@tangle-network/sandbox 0.60.1-develop.20261001222100.ea1ca0e935 → 0.60.2

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.
@@ -1,7 +1,7 @@
1
- import { _ as SandboxSession, h as SandboxTaskSession, r as SandboxInstance } from "../sandbox-BY7KZweP.js";
2
- import { Ba as BackendType, D as CodeExecutionResult, E as CodeExecutionOptions, Gi as SessionInfo, Kr as SandboxFleetParent, O as CodeLanguage, d as BackendConfig, k as CodeResultPart, qi as SessionListOptions } from "../types-Cs-0Hy_K.js";
3
- import { i as Sandbox } from "../client-jPPuv6Ns.js";
4
- import { u as PreviewAuthorizer } from "../preview-iD-q8YLe.js";
1
+ import { _ as SandboxSession, h as SandboxTaskSession, r as SandboxInstance } from "../sandbox-LRvBzGGm.js";
2
+ import { Ba as BackendType, D as CodeExecutionResult, E as CodeExecutionOptions, Gi as SessionInfo, Kr as SandboxFleetParent, O as CodeLanguage, d as BackendConfig, k as CodeResultPart, qi as SessionListOptions } from "../types-C9w6MdZB.js";
3
+ import { i as Sandbox } from "../client-BFilDKO8.js";
4
+ import { u as PreviewAuthorizer } from "../preview-ZaYvOOXz.js";
5
5
  import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
6
6
  import { JSONSchema } from "zod/v4/core";
7
7
  import { ToolSet } from "ai";
@@ -1,2 +1,2 @@
1
- import { _ as publishAgentPreview, a as previewOperationTool, c as AgentPreviewOptions, d as PreviewExecutionContext, f as PublishAgentPreviewOptions, g as listAgentPreviews, h as getAgentPreview, i as PreviewTool, l as PreviewAuthorizationRequest, m as ensureAgentPreview, n as PREVIEW_MCP_ALIAS, o as previewToolsForProfile, p as assertPreviewId, r as PREVIEW_TOOLS, s as AgentPreviewError, t as servePreviewMcp, u as PreviewAuthorizer, v as removeAgentPreview, y as resolveSelfSandbox } from "../preview-iD-q8YLe.js";
1
+ import { _ as publishAgentPreview, a as previewOperationTool, c as AgentPreviewOptions, d as PreviewExecutionContext, f as PublishAgentPreviewOptions, g as listAgentPreviews, h as getAgentPreview, i as PreviewTool, l as PreviewAuthorizationRequest, m as ensureAgentPreview, n as PREVIEW_MCP_ALIAS, o as previewToolsForProfile, p as assertPreviewId, r as PREVIEW_TOOLS, s as AgentPreviewError, t as servePreviewMcp, u as PreviewAuthorizer, v as removeAgentPreview, y as resolveSelfSandbox } from "../preview-ZaYvOOXz.js";
2
2
  export { AgentPreviewError, AgentPreviewOptions, PREVIEW_MCP_ALIAS, PREVIEW_TOOLS, PreviewAuthorizationRequest, PreviewAuthorizer, PreviewExecutionContext, PreviewTool, PublishAgentPreviewOptions, assertPreviewId, ensureAgentPreview, getAgentPreview, listAgentPreviews, previewOperationTool, previewToolsForProfile, publishAgentPreview, removeAgentPreview, resolveSelfSandbox, servePreviewMcp };
@@ -1,4 +1,4 @@
1
- import { Dr as SandboxEvent, a as AgentQuestionRequest, ct as DurablePlanSnapshot, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation } from "./types-Cs-0Hy_K.js";
1
+ import { Dr as SandboxEvent, a as AgentQuestionRequest, ct as DurablePlanSnapshot, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation } from "./types-C9w6MdZB.js";
2
2
  import { InteractionRequest } from "@tangle-network/agent-interface";
3
3
 
4
4
  //#region src/agent-run-outcome.d.ts
@@ -1,7 +1,7 @@
1
- import { l as TraceExportResult, n as HttpClient, r as SandboxInstance, u as TraceExportSink } from "./sandbox-BY7KZweP.js";
1
+ import { l as TraceExportResult, n as HttpClient, r as SandboxInstance, u as TraceExportSink } from "./sandbox-LRvBzGGm.js";
2
2
  import { l as ScopedToken, s as MintInteractiveSessionTokenOptions } from "./terminal-stream-C9jxoB07.js";
3
- import { N as LinesClient } from "./lines-BoT0rBrj.js";
4
- import { $n as PublicTemplateInfo, Ar as SandboxFleetArtifact, B as CreateSandboxOptions, Bt as FleetDispatchStreamOptions, Ea as UsageInfo, En as ListSandboxOptions, Er as SandboxEnvironment, F as CreateIntelligenceReportOptions, Fi as SecretsManager, Fr as SandboxFleetDriverCapability, Ft as FleetAgentResult, G as DeleteMatchingSandboxesFilter, Gr as SandboxFleetOperationsSummary, Gt as FleetMachineId, Hr as SandboxFleetMachineSpec, Ht as FleetDriveTurnRequest, I as CreateRequestOptions, Jn as PromptResult, Jr as SandboxFleetPolicy, Jt as FleetRunEvent, K as DeleteMatchingSandboxesOptions, Kn as PromptInputPart, Kr as SandboxFleetParent, Kt as FleetPromptDispatchOptions, L as CreateSandboxFleetOptions, Lr as SandboxFleetInfo, Lt as FleetDispatchCancelResult, M as ConversationTurnOptions, Mr as SandboxFleetCostEstimate, N as ConversationTurnResult, Nt as FleetAgentId, Or as SandboxFleetAgent, Pa as BatchEvent, Pr as SandboxFleetDispatchResponse, Qr as SandboxFleetTraceBundle, R as CreateSandboxFleetTokenOptions, Rt as FleetDispatchResultBuffer, Tn as ListSandboxFleetOptions, Ur as SandboxFleetManifest, Ut as FleetExecDispatchOptions, Vr as SandboxFleetMachineRecord, Vt as FleetDriveTurnOutcome, Wt as FleetExecDispatchResult, Xr as SandboxFleetSpend, Yt as FleetRunOptions, Zr as SandboxFleetToken, _n as IntelligenceReport, aa as SshKeysManager, ai as SandboxFleetWorkspaceRestoreResult, ar as ReconcileSandboxFleetsOptions, b as BatchRunRequest, ba as TokenRefreshHandler, ci as SandboxInfo, d as BackendConfig, er as PublicTemplateVersionInfo, ii as SandboxFleetWorkspaceReconcileResult, ir as ReapExpiredSandboxFleetsResult, jr as SandboxFleetArtifactSpec, l as AttachSandboxFleetMachineOptions, la as SubscriptionInfo, ni as SandboxFleetUsage, nr as PublishPublicTemplateVersionOptions, oi as SandboxFleetWorkspaceSnapshotResult, or as ReconcileSandboxFleetsResult, q as DeleteMatchingSandboxesResult, qn as PromptOptions, qt as FleetPromptDispatchResult, rr as ReapExpiredSandboxFleetsOptions, si as SandboxIdentity, ti as SandboxFleetTraceOptions, tr as PublishPublicTemplateOptions, v as BatchResult, vn as IntelligenceReportBudget, vt as ExecOptions, xn as IntelligenceReportWindow, y as BatchRunOptions, yi as SandboxShapesInfo, yn as IntelligenceReportCompareTo, yr as SandboxConfig, yt as ExecResult, z as CreateSandboxFleetWithCoordinatorOptions, zt as FleetDispatchResultBufferOptions } from "./types-Cs-0Hy_K.js";
3
+ import { N as LinesClient } from "./lines-T2D6xHHx.js";
4
+ import { $n as PublicTemplateInfo, Ar as SandboxFleetArtifact, B as CreateSandboxOptions, Bt as FleetDispatchStreamOptions, Ea as UsageInfo, En as ListSandboxOptions, Er as SandboxEnvironment, F as CreateIntelligenceReportOptions, Fi as SecretsManager, Fr as SandboxFleetDriverCapability, Ft as FleetAgentResult, G as DeleteMatchingSandboxesFilter, Gr as SandboxFleetOperationsSummary, Gt as FleetMachineId, Hr as SandboxFleetMachineSpec, Ht as FleetDriveTurnRequest, I as CreateRequestOptions, Jn as PromptResult, Jr as SandboxFleetPolicy, Jt as FleetRunEvent, K as DeleteMatchingSandboxesOptions, Kn as PromptInputPart, Kr as SandboxFleetParent, Kt as FleetPromptDispatchOptions, L as CreateSandboxFleetOptions, Lr as SandboxFleetInfo, Lt as FleetDispatchCancelResult, M as ConversationTurnOptions, Mr as SandboxFleetCostEstimate, N as ConversationTurnResult, Nt as FleetAgentId, Or as SandboxFleetAgent, Pa as BatchEvent, Pr as SandboxFleetDispatchResponse, Qr as SandboxFleetTraceBundle, R as CreateSandboxFleetTokenOptions, Rt as FleetDispatchResultBuffer, Tn as ListSandboxFleetOptions, Ur as SandboxFleetManifest, Ut as FleetExecDispatchOptions, Vr as SandboxFleetMachineRecord, Vt as FleetDriveTurnOutcome, Wt as FleetExecDispatchResult, Xr as SandboxFleetSpend, Yt as FleetRunOptions, Zr as SandboxFleetToken, _n as IntelligenceReport, aa as SshKeysManager, ai as SandboxFleetWorkspaceRestoreResult, ar as ReconcileSandboxFleetsOptions, b as BatchRunRequest, ba as TokenRefreshHandler, ci as SandboxInfo, d as BackendConfig, er as PublicTemplateVersionInfo, ii as SandboxFleetWorkspaceReconcileResult, ir as ReapExpiredSandboxFleetsResult, jr as SandboxFleetArtifactSpec, l as AttachSandboxFleetMachineOptions, la as SubscriptionInfo, ni as SandboxFleetUsage, nr as PublishPublicTemplateVersionOptions, oi as SandboxFleetWorkspaceSnapshotResult, or as ReconcileSandboxFleetsResult, q as DeleteMatchingSandboxesResult, qn as PromptOptions, qt as FleetPromptDispatchResult, rr as ReapExpiredSandboxFleetsOptions, si as SandboxIdentity, ti as SandboxFleetTraceOptions, tr as PublishPublicTemplateOptions, v as BatchResult, vn as IntelligenceReportBudget, vt as ExecOptions, xn as IntelligenceReportWindow, y as BatchRunOptions, yi as SandboxShapesInfo, yn as IntelligenceReportCompareTo, yr as SandboxConfig, yt as ExecResult, z as CreateSandboxFleetWithCoordinatorOptions, zt as FleetDispatchResultBufferOptions } from "./types-C9w6MdZB.js";
5
5
  import { f as SandboxError } from "./errors-C6dll8Qf.js";
6
6
  import { AgentInteractiveSessionRef } from "@tangle-network/agent-interface";
7
7
  import { z } from "zod";
