@tangle-network/sandbox 0.31.1-develop.20260825041952.26b46ca → 0.32.0-develop.20260825062920.7dde010

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 { f as assertCurrentBackendType } from "../runtime-api-CNiH33Hk.js";
1
+ import { f as assertCurrentBackendType } from "../runtime-api-paApH4-W.js";
2
2
  import { d as StateError, o as NotFoundError, p as ValidationError } from "../errors-C6kn-3zt.js";
3
- import { n as Sandbox } from "../client-BH4S40HS.js";
4
- import { t as SandboxInstance } from "../sandbox-Bh2dZMzP.js";
3
+ import { n as Sandbox } from "../client-BRegsZuj.js";
4
+ import { t as SandboxInstance } from "../sandbox-CyP8CXaF.js";
5
5
  import { createRequire } from "node:module";
6
6
  //#region src/agent/instances.ts
7
7
  const managers = /* @__PURE__ */ new WeakMap();
@@ -1,7 +1,7 @@
1
- import { _ as backendTypeSchema, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, l as encodeTextForWire, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, u as parseSSEStream } from "./runtime-api-CNiH33Hk.js";
1
+ import { _ as backendTypeSchema, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, l as encodeTextForWire, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, u as parseSSEStream } from "./runtime-api-paApH4-W.js";
2
2
  import { a as NetworkError, f as TimeoutError, l as SandboxError, m as parseErrorResponse, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
3
3
  import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
4
- import { C as normalizeConnection, T as exportTraceBundle, _ as requestInteractiveSessionToken, i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt } from "./sandbox-Bh2dZMzP.js";
4
+ import { C as normalizeConnection, T as exportTraceBundle, _ as requestInteractiveSessionToken, i as normalizeStartupDiagnostics, n as createSandboxInstanceFromResponse, r as normalizeSandboxCreateReceipt } from "./sandbox-CyP8CXaF.js";
5
5
  import { agentProfileSchema } from "@tangle-network/agent-interface";
6
6
  import { z } from "zod";
7
7
  //#region src/backend-registry.ts
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
2
- import { _ as parseBackendRegistryResponseBody, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, m as backendRegistryResponseSchema, n as Sandbox, p as backendRegistryInteractionKindSchema } from "./client-BH4S40HS.js";
3
- import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-Bh2dZMzP.js";
2
+ import { _ as parseBackendRegistryResponseBody, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, m as backendRegistryResponseSchema, n as Sandbox, p as backendRegistryInteractionKindSchema } from "./client-BRegsZuj.js";
3
+ import { a as WorkspaceImages, t as SandboxInstance } from "./sandbox-CyP8CXaF.js";
4
4
  export { AuthError, CapabilityError, FileWriteConflictError, NetworkError, NotFoundError, PartialFailureError, QuotaError, Sandbox, SandboxError, SandboxInstance, ServerError, StateError, TimeoutError, ValidationError, WorkspaceImages, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, isBackendRegistryInteractionKind, parseBackendRegistryResponse, parseBackendRegistryResponseBody };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { _ as backendTypeSchema, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, p as normalizeRuntimeBackendConfig, u as parseSSEStream, v as parseBackendType } from "./runtime-api-CNiH33Hk.js";
1
+ import { _ as backendTypeSchema, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, p as normalizeRuntimeBackendConfig, u as parseSSEStream, v as parseBackendType } from "./runtime-api-paApH4-W.js";
2
2
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, r as EgressProxyRecoveryError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
3
- import { _ as parseBackendRegistryResponseBody, a as splitInlineProfileSkills, c as SandboxFleetClient, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, i as splitInlineProfileFileMounts, l as createBatchResultAccumulator, m as backendRegistryResponseSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryInteractionKindSchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as validateBatchRunRequest } from "./client-BH4S40HS.js";
3
+ import { _ as parseBackendRegistryResponseBody, a as splitInlineProfileSkills, c as SandboxFleetClient, d as backendRegistryCapabilitiesSchema, f as backendRegistryEntrySchema, g as parseBackendRegistryResponse, h as isBackendRegistryInteractionKind, i as splitInlineProfileFileMounts, l as createBatchResultAccumulator, m as backendRegistryResponseSchema, n as Sandbox, o as validateDeferredProfileFileMounts, p as backendRegistryInteractionKindSchema, r as materializeProfileFileMounts, s as SandboxFleet, t as IntelligenceClient, u as validateBatchRunRequest } from "./client-BRegsZuj.js";
4
4
  import { a as INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, c as createInteractiveControlHolderId, l as interactiveSessionIdentityDigest, n as browserInteractiveControlHolderId, o as InteractiveSessionControlController, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-wXQ7W5pT.js";
5
- import { D as toOtelJson, E as otelTraceIdForTangleTrace, S as isToolBearingEvent, T as exportTraceBundle, a as WorkspaceImages, b as collectAgentResponseText, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as BrowserInteractiveSessionController, g as TERMINAL_WS_ECHO_SUBPROTOCOL, h as TerminalStreamError, l as SandboxSession, m as TerminalStream, o as GPU_LEASE_PROVIDER_NAMES, p as InteractiveSessionController, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as applySandboxEventText, w as buildTraceExportPayload, x as getSandboxEventText, y as collectAgentFinalMessageText } from "./sandbox-Bh2dZMzP.js";
5
+ import { D as toOtelJson, E as otelTraceIdForTangleTrace, S as isToolBearingEvent, T as exportTraceBundle, a as WorkspaceImages, b as collectAgentResponseText, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as BrowserInteractiveSessionController, g as TERMINAL_WS_ECHO_SUBPROTOCOL, h as TerminalStreamError, l as SandboxSession, m as TerminalStream, o as GPU_LEASE_PROVIDER_NAMES, p as InteractiveSessionController, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as applySandboxEventText, w as buildTraceExportPayload, x as getSandboxEventText, y as collectAgentFinalMessageText } from "./sandbox-CyP8CXaF.js";
6
6
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-DQD9kCdN.js";
7
- import { t as TangleSandboxClient } from "./tangle-b1Ma7y8m.js";
7
+ import { t as TangleSandboxClient } from "./tangle-DcZBrAGY.js";
8
8
  import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
9
9
  import { z } from "zod";
10
10
  //#region src/confidential.ts
@@ -1050,7 +1050,12 @@ var SandboxRuntimeApi = class {
1050
1050
  * (`SandboxInstance.mintScopedToken`) and a parent agent observes a child
1051
1051
  * sandbox's stream while holding no credential that can mutate the child.
1052
1052
  * With `executionId` set, the stream ends at that turn's terminal
1053
- * `done`/`error` event; otherwise it follows the session until aborted.
1053
+ * `done`/`error` event; a stream that dies before the terminal throws
1054
+ * instead of reading like a finished turn. Aborting `options.signal` ends
1055
+ * the generator cleanly, matching every other SDK stream. Events carry no
1056
+ * `data.sandboxId` stamp here: a scoped-token client knows only its own
1057
+ * runtime URL, and the subscriber already knows which sandbox it minted
1058
+ * the token for.
1054
1059
  */
1055
1060
  async *events(sessionId, options = {}) {
1056
1061
  await this.transport.ensureRunning();
@@ -1060,17 +1065,27 @@ var SandboxRuntimeApi = class {
1060
1065
  if (options.executionId) search.set("executionId", options.executionId);
1061
1066
  const response = await this.request(`/agents/events?${search.toString()}`, { signal: options.signal });
1062
1067
  if (!response.body) throw new NetworkError("event stream has no response body");
1063
- for await (const event of parseSSEStream(response.body, {
1064
- signal: options.signal,
1065
- invalidEvent: "warn-and-skip"
1066
- })) {
1067
- yield {
1068
- type: event.type,
1069
- data: event.data,
1070
- ...event.id !== void 0 ? { id: event.id } : {}
1071
- };
1072
- if (options.executionId !== void 0 && (event.type === "done" || event.type === "error")) return;
1068
+ let sawTerminal = false;
1069
+ try {
1070
+ for await (const event of parseSSEStream(response.body, {
1071
+ signal: options.signal,
1072
+ invalidEvent: "warn-and-skip"
1073
+ })) {
1074
+ yield {
1075
+ type: event.type,
1076
+ data: event.data,
1077
+ ...event.id !== void 0 ? { id: event.id } : {}
1078
+ };
1079
+ if (options.executionId !== void 0 && (event.type === "done" || event.type === "error")) {
1080
+ sawTerminal = true;
1081
+ return;
1082
+ }
1083
+ }
1084
+ } catch (err) {
1085
+ if (err instanceof DOMException && err.name === "AbortError") return;
1086
+ throw err;
1073
1087
  }
1088
+ if (options.executionId !== void 0 && !sawTerminal) throw new NetworkError("event stream ended before a terminal event — the connection dropped mid-turn");
1074
1089
  }
1075
1090
  async readFiles(paths, options = {}) {
1076
1091
  const params = new URLSearchParams();
package/dist/runtime.d.ts CHANGED
@@ -47,7 +47,12 @@ declare class SandboxRuntimeApi {
47
47
  * (`SandboxInstance.mintScopedToken`) and a parent agent observes a child
48
48
  * sandbox's stream while holding no credential that can mutate the child.
49
49
  * With `executionId` set, the stream ends at that turn's terminal
50
- * `done`/`error` event; otherwise it follows the session until aborted.
50
+ * `done`/`error` event; a stream that dies before the terminal throws
51
+ * instead of reading like a finished turn. Aborting `options.signal` ends
52
+ * the generator cleanly, matching every other SDK stream. Events carry no
53
+ * `data.sandboxId` stamp here: a scoped-token client knows only its own
54
+ * runtime URL, and the subscriber already knows which sandbox it minted
55
+ * the token for.
51
56
  */
52
57
  events(sessionId: string, options?: SessionEventStreamOptions): AsyncGenerator<SandboxEvent>;
53
58
  readFiles(paths: string[], options?: FileReadBatchOptions): Promise<FileReadBatchResult>;
@@ -115,4 +120,4 @@ declare class SandboxRuntimeClient extends SandboxRuntimeApi {
115
120
  }
116
121
  declare function createSandboxRuntimeClient(config: SandboxRuntimeClientConfig): SandboxRuntimeClient;
117
122
  //#endregion
118
- export { type AgentRunOutcome, type AgentRunOutcomeTracker, AuthError, CapabilityError, type ChunkedUploadOptions, type ChunkedUploadResult, type ChunkedUploadTransport, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, FileWriteConflictError, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionMessage, StateError, TimeoutError, type UploadProgress, ValidationError, type WriteFileOptions, createAgentRunOutcomeTracker, createSandboxRuntimeClient, deriveAgentResultOutcome, deriveAgentRunOutcome, uploadChunked };
123
+ export { type AgentRunOutcome, type AgentRunOutcomeTracker, AuthError, CapabilityError, type ChunkedUploadOptions, type ChunkedUploadResult, type ChunkedUploadTransport, type FileReadBatchOptions, type FileReadBatchResult, type FileRenameResult, type FileTreeOptions, type FileTreeResult, FileWriteConflictError, type FileWriteResult, type ListMessagesOptions, NetworkError, NotFoundError, PartialFailureError, QuotaError, type RenameOptions, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxRuntimeClient, type SandboxRuntimeClientConfig, type SandboxRuntimeHealth, type SandboxTerminalCreateOptions, type SandboxTerminalInfo, type SandboxTerminalManager, type SandboxTerminalRequestOptions, ServerError, type SessionEventStreamOptions, type SessionMessage, StateError, TimeoutError, type UploadProgress, ValidationError, type WriteFileOptions, createAgentRunOutcomeTracker, createSandboxRuntimeClient, deriveAgentResultOutcome, deriveAgentRunOutcome, uploadChunked };
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as uploadChunked, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, t as SandboxRuntimeApi } from "./runtime-api-CNiH33Hk.js";
1
+ import { a as uploadChunked, g as deriveAgentRunOutcome, h as deriveAgentResultOutcome, m as createAgentRunOutcomeTracker, t as SandboxRuntimeApi } from "./runtime-api-paApH4-W.js";
2
2
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, i as FileWriteConflictError, l as SandboxError, n as CapabilityError, o as NotFoundError, p as ValidationError, s as PartialFailureError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
3
3
  import { n as combineAbortSignals } from "./abort-signal-si1WMfJb.js";
4
4
  //#region src/runtime-client.ts
@@ -1,4 +1,4 @@
1
- import { a as uploadChunked, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, h as deriveAgentResultOutcome, i as sessionHeaders, m as createAgentRunOutcomeTracker, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi, u as parseSSEStream } from "./runtime-api-CNiH33Hk.js";
1
+ import { a as uploadChunked, c as encodePromptForWire, d as applyRequestedModel, f as assertCurrentBackendType, h as deriveAgentResultOutcome, i as sessionHeaders, m as createAgentRunOutcomeTracker, n as normalizeSessionInfo, o as SANDBOX_PROXY_REQUEST_MAX_BYTES, p as normalizeRuntimeBackendConfig, r as appendSessionIdQuery, t as SandboxRuntimeApi, u as parseSSEStream } from "./runtime-api-paApH4-W.js";
2
2
  import { a as NetworkError, c as QuotaError, d as StateError, f as TimeoutError, l as SandboxError, m as parseErrorResponse, n as CapabilityError, o as NotFoundError, p as ValidationError, t as AuthError, u as ServerError } from "./errors-C6kn-3zt.js";
3
3
  import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionStatusResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-wXQ7W5pT.js";
4
4
  import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-si1WMfJb.js";
@@ -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 TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-b1Ma7y8m.js";
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 TANGLE_MAINNET_RPC, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../tangle-DcZBrAGY.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TANGLE_MAINNET_RPC, TangleSandboxClient };
@@ -1,5 +1,5 @@
1
1
  import { m as parseErrorResponse } from "./errors-C6kn-3zt.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-Bh2dZMzP.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-CyP8CXaF.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.31.1-develop.20260825041952.26b46ca",
3
+ "version": "0.32.0-develop.20260825062920.7dde010",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [