@tangle-network/sandbox 0.11.1-develop.20260718000408.b3f0f2a → 0.11.1-develop.20260718023623.c7df56e
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 +39 -16
- package/dist/agent/index.d.ts +3 -3
- package/dist/{client-1LKomw8A.js → client-BYpjTOO7.js} +1 -1
- package/dist/{client-mpqiRmdi.d.ts → client-ChixG64E.d.ts} +2 -2
- package/dist/core.d.ts +3 -3
- package/dist/core.js +2 -2
- package/dist/{index-DD8we2b9.d.ts → index-CmLkWZDA.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/runtime.d.ts +1 -1
- package/dist/{sandbox-BhbAxbub.d.ts → sandbox-BBkFvFe6.d.ts} +6 -6
- package/dist/{sandbox-Cf25Dgrc.js → sandbox-Ban9d-wW.js} +5 -7
- package/dist/session-gateway/index.d.ts +82 -13
- package/dist/session-gateway/index.js +343 -144
- package/dist/tangle/index.d.ts +1 -1
- package/dist/tangle/index.js +1 -1
- package/dist/{tangle-DcGiYTx3.js → tangle-BbC2o7B8.js} +1 -1
- package/dist/{types-Di5KUpoc.d.ts → types-D6WC8r4K.d.ts} +16 -13
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -160,14 +160,22 @@ The decision tree:
|
|
|
160
160
|
### Dispatch + reconnect (the "Worker restart" pattern)
|
|
161
161
|
|
|
162
162
|
```typescript
|
|
163
|
-
import { Sandbox } from "@tangle-network/sandbox";
|
|
163
|
+
import { Sandbox } from "@tangle-network/sandbox/core";
|
|
164
164
|
|
|
165
165
|
const client = new Sandbox({ apiKey: process.env.TANGLE_API_KEY! });
|
|
166
166
|
|
|
167
|
-
// In your /chat handler
|
|
168
|
-
|
|
167
|
+
// In your /chat handler, authenticate first. Derive this stable runtime
|
|
168
|
+
// session ID from the authenticated user, conversation, and turn with a
|
|
169
|
+
// server-side HMAC; never accept a caller-selected runtime session ID.
|
|
170
|
+
const turnId = requireStableTurnId(req);
|
|
171
|
+
const sessionId = await deriveOwnedTurnSessionId(
|
|
172
|
+
user.id,
|
|
173
|
+
conversationId,
|
|
174
|
+
turnId,
|
|
175
|
+
);
|
|
169
176
|
const { sessionId: id, alreadyExisted } = await box.dispatchPrompt(prompt, {
|
|
170
|
-
sessionId,
|
|
177
|
+
sessionId,
|
|
178
|
+
turnId,
|
|
171
179
|
});
|
|
172
180
|
|
|
173
181
|
// Stream to the browser; if the client comes back later with the same sessionId
|
|
@@ -179,32 +187,43 @@ for await (const event of box.session(id).events({
|
|
|
179
187
|
}
|
|
180
188
|
```
|
|
181
189
|
|
|
182
|
-
### Browser-direct streaming (without proxying
|
|
190
|
+
### Browser-direct streaming (without proxying the stream through your server)
|
|
183
191
|
|
|
184
192
|
```typescript
|
|
185
193
|
import { SessionGatewayClient } from "@tangle-network/sandbox/session-gateway";
|
|
186
194
|
|
|
187
|
-
const
|
|
195
|
+
const sessionId =
|
|
196
|
+
localStorage.getItem("sandbox-browser-session") ?? crypto.randomUUID();
|
|
197
|
+
localStorage.setItem("sandbox-browser-session", sessionId);
|
|
198
|
+
|
|
199
|
+
// The browser sends only sessionId. Your authenticated backend looks up the
|
|
200
|
+
// owned runtime session and mints with both sessionId and runtimeSessionId:
|
|
201
|
+
// box.mintScopedToken({ scope: "session", sessionId, runtimeSessionId })
|
|
202
|
+
const scoped = await fetchScopedToken({ sessionId });
|
|
203
|
+
let client: SessionGatewayClient;
|
|
204
|
+
client = new SessionGatewayClient({
|
|
188
205
|
url: "wss://your-sandbox-api.example.com/session",
|
|
189
|
-
token:
|
|
206
|
+
token: scoped.token,
|
|
190
207
|
sessionId,
|
|
208
|
+
onTokenRefresh: () => fetchScopedToken({ sessionId }),
|
|
191
209
|
autoReconnect: true,
|
|
192
|
-
enableReplayPersistence: true,
|
|
193
|
-
replayStorage:
|
|
210
|
+
enableReplayPersistence: true,
|
|
211
|
+
replayStorage: window.localStorage,
|
|
194
212
|
handlers: {
|
|
195
|
-
|
|
196
|
-
onReplayStart: (
|
|
213
|
+
onAgentEvent: (_channel, event, seq) => render(event, seq),
|
|
214
|
+
onReplayStart: (total) => showSpinner(`replaying ${total} events`),
|
|
197
215
|
onReplayComplete: () => hideSpinner(),
|
|
198
|
-
onBackpressureWarning: (
|
|
199
|
-
suggestReplay && client.replay(client.stats.replay.lastEventId),
|
|
216
|
+
onBackpressureWarning: (_droppedCount, since) => void client.replay(since),
|
|
200
217
|
},
|
|
201
218
|
});
|
|
202
219
|
client.connect();
|
|
203
220
|
```
|
|
204
221
|
|
|
205
|
-
`SessionGatewayClient` handles auto-reconnect with exponential backoff,
|
|
206
|
-
|
|
207
|
-
|
|
222
|
+
`SessionGatewayClient` handles auto-reconnect with exponential backoff, event deduplication, replay-on-reconnect, and `lastEventId` persistence.
|
|
223
|
+
None of this requires a Durable Object.
|
|
224
|
+
The initial scoped token must be fetched before `connect()`; `onTokenRefresh` only handles later rotation.
|
|
225
|
+
Public operations reject if `connection.established` does not arrive within `connectionEstablishmentTimeoutMs` (10 seconds by default).
|
|
226
|
+
Use `handlers.onMessage` to observe every non-duplicate normalized frame after the client processes it; its `id` and canonical `seq` fields cover runtime, project, terminal, and control messages, while `onAgentEvent` is the agent-event convenience callback.
|
|
208
227
|
|
|
209
228
|
Server-originated product events can arrive before the browser connects:
|
|
210
229
|
|
|
@@ -219,6 +238,10 @@ The public API binds that pending queue to the authenticated product and Sandbox
|
|
|
219
238
|
A later connection by the same owner leases and acknowledges the ordered queue; another owner receives none of it.
|
|
220
239
|
A gateway crash before acknowledgement redelivers the same event IDs, which the default `SessionGatewayClient` deduplicates before invoking handlers.
|
|
221
240
|
|
|
241
|
+
The Worker example authenticates before touching the account-key-backed Sandbox client and derives a user-owned runtime session ID from the user, conversation, and turn.
|
|
242
|
+
A retry with the same `x-conversation-id` and `x-turn-id` reuses one execution; a distinct turn gets a distinct execution.
|
|
243
|
+
The detached run survives a Worker or browser response ending; reconnect with the same conversation ID, turn ID, and `Last-Event-ID` to resume.
|
|
244
|
+
|
|
222
245
|
See `examples/cf-worker-chat.ts`, `examples/browser-streaming-resume.ts`, and
|
|
223
246
|
`examples/reconnect-from-last-event-id.ts` for end-to-end patterns.
|
|
224
247
|
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as CodeExecutionOptions, O as CodeExecutionResult, j as CodeResultPart, k as CodeLanguage } from "../types-
|
|
2
|
-
import { n as SandboxInstance } from "../sandbox-
|
|
3
|
-
import { i as SandboxClient } from "../client-
|
|
1
|
+
import { D as CodeExecutionOptions, O as CodeExecutionResult, j as CodeResultPart, k as CodeLanguage } from "../types-D6WC8r4K.js";
|
|
2
|
+
import { n as SandboxInstance } from "../sandbox-BBkFvFe6.js";
|
|
3
|
+
import { i as SandboxClient } from "../client-ChixG64E.js";
|
|
4
4
|
import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
|
|
6
6
|
//#region src/agent/tools/_specs.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as encodeTextForWire, i as SANDBOX_PROXY_REQUEST_MAX_BYTES, o as combineAbortSignals, s as encodePromptForWire } from "./runtime-api-fqaQ3CN2.js";
|
|
2
2
|
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, o as PartialFailureError, p as parseErrorResponse, t as AuthError } from "./errors-Cbs78OlF.js";
|
|
3
|
-
import { d as exportTraceBundle, l as normalizeConnection, m as parseSSEStream, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-
|
|
3
|
+
import { d as exportTraceBundle, l as normalizeConnection, m as parseSSEStream, n as normalizeStartupDiagnostics, t as SandboxInstance } from "./sandbox-Ban9d-wW.js";
|
|
4
4
|
//#region src/resources.ts
|
|
5
5
|
/**
|
|
6
6
|
* Compute tiers, ordered smallest → largest. Defined HERE (not imported from
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $n as SandboxFleetArtifactSpec, An as PublishPublicTemplateVersionOptions, Ar as SandboxProfileSummary, B as CreateSandboxOptions, Cr as SandboxFleetWorkspaceRestoreResult, Ct as FleetExecDispatchOptions, Dn as PublicTemplateInfo, Dt as FleetPromptDispatchResult, Et as FleetPromptDispatchOptions, F as CreateIntelligenceReportOptions, Fi as UsageInfo, I as CreateRequestOptions, Jn as SandboxClientConfig, Jt as IntelligenceReportBudget, L as CreateSandboxFleetOptions, Mn as ReapExpiredSandboxFleetsResult, Nn as ReconcileSandboxFleetsOptions, On as PublicTemplateVersionInfo, Pn as ReconcileSandboxFleetsResult, Qn as SandboxFleetArtifact, R as CreateSandboxFleetTokenOptions, Sn as PromptResult, Sr as SandboxFleetWorkspaceReconcileResult, St as FleetDispatchStreamOptions, Tr as SandboxInfo, Tt as FleetMachineId, Xn as SandboxEnvironment, Yt as IntelligenceReportCompareTo, Zr as SecretsManager, Zt as IntelligenceReportWindow, _ as BatchResult, a as AttachSandboxFleetMachineOptions, ar as SandboxFleetInfo, bn as PromptInputPart, br as SandboxFleetUsage, bt as FleetDispatchResultBuffer, dr as SandboxFleetManifest, er as SandboxFleetCostEstimate, fi as SshKeysManager, g as BatchOptions, gi as SubscriptionInfo, gr as SandboxFleetTraceBundle, hr as SandboxFleetToken, jn as ReapExpiredSandboxFleetsOptions, ki as TokenRefreshHandler, kn as PublishPublicTemplateOptions, lr as SandboxFleetMachineRecord, m as BatchEvent, nn as ListSandboxOptions, nr as SandboxFleetDispatchResponse, ot as ExecOptions, pr as SandboxFleetOperationsSummary, qt as IntelligenceReport, rr as SandboxFleetDriverCapability, st as ExecResult, tn as ListSandboxFleetOptions, v as BatchRunOptions, wr as SandboxFleetWorkspaceSnapshotResult, wt as FleetExecDispatchResult, x as BatchTask, xn as PromptOptions, xt as FleetDispatchResultBufferOptions, y as BatchRunRequest, yr as SandboxFleetTraceOptions, yt as FleetDispatchCancelResult, z as CreateSandboxFleetWithCoordinatorOptions } from "./types-
|
|
2
|
-
import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { $n as SandboxFleetArtifactSpec, An as PublishPublicTemplateVersionOptions, Ar as SandboxProfileSummary, B as CreateSandboxOptions, Cr as SandboxFleetWorkspaceRestoreResult, Ct as FleetExecDispatchOptions, Dn as PublicTemplateInfo, Dt as FleetPromptDispatchResult, Et as FleetPromptDispatchOptions, F as CreateIntelligenceReportOptions, Fi as UsageInfo, I as CreateRequestOptions, Jn as SandboxClientConfig, Jt as IntelligenceReportBudget, L as CreateSandboxFleetOptions, Mn as ReapExpiredSandboxFleetsResult, Nn as ReconcileSandboxFleetsOptions, On as PublicTemplateVersionInfo, Pn as ReconcileSandboxFleetsResult, Qn as SandboxFleetArtifact, R as CreateSandboxFleetTokenOptions, Sn as PromptResult, Sr as SandboxFleetWorkspaceReconcileResult, St as FleetDispatchStreamOptions, Tr as SandboxInfo, Tt as FleetMachineId, Xn as SandboxEnvironment, Yt as IntelligenceReportCompareTo, Zr as SecretsManager, Zt as IntelligenceReportWindow, _ as BatchResult, a as AttachSandboxFleetMachineOptions, ar as SandboxFleetInfo, bn as PromptInputPart, br as SandboxFleetUsage, bt as FleetDispatchResultBuffer, dr as SandboxFleetManifest, er as SandboxFleetCostEstimate, fi as SshKeysManager, g as BatchOptions, gi as SubscriptionInfo, gr as SandboxFleetTraceBundle, hr as SandboxFleetToken, jn as ReapExpiredSandboxFleetsOptions, ki as TokenRefreshHandler, kn as PublishPublicTemplateOptions, lr as SandboxFleetMachineRecord, m as BatchEvent, nn as ListSandboxOptions, nr as SandboxFleetDispatchResponse, ot as ExecOptions, pr as SandboxFleetOperationsSummary, qt as IntelligenceReport, rr as SandboxFleetDriverCapability, st as ExecResult, tn as ListSandboxFleetOptions, v as BatchRunOptions, wr as SandboxFleetWorkspaceSnapshotResult, wt as FleetExecDispatchResult, x as BatchTask, xn as PromptOptions, xt as FleetDispatchResultBufferOptions, y as BatchRunRequest, yr as SandboxFleetTraceOptions, yt as FleetDispatchCancelResult, z as CreateSandboxFleetWithCoordinatorOptions } from "./types-D6WC8r4K.js";
|
|
2
|
+
import { a as TraceExportSink, i as TraceExportResult, n as SandboxInstance, t as HttpClient } from "./sandbox-BBkFvFe6.js";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/sse-parser.d.ts
|
|
5
5
|
/**
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as CreateSandboxOptions, Ir as SandboxStatus, Jn as SandboxClientConfig, Tr as SandboxInfo, dn as PreviewLinkInfo, fn as PreviewLinkManager, on as NetworkConfig, ot as ExecOptions, st as ExecResult } from "./types-
|
|
2
|
-
import { n as SandboxInstance } from "./sandbox-
|
|
3
|
-
import { i as SandboxClient } from "./client-
|
|
1
|
+
import { B as CreateSandboxOptions, Ir as SandboxStatus, Jn as SandboxClientConfig, Tr as SandboxInfo, dn as PreviewLinkInfo, fn as PreviewLinkManager, on as NetworkConfig, ot as ExecOptions, st as ExecResult } from "./types-D6WC8r4K.js";
|
|
2
|
+
import { n as SandboxInstance } from "./sandbox-BBkFvFe6.js";
|
|
3
|
+
import { i as SandboxClient } from "./client-ChixG64E.js";
|
|
4
4
|
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-ntvaf0_F.js";
|
|
5
5
|
export { AuthError, CapabilityError, type CreateSandboxOptions, type ExecOptions, type ExecResult, type NetworkConfig, NetworkError, NotFoundError, PartialFailureError, type PreviewLinkInfo, type PreviewLinkManager, QuotaError, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, type SandboxInfo, SandboxInstance, type SandboxStatus, ServerError, StateError, TimeoutError, ValidationError };
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, s as QuotaError, t as AuthError, u as StateError } from "./errors-Cbs78OlF.js";
|
|
2
|
-
import { t as SandboxInstance } from "./sandbox-
|
|
3
|
-
import { n as SandboxClient } from "./client-
|
|
2
|
+
import { t as SandboxInstance } from "./sandbox-Ban9d-wW.js";
|
|
3
|
+
import { n as SandboxClient } from "./client-BYpjTOO7.js";
|
|
4
4
|
export { AuthError, CapabilityError, NetworkError, NotFoundError, PartialFailureError, QuotaError, SandboxClient as Sandbox, SandboxClient, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as CreateSandboxOptions } from "./types-
|
|
2
|
-
import { n as SandboxInstance, t as HttpClient } from "./sandbox-
|
|
1
|
+
import { B as CreateSandboxOptions } from "./types-D6WC8r4K.js";
|
|
2
|
+
import { n as SandboxInstance, t as HttpClient } from "./sandbox-BBkFvFe6.js";
|
|
3
3
|
|
|
4
4
|
//#region src/tangle/abi.d.ts
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as DriverType, $i as AgentProfileValidationIssue, $n as SandboxFleetArtifactSpec, $r as SendSessionMessageRequest, $t as ListMessagesOptions, A as CodeResult, Ai as ToolsConfig, An as PublishPublicTemplateVersionOptions, Ar as SandboxProfileSummary, At as GitBranch, B as CreateSandboxOptions, Bi as WriteManyOptions, Bn as RolloutOptions, Br as SandboxTerminalRequestOptions, Bt as GpuLeaseManager, C as BatchTaskUsage, Ci as TaskSessionProfile, Cn as ProvisionEvent, Cr as SandboxFleetWorkspaceRestoreResult, Ct as FleetExecDispatchOptions, Di as TeePublicKey, Dn as PublicTemplateInfo, Dr as SandboxPermissionsConfig, E as ChunkedUploadResult, Ei as TeeAttestationResponse, En as ProvisionStep, Er as SandboxIntelligenceEnvelope, Et as FleetPromptDispatchOptions, F as CreateIntelligenceReportOptions, Fi as UsageInfo, Fn as RenameOptions, Fr as SandboxRuntimeProfileList, Ft as GpuLease, G as DirectoryPermission, Gi as AgentProfileFileMount, Gn as RunCodeOptions, Gr as SandboxUser, Gt as HostAgentRuntimeBackend, H as CreateTaskSessionOptions, Hi as AgentProfileCapabilities, Hn as RolloutStartResult, Hr as SandboxTraceEvent, Ht as GpuLeaseStatus, I as CreateRequestOptions, Ii as WaitForOptions, Ir as SandboxStatus, It as GpuLeaseBilling, J as DownloadOptions, Ji as AgentProfilePermissionValue, Jn as SandboxClientConfig, Jr as SearchMatch, Jt as IntelligenceReportBudget, K as DispatchPromptOptions, Ki as AgentProfileMcpServer, Kn as SSHCommandDescriptor, Kr as ScopedToken, Kt as InstalledTool, L as CreateSandboxFleetOptions, Li as WaitForRolloutOptions, Lr as SandboxTerminalCreateOptions, Lt as GpuLeaseCommandResult, M as CommitTaskSessionOptions, Mi as UpdateUserOptions, Mn as ReapExpiredSandboxFleetsResult, Mr as SandboxResources, Mt as GitConfig, N as CompletedTurnResult, Ni as UploadOptions, Nn as ReconcileSandboxFleetsOptions, Nr as SandboxRuntimeHealth, Nt as GitDiff, Oi as TeePublicKeyResponse, On as PublicTemplateVersionInfo, Or as SandboxPortBinding, Ot as GPU_LEASE_PROVIDER_NAMES, P as CreateGpuLeaseOptions, Pi as UploadProgress, Pn as ReconcileSandboxFleetsResult, Pr as SandboxRuntimeProfile, Pt as GitStatus, Q as DriverInfo, Qi as AgentProfileSecurityPolicy, Qn as SandboxFleetArtifact, Qr as SendSessionMessageOptions, Ri as WriteFileOptions, Rn as Rollout, Rr as SandboxTerminalInfo, Rt as GpuLeaseExecOptions, S as BatchTaskResult, Si as TaskSessionInfo, Sn as PromptResult, Sr as SandboxFleetWorkspaceReconcileResult, St as FleetDispatchStreamOptions, T as ChunkedUploadOptions, Ti as TeeAttestationReport, Tn as ProvisionStatus, Tr as SandboxInfo, Tt as FleetMachineId, U as DeleteOptions, Ui as AgentProfileConfidential, Un as RolloutStatus, Ur as SandboxTraceExport, Ut as GpuType, V as CreateSessionOptions, Vi as AgentProfile, Vn as RolloutScorer, Vr as SandboxTraceBundle, Vt as GpuLeaseProviderName, W as DevServerInfo, Wi as AgentProfileConnection, Wn as RolloutTurnPart, Wr as SandboxTraceOptions, Wt as HostAgentDriverConfig, X as DriveTurnOptions, Xi as AgentProfileResourceRef, Xn as SandboxEnvironment, Xr as SecretInfo, Xt as IntelligenceReportSubjectType, Y as DownloadProgress, Yi as AgentProfilePrompt, Yn as SandboxConnection, Yr as SearchOptions, Yt as IntelligenceReportCompareTo, Z as DriverConfig, Zi as AgentProfileResources, Zn as SandboxEvent, Zr as SecretsManager, Zt as IntelligenceReportWindow, _ as BatchResult, _i as TaskOptions, _n as ProcessSignal, _r as SandboxFleetTraceEvent, _t as FileTreeResult, a as AttachSandboxFleetMachineOptions, aa as defineAgentProfile, ai as SessionListOptions, an as MkdirOptions, ar as SandboxFleetInfo, at as ExactProcessSpawnOptions, b as BatchSidecarGroup, bi as TaskSessionCommitResult, br as SandboxFleetUsage, bt as FleetDispatchResultBuffer, c as BackendInfo, ca as mergeAgentProfiles, ci as SessionStatus, cn as NonHostAgentDriverConfig, cr as SandboxFleetMachineMeteredUsage, ct as FileInfo, d as BackendType, di as SnapshotResult, dn as PreviewLinkInfo, dr as SandboxFleetManifest, dt as FileReadError, ea as AgentProfileValidationResult, ei as SentSessionMessage, en as ListOptions, er as SandboxFleetCostEstimate, f as BatchBackend, fn as PreviewLinkManager, fr as SandboxFleetManifestMachine, ft as FileReadResult, g as BatchOptions, gi as SubscriptionInfo, gn as ProcessManager, gr as SandboxFleetTraceBundle, gt as FileTreeOptions, h as BatchEventDataMap, hi as StorageConfig, hn as ProcessLogEntry, hr as SandboxFleetToken, ht as FileTreeFile, i as AttachGpuLeaseOptions, ia as capabilitySchema, ii as SessionInfo, in as MintScopedTokenOptions, ir as SandboxFleetDriverTimings, it as EventStreamOptions, ji as TurnDriveResult, jn as ReapExpiredSandboxFleetsOptions, jr as SandboxResourceUsage, jt as GitCommit, ki as TokenRefreshHandler, kn as PublishPublicTemplateOptions, kr as SandboxPortPreviewLink, kt as GitAuth, l as BackendManager, la as validateAgentProfileSecurity, li as SnapshotInfo, ln as PermissionLevel, lr as SandboxFleetMachineRecord, lt as FileReadBatchOptions, m as BatchEvent, mi as StartupOperation, mn as ProcessInfo, mr as SandboxFleetPolicy, mt as FileSystem, n as AccessPolicyRule, na as Capability, ni as SessionEventStreamOptions, nn as ListSandboxOptions, nr as SandboxFleetDispatchResponse, nt as EgressPolicy, o as BackendCapabilities, oa as defineGitHubResource, oi as SessionMessage, on as NetworkConfig, or as SandboxFleetIntelligenceEnvelope, ot as ExecOptions, p as BatchBackendStats, pi as StartupDiagnostics, pn as Process, pr as SandboxFleetOperationsSummary, pt as FileRenameResult, q as DispatchedSession, qi as AgentProfileModelHints, qn as SSHCredentials, qr as ScopedTokenScope, qt as IntelligenceReport, r as AddUserOptions, ra as agentProfileSchema, ri as SessionForkOptions, rn as McpServerConfig, rr as SandboxFleetDriverCapability, rt as EnsureDevServerOptions, s as BackendConfig, sa as defineInlineResource, si as SessionMessageInputPart, sn as NetworkManager, sr as SandboxFleetMachine, st as ExecResult, t as AcceleratorKind, ta as AgentSubagentProfile, ti as SessionBackendCredentials, tn as ListSandboxFleetOptions, tr as SandboxFleetDispatchFailureClass, tt as EgressManager, u as BackendStatus, ui as SnapshotOptions, un as PermissionsManager, ur as SandboxFleetMachineSpec, ut as FileReadBatchResult, v as BatchRunOptions, vi as TaskResult, vn as ProcessSpawnOptions, vr as SandboxFleetTraceExport, vt as FileWriteResult, w as BranchOptions, wi as TeeAttestationOptions, wn as ProvisionResult, wr as SandboxFleetWorkspaceSnapshotResult, x as BatchTask, xi as TaskSessionFileChange, xn as PromptOptions, xr as SandboxFleetWorkspace, xt as FleetDispatchResultBufferOptions, y as BatchRunRequest, yi as TaskSessionChanges, yn as ProcessStatus, yr as SandboxFleetTraceOptions, yt as FleetDispatchCancelResult, z as CreateSandboxFleetWithCoordinatorOptions, zi as WriteManyFile, zn as RolloutChildResult, zr as SandboxTerminalManager, zt as GpuLeaseExecResult } from "./types-
|
|
2
|
-
import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-
|
|
3
|
-
import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-
|
|
1
|
+
import { $ as DriverType, $i as AgentProfileValidationIssue, $n as SandboxFleetArtifactSpec, $r as SendSessionMessageRequest, $t as ListMessagesOptions, A as CodeResult, Ai as ToolsConfig, An as PublishPublicTemplateVersionOptions, Ar as SandboxProfileSummary, At as GitBranch, B as CreateSandboxOptions, Bi as WriteManyOptions, Bn as RolloutOptions, Br as SandboxTerminalRequestOptions, Bt as GpuLeaseManager, C as BatchTaskUsage, Ci as TaskSessionProfile, Cn as ProvisionEvent, Cr as SandboxFleetWorkspaceRestoreResult, Ct as FleetExecDispatchOptions, Di as TeePublicKey, Dn as PublicTemplateInfo, Dr as SandboxPermissionsConfig, E as ChunkedUploadResult, Ei as TeeAttestationResponse, En as ProvisionStep, Er as SandboxIntelligenceEnvelope, Et as FleetPromptDispatchOptions, F as CreateIntelligenceReportOptions, Fi as UsageInfo, Fn as RenameOptions, Fr as SandboxRuntimeProfileList, Ft as GpuLease, G as DirectoryPermission, Gi as AgentProfileFileMount, Gn as RunCodeOptions, Gr as SandboxUser, Gt as HostAgentRuntimeBackend, H as CreateTaskSessionOptions, Hi as AgentProfileCapabilities, Hn as RolloutStartResult, Hr as SandboxTraceEvent, Ht as GpuLeaseStatus, I as CreateRequestOptions, Ii as WaitForOptions, Ir as SandboxStatus, It as GpuLeaseBilling, J as DownloadOptions, Ji as AgentProfilePermissionValue, Jn as SandboxClientConfig, Jr as SearchMatch, Jt as IntelligenceReportBudget, K as DispatchPromptOptions, Ki as AgentProfileMcpServer, Kn as SSHCommandDescriptor, Kr as ScopedToken, Kt as InstalledTool, L as CreateSandboxFleetOptions, Li as WaitForRolloutOptions, Lr as SandboxTerminalCreateOptions, Lt as GpuLeaseCommandResult, M as CommitTaskSessionOptions, Mi as UpdateUserOptions, Mn as ReapExpiredSandboxFleetsResult, Mr as SandboxResources, Mt as GitConfig, N as CompletedTurnResult, Ni as UploadOptions, Nn as ReconcileSandboxFleetsOptions, Nr as SandboxRuntimeHealth, Nt as GitDiff, Oi as TeePublicKeyResponse, On as PublicTemplateVersionInfo, Or as SandboxPortBinding, Ot as GPU_LEASE_PROVIDER_NAMES, P as CreateGpuLeaseOptions, Pi as UploadProgress, Pn as ReconcileSandboxFleetsResult, Pr as SandboxRuntimeProfile, Pt as GitStatus, Q as DriverInfo, Qi as AgentProfileSecurityPolicy, Qn as SandboxFleetArtifact, Qr as SendSessionMessageOptions, Ri as WriteFileOptions, Rn as Rollout, Rr as SandboxTerminalInfo, Rt as GpuLeaseExecOptions, S as BatchTaskResult, Si as TaskSessionInfo, Sn as PromptResult, Sr as SandboxFleetWorkspaceReconcileResult, St as FleetDispatchStreamOptions, T as ChunkedUploadOptions, Ti as TeeAttestationReport, Tn as ProvisionStatus, Tr as SandboxInfo, Tt as FleetMachineId, U as DeleteOptions, Ui as AgentProfileConfidential, Un as RolloutStatus, Ur as SandboxTraceExport, Ut as GpuType, V as CreateSessionOptions, Vi as AgentProfile, Vn as RolloutScorer, Vr as SandboxTraceBundle, Vt as GpuLeaseProviderName, W as DevServerInfo, Wi as AgentProfileConnection, Wn as RolloutTurnPart, Wr as SandboxTraceOptions, Wt as HostAgentDriverConfig, X as DriveTurnOptions, Xi as AgentProfileResourceRef, Xn as SandboxEnvironment, Xr as SecretInfo, Xt as IntelligenceReportSubjectType, Y as DownloadProgress, Yi as AgentProfilePrompt, Yn as SandboxConnection, Yr as SearchOptions, Yt as IntelligenceReportCompareTo, Z as DriverConfig, Zi as AgentProfileResources, Zn as SandboxEvent, Zr as SecretsManager, Zt as IntelligenceReportWindow, _ as BatchResult, _i as TaskOptions, _n as ProcessSignal, _r as SandboxFleetTraceEvent, _t as FileTreeResult, a as AttachSandboxFleetMachineOptions, aa as defineAgentProfile, ai as SessionListOptions, an as MkdirOptions, ar as SandboxFleetInfo, at as ExactProcessSpawnOptions, b as BatchSidecarGroup, bi as TaskSessionCommitResult, br as SandboxFleetUsage, bt as FleetDispatchResultBuffer, c as BackendInfo, ca as mergeAgentProfiles, ci as SessionStatus, cn as NonHostAgentDriverConfig, cr as SandboxFleetMachineMeteredUsage, ct as FileInfo, d as BackendType, di as SnapshotResult, dn as PreviewLinkInfo, dr as SandboxFleetManifest, dt as FileReadError, ea as AgentProfileValidationResult, ei as SentSessionMessage, en as ListOptions, er as SandboxFleetCostEstimate, f as BatchBackend, fn as PreviewLinkManager, fr as SandboxFleetManifestMachine, ft as FileReadResult, g as BatchOptions, gi as SubscriptionInfo, gn as ProcessManager, gr as SandboxFleetTraceBundle, gt as FileTreeOptions, h as BatchEventDataMap, hi as StorageConfig, hn as ProcessLogEntry, hr as SandboxFleetToken, ht as FileTreeFile, i as AttachGpuLeaseOptions, ia as capabilitySchema, ii as SessionInfo, in as MintScopedTokenOptions, ir as SandboxFleetDriverTimings, it as EventStreamOptions, ji as TurnDriveResult, jn as ReapExpiredSandboxFleetsOptions, jr as SandboxResourceUsage, jt as GitCommit, ki as TokenRefreshHandler, kn as PublishPublicTemplateOptions, kr as SandboxPortPreviewLink, kt as GitAuth, l as BackendManager, la as validateAgentProfileSecurity, li as SnapshotInfo, ln as PermissionLevel, lr as SandboxFleetMachineRecord, lt as FileReadBatchOptions, m as BatchEvent, mi as StartupOperation, mn as ProcessInfo, mr as SandboxFleetPolicy, mt as FileSystem, n as AccessPolicyRule, na as Capability, ni as SessionEventStreamOptions, nn as ListSandboxOptions, nr as SandboxFleetDispatchResponse, nt as EgressPolicy, o as BackendCapabilities, oa as defineGitHubResource, oi as SessionMessage, on as NetworkConfig, or as SandboxFleetIntelligenceEnvelope, ot as ExecOptions, p as BatchBackendStats, pi as StartupDiagnostics, pn as Process, pr as SandboxFleetOperationsSummary, pt as FileRenameResult, q as DispatchedSession, qi as AgentProfileModelHints, qn as SSHCredentials, qr as ScopedTokenScope, qt as IntelligenceReport, r as AddUserOptions, ra as agentProfileSchema, ri as SessionForkOptions, rn as McpServerConfig, rr as SandboxFleetDriverCapability, rt as EnsureDevServerOptions, s as BackendConfig, sa as defineInlineResource, si as SessionMessageInputPart, sn as NetworkManager, sr as SandboxFleetMachine, st as ExecResult, t as AcceleratorKind, ta as AgentSubagentProfile, ti as SessionBackendCredentials, tn as ListSandboxFleetOptions, tr as SandboxFleetDispatchFailureClass, tt as EgressManager, u as BackendStatus, ui as SnapshotOptions, un as PermissionsManager, ur as SandboxFleetMachineSpec, ut as FileReadBatchResult, v as BatchRunOptions, vi as TaskResult, vn as ProcessSpawnOptions, vr as SandboxFleetTraceExport, vt as FileWriteResult, w as BranchOptions, wi as TeeAttestationOptions, wn as ProvisionResult, wr as SandboxFleetWorkspaceSnapshotResult, x as BatchTask, xi as TaskSessionFileChange, xn as PromptOptions, xr as SandboxFleetWorkspace, xt as FleetDispatchResultBufferOptions, y as BatchRunRequest, yi as TaskSessionChanges, yn as ProcessStatus, yr as SandboxFleetTraceOptions, yt as FleetDispatchCancelResult, z as CreateSandboxFleetWithCoordinatorOptions, zi as WriteManyFile, zn as RolloutChildResult, zr as SandboxTerminalManager, zt as GpuLeaseExecResult } from "./types-D6WC8r4K.js";
|
|
2
|
+
import { C as SandboxMcpConfig, D as buildSandboxMcpConfig, E as buildControlPlaneMcpConfig, S as SANDBOX_MCP_SERVER_NAME, T as SandboxMcpServerEntry, _ as RespondToPermissionOptions, a as TraceExportSink, b as BuildSandboxMcpConfigOptions, c as otelTraceIdForTangleTrace, d as SandboxSession, f as InteractiveAuthFile, g as InterruptResult, h as InteractiveSessionInfo, i as TraceExportResult, l as toOtelJson, m as InteractiveSessionHost, n as SandboxInstance, o as buildTraceExportPayload, p as InteractiveSessionHandle, r as TraceExportFormat, s as exportTraceBundle, u as SandboxTaskSession, v as StartInteractiveOptions, w as SandboxMcpEndpoint, x as CONTROL_PLANE_MCP_SERVER_NAME, y as BuildControlPlaneMcpConfigOptions } from "./sandbox-BBkFvFe6.js";
|
|
3
|
+
import { a as Team, c as SessionBroadcastEvent, d as SandboxFleetClient, f as ParseSSEStreamOptions, i as SandboxClient, l as SessionBroadcastResult, m as parseSSEStream, n as IntelligenceClient, o as TeamInvitation, p as ParsedSSEEvent, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as SandboxFleet } from "./client-ChixG64E.js";
|
|
4
4
|
import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-CyHojkuA.js";
|
|
5
5
|
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "./index-DKzapw-9.js";
|
|
6
6
|
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-ntvaf0_F.js";
|
|
7
|
-
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-
|
|
7
|
+
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-CmLkWZDA.js";
|
|
8
8
|
|
|
9
9
|
//#region src/attestation-heartbeat.d.ts
|
|
10
10
|
interface TeeAttestationHeartbeatSample {
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { d as serializeForSidecar, l as normalizeRuntimeBackendConfig } from "./runtime-api-fqaQ3CN2.js";
|
|
2
2
|
import { a as NotFoundError, c as SandboxError, d as TimeoutError, f as ValidationError, i as NetworkError, l as ServerError, n as CapabilityError, o as PartialFailureError, r as EgressProxyRecoveryError, s as QuotaError, t as AuthError, u as StateError } from "./errors-Cbs78OlF.js";
|
|
3
|
-
import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, i as SandboxSession, m as parseSSEStream, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-
|
|
4
|
-
import { a as validateDeferredProfileFileMounts, c as DEFAULT_SANDBOX_SIZE, d as resolveSandboxResources, f as sandboxResourcesForSize, i as splitInlineProfileFileMounts, l as SANDBOX_SIZE_PRESETS, n as SandboxClient, o as SandboxFleet, r as materializeProfileFileMounts, s as SandboxFleetClient, t as IntelligenceClient, u as SANDBOX_SIZE_PRESET_NAMES } from "./client-
|
|
3
|
+
import { a as InteractiveSessionHandle, c as getSandboxEventText, d as exportTraceBundle, f as otelTraceIdForTangleTrace, i as SandboxSession, m as parseSSEStream, o as applySandboxEventText, p as toOtelJson, r as SandboxTaskSession, s as collectAgentResponseText, t as SandboxInstance, u as buildTraceExportPayload } from "./sandbox-Ban9d-wW.js";
|
|
4
|
+
import { a as validateDeferredProfileFileMounts, c as DEFAULT_SANDBOX_SIZE, d as resolveSandboxResources, f as sandboxResourcesForSize, i as splitInlineProfileFileMounts, l as SANDBOX_SIZE_PRESETS, n as SandboxClient, o as SandboxFleet, r as materializeProfileFileMounts, s as SandboxFleetClient, t as IntelligenceClient, u as SANDBOX_SIZE_PRESET_NAMES } from "./client-BYpjTOO7.js";
|
|
5
5
|
import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DDnuTcZd.js";
|
|
6
|
-
import { t as TangleSandboxClient } from "./tangle-
|
|
6
|
+
import { t as TangleSandboxClient } from "./tangle-BbC2o7B8.js";
|
|
7
7
|
import { agentProfileSchema, capabilitySchema, defineAgentProfile, defineGitHubResource, defineInlineResource, mergeAgentProfiles, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
8
8
|
//#region src/confidential.ts
|
|
9
9
|
function generateAttestationNonce(bytes = 32) {
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $r as SendSessionMessageRequest, $t as ListMessagesOptions, Br as SandboxTerminalRequestOptions, E as ChunkedUploadResult, Fn as RenameOptions, Fr as SandboxRuntimeProfileList, H as CreateTaskSessionOptions, Lr as SandboxTerminalCreateOptions, M as CommitTaskSessionOptions, Nr as SandboxRuntimeHealth, Or as SandboxPortBinding, Pi as UploadProgress, Qr as SendSessionMessageOptions, Ri as WriteFileOptions, Rr as SandboxTerminalInfo, Si as TaskSessionInfo, T as ChunkedUploadOptions, V as CreateSessionOptions, _t as FileTreeResult, bi as TaskSessionCommitResult, ei as SentSessionMessage, gt as FileTreeOptions, ii as SessionInfo, lt as FileReadBatchOptions, oi as SessionMessage, pt as FileRenameResult, ut as FileReadBatchResult, vt as FileWriteResult, yi as TaskSessionChanges, zr as SandboxTerminalManager } from "./types-
|
|
1
|
+
import { $r as SendSessionMessageRequest, $t as ListMessagesOptions, Br as SandboxTerminalRequestOptions, E as ChunkedUploadResult, Fn as RenameOptions, Fr as SandboxRuntimeProfileList, H as CreateTaskSessionOptions, Lr as SandboxTerminalCreateOptions, M as CommitTaskSessionOptions, Nr as SandboxRuntimeHealth, Or as SandboxPortBinding, Pi as UploadProgress, Qr as SendSessionMessageOptions, Ri as WriteFileOptions, Rr as SandboxTerminalInfo, Si as TaskSessionInfo, T as ChunkedUploadOptions, V as CreateSessionOptions, _t as FileTreeResult, bi as TaskSessionCommitResult, ei as SentSessionMessage, gt as FileTreeOptions, ii as SessionInfo, lt as FileReadBatchOptions, oi as SessionMessage, pt as FileRenameResult, ut as FileReadBatchResult, vt as FileWriteResult, yi as TaskSessionChanges, zr as SandboxTerminalManager } from "./types-D6WC8r4K.js";
|
|
2
2
|
import { a as NotFoundError, c as SandboxError, d as ServerError, f as StateError, i as NetworkError, l as SandboxErrorJson, m as ValidationError, n as CapabilityError, o as PartialFailureError, p as TimeoutError, s as QuotaError, t as AuthError, u as SandboxFailureDetail } from "./errors-ntvaf0_F.js";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/chunked-upload.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $r as SendSessionMessageRequest, $t as ListMessagesOptions, At as GitBranch, Bi as WriteManyOptions, Bn as RolloutOptions, Bt as GpuLeaseManager, Cn as ProvisionEvent, D as CodeExecutionOptions, Ei as TeeAttestationResponse, Fr as SandboxRuntimeProfileList, Ft as GpuLease, H as CreateTaskSessionOptions, Hn as RolloutStartResult, Ii as WaitForOptions, In as RestoreSnapshotOptions, Ir as SandboxStatus, Jr as SearchMatch, Jt as IntelligenceReportBudget, K as DispatchPromptOptions, Kn as SSHCommandDescriptor, Kr as ScopedToken, Kt as InstalledTool, Li as WaitForRolloutOptions, Ln as ResumeOptions, M as CommitTaskSessionOptions, N as CompletedTurnResult, Nr as SandboxRuntimeHealth, Nt as GitDiff, O as CodeExecutionResult, Oi as TeePublicKeyResponse, Or as SandboxPortBinding, Pt as GitStatus, Q as DriverInfo, Qr as SendSessionMessageOptions, Qt as JsonValue, Ri as WriteFileOptions, Rn as Rollout, Si as TaskSessionInfo, Sn as PromptResult, Tr as SandboxInfo, V as CreateSessionOptions, Vr as SandboxTraceBundle, Wr as SandboxTraceOptions, X as DriveTurnOptions, Yn as SandboxConnection, Yr as SearchOptions, Yt as IntelligenceReportCompareTo, Zn as SandboxEvent, Zt as IntelligenceReportWindow, _i as TaskOptions, ai as SessionListOptions, bi as TaskSessionCommitResult, bn as PromptInputPart, di as SnapshotResult, ei as SentSessionMessage, et as DurablePlan, fn as PreviewLinkManager, gn as ProcessManager, gr as SandboxFleetTraceBundle, ii as SessionInfo, in as MintScopedTokenOptions, it as EventStreamOptions, ji as TurnDriveResult, jr as SandboxResourceUsage, jt as GitCommit, k as CodeLanguage, l as BackendManager, li as SnapshotInfo, mt as FileSystem, ni as SessionEventStreamOptions, oi as SessionMessage, ot as ExecOptions, pi as StartupDiagnostics, q as DispatchedSession, qn as SSHCredentials, qt as IntelligenceReport, ri as SessionForkOptions, s as BackendConfig, sn as NetworkManager, st as ExecResult, tt as EgressManager, ui as SnapshotOptions, un as PermissionsManager, vi as TaskResult, vt as FileWriteResult, w as BranchOptions, wi as TeeAttestationOptions, wn as ProvisionResult, xn as PromptOptions, yi as TaskSessionChanges, zi as WriteManyFile, zr as SandboxTerminalManager } from "./types-
|
|
1
|
+
import { $r as SendSessionMessageRequest, $t as ListMessagesOptions, At as GitBranch, Bi as WriteManyOptions, Bn as RolloutOptions, Bt as GpuLeaseManager, Cn as ProvisionEvent, D as CodeExecutionOptions, Ei as TeeAttestationResponse, Fr as SandboxRuntimeProfileList, Ft as GpuLease, H as CreateTaskSessionOptions, Hn as RolloutStartResult, Ii as WaitForOptions, In as RestoreSnapshotOptions, Ir as SandboxStatus, Jr as SearchMatch, Jt as IntelligenceReportBudget, K as DispatchPromptOptions, Kn as SSHCommandDescriptor, Kr as ScopedToken, Kt as InstalledTool, Li as WaitForRolloutOptions, Ln as ResumeOptions, M as CommitTaskSessionOptions, N as CompletedTurnResult, Nr as SandboxRuntimeHealth, Nt as GitDiff, O as CodeExecutionResult, Oi as TeePublicKeyResponse, Or as SandboxPortBinding, Pt as GitStatus, Q as DriverInfo, Qr as SendSessionMessageOptions, Qt as JsonValue, Ri as WriteFileOptions, Rn as Rollout, Si as TaskSessionInfo, Sn as PromptResult, Tr as SandboxInfo, V as CreateSessionOptions, Vr as SandboxTraceBundle, Wr as SandboxTraceOptions, X as DriveTurnOptions, Yn as SandboxConnection, Yr as SearchOptions, Yt as IntelligenceReportCompareTo, Zn as SandboxEvent, Zt as IntelligenceReportWindow, _i as TaskOptions, ai as SessionListOptions, bi as TaskSessionCommitResult, bn as PromptInputPart, di as SnapshotResult, ei as SentSessionMessage, et as DurablePlan, fn as PreviewLinkManager, gn as ProcessManager, gr as SandboxFleetTraceBundle, ii as SessionInfo, in as MintScopedTokenOptions, it as EventStreamOptions, ji as TurnDriveResult, jr as SandboxResourceUsage, jt as GitCommit, k as CodeLanguage, l as BackendManager, li as SnapshotInfo, mt as FileSystem, ni as SessionEventStreamOptions, oi as SessionMessage, ot as ExecOptions, pi as StartupDiagnostics, q as DispatchedSession, qn as SSHCredentials, qt as IntelligenceReport, ri as SessionForkOptions, s as BackendConfig, sn as NetworkManager, st as ExecResult, tt as EgressManager, ui as SnapshotOptions, un as PermissionsManager, vi as TaskResult, vt as FileWriteResult, w as BranchOptions, wi as TeeAttestationOptions, wn as ProvisionResult, xn as PromptOptions, yi as TaskSessionChanges, zi as WriteManyFile, zr as SandboxTerminalManager } from "./types-D6WC8r4K.js";
|
|
2
2
|
|
|
3
3
|
//#region src/mcp.d.ts
|
|
4
4
|
/**
|
|
@@ -1390,13 +1390,13 @@ declare class SandboxInstance {
|
|
|
1390
1390
|
* ```typescript
|
|
1391
1391
|
* await box.registerSessionMapping({
|
|
1392
1392
|
* sessionId: "sess_abc",
|
|
1393
|
-
*
|
|
1393
|
+
* runtimeSessionId: "runtime_abc",
|
|
1394
1394
|
* });
|
|
1395
1395
|
* ```
|
|
1396
1396
|
*/
|
|
1397
1397
|
registerSessionMapping(opts: {
|
|
1398
|
-
sessionId: string;
|
|
1399
|
-
userId
|
|
1398
|
+
sessionId: string; /** @deprecated Ownership is derived from the Sandbox API key. */
|
|
1399
|
+
userId?: string; /** The runtime (sidecar) session id this agent session routes to. */
|
|
1400
1400
|
runtimeSessionId: string; /** Optional container id for direct routing. */
|
|
1401
1401
|
sidecarId?: string; /** Optional projectRef so the server can detect a stale sidecar. */
|
|
1402
1402
|
projectRef?: string;
|
|
@@ -1407,8 +1407,8 @@ declare class SandboxInstance {
|
|
|
1407
1407
|
* sandbox stays alive.
|
|
1408
1408
|
*/
|
|
1409
1409
|
unregisterSessionMapping(opts: {
|
|
1410
|
-
sessionId: string;
|
|
1411
|
-
userId
|
|
1410
|
+
sessionId: string; /** @deprecated Ownership is derived from the Sandbox API key. */
|
|
1411
|
+
userId?: string;
|
|
1412
1412
|
}): Promise<{
|
|
1413
1413
|
success: boolean;
|
|
1414
1414
|
sessionId: string;
|
|
@@ -4242,17 +4242,16 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4242
4242
|
* ```typescript
|
|
4243
4243
|
* await box.registerSessionMapping({
|
|
4244
4244
|
* sessionId: "sess_abc",
|
|
4245
|
-
*
|
|
4245
|
+
* runtimeSessionId: "runtime_abc",
|
|
4246
4246
|
* });
|
|
4247
4247
|
* ```
|
|
4248
4248
|
*/
|
|
4249
4249
|
async registerSessionMapping(opts) {
|
|
4250
4250
|
const response = await this.client.fetch(`/v1/session/${encodeURIComponent(opts.sessionId)}/mapping`, {
|
|
4251
4251
|
method: "PUT",
|
|
4252
|
-
headers: { "x-user-id": opts.userId },
|
|
4253
4252
|
body: JSON.stringify({
|
|
4254
4253
|
sidecarSessionId: opts.runtimeSessionId,
|
|
4255
|
-
|
|
4254
|
+
sidecarId: opts.sidecarId ?? this.id,
|
|
4256
4255
|
...opts.projectRef ? { projectRef: opts.projectRef } : {}
|
|
4257
4256
|
})
|
|
4258
4257
|
});
|
|
@@ -4281,10 +4280,7 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4281
4280
|
* sandbox stays alive.
|
|
4282
4281
|
*/
|
|
4283
4282
|
async unregisterSessionMapping(opts) {
|
|
4284
|
-
const response = await this.client.fetch(`/v1/session/${encodeURIComponent(opts.sessionId)}/mapping`, {
|
|
4285
|
-
method: "DELETE",
|
|
4286
|
-
headers: { "x-user-id": opts.userId }
|
|
4287
|
-
});
|
|
4283
|
+
const response = await this.client.fetch(`/v1/session/${encodeURIComponent(opts.sessionId)}/mapping`, { method: "DELETE" });
|
|
4288
4284
|
if (!response.ok) {
|
|
4289
4285
|
const body = await response.text();
|
|
4290
4286
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
@@ -4566,12 +4562,14 @@ var SandboxInstance = class SandboxInstance {
|
|
|
4566
4562
|
*/
|
|
4567
4563
|
async mintScopedToken(opts) {
|
|
4568
4564
|
if ((opts.scope === "session" || opts.scope === "session-runtime") && !opts.sessionId) throw new ValidationError(`${opts.scope} scope requires a sessionId`);
|
|
4565
|
+
if (opts.scope === "session" && !opts.runtimeSessionId) throw new ValidationError("session scope requires the actual runtimeSessionId");
|
|
4569
4566
|
const response = await this.client.fetch(`/v1/sandboxes/${encodeURIComponent(this.id)}/scoped-token`, {
|
|
4570
4567
|
method: "POST",
|
|
4571
4568
|
headers: { "Content-Type": "application/json" },
|
|
4572
4569
|
body: JSON.stringify({
|
|
4573
4570
|
scope: opts.scope,
|
|
4574
4571
|
...opts.sessionId ? { sessionId: opts.sessionId } : {},
|
|
4572
|
+
...opts.scope === "session" ? { runtimeSessionId: opts.runtimeSessionId } : {},
|
|
4575
4573
|
...opts.ttlMinutes ? { ttlMinutes: opts.ttlMinutes } : {}
|
|
4576
4574
|
})
|
|
4577
4575
|
});
|
|
@@ -40,16 +40,24 @@ interface ReplayOptions {
|
|
|
40
40
|
lastEventId?: string;
|
|
41
41
|
/** Execution ID to replay events for */
|
|
42
42
|
executionId?: string;
|
|
43
|
-
/**
|
|
43
|
+
/** Actual runtime session ID used to scope replayed agent events */
|
|
44
44
|
sessionId?: string;
|
|
45
45
|
}
|
|
46
|
+
interface SubscriptionDenial {
|
|
47
|
+
channel: string;
|
|
48
|
+
reason: string;
|
|
49
|
+
}
|
|
50
|
+
interface SubscriptionAcknowledgement {
|
|
51
|
+
channels: string[];
|
|
52
|
+
denied?: SubscriptionDenial[];
|
|
53
|
+
}
|
|
46
54
|
/**
|
|
47
55
|
* Base fields present on all server messages.
|
|
48
56
|
*/
|
|
49
57
|
interface ServerMessageBase {
|
|
50
58
|
id?: string;
|
|
51
59
|
timestamp?: number;
|
|
52
|
-
/** Monotonic sequence number for
|
|
60
|
+
/** Monotonic per-session sequence number for consumers to detect gaps. */
|
|
53
61
|
seq?: number;
|
|
54
62
|
}
|
|
55
63
|
/**
|
|
@@ -60,12 +68,11 @@ type ServerMessage = (ServerMessageBase & {
|
|
|
60
68
|
messageType?: string;
|
|
61
69
|
data: {
|
|
62
70
|
sessionId: string;
|
|
71
|
+
hydratedCount?: number;
|
|
63
72
|
};
|
|
64
73
|
}) | (ServerMessageBase & {
|
|
65
74
|
type: "subscribed";
|
|
66
|
-
data:
|
|
67
|
-
channels: string[];
|
|
68
|
-
};
|
|
75
|
+
data: SubscriptionAcknowledgement;
|
|
69
76
|
}) | (ServerMessageBase & {
|
|
70
77
|
type: "unsubscribed";
|
|
71
78
|
data: {
|
|
@@ -86,6 +93,19 @@ type ServerMessage = (ServerMessageBase & {
|
|
|
86
93
|
sandboxId: string;
|
|
87
94
|
error?: string;
|
|
88
95
|
};
|
|
96
|
+
}) | (ServerMessageBase & {
|
|
97
|
+
type: "runtime.reconnecting";
|
|
98
|
+
data: {
|
|
99
|
+
sandboxId: string;
|
|
100
|
+
attempt: number;
|
|
101
|
+
delayMs: number;
|
|
102
|
+
};
|
|
103
|
+
}) | (ServerMessageBase & {
|
|
104
|
+
type: "runtime.removed";
|
|
105
|
+
data: {
|
|
106
|
+
sandboxId: string;
|
|
107
|
+
reason: string;
|
|
108
|
+
};
|
|
89
109
|
}) | (ServerMessageBase & {
|
|
90
110
|
type: "runtime.not_found";
|
|
91
111
|
data: {
|
|
@@ -122,7 +142,7 @@ type ServerMessage = (ServerMessageBase & {
|
|
|
122
142
|
}) | (ServerMessageBase & {
|
|
123
143
|
type: "agent.event";
|
|
124
144
|
channel: string;
|
|
125
|
-
data: unknown;
|
|
145
|
+
data: unknown; /** @deprecated The server emits `seq`; retained for older deployments. */
|
|
126
146
|
sequenceId?: number;
|
|
127
147
|
}) | (ServerMessageBase & {
|
|
128
148
|
type: "replay.start";
|
|
@@ -156,6 +176,20 @@ type ServerMessage = (ServerMessageBase & {
|
|
|
156
176
|
totalDropped: number; /** Hint that client should request a replay */
|
|
157
177
|
suggestReplay: boolean;
|
|
158
178
|
};
|
|
179
|
+
}) | (ServerMessageBase & {
|
|
180
|
+
type: "terminal.input.error";
|
|
181
|
+
data: {
|
|
182
|
+
terminalId: string;
|
|
183
|
+
code: string;
|
|
184
|
+
message: string;
|
|
185
|
+
};
|
|
186
|
+
}) | (ServerMessageBase & {
|
|
187
|
+
type: `project.${string}`;
|
|
188
|
+
channel?: string;
|
|
189
|
+
data: unknown;
|
|
190
|
+
}) | (ServerMessageBase & {
|
|
191
|
+
type: "heartbeat";
|
|
192
|
+
data?: unknown;
|
|
159
193
|
});
|
|
160
194
|
interface PortEventData {
|
|
161
195
|
type: "opened" | "closed";
|
|
@@ -163,6 +197,30 @@ interface PortEventData {
|
|
|
163
197
|
protocol: string;
|
|
164
198
|
processName?: string;
|
|
165
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Inbound WebSocket frame before normalization. The server may emit a
|
|
202
|
+
* legacy `messageType` discriminant instead of `type`, and may carry a
|
|
203
|
+
* top-level `channel` plus arbitrary extra fields. `handleMessage`
|
|
204
|
+
* normalizes a `RawWireMessage` into a `ServerMessage` before dispatch:
|
|
205
|
+
* `type` and `data` are mutable here because normalization rewrites them.
|
|
206
|
+
*/
|
|
207
|
+
interface RawWireMessage {
|
|
208
|
+
type?: string;
|
|
209
|
+
messageType?: string;
|
|
210
|
+
channel?: string;
|
|
211
|
+
data?: unknown;
|
|
212
|
+
id?: string;
|
|
213
|
+
message?: string;
|
|
214
|
+
code?: string;
|
|
215
|
+
timestamp?: number;
|
|
216
|
+
seq?: number;
|
|
217
|
+
sequenceId?: number;
|
|
218
|
+
[key: string]: unknown;
|
|
219
|
+
}
|
|
220
|
+
/** Every inbound frame after legacy names and sequence fields are normalized. */
|
|
221
|
+
interface NormalizedServerMessage extends RawWireMessage {
|
|
222
|
+
type: string;
|
|
223
|
+
}
|
|
166
224
|
/**
|
|
167
225
|
* Connection state for the WebSocket client.
|
|
168
226
|
*/
|
|
@@ -215,6 +273,8 @@ interface TokenRefreshResult {
|
|
|
215
273
|
* Event handlers for session gateway events.
|
|
216
274
|
*/
|
|
217
275
|
interface SessionGatewayEventHandlers {
|
|
276
|
+
/** Called after internal processing for every non-duplicate normalized frame. */
|
|
277
|
+
onMessage?: (message: NormalizedServerMessage) => void;
|
|
218
278
|
onConnect?: (sessionId: string) => void;
|
|
219
279
|
onDisconnect?: (code: number, reason: string) => void;
|
|
220
280
|
onReconnect?: () => void;
|
|
@@ -237,7 +297,7 @@ interface SessionGatewayEventHandlers {
|
|
|
237
297
|
}) => void;
|
|
238
298
|
onPortOpened?: (port: number, protocol: string, processName?: string) => void;
|
|
239
299
|
onPortClosed?: (port: number) => void;
|
|
240
|
-
onAgentEvent?: (channel: string, data: unknown,
|
|
300
|
+
onAgentEvent?: (channel: string, data: unknown, seq?: number) => void;
|
|
241
301
|
onError?: (message: string, code?: string) => void;
|
|
242
302
|
onStateChange?: (state: ConnectionState) => void;
|
|
243
303
|
onMetricsChange?: (metrics: ConnectionMetrics) => void;
|
|
@@ -270,11 +330,11 @@ interface SessionGatewayClientConfig {
|
|
|
270
330
|
token: string;
|
|
271
331
|
/** Callback to refresh the token when it's about to expire */
|
|
272
332
|
onTokenRefresh?: () => Promise<TokenRefreshResult>;
|
|
273
|
-
/**
|
|
333
|
+
/** Browser session ID embedded in the session-scoped read token */
|
|
274
334
|
sessionId: string;
|
|
275
335
|
/** Transport mode (default: "websocket") */
|
|
276
336
|
transport?: TransportMode;
|
|
277
|
-
/**
|
|
337
|
+
/** Additional channels to subscribe to; server-authorized channels are used by default. */
|
|
278
338
|
channels?: string[];
|
|
279
339
|
/** Auto-reconnect on disconnect (default: true) */
|
|
280
340
|
autoReconnect?: boolean;
|
|
@@ -302,6 +362,8 @@ interface SessionGatewayClientConfig {
|
|
|
302
362
|
replayStorageKeyPrefix?: string;
|
|
303
363
|
/** Number of latency samples to track for averaging (default: 10) */
|
|
304
364
|
latencyHistorySize?: number;
|
|
365
|
+
/** Maximum wait for `connection.established` (default: 10000 ms) */
|
|
366
|
+
connectionEstablishmentTimeoutMs?: number;
|
|
305
367
|
/** Event handlers */
|
|
306
368
|
handlers?: SessionGatewayEventHandlers;
|
|
307
369
|
}
|
|
@@ -335,11 +397,13 @@ declare class SessionGatewayClient {
|
|
|
335
397
|
private ws;
|
|
336
398
|
private readonly config;
|
|
337
399
|
private readonly handlers;
|
|
400
|
+
private readonly replayStateStore;
|
|
401
|
+
private readonly tokenRefresher;
|
|
338
402
|
private currentToken;
|
|
339
|
-
private isRefreshingToken;
|
|
340
403
|
private state;
|
|
341
404
|
private connectedAt;
|
|
342
405
|
private hasConnectedBefore;
|
|
406
|
+
private connectionEstablishedForSocket;
|
|
343
407
|
private lastPingAt;
|
|
344
408
|
private lastPongAt;
|
|
345
409
|
private lastPingSentAt;
|
|
@@ -353,6 +417,7 @@ declare class SessionGatewayClient {
|
|
|
353
417
|
private pingInterval;
|
|
354
418
|
private pongTimeout;
|
|
355
419
|
private pendingCallbacks;
|
|
420
|
+
private readonly connectionWaiters;
|
|
356
421
|
private messageIdCounter;
|
|
357
422
|
private processedEventIds;
|
|
358
423
|
private pingLatencyHistory;
|
|
@@ -387,7 +452,7 @@ declare class SessionGatewayClient {
|
|
|
387
452
|
/**
|
|
388
453
|
* Request replay of events since a timestamp.
|
|
389
454
|
*/
|
|
390
|
-
replay(since: number): void
|
|
455
|
+
replay(since: number): Promise<void>;
|
|
391
456
|
/**
|
|
392
457
|
* Send terminal input via WebSocket.
|
|
393
458
|
*/
|
|
@@ -423,14 +488,18 @@ declare class SessionGatewayClient {
|
|
|
423
488
|
getToken(): string;
|
|
424
489
|
private setState;
|
|
425
490
|
private handleOpen;
|
|
491
|
+
private handleConnectionEstablished;
|
|
426
492
|
private handleClose;
|
|
493
|
+
private handleError;
|
|
494
|
+
private closeBeforeEstablishment;
|
|
427
495
|
private handleMessage;
|
|
428
496
|
private handlePong;
|
|
429
497
|
private dispatchMessage;
|
|
498
|
+
private deliverMessage;
|
|
430
499
|
private trackExecutionContext;
|
|
431
|
-
private handleTokenExpiring;
|
|
432
500
|
private send;
|
|
433
501
|
private sendWithResponse;
|
|
502
|
+
private waitForConnectionEstablished;
|
|
434
503
|
private restoreSubscriptions;
|
|
435
504
|
private startPingInterval;
|
|
436
505
|
private stopPingInterval;
|
|
@@ -445,4 +514,4 @@ declare class SessionGatewayClient {
|
|
|
445
514
|
private saveReplayState;
|
|
446
515
|
}
|
|
447
516
|
//#endregion
|
|
448
|
-
export { type ClientMessage, type ConnectionMetrics, type ConnectionQuality, type ConnectionState, INITIAL_METRICS, type PortEventData, type ReplayOptions, type ReplayState, type ReplayStateStorage, type ServerMessage, SessionGatewayClient, type SessionGatewayClientConfig, type SessionGatewayEventHandlers, type SessionGatewayStats, type TokenRefreshResult, type TransportMode, calculateConnectionQuality };
|
|
517
|
+
export { type ClientMessage, type ConnectionMetrics, type ConnectionQuality, type ConnectionState, INITIAL_METRICS, type NormalizedServerMessage, type PortEventData, type ReplayOptions, type ReplayState, type ReplayStateStorage, type ServerMessage, SessionGatewayClient, type SessionGatewayClientConfig, type SessionGatewayEventHandlers, type SessionGatewayStats, type SubscriptionAcknowledgement, type SubscriptionDenial, type TokenRefreshResult, type TransportMode, calculateConnectionQuality };
|