package/dist/core.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages } from "./sandbox-BY7KZweP.js";
2
- import { B as LineApplication, D as LineSenderVerification, E as LineSendReceipt, G as parseLineApplicationRequest, H as LineApplicationResult, I as lineInstanceKey, K as parseLineApplicationResult, L as profileChannelReference, N as LinesClient, O as LineSenderVerificationStart, R as LINE_APPLICATION_REPLY_MAX_CHARS, T as LineSendInput, U as LineApplicationState, V as LineApplicationRequest, W as LineApplicationView, b as LineReminderPreferences, c as LineExecutionKey, d as LineInstanceCreate, m as LineMemberInstance, n as LineAgentRolePolicy, o as LineAttachment, p as LineMember, s as LineAttachmentReauthorization, t as Line, u as LineInstanceAttachOptions, v as LineNumberInventory, y as LineProvider, z as LINE_APPLICATION_REQUEST_MAX_BYTES } from "./lines-BoT0rBrj.js";
3
- import { An as NetworkConfig, B as CreateSandboxOptions, Fn as PreviewLinkInfo, Ga as ManagedProcessRecord, Ha as ManagedProcessClient, In as PreviewLinkManager, Ka as ManagedProcessSpec, Kn as PromptInputPart, Ln as PreviewLinkWaitOptions, M as ConversationTurnOptions, N as ConversationTurnResult, Ua as ManagedProcessJobs, Wa as ManagedProcessOptions, Yi as SessionMessageAdmission, bi as SandboxStatus, ci as SandboxInfo, qa as ManagedProcessState, vt as ExecOptions, yr as SandboxConfig, yt as ExecResult } from "./types-Cs-0Hy_K.js";
4
- import { A as isBackendRegistryInteractionKind, C as BackendRegistryEntry, D as backendRegistryEntrySchema, E as backendRegistryCapabilitiesSchema, M as parseBackendRegistryResponseBody, O as backendRegistryInteractionKindSchema, S as BackendRegistryCapabilities, T as BackendRegistryResponse, d as HostedInstance, f as InstanceProfile, g as InstancesClient, i as Sandbox, j as parseBackendRegistryResponse, k as backendRegistryResponseSchema, m as InstanceRestartingError, p as InstanceRecord, u as EnsureInstanceOptions, w as BackendRegistryInteractionKind } from "./client-jPPuv6Ns.js";
1
+ import { a as WorkspaceImagePublishRequestOptions, i as WorkspaceImagePublishInput, o as WorkspaceImagePublishResult, r as SandboxInstance, s as WorkspaceImages } from "./sandbox-LRvBzGGm.js";
2
+ import { B as LineApplication, D as LineSenderVerification, E as LineSendReceipt, G as parseLineApplicationRequest, H as LineApplicationResult, I as lineInstanceKey, K as parseLineApplicationResult, L as profileChannelReference, N as LinesClient, O as LineSenderVerificationStart, R as LINE_APPLICATION_REPLY_MAX_CHARS, T as LineSendInput, U as LineApplicationState, V as LineApplicationRequest, W as LineApplicationView, b as LineReminderPreferences, c as LineExecutionKey, d as LineInstanceCreate, m as LineMemberInstance, n as LineAgentRolePolicy, o as LineAttachment, p as LineMember, s as LineAttachmentReauthorization, t as Line, u as LineInstanceAttachOptions, v as LineNumberInventory, y as LineProvider, z as LINE_APPLICATION_REQUEST_MAX_BYTES } from "./lines-T2D6xHHx.js";
3
+ import { An as NetworkConfig, B as CreateSandboxOptions, Fn as PreviewLinkInfo, Ga as ManagedProcessRecord, Ha as ManagedProcessClient, In as PreviewLinkManager, Ka as ManagedProcessSpec, Kn as PromptInputPart, Ln as PreviewLinkWaitOptions, M as ConversationTurnOptions, N as ConversationTurnResult, Ua as ManagedProcessJobs, Wa as ManagedProcessOptions, Yi as SessionMessageAdmission, bi as SandboxStatus, ci as SandboxInfo, qa as ManagedProcessState, vt as ExecOptions, yr as SandboxConfig, yt as ExecResult } from "./types-C9w6MdZB.js";
4
+ import { A as isBackendRegistryInteractionKind, C as BackendRegistryEntry, D as backendRegistryEntrySchema, E as backendRegistryCapabilitiesSchema, M as parseBackendRegistryResponseBody, O as backendRegistryInteractionKindSchema, S as BackendRegistryCapabilities, T as BackendRegistryResponse, d as HostedInstance, f as InstanceProfile, g as InstancesClient, i as Sandbox, j as parseBackendRegistryResponse, k as backendRegistryResponseSchema, m as InstanceRestartingError, p as InstanceRecord, u as EnsureInstanceOptions, w as BackendRegistryInteractionKind } from "./client-BFilDKO8.js";
5
5
  import { _ as TimeoutError, a as FileWriteConflictError, 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, v as ValidationError } from "./errors-C6dll8Qf.js";
6
6
 
7
7
  //#region src/core.d.ts
@@ -1,5 +1,5 @@
1
- import { n as HttpClient, r as SandboxInstance } from "./sandbox-BY7KZweP.js";
2
- import { B as CreateSandboxOptions } from "./types-Cs-0Hy_K.js";
1
+ import { n as HttpClient, r as SandboxInstance } from "./sandbox-LRvBzGGm.js";
2
+ import { B as CreateSandboxOptions } from "./types-C9w6MdZB.js";
3
3
 
4
4
  //#region src/tangle/abi.d.ts
5
5
  /**
@@ -107,71 +107,90 @@ declare const ITangleJobsAbi: readonly [{
107
107
  }];
108
108
  }];
109
109
  declare const SandboxCreateParamTypes: readonly [{
110
- readonly name: "name";
111
- readonly type: "string";
112
- }, {
113
- readonly name: "image";
114
- readonly type: "string";
115
- }, {
116
- readonly name: "stack";
117
- readonly type: "string";
118
- }, {
119
- readonly name: "agent_identifier";
120
- readonly type: "string";
121
- }, {
122
- readonly name: "env_json";
123
- readonly type: "string";
124
- }, {
125
- readonly name: "metadata_json";
126
- readonly type: "string";
127
- }, {
128
- readonly name: "ssh_enabled";
129
- readonly type: "bool";
130
- }, {
131
- readonly name: "ssh_public_key";
132
- readonly type: "string";
133
- }, {
134
- readonly name: "web_terminal_enabled";
135
- readonly type: "bool";
136
- }, {
137
- readonly name: "max_lifetime_seconds";
138
- readonly type: "uint64";
139
- }, {
140
- readonly name: "idle_timeout_seconds";
141
- readonly type: "uint64";
142
- }, {
143
- readonly name: "cpu_cores";
144
- readonly type: "uint64";
145
- }, {
146
- readonly name: "memory_mb";
147
- readonly type: "uint64";
148
- }, {
149
- readonly name: "disk_gb";
150
- readonly type: "uint64";
151
- }, {
152
- readonly name: "tee_required";
153
- readonly type: "bool";
154
- }, {
155
- readonly name: "tee_type";
156
- readonly type: "uint8";
157
- }, {
158
- readonly name: "attestation_nonce";
159
- readonly type: "string";
110
+ readonly name: "request";
111
+ readonly type: "tuple";
112
+ readonly components: readonly [{
113
+ readonly name: "name";
114
+ readonly type: "string";
115
+ }, {
116
+ readonly name: "image";
117
+ readonly type: "string";
118
+ }, {
119
+ readonly name: "stack";
120
+ readonly type: "string";
121
+ }, {
122
+ readonly name: "agent_identifier";
123
+ readonly type: "string";
124
+ }, {
125
+ readonly name: "env_json";
126
+ readonly type: "string";
127
+ }, {
128
+ readonly name: "metadata_json";
129
+ readonly type: "string";
130
+ }, {
131
+ readonly name: "ssh_enabled";
132
+ readonly type: "bool";
133
+ }, {
134
+ readonly name: "ssh_public_key";
135
+ readonly type: "string";
136
+ }, {
137
+ readonly name: "web_terminal_enabled";
138
+ readonly type: "bool";
139
+ }, {
140
+ readonly name: "max_lifetime_seconds";
141
+ readonly type: "uint64";
142
+ }, {
143
+ readonly name: "idle_timeout_seconds";
144
+ readonly type: "uint64";
145
+ }, {
146
+ readonly name: "cpu_cores";
147
+ readonly type: "uint64";
148
+ }, {
149
+ readonly name: "memory_mb";
150
+ readonly type: "uint64";
151
+ }, {
152
+ readonly name: "disk_gb";
153
+ readonly type: "uint64";
154
+ }, {
155
+ readonly name: "tee_required";
156
+ readonly type: "bool";
157
+ }, {
158
+ readonly name: "tee_type";
159
+ readonly type: "uint8";
160
+ }, {
161
+ readonly name: "attestation_nonce";
162
+ readonly type: "string";
163
+ }, {
164
+ readonly name: "capabilities_json";
165
+ readonly type: "string";
166
+ }];
160
167
  }];
161
168
  declare const SandboxIdParamTypes: readonly [{
162
- readonly name: "sandbox_id";
163
- readonly type: "string";
169
+ readonly name: "request";
170
+ readonly type: "tuple";
171
+ readonly components: readonly [{
172
+ readonly name: "sandbox_id";
173
+ readonly type: "string";
174
+ }];
164
175
  }];
165
176
  declare const SandboxCreateResponseParamTypes: readonly [{
166
- readonly name: "sandboxId";
167
- readonly type: "string";
168
- }, {
169
- readonly name: "json";
170
- readonly type: "string";
177
+ readonly name: "response";
178
+ readonly type: "tuple";
179
+ readonly components: readonly [{
180
+ readonly name: "sandboxId";
181
+ readonly type: "string";
182
+ }, {
183
+ readonly name: "json";
184
+ readonly type: "string";
185
+ }];
171
186
  }];
172
187
  declare const JsonResponseParamTypes: readonly [{
173
- readonly name: "json";
174
- readonly type: "string";
188
+ readonly name: "response";
189
+ readonly type: "tuple";
190
+ readonly components: readonly [{
191
+ readonly name: "json";
192
+ readonly type: "string";
193
+ }];
175
194
  }];
176
195
  declare const AgentSandboxBlueprintAbi: readonly [{
177
196
  readonly type: "function";
@@ -339,9 +358,16 @@ declare class TangleSandboxClient implements HttpClient {
339
358
  private readonly sandboxes;
340
359
  private readonly operatorApiUrl?;
341
360
  private readonly operatorApiToken?;
361
+ private operatorSession;
342
362
  constructor(config: TangleSandboxClientConfig);
343
363
  /**
344
364
  * Create a sandbox via on-chain job submission.
365
+ *
366
+ * Secrets never ride the chain: `options.tangleSecrets` is delivered to the
367
+ * operator's 2-phase provisioning endpoint over an EIP-191-authenticated
368
+ * session after the job completes (requires `operatorApiUrl`). Everything
369
+ * in `options.env` IS published on-chain in the job calldata — secret-shaped
370
+ * keys there trigger a warning pointing at `tangleSecrets`.
345
371
  */
346
372
  create(options?: CreateSandboxOptions): Promise<SandboxInstance>;
347
373
  /**
@@ -373,7 +399,96 @@ declare class TangleSandboxClient implements HttpClient {
373
399
  totalSandboxes: number;
374
400
  totalCapacity: number;
375
401
  }>;
402
+ /**
403
+ * Mint or reuse the EIP-191 session for the operator API.
404
+ *
405
+ * The session is signed by the SAME key that submits jobs (`chain.signMessage`),
406
+ * so the operator binds it to every sandbox this client created.
407
+ */
408
+ private getOperatorSession;
409
+ /**
410
+ * Deliver secrets to a sandbox via the operator's 2-phase provisioning
411
+ * endpoint (`POST /api/sandboxes/:id/secrets`).
412
+ *
413
+ * Unlike `env`, these values never appear on-chain: they ride TLS to the
414
+ * operator, which validates the session's recovered address against the
415
+ * sandbox's on-chain creator before injecting.
416
+ */
417
+ injectSecrets(sandboxId: string, secrets: Record<string, string>): Promise<void>;
418
+ /** Read a sandbox's provisioned secret keys and credential availability. */
419
+ getSecrets(sandboxId: string): Promise<{
420
+ sandboxId: string;
421
+ envJson: Record<string, unknown>;
422
+ credentialsAvailable: boolean;
423
+ }>;
424
+ /**
425
+ * Run an operator-API request with a session, retrying once with a fresh
426
+ * session on 401 (expired PASETO). Any other failure names the sandbox so
427
+ * the caller can retry without losing the ID.
428
+ */
429
+ private withOperatorSession;
376
430
  private fetchOperatorApi;
377
431
  }
378
432
  //#endregion
