@tangle-network/sandbox 0.60.78-develop.20261017134105.a6b32a2 → 0.60.78-develop.20261021212205.858a1d5

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 (66) hide show
  1. package/README.md +62 -0
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +5 -5
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/agent/preview.js +2 -2
  6. package/dist/{agent-run-outcome-CTEpjCEZ.d.ts → agent-run-outcome-brwJbH5S.d.ts} +1 -1
  7. package/dist/auth/index.d.ts +2 -2
  8. package/dist/auth/index.js +5 -5
  9. package/dist/{backend-types-D6bYbvMB.js → backend-types-CLvdSX8V.js} +41 -1
  10. package/dist/{browser-interactive-control-controller-rpTbyvAS.d.ts → browser-interactive-control-controller-CvObO_Kf.d.ts} +1 -1
  11. package/dist/{browser-interactive-control-controller-BJf0P_J4.js → browser-interactive-control-controller-DHx53yre.js} +16 -1
  12. package/dist/{chunked-upload-DtIvkKNo.js → chunked-upload-DN2twsUu.js} +2 -59
  13. package/dist/{chunked-upload-file-DnsHEjg0.js → chunked-upload-file-Dpv1YsoA.js} +2 -1
  14. package/dist/{cli-auth-bundle-cSJjPeFF.js → cli-auth-bundle-CFeHsq-5.js} +23 -11
  15. package/dist/{client-R1tw-4Px.js → client-CgtR203z.js} +3349 -3341
  16. package/dist/client-Dr8qasCR.d.ts +6076 -0
  17. package/dist/collaboration/index.d.ts +1 -1
  18. package/dist/collaboration/index.js +1 -1
  19. package/dist/{collaboration-DaJU5O0E.js → collaboration-g_HzXa6f.js} +5 -5
  20. package/dist/core.d.ts +7 -7
  21. package/dist/core.js +7 -6
  22. package/dist/direct-http2-Dar5erTH.js +99 -0
  23. package/dist/{errors-DSJBKmGZ.js → errors-BfbOP_rx.js} +171 -22
  24. package/dist/{index-DO7GVpk_.d.ts → index-C8VSFtWl.d.ts} +1 -1
  25. package/dist/{index-DZ27pdB8.d.ts → index-CVjTnRWP.d.ts} +1 -1
  26. package/dist/{sandbox-CoIGxzm_.d.ts → index-D5dVNm76.d.ts} +2117 -1519
  27. package/dist/index.d.ts +12 -4704
  28. package/dist/index.js +40 -15
  29. package/dist/intelligence/index.js +1 -1
  30. package/dist/interactive-control.d.ts +1 -1
  31. package/dist/interactive-control.js +1 -1
  32. package/dist/{interactive-controller-CJ24g8Va.js → interactive-controller-OAsASPd_.js} +662 -620
  33. package/dist/interactive-controller-nMhGqXxq.d.ts +41 -0
  34. package/dist/keep-alive-fetch-BBzJDWyt.js +247 -0
  35. package/dist/{lines-DodQslsf.d.ts → lines-C5CPSg8n.d.ts} +21 -17
  36. package/dist/lines-C5ER4aN_.js +298 -0
  37. package/dist/lines.d.ts +1 -1
  38. package/dist/lines.js +1 -295
  39. package/dist/{local-cli-auth-CBV7Vjk5.js → local-cli-auth-D-CQ0-ub.js} +1 -1
  40. package/dist/{mcp-local-DjryqUiY.js → mcp-local-BjLG7VHY.js} +1 -1
  41. package/dist/{preview-wpGGk0bu.d.ts → preview-COO7TSBk.d.ts} +3 -3
  42. package/dist/public-templates-BDrchm0J.d.ts +80 -0
  43. package/dist/public-templates.d.ts +2 -0
  44. package/dist/public-templates.js +173 -0
  45. package/dist/{raw-evidence-archive-Br5a3xZ_.js → raw-evidence-archive-CDYDqHNv.js} +161 -69
  46. package/dist/runtime.d.ts +49 -41
  47. package/dist/runtime.js +8 -8
  48. package/dist/{sandbox-C7Tk62qn.js → sandbox-BrZxAq11.js} +9048 -8939
  49. package/dist/{secp256k1-Dx2XABHz.js → secp256k1-CmLpsmWl.js} +1 -1
  50. package/dist/session-gateway/index.d.ts +23 -67
  51. package/dist/session-gateway/index.js +578 -451
  52. package/dist/tangle/index.d.ts +1 -1
  53. package/dist/tangle/index.js +1 -1
  54. package/dist/{tangle-Ba4Kz5zT.js → tangle-GiPBak5X.js} +176 -169
  55. package/dist/terminal-stream-types-ClZCArRg.d.ts +662 -0
  56. package/dist/{types-B_QF-iHm.d.ts → types-CtH0GRql.d.ts} +6161 -5812
  57. package/package.json +11 -6
  58. package/dist/client-Lhxo82x1.d.ts +0 -1261
  59. package/dist/errors-mPL-qvgF.d.ts +0 -347
  60. package/dist/index-DRto9Ijb.d.ts +0 -579
  61. package/dist/managed-process-B7WfqKmi.d.ts +0 -15
  62. package/dist/terminal-stream-jdYomM1m.d.ts +0 -389
  63. /package/dist/{cli-auth-bundle-ODe06Ts7.d.ts → cli-auth-bundle-Dyw3hCGx.d.ts} +0 -0
  64. /package/dist/{line-application-Cq6dJLBD.js → line-application-DY9ZTdgF.js} +0 -0
  65. /package/dist/{preview-operations-DqSo-IBm.js → preview-operations-Ca02vPDJ.js} +0 -0
  66. /package/dist/{utils-B7_9Hl_z.js → utils-BGvM02yJ.js} +0 -0
