@b3os/sdk 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/core/util.d.ts +1 -1
  3. package/dist/cjs/core/util.js +1 -1
  4. package/dist/cjs/generated/client.d.ts +5 -0
  5. package/dist/cjs/generated/client.js +9 -0
  6. package/dist/cjs/generated/client.js.map +1 -1
  7. package/dist/cjs/generated/errors.d.ts +1 -1
  8. package/dist/cjs/generated/errors.js +45 -0
  9. package/dist/cjs/generated/errors.js.map +1 -1
  10. package/dist/cjs/generated/ids.d.ts +28 -0
  11. package/dist/cjs/generated/ids.js +7 -0
  12. package/dist/cjs/generated/ids.js.map +1 -1
  13. package/dist/cjs/generated/ns/agents.d.ts +438 -11
  14. package/dist/cjs/generated/ns/agents.js +598 -11
  15. package/dist/cjs/generated/ns/agents.js.map +1 -1
  16. package/dist/cjs/generated/ns/images.d.ts +84 -3
  17. package/dist/cjs/generated/ns/images.js +126 -2
  18. package/dist/cjs/generated/ns/images.js.map +1 -1
  19. package/dist/cjs/generated/ns/listeners.d.ts +6 -2
  20. package/dist/cjs/generated/ns/listeners.js +6 -2
  21. package/dist/cjs/generated/ns/listeners.js.map +1 -1
  22. package/dist/cjs/generated/ns/routines.d.ts +11 -0
  23. package/dist/cjs/generated/ns/routines.js +11 -0
  24. package/dist/cjs/generated/ns/routines.js.map +1 -1
  25. package/dist/cjs/generated/ns/sandboxes.d.ts +140 -1
  26. package/dist/cjs/generated/ns/sandboxes.js +190 -1
  27. package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
  28. package/dist/cjs/generated/ns/vision.d.ts +55 -1
  29. package/dist/cjs/generated/ns/vision.js +94 -1
  30. package/dist/cjs/generated/ns/vision.js.map +1 -1
  31. package/dist/cjs/generated/ns/workspaces.d.ts +225 -0
  32. package/dist/cjs/generated/ns/workspaces.js +410 -0
  33. package/dist/cjs/generated/ns/workspaces.js.map +1 -0
  34. package/dist/cjs/generated/types.d.ts +2230 -72
  35. package/dist/esm/core/util.d.ts +1 -1
  36. package/dist/esm/core/util.js +1 -1
  37. package/dist/esm/generated/client.d.ts +5 -0
  38. package/dist/esm/generated/client.js +9 -0
  39. package/dist/esm/generated/client.js.map +1 -1
  40. package/dist/esm/generated/errors.d.ts +1 -1
  41. package/dist/esm/generated/errors.js +45 -0
  42. package/dist/esm/generated/errors.js.map +1 -1
  43. package/dist/esm/generated/ids.d.ts +28 -0
  44. package/dist/esm/generated/ids.js +7 -0
  45. package/dist/esm/generated/ids.js.map +1 -1
  46. package/dist/esm/generated/ns/agents.d.ts +438 -11
  47. package/dist/esm/generated/ns/agents.js +598 -11
  48. package/dist/esm/generated/ns/agents.js.map +1 -1
  49. package/dist/esm/generated/ns/images.d.ts +84 -3
  50. package/dist/esm/generated/ns/images.js +126 -2
  51. package/dist/esm/generated/ns/images.js.map +1 -1
  52. package/dist/esm/generated/ns/listeners.d.ts +6 -2
  53. package/dist/esm/generated/ns/listeners.js +6 -2
  54. package/dist/esm/generated/ns/listeners.js.map +1 -1
  55. package/dist/esm/generated/ns/routines.d.ts +11 -0
  56. package/dist/esm/generated/ns/routines.js +11 -0
  57. package/dist/esm/generated/ns/routines.js.map +1 -1
  58. package/dist/esm/generated/ns/sandboxes.d.ts +140 -1
  59. package/dist/esm/generated/ns/sandboxes.js +190 -1
  60. package/dist/esm/generated/ns/sandboxes.js.map +1 -1
  61. package/dist/esm/generated/ns/vision.d.ts +55 -1
  62. package/dist/esm/generated/ns/vision.js +94 -1
  63. package/dist/esm/generated/ns/vision.js.map +1 -1
  64. package/dist/esm/generated/ns/workspaces.d.ts +225 -0
  65. package/dist/esm/generated/ns/workspaces.js +406 -0
  66. package/dist/esm/generated/ns/workspaces.js.map +1 -0
  67. package/dist/esm/generated/types.d.ts +2230 -72
  68. package/package.json +1 -1
  69. package/src/core/util.ts +1 -1
  70. package/src/generated/client.ts +10 -0
  71. package/src/generated/errors.ts +90 -0
  72. package/src/generated/ids.ts +7 -0
  73. package/src/generated/ns/agents.ts +652 -11
  74. package/src/generated/ns/images.ts +131 -3
  75. package/src/generated/ns/listeners.ts +6 -2
  76. package/src/generated/ns/routines.ts +11 -0
  77. package/src/generated/ns/sandboxes.ts +203 -1
  78. package/src/generated/ns/vision.ts +101 -1
  79. package/src/generated/ns/workspaces.ts +448 -0
  80. package/src/generated/types.ts +2416 -48