379
- export { TANGLE_JOBS_CONTRACT as a, ITangleJobsAbi as c, SandboxCreateResponseParamTypes as d, SandboxIdParamTypes as f, TANGLE_CHAIN_ID as i, JsonResponseParamTypes as l, JOB_SANDBOX_CREATE as n, TangleSandboxClientConfig as o, JOB_SANDBOX_DELETE as r, AgentSandboxBlueprintAbi as s, TangleSandboxClient as t, SandboxCreateParamTypes as u };
433
+ //#region src/tangle/operator-auth.d.ts
434
+ /**
435
+ * Operator API session auth — the client half of the operator's EIP-191
436
+ * challenge-response flow (`sandbox-runtime/src/session_auth`).
437
+ *
438
+ * Flow (matches the operator exactly):
439
+ * 1. `POST /api/auth/challenge` → `{ nonce, message, expires_at }`
440
+ * 2. Sign `message` with the job submitter's key (EIP-191 personal_sign,
441
+ * 65-byte `r ‖ s ‖ v`)
442
+ * 3. `POST /api/auth/session` `{ nonce, signature }` →
443
+ * `{ token, address, expires_at }` (PASETO bearer, 1h)
444
+ * 4. `Authorization: Bearer <token>`
445
+ *
446
+ * The operator recovers the signer address from the signature and binds every
447
+ * sandbox operation to it: `require_sandbox_owner` rejects any session whose
448
+ * address is not the sandbox's on-chain creator. So a session minted from the
449
+ * same key that submitted the create job can read/inject that sandbox's
450
+ * secrets — and nothing else.
451
+ */
452
+ /** Challenge payload served by `POST /api/auth/challenge`. */
453
+ interface OperatorChallenge {
454
+ nonce: string;
455
+ message: string;
456
+ expires_at: number;
457
+ }
458
+ /** Session payload served by `POST /api/auth/session`. */
459
+ interface OperatorSessionToken {
460
+ token: string;
461
+ address: string;
462
+ expires_at: number;
463
+ }
464
+ /** Signs an arbitrary message with EIP-191 personal_sign semantics. */
465
+ type SignMessage = (message: string) => Promise<`0x${string}`>;
466
+ declare class OperatorSessionError extends Error {
467
+ readonly status?: number | undefined;
468
+ constructor(message: string, status?: number | undefined);
469
+ }
470
+ /**
471
+ * A bearer session with the blueprint operator API, minted by proving control
472
+ * of the job submitter's key. Establish lazily and reuse until near expiry;
473
+ * the caller retries with a fresh session on 401.
474
+ */
475
+ declare class OperatorSession {
476
+ private readonly token;
477
+ private readonly address;
478
+ private readonly expiresAtMs;
479
+ private constructor();
480
+ get signerAddress(): string;
481
+ /** True when the token is within the refresh margin of expiry. */
482
+ needsRefresh(nowMs?: number): boolean;
483
+ authorizationHeader(): string;
484
+ /**
485
+ * Run the challenge-response flow against an operator API base URL.
486
+ *
487
+ * `signMessage` must implement EIP-191 personal_sign with the SAME key that
488
+ * submitted the sandbox create job — the operator binds ownership to the
489
+ * recovered address, so any other key yields a session that owns nothing.
490
+ */
491
+ static establish(baseUrl: string, signMessage: SignMessage, fetchImpl?: typeof fetch): Promise<OperatorSession>;
492
+ }
493
+ //#endregion
494
+ export { SandboxIdParamTypes as _, SignMessage as a, JOB_SANDBOX_DELETE as c, TangleSandboxClientConfig as d, AgentSandboxBlueprintAbi as f, SandboxCreateResponseParamTypes as g, SandboxCreateParamTypes as h, OperatorSessionToken as i, TANGLE_CHAIN_ID as l, JsonResponseParamTypes as m, OperatorSession as n, TangleSandboxClient as o, ITangleJobsAbi as p, OperatorSessionError as r, JOB_SANDBOX_CREATE as s, OperatorChallenge as t, TANGLE_JOBS_CONTRACT as u };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { A as InteractiveStopCommand, B as SandboxInteractionConflict, C as InteractiveSessionHandleOptions, D as InteractiveSessionRef, E as InteractiveSessionInfo, F as InteractiveTerminalFrameLog, G as CONTROL_PLANE_MCP_SERVER_NAME, H as SandboxInteractionResult, I as InteractiveTerminalMetadata, J as SandboxMcpEndpoint, K as SANDBOX_MCP_SERVER_NAME, L as createInteractiveTerminalCapture, M as RespondToPermissionOptions, N as agentInteractiveSessionPromptRequestDigest, O as InteractiveSessionStartOptions, P as InteractiveTerminalCapture, R as createInteractiveTerminalSession, S as InteractiveSessionHandle, T as InteractiveSessionIncarnationId, U as BuildControlPlaneMcpConfigOptions, V as SandboxInteractionResolution, W as BuildSandboxMcpConfigOptions, X as buildControlPlaneMcpConfig, Y as SandboxMcpServerEntry, Z as buildSandboxMcpConfig, _ as SandboxSession, a as WorkspaceImagePublishRequestOptions, b as InteractivePromptCommand, c as TraceExportFormat, d as buildTraceExportPayload, f as exportTraceBundle, g as RawEvidenceExport, h as SandboxTaskSession, i as WorkspaceImagePublishInput, j as InterruptResult, k as InteractiveSessionStartResult, l as TraceExportResult, m as toOtelJson, o as WorkspaceImagePublishResult, p as otelTraceIdForTangleTrace, q as SandboxMcpConfig, r as SandboxInstance, s as WorkspaceImages, t as ForkAcknowledgement, u as TraceExportSink, v as AgentInteractiveTerminalSession, w as InteractiveSessionHost, x as InteractiveSessionControlClaim, y as InteractiveControlClaimRequest, z as SandboxInteractionCommandResult } from "./sandbox-BY7KZweP.js";
1
+ import { A as InteractiveStopCommand, B as SandboxInteractionConflict, C as InteractiveSessionHandleOptions, D as InteractiveSessionRef, E as InteractiveSessionInfo, F as InteractiveTerminalFrameLog, G as CONTROL_PLANE_MCP_SERVER_NAME, H as SandboxInteractionResult, I as InteractiveTerminalMetadata, J as SandboxMcpEndpoint, K as SANDBOX_MCP_SERVER_NAME, L as createInteractiveTerminalCapture, M as RespondToPermissionOptions, N as agentInteractiveSessionPromptRequestDigest, O as InteractiveSessionStartOptions, P as InteractiveTerminalCapture, R as createInteractiveTerminalSession, S as InteractiveSessionHandle, T as InteractiveSessionIncarnationId, U as BuildControlPlaneMcpConfigOptions, V as SandboxInteractionResolution, W as BuildSandboxMcpConfigOptions, X as buildControlPlaneMcpConfig, Y as SandboxMcpServerEntry, Z as buildSandboxMcpConfig, _ as SandboxSession, a as WorkspaceImagePublishRequestOptions, b as InteractivePromptCommand, c as TraceExportFormat, d as buildTraceExportPayload, f as exportTraceBundle, g as RawEvidenceExport, h as SandboxTaskSession, i as WorkspaceImagePublishInput, j as InterruptResult, k as InteractiveSessionStartResult, l as TraceExportResult, m as toOtelJson, o as WorkspaceImagePublishResult, p as otelTraceIdForTangleTrace, q as SandboxMcpConfig, r as SandboxInstance, s as WorkspaceImages, t as ForkAcknowledgement, u as TraceExportSink, v as AgentInteractiveTerminalSession, w as InteractiveSessionHost, x as InteractiveSessionControlClaim, y as InteractiveControlClaimRequest, z as SandboxInteractionCommandResult } from "./sandbox-LRvBzGGm.js";
2
2
  import { c as MintScopedTokenOptions, d as TERMINAL_WS_ECHO_SUBPROTOCOL, f as TerminalExitInfo, g as TerminalStreamAuthFormat, h as TerminalReadyInfo, i as TerminalStreamOptions, l as ScopedToken, m as TerminalOutputMessage, n as TerminalStreamError, o as TerminalStreamToken, p as TerminalInteractiveSessionIdentity, r as TerminalStreamHandlers, s as MintInteractiveSessionTokenOptions, t as TerminalStream, u as ScopedTokenScope } from "./terminal-stream-C9jxoB07.js";
3
3
  import { a as InteractiveSessionControlController, c as InteractiveSessionIdentity, d as interactiveSessionIdentityDigest, f as InteractiveAttachOptions, g as InteractiveSessionStatus, h as InteractiveRequestOptions, i as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, l as InteractiveSessionNotRunningError, m as InteractiveControlClaimOptions, n as BrowserInteractiveSessionControlControllerOptions, o as InteractiveSessionControlControllerOptions, p as InteractiveControlClaimAcknowledgement, r as browserInteractiveControlHolderId, s as InteractiveSessionControlTransport, t as BrowserInteractiveSessionControlController, u as createInteractiveControlHolderId } from "./browser-interactive-control-controller-C2qVGzQz.js";
4
4
  import { a as InteractiveSessionControllerOptions, i as InteractiveSessionController, n as BrowserInteractiveSessionControllerOptions, o as InteractiveSessionControllerTransport, r as InteractiveAttachRequest, t as BrowserInteractiveSessionController } from "./interactive-controller-Dghv9yMk.js";
