@tangle-network/sandbox 1.0.190 → 1.0.192

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 (57) hide show
  1. package/dist/agent/index.d.ts +4 -4
  2. package/dist/agent/index.js +9 -6
  3. package/dist/agent/preview.d.ts +1 -1
  4. package/dist/agent/preview.js +1 -1
  5. package/dist/{agent-run-outcome-Cst4px_l.d.ts → agent-run-outcome-BO5paRhX.d.ts} +2 -2
  6. package/dist/{api-request-CZlFy3ku.js → api-request-BHbSfsRr.js} +1 -1
  7. package/dist/{browser-interactive-control-controller-DHIS8edi.js → browser-interactive-control-controller-BYbNLahH.js} +1 -1
  8. package/dist/{browser-interactive-control-controller-DIvMQyer.d.ts → browser-interactive-control-controller-KOK6qn2s.d.ts} +1 -1
  9. package/dist/{chunked-upload-vAE2hVcP.js → chunked-upload-D5ytV_s6.js} +9 -13
  10. package/dist/{chunked-upload-file-HLSriv3V.js → chunked-upload-file-DL1-AqRp.js} +2 -2
  11. package/dist/{client-BERYosgI.js → client-DuWQNr-Q.js} +159 -109
  12. package/dist/{client-C4SnCCpF.d.ts → client-yWdLuj_P.d.ts} +5 -5
  13. package/dist/collaboration/index.js +1 -1
  14. package/dist/{collaboration-CmT6Ygiv.js → collaboration-Bbr45lyk.js} +3 -3
  15. package/dist/{core-BT-0QZT-.js → core-BU1I2KvV.js} +13 -7
  16. package/dist/core.d.ts +6 -6
  17. package/dist/core.js +5 -5
  18. package/dist/errors-Mzq10WZq.js +583 -0
  19. package/dist/{file-download-BXgu9BNh.js → file-download-CKOxcATB.js} +1 -1
  20. package/dist/{index-DDIymnCZ.d.ts → index-DKsOu5sq.d.ts} +5 -5
  21. package/dist/index.d.ts +9 -9
  22. package/dist/index.js +10 -10
  23. package/dist/intelligence/index.js +9 -5
  24. package/dist/interactive-control.d.ts +1 -1
  25. package/dist/interactive-control.js +1 -1
  26. package/dist/{interactive-controller-DXGWBdYK.d.ts → interactive-controller-YyZEsoB0.d.ts} +3 -3
  27. package/dist/{interactive-controller-C876Pjaj.js → interactive-controller-jr3_74Pq.js} +90 -57
  28. package/dist/lib/prepared-evidence.js +1 -1
  29. package/dist/lib/prepared-process.js +1 -1
  30. package/dist/{lines-Br3ygqhP.d.ts → lines-CCHDUfQg.d.ts} +1 -1
  31. package/dist/{lines-DxHJhxCe.js → lines-DrG0WOW6.js} +1 -1
  32. package/dist/lines.d.ts +1 -1
  33. package/dist/lines.js +1 -1
  34. package/dist/{mcp-local-D7MpwsW0.js → mcp-local-O1HzsQiZ.js} +3 -3
  35. package/dist/{prepared-evidence-CP1MmeCQ.js → prepared-evidence-4prvV0YK.js} +1 -1
  36. package/dist/{prepared-process-BWVz93cT.js → prepared-process-BSpZXDDw.js} +1 -1
  37. package/dist/{preview-DUxqnKSk.d.ts → preview-I1z42VGY.d.ts} +3 -3
  38. package/dist/{public-templates-DQiblzzK.d.ts → public-templates-Cw6gmWJD.d.ts} +2 -2
  39. package/dist/public-templates.d.ts +1 -1
  40. package/dist/public-templates.js +7 -4
  41. package/dist/{raw-evidence-archive-CgbWa4es.js → raw-evidence-archive-BD37zHN5.js} +2 -2
  42. package/dist/runtime.d.ts +5 -5
  43. package/dist/runtime.js +9 -7
  44. package/dist/{sandbox-B_Xbc9wR.js → sandbox-Dtb-_btd.js} +317 -221
  45. package/dist/select-seat-command.d.ts +1 -1
  46. package/dist/select-seat-command.js +5 -2
  47. package/dist/session-gateway/index.js +1 -1
  48. package/dist/tangle/index.d.ts +1 -1
  49. package/dist/tangle/index.js +1 -1
  50. package/dist/{tangle-Sg9ORVAA.js → tangle-fs17QlcY.js} +2 -2
  51. package/dist/{terminal-stream-types-1YKRrkZB.d.ts → terminal-stream-types-BqNv5EuG.d.ts} +280 -305
  52. package/dist/{types-B-UsXSi6.d.ts → types-CiuGb4lZ.d.ts} +4 -2
  53. package/package.json +4 -4
  54. package/dist/errors-CaX0a5Ry.js +0 -636
  55. /package/dist/{abort-signal-PgWPMn_e.js → abort-signal-Cu4F2VVz.js} +0 -0
  56. /package/dist/{file-transfer-DTHgLccV.js → file-transfer-Cr9Ossea.js} +0 -0
  57. /package/dist/{retry-after-header-Bt-XvU-x.js → retry-after-header-DUdCC0KJ.js} +0 -0
