@tangle-network/sandbox 0.60.25-develop.20261008094859.aaa33fe → 0.60.26-develop.20261008100338.fdb71c8
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.
- package/README.md +28 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +4 -4
- package/dist/agent/preview.d.ts +1 -1
- package/dist/{agent-run-outcome-DgQPyF7j.d.ts → agent-run-outcome-D5VVd5Ei.d.ts} +1 -1
- package/dist/{client-DWvFva4_.js → client-B4ehn1iw.js} +3 -3
- package/dist/{client-Cw1BDXF6.d.ts → client-DqA0N91W.d.ts} +4 -4
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-CFe2H--1.js → collaboration-D15xoinI.js} +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/core.js +3 -3
- package/dist/{errors-DS32ViPj.d.ts → errors-BXMXbVFO.d.ts} +32 -1
- package/dist/{errors-C1c3Q6Bj.js → errors-DMxVFCS6.js} +34 -1
- package/dist/{index-D7Zlm_Wd.d.ts → index-Dv77g3s5.d.ts} +2 -2
- package/dist/index.d.ts +18 -8
- package/dist/index.js +8 -7
- package/dist/intelligence/index.js +1 -1
- package/dist/{interactive-controller-D37MXlzk.js → interactive-controller-4Fo9aDih.js} +1 -1
- package/dist/{lines-CMuNKH1G.d.ts → lines-d9AEcbCd.d.ts} +20 -6
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +8 -5
- package/dist/{preview-BUlJ5sev.d.ts → preview-CCAwjkRr.d.ts} +3 -3
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +2 -2
- package/dist/{sandbox-DMEC3bW3.js → sandbox-C42UAlFT.js} +218 -56
- package/dist/{sandbox-ChOvAiKL.d.ts → sandbox-CSFajXr_.d.ts} +7 -6
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-DSfA8z6z.js → tangle-9TwNLIs5.js} +2 -2
- package/dist/{types-BY5gTf9n.d.ts → types-Di0cLhOV.d.ts} +24 -8
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as CreateSandboxOptions, d as BackendConfig } from "./types-
|
|
1
|
+
import { B as CreateSandboxOptions, d as BackendConfig } from "./types-Di0cLhOV.js";
|
|
2
2
|
|
|
3
3
|
//#region src/line-application.d.ts
|
|
4
4
|
/** Bounded callback request bytes after canonicalization, including JSON framing. */
|
|
@@ -75,7 +75,7 @@ declare function parseLineApplicationResult(value: unknown, request: Pick<LineAp
|
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/lines.d.ts
|
|
77
77
|
/** The transport a line carries. */
|
|
78
|
-
type LineTransport = "imessage" | "sms" | "whatsapp" | "email";
|
|
78
|
+
type LineTransport = "imessage" | "sms" | "whatsapp" | "email" | "voice";
|
|
79
79
|
/** What a role's members share and may do in the attached sandbox. */
|
|
80
80
|
interface LineRole {
|
|
81
81
|
/** `shared`: the member's turns see other shared members' recent exchanges. `own`: they see none, and nobody sees theirs. */
|
|
@@ -119,6 +119,11 @@ interface LineMemberSpec {
|
|
|
119
119
|
/** This member's allowance subject; requires limits.allowance.perMember.
|
|
120
120
|
* The payer never determines the private workspace identity. */
|
|
121
121
|
allowance?: LineAllowanceSubject;
|
|
122
|
+
/** Required for a ph0ny voice line: an owner attestation to this phone member's prior consent. */
|
|
123
|
+
voiceConsent?: {
|
|
124
|
+
recordedAt: string;
|
|
125
|
+
sourceRef: string;
|
|
126
|
+
};
|
|
122
127
|
}
|
|
123
128
|
/** Per-attachment bounds. */
|
|
124
129
|
interface LineLimits {
|
|
@@ -356,6 +361,9 @@ type LineFromConnectionInput = LineFromConnectionCommon & ({
|
|
|
356
361
|
} | {
|
|
357
362
|
transport: "whatsapp";
|
|
358
363
|
phoneNumberId: string;
|
|
364
|
+
} /** An already-owned ph0ny number; Hub admission is enabled separately. */ | {
|
|
365
|
+
transport: "voice";
|
|
366
|
+
phoneNumberId: string;
|
|
359
367
|
});
|
|
360
368
|
/** Fields a member update may change. */
|
|
361
369
|
interface LineSendInput {
|
|
@@ -469,14 +477,18 @@ interface LineVoice {
|
|
|
469
477
|
state: "enabling" | "enabled" | "disabled";
|
|
470
478
|
ph0nyConnectionId: string;
|
|
471
479
|
ph0nyAgentId: string;
|
|
480
|
+
/** The owned ph0ny number that answers through this line, when Twilio carries voice. */
|
|
481
|
+
ph0nyPhoneNumberId?: string | null;
|
|
472
482
|
updatedAt: string;
|
|
473
483
|
}
|
|
474
484
|
/** Input to `client.lines.enableVoice()`. */
|
|
475
485
|
interface LineVoiceOptions {
|
|
476
486
|
/** Your ph0ny Hub connection (provider `phony`). */
|
|
477
487
|
ph0nyConnectionId: string;
|
|
478
|
-
/** The ph0ny agent that voices the calls
|
|
488
|
+
/** The ph0ny agent that voices the calls. Inkbox voice adds `ask_workspace`. */
|
|
479
489
|
ph0nyAgentId: string;
|
|
490
|
+
/** Bind this owned ph0ny number to any active Hub line's member and attachment rules. */
|
|
491
|
+
ph0nyPhoneNumberId?: string;
|
|
480
492
|
}
|
|
481
493
|
interface Line {
|
|
482
494
|
id: string;
|
|
@@ -598,9 +610,11 @@ declare class LinesClient {
|
|
|
598
610
|
*/
|
|
599
611
|
release(number: string): Promise<boolean>;
|
|
600
612
|
/**
|
|
601
|
-
* Take calls
|
|
602
|
-
*
|
|
603
|
-
*
|
|
613
|
+
* Take calls for an active Hub line. Without a phone number ID, the line
|
|
614
|
+
* must be Inkbox iMessage; Hub changes its call action and adds
|
|
615
|
+
* `ask_workspace` to the agent. With an owned ph0ny phone number ID, Hub
|
|
616
|
+
* binds that Twilio number to the line's admission hook and leaves the
|
|
617
|
+
* line's provider call settings unchanged.
|
|
604
618
|
*/
|
|
605
619
|
enableVoice(lineId: string, options: LineVoiceOptions): Promise<Line>;
|
|
606
620
|
/** Stop taking calls on a line: Hub refuses them and Inkbox rejects them. */
|
package/dist/lines.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as LineSenderVerification, B as profileChannelReference, C as LineReplyCodeInput, D as LineRole, E as LineRespondView, F as LineVoiceOptions, I as LinesClient, L as LinesHttpClient, M as LineThread, N as LineTransport, O as LineSendInput, P as LineVoice, R as SandboxLines, S as LineReplyCode, T as LineRespondAgent, _ as LineMemberSpec, a as LineApplicationAttachOptions, b as LineProvider, c as LineAttachmentReauthorization, d as LineInstanceAttachOptions, f as LineInstanceCreate, g as LineMemberPatch, h as LineMemberInstance, i as LineAllowanceSubject, j as LineSenderVerificationStart, k as LineSendReceipt, l as LineExecutionKey, m as LineMember, n as LineAgentRolePolicy, o as LineAttachOptions, p as LineLimits, r as LineAllowance, s as LineAttachment, t as Line, u as LineFromConnectionInput, v as LineMessage, w as LineReplyGate, x as LineReminderPreferences, y as LineNumberInventory, z as lineInstanceKey } from "./lines-
|
|
1
|
+
import { A as LineSenderVerification, B as profileChannelReference, C as LineReplyCodeInput, D as LineRole, E as LineRespondView, F as LineVoiceOptions, I as LinesClient, L as LinesHttpClient, M as LineThread, N as LineTransport, O as LineSendInput, P as LineVoice, R as SandboxLines, S as LineReplyCode, T as LineRespondAgent, _ as LineMemberSpec, a as LineApplicationAttachOptions, b as LineProvider, c as LineAttachmentReauthorization, d as LineInstanceAttachOptions, f as LineInstanceCreate, g as LineMemberPatch, h as LineMemberInstance, i as LineAllowanceSubject, j as LineSenderVerificationStart, k as LineSendReceipt, l as LineExecutionKey, m as LineMember, n as LineAgentRolePolicy, o as LineAttachOptions, p as LineLimits, r as LineAllowance, s as LineAttachment, t as Line, u as LineFromConnectionInput, v as LineMessage, w as LineReplyGate, x as LineReminderPreferences, y as LineNumberInventory, z as lineInstanceKey } from "./lines-d9AEcbCd.js";
|
|
2
2
|
export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineApplicationAttachOptions, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyCode, LineReplyCodeInput, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
|
package/dist/lines.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as ValidationError, y as parseErrorResponse } from "./errors-DMxVFCS6.js";
|
|
2
2
|
//#region src/lines.ts
|
|
3
3
|
/**
|
|
4
4
|
* Lines: give a sandbox a phone number or messaging address.
|
|
@@ -185,16 +185,19 @@ var LinesClient = class {
|
|
|
185
185
|
return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, { method: "DELETE" }))).released;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* Take calls
|
|
189
|
-
*
|
|
190
|
-
*
|
|
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.
|
|
191
193
|
*/
|
|
192
194
|
async enableVoice(lineId, options) {
|
|
193
195
|
return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: {
|
|
194
196
|
enabled: true,
|
|
195
197
|
ph0ny: {
|
|
196
198
|
connectionId: options.ph0nyConnectionId,
|
|
197
|
-
agentId: options.ph0nyAgentId
|
|
199
|
+
agentId: options.ph0nyAgentId,
|
|
200
|
+
...options.ph0nyPhoneNumberId ? { phoneNumberId: options.ph0nyPhoneNumberId } : {}
|
|
198
201
|
}
|
|
199
202
|
} })))).line;
|
|
200
203
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as SandboxInstance } from "./sandbox-
|
|
2
|
-
import { Fn as PreviewLinkInfo, ht as EnsureDevServerOptions } from "./types-
|
|
3
|
-
import { i as Sandbox } from "./client-
|
|
1
|
+
import { r as SandboxInstance } from "./sandbox-CSFajXr_.js";
|
|
2
|
+
import { Fn as PreviewLinkInfo, ht as EnsureDevServerOptions } from "./types-Di0cLhOV.js";
|
|
3
|
+
import { i as Sandbox } from "./client-DqA0N91W.js";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/preview-operations.d.ts
|
|
6
6
|
type AgentPreviewOptions = Pick<EnsureDevServerOptions, "sessionId" | "cwd"> & {
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as CommitTaskSessionOptions, At as FileUsageOptions, Bi as SendSessionMessageRequest, Cn as ListMessagesOptions, Di as SandboxTerminalManager, Ei as SandboxTerminalInfo, Gi as SessionExecutionStatus, H as CreateTaskSessionOptions, Ji as SessionInfo, Mt as FileWriteResult, Na as WriteFileOptions, Oa as UploadProgress, Oi as SandboxTerminalRequestOptions, Ot as FileTreeOptions, Qi as SessionMessageAdmission, St as FileReadBatchResult, T as ChunkedUploadResult, Ti as SandboxTerminalCreateOptions, Tt as FileRenameResult, Ui as SessionEventStreamOptions, V as CreateSessionOptions, Vi as SentSessionMessage, Wi as SessionExecutionInfo, Zi as SessionMessage, cr as RenameOptions, fi as SandboxPortBinding, ga as TaskSessionInfo, jt as FileUsageResult, kr as SandboxEvent, kt as FileTreeResult, ma as TaskSessionCommitResult, pa as TaskSessionChanges, w as ChunkedUploadOptions, xt as FileReadBatchOptions, yi as SandboxRuntimeHealth, zi as SendSessionMessageOptions } from "./types-
|
|
1
|
+
import { A as CommitTaskSessionOptions, At as FileUsageOptions, Bi as SendSessionMessageRequest, Cn as ListMessagesOptions, Di as SandboxTerminalManager, Ei as SandboxTerminalInfo, Gi as SessionExecutionStatus, H as CreateTaskSessionOptions, Ji as SessionInfo, Mt as FileWriteResult, Na as WriteFileOptions, Oa as UploadProgress, Oi as SandboxTerminalRequestOptions, Ot as FileTreeOptions, Qi as SessionMessageAdmission, St as FileReadBatchResult, T as ChunkedUploadResult, Ti as SandboxTerminalCreateOptions, Tt as FileRenameResult, Ui as SessionEventStreamOptions, V as CreateSessionOptions, Vi as SentSessionMessage, Wi as SessionExecutionInfo, Zi as SessionMessage, cr as RenameOptions, fi as SandboxPortBinding, ga as TaskSessionInfo, jt as FileUsageResult, kr as SandboxEvent, kt as FileTreeResult, ma as TaskSessionCommitResult, pa as TaskSessionChanges, w as ChunkedUploadOptions, xt as FileReadBatchOptions, yi as SandboxRuntimeHealth, zi as SendSessionMessageOptions } from "./types-Di0cLhOV.js";
|
|
2
2
|
import { l as ScopedToken, t as TerminalStream } from "./terminal-stream-B6bUr0hj.js";
|
|
3
3
|
import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-DRCfxOQz.js";
|
|
4
4
|
import { t as BrowserInteractiveSessionController } from "./interactive-controller-ykaThYp6.js";
|
|
5
|
-
import {
|
|
6
|
-
import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, o as projectAgentTerminalRecord, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-
|
|
5
|
+
import { a as FileWriteConflictError, b as ValidationError, c as NotFoundError, f as SandboxError, g as StateError, h as ServerError, l as PartialFailureError, m as SandboxFailureDetail, n as CapabilityError, p as SandboxErrorJson, s as NetworkError, t as AuthError, u as QuotaError, y as TimeoutError } from "./errors-BXMXbVFO.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-D5VVd5Ei.js";
|
|
7
7
|
|
|
8
8
|
//#region src/lib/chunked-upload.d.ts
|
|
9
9
|
/** The transport a caller wires this module to — {@link SandboxInstance.runtimeFetch}
|
package/dist/runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as projectAgentTerminalRecord, L as createAgentRunOutcomeTracker, R as deriveAgentResultOutcome, b as uploadChunked, l as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as deriveAgentRunOutcome } from "./interactive-controller-
|
|
2
|
-
import { _ as
|
|
1
|
+
import { B as projectAgentTerminalRecord, L as createAgentRunOutcomeTracker, R as deriveAgentResultOutcome, b as uploadChunked, l as SandboxRuntimeApi, t as BrowserInteractiveSessionController, z as deriveAgentRunOutcome } from "./interactive-controller-4Fo9aDih.js";
|
|
2
|
+
import { _ as TimeoutError, a as FileWriteConflictError, c as NetworkError, d as QuotaError, h as StateError, l as NotFoundError, m as ServerError, n as CapabilityError, p as SandboxError, t as AuthError, u as PartialFailureError, v as ValidationError } from "./errors-DMxVFCS6.js";
|
|
3
3
|
import { f as combineAbortSignals, n as browserInteractiveControlHolderId, s as InteractiveSessionNotRunningError } from "./browser-interactive-control-controller-BJf0P_J4.js";
|
|
4
4
|
//#region src/runtime-client.ts
|
|
5
5
|
const DEFAULT_RUNTIME_TIMEOUT_MS = 3e4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as backendTypeSchema } from "./backend-types-C7b_Gpa0.js";
|
|
2
|
-
import { C as SANDBOX_PROXY_REQUEST_MAX_BYTES, D as parseSSEStream, E as encodeTextForWire, I as withoutRuntimeSecrets, L as createAgentRunOutcomeTracker, M as normalizeRuntimeBackendConfig, N as requestedPublicProfileDigest, O as applyRequestedModel, P as requestedSecretProfilePublicDigest, R as deriveAgentResultOutcome, S as validateAcceptedDispatchRunRef, T as encodePromptForWire, _ as resolveTraceId, b as uploadChunked, c as requestScopedToken, d as normalizeSessionInfo, f as sessionMessageRequestBody, g as mintTraceId, h as isTraceId, j as mergeRuntimeBackendConfig, k as assertCurrentBackendType, l as SandboxRuntimeApi, m as TRACE_ID_HEADER, n as InteractiveSessionController, o as assertScopedTokenActive, p as waitForRetryAfter, r as TerminalStream, u as isRetryableCredentialRefusal, v as appendSessionIdQuery, x as resolveDispatchRunIdentity, y as sessionHeaders } from "./interactive-controller-
|
|
3
|
-
import { _ as
|
|
2
|
+
import { C as SANDBOX_PROXY_REQUEST_MAX_BYTES, D as parseSSEStream, E as encodeTextForWire, I as withoutRuntimeSecrets, L as createAgentRunOutcomeTracker, M as normalizeRuntimeBackendConfig, N as requestedPublicProfileDigest, O as applyRequestedModel, P as requestedSecretProfilePublicDigest, R as deriveAgentResultOutcome, S as validateAcceptedDispatchRunRef, T as encodePromptForWire, _ as resolveTraceId, b as uploadChunked, c as requestScopedToken, d as normalizeSessionInfo, f as sessionMessageRequestBody, g as mintTraceId, h as isTraceId, j as mergeRuntimeBackendConfig, k as assertCurrentBackendType, l as SandboxRuntimeApi, m as TRACE_ID_HEADER, n as InteractiveSessionController, o as assertScopedTokenActive, p as waitForRetryAfter, r as TerminalStream, u as isRetryableCredentialRefusal, v as appendSessionIdQuery, x as resolveDispatchRunIdentity, y as sessionHeaders } from "./interactive-controller-4Fo9aDih.js";
|
|
3
|
+
import { _ as TimeoutError, b as parseResponseError, c as NetworkError, d as QuotaError, g as StreamInterruptedError, h as StateError, l as NotFoundError, m as ServerError, n as CapabilityError, p as SandboxError, r as EdgeNotReadyError, t as AuthError, v as ValidationError, x as readResponseJson, y as parseErrorResponse } from "./errors-DMxVFCS6.js";
|
|
4
4
|
import { d as awaitWithAbort, f as combineAbortSignals, g as interactiveSessionStatusResponseSchema, h as interactiveSessionControlValidationResponseSchema, l as createInteractiveControlHolderId, m as interactiveSessionControlReleaseResponseSchema, p as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-BJf0P_J4.js";
|
|
5
5
|
import { SandboxLines } from "./lines.js";
|
|
6
6
|
import { r as cliAuthReferenceSchema } from "./cli-auth-bundle-CZfgymgf.js";
|
|
@@ -1836,6 +1836,99 @@ function collectAgentFinalMessageText(events) {
|
|
|
1836
1836
|
return composed.trim().length > 0 ? composed : void 0;
|
|
1837
1837
|
}
|
|
1838
1838
|
//#endregion
|
|
1839
|
+
//#region src/lib/stream-resume.ts
|
|
1840
|
+
/**
|
|
1841
|
+
* How a prompt stream rejoins its execution after the connection drops.
|
|
1842
|
+
*
|
|
1843
|
+
* A dropped stream is a transport fact, never a statement about the run. The
|
|
1844
|
+
* platform restarts its control path (host agents, orchestrator, Worker)
|
|
1845
|
+
* several times a day while executions keep running inside their sandboxes
|
|
1846
|
+
* and keep appending to their durable event log, so the SDK rejoins the log
|
|
1847
|
+
* for as long as the caller allows and the sandbox exists.
|
|
1848
|
+
*/
|
|
1849
|
+
/** Default reconnect window: how long an execution may stay unreachable. */
|
|
1850
|
+
const DEFAULT_RECONNECT_WINDOW_MS = 360 * 60 * 1e3;
|
|
1851
|
+
/** The first retry waits this long; each consecutive failure doubles it. */
|
|
1852
|
+
const RECONNECT_BASE_DELAY_MS = 1e3;
|
|
1853
|
+
/** No single wait between attempts exceeds this. */
|
|
1854
|
+
const RECONNECT_MAX_DELAY_MS = 3e4;
|
|
1855
|
+
/** The caller's window, or the default; 0 disables reconnection. */
|
|
1856
|
+
function resolveReconnectWindowMs(value) {
|
|
1857
|
+
if (value === void 0) return DEFAULT_RECONNECT_WINDOW_MS;
|
|
1858
|
+
if (!Number.isFinite(value) || value < 0) throw new RangeError("reconnectWindowMs must be a non-negative number");
|
|
1859
|
+
return value;
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Capped exponential backoff with ±20% jitter, so the clients a host-agent
|
|
1863
|
+
* restart disconnects together do not return together.
|
|
1864
|
+
*/
|
|
1865
|
+
function reconnectDelayMs(consecutiveFailures, random = Math.random) {
|
|
1866
|
+
const exponent = Math.max(0, consecutiveFailures - 1);
|
|
1867
|
+
const base = Math.min(RECONNECT_MAX_DELAY_MS, RECONNECT_BASE_DELAY_MS * 2 ** Math.min(exponent, 16));
|
|
1868
|
+
return Math.round(base * (.8 + .4 * random()));
|
|
1869
|
+
}
|
|
1870
|
+
/** Sandbox states from which no execution can continue. */
|
|
1871
|
+
function isFinalSandboxStatus(status) {
|
|
1872
|
+
return status === "stopped" || status === "failed" || status === "expired" || status === "deleted";
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Drops events the caller already received. The runtime numbers buffered
|
|
1876
|
+
* events with one increasing integer per sandbox, so numeric ids compare by
|
|
1877
|
+
* value; any other id is remembered exactly.
|
|
1878
|
+
*/
|
|
1879
|
+
var DeliveredEvents = class {
|
|
1880
|
+
highestNumeric;
|
|
1881
|
+
opaque = /* @__PURE__ */ new Set();
|
|
1882
|
+
constructor(lastEventId) {
|
|
1883
|
+
if (lastEventId !== void 0) this.record(lastEventId);
|
|
1884
|
+
}
|
|
1885
|
+
isDuplicate(eventId) {
|
|
1886
|
+
if (eventId === void 0 || eventId === "") return false;
|
|
1887
|
+
const numeric = numericEventId(eventId);
|
|
1888
|
+
if (numeric !== void 0) return this.highestNumeric !== void 0 && numeric <= this.highestNumeric;
|
|
1889
|
+
return this.opaque.has(eventId);
|
|
1890
|
+
}
|
|
1891
|
+
record(eventId) {
|
|
1892
|
+
if (eventId === void 0 || eventId === "") return;
|
|
1893
|
+
const numeric = numericEventId(eventId);
|
|
1894
|
+
if (numeric !== void 0) {
|
|
1895
|
+
if (this.highestNumeric === void 0 || numeric > this.highestNumeric) this.highestNumeric = numeric;
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
this.opaque.add(eventId);
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
/**
|
|
1902
|
+
* The runtime ends each replay connection with a `stream.terminal`
|
|
1903
|
+
* announcement that reuses the last delivered event id as its position, so
|
|
1904
|
+
* it is never a duplicate of an agent event.
|
|
1905
|
+
*/
|
|
1906
|
+
function isDuplicateDelivery(delivered, event) {
|
|
1907
|
+
return event.type !== "stream.terminal" && delivered.isDuplicate(event.id);
|
|
1908
|
+
}
|
|
1909
|
+
function numericEventId(eventId) {
|
|
1910
|
+
if (!/^\d{1,15}$/u.test(eventId)) return void 0;
|
|
1911
|
+
return Number(eventId);
|
|
1912
|
+
}
|
|
1913
|
+
/** Resolve after `ms`, or as soon as the signal aborts; the caller checks it. */
|
|
1914
|
+
function waitForReconnect(ms, signal) {
|
|
1915
|
+
return new Promise((resolve) => {
|
|
1916
|
+
if (signal?.aborted) {
|
|
1917
|
+
resolve();
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
const timer = setTimeout(() => {
|
|
1921
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1922
|
+
resolve();
|
|
1923
|
+
}, ms);
|
|
1924
|
+
const onAbort = () => {
|
|
1925
|
+
clearTimeout(timer);
|
|
1926
|
+
resolve();
|
|
1927
|
+
};
|
|
1928
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
//#endregion
|
|
1839
1932
|
//#region src/profile-file-delivery.ts
|
|
1840
1933
|
/** Successful immutable mount delivery is scoped to one filesystem incarnation. */
|
|
1841
1934
|
var ProfileFileDelivery = class {
|
|
@@ -3561,6 +3654,23 @@ function fromStreamErrorEvent(data) {
|
|
|
3561
3654
|
* through so consumers can inspect the failure without re-parsing the message.
|
|
3562
3655
|
*/
|
|
3563
3656
|
function toStreamErrorEvent(err) {
|
|
3657
|
+
if (err instanceof StreamInterruptedError) return {
|
|
3658
|
+
type: "error",
|
|
3659
|
+
data: {
|
|
3660
|
+
message: err.message,
|
|
3661
|
+
code: err.code,
|
|
3662
|
+
name: err.name,
|
|
3663
|
+
origin: err.origin,
|
|
3664
|
+
endpoint: err.endpoint,
|
|
3665
|
+
outcome: "unknown",
|
|
3666
|
+
reason: err.reason,
|
|
3667
|
+
executionId: err.executionId,
|
|
3668
|
+
...err.sessionId ? { sessionId: err.sessionId } : {},
|
|
3669
|
+
...err.lastEventId ? { lastEventId: err.lastEventId } : {},
|
|
3670
|
+
...err.lastReplayStatus !== void 0 ? { lastReplayStatus: err.lastReplayStatus } : {},
|
|
3671
|
+
...err.lastExecutionStatus ? { lastExecutionStatus: err.lastExecutionStatus } : {}
|
|
3672
|
+
}
|
|
3673
|
+
};
|
|
3564
3674
|
if (err instanceof SandboxError) return {
|
|
3565
3675
|
type: "error",
|
|
3566
3676
|
data: {
|
|
@@ -4631,6 +4741,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4631
4741
|
let sessionId = options?.sessionId;
|
|
4632
4742
|
let executionId = options?.lastEventId ? options.executionId : void 0;
|
|
4633
4743
|
let profileResendAttempted = false;
|
|
4744
|
+
let streamInterrupted = false;
|
|
4634
4745
|
try {
|
|
4635
4746
|
for (;;) {
|
|
4636
4747
|
let yieldedThisAttempt = false;
|
|
@@ -4665,9 +4776,21 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4665
4776
|
executionId,
|
|
4666
4777
|
error: err instanceof Error ? err.message : String(err)
|
|
4667
4778
|
});
|
|
4779
|
+
if (err instanceof StreamInterruptedError) {
|
|
4780
|
+
streamInterrupted = true;
|
|
4781
|
+
yield toStreamErrorEvent(err);
|
|
4782
|
+
return;
|
|
4783
|
+
}
|
|
4668
4784
|
yield toStreamErrorEvent(err);
|
|
4669
4785
|
} finally {
|
|
4670
|
-
if (!receivedTerminal && !
|
|
4786
|
+
if (!receivedTerminal && !streamInterrupted && options.detach !== true && executionId !== void 0 && sessionId !== void 0) {
|
|
4787
|
+
this.logStreamCheckpoint("consumer_cancel", {
|
|
4788
|
+
sessionId,
|
|
4789
|
+
executionId
|
|
4790
|
+
});
|
|
4791
|
+
this._interrupt(sessionId, { executionId }).catch(() => void 0);
|
|
4792
|
+
}
|
|
4793
|
+
if (!receivedTerminal && !streamInterrupted && !isCallerAbort()) {
|
|
4671
4794
|
this.logStreamCheckpoint("synthetic_terminal", {
|
|
4672
4795
|
sessionId,
|
|
4673
4796
|
executionId
|
|
@@ -4684,10 +4807,11 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4684
4807
|
}
|
|
4685
4808
|
}
|
|
4686
4809
|
/**
|
|
4687
|
-
* Inner prompt stream: opens the SSE connection and
|
|
4688
|
-
* drops. May throw (pre-stream HTTP error, timeout,
|
|
4689
|
-
*
|
|
4690
|
-
* `
|
|
4810
|
+
* Inner prompt stream: opens the SSE connection and rejoins the execution's
|
|
4811
|
+
* event log on silent drops. May throw (pre-stream HTTP error, timeout, or
|
|
4812
|
+
* `StreamInterruptedError` when it cannot rejoin); the public
|
|
4813
|
+
* `streamPrompt` wrapper converts those throws into in-band events so
|
|
4814
|
+
* callers never see a thrown generator.
|
|
4691
4815
|
*/
|
|
4692
4816
|
async *streamPromptInner(message, options, internal) {
|
|
4693
4817
|
if (options?.nativeResume !== void 0) {
|
|
@@ -4738,15 +4862,8 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4738
4862
|
let executionId = options?.executionId;
|
|
4739
4863
|
let sessionId = options?.sessionId;
|
|
4740
4864
|
let receivedTerminal = false;
|
|
4741
|
-
const
|
|
4742
|
-
|
|
4743
|
-
4e3,
|
|
4744
|
-
8e3,
|
|
4745
|
-
16e3,
|
|
4746
|
-
3e4,
|
|
4747
|
-
3e4
|
|
4748
|
-
];
|
|
4749
|
-
const MAX_RECONNECT_ATTEMPTS = RECONNECT_BACKOFF_MS.length;
|
|
4865
|
+
const reconnectWindowMs = resolveReconnectWindowMs(options?.reconnectWindowMs);
|
|
4866
|
+
const delivered = new DeliveredEvents(lastEventId);
|
|
4750
4867
|
let lastReplayStatus;
|
|
4751
4868
|
let lastExecutionStatus;
|
|
4752
4869
|
let firstSseEventSeen = false;
|
|
@@ -4825,31 +4942,40 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4825
4942
|
status: response.status,
|
|
4826
4943
|
ok: false
|
|
4827
4944
|
});
|
|
4828
|
-
} else
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
firstSseEventSeen
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
if (
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4945
|
+
} else try {
|
|
4946
|
+
for await (const event of this.parseSSEStream(response, streamSignal)) {
|
|
4947
|
+
if (event.type === "history.replay.start" || event.type === "history.replay.end") continue;
|
|
4948
|
+
if (!firstSseEventSeen) {
|
|
4949
|
+
firstSseEventSeen = true;
|
|
4950
|
+
logStreamCheckpoint("first_sse_event", {
|
|
4951
|
+
eventType: event.type,
|
|
4952
|
+
eventId: event.id
|
|
4953
|
+
});
|
|
4954
|
+
}
|
|
4955
|
+
if (isDuplicateDelivery(delivered, event)) continue;
|
|
4956
|
+
delivered.record(event.id);
|
|
4957
|
+
if (event.id) lastEventId = event.id;
|
|
4958
|
+
if (event.type === "execution.started" && event.data?.executionId) {
|
|
4959
|
+
executionId = event.data.executionId;
|
|
4960
|
+
const eventSessionId = event.data?.sessionId;
|
|
4961
|
+
if (sessionId === void 0 && typeof eventSessionId === "string" && eventSessionId.length > 0) sessionId = eventSessionId;
|
|
4962
|
+
}
|
|
4963
|
+
if (event.type === "done" || event.type === "error") {
|
|
4964
|
+
receivedTerminal = true;
|
|
4965
|
+
logStreamCheckpoint("terminal_event", {
|
|
4966
|
+
eventType: event.type,
|
|
4967
|
+
eventId: event.id,
|
|
4968
|
+
sessionId,
|
|
4969
|
+
executionId
|
|
4970
|
+
});
|
|
4971
|
+
}
|
|
4972
|
+
yield event;
|
|
4851
4973
|
}
|
|
4852
|
-
|
|
4974
|
+
} catch (readError) {
|
|
4975
|
+
throwIfTimedOut();
|
|
4976
|
+
if (receivedTerminal || options?.signal?.aborted || streamSignal?.aborted) return;
|
|
4977
|
+
logStreamCheckpoint("stream_read_failed", { error: readError instanceof Error ? readError.message : String(readError) });
|
|
4978
|
+
console.warn(`[sandbox-sdk] Stream connection broke: ${readError instanceof Error ? readError.message : String(readError)}`);
|
|
4853
4979
|
}
|
|
4854
4980
|
if (receivedTerminal) return;
|
|
4855
4981
|
throwIfTimedOut();
|
|
@@ -4864,22 +4990,49 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4864
4990
|
endpoint: "/agents/run/stream",
|
|
4865
4991
|
origin: "runtime"
|
|
4866
4992
|
});
|
|
4867
|
-
|
|
4993
|
+
const resumeExecutionId = executionId;
|
|
4994
|
+
const interrupted = (reason, detail, cause) => {
|
|
4995
|
+
const replayStatusText = lastReplayStatus !== void 0 ? `; last replay status ${lastReplayStatus}` : "";
|
|
4996
|
+
const execStatusText = lastExecutionStatus ? `; last known execution status ${lastExecutionStatus}` : "";
|
|
4997
|
+
console.warn(`[sandbox-sdk] Stopped rejoining execution ${resumeExecutionId}: ${detail}`);
|
|
4998
|
+
return new StreamInterruptedError({
|
|
4999
|
+
message: `Prompt stream for execution ${resumeExecutionId} ended before a terminal event and could not be rejoined (${detail}); the execution's outcome is unknown${replayStatusText}${execStatusText}`,
|
|
5000
|
+
executionId: resumeExecutionId,
|
|
5001
|
+
...sessionId ? { sessionId } : {},
|
|
5002
|
+
...lastEventId ? { lastEventId } : {},
|
|
5003
|
+
reason,
|
|
5004
|
+
...lastReplayStatus !== void 0 ? { lastReplayStatus } : {},
|
|
5005
|
+
...lastExecutionStatus ? { lastExecutionStatus } : {},
|
|
5006
|
+
...cause !== void 0 ? { cause } : {}
|
|
5007
|
+
});
|
|
5008
|
+
};
|
|
5009
|
+
let outageStartedAt = Date.now();
|
|
5010
|
+
let consecutiveFailures = 0;
|
|
5011
|
+
let notFoundSince;
|
|
5012
|
+
for (let attempt = 1;; attempt++) {
|
|
4868
5013
|
throwIfTimedOut();
|
|
4869
5014
|
if (options?.signal?.aborted || streamSignal?.aborted) return;
|
|
4870
|
-
|
|
5015
|
+
const outageMs = Date.now() - outageStartedAt;
|
|
5016
|
+
if (outageMs >= reconnectWindowMs) throw interrupted("reconnect-window-elapsed", `unreachable for ${outageMs}ms of a ${reconnectWindowMs}ms reconnect window`);
|
|
5017
|
+
consecutiveFailures += 1;
|
|
5018
|
+
const delayMs = Math.min(reconnectDelayMs(consecutiveFailures), reconnectWindowMs - outageMs);
|
|
5019
|
+
console.warn(`[sandbox-sdk] Stream dropped without terminal event, reconnecting (attempt ${attempt}; unreachable ${Math.round(outageMs / 1e3)}s of ${Math.round(reconnectWindowMs / 1e3)}s)`);
|
|
4871
5020
|
logStreamCheckpoint("reconnect_attempt_start", {
|
|
4872
5021
|
attempt,
|
|
4873
5022
|
executionId,
|
|
4874
5023
|
sessionId,
|
|
4875
|
-
lastEventId
|
|
5024
|
+
lastEventId,
|
|
5025
|
+
outageMs,
|
|
5026
|
+
delayMs
|
|
4876
5027
|
});
|
|
4877
|
-
await
|
|
5028
|
+
await waitForReconnect(delayMs, streamSignal);
|
|
4878
5029
|
throwIfTimedOut();
|
|
4879
5030
|
if (options?.signal?.aborted || streamSignal?.aborted) return;
|
|
5031
|
+
let connectedAt;
|
|
5032
|
+
let deliveredThisConnection = 0;
|
|
4880
5033
|
try {
|
|
4881
5034
|
const queryParams = lastEventId ? `?lastEventId=${encodeURIComponent(lastEventId)}&format=sse` : "?format=sse";
|
|
4882
|
-
const replayResponse = await this.runtimeFetch(`/agents/run/${encodeURIComponent(
|
|
5035
|
+
const replayResponse = await this.runtimeFetch(`/agents/run/${encodeURIComponent(resumeExecutionId)}/events${queryParams}`, {
|
|
4883
5036
|
method: "GET",
|
|
4884
5037
|
signal: streamSignal,
|
|
4885
5038
|
headers: traceHeaders
|
|
@@ -4891,9 +5044,15 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4891
5044
|
});
|
|
4892
5045
|
if (!replayResponse.ok) {
|
|
4893
5046
|
lastReplayStatus = replayResponse.status;
|
|
5047
|
+
await replayResponse.body?.cancel().catch(() => void 0);
|
|
4894
5048
|
await reconcileRuntimeRefusal(replayResponse.status);
|
|
4895
5049
|
console.warn(`[sandbox-sdk] Replay endpoint returned ${replayResponse.status}, attempt ${attempt}`);
|
|
4896
|
-
if (replayResponse.status
|
|
5050
|
+
if (replayResponse.status !== 404) {
|
|
5051
|
+
notFoundSince = void 0;
|
|
5052
|
+
continue;
|
|
5053
|
+
}
|
|
5054
|
+
notFoundSince ??= Date.now();
|
|
5055
|
+
if (sessionId) try {
|
|
4897
5056
|
const info = await this._sessionStatus(sessionId);
|
|
4898
5057
|
if (info) {
|
|
4899
5058
|
lastExecutionStatus = info.status;
|
|
@@ -4922,8 +5081,11 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4922
5081
|
} catch (statusErr) {
|
|
4923
5082
|
console.warn(`[sandbox-sdk] Session status poll failed during replay 404: ${statusErr instanceof Error ? statusErr.message : String(statusErr)}`);
|
|
4924
5083
|
}
|
|
5084
|
+
if (Date.now() - notFoundSince >= 6e5) throw interrupted("execution-not-found", `the runtime has answered 404 for ${Date.now() - notFoundSince}ms`);
|
|
4925
5085
|
continue;
|
|
4926
5086
|
}
|
|
5087
|
+
notFoundSince = void 0;
|
|
5088
|
+
connectedAt = Date.now();
|
|
4927
5089
|
for await (const event of this.parseSSEStream(replayResponse, streamSignal)) {
|
|
4928
5090
|
if (!firstSseEventSeen) {
|
|
4929
5091
|
firstSseEventSeen = true;
|
|
@@ -4934,6 +5096,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4934
5096
|
});
|
|
4935
5097
|
}
|
|
4936
5098
|
if (event.type === "history.replay.start" || event.type === "history.replay.end") continue;
|
|
5099
|
+
if (isDuplicateDelivery(delivered, event)) continue;
|
|
5100
|
+
delivered.record(event.id);
|
|
5101
|
+
deliveredThisConnection += 1;
|
|
4937
5102
|
if (event.id) lastEventId = event.id;
|
|
4938
5103
|
const eventSessionId = event.data?.sessionId;
|
|
4939
5104
|
if (typeof eventSessionId === "string" && eventSessionId.length > 0) sessionId = eventSessionId;
|
|
@@ -4960,7 +5125,9 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4960
5125
|
if (options?.signal?.aborted || streamSignal?.aborted) return;
|
|
4961
5126
|
} catch (err) {
|
|
4962
5127
|
throwIfTimedOut();
|
|
4963
|
-
if (err instanceof
|
|
5128
|
+
if (err instanceof StreamInterruptedError) throw err;
|
|
5129
|
+
if (options?.signal?.aborted || streamSignal?.aborted) return;
|
|
5130
|
+
if (err instanceof StateError && isFinalSandboxStatus(this.status)) throw interrupted("sandbox-not-running", `the sandbox is ${this.status}`, err);
|
|
4964
5131
|
logStreamCheckpoint("reconnect_attempt_end", {
|
|
4965
5132
|
attempt,
|
|
4966
5133
|
status: "failed",
|
|
@@ -4968,15 +5135,10 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4968
5135
|
});
|
|
4969
5136
|
console.warn(`[sandbox-sdk] Reconnection attempt ${attempt} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
4970
5137
|
}
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
const execStatusText = lastExecutionStatus ? `; last known execution status ${lastExecutionStatus}` : "";
|
|
4976
|
-
throw new NetworkError(`Prompt stream ended before a terminal event for execution ${executionId}${replayStatusText}${execStatusText}`, {
|
|
4977
|
-
endpoint: `/agents/run/${executionId}/events`,
|
|
4978
|
-
origin: "runtime"
|
|
4979
|
-
});
|
|
5138
|
+
if (connectedAt !== void 0 && (deliveredThisConnection > 0 || Date.now() - connectedAt >= 3e4)) {
|
|
5139
|
+
outageStartedAt = Date.now();
|
|
5140
|
+
consecutiveFailures = 0;
|
|
5141
|
+
}
|
|
4980
5142
|
}
|
|
4981
5143
|
}
|
|
4982
5144
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as CliAuthReference } from "./cli-auth-bundle-BMcIiB-I.js";
|
|
2
|
-
import { $n as PublicProfileConflict, A as CommitTaskSessionOptions, Aa as WaitForOptions, Ai as SandboxTraceBundle, Bi as SendSessionMessageRequest, C as BranchOptions, Ci as SandboxStatus, Cn as ListMessagesOptions, Cr as SandboxCreateReceipt, D as CodeExecutionResult, E as CodeExecutionOptions, Et as FileSystem, Fa as WriteManyOptions, Fi as SearchMatch, H as CreateTaskSessionOptions, Hn as ProcessManager, Ii as SearchOptions, In as PreviewLinkManager, Ji as SessionInfo, Jn as PromptResult, Ka as RawEvidenceDirectoryExport, Kn as PromptInputPart, M as ConversationTurnOptions, Ma as WorkspaceOperationLookup, Mt as FileWriteResult, N as ConversationTurnResult, Na as WriteFileOptions, Ni as SandboxTraceOptions, O as CodeLanguage, Pa as WriteManyFile, Pn as PermissionsManager, Q as DispatchedSession, Qa as InteractionResolutionAcknowledgement, Qi as SessionMessageAdmission, Qt as ForkLookupOptions, Sa as TeePublicKeyResponse, Sn as JsonValue, Ta as TurnDriveResult, Tr as SandboxDeleteOptions, Ua as SandboxEnvRecovery, Ui as SessionEventStreamOptions, V as CreateSessionOptions, Vi as SentSessionMessage, Wa as SandboxEnvRecoveryView, Wi as SessionExecutionInfo, Xi as SessionListOptions, Xn as ProvisionResult, Xt as ForkCounts, Yi as SessionInterruptOptions, Yn as ProvisionEvent, Z as DispatchPromptOptions, Za as WorkspaceImagePublishResult$1, Zi as SessionMessage, Zt as ForkIdempotency, _n as IntelligenceReport, aa as SnapshotInfo, an as GitStatus, ba as TeeAttestationResponse, bi as SandboxShape, d as BackendConfig, dn as GpuLeaseManager, dr as Rollout, ea as SessionResultOptions, ei as SandboxFleetTraceBundle, fi as SandboxPortBinding, ga as TaskSessionInfo, gn as InstalledTool, gt as EventStreamOptions, hi as SandboxResourceUsage, hr as RolloutStartResult, in as GitDiff, it as DriverInfo, j as CompletedTurnResult, ja as WaitForRolloutOptions, jn as NetworkManager, ki as SandboxTerminals, kr as SandboxEvent, la as StartupDiagnostics, lr as RestoreSnapshotOptions, ma as TaskSessionCommitResult, na as SnapshotDeleteAcknowledgement, nn as GitCommit, nt as DriveTurnOptions, oa as SnapshotOptions, on as GpuLease, ot as DurablePlan, p as BackendManager, pa as TaskSessionChanges, pr as RolloutOptions, pt as EgressManager, qa as RawEvidenceExportOptions, qi as SessionForkOptions, qn as PromptOptions, sa as SnapshotResult, st as DurablePlanDecisionResult, tn as GitBranch, ui as SandboxInfo, ur as ResumeOptions, va as TeeAttestationOptions, vi as SandboxRuntimeCapabilities, vn as IntelligenceReportBudget, vr as SSHCommandDescriptor, vt as ExecOptions, wi as SandboxTerminalAttachOptions, wr as SandboxDeleteAcknowledgement, xn as IntelligenceReportWindow, xr as SandboxConnection, yi as SandboxRuntimeHealth, yn as IntelligenceReportCompareTo, yr as SSHCredentials, yt as ExecResult, zi as SendSessionMessageOptions } from "./types-
|
|
2
|
+
import { $n as PublicProfileConflict, A as CommitTaskSessionOptions, Aa as WaitForOptions, Ai as SandboxTraceBundle, Bi as SendSessionMessageRequest, C as BranchOptions, Ci as SandboxStatus, Cn as ListMessagesOptions, Cr as SandboxCreateReceipt, D as CodeExecutionResult, E as CodeExecutionOptions, Et as FileSystem, Fa as WriteManyOptions, Fi as SearchMatch, H as CreateTaskSessionOptions, Hn as ProcessManager, Ii as SearchOptions, In as PreviewLinkManager, Ji as SessionInfo, Jn as PromptResult, Ka as RawEvidenceDirectoryExport, Kn as PromptInputPart, M as ConversationTurnOptions, Ma as WorkspaceOperationLookup, Mt as FileWriteResult, N as ConversationTurnResult, Na as WriteFileOptions, Ni as SandboxTraceOptions, O as CodeLanguage, Pa as WriteManyFile, Pn as PermissionsManager, Q as DispatchedSession, Qa as InteractionResolutionAcknowledgement, Qi as SessionMessageAdmission, Qt as ForkLookupOptions, Sa as TeePublicKeyResponse, Sn as JsonValue, Ta as TurnDriveResult, Tr as SandboxDeleteOptions, Ua as SandboxEnvRecovery, Ui as SessionEventStreamOptions, V as CreateSessionOptions, Vi as SentSessionMessage, Wa as SandboxEnvRecoveryView, Wi as SessionExecutionInfo, Xi as SessionListOptions, Xn as ProvisionResult, Xt as ForkCounts, Yi as SessionInterruptOptions, Yn as ProvisionEvent, Z as DispatchPromptOptions, Za as WorkspaceImagePublishResult$1, Zi as SessionMessage, Zt as ForkIdempotency, _n as IntelligenceReport, aa as SnapshotInfo, an as GitStatus, ba as TeeAttestationResponse, bi as SandboxShape, d as BackendConfig, dn as GpuLeaseManager, dr as Rollout, ea as SessionResultOptions, ei as SandboxFleetTraceBundle, fi as SandboxPortBinding, ga as TaskSessionInfo, gn as InstalledTool, gt as EventStreamOptions, hi as SandboxResourceUsage, hr as RolloutStartResult, in as GitDiff, it as DriverInfo, j as CompletedTurnResult, ja as WaitForRolloutOptions, jn as NetworkManager, ki as SandboxTerminals, kr as SandboxEvent, la as StartupDiagnostics, lr as RestoreSnapshotOptions, ma as TaskSessionCommitResult, na as SnapshotDeleteAcknowledgement, nn as GitCommit, nt as DriveTurnOptions, oa as SnapshotOptions, on as GpuLease, ot as DurablePlan, p as BackendManager, pa as TaskSessionChanges, pr as RolloutOptions, pt as EgressManager, qa as RawEvidenceExportOptions, qi as SessionForkOptions, qn as PromptOptions, sa as SnapshotResult, st as DurablePlanDecisionResult, tn as GitBranch, ui as SandboxInfo, ur as ResumeOptions, va as TeeAttestationOptions, vi as SandboxRuntimeCapabilities, vn as IntelligenceReportBudget, vr as SSHCommandDescriptor, vt as ExecOptions, wi as SandboxTerminalAttachOptions, wr as SandboxDeleteAcknowledgement, xn as IntelligenceReportWindow, xr as SandboxConnection, yi as SandboxRuntimeHealth, yn as IntelligenceReportCompareTo, yr as SSHCredentials, yt as ExecResult, zi as SendSessionMessageOptions } from "./types-Di0cLhOV.js";
|
|
3
3
|
import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-B6bUr0hj.js";
|
|
4
4
|
import { f as InteractiveAttachOptions, g as InteractiveSessionStatus, h as InteractiveRequestOptions, m as InteractiveControlClaimOptions, p as InteractiveControlClaimAcknowledgement } from "./browser-interactive-control-controller-DRCfxOQz.js";
|
|
5
5
|
import { r as InteractiveAttachRequest } from "./interactive-controller-ykaThYp6.js";
|
|
6
|
-
import { R as SandboxLines } from "./lines-
|
|
6
|
+
import { R as SandboxLines } from "./lines-d9AEcbCd.js";
|
|
7
7
|
import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, AgentInteractiveTerminalSession as AgentInteractiveTerminalSession$1, AgentProfile, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, InteractionAcknowledgement, InteractionData, InteractionRequest, InteractionResponseCommand, TerminalOutputEvent, TerminalReplayWindow, agentInteractiveSessionPromptRequestDigest } from "@tangle-network/agent-interface";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
@@ -1124,10 +1124,11 @@ declare class SandboxInstance {
|
|
|
1124
1124
|
private buildRunBackendBody;
|
|
1125
1125
|
streamPrompt(message: string | PromptInputPart[], requestedOptions?: PromptOptions): AsyncGenerator<SandboxEvent>;
|
|
1126
1126
|
/**
|
|
1127
|
-
* Inner prompt stream: opens the SSE connection and
|
|
1128
|
-
* drops. May throw (pre-stream HTTP error, timeout,
|
|
1129
|
-
*
|
|
1130
|
-
* `
|
|
1127
|
+
* Inner prompt stream: opens the SSE connection and rejoins the execution's
|
|
1128
|
+
* event log on silent drops. May throw (pre-stream HTTP error, timeout, or
|
|
1129
|
+
* `StreamInterruptedError` when it cannot rejoin); the public
|
|
1130
|
+
* `streamPrompt` wrapper converts those throws into in-band events so
|
|
1131
|
+
* callers never see a thrown generator.
|
|
1131
1132
|
*/
|
|
1132
1133
|
private streamPromptInner;
|
|
1133
1134
|
/**
|
package/dist/tangle/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as ITangleJobsAbi, T as SandboxCreateResponseParamTypes, _ as JOB_SANDBOX_DELETE, a as fetchQuote, b as TangleSandboxClientConfig, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as JOB_SANDBOX_CREATE, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_CHAIN_ID, w as SandboxCreateParamTypes, x as AgentSandboxBlueprintAbi, y as TANGLE_JOBS_CONTRACT } from "../index-
|
|
1
|
+
import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as ITangleJobsAbi, T as SandboxCreateResponseParamTypes, _ as JOB_SANDBOX_DELETE, a as fetchQuote, b as TangleSandboxClientConfig, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as JOB_SANDBOX_CREATE, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_CHAIN_ID, w as SandboxCreateParamTypes, x as AgentSandboxBlueprintAbi, y as TANGLE_JOBS_CONTRACT } from "../index-Dv77g3s5.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JobQuoteDetails, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, QuoteDomain, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, SignedQuote, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
package/dist/tangle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as JOB_SANDBOX_DELETE, f as TANGLE_CHAIN_ID, g as JsonResponseParamTypes, h as ITangleJobsAbi, i as jobQuoteDigest, l as OperatorSessionError, m as AgentSandboxBlueprintAbi, n as fetchQuote, o as validateQuote, p as TANGLE_JOBS_CONTRACT, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as JOB_SANDBOX_CREATE, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-
|
|
1
|
+
import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as JOB_SANDBOX_DELETE, f as TANGLE_CHAIN_ID, g as JsonResponseParamTypes, h as ITangleJobsAbi, i as jobQuoteDigest, l as OperatorSessionError, m as AgentSandboxBlueprintAbi, n as fetchQuote, o as validateQuote, p as TANGLE_JOBS_CONTRACT, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as JOB_SANDBOX_CREATE, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-9TwNLIs5.js";
|
|
2
2
|
export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createSandboxInstanceFromResponse } from "./sandbox-
|
|
1
|
+
import { x as readResponseJson } from "./errors-DMxVFCS6.js";
|
|
2
|
+
import { n as createSandboxInstanceFromResponse } from "./sandbox-C42UAlFT.js";
|
|
3
3
|
import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-ChcSLv53.js";
|
|
4
4
|
//#region src/tangle/abi.ts
|
|
5
5
|
/**
|