5
- import { A as LineTransport, B as LineApplication, C as LineRespondView, D as LineSenderVerification, E as LineSendReceipt, F as SandboxLines, G as parseLineApplicationRequest, H as LineApplicationResult, I as lineInstanceKey, K as parseLineApplicationResult, L as profileChannelReference, M as LineVoiceOptions, N as LinesClient, O as LineSenderVerificationStart, R as LINE_APPLICATION_REPLY_MAX_CHARS, S as LineRespondAgent, T as LineSendInput, U as LineApplicationState, V as LineApplicationRequest, W as LineApplicationView, _ as LineMessage, a as LineAttachOptions, b as LineReminderPreferences, c as LineExecutionKey, d as LineInstanceCreate, f as LineLimits, g as LineMemberSpec, h as LineMemberPatch, i as LineAllowanceSubject, j as LineVoice, k as LineThread, l as LineFromConnectionInput, m as LineMemberInstance, n as LineAgentRolePolicy, o as LineAttachment, p as LineMember, r as LineAllowance, s as LineAttachmentReauthorization, t as Line, u as LineInstanceAttachOptions, v as LineNumberInventory, w as LineRole, x as LineReplyGate, y as LineProvider, z as LINE_APPLICATION_REQUEST_MAX_BYTES } from "./lines-BoT0rBrj.js";
6
- import { $ as DownloadOptions, $i as SnapshotDeleteAcknowledgement, $n as PublicTemplateInfo, $r as SandboxFleetTraceEvent, $t as GPU_LEASE_PROVIDER_NAMES, A as CommitTaskSessionOptions, Aa as WriteFileOptions, Ai as SandboxTraceOptions, An as NetworkConfig, Ar as SandboxFleetArtifact, At as FileUsageOptions, B as CreateSandboxOptions, Ba as BackendType, Bi as SessionEventStreamOptions, Bn as ProcessListOptions, Br as SandboxFleetMachineMeteredUsage, Bt as FleetDispatchStreamOptions, C as BranchOptions, Ca as UpdateUserOptions, Ci as SandboxTerminalInfo, Cn as ListMessagesOptions, Cr as SandboxDeleteAcknowledgement, Ct as FileReadError, Da as WaitForOptions, Di as SandboxTraceBundle, Dn as MAX_EGRESS_DENIALS_LIMIT, Dr as SandboxEvent, Dt as FileTreeFile, Ea as UsageInfo, Ei as SandboxTerminals, En as ListSandboxOptions, Er as SandboxEnvironment, Et as FileSystem, F as CreateIntelligenceReportOptions, Fa as BatchEventDataMap, Fi as SecretsManager, Fn as PreviewLinkInfo, Fr as SandboxFleetDriverCapability, Ft as FleetAgentResult, G as DeleteMatchingSandboxesFilter, Ga as ManagedProcessRecord, Gi as SessionInfo, Gn as ProcessStatus, Gr as SandboxFleetOperationsSummary, Gt as FleetMachineId, H as CreateTaskSessionOptions, Ha as ManagedProcessClient, Hi as SessionExecutionStatus, Hn as ProcessManager, Hr as SandboxFleetMachineSpec, Ht as FleetDriveTurnRequest, I as CreateRequestOptions, Ia as BatchSidecarGroup, Ii as SendSessionMessageOptions, In as PreviewLinkManager, Ir as SandboxFleetDriverTimings, It as FleetAgentRunStatus, J as DeleteOptions, Ji as SessionMessage, Jn as PromptResult, Jr as SandboxFleetPolicy, Jt as FleetRunEvent, K as DeleteMatchingSandboxesOptions, Ka as ManagedProcessSpec, Ki as SessionInterruptOptions, Kn as PromptInputPart, Kr as SandboxFleetParent, Kt as FleetPromptDispatchOptions, L as CreateSandboxFleetOptions, La as BatchTaskUsage, Li as SendSessionMessageRequest, Ln as PreviewLinkWaitOptions, Lr as SandboxFleetInfo, Lt as FleetDispatchCancelResult, M as ConversationTurnOptions, Ma as WriteManyOptions, Mi as SearchMatch, Mn as NonHostAgentDriverConfig, Mr as SandboxFleetCostEstimate, Mt as FileWriteResult, N as ConversationTurnResult, Na as BatchBackendStats, Ni as SearchOptions, Nn as PermissionLevel, Nr as SandboxFleetDispatchFailureClass, Nt as FleetAgentId, Oa as WaitForRolloutOptions, Oi as SandboxTraceEvent, On as McpServerConfig, Or as SandboxFleetAgent, Ot as FileTreeOptions, P as CreateGpuLeaseOptions, Pa as BatchEvent, Pi as SecretInfo, Pn as PermissionsManager, Pr as SandboxFleetDispatchResponse, Pt as FleetAgentPlacement, Q as DispatchedSession, Qi as SessionStatus, Qn as ProvisionStep, Qr as SandboxFleetTraceBundle, Qt as ForkLookupOptions, Ra as PublicBatchRunRequest, Ri as SentSessionMessage, Rn as Process, Rr as SandboxFleetIntelligenceEnvelope, Rt as FleetDispatchResultBuffer, S as BatchTaskResult, Sa as TurnDriveResult, Si as SandboxTerminalCreateOptions, Sr as SandboxCreateReceipt, St as FileReadBatchResult, T as ChunkedUploadResult, Ta as UploadProgress, Ti as SandboxTerminalRequestOptions, Tn as ListSandboxFleetOptions, Tr as SandboxDeleteOutcome, Tt as FileRenameResult, U as DeleteMatchingSandboxOutcome, Ua as ManagedProcessJobs, Ui as SessionFailureReason, Un as ProcessSignal, Ur as SandboxFleetManifest, Ut as FleetExecDispatchOptions, V as CreateSessionOptions, Va as parseBackendType, Vi as SessionExecutionInfo, Vn as ProcessLogEntry, Vr as SandboxFleetMachineRecord, Vt as FleetDriveTurnOutcome, W as DeleteMatchingSandboxResult, Wa as ManagedProcessOptions, Wi as SessionForkOptions, Wn as ProcessSpawnOptions, Wr as SandboxFleetManifestMachine, X as DirectoryPermission, Xi as SessionMessageInputPart, Xn as ProvisionResult, Xr as SandboxFleetSpend, Xt as ForkCounts, Y as DevServerInfo, Yi as SessionMessageAdmission, Yn as ProvisionEvent, Yr as SandboxFleetProfileRef, Yt as FleetRunOptions, Z as DispatchPromptOptions, Zi as SessionResultOptions, Zn as ProvisionStatus, Zr as SandboxFleetToken, Zt as ForkIdempotency, _ as BatchBackend, _a as TeeAttestationResponse, _i as SandboxShape, _n as IntelligenceReport, _r as SSHCommandDescriptor, _t as ExactProcessSpawnOptions, ai as SandboxFleetWorkspaceRestoreResult, an as GitStatus, ar as ReconcileSandboxFleetsOptions, at as DriverType, b as BatchRunRequest, ba as TokenRefreshHandler, bi as SandboxStatus, bn as IntelligenceReportSubjectType, br as SandboxConnection, bt as FileInfo, c as AttachGpuLeaseOptions, ca as StorageConfig, ci as SandboxInfo, cn as GpuLeaseCommandResult, d as BackendConfig, da as TaskSessionCommitResult, di as SandboxPortPreviewLink, dn as GpuLeaseManager, dr as RolloutChildResult, dt as EffectiveBackendSource, ea as SnapshotDeleteOutcome, ei as SandboxFleetTraceExport, en as GitAuth, er as PublicTemplateVersionInfo, et as DownloadProgress, f as BackendInfo, fa as TaskSessionFileChange, fi as SandboxRemovalState, fn as GpuLeaseProviderName, fr as RolloutOptions, ft as EgressDenial, g as BackendStatus, ga as TeeAttestationReport, gi as SandboxRuntimeHealth, gn as InstalledTool, gr as RolloutTurnPart, gt as EventStreamOptions, h as BackendRuntimeConfigUpdate, ha as TeeAttestationOptions, hi as SandboxRuntimeCapabilities, hn as HostAgentRuntimeBackend, hr as RolloutStatus, ht as EnsureDevServerOptions, ia as SnapshotResult, ii as SandboxFleetWorkspaceReconcileResult, in as GitDiff, ir as ReapExpiredSandboxFleetsResult, it as DriverInfo, j as CompletedTurnResult, ja as WriteManyFile, ji as SandboxUser, jn as NetworkManager, jr as SandboxFleetArtifactSpec, jt as FileUsageResult, ka as WorkspaceOperationLookup, ki as SandboxTraceExport, kn as MkdirOptions, kr as SandboxFleetAgentSpec, kt as FileTreeResult, l as AttachSandboxFleetMachineOptions, la as SubscriptionInfo, li as SandboxIntelligenceEnvelope, ln as GpuLeaseExecOptions, lt as EffectiveBackend, m as BackendMcpServerStatus, ma as TaskSessionProfile, mi as SandboxResources, mn as HostAgentDriverConfig, mr as RolloutStartResult, mt as EgressPolicy, n as AccessPolicyRule, na as SnapshotInfo, ni as SandboxFleetUsage, nn as GitCommit, nr as PublishPublicTemplateVersionOptions, nt as DriveTurnOptions, oa as StartupDiagnostics, oi as SandboxFleetWorkspaceSnapshotResult, on as GpuLease, or as ReconcileSandboxFleetsResult, ot as DurablePlan, p as BackendManager, pa as TaskSessionInfo, pi as SandboxResourceUsage, pn as GpuLeaseStatus, pr as RolloutScorer, pt as EgressManager, q as DeleteMatchingSandboxesResult, qa as ManagedProcessState, qi as SessionListOptions, qn as PromptOptions, qr as SandboxFleetPlacement, qt as FleetPromptDispatchResult, r as AddUserOptions, ra as SnapshotOptions, ri as SandboxFleetWorkspace, rn as GitConfig, rr as ReapExpiredSandboxFleetsOptions, rt as DriverConfig, sa as StartupOperation, si as SandboxIdentity, sn as GpuLeaseBilling, sr as RenameOptions, st as DurablePlanDecisionResult, t as AcceleratorKind, ta as SnapshotIdempotency, ti as SandboxFleetTraceOptions, tn as GitBranch, tr as PublishPublicTemplateOptions, tt as DownloadResult, u as BackendCapabilities, ua as TaskSessionChanges, ui as SandboxPortBinding, un as GpuLeaseExecResult, ur as Rollout, ut as EffectiveBackendProfile, v as BatchResult, va as TeePublicKey, vi as SandboxShapePreset, vn as IntelligenceReportBudget, vr as SSHCredentials, vt as ExecOptions, w as ChunkedUploadOptions, wa as UploadOptions, wi as SandboxTerminalManager, wn as ListOptions, wr as SandboxDeleteOptions, wt as FileReadResult, x as BatchTask, xa as TokenUsage, xi as SandboxTerminalAttachOptions, xn as IntelligenceReportWindow, xr as SandboxCreateOutcome, xt as FileReadBatchOptions, y as BatchRunOptions, ya as TeePublicKeyResponse, yi as SandboxShapesInfo, yn as IntelligenceReportCompareTo, yr as SandboxConfig, yt as ExecResult, z as CreateSandboxFleetWithCoordinatorOptions, za as ALL_BACKEND_TYPES, zi as SessionBackendCredentials, zn as ProcessInfo, zr as SandboxFleetMachine, zt as FleetDispatchResultBufferOptions } from "./types-Cs-0Hy_K.js";
7
- import { A as isBackendRegistryInteractionKind, C as BackendRegistryEntry, D as backendRegistryEntrySchema, E as backendRegistryCapabilitiesSchema, M as parseBackendRegistryResponseBody, O as backendRegistryInteractionKindSchema, S as BackendRegistryCapabilities, T as BackendRegistryResponse, _ as SandboxFleet, a as Team, b as ParsedSSEEvent, c as SessionBroadcastEvent, d as HostedInstance, f as InstanceProfile, g as InstancesClient, h as InstanceStart, i as Sandbox, j as parseBackendRegistryResponse, k as backendRegistryResponseSchema, l as SessionBroadcastResult, m as InstanceRestartingError, n as IntelligenceClient, o as TeamInvitation, p as InstanceRecord, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as EnsureInstanceOptions, v as SandboxFleetClient, w as BackendRegistryInteractionKind, x as parseSSEStream, y as ParseSSEStreamOptions } from "./client-jPPuv6Ns.js";
5
+ import { A as LineTransport, B as LineApplication, C as LineRespondView, D as LineSenderVerification, E as LineSendReceipt, F as SandboxLines, G as parseLineApplicationRequest, H as LineApplicationResult, I as lineInstanceKey, K as parseLineApplicationResult, L as profileChannelReference, M as LineVoiceOptions, N as LinesClient, O as LineSenderVerificationStart, R as LINE_APPLICATION_REPLY_MAX_CHARS, S as LineRespondAgent, T as LineSendInput, U as LineApplicationState, V as LineApplicationRequest, W as LineApplicationView, _ as LineMessage, a as LineAttachOptions, b as LineReminderPreferences, c as LineExecutionKey, d as LineInstanceCreate, f as LineLimits, g as LineMemberSpec, h as LineMemberPatch, i as LineAllowanceSubject, j as LineVoice, k as LineThread, l as LineFromConnectionInput, m as LineMemberInstance, n as LineAgentRolePolicy, o as LineAttachment, p as LineMember, r as LineAllowance, s as LineAttachmentReauthorization, t as Line, u as LineInstanceAttachOptions, v as LineNumberInventory, w as LineRole, x as LineReplyGate, y as LineProvider, z as LINE_APPLICATION_REQUEST_MAX_BYTES } from "./lines-T2D6xHHx.js";
6
+ import { $ as DownloadOptions, $i as SnapshotDeleteAcknowledgement, $n as PublicTemplateInfo, $r as SandboxFleetTraceEvent, $t as GPU_LEASE_PROVIDER_NAMES, A as CommitTaskSessionOptions, Aa as WriteFileOptions, Ai as SandboxTraceOptions, An as NetworkConfig, Ar as SandboxFleetArtifact, At as FileUsageOptions, B as CreateSandboxOptions, Ba as BackendType, Bi as SessionEventStreamOptions, Bn as ProcessListOptions, Br as SandboxFleetMachineMeteredUsage, Bt as FleetDispatchStreamOptions, C as BranchOptions, Ca as UpdateUserOptions, Ci as SandboxTerminalInfo, Cn as ListMessagesOptions, Cr as SandboxDeleteAcknowledgement, Ct as FileReadError, Da as WaitForOptions, Di as SandboxTraceBundle, Dn as MAX_EGRESS_DENIALS_LIMIT, Dr as SandboxEvent, Dt as FileTreeFile, Ea as UsageInfo, Ei as SandboxTerminals, En as ListSandboxOptions, Er as SandboxEnvironment, Et as FileSystem, F as CreateIntelligenceReportOptions, Fa as BatchEventDataMap, Fi as SecretsManager, Fn as PreviewLinkInfo, Fr as SandboxFleetDriverCapability, Ft as FleetAgentResult, G as DeleteMatchingSandboxesFilter, Ga as ManagedProcessRecord, Gi as SessionInfo, Gn as ProcessStatus, Gr as SandboxFleetOperationsSummary, Gt as FleetMachineId, H as CreateTaskSessionOptions, Ha as ManagedProcessClient, Hi as SessionExecutionStatus, Hn as ProcessManager, Hr as SandboxFleetMachineSpec, Ht as FleetDriveTurnRequest, I as CreateRequestOptions, Ia as BatchSidecarGroup, Ii as SendSessionMessageOptions, In as PreviewLinkManager, Ir as SandboxFleetDriverTimings, It as FleetAgentRunStatus, J as DeleteOptions, Ji as SessionMessage, Jn as PromptResult, Jr as SandboxFleetPolicy, Jt as FleetRunEvent, K as DeleteMatchingSandboxesOptions, Ka as ManagedProcessSpec, Ki as SessionInterruptOptions, Kn as PromptInputPart, Kr as SandboxFleetParent, Kt as FleetPromptDispatchOptions, L as CreateSandboxFleetOptions, La as BatchTaskUsage, Li as SendSessionMessageRequest, Ln as PreviewLinkWaitOptions, Lr as SandboxFleetInfo, Lt as FleetDispatchCancelResult, M as ConversationTurnOptions, Ma as WriteManyOptions, Mi as SearchMatch, Mn as NonHostAgentDriverConfig, Mr as SandboxFleetCostEstimate, Mt as FileWriteResult, N as ConversationTurnResult, Na as BatchBackendStats, Ni as SearchOptions, Nn as PermissionLevel, Nr as SandboxFleetDispatchFailureClass, Nt as FleetAgentId, Oa as WaitForRolloutOptions, Oi as SandboxTraceEvent, On as McpServerConfig, Or as SandboxFleetAgent, Ot as FileTreeOptions, P as CreateGpuLeaseOptions, Pa as BatchEvent, Pi as SecretInfo, Pn as PermissionsManager, Pr as SandboxFleetDispatchResponse, Pt as FleetAgentPlacement, Q as DispatchedSession, Qi as SessionStatus, Qn as ProvisionStep, Qr as SandboxFleetTraceBundle, Qt as ForkLookupOptions, Ra as PublicBatchRunRequest, Ri as SentSessionMessage, Rn as Process, Rr as SandboxFleetIntelligenceEnvelope, Rt as FleetDispatchResultBuffer, S as BatchTaskResult, Sa as TurnDriveResult, Si as SandboxTerminalCreateOptions, Sr as SandboxCreateReceipt, St as FileReadBatchResult, T as ChunkedUploadResult, Ta as UploadProgress, Ti as SandboxTerminalRequestOptions, Tn as ListSandboxFleetOptions, Tr as SandboxDeleteOutcome, Tt as FileRenameResult, U as DeleteMatchingSandboxOutcome, Ua as ManagedProcessJobs, Ui as SessionFailureReason, Un as ProcessSignal, Ur as SandboxFleetManifest, Ut as FleetExecDispatchOptions, V as CreateSessionOptions, Va as parseBackendType, Vi as SessionExecutionInfo, Vn as ProcessLogEntry, Vr as SandboxFleetMachineRecord, Vt as FleetDriveTurnOutcome, W as DeleteMatchingSandboxResult, Wa as ManagedProcessOptions, Wi as SessionForkOptions, Wn as ProcessSpawnOptions, Wr as SandboxFleetManifestMachine, X as DirectoryPermission, Xi as SessionMessageInputPart, Xn as ProvisionResult, Xr as SandboxFleetSpend, Xt as ForkCounts, Y as DevServerInfo, Yi as SessionMessageAdmission, Yn as ProvisionEvent, Yr as SandboxFleetProfileRef, Yt as FleetRunOptions, Z as DispatchPromptOptions, Zi as SessionResultOptions, Zn as ProvisionStatus, Zr as SandboxFleetToken, Zt as ForkIdempotency, _ as BatchBackend, _a as TeeAttestationResponse, _i as SandboxShape, _n as IntelligenceReport, _r as SSHCommandDescriptor, _t as ExactProcessSpawnOptions, ai as SandboxFleetWorkspaceRestoreResult, an as GitStatus, ar as ReconcileSandboxFleetsOptions, at as DriverType, b as BatchRunRequest, ba as TokenRefreshHandler, bi as SandboxStatus, bn as IntelligenceReportSubjectType, br as SandboxConnection, bt as FileInfo, c as AttachGpuLeaseOptions, ca as StorageConfig, ci as SandboxInfo, cn as GpuLeaseCommandResult, d as BackendConfig, da as TaskSessionCommitResult, di as SandboxPortPreviewLink, dn as GpuLeaseManager, dr as RolloutChildResult, dt as EffectiveBackendSource, ea as SnapshotDeleteOutcome, ei as SandboxFleetTraceExport, en as GitAuth, er as PublicTemplateVersionInfo, et as DownloadProgress, f as BackendInfo, fa as TaskSessionFileChange, fi as SandboxRemovalState, fn as GpuLeaseProviderName, fr as RolloutOptions, ft as EgressDenial, g as BackendStatus, ga as TeeAttestationReport, gi as SandboxRuntimeHealth, gn as InstalledTool, gr as RolloutTurnPart, gt as EventStreamOptions, h as BackendRuntimeConfigUpdate, ha as TeeAttestationOptions, hi as SandboxRuntimeCapabilities, hn as HostAgentRuntimeBackend, hr as RolloutStatus, ht as EnsureDevServerOptions, ia as SnapshotResult, ii as SandboxFleetWorkspaceReconcileResult, in as GitDiff, ir as ReapExpiredSandboxFleetsResult, it as DriverInfo, j as CompletedTurnResult, ja as WriteManyFile, ji as SandboxUser, jn as NetworkManager, jr as SandboxFleetArtifactSpec, jt as FileUsageResult, ka as WorkspaceOperationLookup, ki as SandboxTraceExport, kn as MkdirOptions, kr as SandboxFleetAgentSpec, kt as FileTreeResult, l as AttachSandboxFleetMachineOptions, la as SubscriptionInfo, li as SandboxIntelligenceEnvelope, ln as GpuLeaseExecOptions, lt as EffectiveBackend, m as BackendMcpServerStatus, ma as TaskSessionProfile, mi as SandboxResources, mn as HostAgentDriverConfig, mr as RolloutStartResult, mt as EgressPolicy, n as AccessPolicyRule, na as SnapshotInfo, ni as SandboxFleetUsage, nn as GitCommit, nr as PublishPublicTemplateVersionOptions, nt as DriveTurnOptions, oa as StartupDiagnostics, oi as SandboxFleetWorkspaceSnapshotResult, on as GpuLease, or as ReconcileSandboxFleetsResult, ot as DurablePlan, p as BackendManager, pa as TaskSessionInfo, pi as SandboxResourceUsage, pn as GpuLeaseStatus, pr as RolloutScorer, pt as EgressManager, q as DeleteMatchingSandboxesResult, qa as ManagedProcessState, qi as SessionListOptions, qn as PromptOptions, qr as SandboxFleetPlacement, qt as FleetPromptDispatchResult, r as AddUserOptions, ra as SnapshotOptions, ri as SandboxFleetWorkspace, rn as GitConfig, rr as ReapExpiredSandboxFleetsOptions, rt as DriverConfig, sa as StartupOperation, si as SandboxIdentity, sn as GpuLeaseBilling, sr as RenameOptions, st as DurablePlanDecisionResult, t as AcceleratorKind, ta as SnapshotIdempotency, ti as SandboxFleetTraceOptions, tn as GitBranch, tr as PublishPublicTemplateOptions, tt as DownloadResult, u as BackendCapabilities, ua as TaskSessionChanges, ui as SandboxPortBinding, un as GpuLeaseExecResult, ur as Rollout, ut as EffectiveBackendProfile, v as BatchResult, va as TeePublicKey, vi as SandboxShapePreset, vn as IntelligenceReportBudget, vr as SSHCredentials, vt as ExecOptions, w as ChunkedUploadOptions, wa as UploadOptions, wi as SandboxTerminalManager, wn as ListOptions, wr as SandboxDeleteOptions, wt as FileReadResult, x as BatchTask, xa as TokenUsage, xi as SandboxTerminalAttachOptions, xn as IntelligenceReportWindow, xr as SandboxCreateOutcome, xt as FileReadBatchOptions, y as BatchRunOptions, ya as TeePublicKeyResponse, yi as SandboxShapesInfo, yn as IntelligenceReportCompareTo, yr as SandboxConfig, yt as ExecResult, z as CreateSandboxFleetWithCoordinatorOptions, za as ALL_BACKEND_TYPES, zi as SessionBackendCredentials, zn as ProcessInfo, zr as SandboxFleetMachine, zt as FleetDispatchResultBufferOptions } from "./types-C9w6MdZB.js";
7
+ import { A as isBackendRegistryInteractionKind, C as BackendRegistryEntry, D as backendRegistryEntrySchema, E as backendRegistryCapabilitiesSchema, M as parseBackendRegistryResponseBody, O as backendRegistryInteractionKindSchema, S as BackendRegistryCapabilities, T as BackendRegistryResponse, _ as SandboxFleet, a as Team, b as ParsedSSEEvent, c as SessionBroadcastEvent, d as HostedInstance, f as InstanceProfile, g as InstancesClient, h as InstanceStart, i as Sandbox, j as parseBackendRegistryResponse, k as backendRegistryResponseSchema, l as SessionBroadcastResult, m as InstanceRestartingError, n as IntelligenceClient, o as TeamInvitation, p as InstanceRecord, r as InviteTeamMemberOptions, s as TeamMember, t as CreateTeamOptions, u as EnsureInstanceOptions, v as SandboxFleetClient, w as BackendRegistryInteractionKind, x as parseSSEStream, y as ParseSSEStreamOptions } from "./client-BFilDKO8.js";
8
8
  import { _ as TimeoutError, a as FileWriteConflictError, c as NotFoundError, d as ResumeEnvRequiredError, f as SandboxError, g as StateError, h as ServerError, i as EgressProxyRecoveryError, l as PartialFailureError, m as SandboxFailureDetail, n as CapabilityError, o as KeyBudgetExhaustedError, p as SandboxErrorJson, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError, v as ValidationError } from "./errors-C6dll8Qf.js";
