@tangle-network/sandbox 0.63.20 → 0.63.22

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 (65) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +5 -5
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +2 -2
  5. package/dist/{agent-run-outcome-DlYhZnhD.d.ts → agent-run-outcome-C-VR-L0I.d.ts} +1 -1
  6. package/dist/auth/index.d.ts +2 -2
  7. package/dist/auth/index.js +1 -1
  8. package/dist/{backend-types-D6bYbvMB.js → backend-types-zuUBEJO1.js} +35 -1
  9. package/dist/{browser-interactive-control-controller-B6sySQFu.d.ts → browser-interactive-control-controller-CvObO_Kf.d.ts} +1 -1
  10. package/dist/{browser-interactive-control-controller-BJf0P_J4.js → browser-interactive-control-controller-DHx53yre.js} +16 -1
  11. package/dist/{chunked-upload-KJyRCAiC.js → chunked-upload-DN2twsUu.js} +1 -1
  12. package/dist/{chunked-upload-file-DfiGzqaR.js → chunked-upload-file-Dpv1YsoA.js} +2 -2
  13. package/dist/{cli-auth-bundle-CMgB8Ec3.js → cli-auth-bundle-R0Y7rngn.js} +8 -8
  14. package/dist/{client-Dl22CVOz.js → client-CGcWP4FX.js} +3271 -3271
  15. package/dist/client-CqpKC6n3.d.ts +6066 -0
  16. package/dist/collaboration/index.d.ts +1 -1
  17. package/dist/collaboration/index.js +1 -1
  18. package/dist/{collaboration-XHg5BEUI.js → collaboration-g_HzXa6f.js} +1 -1
  19. package/dist/core.d.ts +6 -7
  20. package/dist/core.js +5 -5
  21. package/dist/{direct-http2-Dq7tq6jV.js → direct-http2-CoGVOqVR.js} +1 -1
  22. package/dist/{errors-AB5BD3FM.js → errors-BfbOP_rx.js} +19 -1
  23. package/dist/{sandbox-DDdPhk2j.d.ts → index-D4OBUP5M.d.ts} +2105 -1461
  24. package/dist/index.d.ts +12 -4747
  25. package/dist/index.js +15 -11
  26. package/dist/intelligence/index.js +1 -1
  27. package/dist/interactive-control.d.ts +1 -1
  28. package/dist/interactive-control.js +1 -1
  29. package/dist/{interactive-controller-BSWoA0YE.d.ts → interactive-controller-BBwB_5QQ.d.ts} +3 -2
  30. package/dist/{interactive-controller-zE6hwv3C.js → interactive-controller-D4N4zqmu.js} +578 -610
  31. package/dist/{lines-hsXVdk60.d.ts → lines-5m11CEj-.d.ts} +21 -17
  32. package/dist/lines-C5ER4aN_.js +298 -0
  33. package/dist/lines.d.ts +1 -1
  34. package/dist/lines.js +1 -295
  35. package/dist/{local-cli-auth-C4QcPdZt.js → local-cli-auth-DVUBOY4y.js} +1 -1
  36. package/dist/{mcp-local-BYHcA72Z.js → mcp-local-BjLG7VHY.js} +1 -1
  37. package/dist/{preview-D8UAF7F9.d.ts → preview-CcJBQSjB.d.ts} +3 -3
  38. package/dist/{public-templates-BP3sTaSb.d.ts → public-templates-nv4AFFVc.d.ts} +2 -2
  39. package/dist/public-templates.d.ts +1 -1
  40. package/dist/public-templates.js +1 -1
  41. package/dist/runtime.d.ts +47 -40
  42. package/dist/runtime.js +4 -4
  43. package/dist/{sandbox-BJkpVtLN.js → sandbox-BDgvO9Z3.js} +9256 -9215
  44. package/dist/{secp256k1-DoWlH6ff.js → secp256k1-CmLpsmWl.js} +1 -1
  45. package/dist/session-gateway/index.d.ts +16 -17
  46. package/dist/session-gateway/index.js +20 -23
  47. package/dist/tangle/index.d.ts +1 -1
  48. package/dist/tangle/index.js +1 -1
  49. package/dist/{tangle-BBpguPfj.js → tangle-D-VfQGTu.js} +144 -138
  50. package/dist/terminal-stream-types-ClZCArRg.d.ts +662 -0
  51. package/dist/{types-BxZX2EVj.d.ts → types-BjyQe_CI.d.ts} +393 -315
  52. package/package.json +6 -6
  53. package/dist/client-DraGbXEP.d.ts +0 -1249
  54. package/dist/error-classes-BWS1a9HO.d.ts +0 -321
  55. package/dist/index-xS3mRl69.d.ts +0 -578
  56. package/dist/managed-process-B-pXdMLC.d.ts +0 -15
  57. package/dist/terminal-stream-DgD7GlFi.d.ts +0 -388
  58. /package/dist/{cli-auth-bundle-BKsrsbxy.d.ts → cli-auth-bundle-Dyw3hCGx.d.ts} +0 -0
  59. /package/dist/{index-DfA_usrZ.d.ts → index-C8VSFtWl.d.ts} +0 -0
  60. /package/dist/{index-CWUW8pqr.d.ts → index-CVjTnRWP.d.ts} +0 -0
  61. /package/dist/{keep-alive-fetch-CXvfSczd.js → keep-alive-fetch-CuwGi7gz.js} +0 -0
  62. /package/dist/{line-application-UtPFP0o4.js → line-application-DY9ZTdgF.js} +0 -0
  63. /package/dist/{preview-operations-Bvo5YcIq.js → preview-operations-Ca02vPDJ.js} +0 -0
  64. /package/dist/{raw-evidence-archive-Bxk6fUjS.js → raw-evidence-archive-CDYDqHNv.js} +0 -0
  65. /package/dist/{utils-B6gap92T.js → utils-BGvM02yJ.js} +0 -0