package/README.md CHANGED
@@ -31,6 +31,7 @@ export SANDBOX_BASE_URL=https://sandbox.tangle.tools
31
31
  | OpenAI-compatible request and event translation | `@tangle-network/sandbox/openai` |
32
32
  | Multiple managed Agents, framework tool packs, and the local MCP bridge | `@tangle-network/sandbox/agent` |
33
33
  | Browser-safe trace reads from Tangle Intelligence | `@tangle-network/sandbox/intelligence` |
34
+ | Browser-safe public template catalog and publication jobs (`PublicTemplatesClient`) | `@tangle-network/sandbox/public-templates` |
34
35
 
35
36
  Install an optional peer dependency only when the selected integration requires it.
36
37
  The Tangle quote digest, input-hash, and signature-validation helpers do not need `viem` at runtime.
@@ -110,6 +111,7 @@ try {
110
111
  Keep `delete()` in `finally` unless the sandbox must outlive the process.
111
112
  `delete()` answers once the sandbox is dead and billed; its container, volume and network are reclaimed behind the answer, and the acknowledgement reports `removal: "pending"`.
112
113
  The sandbox is already gone for every read at that point.
114
+ Deleted customer snapshot repositories, including their final snapshot, remain until their owner explicitly deletes them. Platform-managed repositories of internal-account boxes retire automatically after the deleted-retention window, subject to preservation holds and active exports/restores. The serving window comes from the storage owner; see [deleted repository retention](../../../docs/sandbox-lifecycle-reliability.md#deleted-snapshot-repository-retirement).
113
115
  Pass `await box.delete({ until: "removed" })` when you need the reclaim itself, for example before reusing the same host capacity in a test; it reports `removal: "complete"`, or `"pending"` if the wait runs out.
114
116
 
115
117
  To remove every sandbox that one job created, tag them with metadata at create time and delete them by prefix:
@@ -960,6 +962,8 @@ pnpm --filter @tangle-network/sandbox build
960
962
  pnpm --filter @tangle-network/sandbox verify-dist
961
963
  ```
962
964
 
965
+ Public type definitions live in `src/types/` by capability; `src/types.ts` preserves the existing import path. For a type split, run `node products/sandbox/sdk/scripts/check-type-capabilities.mjs <base-ref>` from the repository root to compare every moved declaration and report module sizes. Compare two emitted declaration trees with `node products/sandbox/sdk/scripts/verify-declarations.mjs <after-dist> --compare <before-dist>`. The report separates raw artifact bytes from declaration and import identity; it preserves JSDoc and overload order.
966
+
963
967
  ## License
964
968
 
965
969
  MIT
@@ -992,6 +996,64 @@ most 64 MiB of cumulative part text. Limits and incomplete snapshots never becom
992
996
  complete coverage. The dedicated Sidecar archive route is required; an older deployment
993
997
  returns an error without falling back to the aggregate `rawEvidence()` API.
994
998
 
999
+ To keep the HOME walk but leave the bytes of directories the harness downloads
1000
+ again on the box, name them in `omitContent`. Each file below one keeps its
1001
+ metadata, has `contentOmitted: true`, and has no `content` or `sha256`:
1002
+
1003
+ ```ts
1004
+ const evidence = await box.session(sessionId).exportRawEvidence(destination, {
1005
+ maxBytes: 4 * 1024 ** 3,
1006
+ maxFiles: 100_000,
1007
+ omitContent: [".codex/plugins/cache/", ".codex/cache/remote_plugin_catalog/"],
1008
+ });
1009
+ ```
1010
+
1011
+ The manifest lists the honoured prefixes in `omitContent`. A prefix that covers
1012
+ or enters the harness's native session store (for example `.codex/` or
1013
+ `.codex/sessions/`) answers 400, so the session itself always keeps its bytes.
1014
+ The SDK allows at most 64 prefixes of at most 512 characters each, and 8 KiB of
1015
+ encoded query. A Sidecar older than the option ignores it and sends every
1016
+ file's bytes, so keep `maxBytes` sized for the whole HOME until every Sidecar
1017
+ you reach serves this version.
1018
+
1019
+ To keep only the native session store, ask for the session copies alone:
1020
+
1021
+ ```ts
1022
+ const native = await box.session(sessionId).exportRawEvidence(destination, {
1023
+ maxBytes: 3 * 1024 ** 3,
1024
+ maxFiles: 100_000,
1025
+ copy: "latest",
1026
+ parts: "native",
1027
+ });
1028
+ // Each attempt's session files: native.manifest.nativeSessions[].files
1029
+ ```
1030
+
1031
+ `parts: "native"` requires `copy`. The archive then holds the manifest and the
1032
+ `nativeSessions` copies only: no event log, process stream or HOME walk, so `maxBytes`
1033
+ bounds the copies however large the session's logs have grown, and a copy larger
1034
+ than the bound still fails. The manifest names what was left out (`parts: "native"`,
1035
+ `status: "partial"`, `events_not_requested`, `process_io_not_requested`). A sidecar
1036
+ older than the option serves the full archive within the same bounds.
1037
+
1038
+ To keep every native session store on the box before deleting it, export the box:
1039
+
1040
+ ```ts
1041
+ const stores = await box.exportRawEvidence(destination, {
1042
+ maxBytes: 3 * 1024 ** 3,
1043
+ maxFiles: 100_000,
1044
+ });
1045
+ // Each runtime HOME's store files: stores.manifest.homes[].files
1046
+ // Each settled copy, with the HOME it came from: stores.manifest.nativeSessions[]
1047
+ ```
1048
+
1049
+ The box archive (`tangle.raw-evidence-archive.box.v1`) finds stores by walking the
1050
+ runtime HOMEs, not the session listing, so it also serves a box restored from a
1051
+ snapshot whose session listing is empty. It reads only files a harness contract
1052
+ declares as its session store (Claude Code projects, Codex rollouts, OpenCode's
1053
+ SQLite database, and the rest), never credentials or config. A HOME a running
1054
+ harness holds is copied without stopping it and marked `live`. It needs a token
1055
+ that is not bound to one session; a sidecar older than the route answers 404.
1056
+
995
1057
 
996
1058
  ### Prepared durable-plan follow-ups
997
1059
 
@@ -1,7 +1,7 @@
1
- import { g as SandboxSession, m as SandboxTaskSession, n as SandboxInstance } from "../sandbox-CoIGxzm_.js";
2
- import { D as CodeExecutionResult, E as CodeExecutionOptions, O as CodeLanguage, ai as SandboxFleetParent, bo as BackendType, ca as SessionInfo, d as BackendConfig, k as CodeResultPart, ua as SessionListOptions } from "../types-B_QF-iHm.js";
3
- import { i as Sandbox } from "../client-Lhxo82x1.js";
4
- import { u as PreviewAuthorizer } from "../preview-wpGGk0bu.js";
1
+ import { I as SandboxTaskSession, O as SandboxInstance, R as SandboxSession } from "../index-D5dVNm76.js";
2
+ import { Di as CodeResultPart, Ei as CodeExecutionResult, Sa as BackendConfig, Ti as CodeExecutionOptions, Ua as CodeLanguage, bn as SandboxFleetParent, vo as BackendType, xt as SessionListOptions, yt as SessionInfo } from "../types-CtH0GRql.js";
3
+ import { t as Sandbox } from "../client-Dr8qasCR.js";
4
+ import { u as PreviewAuthorizer } from "../preview-COO7TSBk.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-DjryqUiY.js";
2
- import { D as assertCurrentBackendType } from "../interactive-controller-CJ24g8Va.js";
3
- import { _ as StateError, b as ValidationError, d as NotFoundError } from "../errors-DSJBKmGZ.js";
4
- import { n as Sandbox } from "../client-R1tw-4Px.js";
5
- import { t as SandboxInstance } from "../sandbox-C7Tk62qn.js";
1
+ import { a as TOOL_SPECS, i as ALL_TOOL_SPECS, o as serializeToolResult, r as bindToolSpecs, t as createMcpServer } from "../mcp-local-BjLG7VHY.js";
2
+ import { D as assertCurrentBackendType } from "../interactive-controller-OAsASPd_.js";
3
+ import { S as StateError, T as ValidationError, h as NotFoundError } from "../errors-BfbOP_rx.js";
4
+ import { t as Sandbox } from "../client-CgtR203z.js";
5
+ import { t as SandboxInstance } from "../sandbox-BrZxAq11.js";
6
6
  import { z } from "zod";
7
7
  //#region src/agent/instances.ts
8
8
  const managers = /* @__PURE__ */ new WeakMap();
@@ -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-wpGGk0bu.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-COO7TSBk.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 { a as listAgentPreviews, c as resolveSelfSandbox, i as getAgentPreview, n as assertPreviewId, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "../preview-operations-DqSo-IBm.js";
1
+ import { a as listAgentPreviews, c as resolveSelfSandbox, i as getAgentPreview, n as assertPreviewId, o as publishAgentPreview, r as ensureAgentPreview, s as removeAgentPreview, t as AgentPreviewError } from "../preview-operations-Ca02vPDJ.js";
2
2
  import { agentProfileSchema } from "@tangle-network/agent-interface";
3
3
  //#region src/agent/preview-policy.ts
4
4
  /** Channel-neutral preview tool selection from a host-authored profile. */
@@ -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-DjryqUiY.js").then((n) => n.n), import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js")]);
69
+ const [{ createMcpServer }, { WebStandardStreamableHTTPServerTransport }] = await Promise.all([import("../mcp-local-BjLG7VHY.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,4 +1,4 @@
1
- import { Br as SandboxEvent, a as AgentQuestionRequest, i as AgentApprovalRequirement, o as AgentRunStatus, s as AgentToolInvocation, ut as DurablePlanSnapshot } from "./types-B_QF-iHm.js";
1
+ import { Ji as AgentApprovalRequirement, Xi as AgentRunStatus, Yi as AgentQuestionRequest, Zi as AgentToolInvocation, pa as SandboxEvent, ra as DurablePlanSnapshot } from "./types-CtH0GRql.js";
2
2
  import { InteractionRequest } from "@tangle-network/agent-interface";
3
3
 
4
4
  //#region src/agent-run-outcome.d.ts
@@ -1,3 +1,3 @@
1
- import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema, t as CliAuthReference } from "../cli-auth-bundle-ODe06Ts7.js";
2
- import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-DO7GVpk_.js";
1
+ import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema, t as CliAuthReference } from "../cli-auth-bundle-Dyw3hCGx.js";
2
+ import { _ as ReadTokenPayload, a as issueCollaborationToken, c as issueSessionScopedToken, d as AnyTokenPayload, f as BatchScopedTokenPayload, g as ProjectScopedTokenPayload, h as IssueCollaborationTokenOptions, i as issueBatchScopedToken, l as unsafeDecodeToken, m as CollaborationTokenPayload, n as getTokenTTL, o as issueProjectScopedToken, p as CollaborationAccess, r as isTokenExpiringSoon, s as issueReadToken, t as ProductTokenIssuer, u as verifyToken, v as SessionScopedTokenPayload, y as TokenScope } from "../index-C8VSFtWl.js";
3
3
  export { AnyTokenPayload, BatchScopedTokenPayload, CliAuthReference, CollaborationAccess, CollaborationTokenPayload, IssueCollaborationTokenOptions, ProductTokenIssuer, ProjectScopedTokenPayload, ReadTokenPayload, SessionScopedTokenPayload, TokenScope, assertCliAuthReferenceSupported, cliAuthReferenceSchema, getTokenTTL, isTokenExpiringSoon, issueBatchScopedToken, issueCollaborationToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, materializeCliAuthBundle, unsafeDecodeToken, verifyToken };
@@ -1,4 +1,4 @@
1
- import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-cSJjPeFF.js";
1
+ import { i as materializeCliAuthBundle, n as assertCliAuthReferenceSupported, r as cliAuthReferenceSchema } from "../cli-auth-bundle-CFeHsq-5.js";
2
2
  //#region src/auth/tokens.ts
3
3
  const textEncoder = new TextEncoder();
4
4
  const textDecoder = new TextDecoder();
@@ -258,11 +258,11 @@ function isTokenExpiringSoon(payload, bufferSeconds = 60) {
258
258
  */
259
259
  var ProductTokenIssuer = class {
260
260
  productId;
261
- signingSecret;
261
+ #signingSecret;
262
262
  ttlMinutes;
263
263
  constructor(config) {
264
264
  this.productId = config.productId;
265
- this.signingSecret = config.signingSecret;
265
+ this.#signingSecret = config.signingSecret;
266
266
  this.ttlMinutes = {
267
267
  free: config.ttlMinutes?.free ?? 15,
268
268
  pro: config.ttlMinutes?.pro ?? 240,
@@ -275,7 +275,7 @@ var ProductTokenIssuer = class {
275
275
  issue(params) {
276
276
  const tier = params.tier ?? "free";
277
277
  const ttl = this.ttlMinutes[tier] ?? this.ttlMinutes.free;
278
- const token = issueReadToken(this.signingSecret, {
278
+ const token = issueReadToken(this.#signingSecret, {
279
279
  sub: params.userId,
280
280
  sid: params.sessionId,
281
281
  pid: this.productId,
@@ -294,7 +294,7 @@ var ProductTokenIssuer = class {
294
294
  issueCollaboration(params) {
295
295
  const tier = params.tier ?? "free";
296
296
  const ttl = this.ttlMinutes[tier] ?? this.ttlMinutes.free;
297
- const token = issueCollaborationToken(this.signingSecret, {
297
+ const token = issueCollaborationToken(this.#signingSecret, {
298
298
  userId: params.userId,
299
299
  sessionId: params.sessionId,
300
300
  productId: this.productId,
@@ -30,6 +30,12 @@ const BACKEND_TYPE = {
30
30
  /** Stable declaration order; registry tests check the shipped spec composition. */
31
31
  const ALL_BACKEND_TYPES = Object.values(BACKEND_TYPE);
32
32
  const backendTypeSchema = z.enum(ALL_BACKEND_TYPES);
33
+ /**
34
+ * `backend.metadata.isolationPrincipal`: the opaque, stable id of the member a
35
+ * secret-isolated session's turns run for, never a credential. Turns of one
36
+ * session, principal and profile authority share one OS identity.
37
+ */
38
+ const isolationPrincipalSchema = z.string().regex(/^[A-Za-z0-9_.:@-]{1,256}$/);
33
39
  const BACKEND_TYPE_SET = new Set(ALL_BACKEND_TYPES);
34
40
  function isBackendType(value) {
35
41
  return BACKEND_TYPE_SET.has(value);
@@ -38,5 +44,39 @@ function parseBackendType(value) {
38
44
  if (!isBackendType(value)) throw new Error(`Unknown backend type "${value}". Expected one of: ${ALL_BACKEND_TYPES.join(", ")}`);
39
45
  return value;
40
46
  }
47
+ const SOURCES = [
48
+ "request",
49
+ "environment",
50
+ "profile"
51
+ ];
52
+ function nonEmpty(value) {
53
+ return typeof value === "string" && value.length > 0 ? value : void 0;
54
+ }
55
+ function normalizeProfile(value) {
56
+ if (!value || typeof value !== "object") return void 0;
57
+ const raw = value;
58
+ const digest = nonEmpty(raw.digest);
59
+ if (!digest) return void 0;
60
+ const name = nonEmpty(raw.name);
61
+ return {
62
+ ...name ? { name } : {},
63
+ digest
64
+ };
65
+ }
66
+ function normalizeEffectiveBackend(value) {
67
+ if (!value || typeof value !== "object") return void 0;
68
+ const raw = value;
69
+ const provider = nonEmpty(raw.provider);
70
+ const model = nonEmpty(raw.model);
71
+ const profile = normalizeProfile(raw.profile);
72
+ if (!provider && !model && !profile) return void 0;
73
+ const source = nonEmpty(raw.source);
74
+ return {
75
+ ...provider ? { provider } : {},
76
+ ...model ? { model } : {},
77
+ ...source && SOURCES.includes(source) ? { source } : {},
78
+ ...profile ? { profile } : {}
79
+ };
80
+ }
41
81
  //#endregion
42
- export { parseBackendType as i, BACKEND_TYPE as n, backendTypeSchema as r, ALL_BACKEND_TYPES as t };
82
+ export { normalizeEffectiveBackend as a, isolationPrincipalSchema as i, BACKEND_TYPE as n, parseBackendType as o, backendTypeSchema as r, ALL_BACKEND_TYPES as t };
@@ -1,4 +1,4 @@
1
- import { o as TerminalStreamHandlers } from "./terminal-stream-jdYomM1m.js";
1
+ import { i as TerminalStreamHandlers } from "./terminal-stream-types-ClZCArRg.js";
2
2
  import { AgentInteractiveSessionAttach, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionStatus } from "@tangle-network/agent-interface";
3
3
  import { AgentInteractiveSessionControlClaim as AgentInteractiveSessionControlClaim$1, AgentInteractiveSessionControlClaimRequest as AgentInteractiveSessionControlClaimRequest$1, AgentInteractiveSessionRef as AgentInteractiveSessionRef$1 } from "@tangle-network/agent-interface/environment-interactive-control";
4
4
 
@@ -59,6 +59,21 @@ function awaitWithAbort(work, signal) {
59
59
  });
60
60
  });
61
61
  }
62
+ const delayUntilAborted = (ms, signal) => new Promise((resolve, reject) => {
63
+ if (signal?.aborted) {
64
+ reject(signal.reason ?? /* @__PURE__ */ new Error("aborted"));
65
+ return;
66
+ }
67
+ const timer = setTimeout(() => {
68
+ signal?.removeEventListener("abort", onAbort);
69
+ resolve();
70
+ }, ms);
71
+ function onAbort() {
72
+ clearTimeout(timer);
73
+ reject(signal?.reason ?? /* @__PURE__ */ new Error("aborted"));
74
+ }
75
+ signal?.addEventListener("abort", onAbort, { once: true });
76
+ });
62
77
  //#endregion
63
78
  //#region src/interactive-control-controller.ts
64
79
  /** A status response that cannot admit a terminal control claim. */
@@ -318,4 +333,4 @@ function browserInteractiveControlHolderId(environmentId, sessionId, incarnation
318
333
  }
319
334
  }
320
335
  //#endregion
321
- export { INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS as a, assertInteractiveSessionRef as c, awaitWithAbort as d, combineAbortSignals as f, interactiveSessionStatusResponseSchema as g, interactiveSessionControlValidationResponseSchema as h, createBrowserInteractiveSessionControlTransport as i, createInteractiveControlHolderId as l, interactiveSessionControlReleaseResponseSchema as m, browserInteractiveControlHolderId as n, InteractiveSessionControlController as o, interactiveSessionControlClaimResponseSchema as p, browserInteractiveTerminalEndpoint as r, InteractiveSessionNotRunningError as s, BrowserInteractiveSessionControlController as t, interactiveSessionIdentityDigest as u };
336
+ export { interactiveSessionStatusResponseSchema as _, INTERACTIVE_CONTROL_CLEANUP_TIMEOUT_MS as a, assertInteractiveSessionRef as c, awaitWithAbort as d, combineAbortSignals as f, interactiveSessionControlValidationResponseSchema as g, interactiveSessionControlReleaseResponseSchema as h, createBrowserInteractiveSessionControlTransport as i, createInteractiveControlHolderId as l, interactiveSessionControlClaimResponseSchema as m, browserInteractiveControlHolderId as n, InteractiveSessionControlController as o, delayUntilAborted as p, browserInteractiveTerminalEndpoint as r, InteractiveSessionNotRunningError as s, BrowserInteractiveSessionControlController as t, interactiveSessionIdentityDigest as u };
@@ -1,61 +1,4 @@
1
- import { g as ServerError, h as SandboxError, p as QuotaError, u as NetworkError, x as parseErrorResponse, y as TimeoutError } from "./errors-DSJBKmGZ.js";
2
- //#region ../../../packages/runtime-contracts/dist/file-limits.js
3
- const MEBIBYTE$1 = 1024 * 1024;
4
- 10 * MEBIBYTE$1;
5
- const FILE_DECODED_WRITE_MAX_BYTES = 5 * MEBIBYTE$1;
6
- 5 * MEBIBYTE$1;
7
- 10 * MEBIBYTE$1;
8
- 5 * MEBIBYTE$1;
9
- //#endregion
10
- //#region ../../../packages/runtime-contracts/dist/request-limits.js
11
- /**
12
- * Raw WIRE/TRANSPORT caps: request-byte limits checked while the body
13
- * streams in (bodyLimit middleware, Content-Length, encoded proxy bodies),
14
- * before anything is parsed or decoded. Rejections against these carry
15
- * code `PAYLOAD_TOO_LARGE` (`payload-too-large.ts`) — the remedy is to
16
- * split the delivery. Decoded/parsed-content caps (code `FILE_TOO_LARGE`)
17
- * live in `file-io.ts`.
18
- */
19
- const MEBIBYTE = 1024 * 1024;
20
- /**
21
- * Gateway (CF Worker) proxy cap on any request body it forwards — both
22
- * pass-through requests and route-constructed (`options.body`) proxy
23
- * payloads. Workers buffer forwarded bodies (streaming upstream stalls),
24
- * so this bounds Worker memory per request.
25
- */
26
- const SANDBOX_PROXY_REQUEST_MAX_BYTES = MEBIBYTE;
27
- 32 * MEBIBYTE;
28
- /**
29
- * Max assembled size of one chunked-upload session — the ceiling of the
30
- * sanctioned >1 MiB delivery path. Parts stage in sidecar memory until
31
- * commit, so this bounds per-session memory, not the destination
32
- * filesystem.
33
- */
34
- const FILE_UPLOAD_SESSION_MAX_BYTES = 64 * MEBIBYTE;
35
- 128 * MEBIBYTE;
36
- //#endregion
37
- //#region ../../../packages/runtime-contracts/dist/size-limit-errors.js
38
- /** Canonical error codes for wire-size and decoded-content rejections. */
39
- const PAYLOAD_TOO_LARGE_CODE = "PAYLOAD_TOO_LARGE";
40
- const FILE_TOO_LARGE_CODE = "FILE_TOO_LARGE";
41
- function isRecord(value) {
42
- return value !== null && typeof value === "object" && !Array.isArray(value);
43
- }
44
- function isPositiveInteger(value) {
45
- return typeof value === "number" && Number.isInteger(value) && value > 0;
46
- }
47
- function isSizeLimitErrorBodyFor(value, code) {
48
- if (!isRecord(value) || value.success !== false || !isRecord(value.error)) return false;
49
- const error = value.error;
50
- return error.code === code && typeof error.message === "string" && typeof error.surface === "string" && isPositiveInteger(error.limitBytes) && (error.actualBytes === void 0 || isPositiveInteger(error.actualBytes));
51
- }
52
- function isPayloadTooLargeErrorBody(value) {
53
- return isSizeLimitErrorBodyFor(value, PAYLOAD_TOO_LARGE_CODE);
54
- }
55
- function isFileTooLargeErrorBody(value) {
56
- return isSizeLimitErrorBodyFor(value, FILE_TOO_LARGE_CODE);
57
- }
58
- //#endregion
1
+ import { D as isPayloadTooLargeErrorBody, E as isFileTooLargeErrorBody, O as FILE_UPLOAD_SESSION_MAX_BYTES, b as SandboxError, m as NetworkError, n as parseErrorResponse, v as QuotaError, w as TimeoutError, x as ServerError } from "./errors-BfbOP_rx.js";
59
2
  //#region src/lib/chunked-upload.ts
60
3
  /**
61
4
  * Chunked upload — the sanctioned SDK path for delivering payloads larger
@@ -432,4 +375,4 @@ var ChunkedUploadInterruptedError = class extends Error {
432
375
  }
433
376
  };
434
377
  //#endregion
435
- export { planCompression as a, FILE_UPLOAD_SESSION_MAX_BYTES as c, partCount as i, SANDBOX_PROXY_REQUEST_MAX_BYTES as l, commitSession as n, putPart as o, initUploadSession as r, uploadChunked as s, abortSession as t, FILE_DECODED_WRITE_MAX_BYTES as u };
378
+ export { planCompression as a, partCount as i, commitSession as n, putPart as o, initUploadSession as r, uploadChunked as s, abortSession as t };
@@ -1,4 +1,5 @@
1
- import { a as planCompression, c as FILE_UPLOAD_SESSION_MAX_BYTES, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-DtIvkKNo.js";
1
+ import { O as FILE_UPLOAD_SESSION_MAX_BYTES } from "./errors-BfbOP_rx.js";
2
+ import { a as planCompression, i as partCount, n as commitSession, o as putPart, r as initUploadSession, t as abortSession } from "./chunked-upload-DN2twsUu.js";
2
3
  import { createHash } from "node:crypto";
3
4
  import { open } from "node:fs/promises";
4
5
  //#region src/lib/chunked-upload-file.ts
@@ -1,22 +1,22 @@
1
- import { n as BACKEND_TYPE } from "./backend-types-D6bYbvMB.js";
1
+ import { n as BACKEND_TYPE } from "./backend-types-CLvdSX8V.js";
2
2
  import { z } from "zod";
3
3
  import { agentProfileJsonSchema, agentProfileSchema as agentProfileSchema$1 } from "@tangle-network/agent-interface";
4
4
  import "@tangle-network/agent-interface/harness-capabilities";
5
- //#region ../../../packages/cli-agent-registry/dist/native-session-contracts-BgDTDx5F.mjs
5
+ //#region ../../../packages/cli-agent-registry/dist/native-session-contracts-CddywaKf.mjs
6
6
  /** The CLI version infra/nix ships for each registered harness. */
7
7
  const HARNESS_CLI_VERSIONS = {
8
- "claude-code": "2.1.296",
8
+ "claude-code": "2.1.306",
9
9
  codex: "0.162.1",
10
- opencode: "1.18.35",
11
- pi: "1.1.0",
10
+ opencode: "1.19.3",
11
+ pi: "1.3.0",
12
12
  "kimi-code": "1.49.0",
13
- "factory-droids": "0.240.0",
14
- amp: "0.0.1791633643-g895a91",
13
+ "factory-droids": "0.245.1",
14
+ amp: "0.0.1792584044-g15483c",
15
15
  prime: "0.7.2",
16
- hermes: "0.21.6",
16
+ hermes: "0.22.3",
17
17
  forge: "2.14.0",
18
18
  openclaw: "2026.7.1-2",
19
- acp: "claude-agent-acp 0.89.1; codex-acp 0.16.0; gemini-cli 0.63.0"
19
+ acp: "claude-agent-acp 0.94.0; codex-acp 0.16.0; gemini-cli 0.65.0"
20
20
  };
21
21
  const CLAUDE_PROJECTS = {
22
22
  root: ".claude/projects",
@@ -32,6 +32,18 @@ const CODEX_ROLLOUTS = {
32
32
  shared: false,
33
33
  format: "codex.rollout-jsonl"
34
34
  };
35
+ /**
36
+ * Rollouts codex moved out of `sessions/` when a thread was archived: the same
37
+ * transcript, flat under `archived_sessions/`. Without it an archived
38
+ * session is no store's, so no copy, capture or export carries it.
39
+ */
40
+ const CODEX_ARCHIVED_ROLLOUTS = {
41
+ root: ".codex/archived_sessions",
42
+ files: ["rollout-*-{id}.jsonl"],
43
+ write: "jsonl-append",
44
+ shared: false,
45
+ format: "codex.rollout-jsonl"
46
+ };
35
47
  const GEMINI_CHATS = {
36
48
  root: ".gemini/tmp",
37
49
  files: ["*/chats/session-*{id}*.json"],
@@ -308,7 +320,7 @@ var codex_default = {
308
320
  },
309
321
  contract: {
310
322
  version: 1,
311
- stores: [CODEX_ROLLOUTS],
323
+ stores: [CODEX_ROLLOUTS, CODEX_ARCHIVED_ROLLOUTS],
312
324
  identity: {
313
325
  kind: "first-event",
314
326
  event: "thread.started",
@@ -1028,7 +1040,7 @@ const NATIVE_SESSION_CONTRACTS = {
1028
1040
  HARNESSES["kimi-code"].session.defect.reason, HARNESSES["factory-droids"].session.defect.reason, HARNESSES["amp"].session.defect.reason, HARNESSES["prime"].session.defect.reason, HARNESSES["hermes"].session.defect.reason, HARNESSES["forge"].session.defect.reason, HARNESSES["openclaw"].session.defect.reason, HARNESSES["acp"].session.defect.reason;
1029
1041
  HARNESSES["nanoclaw"].session.defect.reason, HARNESSES["cursor"].session.defect.reason;
1030
1042
  //#endregion
1031
- //#region ../../../packages/cli-agent-registry/dist/specs-CY_P6D0s.mjs
1043
+ //#region ../../../packages/cli-agent-registry/dist/specs-DvgpCrPk.mjs
1032
1044
  z.globalRegistry.add(agentProfileSchema$1, {
1033
1045
  id: "AgentProfile",
1034
1046
  ...agentProfileJsonSchema