@@ -158,85 +158,6 @@ export type OpenworkWorkspaceFileWriteResult = {
158158 revision ?: string ;
159159} ;
160160
161- export type OpenworkFileSession = {
162- id : string ;
163- workspaceId : string ;
164- createdAt : number ;
165- expiresAt : number ;
166- ttlMs : number ;
167- canWrite : boolean ;
168- } ;
169-
170- export type OpenworkFileCatalogEntry = {
171- path : string ;
172- kind : "file" | "dir" ;
173- size : number ;
174- mtimeMs : number ;
175- revision : string ;
176- } ;
177-
178- export type OpenworkFileSessionEvent = {
179- id : string ;
180- seq : number ;
181- workspaceId : string ;
182- type : "write" | "delete" | "rename" | "mkdir" ;
183- path : string ;
184- toPath ?: string ;
185- revision ?: string ;
186- timestamp : number ;
187- } ;
188-
189- export type OpenworkFileReadBatchResult = {
190- items : Array <
191- | {
192- ok : true ;
193- path : string ;
194- kind : "file" ;
195- bytes : number ;
196- updatedAt : number ;
197- revision : string ;
198- contentBase64 : string ;
199- }
200- | {
201- ok : false ;
202- path : string ;
203- code : string ;
204- message : string ;
205- maxBytes ?: number ;
206- size ?: number ;
207- }
208- > ;
209- } ;
210-
211- export type OpenworkFileWriteBatchResult = {
212- items : Array <
213- | {
214- ok : true ;
215- path : string ;
216- bytes : number ;
217- updatedAt : number ;
218- revision : string ;
219- previousRevision ?: string | null ;
220- }
221- | {
222- ok : false ;
223- path : string ;
224- code : string ;
225- message : string ;
226- expectedRevision ?: string ;
227- currentRevision ?: string | null ;
228- maxBytes ?: number ;
229- size ?: number ;
230- }
231- > ;
232- cursor : number ;
233- } ;
234-
235- export type OpenworkFileOpsBatchResult = {
236- items : Array < Record < string , unknown > > ;
237- cursor : number ;
238- } ;
239-
240161export type OpenworkCommandItem = {
241162 name : string ;
242163 description ?: string ;
@@ -1781,103 +1702,6 @@ export function createOpenworkServerClient(options: { baseUrl: string; token?: s
17811702 { token, hostToken, timeoutMs : timeouts . binary } ,
17821703 ) ,
17831704
1784- createFileSession : ( workspaceId : string , options ?: { ttlSeconds ?: number ; write ?: boolean } ) =>
1785- requestJson < { session : OpenworkFileSession } > ( baseUrl , `/workspace/${ encodeURIComponent ( workspaceId ) } /files/sessions` , {
1786- token,
1787- hostToken,
1788- method : "POST" ,
1789- body : {
1790- ...( typeof options ?. ttlSeconds === "number" ? { ttlSeconds : options . ttlSeconds } : { } ) ,
1791- ...( typeof options ?. write === "boolean" ? { write : options . write } : { } ) ,
1792- } ,
1793- } ) ,
1794-
1795- renewFileSession : ( sessionId : string , options ?: { ttlSeconds ?: number } ) =>
1796- requestJson < { session : OpenworkFileSession } > ( baseUrl , `/files/sessions/${ encodeURIComponent ( sessionId ) } /renew` , {
1797- token,
1798- hostToken,
1799- method : "POST" ,
1800- body : {
1801- ...( typeof options ?. ttlSeconds === "number" ? { ttlSeconds : options . ttlSeconds } : { } ) ,
1802- } ,
1803- } ) ,
1804-
1805- closeFileSession : ( sessionId : string ) =>
1806- requestJson < { ok : boolean } > ( baseUrl , `/files/sessions/${ encodeURIComponent ( sessionId ) } ` , {
1807- token,
1808- hostToken,
1809- method : "DELETE" ,
1810- } ) ,
1811-
1812- getFileCatalogSnapshot : (
1813- sessionId : string ,
1814- options ?: { prefix ?: string ; after ?: string ; includeDirs ?: boolean ; limit ?: number } ,
1815- ) => {
1816- const params = new URLSearchParams ( ) ;
1817- if ( options ?. prefix ?. trim ( ) ) params . set ( "prefix" , options . prefix . trim ( ) ) ;
1818- if ( options ?. after ?. trim ( ) ) params . set ( "after" , options . after . trim ( ) ) ;
1819- if ( typeof options ?. includeDirs === "boolean" ) params . set ( "includeDirs" , options . includeDirs ? "true" : "false" ) ;
1820- if ( typeof options ?. limit === "number" ) params . set ( "limit" , String ( options . limit ) ) ;
1821- const query = params . toString ( ) ;
1822- return requestJson < {
1823- sessionId : string ;
1824- workspaceId : string ;
1825- generatedAt : number ;
1826- cursor : number ;
1827- total : number ;
1828- truncated : boolean ;
1829- nextAfter ?: string ;
1830- items : OpenworkFileCatalogEntry [ ] ;
1831- } > (
1832- baseUrl ,
1833- `/files/sessions/${ encodeURIComponent ( sessionId ) } /catalog/snapshot${ query ? `?${ query } ` : "" } ` ,
1834- { token, hostToken } ,
1835- ) ;
1836- } ,
1837-
1838- listFileSessionEvents : ( sessionId : string , options ?: { since ?: number } ) => {
1839- const query = typeof options ?. since === "number" ? `?since=${ encodeURIComponent ( String ( options . since ) ) } ` : "" ;
1840- return requestJson < { items : OpenworkFileSessionEvent [ ] ; cursor : number } > (
1841- baseUrl ,
1842- `/files/sessions/${ encodeURIComponent ( sessionId ) } /catalog/events${ query } ` ,
1843- { token, hostToken } ,
1844- ) ;
1845- } ,
1846-
1847- readFileBatch : ( sessionId : string , paths : string [ ] ) =>
1848- requestJson < OpenworkFileReadBatchResult > ( baseUrl , `/files/sessions/${ encodeURIComponent ( sessionId ) } /read-batch` , {
1849- token,
1850- hostToken,
1851- method : "POST" ,
1852- body : { paths } ,
1853- } ) ,
1854-
1855- writeFileBatch : (
1856- sessionId : string ,
1857- writes : Array < { path : string ; contentBase64 : string ; ifMatchRevision ?: string ; force ?: boolean } > ,
1858- ) =>
1859- requestJson < OpenworkFileWriteBatchResult > ( baseUrl , `/files/sessions/${ encodeURIComponent ( sessionId ) } /write-batch` , {
1860- token,
1861- hostToken,
1862- method : "POST" ,
1863- body : { writes } ,
1864- } ) ,
1865-
1866- runFileBatchOps : (
1867- sessionId : string ,
1868- operations : Array <
1869- | { type : "mkdir" ; path : string }
1870- | { type : "delete" ; path : string ; recursive ?: boolean }
1871- | { type : "rename" ; from : string ; to : string }
1872- > ,
1873- ) =>
1874- requestJson < OpenworkFileOpsBatchResult > ( baseUrl , `/files/sessions/${ encodeURIComponent ( sessionId ) } /ops` , {
1875- token,
1876- hostToken,
1877- method : "POST" ,
1878- body : { operations } ,
1879- } ) ,
1880-
18811705 readWorkspaceFile : ( workspaceId : string , path : string ) =>
18821706 requestJson < OpenworkWorkspaceFileContent > (
18831707 baseUrl ,
0 commit comments