@@ -1,7 +1,7 @@
1
- import { I as SandboxTaskSession, O as SandboxInstance, R as SandboxSession } from "../index-DDIymnCZ.js";
2
- import { Bt as SandboxFleetParent, Ha as CodeExecutionResult, Ua as CodeLanguage, Ur as CodeExecutionOptions, Wa as CodeResultPart, ga as BackendConfig, ia as SessionListOptions, na as SessionInfo, wo as BackendType } from "../types-B-UsXSi6.js";
3
- import { t as Sandbox } from "../client-C4SnCCpF.js";
4
- import { u as PreviewAuthorizer } from "../preview-DUxqnKSk.js";
1
+ import { I as SandboxTaskSession, O as SandboxInstance, R as SandboxSession } from "../index-DKsOu5sq.js";
2
+ import { Bt as SandboxFleetParent, Ha as CodeExecutionResult, Ua as CodeLanguage, Ur as CodeExecutionOptions, Wa as CodeResultPart, ga as BackendConfig, ia as SessionListOptions, na as SessionInfo, wo as BackendType } from "../types-CiuGb4lZ.js";
3
+ import { t as Sandbox } from "../client-yWdLuj_P.js";
4
+ import { u as PreviewAuthorizer } from "../preview-I1z42VGY.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,8 +1,8 @@
1
- import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-D7MpwsW0.js";
2
- import { O as assertCurrentBackendType } from "../interactive-controller-C876Pjaj.js";
3
- import { t as SandboxInstance } from "../sandbox-B_Xbc9wR.js";
4
- import { C as StateError, E as ValidationError, g as NotFoundError } from "../errors-CaX0a5Ry.js";
5
- import { t as Sandbox } from "../client-BERYosgI.js";
1
+ import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-O1HzsQiZ.js";
2
+ import { O as assertCurrentBackendType } from "../interactive-controller-jr3_74Pq.js";
3
+ import { t as SandboxInstance } from "../sandbox-Dtb-_btd.js";
4
+ import { D as ValidationError, _ as NotFoundError, w as StateError } from "../errors-Mzq10WZq.js";
5
+ import { t as Sandbox } from "../client-DuWQNr-Q.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -107,7 +107,10 @@ var SandboxAgentManager = class {
107
107
  }