9
9
  import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-BSCz2Q0v.js";
10
10
  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-BKhRnV0i.js";
11
- import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-C1GJ1YCD.js";
12
- import { o as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-CZjj0Wj3.js";
11
+ import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-BDxby7zK.js";
12
+ import { d as TangleSandboxClientConfig, o as TangleSandboxClient } from "./index-DGuTeptP.js";
13
13
  import * as _$_tangle_network_agent_interface0 from "@tangle-network/agent-interface";
14
14
  import { AgentProfile, AgentProfile as AgentProfile$1, AgentProfileCapabilities, AgentProfileConfidential, AgentProfileConfigValue, AgentProfileConnection, AgentProfileFileMount, AgentProfileFileMount as AgentProfileFileMount$1, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePermissionValue, AgentProfilePrompt, AgentProfileResourceRef, AgentProfileResources, AgentProfileSecurityPolicy, AgentProfileValidationIssue, AgentProfileValidationResult, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, AgentSubagentProfile, Capability, SANDBOX_SIZE_PRESET_NAMES, SandboxSizePreset } from "@tangle-network/agent-interface";
15
15
  import { z } from "zod";
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { D as otelTraceIdForTangleTrace, E as exportTraceBundle, O as toOtelJson
7
7
  import { LinesClient, SandboxLines, lineInstanceKey, profileChannelReference } from "./lines.js";
8
8
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-C1JAl5kE.js";
9
9
  import { i as parseLineApplicationResult, n as LINE_APPLICATION_REQUEST_MAX_BYTES, r as parseLineApplicationRequest, t as LINE_APPLICATION_REPLY_MAX_CHARS } from "./line-application-DJYY1v8U.js";
10
- import { t as TangleSandboxClient } from "./tangle-DsvldZtQ.js";
10
+ import { t as TangleSandboxClient } from "./tangle-SNShua9T.js";
11
11
  import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
12
12
  import { z } from "zod";
13
13
  //#region src/confidential.ts
@@ -1,4 +1,4 @@
1
- import { B as CreateSandboxOptions, d as BackendConfig } from "./types-Cs-0Hy_K.js";
1
+ import { B as CreateSandboxOptions, d as BackendConfig } from "./types-C9w6MdZB.js";
2
2
 
3
3
  //#region src/line-application.d.ts
4
4
  /** Bounded callback request bytes after canonicalization, including JSON framing. */
package/dist/lines.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as LineTransport, C as LineRespondView, D as LineSenderVerification, E as LineSendReceipt, F as SandboxLines, I as lineInstanceKey, L as profileChannelReference, M as LineVoiceOptions, N as LinesClient, O as LineSenderVerificationStart, P as LinesHttpClient, S as LineRespondAgent, T as LineSendInput, _ as LineMessage, a as LineAttachOptions, b as LineReminderPreferences, c as LineExecutionKey, d as LineInstanceCreate, f as LineLimits, g as LineMemberSpec, h as LineMemberPatch, i as LineAllowanceSubject, j as LineVoice, k as LineThread, l as LineFromConnectionInput, m as LineMemberInstance, n as LineAgentRolePolicy, o as LineAttachment, p as LineMember, r as LineAllowance, s as LineAttachmentReauthorization, t as Line, u as LineInstanceAttachOptions, v as LineNumberInventory, w as LineRole, x as LineReplyGate, y as LineProvider } from "./lines-BoT0rBrj.js";
1
+ import { A as LineTransport, C as LineRespondView, D as LineSenderVerification, E as LineSendReceipt, F as SandboxLines, I as lineInstanceKey, L as profileChannelReference, M as LineVoiceOptions, N as LinesClient, O as LineSenderVerificationStart, P as LinesHttpClient, S as LineRespondAgent, T as LineSendInput, _ as LineMessage, a as LineAttachOptions, b as LineReminderPreferences, c as LineExecutionKey, d as LineInstanceCreate, f as LineLimits, g as LineMemberSpec, h as LineMemberPatch, i as LineAllowanceSubject, j as LineVoice, k as LineThread, l as LineFromConnectionInput, m as LineMemberInstance, n as LineAgentRolePolicy, o as LineAttachment, p as LineMember, r as LineAllowance, s as LineAttachmentReauthorization, t as Line, u as LineInstanceAttachOptions, v as LineNumberInventory, w as LineRole, x as LineReplyGate, y as LineProvider } from "./lines-T2D6xHHx.js";
2
2
  export { Line, LineAgentRolePolicy, LineAllowance, LineAllowanceSubject, LineAttachOptions, LineAttachment, LineAttachmentReauthorization, LineExecutionKey, LineFromConnectionInput, LineInstanceAttachOptions, LineInstanceCreate, LineLimits, LineMember, LineMemberInstance, LineMemberPatch, LineMemberSpec, LineMessage, LineNumberInventory, LineProvider, LineReminderPreferences, LineReplyGate, LineRespondAgent, LineRespondView, LineRole, LineSendInput, LineSendReceipt, LineSenderVerification, LineSenderVerificationStart, LineThread, LineTransport, LineVoice, LineVoiceOptions, LinesClient, LinesHttpClient, SandboxLines, lineInstanceKey, profileChannelReference };
@@ -1,6 +1,6 @@
1
- import { r as SandboxInstance } from "./sandbox-BY7KZweP.js";
2
- import { Fn as PreviewLinkInfo, ht as EnsureDevServerOptions } from "./types-Cs-0Hy_K.js";
3
- import { i as Sandbox } from "./client-jPPuv6Ns.js";
1
+ import { r as SandboxInstance } from "./sandbox-LRvBzGGm.js";
2
+ import { Fn as PreviewLinkInfo, ht as EnsureDevServerOptions } from "./types-C9w6MdZB.js";
3
+ import { i as Sandbox } from "./client-BFilDKO8.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
1
  import { l as ScopedToken, t as TerminalStream } from "./terminal-stream-C9jxoB07.js";
2
2
  import { c as InteractiveSessionIdentity, l as InteractiveSessionNotRunningError, r as browserInteractiveControlHolderId } from "./browser-interactive-control-controller-C2qVGzQz.js";
3
3
  import { t as BrowserInteractiveSessionController } from "./interactive-controller-Dghv9yMk.js";
4
- import { A as CommitTaskSessionOptions, Aa as WriteFileOptions, At as FileUsageOptions, Bi as SessionEventStreamOptions, Ci as SandboxTerminalInfo, Cn as ListMessagesOptions, Dr as SandboxEvent, Gi as SessionInfo, H as CreateTaskSessionOptions, Hi as SessionExecutionStatus, Ii as SendSessionMessageOptions, Ji as SessionMessage, Li as SendSessionMessageRequest, Mt as FileWriteResult, Ot as FileTreeOptions, Ri as SentSessionMessage, Si as SandboxTerminalCreateOptions, St as FileReadBatchResult, T as ChunkedUploadResult, Ta as UploadProgress, Ti as SandboxTerminalRequestOptions, Tt as FileRenameResult, V as CreateSessionOptions, Vi as SessionExecutionInfo, Yi as SessionMessageAdmission, da as TaskSessionCommitResult, gi as SandboxRuntimeHealth, jt as FileUsageResult, kt as FileTreeResult, pa as TaskSessionInfo, sr as RenameOptions, ua as TaskSessionChanges, ui as SandboxPortBinding, w as ChunkedUploadOptions, wi as SandboxTerminalManager, xt as FileReadBatchOptions } from "./types-Cs-0Hy_K.js";
4
+ import { A as CommitTaskSessionOptions, Aa as WriteFileOptions, At as FileUsageOptions, Bi as SessionEventStreamOptions, Ci as SandboxTerminalInfo, Cn as ListMessagesOptions, Dr as SandboxEvent, Gi as SessionInfo, H as CreateTaskSessionOptions, Hi as SessionExecutionStatus, Ii as SendSessionMessageOptions, Ji as SessionMessage, Li as SendSessionMessageRequest, Mt as FileWriteResult, Ot as FileTreeOptions, Ri as SentSessionMessage, Si as SandboxTerminalCreateOptions, St as FileReadBatchResult, T as ChunkedUploadResult, Ta as UploadProgress, Ti as SandboxTerminalRequestOptions, Tt as FileRenameResult, V as CreateSessionOptions, Vi as SessionExecutionInfo, Yi as SessionMessageAdmission, da as TaskSessionCommitResult, gi as SandboxRuntimeHealth, jt as FileUsageResult, kt as FileTreeResult, pa as TaskSessionInfo, sr as RenameOptions, ua as TaskSessionChanges, ui as SandboxPortBinding, w as ChunkedUploadOptions, wi as SandboxTerminalManager, xt as FileReadBatchOptions } from "./types-C9w6MdZB.js";
5
5
  import { _ as TimeoutError, a as FileWriteConflictError, 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, v as ValidationError } from "./errors-C6dll8Qf.js";
6
- import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-C1GJ1YCD.js";
6
+ import { a as deriveAgentRunOutcome, i as deriveAgentResultOutcome, n as AgentRunOutcomeTracker, r as createAgentRunOutcomeTracker, t as AgentRunOutcome } from "./agent-run-outcome-BDxby7zK.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}
@@ -1,8 +1,8 @@
1
1
  import { a as TerminalStreamReconnectAuthority, c as MintScopedTokenOptions, h as TerminalReadyInfo, l as ScopedToken, r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-C9jxoB07.js";
2
2
  import { f as InteractiveAttachOptions, g as InteractiveSessionStatus, h as InteractiveRequestOptions, m as InteractiveControlClaimOptions, p as InteractiveControlClaimAcknowledgement } from "./browser-interactive-control-controller-C2qVGzQz.js";
3
3
  import { r as InteractiveAttachRequest } from "./interactive-controller-Dghv9yMk.js";
4
- import { F as SandboxLines } from "./lines-BoT0rBrj.js";
5
- import { $i as SnapshotDeleteAcknowledgement, A as CommitTaskSessionOptions, Aa as WriteFileOptions, Ai as SandboxTraceOptions, Bi as SessionEventStreamOptions, C as BranchOptions, Cn as ListMessagesOptions, Cr as SandboxDeleteAcknowledgement, D as CodeExecutionResult, Da as WaitForOptions, Di as SandboxTraceBundle, Dr as SandboxEvent, E as CodeExecutionOptions, Ei as SandboxTerminals, Et as FileSystem, Gi as SessionInfo, H as CreateTaskSessionOptions, Hn as ProcessManager, Ii as SendSessionMessageOptions, In as PreviewLinkManager, Ji as SessionMessage, Jn as PromptResult, Ki as SessionInterruptOptions, Kn as PromptInputPart, Li as SendSessionMessageRequest, M as ConversationTurnOptions, Ma as WriteManyOptions, Mi as SearchMatch, Mt as FileWriteResult, N as ConversationTurnResult, Ni as SearchOptions, O as CodeLanguage, Oa as WaitForRolloutOptions, Pn as PermissionsManager, Q as DispatchedSession, Qr as SandboxFleetTraceBundle, Qt as ForkLookupOptions, Ri as SentSessionMessage, Sa as TurnDriveResult, Sn as JsonValue, Sr as SandboxCreateReceipt, V as CreateSessionOptions, Vi as SessionExecutionInfo, Wi as SessionForkOptions, Xn as ProvisionResult, Xt as ForkCounts, Yi as SessionMessageAdmission, Yn as ProvisionEvent, Z as DispatchPromptOptions, Zi as SessionResultOptions, Zt as ForkIdempotency, _a as TeeAttestationResponse, _i as SandboxShape, _n as IntelligenceReport, _r as SSHCommandDescriptor, an as GitStatus, bi as SandboxStatus, br as SandboxConnection, ci as SandboxInfo, cr as RestoreSnapshotOptions, d as BackendConfig, da as TaskSessionCommitResult, dn as GpuLeaseManager, fr as RolloutOptions, gi as SandboxRuntimeHealth, gn as InstalledTool, gt as EventStreamOptions, ha as TeeAttestationOptions, hi as SandboxRuntimeCapabilities, ia as SnapshotResult, in as GitDiff, it as DriverInfo, j as CompletedTurnResult, ja as WriteManyFile, jn as NetworkManager, ka as WorkspaceOperationLookup, lr as ResumeOptions, mr as RolloutStartResult, na as SnapshotInfo, nn as GitCommit, nt as DriveTurnOptions, oa as StartupDiagnostics, on as GpuLease, ot as DurablePlan, p as BackendManager, pa as TaskSessionInfo, pi as SandboxResourceUsage, pt as EgressManager, qi as SessionListOptions, qn as PromptOptions, ra as SnapshotOptions, st as DurablePlanDecisionResult, tn as GitBranch, ua as TaskSessionChanges, ui as SandboxPortBinding, ur as Rollout, vn as IntelligenceReportBudget, vr as SSHCredentials, vt as ExecOptions, wr as SandboxDeleteOptions, xi as SandboxTerminalAttachOptions, xn as IntelligenceReportWindow, ya as TeePublicKeyResponse, yn as IntelligenceReportCompareTo, yt as ExecResult } from "./types-Cs-0Hy_K.js";
4
+ import { F as SandboxLines } from "./lines-T2D6xHHx.js";
5
+ import { $i as SnapshotDeleteAcknowledgement, A as CommitTaskSessionOptions, Aa as WriteFileOptions, Ai as SandboxTraceOptions, Bi as SessionEventStreamOptions, C as BranchOptions, Cn as ListMessagesOptions, Cr as SandboxDeleteAcknowledgement, D as CodeExecutionResult, Da as WaitForOptions, Di as SandboxTraceBundle, Dr as SandboxEvent, E as CodeExecutionOptions, Ei as SandboxTerminals, Et as FileSystem, Gi as SessionInfo, H as CreateTaskSessionOptions, Hn as ProcessManager, Ii as SendSessionMessageOptions, In as PreviewLinkManager, Ji as SessionMessage, Jn as PromptResult, Ki as SessionInterruptOptions, Kn as PromptInputPart, Li as SendSessionMessageRequest, M as ConversationTurnOptions, Ma as WriteManyOptions, Mi as SearchMatch, Mt as FileWriteResult, N as ConversationTurnResult, Ni as SearchOptions, O as CodeLanguage, Oa as WaitForRolloutOptions, Pn as PermissionsManager, Q as DispatchedSession, Qr as SandboxFleetTraceBundle, Qt as ForkLookupOptions, Ri as SentSessionMessage, Sa as TurnDriveResult, Sn as JsonValue, Sr as SandboxCreateReceipt, V as CreateSessionOptions, Vi as SessionExecutionInfo, Wi as SessionForkOptions, Xn as ProvisionResult, Xt as ForkCounts, Yi as SessionMessageAdmission, Yn as ProvisionEvent, Z as DispatchPromptOptions, Zi as SessionResultOptions, Zt as ForkIdempotency, _a as TeeAttestationResponse, _i as SandboxShape, _n as IntelligenceReport, _r as SSHCommandDescriptor, an as GitStatus, bi as SandboxStatus, br as SandboxConnection, ci as SandboxInfo, cr as RestoreSnapshotOptions, d as BackendConfig, da as TaskSessionCommitResult, dn as GpuLeaseManager, fr as RolloutOptions, gi as SandboxRuntimeHealth, gn as InstalledTool, gt as EventStreamOptions, ha as TeeAttestationOptions, hi as SandboxRuntimeCapabilities, ia as SnapshotResult, in as GitDiff, it as DriverInfo, j as CompletedTurnResult, ja as WriteManyFile, jn as NetworkManager, ka as WorkspaceOperationLookup, lr as ResumeOptions, mr as RolloutStartResult, na as SnapshotInfo, nn as GitCommit, nt as DriveTurnOptions, oa as StartupDiagnostics, on as GpuLease, ot as DurablePlan, p as BackendManager, pa as TaskSessionInfo, pi as SandboxResourceUsage, pt as EgressManager, qi as SessionListOptions, qn as PromptOptions, ra as SnapshotOptions, st as DurablePlanDecisionResult, tn as GitBranch, ua as TaskSessionChanges, ui as SandboxPortBinding, ur as Rollout, vn as IntelligenceReportBudget, vr as SSHCredentials, vt as ExecOptions, wr as SandboxDeleteOptions, xi as SandboxTerminalAttachOptions, xn as IntelligenceReportWindow, ya as TeePublicKeyResponse, yn as IntelligenceReportCompareTo, yt as ExecResult } from "./types-C9w6MdZB.js";
6
6
  import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, AgentInteractiveTerminalSession as AgentInteractiveTerminalSession$1, AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, InteractionAcknowledgement, InteractionData, InteractionRequest, InteractionResponseCommand, TerminalOutputEvent, TerminalReplayWindow, agentInteractiveSessionPromptRequestDigest } from "@tangle-network/agent-interface";
7
7
  import { z } from "zod";
8
8
 
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as ITangleJobsAbi, d as SandboxCreateResponseParamTypes, f as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as JsonResponseParamTypes, n as JOB_SANDBOX_CREATE, o as TangleSandboxClientConfig, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../index-CZjj0Wj3.js";
2
- export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig };
1
+ import { _ as SandboxIdParamTypes, a as SignMessage, c as JOB_SANDBOX_DELETE, d as TangleSandboxClientConfig, f as AgentSandboxBlueprintAbi, g as SandboxCreateResponseParamTypes, h as SandboxCreateParamTypes, i as OperatorSessionToken, l as TANGLE_CHAIN_ID, m as JsonResponseParamTypes, n as OperatorSession, o as TangleSandboxClient, p as ITangleJobsAbi, r as OperatorSessionError, s as JOB_SANDBOX_CREATE, t as OperatorChallenge, u as TANGLE_JOBS_CONTRACT } from "../index-DGuTeptP.js";
2
+ export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig };
@@ -1,2 +1,2 @@
1
- import { a as TANGLE_JOBS_CONTRACT, c as JsonResponseParamTypes, d as SandboxIdParamTypes, i as TANGLE_CHAIN_ID, l as SandboxCreateParamTypes, n as JOB_SANDBOX_CREATE, o as AgentSandboxBlueprintAbi, r as JOB_SANDBOX_DELETE, s as ITangleJobsAbi, t as TangleSandboxClient, u as SandboxCreateResponseParamTypes } from "../tangle-DsvldZtQ.js";
2
- export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient };
1
+ import { a as JOB_SANDBOX_DELETE, c as AgentSandboxBlueprintAbi, d as SandboxCreateParamTypes, f as SandboxCreateResponseParamTypes, i as JOB_SANDBOX_CREATE, l as ITangleJobsAbi, n as OperatorSession, o as TANGLE_CHAIN_ID, p as SandboxIdParamTypes, r as OperatorSessionError, s as TANGLE_JOBS_CONTRACT, t as TangleSandboxClient, u as JsonResponseParamTypes } from "../tangle-SNShua9T.js";
2
+ export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient };
@@ -132,90 +132,110 @@ const ITangleJobsAbi = [
132
132
  ]
133
133
  }
134
134
  ];
135
- const SandboxCreateParamTypes = [
136
- {
137
- name: "name",
138
- type: "string"
139
- },
140
- {
141
- name: "image",
142
- type: "string"
143
- },
144
- {
145
- name: "stack",
146
- type: "string"
147
- },
148
- {
149
- name: "agent_identifier",
150
- type: "string"
151
- },
152
- {
153
- name: "env_json",
154
- type: "string"
155
- },
156
- {
157
- name: "metadata_json",
158
- type: "string"
159
- },
160
- {
161
- name: "ssh_enabled",
162
- type: "bool"
163
- },
164
- {
165
- name: "ssh_public_key",
166
- type: "string"
167
- },
168
- {
169
- name: "web_terminal_enabled",
170
- type: "bool"
171
- },
172
- {
173
- name: "max_lifetime_seconds",
174
- type: "uint64"
175
- },
176
- {
177
- name: "idle_timeout_seconds",
178
- type: "uint64"
179
- },
180
- {
181
- name: "cpu_cores",
182
- type: "uint64"
183
- },
184
- {
185
- name: "memory_mb",
186
- type: "uint64"
187
- },
188
- {
189
- name: "disk_gb",
190
- type: "uint64"
191
- },
192
- {
193
- name: "tee_required",
194
- type: "bool"
195
- },
196
- {
197
- name: "tee_type",
198
- type: "uint8"
199
- },
200
- {
201
- name: "attestation_nonce",
202
- type: "string"
203
- }
204
- ];
135
+ const SandboxCreateParamTypes = [{
136
+ name: "request",
137
+ type: "tuple",
138
+ components: [
139
+ {
140
+ name: "name",
141
+ type: "string"
142
+ },
143
+ {
144
+ name: "image",
145
+ type: "string"
146
+ },
147
+ {
148
+ name: "stack",
149
+ type: "string"
150
+ },
151
+ {
152
+ name: "agent_identifier",
153
+ type: "string"
154
+ },
155
+ {
156
+ name: "env_json",
157
+ type: "string"
158
+ },
159
+ {
160
+ name: "metadata_json",
161
+ type: "string"
162
+ },
163
+ {
164
+ name: "ssh_enabled",
165
+ type: "bool"
166
+ },
167
+ {
168
+ name: "ssh_public_key",
169
+ type: "string"
170
+ },
171
+ {
172
+ name: "web_terminal_enabled",
173
+ type: "bool"
174
+ },
175
+ {
176
+ name: "max_lifetime_seconds",
177
+ type: "uint64"
178
+ },
179
+ {
180
+ name: "idle_timeout_seconds",
181
+ type: "uint64"
182
+ },
183
+ {
184
+ name: "cpu_cores",
185
+ type: "uint64"
186
+ },
187
+ {
188
+ name: "memory_mb",
189
+ type: "uint64"
190
+ },
191
+ {
192
+ name: "disk_gb",
193
+ type: "uint64"
194
+ },
195
+ {
196
+ name: "tee_required",
197
+ type: "bool"
198
+ },
199
+ {
200
+ name: "tee_type",
201
+ type: "uint8"
202
+ },
203
+ {
204
+ name: "attestation_nonce",
205
+ type: "string"
206
+ },
207
+ {
208
+ name: "capabilities_json",
209
+ type: "string"
210
+ }
211
+ ]
212
+ }];
205
213
  const SandboxIdParamTypes = [{
206
- name: "sandbox_id",
207
- type: "string"
214
+ name: "request",
215
+ type: "tuple",
216
+ components: [{
217
+ name: "sandbox_id",
218
+ type: "string"
219
+ }]
208
220
  }];
