@tangle-network/sandbox 0.57.0 → 0.58.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +3 -2
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +36 -74
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/agent/preview.js +2 -2
  6. package/dist/{agent-run-outcome-B8PjRMLE.d.ts → agent-run-outcome-CJP18Ip8.d.ts} +1 -1
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.js +1 -1
  9. package/dist/{browser-interactive-control-controller-knjCl8Zp.d.ts → browser-interactive-control-controller-1m7jgLeg.d.ts} +1 -1
  10. package/dist/{client-CdbHGWiu.js → client-BHItHEg0.js} +19 -5
  11. package/dist/{client-BHGieo06.d.ts → client-BI0_ZUUS.d.ts} +6 -4
  12. package/dist/collaboration/index.d.ts +1 -1
  13. package/dist/core.d.ts +6 -5
  14. package/dist/core.js +5 -3
  15. package/dist/{index-C1sVorE5.d.ts → index-BitiSmBp.d.ts} +2 -2
  16. package/dist/index.d.ts +12 -11
  17. package/dist/index.js +6 -4
  18. package/dist/interactive-control.d.ts +1 -1
  19. package/dist/line-application-DOg7jrnA.js +100 -0
  20. package/dist/lines-DLIo-NTB.d.ts +556 -0
  21. package/dist/lines.d.ts +2 -0
  22. package/dist/lines.js +273 -0
  23. package/dist/{local-cli-auth-DfuFJCcs.js → local-cli-auth-N1IYywxf.js} +1 -1
  24. package/dist/{mcp-local-DUT2U_y8.js → mcp-local-BWsftreI.js} +27 -16
  25. package/dist/{preview-wJJxG42-.d.ts → preview-CVrjEPgk.d.ts} +3 -3
  26. package/dist/runtime.d.ts +3 -3
  27. package/dist/{sandbox-C9VLoJAb.js → sandbox-B2kuUBn6.js} +84 -228
  28. package/dist/{sandbox-DWDqWnsJ.d.ts → sandbox-DyPRgt1M.d.ts} +10 -411
  29. package/dist/tangle/index.d.ts +1 -1
  30. package/dist/tangle/index.js +1 -1
  31. package/dist/{tangle-Bm6H-xIM.js → tangle-DCjIsZI0.js} +1 -1
  32. package/dist/{types-CFmeauzy.d.ts → types-_Gn4d93t.d.ts} +72 -2
  33. package/package.json +9 -4
  34. /package/dist/{cli-auth-bundle-bRJOyaJO.js → cli-auth-bundle-0VjPAtKt.js} +0 -0
  35. /package/dist/{errors-CNsmhCen.d.ts → errors-AVpynVrG.d.ts} +0 -0
  36. /package/dist/{index-BN7zNEUB.d.ts → index-C48z7K4r.d.ts} +0 -0
  37. /package/dist/{index-X4EEZlMi.d.ts → index-D4u-vv87.d.ts} +0 -0
  38. /package/dist/{preview-operations-Dgbi46FH.js → preview-operations-BhQ4_CF7.js} +0 -0
  39. /package/dist/{terminal-stream-BW4veIsI.d.ts → terminal-stream-Bf2stNDX.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { C as normalizeRuntimeBackendConfig, D as ALL_BACKEND_TYPES, E as deriveAgentRunOutcome, O as backendTypeSchema, T as deriveAgentResultOutcome, k as parseBackendType, w as createAgentRunOutcomeTracker, y as parseSSEStream } from "./runtime-api-BZg34WGd.js";
2
2
  import { a as FileWriteConflictError, c as NotFoundError, d as ResumeEnvRequiredError, f as SandboxError, g as ValidationError, h as TimeoutError, i as EgressProxyRecoveryError, l as PartialFailureError, m as StateError, n as CapabilityError, o as KeyBudgetExhaustedError, p as ServerError, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-BkhlSDW-.js";
3
- import { _ as backendRegistryInteractionKindSchema, a as splitInlineProfileSkills, b as parseBackendRegistryResponse, c as InstanceRestartingError, d as SandboxFleetClient, f as runtimeWorkspaceCwdSchema, g as backendRegistryEntrySchema, h as backendRegistryCapabilitiesSchema, i as splitInlineProfileFileMounts, l as InstancesClient, m as validateBatchRunRequest, n as Sandbox, o as validateDeferredProfileFileMounts, p as createBatchResultAccumulator, r as materializeProfileFileMounts, s as HostedInstance, t as IntelligenceClient, u as SandboxFleet, v as backendRegistryResponseSchema, x as parseBackendRegistryResponseBody, y as isBackendRegistryInteractionKind } from "./client-CdbHGWiu.js";
3
+ import { _ as backendRegistryInteractionKindSchema, a as splitInlineProfileSkills, b as parseBackendRegistryResponse, c as InstanceRestartingError, d as SandboxFleetClient, f as runtimeWorkspaceCwdSchema, g as backendRegistryEntrySchema, h as backendRegistryCapabilitiesSchema, i as splitInlineProfileFileMounts, l as InstancesClient, m as validateBatchRunRequest, n as Sandbox, o as validateDeferredProfileFileMounts, p as createBatchResultAccumulator, r as materializeProfileFileMounts, s as HostedInstance, t as IntelligenceClient, u as SandboxFleet, v as backendRegistryResponseSchema, x as parseBackendRegistryResponseBody, y as isBackendRegistryInteractionKind } from "./client-BHItHEg0.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-CVGqjPgs.js";
5
- import { A as lineInstanceKey, C as collectAgentResponseText, F as toOtelJson, M as buildTraceExportPayload, N as exportTraceBundle, O as LinesClient, P as otelTraceIdForTangleTrace, S as collectAgentFinalMessageText, T as isToolBearingEvent, _ as TerminalStream, a as WorkspaceImages, c as SandboxTaskSession, d as agentInteractiveSessionPromptRequestDigest, f as InteractiveTerminalFrameLog, g as InteractiveSessionController, h as BrowserInteractiveSessionController, k as SandboxLines, l as SandboxSession, m as createInteractiveTerminalSession, o as GPU_LEASE_PROVIDER_NAMES, p as createInteractiveTerminalCapture, s as MAX_EGRESS_DENIALS_LIMIT, t as SandboxInstance, u as InteractiveSessionHandle, v as TerminalStreamError, w as getSandboxEventText, x as applySandboxEventText, y as TERMINAL_WS_ECHO_SUBPROTOCOL } from "./sandbox-C9VLoJAb.js";
5
+ import { C as collectAgentFinalMessageText, D as ManagedProcessClient, E as isToolBearingEvent, M as exportTraceBundle, N as otelTraceIdForTangleTrace, P as toOtelJson, S as applySandboxEventText, T as getSandboxEventText, _ as InteractiveSessionController, b as TERMINAL_WS_ECHO_SUBPROTOCOL, c as MAX_EGRESS_DENIALS_LIMIT, d as InteractiveSessionHandle, f as agentInteractiveSessionPromptRequestDigest, g as BrowserInteractiveSessionController, h as createInteractiveTerminalSession, j as buildTraceExportPayload, l as SandboxTaskSession, m as createInteractiveTerminalCapture, o as WorkspaceImages, p as InteractiveTerminalFrameLog, s as GPU_LEASE_PROVIDER_NAMES, t as SandboxInstance, u as SandboxSession, v as TerminalStream, w as collectAgentResponseText, y as TerminalStreamError } from "./sandbox-B2kuUBn6.js";
6
+ import { LinesClient, SandboxLines, lineInstanceKey, profileChannelReference } from "./lines.js";
6
7
  import { a as CollaborationClient, i as parseCollaborationDocumentId, n as buildCollaborationDocumentId, r as normalizeCollaborationPath, t as CollaborationFileBridge } from "./collaboration-CSHswAOI.js";
7
- import { t as TangleSandboxClient } from "./tangle-Bm6H-xIM.js";
8
+ import { i as parseLineApplicationResult, n as LINE_APPLICATION_REQUEST_MAX_BYTES, r as parseLineApplicationRequest, t as LINE_APPLICATION_REPLY_MAX_CHARS } from "./line-application-DOg7jrnA.js";
9
+ import { t as TangleSandboxClient } from "./tangle-DCjIsZI0.js";
8
10
  import { SANDBOX_SIZE_PRESET_NAMES, agentProfileConfidentialSchema, agentProfileSchema } from "@tangle-network/agent-interface";
9
11
  import { z } from "zod";
10
12
  //#region src/confidential.ts
@@ -1478,4 +1480,4 @@ function stripUndefined(value) {
1478
1480
  return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0).map(([k, v]) => [k, stripUndefined(v)]));
1479
1481
  }