108
108
  async startPrepared(spec) {
109
109
  if (spec.callerSelectedId) {
110
- if (await this.sandbox.session(spec.id).status()) throw new StateError(`Agent ${spec.id} already exists; use box.agents.get("${spec.id}") to reattach or choose a new id`, "existing-agent", "new-agent-id");
110
+ if (await this.sandbox.session(spec.id).status()) throw new StateError(`Agent ${spec.id} already exists; use box.agents.get("${spec.id}") to reattach or choose a new id`, {
111
+ currentState: "existing-agent",
112
+ requiredState: "new-agent-id"
113
+ });
111
114
  }
112
115
  if (spec.workspace.mode === "isolated") return (await this.sandbox.createTaskSession({
113
116
  sessionId: spec.id,
@@ -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-DUxqnKSk.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-I1z42VGY.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 };
@@ -66,7 +66,7 @@ async function servePreviewMcp(request, config) {
66
66
  if (typeof config.authorize !== "function") throw new Error("Preview MCP requires a host authorization callback");
67
67
  const tools = config.tools ?? PREVIEW_TOOLS;
68
68
  if (!tools.length || tools.some((tool) => !PREVIEW_TOOLS.includes(tool))) throw new Error("Preview MCP requires an explicit nonempty preview-only tool grant");
69
- const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-D7MpwsW0.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
69
+ const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-O1HzsQiZ.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
70
70
  const handle = await createMcpServer(config.box, {
71
71
  name: "tangle-previews",
72
72
  sessionId: config.sessionId,
@@ -1,5 +1,5 @@
1
- import { V as InteractionRequest } from "./terminal-stream-types-1YKRrkZB.js";
2
- import { Di as SandboxEvent, _i as DurablePlanSnapshot, ci as AgentApprovalRequirement, di as AgentToolInvocation, li as AgentQuestionRequest, ui as AgentRunStatus } from "./types-B-UsXSi6.js";
1
+ import { V as InteractionRequest } from "./terminal-stream-types-BqNv5EuG.js";
2
+ import { Di as SandboxEvent, _i as DurablePlanSnapshot, ci as AgentApprovalRequirement, di as AgentToolInvocation, li as AgentQuestionRequest, ui as AgentRunStatus } from "./types-CiuGb4lZ.js";
3
3
 
4
4
  //#region src/agent-run-outcome.d.ts
5
5
  interface AgentRunOutcome {
@@ -1,7 +1,7 @@
1
1
  import { t as rewrapResponse } from "./response-rewrap-Cjoxh2wZ.js";
2
2
  //#region src/lib/api-request.mjs
3
3
  /** The package version tsdown.config.ts defines; unbuilt source reports 0.0.0. */
4
- const SDK_VERSION = "1.0.190";
4
+ const SDK_VERSION = "1.0.192";
5
5
  function withRequestContextHeaders(response, path, method, body = response.body) {
6
6
  const headers = new Headers(response.headers);
7
7
  headers.set("x-tangle-request-path", path);
@@ -1,5 +1,5 @@
1
1
  import { C as boundedIdentifierSchema, D as isBoundedEventContentJson, E as boundedStringSchema, S as boundedEventContentStringSchema, T as boundedJsonSchema, _ as CONTRACT_MAX_ARRAY_LENGTH, b as boundedEventContentJsonSchema, g as sha256DigestSchema, h as omitTopLevelDigest, m as looksLikeCredential, n as REASONING_EFFORTS, o as canonicalCandidateDigest, p as isWellFormedUnicode, s as canonicalCandidateJson, t as harnessTypeSchema, u as isCanonicalJsonValue, w as boundedJsonRecordSchema, x as boundedEventContentRecordSchema, y as CONTRACT_MAX_STRING_LENGTH } from "./harness-DMaNgn0S.js";
2
- import { n as awaitWithAbort } from "./abort-signal-PgWPMn_e.js";
2
+ import { n as awaitWithAbort } from "./abort-signal-Cu4F2VVz.js";
3
3
  import { z } from "zod";
4
4
  //#region ../../../node_modules/.pnpm/@tangle-network+agent-interface@5.10.13/node_modules/@tangle-network/agent-interface/dist/native-session-event.js
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as AgentInteractiveSessionStatus, C as AgentInteractiveSessionAttach, E as AgentInteractiveSessionControlClaimRequest, T as AgentInteractiveSessionControlClaimAcknowledgement, i as TerminalStreamHandlers, k as AgentInteractiveSessionRef, w as AgentInteractiveSessionControlClaim } from "./terminal-stream-types-1YKRrkZB.js";
1
+ import { A as AgentInteractiveSessionStatus, C as AgentInteractiveSessionAttach, E as AgentInteractiveSessionControlClaimRequest, T as AgentInteractiveSessionControlClaimAcknowledgement, i as TerminalStreamHandlers, k as AgentInteractiveSessionRef, w as AgentInteractiveSessionControlClaim } from "./terminal-stream-types-BqNv5EuG.js";
2
2
 
3
3
  //#region src/interactive-types.d.ts
4
4
  /** Cancellation for an interactive SDK request. */
@@ -1,6 +1,6 @@
1
- import { i as FILE_UPLOAD_SESSION_MAX_BYTES, n as isFileTooLargeErrorBody, r as isPayloadTooLargeErrorBody } from "./file-transfer-DTHgLccV.js";
2
- import { S as ServerError, T as TimeoutError, h as NetworkError, n as parseErrorResponse, x as SandboxError, y as QuotaError } from "./errors-CaX0a5Ry.js";
3
- import { t as abortableSleep } from "./abort-signal-PgWPMn_e.js";
1
+ import { S as SandboxError, n as isTransientWrite, r as parseErrorResponse } from "./errors-Mzq10WZq.js";
2
+ import { t as abortableSleep } from "./abort-signal-Cu4F2VVz.js";
3
+ import { i as FILE_UPLOAD_SESSION_MAX_BYTES, n as isFileTooLargeErrorBody, r as isPayloadTooLargeErrorBody } from "./file-transfer-Cr9Ossea.js";
4
4
  //#region src/generated/sandbox-upload-operations.ts
5
5
  function uploadSessionInit(transport, input, init = {}) {
6
6
  return transport.fetch(`/fs/upload-session`, {
@@ -50,15 +50,8 @@ const RETRY_MAX_MS = 2e3;
50
50
  * staging budget. */
51
51
  const DEFAULT_UPLOAD_CONCURRENCY = 4;
52
52
  const MAX_UPLOAD_CONCURRENCY = 8;
53
- /** Transient part-upload failures worth retrying: rate-limit/budget (429),
54
- * 5xx, transport (network), and request timeouts — mirrors
55
- * `isTransientWriteError` in `sandbox.ts`. A non-transient error (bad path,
56
- * auth, checksum, containment) fails loud immediately. */
57
- function isTransientUploadError(rejection) {
58
- return rejection instanceof QuotaError || rejection instanceof ServerError || rejection instanceof NetworkError || rejection instanceof TimeoutError;
59
- }
60
53
  function isChecksumMismatch(rejection) {
61
- return rejection instanceof SandboxError && rejection.code === "CHECKSUM_MISMATCH";
54
+ return rejection instanceof SandboxError && rejection.wireCode === "CHECKSUM_MISMATCH";
62
55
  }
63
56
  /** Cheap size probe used for the pre-flight cap check, read directly off
64
57
  * the input shape (`Blob.size` / `ArrayBuffer.byteLength` / view
@@ -223,7 +216,7 @@ async function putPart(transport, uploadId, index, options, wire) {
223
216
  if (!response.ok) throw await parseUploadError(response);
224
217
  return;
225
218
  } catch (err) {
226
- if (isTransientUploadError(err) && attempt < maxRetries) {
219
+ if (isTransientWrite(err) && attempt < maxRetries) {
227
220
  const retryAfterMs = err instanceof SandboxError ? err.retryAfterMs : void 0;
228
221
  const backoff = Math.min(RETRY_BASE_MS * 2 ** attempt, RETRY_MAX_MS);
229
222
  await abortableSleep(retryAfterMs ?? backoff, options.signal);
@@ -339,7 +332,10 @@ async function abortSession(transport, uploadId) {
339
332
  */
340
333
  async function uploadChunked(transport, remotePath, data, options = {}) {
341
334
  const estimatedSize = sizeOfInput(data);
342
- if (estimatedSize > 67108864) throw new SandboxError(`Payload for ${remotePath} is ${estimatedSize} bytes, over the ${FILE_UPLOAD_SESSION_MAX_BYTES} byte chunked-upload session cap`, "PAYLOAD_TOO_LARGE", 413);
335
+ if (estimatedSize > 67108864) throw new SandboxError(`Payload for ${remotePath} is ${estimatedSize} bytes, over the ${FILE_UPLOAD_SESSION_MAX_BYTES} byte chunked-upload session cap`, {
336
+ code: "PAYLOAD_TOO_LARGE",
337
+ status: 413
338
+ });
343
339
  options.signal?.throwIfAborted();
344
340
  const bytes = await normalizeToBytes(data);
345
341
  options.signal?.throwIfAborted();
@@ -1,5 +1,5 @@
1
- import { i as FILE_UPLOAD_SESSION_MAX_BYTES } from "./file-transfer-DTHgLccV.js";
2
- import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-vAE2hVcP.js";
1
+ import { i as FILE_UPLOAD_SESSION_MAX_BYTES } from "./file-transfer-Cr9Ossea.js";
2
+ import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-D5ytV_s6.js";
3
3
  import { createHash } from "node:crypto";
4
4
  import { open } from "node:fs/promises";
5
5
  //#region src/lib/chunked-upload-file.ts