@tangle-network/sandbox 0.55.3 → 0.58.0

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 (44) hide show
  1. package/README.md +21 -2
  2. package/dist/agent/index.d.ts +59 -19
  3. package/dist/agent/index.js +39 -357
  4. package/dist/agent/preview.d.ts +2 -0
  5. package/dist/agent/preview.js +74 -0
  6. package/dist/{agent-run-outcome-CWo6e5lW.d.ts → agent-run-outcome-DV-9cNsk.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-Dv0gbFMu.js → browser-interactive-control-controller-CVGqjPgs.js} +1 -1
  10. package/dist/{browser-interactive-control-controller-BELrFH4f.d.ts → browser-interactive-control-controller-knjCl8Zp.d.ts} +1 -1
  11. package/dist/{client-B-LZQQ51.d.ts → client-B1I66sl_.d.ts} +10 -4
  12. package/dist/{client-B6Jo-v5w.js → client-BMdV_CeM.js} +30 -7
  13. package/dist/collaboration/index.d.ts +1 -1
  14. package/dist/collaboration/index.js +1 -1
  15. package/dist/{collaboration-DLPFc9-W.js → collaboration-CSHswAOI.js} +1 -1
  16. package/dist/core.d.ts +5 -5
  17. package/dist/core.js +3 -3
  18. package/dist/{index-ATSSTK2A.d.ts → index-CGnI-q1g.d.ts} +2 -2
  19. package/dist/index.d.ts +11 -11
  20. package/dist/index.js +7 -7
  21. package/dist/intelligence/index.js +1 -1
  22. package/dist/interactive-control.d.ts +1 -1
  23. package/dist/interactive-control.js +1 -1
  24. package/dist/{local-cli-auth-BAJuMBZU.js → local-cli-auth-DfuFJCcs.js} +1 -1
  25. package/dist/mcp-local-DXO-9rtB.js +440 -0
  26. package/dist/preview-Bz7TXYSf.d.ts +72 -0
  27. package/dist/preview-operations-Dgbi46FH.js +212 -0
  28. package/dist/{runtime-api-DoZsOiOR.js → runtime-api-BZg34WGd.js} +10 -5
  29. package/dist/runtime.d.ts +6 -4
  30. package/dist/runtime.js +3 -3
  31. package/dist/{sandbox-C7KqjY6Y.d.ts → sandbox-BMSWYvdP.d.ts} +144 -10
  32. package/dist/{sandbox-DzSE1u7d.js → sandbox-DyrDBnjp.js} +130 -10
  33. package/dist/tangle/index.d.ts +1 -1
  34. package/dist/tangle/index.js +1 -1
  35. package/dist/{tangle-CmpR_07-.js → tangle-BtQkJqfz.js} +2 -2
  36. package/dist/{types-UOIM3RS6.d.ts → types-DRyvWIJf.d.ts} +24 -2
  37. package/package.json +11 -6
  38. /package/dist/{abort-signal-si1WMfJb.js → abort-signal-CgFhjY_v.js} +0 -0
  39. /package/dist/{cli-auth-bundle-DUsK57rK.js → cli-auth-bundle-bRJOyaJO.js} +0 -0
  40. /package/dist/{errors-CmYPVl-k.js → errors-BkhlSDW-.js} +0 -0
  41. /package/dist/{errors-Cz23YNu2.d.ts → errors-CNsmhCen.d.ts} +0 -0
  42. /package/dist/{index-BWiG3Vcw.d.ts → index-BN7zNEUB.d.ts} +0 -0
  43. /package/dist/{index-BfVsF6yU.d.ts → index-X4EEZlMi.d.ts} +0 -0
  44. /package/dist/{terminal-stream-CcaBTVg3.d.ts → terminal-stream-BW4veIsI.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { C as normalizeRuntimeBackendConfig, S as mergeRuntimeBackendConfig, T as deriveAgentResultOutcome, _ as encodePromptForWire, a as waitForRetryAfter, b as applyRequestedModel, c as mintTraceId, d as sessionHeaders, f as uploadChunked, h as SANDBOX_PROXY_REQUEST_MAX_BYTES, i as sessionMessageRequestBody, l as resolveTraceId, m as validateAcceptedDispatchRunRef, n as isRetryableCredentialRefusal, o as TRACE_ID_HEADER, p as resolveDispatchRunIdentity, r as normalizeSessionInfo, s as isTraceId, t as SandboxRuntimeApi, u as appendSessionIdQuery, w as createAgentRunOutcomeTracker, x as assertCurrentBackendType, y as parseSSEStream } from "./runtime-api-DoZsOiOR.js";
2
- import { _ as parseErrorResponse, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, m as StateError, n as CapabilityError, p as ServerError, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-CmYPVl-k.js";
3
- import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionControlValidationResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, p as interactiveSessionStatusResponseSchema, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-Dv0gbFMu.js";
4
- import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-si1WMfJb.js";
1
+ import { C as normalizeRuntimeBackendConfig, S as mergeRuntimeBackendConfig, T as deriveAgentResultOutcome, _ as encodePromptForWire, a as waitForRetryAfter, b as applyRequestedModel, c as mintTraceId, d as sessionHeaders, f as uploadChunked, h as SANDBOX_PROXY_REQUEST_MAX_BYTES, i as sessionMessageRequestBody, l as resolveTraceId, m as validateAcceptedDispatchRunRef, n as isRetryableCredentialRefusal, o as TRACE_ID_HEADER, p as resolveDispatchRunIdentity, r as normalizeSessionInfo, s as isTraceId, t as SandboxRuntimeApi, u as appendSessionIdQuery, w as createAgentRunOutcomeTracker, x as assertCurrentBackendType, y as parseSSEStream } from "./runtime-api-BZg34WGd.js";
2
+ import { _ as parseErrorResponse, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, m as StateError, n as CapabilityError, p as ServerError, r as EdgeNotReadyError, s as NetworkError, t as AuthError, u as QuotaError } from "./errors-BkhlSDW-.js";
3
+ import { c as createInteractiveControlHolderId, d as interactiveSessionControlReleaseResponseSchema, f as interactiveSessionControlValidationResponseSchema, i as createBrowserInteractiveSessionControlTransport, o as InteractiveSessionControlController, p as interactiveSessionStatusResponseSchema, r as browserInteractiveTerminalEndpoint, s as assertInteractiveSessionRef, u as interactiveSessionControlClaimResponseSchema } from "./browser-interactive-control-controller-CVGqjPgs.js";
4
+ import { n as combineAbortSignals, t as awaitWithAbort } from "./abort-signal-CgFhjY_v.js";
5
5
  import { AgentExactRunControlRefSchema, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, InteractionAcknowledgementSchema, InteractionBindingSchema, InteractionRequestSchema, InteractionResponseCommandSchema, InteractionResponseSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentRunCancellationAcknowledgementMatchesRequest, canonicalCandidateDigest, exactAgentInteractiveSessionStart, sha256DigestSchema, terminalSessionUsable } from "@tangle-network/agent-interface";
6
6
  import { z } from "zod";
7
7
  import { AgentInteractiveSessionControlClaimSchema as AgentInteractiveSessionControlClaimSchema$1, AgentInteractiveSessionPromptAcknowledgementSchema as AgentInteractiveSessionPromptAcknowledgementSchema$1, AgentInteractiveSessionRefSchema as AgentInteractiveSessionRefSchema$1, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema as AgentInteractiveSessionStopAcknowledgementSchema$1 } from "@tangle-network/agent-interface/environment-interactive-control";
@@ -341,6 +341,15 @@ var LinesClient = class {
341
341
  return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/attachment`, { method: "DELETE" }))).detached;
342
342
  }
343
343
  /**
344
+ * Retire a detached line's Hub routing and free its workspace transport slot.
345
+ * Hub refuses an attached or voice-enabled line. A retry by line id returns
346
+ * false; the provider connection and message history remain.
347
+ */
348
+ async release(number) {
349
+ const lineId = await this.resolve(number);
350
+ return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, { method: "DELETE" }))).released;
351
+ }
352
+ /**
344
353
  * Take calls on a line (Inkbox iMessage lines). Hub points the identity's
345
354
  * incoming calls at itself, binds the ph0ny agent to the line and adds the
346
355
  * agent's `ask_workspace` tool. Enabling again replaces every credential.
@@ -358,6 +367,22 @@ var LinesClient = class {
358
367
  async disableVoice(lineId) {
359
368
  return (await hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}`, json("PATCH", { voice: { enabled: false } })))).line;
360
369
  }
370
+ /**
371
+ * Queue a proactive message to an active, consenting member. Hub reuses the
372
+ * member's authenticated provider conversation, rechecks STOP immediately
373
+ * before delivery, and defers delivery during the recipient's saved quiet hours.
374
+ */
375
+ async send(lineId, input) {
376
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/send`, json("POST", input)));
377
+ }
378
+ /** Read the native outbox receipt. Queued is not a delivery confirmation. */
379
+ async sentMessage(lineId, messageId) {
380
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/outbox/${encodeURIComponent(messageId)}`));
381
+ }
382
+ /** Only the recipient's proven message can enable reminders or choose quiet hours. */
383
+ async reminders(lineId, memberId) {
384
+ return hubData(await this.http.fetch(`/v1/lines/${encodeURIComponent(lineId)}/members/${encodeURIComponent(memberId)}/reminders`));
385
+ }
361
386
  /** Members of the line's active attachment. */
362
387
  members(lineId) {
363
388
  const base = `/v1/lines/${encodeURIComponent(lineId)}/members`;
@@ -537,6 +562,7 @@ function parseSandboxRuntimeCapabilities(raw) {
537
562
  const interactionsValue = record.interactions;
538
563
  if (interactionsValue === null || typeof interactionsValue !== "object" || Array.isArray(interactionsValue)) invalidCapabilities("a malformed 'interactions' group");
539
564
  const interactionsRecord = interactionsValue;
565
+ if ("exactBeforeToolApproval" in interactionsRecord && typeof interactionsRecord.exactBeforeToolApproval !== "boolean") invalidCapabilities("a non-boolean 'interactions.exactBeforeToolApproval' flag");
540
566
  if ("responseDedupe" in interactionsRecord && typeof interactionsRecord.responseDedupe !== "boolean") invalidCapabilities("a non-boolean 'interactions.responseDedupe' flag");
541
567
  const interactiveAgentValue = record.interactiveAgent;
542
568
  let interactiveAgent;
@@ -563,7 +589,10 @@ function parseSandboxRuntimeCapabilities(raw) {
563
589
  "idempotent"
564
590
  ]),
565
591
  runs: readFlagGroup(record, "runs", ["executionScopedStatus", "eventReplay"]),
566
- interactions: typeof interactionsRecord.responseDedupe === "boolean" ? { responseDedupe: interactionsRecord.responseDedupe } : {},
592
+ interactions: {
593
+ ...typeof interactionsRecord.responseDedupe === "boolean" ? { responseDedupe: interactionsRecord.responseDedupe } : {},
594
+ ...typeof interactionsRecord.exactBeforeToolApproval === "boolean" ? { exactBeforeToolApproval: interactionsRecord.exactBeforeToolApproval } : {}
595
+ },
567
596
  ...interactiveAgent === void 0 ? {} : { interactiveAgent }
568
597
  };
569
598
  }
@@ -3206,6 +3235,14 @@ var SandboxSession = class SandboxSession {
3206
3235
  async runs() {
3207
3236
  return this.box._sessionRuns(this.id);
3208
3237
  }
3238
+ /** Export the exact provider session before this sandbox is deleted. */
3239
+ async nativeRollout() {
3240
+ return this.box._sessionNativeRollout(this.id);
3241
+ }
3242
+ /** Capture the complete attributed native store and process stream before deletion. */
3243
+ async rawEvidence() {
3244
+ return this.box._sessionRawEvidence(this.id);
3245
+ }
3209
3246
  /** Read the exact execution admitted for a turn, including server-owned plan follow-ups.
3210
3247
  * This never admits work or verifies the input of a proposed retry.
3211
3248
  */
@@ -3708,6 +3745,18 @@ const SANDBOX_CREATE_OUTCOMES = [
3708
3745
  * An outcome this SDK version does not know becomes `unknown`: only a known
3709
3746
  * `created` proves that the call allocated the environment.
3710
3747
  */
3748
+ function normalizeCaptureProof(raw) {
3749
+ if (!raw || typeof raw !== "object") return null;
3750
+ const proof = raw;
3751
+ if (typeof proof.hostId !== "string" || proof.hostId.length === 0 || typeof proof.containerId !== "string" || !/^[a-f0-9]{64}$/.test(proof.containerId) || typeof proof.imageId !== "string" || !/^sha256:[a-f0-9]{64}$/.test(proof.imageId) || typeof proof.bundleRevision !== "string" || !/^[a-f0-9]{40}$/.test(proof.bundleRevision) || typeof proof.bundleChecksum !== "string" || !/^sha256:[a-f0-9]{64}$/.test(proof.bundleChecksum)) return null;
3752
+ return {
3753
+ hostId: proof.hostId,
3754
+ containerId: proof.containerId,
3755
+ imageId: proof.imageId,
3756
+ bundleRevision: proof.bundleRevision,
3757
+ bundleChecksum: proof.bundleChecksum
3758
+ };
3759
+ }
3711
3760
  function normalizeSandboxCreateReceipt(raw) {
3712
3761
  if (!raw || typeof raw !== "object") return null;
3713
3762
  const record = raw;
@@ -3719,7 +3768,8 @@ function normalizeSandboxCreateReceipt(raw) {
3719
3768
  outcome,
3720
3769
  idempotencyKeyApplied,
3721
3770
  ...record.ownerContext === "inherit" || record.ownerContext === "isolated" ? { ownerContext: record.ownerContext } : {},
3722
- ...injectedSecrets ? { injectedSecrets } : {}
3771
+ ...injectedSecrets ? { injectedSecrets } : {},
3772
+ ...normalizeCaptureProof(record.captureProof) ? { captureProof: normalizeCaptureProof(record.captureProof) ?? void 0 } : {}
3723
3773
  };
3724
3774
  }
3725
3775
  /**
@@ -4239,6 +4289,10 @@ var SandboxInstance = class SandboxInstance {
4239
4289
  createReceipt() {
4240
4290
  return this.info.createReceipt ?? null;
4241
4291
  }
4292
+ /** Verified identity of the currently running container, if available. */
4293
+ captureProof() {
4294
+ return this.info.captureProof ?? null;
4295
+ }
4242
4296
  /**
4243
4297
  * Serialize to the public sandbox shape for logs and structured
4244
4298
  * output. Secrets in `connection` (currently `authToken`) are
@@ -5444,8 +5498,8 @@ var SandboxInstance = class SandboxInstance {
5444
5498
  * Older runtimes without app-variable registration fail this call.
5445
5499
  * Credential values must stay outside profiles, receipts, and logs.
5446
5500
  */
5447
- async setRuntimeEnv(env) {
5448
- return this.runtime.setRuntimeEnv(env);
5501
+ async setRuntimeEnv(env, options = {}) {
5502
+ return this.runtime.setRuntimeEnv(env, options);
5449
5503
  }
5450
5504
  /**
5451
5505
  * Return the runtime's current listening-port snapshot.
@@ -6851,7 +6905,12 @@ var SandboxInstance = class SandboxInstance {
6851
6905
  const body = await response.text();
6852
6906
  throw parseErrorResponse(response.status, body, void 0, response.headers);
6853
6907
  }
6854
- return normalizePreviewLink((await response.json()).previewLink);
6908
+ const data = await response.json();
6909
+ if (response.status !== 200 && response.status !== 201) throw new Error("Preview creation returned an unexpected success status");
6910
+ return {
6911
+ ...normalizePreviewLink(data.previewLink),
6912
+ created: response.status === 201
6913
+ };
6855
6914
  }
6856
6915
  async previewLinkList() {
6857
6916
  const response = await this.runtimeFetch("/preview-links");
@@ -7997,6 +8056,7 @@ var SandboxInstance = class SandboxInstance {
7997
8056
  status: data.status ?? "pending",
7998
8057
  connection,
7999
8058
  metadata: data.metadata,
8059
+ captureProof: normalizeCaptureProof(data.captureProof) ?? void 0,
8000
8060
  createdAt: data.createdAt ? new Date(data.createdAt) : this.info.createdAt,
8001
8061
  startedAt: data.startedAt ? new Date(data.startedAt) : void 0,
8002
8062
  lastActivityAt: data.lastActivityAt ? new Date(data.lastActivityAt) : void 0,
@@ -8388,6 +8448,7 @@ var SandboxInstance = class SandboxInstance {
8388
8448
  text: message
8389
8449
  }] : [...message],
8390
8450
  turnId: opts.turnId,
8451
+ ...opts.managedQuoteVersion !== void 0 ? { managedQuoteVersion: opts.managedQuoteVersion } : {},
8391
8452
  ...backend !== void 0 ? { backend } : {},
8392
8453
  ...opts.runControlRef !== void 0 ? { runControlRef: opts.runControlRef } : {}
8393
8454
  };
@@ -8511,6 +8572,65 @@ var SandboxInstance = class SandboxInstance {
8511
8572
  }
8512
8573
  return normalizeSessionInfo(await response.json());
8513
8574
  }
8575
+ /** @internal — invoked before the sandbox is deleted. */
8576
+ async _sessionNativeRollout(id) {
8577
+ await this.ensureRunning();
8578
+ const response = await this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/native-rollout`);
8579
+ if (!response.ok && response.status !== 404) throw parseErrorResponse(response.status, await response.text(), void 0, response.headers);
8580
+ const decoded = await response.json();
8581
+ if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded)) throw new ServerError("Malformed native rollout response");
8582
+ const raw = decoded;
8583
+ if (raw.status === "unavailable") {
8584
+ if (typeof raw.reason !== "string" || raw.reason.length === 0 || raw.sessionId !== id || typeof raw.backendType !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(raw.backendType) || raw.nativeSessionId !== void 0 && (typeof raw.nativeSessionId !== "string" || !/^ses_[A-Za-z0-9_-]{1,124}$/.test(raw.nativeSessionId))) throw new ServerError("Malformed native rollout unavailable response");
8585
+ return raw;
8586
+ }
8587
+ if (raw.status !== "captured" || raw.sessionId !== id || raw.backendType !== "opencode" || raw.format !== "opencode-session-export-json" || typeof raw.contentBase64 !== "string" || !Number.isSafeInteger(raw.sizeBytes) || Number(raw.sizeBytes) < 1 || Number(raw.sizeBytes) > 128 * 1024 * 1024 || typeof raw.sha256 !== "string" || !/^sha256:[a-f0-9]{64}$/.test(raw.sha256) || typeof raw.nativeSessionId !== "string" || !/^ses_[A-Za-z0-9_-]{1,124}$/.test(raw.nativeSessionId)) throw new ServerError("Malformed native rollout response");
8588
+ let binary;
8589
+ try {
8590
+ binary = atob(raw.contentBase64);
8591
+ } catch {
8592
+ throw new ServerError("Malformed native rollout base64 content");
8593
+ }
8594
+ const content = new Uint8Array(binary.length);
8595
+ for (let index = 0; index < binary.length; index += 1) content[index] = binary.charCodeAt(index);
8596
+ if (content.length !== raw.sizeBytes) throw new ServerError("Native rollout byte count mismatch");
8597
+ const subtle = globalThis.crypto?.subtle;
8598
+ if (!subtle) throw new ServerError("Native rollout verification requires Web Crypto");
8599
+ const digest = await subtle.digest("SHA-256", content);
8600
+ if (`sha256:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("")}` !== raw.sha256) throw new ServerError("Native rollout SHA-256 mismatch");
8601
+ let exported;
8602
+ try {
8603
+ exported = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(content));
8604
+ } catch {
8605
+ throw new ServerError("Malformed native rollout content");
8606
+ }
8607
+ const native = typeof exported === "object" && exported !== null && !Array.isArray(exported) ? exported : void 0;
8608
+ const info = native?.info;
8609
+ if (typeof info !== "object" || info === null || Array.isArray(info) || info.id !== raw.nativeSessionId || !Array.isArray(native?.messages)) throw new ServerError("Native rollout session ID mismatch");
8610
+ return {
8611
+ ...raw,
8612
+ content
8613
+ };
8614
+ }
8615
+ /** @internal — invoked before the sandbox is deleted. */
8616
+ async _sessionRawEvidence(id) {
8617
+ await this.ensureRunning();
8618
+ await this.refresh();
8619
+ const response = await this.runtimeFetch(`/agents/sessions/${encodeURIComponent(id)}/raw-evidence`);
8620
+ if (!response.ok && response.status !== 404) throw parseErrorResponse(response.status, await response.text(), void 0, response.headers);
8621
+ const raw = await response.json();
8622
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new ServerError("Malformed raw evidence response");
8623
+ const record = raw;
8624
+ if (record.status === "unavailable") {
8625
+ if (record.sessionId !== id || typeof record.backendType !== "string" || typeof record.reason !== "string" || record.reason.length === 0) throw new ServerError("Malformed raw evidence unavailable response");
8626
+ return record;
8627
+ }
8628
+ const completeness = record.completeness;
8629
+ if (record.status !== "captured" || record.sessionId !== id || typeof record.backendType !== "string" || typeof record.nativeSessionId !== "string" || record.proofStatus !== "verified" && record.proofStatus !== "unverified" || record.proofStatus === "verified" && (typeof record.containerId !== "string" || !/^[a-f0-9]{64}$/.test(record.containerId) || typeof record.sidecarBundleChecksum !== "string" || !/^sha256:[a-f0-9]{64}$/.test(record.sidecarBundleChecksum)) || typeof record.sidecarImageDigest !== "string" || !/^sha256:[a-f0-9]{64}$/.test(record.sidecarImageDigest) || typeof record.sidecarBundleRevision !== "string" || !/^[a-f0-9]{40}$/.test(record.sidecarBundleRevision) || !Array.isArray(record.nativeRoots) || !Array.isArray(record.files) || !Array.isArray(record.excluded) || !Array.isArray(record.processIo) || !Array.isArray(record.processTerminals) || !Array.isArray(record.events) || typeof record.inventory !== "object" || record.inventory === null || completeness?.nativeStore !== true || completeness.processIo !== true || completeness.events !== true || record.coverageComplete !== true) throw new ServerError("Malformed raw evidence response");
8630
+ const expected = this.info.captureProof;
8631
+ if (expected && (record.proofStatus !== "verified" || record.containerId !== expected.containerId || record.sidecarImageDigest !== expected.imageId || record.sidecarBundleRevision !== expected.bundleRevision || record.sidecarBundleChecksum !== expected.bundleChecksum)) throw new ServerError("Raw evidence does not match current container capture proof");
8632
+ return record;
8633
+ }
8514
8634
  /** @internal — invoked by SandboxSession.runs(). */
8515
8635
  async _sessionRuns(id) {
8516
8636
  return this.runtime.runs(id);
@@ -8906,4 +9026,4 @@ function quoteForShell(value) {
8906
9026
  return `'${value.replace(/'/g, "'\\''")}'`;
8907
9027
  }
8908
9028
  //#endregion
8909
- export { lineInstanceKey as A, collectAgentResponseText as C, normalizeSandboxShape as D, normalizeConnection as E, toOtelJson as F, buildTraceExportPayload as M, exportTraceBundle as N, LinesClient as O, otelTraceIdForTangleTrace as P, collectAgentFinalMessageText as S, isToolBearingEvent as T, TerminalStream as _, WorkspaceImages as a, requestInteractiveSessionToken as b, SandboxTaskSession as c, agentInteractiveSessionPromptRequestDigest as d, InteractiveTerminalFrameLog as f, InteractiveSessionController as g, BrowserInteractiveSessionController as h, normalizeStartupDiagnostics as i, rewrapResponse as j, SandboxLines as k, SandboxSession as l, createInteractiveTerminalSession as m, createSandboxInstanceFromResponse as n, GPU_LEASE_PROVIDER_NAMES as o, createInteractiveTerminalCapture as p, normalizeSandboxCreateReceipt as r, MAX_EGRESS_DENIALS_LIMIT as s, SandboxInstance as t, InteractiveSessionHandle as u, TerminalStreamError as v, getSandboxEventText as w, applySandboxEventText as x, TERMINAL_WS_ECHO_SUBPROTOCOL as y };
9029
+ export { SandboxLines as A, collectAgentFinalMessageText as C, normalizeConnection as D, isToolBearingEvent as E, otelTraceIdForTangleTrace as F, toOtelJson as I, rewrapResponse as M, buildTraceExportPayload as N, normalizeSandboxShape as O, exportTraceBundle as P, applySandboxEventText as S, getSandboxEventText as T, InteractiveSessionController as _, normalizeStartupDiagnostics as a, TERMINAL_WS_ECHO_SUBPROTOCOL as b, MAX_EGRESS_DENIALS_LIMIT as c, InteractiveSessionHandle as d, agentInteractiveSessionPromptRequestDigest as f, BrowserInteractiveSessionController as g, createInteractiveTerminalSession as h, normalizeSandboxCreateReceipt as i, lineInstanceKey as j, LinesClient as k, SandboxTaskSession as l, createInteractiveTerminalCapture as m, createSandboxInstanceFromResponse as n, WorkspaceImages as o, InteractiveTerminalFrameLog as p, normalizeCaptureProof as r, GPU_LEASE_PROVIDER_NAMES as s, SandboxInstance as t, SandboxSession as u, TerminalStream as v, collectAgentResponseText as w, requestInteractiveSessionToken as x, TerminalStreamError as y };
@@ -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-ATSSTK2A.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 TangleSandboxClientConfig, r as JOB_SANDBOX_DELETE, s as AgentSandboxBlueprintAbi, t as TangleSandboxClient, u as SandboxCreateParamTypes } from "../index-CGnI-q1g.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, 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-CmpR_07-.js";
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-BtQkJqfz.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient };
@@ -1,5 +1,5 @@
1
- import { _ as parseErrorResponse } from "./errors-CmYPVl-k.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-DzSE1u7d.js";
1
+ import { _ as parseErrorResponse } from "./errors-BkhlSDW-.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-DyrDBnjp.js";
3
3
  //#region src/tangle/abi.ts
4
4
  /**
5
5
  * Tangle Contract ABI Definitions
@@ -1,4 +1,4 @@
1
- import { r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-CcaBTVg3.js";
1
+ import { r as TerminalStreamHandlers, t as TerminalStream } from "./terminal-stream-BW4veIsI.js";
2
2
  import * as _$_tangle_network_agent_interface0 from "@tangle-network/agent-interface";
3
3
  import { AgentExactRunControlRef, AgentProfile, AgentProfileCapabilities, AgentProfileConfidential, AgentProfileValidationResult, AgentRuntimeAttachments, HarnessType, ReasoningEffort, SandboxSizePreset } from "@tangle-network/agent-interface";
4
4
  import { z } from "zod";
@@ -1456,6 +1456,8 @@ interface SandboxShapesInfo {
1456
1456
  interface CreateSandboxOptions {
1457
1457
  /** Suppress implicit owner secrets, startup scripts, and Hub authority. */
1458
1458
  ownerContext?: "inherit" | "isolated";
1459
+ /** Require proven native session capture on the selected host. */
1460
+ requireNativeSessionCapture?: boolean;
1459
1461
  /**
1460
1462
  * Environment or container image to run.
1461
1463
  *
@@ -2010,6 +2012,14 @@ interface SandboxCreateReceipt {
2010
2012
  * on a platform old enough not to report the set.
2011
2013
  */
2012
2014
  injectedSecrets?: string[];
2015
+ /** Host-confirmed identity of the container whose native rollout is retained. */
2016
+ captureProof?: {
2017
+ hostId: string;
2018
+ containerId: string;
2019
+ imageId: string;
2020
+ bundleRevision: string;
2021
+ bundleChecksum: string;
2022
+ };
2013
2023
  }
2014
2024
  /**
2015
2025
  * Full sandbox information returned from the API.
@@ -2031,6 +2041,8 @@ interface SandboxInfo {
2031
2041
  connection?: SandboxConnection;
2032
2042
  /** Custom metadata */
2033
2043
  metadata?: Record<string, unknown>;
2044
+ /** Verified current container identity, available on create and get. */
2045
+ captureProof?: SandboxCreateReceipt["captureProof"];
2034
2046
  /** When the sandbox was created */
2035
2047
  createdAt: Date;
2036
2048
  /** When the sandbox started running */
@@ -3134,6 +3146,9 @@ interface SandboxRuntimeCapabilities {
3134
3146
  eventReplay: boolean;
3135
3147
  };
3136
3148
  interactions: {
3149
+ /** This sidecar image contains the OpenCode native before-tool approval
3150
+ * hook. Require OpenCode and permission interactions before using it. */
3151
+ exactBeforeToolApproval?: boolean;
3137
3152
  /** Every acknowledged interaction resolution is recorded: repeating a
3138
3153
  * response replays the recorded resolution, and a different answer for
3139
3154
  * a recorded resolution raises a 409 `StateError`. The deployment
@@ -3317,6 +3332,8 @@ interface SendSessionMessageRequest {
3317
3332
  messageId?: string;
3318
3333
  /** Per-turn overrides within the session's native backend. */
3319
3334
  backend?: Partial<BackendConfig>;
3335
+ /** Router quote for a warm OpenCode turn with a total output ceiling. */
3336
+ managedQuoteVersion?: string;
3320
3337
  /** Exact caller-owned execution identity for canonical cancellation. */
3321
3338
  runControlRef?: AgentExactRunControlRef;
3322
3339
  parts: SessionMessageInputPart[];
@@ -3573,6 +3590,8 @@ interface DispatchedSession {
3573
3590
  interface ConversationTurnOptions {
3574
3591
  sessionId: string;
3575
3592
  turnId: string;
3593
+ /** Router quote included in the durable admission request. */
3594
+ managedQuoteVersion?: string;
3576
3595
  /** Per-turn backend, profile, runtime attachments, and interaction settings. */
3577
3596
  backend?: Partial<BackendConfig>;
3578
3597
  /** Model shorthand; conflicts with backend.model.model are rejected. */
@@ -5603,6 +5622,7 @@ interface PreviewLinkManager {
5603
5622
  * Create a preview link for a port.
5604
5623
  * Returns the preview link with its public URL.
5605
5624
  * If a link already exists for this port, returns the existing one.
5625
+ * `created` reports the host's atomic create decision for this request.
5606
5626
  *
5607
5627
  * @param port - Port number to expose (1-65535)
5608
5628
  * @param options - Optional protocol and metadata
@@ -5610,7 +5630,9 @@ interface PreviewLinkManager {
5610
5630
  create(port: number, options?: {
5611
5631
  protocol?: "tcp" | "udp";
5612
5632
  metadata?: Record<string, unknown>;
5613
- }): Promise<PreviewLinkInfo>;
5633
+ }): Promise<PreviewLinkInfo & {
5634
+ created: boolean;
5635
+ }>;
5614
5636
  /**
5615
5637
  * Refresh one link's public delivery status.
5616
5638
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox",
3
- "version": "0.55.3",
3
+ "version": "0.58.0",
4
4
  "description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -63,6 +63,11 @@
63
63
  "import": "./dist/intelligence/index.js",
64
64
  "types": "./dist/intelligence/index.d.ts",
65
65
  "default": "./dist/intelligence/index.js"
66
+ },
67
+ "./preview": {
68
+ "import": "./dist/agent/preview.js",
69
+ "types": "./dist/agent/preview.d.ts",
70
+ "default": "./dist/agent/preview.js"
66
71
  }
67
72
  },
68
73
  "files": [
@@ -137,11 +142,11 @@
137
142
  "vitest": "^4.1.5",
138
143
  "ws": "^8.20.0",
139
144
  "yjs": "13.6.30",
140
- "@tangle-network/agent-profile-materialize": "0.20.3",
141
- "@tangle-network/runtime-contracts": "0.8.2",
142
- "@tangle-network/sse-core": "0.0.0",
143
- "@tangle-network/cli-agent-registry": "0.4.10",
144
- "@repo/shared": "0.0.0"
145
+ "@repo/shared": "0.0.0",
146
+ "@tangle-network/agent-profile-materialize": "0.20.4",
147
+ "@tangle-network/cli-agent-registry": "0.4.13",
148
+ "@tangle-network/runtime-contracts": "0.10.0",
149
+ "@tangle-network/sse-core": "0.0.0"
145
150
  },
146
151
  "scripts": {
147
152
  "build": "node scripts/build-dist.mjs",
File without changes