1480
1482
  //#endregion
1481
- export { ALL_BACKEND_TYPES, AuthError, BrowserInteractiveSessionControlController, BrowserInteractiveSessionController, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, CollaborationClient, CollaborationFileBridge, DEFAULT_SANDBOX_SIZE, EdgeNotReadyError, EgressProxyRecoveryError, FileWriteConflictError, GPU_LEASE_PROVIDER_NAMES, HostedInstance, INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, Image, ImageBuilder, InstanceRestartingError, InstancesClient, IntelligenceClient, InteractiveSessionControlController, InteractiveSessionController, InteractiveSessionHandle, InteractiveTerminalFrameLog, KeyBudgetExhaustedError, LinesClient, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, MAX_EGRESS_DENIALS_LIMIT, NetworkError, NotFoundError, PartialFailureError, QuotaError, ResumeEnvRequiredError, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, Sandbox, SandboxError, SandboxFleet, SandboxFleetClient, SandboxInstance, SandboxLines, SandboxSession, SandboxTaskSession, ServerError, StateError, TERMINAL_WS_ECHO_SUBPROTOCOL, TangleSandboxClient, TerminalStream, TerminalStreamError, TimeoutError, ValidationError, WorkspaceImages, applySandboxEventText, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, browserInteractiveControlHolderId, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentFinalMessageText, collectAgentResponseText, createAgentRunOutcomeTracker, createBatchResultAccumulator, createConfidentialSandbox, createInteractiveControlHolderId, createInteractiveTerminalCapture, createInteractiveTerminalSession, createManageSandboxesTool, deriveAgentResultOutcome, deriveAgentRunOutcome, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, agentInteractiveSessionPromptRequestDigest as interactivePromptRequestDigest, interactiveSessionIdentityDigest, isBackendRegistryInteractionKind, isToolBearingEvent, lineInstanceKey, manageSandboxesInputSchema, materializeProfileFileMounts, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseBackendType, parseCollaborationDocumentId, parseSSEStream, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, splitInlineProfileFileMounts, splitInlineProfileSkills, startTeeAttestationHeartbeat, toOtelJson, validateBatchRunRequest, validateDeferredProfileFileMounts };
1483
+ export { ALL_BACKEND_TYPES, AuthError, BrowserInteractiveSessionControlController, BrowserInteractiveSessionController, CONTROL_PLANE_MCP_SERVER_NAME, CapabilityError, CollaborationClient, CollaborationFileBridge, DEFAULT_SANDBOX_SIZE, EdgeNotReadyError, EgressProxyRecoveryError, FileWriteConflictError, GPU_LEASE_PROVIDER_NAMES, HostedInstance, INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS, Image, ImageBuilder, InstanceRestartingError, InstancesClient, IntelligenceClient, InteractiveSessionControlController, InteractiveSessionController, InteractiveSessionHandle, InteractiveTerminalFrameLog, KeyBudgetExhaustedError, LINE_APPLICATION_REPLY_MAX_CHARS, LINE_APPLICATION_REQUEST_MAX_BYTES, LinesClient, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, MAX_EGRESS_DENIALS_LIMIT, ManagedProcessClient, NetworkError, NotFoundError, PartialFailureError, QuotaError, ResumeEnvRequiredError, SANDBOX_MCP_SERVER_NAME, SANDBOX_SIZE_PRESETS, SANDBOX_SIZE_PRESET_NAMES, Sandbox, SandboxError, SandboxFleet, SandboxFleetClient, SandboxInstance, SandboxLines, SandboxSession, SandboxTaskSession, ServerError, StateError, TERMINAL_WS_ECHO_SUBPROTOCOL, TangleSandboxClient, TerminalStream, TerminalStreamError, TimeoutError, ValidationError, WorkspaceImages, applySandboxEventText, backendRegistryCapabilitiesSchema, backendRegistryEntrySchema, backendRegistryInteractionKindSchema, backendRegistryResponseSchema, browserInteractiveControlHolderId, buildCollaborationDocumentId, buildControlPlaneMcpConfig, buildSandboxMcpConfig, buildTangleRouterEvalMatrixRequest, buildTangleRouterResponsesWebSearchRequest, buildTangleRouterSearchBackend, buildTangleRouterSearchProfile, buildTraceExportPayload, collectAgentFinalMessageText, collectAgentResponseText, createAgentRunOutcomeTracker, createBatchResultAccumulator, createConfidentialSandbox, createInteractiveControlHolderId, createInteractiveTerminalCapture, createInteractiveTerminalSession, createManageSandboxesTool, deriveAgentResultOutcome, deriveAgentRunOutcome, exportTraceBundle, fetchTangleRouterSearchConfig, generateAttestationNonce, generateDockerfile, getSandboxEventText, agentInteractiveSessionPromptRequestDigest as interactivePromptRequestDigest, interactiveSessionIdentityDigest, isBackendRegistryInteractionKind, isToolBearingEvent, lineInstanceKey, manageSandboxesInputSchema, materializeProfileFileMounts, normalizeCollaborationPath, normalizeRuntimeBackendConfig, otelTraceIdForTangleTrace, parseBackendRegistryResponse, parseBackendRegistryResponseBody, parseBackendType, parseCollaborationDocumentId, parseLineApplicationRequest, parseLineApplicationResult, parseSSEStream, profileChannelReference, resolveSandboxResources, runTangleRouterEvalMatrixInSandbox, sandboxResourcesForSize, splitInlineProfileFileMounts, splitInlineProfileSkills, startTeeAttestationHeartbeat, toOtelJson, validateBatchRunRequest, validateDeferredProfileFileMounts };
@@ -1,2 +1,2 @@
1
- import { c as InteractiveSessionIdentity, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-knjCl8Zp.js";
1
+ import { c as InteractiveSessionIdentity, n as BrowserInteractiveSessionControlControllerOptions, r as browserInteractiveControlHolderId, t as BrowserInteractiveSessionControlController } from "./browser-interactive-control-controller-1m7jgLeg.js";
2
2
  export { BrowserInteractiveSessionControlController, type BrowserInteractiveSessionControlControllerOptions, type InteractiveSessionIdentity, browserInteractiveControlHolderId };
@@ -0,0 +1,100 @@
1
+ //#region src/line-application.ts
2
+ /** Bounded callback request bytes after canonicalization, including JSON framing. */
3
+ const LINE_APPLICATION_REQUEST_MAX_BYTES = 96 * 1024;
4
+ /** Fits the Lines reply splitter and the callback transport's 64 KiB read bound. */
5
+ const LINE_APPLICATION_REPLY_MAX_CHARS = 12e3;
6
+ function record(value) {
7
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw new TypeError("Expected a line application object");
8
+ return value;
9
+ }
10
+ function text(value, max) {
11
+ if (typeof value !== "string" || !value.trim() || value.includes("\0") || value.length > max) throw new TypeError("Invalid line application text");
12
+ return value;
13
+ }
14
+ function id(value) {
15
+ const result = text(value, 256);
16
+ if (!/^[A-Za-z0-9][A-Za-z0-9_.:@-]*$/.test(result)) throw new TypeError("Invalid line application identity");
17
+ return result;
18
+ }
19
+ function binding(value) {
20
+ const result = text(value, 1024);
21
+ if (!/^[\x21-\x7e]+$/.test(result)) throw new TypeError("Invalid line application binding");
22
+ return result;
23
+ }
24
+ /** Canonicalize only defined fields. Unknown provider payloads and credentials stay out. */
25
+ function parseLineApplicationRequest(value) {
26
+ const input = record(value);
27
+ if (input.version !== 1) throw new TypeError("Unknown line application version");
28
+ const sender = record(input.sender);
29
+ const transport = input.transport;
30
+ if (transport !== "imessage" && transport !== "sms" && transport !== "whatsapp" && transport !== "email") throw new TypeError("Unknown line transport");
31
+ const receivedAt = text(input.receivedAt, 64);
32
+ if (!Number.isFinite(Date.parse(receivedAt))) throw new TypeError("Invalid line message time");
33
+ const result = {
34
+ version: 1,
35
+ binding: binding(input.binding),
36
+ messageId: id(input.messageId),
37
+ lineId: id(input.lineId),
38
+ attachmentId: id(input.attachmentId),
39
+ memberId: id(input.memberId),
40
+ lineThreadId: id(input.lineThreadId),
41
+ ownerUserId: id(input.ownerUserId),
42
+ sender: {
43
+ address: text(sender.address, 320),
44
+ role: id(sender.role)
45
+ },
46
+ transport,
47
+ receivedAt,
48
+ ...input.acceptedExecutionId === void 0 ? {} : { acceptedExecutionId: id(input.acceptedExecutionId) },
49
+ text: text(input.text, 64 * 1024)
50
+ };
51
+ if (new TextEncoder().encode(JSON.stringify(result)).byteLength > 98304) throw new TypeError("Line application request exceeds the byte limit");
52
+ return result;
53
+ }
54
+ /** A raw agent response is not this receipt. Applications report only settled output. */
55
+ function parseLineApplicationResult(value, request) {
56
+ const result = record(value);
57
+ if (result.version !== 1 || result.binding !== request.binding || result.messageId !== request.messageId || result.attachmentId !== request.attachmentId) throw new TypeError("Line application result identity mismatch");
58
+ if (request.acceptedExecutionId !== void 0 && result.executionId !== request.acceptedExecutionId) throw new TypeError("Accepted application execution changed");
59
+ const identity = {
60
+ version: 1,
61
+ binding: request.binding,
62
+ messageId: request.messageId,
63
+ attachmentId: request.attachmentId
64
+ };
65
+ switch (result.state) {
66
+ case "pending":
67
+ if (typeof result.admitted !== "boolean") throw new TypeError("Admission is not established");
68
+ if (result.admitted) return {
69
+ ...identity,
70
+ state: "pending",
71
+ admitted: true,
72
+ executionId: id(result.executionId)
73
+ };
74
+ if (result.executionId !== void 0) throw new TypeError("Unadmitted result cannot name an execution");
75
+ return {
76
+ ...identity,
77
+ state: "pending",
78
+ admitted: false
79
+ };
80
+ case "completed": return {
81
+ ...identity,
82
+ state: "completed",
83
+ executionId: id(result.executionId),
84
+ text: text(result.text, LINE_APPLICATION_REPLY_MAX_CHARS)
85
+ };
86
+ case "failed": {
87
+ const code = text(result.code, 80);
88
+ if (!/^[a-z][a-z0-9_:.-]*$/.test(code)) throw new TypeError("Invalid failure code");
89
+ return {
90
+ ...identity,
91
+ state: "failed",
92
+ code,
93
+ ...result.executionId === void 0 ? {} : { executionId: id(result.executionId) }
94
+ };
95
+ }
96
+ default: throw new TypeError("Unknown line application state");
97
+ }
98
+ }
99
+ //#endregion
100
+ export { parseLineApplicationResult as i, LINE_APPLICATION_REQUEST_MAX_BYTES as n, parseLineApplicationRequest as r, LINE_APPLICATION_REPLY_MAX_CHARS as t };