package/dist/lines.js CHANGED
@@ -1,296 +1,2 @@
1
- import { t as parseErrorResponse, w as ValidationError } from "./errors-AB5BD3FM.js";
2
- //#region src/lines.ts
3
- /**
4
- * Lines: give a sandbox a phone number or messaging address.
5
- *
6
- * A line is an address that Tangle Hub receives on, such as an Inkbox
7
- * iMessage identity or Linq WhatsApp number. Attaching it to a sandbox makes
8
- * Hub route each inbound message to that sandbox. Each member gets a separate
9
- * thread in its own agent session. Hub sends the agent's answer on the same
10
- * line. Hub owns routing, consent (STOP/START), unknown senders and
11
- * metering, so an app only chooses who may text and in which mode.
12
- *
13
- * @example
14
- * ```ts
15
- * const line = await client.lines.fromConnection({ connectionId, transport: "imessage" });
16
- * await box.lines.attach({
17
- * number: line.id,
18
- * mode: "personal",
19
- * members: [{ address: "+15550100001", role: "owner" }],
20
- * });
21
- * // Text `line.connect` to `line.routerAddress`, then write to the agent.
22
- * ```
23
- *
24
- * A line can also give every member their own sandbox, so a public line
25
- * serves each person from an isolated box with its own files:
26
- *
27
- * ```ts
28
- * await client.lines.attach({
29
- * number: line.id,
30
- * mode: "shared",
31
- * members: [{ address: "+15550100001", role: "owner" }],
32
- * unknownSenders: "guest",
33
- * roles: { owner: { context: "own", tools: "act" }, guest: { context: "own", tools: "act" } },
34
- * instance: { keyPrefix: "person:", create: { idleTimeoutSeconds: 600 } },
35
- * });
36
- * ```
37
- */
38
- /**
39
- * The instance key that serves one member: `keyPrefix` plus the first 32 hex
40
- * characters of the SHA-256 of the member's address as Hub stores it (E.164,
41
- * or a lowercased email). It depends only on the prefix and the address, so a
42
- * person keeps their box across re-attaches, and your own code can reach it
43
- * with `client.instances.ensure({ key })`. This helper applies only to
44
- * address-bound members. Hub derives a different key for `subjectId` members.
45
- */
46
- async function lineInstanceKey(keyPrefix, address) {
47
- const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(address));
48
- return `${keyPrefix}${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 32)}`;
49
- }
50
- /** Stable setup retry identity. This label never grants profile or line access. */
51
- async function profileChannelReference(profileId, input) {
52
- if (!/^ap_[A-Za-z0-9_-]{1,61}$/.test(profileId)) throw new ValidationError("Use a stored Platform profile ID");
53
- const identity = JSON.stringify([
54
- input.connectionId,
55
- input.transport,
56
- input.phoneNumberId ?? null,
57
- input.address?.trim().toLowerCase() ?? null
58
- ]);
59
- const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(identity));
60
- return `profile:${profileId}:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 32)}`;
61
- }
62
- const LINE_ID = /^ln_[A-Za-z0-9_-]+$/;
63
- async function hubData(response) {
64
- const body = await response.text();
65
- if (!response.ok) throw parseErrorResponse(response.status, body, void 0, response.headers);
66
- const parsed = JSON.parse(body);
67
- if (parsed.success !== true || parsed.data === void 0) throw parseErrorResponse(502, body, void 0, response.headers);
68
- return parsed.data;
69
- }
70
- function json(method, body) {
71
- return {
72
- method,
73
- headers: { "Content-Type": "application/json" },
74
- body: JSON.stringify(body)
75
- };
76
- }
77
- /** `client.lines`: your lines, their members and their threads. */
78
- var LinesClient = class {
79
- constructor(http) {
80
- this.http = http;
81
- }
82
- /**
83
- * Create a line from an owned Inkbox or Linq connection, or return the line
84
- * already pinned to that provider identity. Hub owns inbound routing and
85
- * never re-keys the connection.
86
- */
87
- async fromConnection(input) {
88
- return (await hubData(await this.http.fetch("/v1/lines", json("POST", input)))).line;
89
- }
90
- /** Your lines. `sandboxId` narrows to lines attached to that sandbox. */
91
- async list(options = {}) {
92
- const params = new URLSearchParams();
93
- if (options.sandboxId) params.set("sandboxId", options.sandboxId);
94
- if (options.profileId) params.set("profileId", options.profileId);
95
- const query = params.size ? `?${params}` : "";
96
- return (await hubData(await this.http.fetch(`/v1/lines${query}`))).lines;
97
- }
98
- /** Supported combinations from the maintained host channel catalog. */
99
- async providers() {
100
- return (await hubData(await this.http.fetch("/v1/lines/providers"))).providers;
101
- }
102
- /** Metadata only; no reservation and no provider credentials are returned. */
103
- async numbers(connectionId, transport) {
104
- const params = new URLSearchParams({
105
- connectionId,
106
- transport
107
- });
108
- return hubData(await this.http.fetch(`/v1/lines/numbers?${params}`));
109
- }
110
- /** Choose the payer/execution authority for a cookie-authenticated attachment. */
111
- async executionKeys() {
112
- return (await hubData(await this.http.fetch("/v1/lines/execution-keys"))).keys;
113
- }
114
- async get(lineId) {
115
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`))).line;
116
- }
117
- /** A line id for a line id or one of your lines' addresses. */
118
- async resolve(number) {
119
- if (LINE_ID.test(number)) return number;
120
- const line = (await this.list()).find((l) => l.address === number);
121
- if (!line) throw new ValidationError(`No line with address ${number}`);
122
- return line.id;
123
- }
124
- /** Start a signed Inkbox iMessage owner-handset test for an unattached line. */
125
- async startSenderVerification(number) {
126
- const lineId = await this.resolve(number);
127
- return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/sender-verifications`, json("POST", {})));
128
- }
129
- /** Read proof state with the same owner API key that started the test. */
130
- async getSenderVerification(number, testId) {
131
- if (!/^lsv_[A-Za-z0-9_-]+$/.test(testId)) throw new ValidationError("A valid sender verification id is required");
132
- const lineId = await this.resolve(number);
133
- return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/sender-verifications/${encodeURIComponent(testId)}`));
134
- }
135
- /**
136
- * Attach a line to member sandboxes or one application callback. Hub checks
137
- * the owner key and keeps one active attachment. The callback must resolve
138
- * each declared customer's subject to its own authorized private target.
139
- */
140
- async attach(options) {
141
- const lineId = await this.resolve(options.number);
142
- const { number: _number, ...rest } = options;
143
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, json("PUT", rest)))).attachment;
144
- }
145
- /** Bind the current API key to this same attachment after app key rotation.
146
- * Hub checks the observed attachment and old key, app key lineage, owner,
147
- * workspace and sandbox. A race leaves the existing binding unchanged.
148
- */
149
- async reauthorizeAttachment(number, expected) {
150
- if (!/^lat_[A-Za-z0-9_-]+$/.test(expected.expectedAttachmentId)) throw new ValidationError("A valid expected attachment id is required");
151
- if (!/^key_[A-Za-z0-9_-]+$/.test(expected.expectedRunAsKeyId)) throw new ValidationError("A valid expected execution key id is required");
152
- const lineId = await this.resolve(number);
153
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment/reauthorize`, json("PUT", expected)))).attachment;
154
- }
155
- /**
156
- * Detach a line (by id or address), whatever it is attached to. This is
157
- * the way to detach a line attached with `instance`, which names no
158
- * sandbox. Each member's own sandbox stays under its instance key. Returns
159
- * false when the line was not attached.
160
- */
161
- async detach(number, options = {}) {
162
- if (options.expectedAttachmentId !== void 0 && !/^lat_[A-Za-z0-9_-]+$/.test(options.expectedAttachmentId)) throw new ValidationError("Invalid expected attachment identity");
163
- const lineId = await this.resolve(number);
164
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, {
165
- method: "DELETE",
166
- ...options.expectedAttachmentId ? { headers: { "if-match": `"${options.expectedAttachmentId}"` } } : {}
167
- }))).detached;
168
- }
169
- /** Detach only this observed attachment. A replacement is left untouched.
170
- * The distinct native route makes older hosts refuse rather than ignore
171
- * the condition. This never falls back to unconditional line detachment.
172
- */
173
- async detachAttachment(number, attachmentId) {
174
- if (!/^[A-Za-z0-9_-]{1,256}$/.test(attachmentId)) throw new ValidationError("A valid expected attachment id is required");
175
- const lineId = await this.resolve(number);
176
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachments/${encodeURIComponent(attachmentId)}`, { method: "DELETE" }))).detached;
177
- }
178
- /**
179
- * Retire a detached line's Hub routing and free its workspace transport slot.
180
- * Hub refuses an attached or voice-enabled line. A retry by line id returns
181
- * false; the provider connection and message history remain.
182
- */
183
- async release(number) {
184
- const lineId = await this.resolve(number);
185
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, { method: "DELETE" }))).released;
186
- }
187
- /**
188
- * Take calls for an active Hub line. Without a phone number ID, the line
189
- * must be Inkbox iMessage; Hub changes its call action and adds
190
- * `ask_workspace` to the agent. With an owned ph0ny phone number ID, Hub
191
- * binds that Twilio number to the line's admission hook and leaves the
192
- * line's provider call settings unchanged.
193
- */
194
- async enableVoice(lineId, options) {
195
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: {
196
- enabled: true,
197
- ph0ny: {
198
- connectionId: options.ph0nyConnectionId,
199
- agentId: options.ph0nyAgentId,
200
- ...options.ph0nyPhoneNumberId ? { phoneNumberId: options.ph0nyPhoneNumberId } : {}
201
- }
202
- } })))).line;
203
- }
204
- /** Stop taking calls on a line: Hub refuses them and Inkbox rejects them. */
205
- async disableVoice(lineId) {
206
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: { enabled: false } })))).line;
207
- }
208
- /**
209
- * Queue a proactive message to an active, consenting member. Hub reuses the
210
- * member's authenticated provider conversation, rechecks STOP immediately
211
- * before delivery, and defers delivery during the recipient's saved quiet hours.
212
- */
213
- async send(lineId, input) {
214
- return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/send`, json("POST", input)));
215
- }
216
- /** Read the native outbox receipt. Queued is not a delivery confirmation. */
217
- async sentMessage(lineId, messageId) {
218
- return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/outbox/${encodeURIComponent(messageId)}`));
219
- }
220
- /** Only the recipient's proven message can enable reminders or choose quiet hours. */
221
- async reminders(lineId, memberId) {
222
- return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/members/${encodeURIComponent(memberId)}/reminders`));
223
- }
224
- /** Members of the line's active attachment. */
225
- members(lineId) {
226
- const base = `/v1/lines/${encodeURIComponent(lineId)}/members`;
227
- const http = this.http;
228
- return {
229
- async list() {
230
- return (await hubData(await http.fetch(base))).members;
231
- },
232
- async add(spec) {
233
- return (await hubData(await http.fetch(base, json("POST", spec)))).member;
234
- },
235
- async update(memberId, patch) {
236
- return (await hubData(await http.fetch(`${base}/${encodeURIComponent(memberId)}`, json("PATCH", patch)))).member;
237
- },
238
- async remove(memberId) {
239
- await hubData(await http.fetch(`${base}/${encodeURIComponent(memberId)}`, { method: "DELETE" }));
240
- }
241
- };
242
- }
243
- /** Read one retained message without depending on a recent-message page. */
244
- async message(lineId, messageId) {
245
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/messages/${encodeURIComponent(messageId)}`))).message;
246
- }
247
- /** Threads of a line (one per member) and their messages, newest first. */
248
- threads(lineId) {
249
- const base = `/v1/lines/${encodeURIComponent(lineId)}/threads`;
250
- const http = this.http;
251
- return {
252
- async list() {
253
- return (await hubData(await http.fetch(base))).threads;
254
- },
255
- async messages(threadId) {
256
- return (await hubData(await http.fetch(`${base}/${encodeURIComponent(threadId)}/messages`))).messages;
257
- }
258
- };
259
- }
260
- };
261
- /** `sandbox.lines`: attach lines to this sandbox. */
262
- var SandboxLines = class {
263
- lines;
264
- constructor(http, sandboxId) {
265
- this.http = http;
266
- this.sandboxId = sandboxId;
267
- this.lines = new LinesClient(http);
268
- }
269
- /**
270
- * Attach a line to this sandbox. Hub checks that your API key can run this
271
- * sandbox, and each turn runs as a short-lived child of that key. Attaching
272
- * again with the same options returns the same attachment.
273
- */
274
- async attach(options) {
275
- const lineId = await this.lines.resolve(options.number);
276
- const { number: _number, ...rest } = options;
277
- return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, json("PUT", {
278
- ...rest,
279
- sandboxId: this.sandboxId
280
- })))).attachment;
281
- }
282
- /** Lines attached to this sandbox. */
283
- async list() {
284
- return this.lines.list({ sandboxId: this.sandboxId });
285
- }
286
- /** Detach a line (by id or address) from this sandbox. */
287
- async detach(number) {
288
- const lineId = await this.lines.resolve(number);
289
- const line = await this.lines.get(lineId);
290
- if (!line.attachment) return;
291
- if (line.attachment.sandboxId !== this.sandboxId) throw new ValidationError(`Line ${lineId} is attached to another sandbox`);
292
- await this.lines.detachAttachment(lineId, line.attachment.id);
293
- }
294
- };
295
- //#endregion
1
+ import { i as profileChannelReference, n as SandboxLines, r as lineInstanceKey, t as LinesClient } from "./lines-C5ER4aN_.js";
296
2
  export { LinesClient, SandboxLines, lineInstanceKey, profileChannelReference };
@@ -1,4 +1,4 @@
1
- import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-CMgB8Ec3.js";
1
+ import { t as AUTH_BUNDLE_PATHS } from "./cli-auth-bundle-R0Y7rngn.js";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { homedir } from "node:os";
@@ -1,4 +1,4 @@
1
- import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-Bvo5YcIq.js";
1
+ import { a as listAgentPreviews, i as getAgentPreview, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "./preview-operations-Ca02vPDJ.js";
2
2
  import { createRequire } from "node:module";
3
3
  //#region \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
@@ -1,6 +1,6 @@
1
- import { n as SandboxInstance } from "./sandbox-DDdPhk2j.js";
2
- import { J as PreviewLinkInfo, R as EnsureDevServerOptions } from "./types-BxZX2EVj.js";
3
- import { i as Sandbox } from "./client-DraGbXEP.js";
1
+ import { O as SandboxInstance } from "./index-D4OBUP5M.js";
2
+ import { I as EnsureDevServerOptions, U as PreviewLinkInfo } from "./types-BjyQe_CI.js";
3
+ import { t as Sandbox } from "./client-CqpKC6n3.js";
4
4
 
5
5
  //#region src/agent/preview-operations.d.ts
6
6
  type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {
@@ -1,5 +1,5 @@
1
- import { _i as PublicTemplateVersionInfo, ea as HttpClient, gi as PublicTemplateInfo, vi as PublishPublicTemplateOptions, yi as PublishPublicTemplateVersionOptions } from "./types-BxZX2EVj.js";
2
- import { g as SandboxError } from "./error-classes-BWS1a9HO.js";
1
+ import { F as SandboxError } from "./terminal-stream-types-ClZCArRg.js";
2
+ import { Ui as HttpClient, di as PublicTemplateInfo, fi as PublicTemplateVersionInfo, mi as PublishPublicTemplateVersionOptions, pi as PublishPublicTemplateOptions } from "./types-BjyQe_CI.js";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/public-templates.d.ts
@@ -1,2 +1,2 @@
1
- import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-BP3sTaSb.js";
1
+ import { a as PublicTemplatesClient, i as PublicTemplatePublishRequestOptions, n as PublicTemplatePublishError, r as PublicTemplatePublishJob, t as PublicTemplatePublishArtifact } from "./public-templates-nv4AFFVc.js";
2
2
  export { PublicTemplatePublishArtifact, PublicTemplatePublishError, PublicTemplatePublishJob, PublicTemplatePublishRequestOptions, PublicTemplatesClient };
@@ -1,4 +1,4 @@
1
- import { r as readResponseJson, y as SandboxError } from "./errors-AB5BD3FM.js";
1
+ import { b as SandboxError, i as readResponseJson } from "./errors-BfbOP_rx.js";
2
2
  import { z } from "zod";
3
3
  //#region src/public-templates.ts
4
4
  const publicationStatus = z.enum([
package/dist/runtime.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { $r as FileTreeOptions, At as SessionExecutionStatus, Ba as SandboxEvent, Br as ChunkedUploadResult, Et as SentSessionMessage, Ht as TaskSessionCommitResult, It as SessionMessage, Kr as FileReadBatchOptions, Lt as SessionMessageAdmission, Nt as SessionInfo, Ot as SessionEventStreamOptions, St as ListMessagesOptions, Tt as SendSessionMessageRequest, Vt as TaskSessionChanges, Wt as TaskSessionInfo, Xr as FileRenameResult, _t as CreateSessionOptions, ci as UploadProgress, cr as SandboxTerminalManager, ei as FileTreeResult, ft as CommitTaskSessionOptions, ir as SandboxRuntimeHealth, kt as SessionExecutionInfo, li as WriteFileOptions, lr as SandboxTerminalRequestOptions, ni as FileUsageResult, oi as RenameOptions, or as SandboxTerminalCreateOptions, qr as FileReadBatchResult, ri as FileWriteResult, sr as SandboxTerminalInfo, ti as FileUsageOptions, tr as SandboxPortBinding, vt as CreateTaskSessionOptions, wt as SendSessionMessageOptions, zr as ChunkedUploadOptions } from "./types-BxZX2EVj.js";
2
- import { n as TerminalStream, p as ScopedToken } from "./terminal-stream-DgD7GlFi.js";
3
- import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-B6sySQFu.js";
4
- import { t as BrowserInteractiveSessionController } from "./interactive-controller-BSWoA0YE.js";
5
- import { C as TimeoutError, _ as SandboxErrorJson, b as StateError, d as NotFoundError, f as PartialFailureError, g as SandboxError, m as QuotaError, o as FileWriteConflictError, p as ProfileFileMountPathError, r as CapabilityError, t as AuthError, u as NetworkError, v as SandboxFailureDetail, w as ValidationError, y as ServerError } from "./error-classes-BWS1a9HO.js";
6
- import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-DlYhZnhD.js";
1
+ import { A as NotFoundError, F as SandboxError, H as TimeoutError, I as SandboxErrorJson, L as SandboxFailureDetail, M as ProfileFileMountPathError, N as QuotaError, R as ServerError, S as CapabilityError, T as FileWriteConflictError, U as ValidationError, b as AuthError, j as PartialFailureError, k as NetworkError, u as ScopedToken, z as StateError } from "./terminal-stream-types-ClZCArRg.js";
2
+ import { Ct as SessionEventStreamOptions, Fr as ChunkedUploadResult, Ft as TaskSessionChanges, Gr as FileRenameResult, Hr as FileReadBatchResult, It as TaskSessionCommitResult, Jr as FileTreeOptions, Mt as SessionMessageAdmission, Ot as SessionInfo, Pr as ChunkedUploadOptions, Qn as SandboxRuntimeHealth, Qr as FileWriteResult, Rt as TaskSessionInfo, Sa as SandboxEvent, Tt as SessionExecutionStatus, Vr as FileReadBatchOptions, Xr as FileUsageOptions, Yn as SandboxPortBinding, Yr as FileTreeResult, Zr as FileUsageResult, _t as ListMessagesOptions, bt as SendSessionMessageRequest, er as SandboxTerminalCreateOptions, fr as TerminalStream, ft as CreateSessionOptions, ii as WriteFileOptions, jt as SessionMessage, nr as SandboxTerminalManager, pt as CreateTaskSessionOptions, ri as UploadProgress, rr as SandboxTerminalRequestOptions, st as CommitTaskSessionOptions, ti as RenameOptions, tr as SandboxTerminalInfo, wt as SessionExecutionInfo, xt as SentSessionMessage, yt as SendSessionMessageOptions } from "./types-BjyQe_CI.js";
3
+ import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-CvObO_Kf.js";
4
+ import { t as BrowserInteractiveSessionController } from "./interactive-controller-BBwB_5QQ.js";
5
+ import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-C-VR-L0I.js";
7
6
 
8
7
  //#region src/lib/chunked-upload.d.ts
9
8
  /** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
@@ -30,15 +29,13 @@ interface ChunkedUploadTransport {
30
29
  */
31
30
  declare function uploadChunked(transport: ChunkedUploadTransport, remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
32
31
  //#endregion
33
- //#region src/runtime-api.d.ts
32
+ //#region src/runtime-transport.d.ts
34
33
  interface RuntimeTransport {
35
34
  ensureRunning(): Promise<void>;
36
35
  fetch(path: string, init?: RequestInit): Promise<Response>;
37
36
  }
38
- /** A 503 the runtime answers before any work starts; the request may be resent. */
39
- /** Internal typed client for routes served by a sandbox runtime. */
40
- declare class SandboxRuntimeApi {
41
- private readonly transport;
37
+ declare class RuntimeApiTransport {
38
+ protected readonly transport: RuntimeTransport;
42
39
  readonly terminals: SandboxTerminalManager;
43
40
  constructor(transport: RuntimeTransport);
44
41
  health(): Promise<SandboxRuntimeHealth>;
@@ -46,6 +43,44 @@ declare class SandboxRuntimeApi {
46
43
  ttlMs?: number;
47
44
  }): Promise<void>;
48
45
  ports(): Promise<SandboxPortBinding[]>;
46
+ protected createTerminal(options?: SandboxTerminalCreateOptions, request?: SandboxTerminalRequestOptions): Promise<SandboxTerminalInfo>;
47
+ protected writeTerminal(terminalId: string, data: string, request?: SandboxTerminalRequestOptions): Promise<void>;
48
+ protected listTerminals(): Promise<SandboxTerminalInfo[]>;
49
+ protected getTerminal(terminalId: string): Promise<SandboxTerminalInfo | null>;
50
+ protected json<T>(path: string, init?: RequestInit): Promise<T>;
51
+ protected request(path: string, init?: RequestInit): Promise<Response>;
52
+ protected assertOk(response: Response): Promise<void>;
53
+ }
54
+ //#endregion
55
+ //#region src/runtime-files.d.ts
56
+ declare class RuntimeFiles extends RuntimeApiTransport {
57
+ readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
58
+ writeFile(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
59
+ /**
60
+ * Upload in-memory binary or text data to the sandbox over the chunked
61
+ * upload-session protocol — the browser/Worker-safe sanctioned path for
62
+ * payloads over ~1 MiB, sized to clear the gateway proxy's per-request cap
63
+ * (parts stay under {@link FILE_UPLOAD_PART_MAX_BYTES}). Binary-safe:
64
+ * accepts a `Blob`, `ArrayBuffer`, `ArrayBufferView`, or UTF-8 `string`.
65
+ * Delegates to the shared `uploadChunked` engine in `lib/chunked-upload.js`,
66
+ * wired to this client's `transport.fetch` so requests carry the same
67
+ * scoped-token `Authorization` header and base URL as every other method
68
+ * on this class (e.g. {@link SandboxRuntimeApi.writeFile}) — works
69
+ * identically over the gateway proxy or a direct sidecar connection.
70
+ *
71
+ * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately, before any
72
+ * request, if the payload exceeds the chunked-upload session cap.
73
+ */
74
+ uploadData(remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
75
+ deleteFile(path: string, options?: Pick<WriteFileOptions, "sessionId">): Promise<void>;
76
+ renameFile(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
77
+ fileTree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
78
+ fileUsage(path: string, options?: FileUsageOptions): Promise<FileUsageResult>;
79
+ }
80
+ //#endregion
81
+ //#region src/runtime-api.d.ts
82
+ /** Internal typed client for routes served by a sandbox runtime. */
83
+ declare class SandboxRuntimeApi extends RuntimeFiles {
49
84
  /**
50
85
  * Subscribe to a session's agent event stream (`/agents/events`).
51
86
  *
@@ -70,28 +105,6 @@ declare class SandboxRuntimeApi {
70
105
  runs(sessionId: string, options?: {
71
106
  signal?: AbortSignal;
72
107
  }): Promise<SessionExecutionInfo[]>;
73
- readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
74
- writeFile(path: string, content: string, options?: WriteFileOptions): Promise<FileWriteResult>;
75
- /**
76
- * Upload in-memory binary or text data to the sandbox over the chunked
77
- * upload-session protocol — the browser/Worker-safe sanctioned path for
78
- * payloads over ~1 MiB, sized to clear the gateway proxy's per-request cap
79
- * (parts stay under {@link FILE_UPLOAD_PART_MAX_BYTES}). Binary-safe:
80
- * accepts a `Blob`, `ArrayBuffer`, `ArrayBufferView`, or UTF-8 `string`.
81
- * Delegates to the shared `uploadChunked` engine in `lib/chunked-upload.js`,
82
- * wired to this client's `transport.fetch` so requests carry the same
83
- * scoped-token `Authorization` header and base URL as every other method
84
- * on this class (e.g. {@link SandboxRuntimeApi.writeFile}) — works
85
- * identically over the gateway proxy or a direct sidecar connection.
86
- *
87
- * @throws {SandboxError} `PAYLOAD_TOO_LARGE` immediately, before any
88
- * request, if the payload exceeds the chunked-upload session cap.
89
- */
90
- uploadData(remotePath: string, data: Blob | ArrayBuffer | ArrayBufferView | string, options?: ChunkedUploadOptions): Promise<ChunkedUploadResult>;
91
- deleteFile(path: string, options?: Pick<WriteFileOptions, "sessionId">): Promise<void>;
92
- renameFile(sourcePath: string, destinationPath: string, options?: RenameOptions): Promise<FileRenameResult>;
93
- fileTree(path: string, options?: FileTreeOptions): Promise<FileTreeResult>;
94
- fileUsage(path: string, options?: FileUsageOptions): Promise<FileUsageResult>;
95
108
  createSession(options: CreateSessionOptions): Promise<SessionInfo>;
96
109
  messages(id: string, options?: Omit<ListMessagesOptions, "sessionId">): Promise<SessionMessage[]>;
97
110
  createTaskSession(options: CreateTaskSessionOptions): Promise<TaskSessionInfo>;
@@ -99,13 +112,7 @@ declare class SandboxRuntimeApi {
99
112
  deleteSession(id: string): Promise<void>;
100
113
  taskSessionChanges(id: string): Promise<TaskSessionChanges>;
101
114
  commitTaskSession(id: string, options?: CommitTaskSessionOptions): Promise<TaskSessionCommitResult>;
102
- private createTerminal;
103
- private writeTerminal;
104
- private listTerminals;
105
- private getTerminal;
106
- private json;
107
- private request;
108
- private assertOk;
115
+ constructor(transport: RuntimeTransport);
109
116
  }
110
117
  //#endregion
111
118
  //#region src/runtime-client.d.ts
package/dist/runtime.js CHANGED
@@ -1,7 +1,7 @@
1
- import { B as deriveAgentResultOutcome, H as projectAgentTerminalRecord, V as deriveAgentRunOutcome, d as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as createAgentRunOutcomeTracker } from "./interactive-controller-zE6hwv3C.js";
2
- import { C as TimeoutError, _ as QuotaError, b as ServerError, g as ProfileFileMountPathError, h as PartialFailureError, i as AuthError, l as FileWriteConflictError, m as NotFoundError, o as CapabilityError, p as NetworkError, w as ValidationError, x as StateError, y as SandboxError } from "./errors-AB5BD3FM.js";
3
- import { f as combineAbortSignals, n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BJf0P_J4.js";
4
- import { s as uploadChunked } from "./chunked-upload-KJyRCAiC.js";
1
+ import { I as createAgentRunOutcomeTracker, L as deriveAgentResultOutcome, R as deriveAgentRunOutcome, c as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as projectAgentTerminalRecord } from "./interactive-controller-D4N4zqmu.js";
2
+ import { S as StateError, T as ValidationError, _ as ProfileFileMountPathError, a as AuthError, b as SandboxError, g as PartialFailureError, h as NotFoundError, m as NetworkError, s as CapabilityError, u as FileWriteConflictError, v as QuotaError, w as TimeoutError, x as ServerError } from "./errors-BfbOP_rx.js";
3
+ import { f as combineAbortSignals, n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-DHx53yre.js";
4
+ import { s as uploadChunked } from "./chunked-upload-DN2twsUu.js";
5
5
  //#region src/runtime-client.ts
6
6
  const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
7
7
  function requireToken(token) {