@@ -0,0 +1,448 @@
1
+ // Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
2
+
3
+ import type { RequestOptions } from "../../core/client.ts";
4
+ import { Namespace } from "../../core/namespace.ts";
5
+ import type { Op } from "../../core/op.ts";
6
+ import type { APIPromise, ListPromise } from "../../core/promise.ts";
7
+ import type * as T from "../types.ts";
8
+
9
+ const listWorkspacesOp: Op = {
10
+ id: "workspacesListWorkspaces",
11
+ method: "GET",
12
+ path: "/v1/workspaces",
13
+ timeoutMs: 10000,
14
+ stretch: true,
15
+ scope: "workspaces:read",
16
+ };
17
+ const createWorkspaceOp: Op = {
18
+ id: "workspacesCreateWorkspace",
19
+ method: "POST",
20
+ path: "/v1/workspaces",
21
+ body: "json",
22
+ idem: true,
23
+ timeoutMs: 10000,
24
+ stretch: true,
25
+ scope: "workspaces:write",
26
+ };
27
+ const deleteWorkspaceOp: Op = {
28
+ id: "workspacesDeleteWorkspace",
29
+ method: "DELETE",
30
+ path: "/v1/workspaces/{workspace_id}",
31
+ params: ["workspace_id"],
32
+ timeoutMs: 10000,
33
+ stretch: true,
34
+ scope: "workspaces:write",
35
+ };
36
+ const getWorkspaceOp: Op = {
37
+ id: "workspacesGetWorkspace",
38
+ method: "GET",
39
+ path: "/v1/workspaces/{workspace_id}",
40
+ params: ["workspace_id"],
41
+ timeoutMs: 10000,
42
+ stretch: true,
43
+ scope: "workspaces:read",
44
+ };
45
+ const listBranchesOp: Op = {
46
+ id: "workspacesListBranches",
47
+ method: "GET",
48
+ path: "/v1/workspaces/{workspace_id}/branches",
49
+ params: ["workspace_id"],
50
+ timeoutMs: 10000,
51
+ stretch: true,
52
+ scope: "workspaces:read",
53
+ };
54
+ const createBranchOp: Op = {
55
+ id: "workspacesCreateBranch",
56
+ method: "POST",
57
+ path: "/v1/workspaces/{workspace_id}/branches",
58
+ params: ["workspace_id"],
59
+ body: "json",
60
+ idem: true,
61
+ timeoutMs: 10000,
62
+ stretch: true,
63
+ scope: "workspaces:run",
64
+ };
65
+ const deleteBranchOp: Op = {
66
+ id: "workspacesDeleteBranch",
67
+ method: "DELETE",
68
+ path: "/v1/workspaces/{workspace_id}/branches/{branch_id}",
69
+ params: ["workspace_id", "branch_id"],
70
+ timeoutMs: 10000,
71
+ stretch: true,
72
+ scope: "workspaces:run",
73
+ };
74
+ const getBranchOp: Op = {
75
+ id: "workspacesGetBranch",
76
+ method: "GET",
77
+ path: "/v1/workspaces/{workspace_id}/branches/{branch_id}",
78
+ params: ["workspace_id", "branch_id"],
79
+ timeoutMs: 10000,
80
+ stretch: true,
81
+ scope: "workspaces:read",
82
+ };
83
+ const commitOp: Op = {
84
+ id: "workspacesCommit",
85
+ method: "POST",
86
+ path: "/v1/workspaces/{workspace_id}/branches/{branch_id}/commits",
87
+ params: ["workspace_id", "branch_id"],
88
+ body: "json",
89
+ idem: true,
90
+ timeoutMs: 60000,
91
+ stretch: true,
92
+ scope: "workspaces:run",
93
+ };
94
+ const mergeOp: Op = {
95
+ id: "workspacesMerge",
96
+ method: "POST",
97
+ path: "/v1/workspaces/{workspace_id}/branches/{branch_id}/merge",
98
+ params: ["workspace_id", "branch_id"],
99
+ body: "json",
100
+ idem: true,
101
+ timeoutMs: 60000,
102
+ stretch: true,
103
+ scope: "workspaces:run",
104
+ };
105
+ const listCommitsOp: Op = {
106
+ id: "workspacesListCommits",
107
+ method: "GET",
108
+ path: "/v1/workspaces/{workspace_id}/commits",
109
+ params: ["workspace_id"],
110
+ timeoutMs: 10000,
111
+ stretch: true,
112
+ scope: "workspaces:read",
113
+ };
114
+ const getCommitOp: Op = {
115
+ id: "workspacesGetCommit",
116
+ method: "GET",
117
+ path: "/v1/workspaces/{workspace_id}/commits/{commit_id}",
118
+ params: ["workspace_id", "commit_id"],
119
+ timeoutMs: 10000,
120
+ stretch: true,
121
+ scope: "workspaces:read",
122
+ };
123
+ const diffOp: Op = {
124
+ id: "workspacesDiff",
125
+ method: "GET",
126
+ path: "/v1/workspaces/{workspace_id}/diff",
127
+ params: ["workspace_id"],
128
+ timeoutMs: 30000,
129
+ stretch: true,
130
+ scope: "workspaces:read",
131
+ };
132
+ const listFilesOp: Op = {
133
+ id: "workspacesListFiles",
134
+ method: "GET",
135
+ path: "/v1/workspaces/{workspace_id}/files",
136
+ params: ["workspace_id"],
137
+ timeoutMs: 10000,
138
+ stretch: true,
139
+ scope: "workspaces:read",
140
+ };
141
+ const readFileOp: Op = {
142
+ id: "workspacesReadFile",
143
+ method: "GET",
144
+ path: "/v1/workspaces/{workspace_id}/files/content",
145
+ params: ["workspace_id"],
146
+ timeoutMs: 30000,
147
+ stretch: true,
148
+ scope: "workspaces:read",
149
+ };
150
+ const putRulesOp: Op = {
151
+ id: "workspacesPutRules",
152
+ method: "PUT",
153
+ path: "/v1/workspaces/{workspace_id}/rules",
154
+ params: ["workspace_id"],
155
+ body: "json",
156
+ timeoutMs: 10000,
157
+ stretch: true,
158
+ scope: "workspaces:rules:write",
159
+ };
160
+
161
+ /** Descriptors of every workspaces operation, keyed by method name (for tooling and custom clients). */
162
+ export const workspacesOps = {
163
+ listWorkspaces: listWorkspacesOp,
164
+ createWorkspace: createWorkspaceOp,
165
+ deleteWorkspace: deleteWorkspaceOp,
166
+ getWorkspace: getWorkspaceOp,
167
+ listBranches: listBranchesOp,
168
+ createBranch: createBranchOp,
169
+ deleteBranch: deleteBranchOp,
170
+ getBranch: getBranchOp,
171
+ commit: commitOp,
172
+ merge: mergeOp,
173
+ listCommits: listCommitsOp,
174
+ getCommit: getCommitOp,
175
+ diff: diffOp,
176
+ listFiles: listFilesOp,
177
+ readFile: readFileOp,
178
+ putRules: putRulesOp,
179
+ } as const;
180
+
181
+ /**
182
+ * Workspaces: file trees with git-compatible history, a branch per agent, commits checked against per-path rules, and merges that report every conflict (`/v1/workspaces`).
183
+ */
184
+ export class WorkspacesAPI extends Namespace {
185
+ /**
186
+ * List workspaces
187
+ *
188
+ * Lists this project's workspaces, newest first. Deleted workspaces are not listed.
189
+ *
190
+ * `GET /v1/workspaces` · scope `workspaces:read` · served by the node
191
+ *
192
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
193
+ */
194
+ listWorkspaces(
195
+ params?: T.WorkspacesListWorkspacesParams,
196
+ options?: RequestOptions,
197
+ ): ListPromise<T.WorkspaceList, T.Workspace> {
198
+ return this._client._list<T.WorkspaceList, T.Workspace>(listWorkspacesOp, { query: params }, options);
199
+ }
200
+
201
+ /**
202
+ * Create a workspace
203
+ *
204
+ * Creates an empty workspace with one branch, `main`, protected: merging into `main` needs `workspaces:write`,
205
+ * so agents (whose grants hold `workspaces:run` unless they name more) merge into their own branches and a
206
+ * person or a routine promotes. `rules` are optional; a workspace without rules is open to the whole project,
207
+ * like every other B3OS object. Setting rules later needs `workspaces:rules:write`.
208
+ *
209
+ * `POST /v1/workspaces` · scope `workspaces:write` · served by the node
210
+ *
211
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
212
+ */
213
+ createWorkspace(body: T.WorkspaceCreateRequest, options?: RequestOptions): APIPromise<T.Workspace> {
214
+ return this._client._call<T.Workspace>(createWorkspaceOp, { body }, options);
215
+ }
216
+
217
+ /**
218
+ * Delete a workspace
219
+ *
220
+ * Deletes the workspace, its branches and its history. A branch mounted into a sandbox or an agent instance
221
+ * answers `409 branch_held` until it is released. Only this call removes a workspace's data: no expiry, deploy
222
+ * or cleanup does.
223
+ *
224
+ * `DELETE /v1/workspaces/{workspace_id}` · scope `workspaces:write` · served by the node
225
+ *
226
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
227
+ */
228
+ deleteWorkspace(workspaceId: string, options?: RequestOptions): APIPromise<T.Deleted> {
229
+ return this._client._call<T.Deleted>(deleteWorkspaceOp, { path: [workspaceId] }, options);
230
+ }
231
+
232
+ /**
233
+ * Get a workspace
234
+ *
235
+ * Returns one of this project's workspaces, with its rules, the head of `main` and its usage.
236
+ *
237
+ * `GET /v1/workspaces/{workspace_id}` · scope `workspaces:read` · served by the node
238
+ *
239
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
240
+ */
241
+ getWorkspace(workspaceId: string, options?: RequestOptions): APIPromise<T.Workspace> {
242
+ return this._client._call<T.Workspace>(getWorkspaceOp, { path: [workspaceId] }, options);
243
+ }
244
+
245
+ /**
246
+ * List branches
247
+ *
248
+ * Lists the workspace's branches, newest first, open ones unless `status` says otherwise.
249
+ *
250
+ * `GET /v1/workspaces/{workspace_id}/branches` · scope `workspaces:read` · served by the node
251
+ *
252
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
253
+ */
254
+ listBranches(
255
+ workspaceId: string,
256
+ params?: T.WorkspacesListBranchesParams,
257
+ options?: RequestOptions,
258
+ ): ListPromise<T.BranchList, T.Branch> {
259
+ return this._client._list<T.BranchList, T.Branch>(listBranchesOp, { path: [workspaceId], query: params }, options);
260
+ }
261
+
262
+ /**
263
+ * Create a branch
264
+ *
265
+ * Makes a branch from a branch's head or from a commit (`from`, `main` by default). No data is copied: the
266
+ * branch starts at that commit. Without a `name` the branch is ephemeral and expires `ttl_s` after its creation
267
+ * (7 days by default) unless it was merged; with one it is kept until it is deleted.
268
+ *
269
+ * `POST /v1/workspaces/{workspace_id}/branches` · scope `workspaces:run` · served by the node
270
+ *
271
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
272
+ */
273
+ createBranch(workspaceId: string, body: T.BranchCreateRequest, options?: RequestOptions): APIPromise<T.Branch> {
274
+ return this._client._call<T.Branch>(createBranchOp, { path: [workspaceId], body }, options);
275
+ }
276
+
277
+ /**
278
+ * Delete a branch
279
+ *
280
+ * Closes the branch. Its commits stay in the history while another branch reaches them, and for
281
+ * `workspaces.history_days` after that. `main` cannot be deleted, and a mounted branch answers `409 branch_held`.
282
+ *
283
+ * `DELETE /v1/workspaces/{workspace_id}/branches/{branch_id}` · scope `workspaces:run` · served by the node
284
+ *
285
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
286
+ */
287
+ deleteBranch(workspaceId: string, branchId: string, options?: RequestOptions): APIPromise<T.Deleted> {
288
+ return this._client._call<T.Deleted>(deleteBranchOp, { path: [workspaceId, branchId] }, options);
289
+ }
290
+
291
+ /**
292
+ * Get a branch
293
+ *
294
+ * Returns one branch: its base and head commits, whether it is protected, and what holds it mounted.
295
+ *
296
+ * `GET /v1/workspaces/{workspace_id}/branches/{branch_id}` · scope `workspaces:read` · served by the node
297
+ *
298
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
299
+ */
300
+ getBranch(workspaceId: string, branchId: string, options?: RequestOptions): APIPromise<T.Branch> {
301
+ return this._client._call<T.Branch>(getBranchOp, { path: [workspaceId, branchId] }, options);
302
+ }
303
+
304
+ /**
305
+ * Commit to a branch
306
+ *
307
+ * Adds a commit on top of the branch's head from a list of files to write or delete. Every path is checked
308
+ * before anything is stored: a path the caller's principals may not write (or may not see) refuses the whole
309
+ * commit with `403 path_not_writable`, an `append_only` file that loses bytes with `422 append_only_violation`,
310
+ * and a file that holds a credential (B3OS keys, common provider tokens, private keys) with
311
+ * `422 secret_in_commit`, which names the path and line and never the value. `if_head` makes the commit apply
312
+ * only while the branch's head is still that commit (`409 head_moved` otherwise). Writing the same bytes a path
313
+ * already holds changes nothing; a commit that changes nothing answers the current head.
314
+ *
315
+ * From inside a sandbox that holds the branch (created with `workspaces`), send no `files`: the node reads what
316
+ * the sandbox changed under the branch's path (new and changed files, deletes, replaced folders), takes from the
317
+ * sandbox only the contents that differ from the head, and commits them as the sandbox, with the same checks.
318
+ * That call needs no workspaces scope: holding the branch is the authority for it, and for nothing else. A
319
+ * sandbox naming another branch is `403 forbidden` (reason `sandbox`), and a file that changes while the commit
320
+ * reads it is `409 conflict` (commit again). Uncommitted changes stay in the sandbox; the next commit sends only
321
+ * what changed since.
322
+ *
323
+ * `POST /v1/workspaces/{workspace_id}/branches/{branch_id}/commits` · scope `workspaces:run` · served by the node
324
+ *
325
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
326
+ */
327
+ commit(workspaceId: string, branchId: string, body: T.CommitRequest, options?: RequestOptions): APIPromise<T.Commit> {
328
+ return this._client._call<T.Commit>(commitOp, { path: [workspaceId, branchId], body }, options);
329
+ }
330
+
331
+ /**
332
+ * Merge a branch into another
333
+ *
334
+ * Merges the branch into `into` (a branch name or ID, `main` by default) with a three-way merge against their
335
+ * merge base, and answers the target's new head. Paths changed on one side only merge without reading their
336
+ * content; a path changed on both sides merges line by line when both are text, and is a conflict when the
337
+ * changes overlap, when either is binary, or when one side deleted it. A conflict answers
338
+ * `409 merge_conflict` with every conflict (path, kind and the three blob IDs) and changes nothing.
339
+ * `mode: paths` makes any path changed on both sides a conflict. Merging into a protected branch (`main` by
340
+ * default) needs `workspaces:write`.
341
+ *
342
+ * `POST /v1/workspaces/{workspace_id}/branches/{branch_id}/merge` · scope `workspaces:run` · served by the node
343
+ *
344
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
345
+ */
346
+ merge(
347
+ workspaceId: string,
348
+ branchId: string,
349
+ body: T.MergeRequest,
350
+ options?: RequestOptions,
351
+ ): APIPromise<T.MergeResult> {
352
+ return this._client._call<T.MergeResult>(mergeOp, { path: [workspaceId, branchId], body }, options);
353
+ }
354
+
355
+ /**
356
+ * List commits
357
+ *
358
+ * Lists the commits a branch reaches (`branch_id`, else `main`), newest first.
359
+ *
360
+ * `GET /v1/workspaces/{workspace_id}/commits` · scope `workspaces:read` · served by the node
361
+ *
362
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
363
+ */
364
+ listCommits(
365
+ workspaceId: string,
366
+ params?: T.WorkspacesListCommitsParams,
367
+ options?: RequestOptions,
368
+ ): ListPromise<T.CommitList, T.Commit> {
369
+ return this._client._list<T.CommitList, T.Commit>(listCommitsOp, { path: [workspaceId], query: params }, options);
370
+ }
371
+
372
+ /**
373
+ * Get a commit
374
+ *
375
+ * Returns one commit of the workspace, with its parents, its git IDs and the principals behind it.
376
+ *
377
+ * `GET /v1/workspaces/{workspace_id}/commits/{commit_id}` · scope `workspaces:read` · served by the node
378
+ *
379
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
380
+ */
381
+ getCommit(workspaceId: string, commitId: string, options?: RequestOptions): APIPromise<T.Commit> {
382
+ return this._client._call<T.Commit>(getCommitOp, { path: [workspaceId, commitId] }, options);
383
+ }
384
+
385
+ /**
386
+ * Diff two commits
387
+ *
388
+ * The paths that differ between `base` and `head` (commit IDs or branch names), each added, modified, deleted or
389
+ * changed type, with sizes, read from the trees without walking any files. Only paths the caller may read are
390
+ * listed. `path` limits the answer to one directory.
391
+ *
392
+ * `GET /v1/workspaces/{workspace_id}/diff` · scope `workspaces:read` · served by the node
393
+ *
394
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
395
+ */
396
+ diff(workspaceId: string, params: T.WorkspacesDiffParams, options?: RequestOptions): APIPromise<T.WorkspaceDiff> {
397
+ return this._client._call<T.WorkspaceDiff>(diffOp, { path: [workspaceId], query: params }, options);
398
+ }
399
+
400
+ /**
401
+ * List files
402
+ *
403
+ * Lists a directory at `ref` (a commit ID or a branch name; `main` by default), or describes one file. Only
404
+ * paths the caller may read are listed; any other path answers `404 workspace_path_not_found`, as a path that
405
+ * does not exist does.
406
+ *
407
+ * `GET /v1/workspaces/{workspace_id}/files` · scope `workspaces:read` · served by the node
408
+ *
409
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
410
+ */
411
+ listFiles(
412
+ workspaceId: string,
413
+ params?: T.WorkspacesListFilesParams,
414
+ options?: RequestOptions,
415
+ ): APIPromise<T.WorkspaceEntryList> {
416
+ return this._client._call<T.WorkspaceEntryList>(listFilesOp, { path: [workspaceId], query: params }, options);
417
+ }
418
+
419
+ /**
420
+ * Read a file
421
+ *
422
+ * The bytes of one file at `ref` (a commit ID or a branch name; `main` by default), if the caller may read it.
423
+ *
424
+ * `GET /v1/workspaces/{workspace_id}/files/content` · scope `workspaces:read` · served by the node
425
+ *
426
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
427
+ */
428
+ readFile(workspaceId: string, params: T.WorkspacesReadFileParams, options?: RequestOptions): APIPromise<Uint8Array> {
429
+ return this._client._call<Uint8Array>(readFileOp, { path: [workspaceId], query: params }, options, "*/*", "bytes");
430
+ }
431
+
432
+ /**
433
+ * Replace a workspace's rules
434
+ *
435
+ * Replaces the ordered list of path rules. The last rule that matches a path decides it; a principal may read
436
+ * (or write) a path only when the agent, the human and whoever started the turn are all allowed by it. A rule
437
+ * with `append_only` lets a commit only add bytes at the end of a matching file. New rules bind every commit
438
+ * from now on. Needs `workspaces:rules:write`, which a sandbox's grant holds only when it names it exactly, so an
439
+ * agent never changes the rules that bind it.
440
+ *
441
+ * `PUT /v1/workspaces/{workspace_id}/rules` · scope `workspaces:rules:write` · served by the node
442
+ *
443
+ * Stretch: in the contract, but may answer `501 not_implemented` on this deployment.
444
+ */
445
+ putRules(workspaceId: string, body: T.WorkspaceRulesRequest, options?: RequestOptions): APIPromise<T.Workspace> {
446
+ return this._client._call<T.Workspace>(putRulesOp, { path: [workspaceId], body }, options);
447
+ }
448
+ }