209
221
  const SandboxCreateResponseParamTypes = [{
210
- name: "sandboxId",
211
- type: "string"
212
- }, {
213
- name: "json",
214
- type: "string"
222
+ name: "response",
223
+ type: "tuple",
224
+ components: [{
225
+ name: "sandboxId",
226
+ type: "string"
227
+ }, {
228
+ name: "json",
229
+ type: "string"
230
+ }]
215
231
  }];
216
232
  const JsonResponseParamTypes = [{
217
- name: "json",
218
- type: "string"
233
+ name: "response",
234
+ type: "tuple",
235
+ components: [{
236
+ name: "json",
237
+ type: "string"
238
+ }]
219
239
  }];
220
240
  const AgentSandboxBlueprintAbi = [
221
241
  {
@@ -447,31 +467,35 @@ var TangleChainClient = class {
447
467
  }
448
468
  encodeSandboxCreateInputs(options) {
449
469
  if ((options.sshPublicKeys?.length ?? 0) > 1) throw new Error("Tangle sandbox creation accepts one SSH public key; pass at most one sshPublicKeys entry");
470
+ const [teeRequired, teeType, attestationNonce] = teeCreateValues(options);
450
471
  return {
451
472
  types: SandboxCreateParamTypes,
452
- values: [
453
- options.name ?? "",
454
- options.environment ?? "",
455
- "",
456
- "",
457
- options.env ? JSON.stringify(options.env) : "",
458
- options.metadata ? JSON.stringify(options.metadata) : "",
459
- options.sshEnabled ?? false,
460
- options.sshPublicKeys?.[0] ?? "",
461
- options.webTerminalEnabled ?? false,
462
- BigInt(options.maxLifetimeSeconds ?? 0),
463
- BigInt(options.idleTimeoutSeconds ?? 0),
464
- BigInt(options.resources?.cpuCores ?? 0),
465
- BigInt(options.resources?.memoryMB ?? 0),
466
- BigInt(options.resources?.diskGB ?? 0),
467
- ...teeCreateValues(options)
468
- ]
473
+ values: [{
474
+ name: options.name ?? "",
475
+ image: options.environment ?? "",
476
+ stack: "",
477
+ agent_identifier: "",
478
+ env_json: options.env ? JSON.stringify(options.env) : "",
479
+ metadata_json: options.metadata ? JSON.stringify(options.metadata) : "",
480
+ ssh_enabled: options.sshEnabled ?? false,
481
+ ssh_public_key: options.sshPublicKeys?.[0] ?? "",
482
+ web_terminal_enabled: options.webTerminalEnabled ?? false,
483
+ max_lifetime_seconds: BigInt(options.maxLifetimeSeconds ?? 0),
484
+ idle_timeout_seconds: BigInt(options.idleTimeoutSeconds ?? 0),
485
+ cpu_cores: BigInt(options.resources?.cpuCores ?? 0),
486
+ memory_mb: BigInt(options.resources?.memoryMB ?? 0),
487
+ disk_gb: BigInt(options.resources?.diskGB ?? 0),
488
+ tee_required: teeRequired,
489
+ tee_type: teeType,
490
+ attestation_nonce: attestationNonce,
491
+ capabilities_json: options.capabilities?.length ? JSON.stringify(options.capabilities) : ""
492
+ }]
469
493
  };
470
494
  }
471
495
  encodeSandboxIdInputs(sandboxId) {
472
496
  return {
473
497
  types: SandboxIdParamTypes,
474
- values: [sandboxId]
498
+ values: [{ sandbox_id: sandboxId }]
475
499
  };
476
500
  }
477
501
  async submitJobAndWait(jobIndex, encoded) {
@@ -570,6 +594,91 @@ var TangleChainClient = class {
570
594
  if (jobIndex === 0) return SandboxCreateResponseParamTypes;
571
595
  return JsonResponseParamTypes;
572
596
  }
597
+ /**
598
+ * Sign a message with the job submitter's key (EIP-191 personal_sign).
599
+ *
600
+ * This is the credential for the operator API's session flow: the operator
601
+ * recovers the signer address and binds it to sandbox ownership, so only
602
+ * the key that submitted the create job can mint a session that manages
603
+ * that sandbox's secrets.
604
+ */
605
+ async signMessage(message) {
606
+ await this.ensureInitialized();
607
+ const account = this.account;
608
+ if (!account) throw new Error("TangleChainClient has no account to sign with; privateKey or wallet is required");
609
+ if (this.config.privateKey) {
610
+ if (typeof account.signMessage !== "function") throw new Error("Configured account cannot sign messages; an EIP-191 signer is required for operator sessions");
611
+ return account.signMessage({ message });
612
+ }
613
+ const walletClient = this.walletClient;
614
+ if (!walletClient) throw new Error("TangleChainClient has no wallet client; privateKey or wallet is required");
615
+ return walletClient.signMessage({
616
+ account,
617
+ message
618
+ });
619
+ }
620
+ };
621
+ //#endregion
622
+ //#region src/tangle/operator-auth.ts
623
+ const SESSION_REFRESH_MARGIN_MS = 6e4;
624
+ var OperatorSessionError = class extends Error {
625
+ constructor(message, status) {
626
+ super(message);
627
+ this.status = status;
628
+ this.name = "OperatorSessionError";
629
+ }
630
+ };
631
+ /**
632
+ * A bearer session with the blueprint operator API, minted by proving control
633
+ * of the job submitter's key. Establish lazily and reuse until near expiry;
634
+ * the caller retries with a fresh session on 401.
635
+ */
636
+ var OperatorSession = class OperatorSession {
637
+ constructor(token, address, expiresAtMs) {
638
+ this.token = token;
639
+ this.address = address;
640
+ this.expiresAtMs = expiresAtMs;
641
+ }
642
+ get signerAddress() {
643
+ return this.address;
644
+ }
645
+ /** True when the token is within the refresh margin of expiry. */
646
+ needsRefresh(nowMs = Date.now()) {
647
+ return nowMs >= this.expiresAtMs - SESSION_REFRESH_MARGIN_MS;
648
+ }
649
+ authorizationHeader() {
650
+ return `Bearer ${this.token}`;
651
+ }
652
+ /**
653
+ * Run the challenge-response flow against an operator API base URL.
654
+ *
655
+ * `signMessage` must implement EIP-191 personal_sign with the SAME key that
656
+ * submitted the sandbox create job — the operator binds ownership to the
657
+ * recovered address, so any other key yields a session that owns nothing.
658
+ */
659
+ static async establish(baseUrl, signMessage, fetchImpl = fetch) {
660
+ const root = baseUrl.replace(/\/+$/, "");
661
+ const challengeResponse = await fetchImpl(`${root}/api/auth/challenge`, { method: "POST" });
662
+ if (!challengeResponse.ok) throw new OperatorSessionError(`Operator challenge failed (HTTP ${challengeResponse.status})`, challengeResponse.status);
663
+ const challenge = await challengeResponse.json();
664
+ if (!challenge?.nonce || !challenge?.message) throw new OperatorSessionError("Operator challenge response is missing nonce/message");
665
+ const signature = await signMessage(challenge.message);
666
+ const sessionResponse = await fetchImpl(`${root}/api/auth/session`, {
667
+ method: "POST",
668
+ headers: { "Content-Type": "application/json" },
669
+ body: JSON.stringify({
670
+ nonce: challenge.nonce,
671
+ signature
672
+ })
673
+ });
674
+ if (!sessionResponse.ok) {
675
+ const body = await sessionResponse.text().catch(() => "");
676
+ throw new OperatorSessionError(`Operator session rejected (HTTP ${sessionResponse.status}): ${body.slice(0, 200)}`, sessionResponse.status);
677
+ }
678
+ const session = await sessionResponse.json();
679
+ if (!session?.token) throw new OperatorSessionError("Operator session response is missing a token");
680
+ return new OperatorSession(session.token, session.address, session.expires_at * 1e3);
681
+ }
573
682
  };
574
683
  //#endregion
575
684
  //#region src/tangle/client.ts
@@ -587,6 +696,20 @@ function randomHexToken(bytes) {
587
696
  globalThis.crypto.getRandomValues(buf);
588
697
  return Array.from(buf).map((b) => b.toString(16).padStart(2, "0")).join("");
589
698
  }
699
+ /** Key names that look like credentials. Heuristic, deliberately loud-but-not-blocking. */
700
+ const SECRET_SHAPED_KEY = /(?:secret|token|password|passwd|api[_-]?key|private[_-]?key|credential)/i;
701
+ /**
702
+ * `env` on the Tangle driver is ABI-encoded into the job calldata and is
703
+ * public on-chain forever. Warn (not block) when a key looks like a
704
+ * credential so the common mistake surfaces at the call site instead of on
705
+ * a block explorer.
706
+ */
707
+ function warnSecretShapedEnvKeys(env) {
708
+ if (!env) return;
709
+ const offenders = Object.keys(env).filter((key) => SECRET_SHAPED_KEY.test(key));
710
+ if (offenders.length === 0) return;
711
+ console.warn(`[tangle-sandbox] These env keys are published on-chain in the job calldata and are permanently public: ${offenders.join(", ")}. Pass confidential values via create({ tangleSecrets }) instead (requires operatorApiUrl; delivered over TLS via the operator's 2-phase secret endpoint).`);
712
+ }
590
713
  function attestationNonceFromOptions(options) {
591
714
  const direct = options.confidential?.attestationNonce;
592
715
  if (direct) return direct;
@@ -622,7 +745,10 @@ function requirePathGroup(match, index) {
622
745
  if (value === void 0) throw new Error(`Path matcher missing group ${index}`);
623
746
  return value;
624
747
  }
625
- function asRecord(value) {
748
+ /** Narrow one field of already-parsed JSON to a record without widening
749
+ * the boundary to `unknown`. */
750
+ function recordField(raw, key) {
751
+ const value = raw[key];
626
752
  return value && typeof value === "object" ? value : void 0;
627
753
  }
628
754
  function readString(record, keys) {
@@ -678,8 +804,8 @@ function sandboxInfoFromEntry(entry) {
678
804
  };
679
805
  }
680
806
  function sandboxEntryFromWire(fallbackId, raw) {
681
- const connection = asRecord(raw.connection);
682
- const metadata = asRecord(raw.metadata);
807
+ const connection = recordField(raw, "connection");
808
+ const metadata = recordField(raw, "metadata");
683
809
  const id = readString(raw, [
684
810
  "id",
685
811
  "sandboxId",
@@ -691,7 +817,10 @@ function sandboxEntryFromWire(fallbackId, raw) {
691
817
  "runtimeToken",
692
818
  "token"
693
819
  ]) ?? "";
694
- const tupleField = (key) => Object.hasOwn(raw, key) ? raw[key] : void 0;
820
+ const tupleField = (key) => {
821
+ const value = raw[key];
822
+ return typeof value === "string" ? value : value;
823
+ };
695
824
  const tupleId = tupleField("filesystemIncarnationId") === void 0 ? void 0 : typeof tupleField("filesystemIncarnationId") === "string" ? tupleField("filesystemIncarnationId") : "";
696
825
  const tupleProvenance = tupleField("filesystemIncarnationProvenance") === void 0 ? void 0 : tupleField("filesystemIncarnationProvenance");
697
826
  const tupleReadiness = tupleField("filesystemIncarnationReadiness") === void 0 ? void 0 : tupleField("filesystemIncarnationReadiness");
@@ -719,6 +848,7 @@ var TangleSandboxClient = class {
719
848
  sandboxes = /* @__PURE__ */ new Map();
720
849
  operatorApiUrl;
721
850
  operatorApiToken;
851
+ operatorSession = null;
722
852
  constructor(config) {
723
853
  if (!config.privateKey && !config.wallet) throw new Error("TangleSandboxClient requires either privateKey or wallet");
724
854
  this.chain = new TangleChainClient(config);
@@ -727,9 +857,20 @@ var TangleSandboxClient = class {
727
857
  }
728
858
  /**
729
859
  * Create a sandbox via on-chain job submission.
860
+ *
861
+ * Secrets never ride the chain: `options.tangleSecrets` is delivered to the
862
+ * operator's 2-phase provisioning endpoint over an EIP-191-authenticated
863
+ * session after the job completes (requires `operatorApiUrl`). Everything
864
+ * in `options.env` IS published on-chain in the job calldata — secret-shaped
865
+ * keys there trigger a warning pointing at `tangleSecrets`.
730
866
  */
731
867
  async create(options) {
732
868
  if (options?.billingOwnerId !== void 0) throw new Error("billingOwnerId is supported only by the HTTP Sandbox API client");
869
+ warnSecretShapedEnvKeys(options?.env);
870
+ const tangleSecrets = options?.tangleSecrets;
871
+ if (tangleSecrets && Object.keys(tangleSecrets).length > 0) {
872
+ if (!this.operatorApiUrl) throw new Error("tangleSecrets requires operatorApiUrl: secrets are delivered via the operator's 2-phase provisioning endpoint, never via on-chain calldata. Configure operatorApiUrl, or pass the values as plain env only if they are NOT confidential (env_json is public on-chain forever).");
873
+ }
733
874
  const createOptions = withAttestationNonce(options ?? {});
734
875
  const encoded = this.chain.encodeSandboxCreateInputs(createOptions);
735
876
  const { result: _result, callId, blockNumber } = await this.chain.submitJobAndWait(0, encoded);
@@ -737,10 +878,11 @@ var TangleSandboxClient = class {
737
878
  let sandboxId;
738
879
  let responseJson = {};
739
880
  if (resultBytes) try {
740
- const decoded = (await import("viem")).decodeAbiParameters(this.chain.getResponseParamTypes(0), resultBytes);
741
- sandboxId = decoded[0];
881
+ const [decoded] = (await import("viem")).decodeAbiParameters(this.chain.getResponseParamTypes(0), resultBytes);
882
+ const decodedEntry = decoded;
883
+ sandboxId = decodedEntry.sandboxId;
742
884
  try {
743
- responseJson = JSON.parse(decoded[1]);
885
+ responseJson = JSON.parse(decodedEntry.json);
744
886
  } catch {}
745
887
  } catch {
746
888
  throw new Error("Failed to decode create job result");
@@ -763,6 +905,7 @@ var TangleSandboxClient = class {
763
905
  attestationNonce: attestationNonceFromOptions(createOptions) ?? wireEntry.attestationNonce
764
906
  };
765
907
  this.sandboxes.set(sandboxId, entry);
908
+ if (tangleSecrets && Object.keys(tangleSecrets).length > 0) await this.injectSecrets(sandboxId, tangleSecrets);
766
909
  return createSandboxInstanceFromResponse(this, sandboxInfoFromEntry(entry));
767
910
  }
768
911
  /**
@@ -917,6 +1060,74 @@ var TangleSandboxClient = class {
917
1060
  async getServiceStats() {
918
1061
  return this.chain.getServiceStats();
919
1062
  }
1063
+ /**
1064
+ * Mint or reuse the EIP-191 session for the operator API.
1065
+ *
1066
+ * The session is signed by the SAME key that submits jobs (`chain.signMessage`),
1067
+ * so the operator binds it to every sandbox this client created.
1068
+ */
1069
+ async getOperatorSession(force = false) {
1070
+ if (!this.operatorApiUrl) throw new Error("Operator API URL is not configured");
1071
+ if (!force && this.operatorSession && !this.operatorSession.needsRefresh()) return this.operatorSession;
1072
+ const session = await OperatorSession.establish(this.operatorApiUrl, (message) => this.chain.signMessage(message));
1073
+ this.operatorSession = session;
1074
+ return session;
1075
+ }
1076
+ /**
1077
+ * Deliver secrets to a sandbox via the operator's 2-phase provisioning
1078
+ * endpoint (`POST /api/sandboxes/:id/secrets`).
1079
+ *
1080
+ * Unlike `env`, these values never appear on-chain: they ride TLS to the
1081
+ * operator, which validates the session's recovered address against the
1082
+ * sandbox's on-chain creator before injecting.
1083
+ */
1084
+ async injectSecrets(sandboxId, secrets) {
1085
+ await this.withOperatorSession(sandboxId, async (session, url) => {
1086
+ return await fetch(`${url}/api/sandboxes/${encodeURIComponent(sandboxId)}/secrets`, {
1087
+ method: "POST",
1088
+ headers: {
1089
+ Authorization: session.authorizationHeader(),
1090
+ "Content-Type": "application/json"
1091
+ },
1092
+ body: JSON.stringify({ env_json: secrets })
1093
+ });
1094
+ }, "inject secrets into");
1095
+ }
1096
+ /** Read a sandbox's provisioned secret keys and credential availability. */
1097
+ async getSecrets(sandboxId) {
1098
+ return this.withOperatorSession(sandboxId, async (session, url) => {
1099
+ return await fetch(`${url}/api/sandboxes/${encodeURIComponent(sandboxId)}/secrets`, {
1100
+ method: "GET",
1101
+ headers: { Authorization: session.authorizationHeader() }
1102
+ });
1103
+ }, "read secrets for").then(async (response) => {
1104
+ const body = await response.json();
1105
+ return {
1106
+ sandboxId: body.sandbox_id ?? sandboxId,
1107
+ envJson: body.env_json ?? {},
1108
+ credentialsAvailable: Boolean(body.credentials_available)
1109
+ };
1110
+ });
1111
+ }
1112
+ /**
1113
+ * Run an operator-API request with a session, retrying once with a fresh
1114
+ * session on 401 (expired PASETO). Any other failure names the sandbox so
1115
+ * the caller can retry without losing the ID.
1116
+ */
1117
+ async withOperatorSession(sandboxId, request, action) {
1118
+ if (!this.operatorApiUrl) throw new Error(`Cannot ${action} sandbox ${sandboxId}: operatorApiUrl is not configured`);
1119
+ let session = await this.getOperatorSession();
1120
+ let response = await request(session, this.operatorApiUrl);
1121
+ if (response.status === 401) {
1122
+ session = await this.getOperatorSession(true);
1123
+ response = await request(session, this.operatorApiUrl);
1124
+ }
1125
+ if (!response.ok) {
1126
+ const body = await response.text().catch(() => "");
1127
+ throw new OperatorSessionError(`Failed to ${action} sandbox ${sandboxId} (HTTP ${response.status}): ${body.slice(0, 300)}`, response.status);
1128
+ }
1129
+ return response;
1130
+ }
920
1131
  async fetchOperatorApi(path, options) {
921
1132
  if (!this.operatorApiUrl) return new Response(JSON.stringify({ error: "Operator API URL is not configured" }), {
922
1133
  status: 501,
@@ -932,4 +1143,4 @@ var TangleSandboxClient = class {
932
1143
  }
933
1144
  };
934
1145
  //#endregion
935
- export { TANGLE_JOBS_CONTRACT as a, JsonResponseParamTypes as c, SandboxIdParamTypes as d, TANGLE_CHAIN_ID as i, SandboxCreateParamTypes as l, JOB_SANDBOX_CREATE as n, AgentSandboxBlueprintAbi as o, JOB_SANDBOX_DELETE as r, ITangleJobsAbi as s, TangleSandboxClient as t, SandboxCreateResponseParamTypes as u };
1146
+ export { JOB_SANDBOX_DELETE as a, AgentSandboxBlueprintAbi as c, SandboxCreateParamTypes as d, SandboxCreateResponseParamTypes as f, JOB_SANDBOX_CREATE as i, ITangleJobsAbi as l, OperatorSession as n, TANGLE_CHAIN_ID as o, SandboxIdParamTypes as p, OperatorSessionError as r, TANGLE_JOBS_CONTRACT as s, TangleSandboxClient as t, JsonResponseParamTypes as u };
@@ -1779,6 +1779,26 @@ interface CreateSandboxOptions {
1779
1779
  * ```
1780
1780
  */
1781
1781
  secrets?: string[] | "all";
1782
+ /**
1783
+ * Confidential environment variables for the **Tangle (on-chain) driver**,
1784
+ * delivered OFF-chain via the operator's 2-phase secret provisioning
1785
+ * endpoint after the create job completes. Requires the client to be
1786
+ * configured with `operatorApiUrl`.
1787
+ *
1788
+ * Unlike {@link CreateSandboxOptions.env}, these values never appear in the
1789
+ * job calldata: the client mints an EIP-191-authenticated operator session
1790
+ * signed by the same key that submitted the job, and the operator injects
1791
+ * the secrets only after verifying that key owns the sandbox.
1792
+ *
1793
+ * @example
1794
+ * ```typescript
1795
+ * const box = await client.create({
1796
+ * environment: "universal",
1797
+ * tangleSecrets: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY },
1798
+ * });
1799
+ * ```
1800
+ */
1801
+ tangleSecrets?: Record<string, string>;
1782
1802
  /** Custom metadata to store with the sandbox */
1783
1803
  metadata?: Record<string, unknown>;
1784
1804
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.60.1-develop.20261001222100.ea1ca0e935",
3
+ "version": "0.60.2",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -148,9 +148,9 @@
148
148
  "vitest": "^4.1.5",
149
149
  "ws": "^8.20.0",
150
150
  "yjs": "13.6.30",
151
+ "@products/sandbox-test-utils": "0.0.0",
151
152
  "@repo/shared": "0.0.0",
152
153
  "@tangle-network/agent-profile-materialize": "0.20.5",
153
- "@products/sandbox-test-utils": "0.0.0",
154
154
  "@tangle-network/cli-agent-registry": "0.4.17",
155
155
  "@tangle-network/runtime-contracts": "0.11.0",
156
156
  "@tangle-network/sse-core": "0.0.0"