@tangle-network/agent-provider-tangle 3.6.5 → 3.6.7

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.
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # @tangle-network/agent-provider-tangle
2
2
 
3
3
  Wraps `@tangle-network/sandbox` as an `AgentEnvironmentProvider`.
4
- The Sandbox peer range is `>=0.58.7 <1.0.0`.
5
- The floor includes native credential reference validation, per-container capability parsing, and runtime MCP transport.
4
+ The Sandbox peer range is `>=0.60.27 <1.0.0`; the minimum version exports the shared terminal projection.
5
+
6
+ Terminal `result` and `done` events use the Sandbox SDK's `projectAgentTerminalRecord` summary. Cumulative tool history stays in native evidence; bounded approval identity survives projection, and malformed or conflicting approval sources fail closed. Terminal events omit the duplicate raw `providerEvent` payload.
7
+
8
+ Per-turn backend options use the SDK's `normalizeRuntimeBackendConfig` for current model/auth fields and turn-scoped `runtimeSecrets`. Unknown options remain rejected, and native credentials still require the exact profile's subscription intent. Retained request identity excludes credential values, matching Sandbox message admission; Sandbox separately keys the executing backend by secret values so rotation cannot reuse stale authority.
6
9
 
7
10
  Runtime MCP bindings travel through `CreateAgentEnvironmentInput.runtimeAttachments` to Sandbox's `backend.runtimeAttachments`.
8
11
  They remain separate from the authored profile and its digest.
@@ -1,6 +1,8 @@
1
1
  import { type BackendType, type CreateSandboxOptions } from "@tangle-network/sandbox";
2
2
  import type { CreateAgentEnvironmentInput, WorkspaceRequest } from "@tangle-network/agent-interface/environment-provider";
3
3
  import type { TangleModelCredentials } from "./tangle-types.js";
4
+ /** Immutable create evidence used to bind a later native resume to its restored snapshot. */
5
+ export declare const NATIVE_RESUME_CHECKPOINT_METADATA_KEY = "tangleNativeResumeCheckpointId";
4
6
  export declare function captureModelCredentials(value: TangleModelCredentials | undefined): TangleModelCredentials | undefined;
5
7
  export declare function sandboxOptionsFromCreateInput(input: CreateAgentEnvironmentInput, defaultBackend?: BackendType, parsedWorkspace?: WorkspaceRequest, modelCredentials?: TangleModelCredentials, subscriptionSelection?: boolean): CreateSandboxOptions;
6
8
  /**
@@ -5,6 +5,8 @@ import { assertBoundedJson, boundedIdentifier, boundedString, MAX_ARRAY_LENGTH,
5
5
  import { profileCredentialSource } from "./model-credential-source.js";
6
6
  import { sandboxResourcesFromResourceRequest } from "./tangle-resources.js";
7
7
  import { tangleRuntimeAttachments } from "./tangle-runtime-attachments.js";
8
+ /** Immutable create evidence used to bind a later native resume to its restored snapshot. */
9
+ export const NATIVE_RESUME_CHECKPOINT_METADATA_KEY = "tangleNativeResumeCheckpointId";
8
10
  export function captureModelCredentials(value) {
9
11
  if (value === undefined)
10
12
  return undefined;
@@ -78,9 +80,16 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
78
80
  if (recordsCredential && Object.hasOwn(input.metadata ?? {}, "modelCredentials")) {
79
81
  throw new Error("Tangle credential selection owns metadata.modelCredentials");
80
82
  }
81
- const metadata = recordsCredential
82
- ? { ...input.metadata, modelCredentials }
83
- : input.metadata;
83
+ if (Object.hasOwn(input.metadata ?? {}, NATIVE_RESUME_CHECKPOINT_METADATA_KEY)) {
84
+ throw new Error("Tangle owns the native resume checkpoint metadata");
85
+ }
86
+ const metadata = {
87
+ ...input.metadata,
88
+ ...(recordsCredential ? { modelCredentials } : {}),
89
+ ...(workspace.checkpoint === undefined ? {} : {
90
+ [NATIVE_RESUME_CHECKPOINT_METADATA_KEY]: boundedIdentifier(workspace.checkpoint.checkpointId, "Tangle native resume checkpoint id"),
91
+ }),
92
+ };
84
93
  if (input.providerOptions && Object.keys(input.providerOptions).length > 0) {
85
94
  throw new Error("Tangle create providerOptions are not supported");
86
95
  }
@@ -137,7 +146,7 @@ export function sandboxOptionsFromCreateInput(input, defaultBackend, parsedWorks
137
146
  ...(Array.isArray(secrets) ? { secrets } : {}),
138
147
  ...(input.egress === undefined ? {} : { egressPolicy: sandboxEgressPolicy(input.egress) }),
139
148
  ...(input.billingOwner === undefined ? {} : { billingOwnerId: input.billingOwner }),
140
- ...(metadata ? { metadata } : {}),
149
+ ...(Object.keys(metadata).length > 0 ? { metadata } : {}),
141
150
  ...(input.name === undefined ? {} : { name: input.name }),
142
151
  ...(input.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),
143
152
  backend: {
@@ -12,6 +12,7 @@ export interface DeploymentCapabilitySupport {
12
12
  /** The selected runtime explicitly supports named native credential references. */
13
13
  readonly cliAuthReferences: boolean;
14
14
  readonly claudeTokenContinuations: boolean;
15
+ readonly codexCredentialContinuations: boolean;
15
16
  /**
16
17
  * Run requests carry the caller's exact `runControlRef`, and admission
17
18
  * echoes the executionId. Detached dispatch needs both: it sends the
@@ -11,6 +11,7 @@ import { awaitWithSignal } from "./tangle-contract-safety.js";
11
11
  export const UNPROVEN_DEPLOYMENT = {
12
12
  cliAuthReferences: false,
13
13
  claudeTokenContinuations: false,
14
+ codexCredentialContinuations: false,
14
15
  exactDispatch: false,
15
16
  canonicalCancellation: false,
16
17
  eventReplay: false,
@@ -36,6 +37,7 @@ export const UNPROVEN_DEPLOYMENT = {
36
37
  export const ADAPTER_CEILING_DEPLOYMENT = {
37
38
  cliAuthReferences: true,
38
39
  claudeTokenContinuations: true,
40
+ codexCredentialContinuations: true,
39
41
  exactDispatch: true,
40
42
  canonicalCancellation: true,
41
43
  eventReplay: true,
@@ -53,6 +55,7 @@ export function deploymentCapabilitySupport(document) {
53
55
  return {
54
56
  cliAuthReferences: document.cliAuthReferences === true,
55
57
  claudeTokenContinuations: document.claudeTokenContinuations === true,
58
+ codexCredentialContinuations: document.codexCredentialContinuations === true,
56
59
  exactDispatch: document.dispatch?.runControlRef === true &&
57
60
  document.dispatch?.executionIdOnAdmission === true,
58
61
  canonicalCancellation: document.cancel?.canonicalRunCancellation === true &&
@@ -1,6 +1,6 @@
1
1
  import { assertCliAuthReferenceSupported } from "@tangle-network/sandbox/auth";
2
2
  import { canonicalCandidateDigest } from "@tangle-network/agent-interface";
3
- import { captureModelCredentials } from "./tangle-create-options.js";
3
+ import { captureModelCredentials, NATIVE_RESUME_CHECKPOINT_METADATA_KEY } from "./tangle-create-options.js";
4
4
  import { AgentTurnInputSchema, deepFreeze } from "@tangle-network/agent-interface";
5
5
  import { AgentEnvironmentCapabilitiesSchema } from "@tangle-network/agent-interface/environment-provider";
6
6
  import { environmentEventFromSandboxEvent } from "./tangle-events.js";
@@ -101,6 +101,16 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
101
101
  const usageLog = createExecutionUsageLog();
102
102
  const assertCaptureInput = (input) => {
103
103
  const backend = promptOptionsFromTurnInput(input, { provider: providerName, environmentId }).backend;
104
+ if (input.nativeResume !== undefined) {
105
+ const checkpointId = box.metadata?.[NATIVE_RESUME_CHECKPOINT_METADATA_KEY];
106
+ const harness = backend?.type ?? backend?.profile?.harness;
107
+ if (checkpointId !== input.nativeResume.sourceCheckpointId ||
108
+ harness !== input.nativeResume.harness ||
109
+ (backend?.profile?.harness !== undefined && backend.profile.harness !== harness) ||
110
+ nativeReference === undefined || boundCredentialSource !== "subscription") {
111
+ throw new Error("Tangle native resume requires the exact restored checkpoint, harness, and selected subscription credential");
112
+ }
113
+ }
104
114
  const turnSource = backend?.profile === undefined ? undefined : profileCredentialSource(backend.profile);
105
115
  if (turnSource !== undefined && turnSource !== boundCredentialSource) {
106
116
  throw new Error("Tangle turn credential source differs from its environment; create a separate environment for that profile");
@@ -146,13 +156,18 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
146
156
  let selectedReference = nativeReference;
147
157
  // Exact reads retain the admitted execution. A new operation obtains a new durable
148
158
  // account-owner binding; retries of that operation present the same key after restart.
149
- // Per-turn account selection exists for Claude setup tokens, whose named-grant continuation
150
- // Sandbox proves. Other harnesses keep the account selected at creation, whose admission
151
- // already covered the run deadline.
152
- if (!replay && request?.resolveModelCredentials !== undefined && harness === "claude-code") {
153
- if (!deployment.claudeTokenContinuations || box.grantNativeCredential === undefined ||
154
- nativeReference.format !== "token") {
155
- throw new Error("Tangle fresh subscription turns require proven Claude token continuation and named-grant support");
159
+ // Native subscription turns can change accounts only when the serving image proves
160
+ // a named grant that preserves this harness's private session HOME.
161
+ if (!replay && request?.resolveModelCredentials !== undefined &&
162
+ (harness === "claude-code" || harness === "codex")) {
163
+ const supported = harness === "claude-code"
164
+ ? deployment.claudeTokenContinuations && nativeReference.format === "token"
165
+ : deployment.codexCredentialContinuations &&
166
+ (nativeReference.format === "bundle" || nativeReference.format === "files");
167
+ if (!supported || box.grantNativeCredential === undefined) {
168
+ throw new Error(harness === "claude-code"
169
+ ? "Tangle fresh subscription turns require proven Claude token continuation and named-grant support"
170
+ : "Tangle fresh subscription turns require proven Codex credential continuation and named-grant support");
156
171
  }
157
172
  const profile = backend?.profile;
158
173
  if (profile === undefined || profileCredentialSource(profile) !== "subscription") {
@@ -173,8 +188,11 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
173
188
  }),
174
189
  ...(input.signal ? { signal: input.signal } : {}),
175
190
  }))), input.signal));
176
- if (selected === undefined || !("cliAuth" in selected) || selected.cliAuth.format !== "token") {
177
- throw new Error("Tangle subscription turn resolver must select a stored Claude token reference");
191
+ if (selected === undefined || !("cliAuth" in selected) ||
192
+ (harness === "claude-code"
193
+ ? selected.cliAuth.format !== "token"
194
+ : selected.cliAuth.format !== "bundle" && selected.cliAuth.format !== "files")) {
195
+ throw new Error(`Tangle subscription turn resolver must select a stored ${harness} native reference`);
178
196
  }
179
197
  selectedReference = selected.cliAuth;
180
198
  assertCliAuthReferenceSupported(harness, { ...model, cliAuth: selectedReference });
@@ -1,7 +1,7 @@
1
1
  import { CanonicalStreamEventSchema, boundedEventContentRecordSchema, } from "@tangle-network/agent-interface";
2
2
  import { optionalNonEmptyString } from "./tangle-environment-values.js";
3
3
  import { tokenUsageFromData } from "./tangle-result-values.js";
4
- import { sandboxTerminalProjection } from "./tangle-prompt.js";
4
+ import { projectAgentTerminalRecord } from "@tangle-network/sandbox/runtime";
5
5
  /** The sidecar sends this envelope when an SSE connection is ready. */
6
6
  export function isSandboxConnectionMarker(event) {
7
7
  if (!event || typeof event !== "object")
@@ -136,9 +136,8 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
136
136
  }
137
137
  const terminal = record.type === "result" || record.type === "done";
138
138
  const sourceData = record.data;
139
- const projected = terminal && Object.hasOwn(sourceData, "toolInvocations");
140
- const data = projected ? sandboxTerminalProjection(sourceData) : sourceData;
141
- assertBoundedRecord(projected ? { ...record, data } : record);
139
+ const data = terminal ? projectAgentTerminalRecord(sourceData) : sourceData;
140
+ assertBoundedRecord(terminal ? { ...record, data } : record);
142
141
  if (Object.prototype.hasOwnProperty.call(data, "contextTransferReceipt")) {
143
142
  throw new Error("Tangle Sandbox emitted an unsolicited context transfer receipt");
144
143
  }
@@ -195,7 +194,7 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
195
194
  ...(usageMode === undefined ? {} : { usageMode }),
196
195
  // A terminal projection is not the complete native event. The source is
197
196
  // available through exact session/execution evidence, including tool history.
198
- ...(!projected ? { providerEvent: event } : {}),
197
+ ...(!terminal ? { providerEvent: event } : {}),
199
198
  };
200
199
  }
201
200
  function normalizeSandboxEvent(type, data, identity) {
@@ -20,6 +20,8 @@ export interface PreparedNativeEvidence {
20
20
  directory?: string;
21
21
  remove(): Promise<void>;
22
22
  }
23
+ export declare const MAX_METADATA_BYTES: number;
24
+ export declare const MAX_RECORD_BYTES: number;
23
25
  /** Exact receipt validation is repeated while consuming, so a later local mutation fails capture. */
24
26
  export declare function nativePayloadChunks(directory: string, ref: NativePayloadFile, signal?: AbortSignal): AsyncIterable<Uint8Array>;
25
27
  /** The new route must never fall back to the legacy aggregate JSON request. */
@@ -5,8 +5,10 @@ import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { EvidenceJsonArray } from "./tangle-evidence-json.js";
7
7
  const MAX_ENTRIES = 100_000;
8
- const MAX_METADATA_BYTES = 32 * 1024 * 1024;
9
- const MAX_RECORD_BYTES = 16 * 1024 * 1024;
8
+ // Match the shipped Sandbox archive reader: a valid producer manifest or NDJSON
9
+ // record must not be rejected after capture solely by this consumer's bound.
10
+ export const MAX_METADATA_BYTES = 64 * 1024 * 1024;
11
+ export const MAX_RECORD_BYTES = 16 * 1024 * 1024;
10
12
  function record(value) {
11
13
  if (!value || typeof value !== "object" || Array.isArray(value))
12
14
  throw new Error("Tangle native export metadata is malformed");
@@ -9,7 +9,7 @@ export declare function promptOptionsFromTurnInput(input: AgentTurnInput, target
9
9
  sessionId?: string;
10
10
  }): PromptOptions;
11
11
  /**
12
- * The `BackendConfig` fields the Sandbox prompt options declare.
12
+ * The `BackendConfig` fields this adapter forwards to Sandbox prompt options.
13
13
  *
14
14
  * A turn may carry any of them and nothing else. An undeclared field is
15
15
  * refused instead of forwarded, because the SDK drops what it does not
@@ -17,7 +17,7 @@ export declare function promptOptionsFromTurnInput(input: AgentTurnInput, target
17
17
  * anywhere, which is the silent substitution the SDK's own `model` field
18
18
  * exists to prevent.
19
19
  */
20
- declare const SANDBOX_BACKEND_FIELD_LIST: readonly ["runtimeAttachments", "type", "profile", "model", "server", "interactions", "metadata"];
20
+ declare const SANDBOX_BACKEND_FIELD_LIST: readonly ["runtimeAttachments", "runtimeSecrets", "modelId", "provider", "apiKey", "baseUrl", "maxThinkingTokens", "mode", "apiKeyEnv", "cliAuth", "authMode", "authFiles", "type", "profile", "model", "server", "interactions", "metadata"];
21
21
  /**
22
22
  * The `BackendConfig["model"]` fields the Sandbox prompt options declare.
23
23
  *
@@ -27,7 +27,7 @@ declare const SANDBOX_BACKEND_FIELD_LIST: readonly ["runtimeAttachments", "type"
27
27
  */
28
28
  declare const SANDBOX_BACKEND_MODEL_FIELD_LIST: readonly ["provider", "model", "apiKey", "baseUrl", "maxThinkingTokens", "mode", "apiKeyEnv", "cliAuth", "authMode", "authFiles"];
29
29
  /**
30
- * The two lists above are the SDK's field sets, restated as values because a
30
+ * These lists cover the SDK's field sets, restated as values because a
31
31
  * TypeScript type cannot be read at run time. This pin keeps them exact in
32
32
  * both directions: a field the SDK adds, renames, or removes fails the build
33
33
  * here rather than reaching a caller as a wrong refusal or a silent drop.
@@ -82,12 +82,6 @@ type ValidatedSandboxPromptResult = Record<string, unknown> & {
82
82
  durationMs: number;
83
83
  executionId?: string;
84
84
  };
85
- /**
86
- * Completion is a bounded summary; cumulative tool history is retained separately.
87
- * The native session evidence owns the original arguments and outputs. Never
88
- * truncate that history or require the whole conversation to fit one event.
89
- */
90
- export declare function sandboxTerminalProjection(record: Record<string, unknown>): Record<string, unknown>;
91
85
  export declare function validatedSandboxPromptResult(result: PromptResult): ValidatedSandboxPromptResult;
92
86
  export declare function agentTurnResultFromPromptRecord(record: ValidatedSandboxPromptResult, options?: {
93
87
  contextTransferRequested?: boolean;
@@ -1,3 +1,5 @@
1
+ import { normalizeRuntimeBackendConfig } from "@tangle-network/sandbox";
2
+ import { projectAgentTerminalRecord } from "@tangle-network/sandbox/runtime";
1
3
  import { assertCliAuthReferenceSupported, cliAuthReferenceSchema, } from "@tangle-network/sandbox/auth";
2
4
  import { agentProfileSchema, canonicalAgentProfileDigest, boundedEventContentRecordSchema, AgentExactRunControlRefSchema, AgentTurnInputSchema, ContextTransferReceiptSchema, contextTransferResultMatchesRequest, } from "@tangle-network/agent-interface";
3
5
  import { tokenUsageFromData } from "./tangle-result-values.js";
@@ -49,6 +51,7 @@ export function promptOptionsFromTurnInput(input, target) {
49
51
  return {
50
52
  ...(sessionId ? { sessionId } : {}),
51
53
  ...(input.model ? { model: input.model } : {}),
54
+ ...(input.nativeResume === undefined ? {} : { nativeResume: input.nativeResume }),
52
55
  ...(backend === undefined ? {} : { backend }),
53
56
  ...(input.timeoutMs !== undefined ? { timeoutMs: input.timeoutMs } : {}),
54
57
  ...(input.context ? { context: input.context } : {}),
@@ -61,7 +64,7 @@ export function promptOptionsFromTurnInput(input, target) {
61
64
  };
62
65
  }
63
66
  /**
64
- * The `BackendConfig` fields the Sandbox prompt options declare.
67
+ * The `BackendConfig` fields this adapter forwards to Sandbox prompt options.
65
68
  *
66
69
  * A turn may carry any of them and nothing else. An undeclared field is
67
70
  * refused instead of forwarded, because the SDK drops what it does not
@@ -71,6 +74,17 @@ export function promptOptionsFromTurnInput(input, target) {
71
74
  */
72
75
  const SANDBOX_BACKEND_FIELD_LIST = [
73
76
  "runtimeAttachments",
77
+ "runtimeSecrets",
78
+ "modelId",
79
+ "provider",
80
+ "apiKey",
81
+ "baseUrl",
82
+ "maxThinkingTokens",
83
+ "mode",
84
+ "apiKeyEnv",
85
+ "cliAuth",
86
+ "authMode",
87
+ "authFiles",
74
88
  "type",
75
89
  "profile",
76
90
  "model",
@@ -118,8 +132,18 @@ export function backendFromTurnProviderOptions(providerOptions) {
118
132
  return sandboxPromptBackend(providerOptions.backend);
119
133
  }
120
134
  function sandboxPromptBackend(value) {
121
- const present = plainRecord(value, "Tangle prompt backend options");
122
- assertDeclaredFields(present, SANDBOX_BACKEND_FIELDS, "Tangle prompt backend options");
135
+ const source = plainRecord(value, "Tangle prompt backend options");
136
+ assertDeclaredFields(source, SANDBOX_BACKEND_FIELDS, "Tangle prompt backend options");
137
+ // Normalization can omit falsy nested values or replace them with flat fields.
138
+ // Reject malformed declarations before that loses the caller's input.
139
+ for (const field of ["model", "server"]) {
140
+ if (source[field] !== undefined) {
141
+ plainRecord(source[field], `Tangle prompt backend ${field} options`);
142
+ }
143
+ }
144
+ const present = normalizeRuntimeBackendConfig(source, {
145
+ allowRuntimeSecrets: true,
146
+ }) ?? {};
123
147
  const backend = {
124
148
  ...(present.type === undefined
125
149
  ? {}
@@ -161,6 +185,9 @@ function sandboxPromptBackend(value) {
161
185
  }
162
186
  assertCliAuthReferenceSupported(backend.type, backend.model);
163
187
  }
188
+ if (present.runtimeSecrets !== undefined) {
189
+ Object.assign(backend, { runtimeSecrets: present.runtimeSecrets });
190
+ }
164
191
  if (present.runtimeAttachments !== undefined) {
165
192
  Object.assign(backend, {
166
193
  runtimeAttachments: tangleRuntimeAttachments(present.runtimeAttachments, backend.profile),
@@ -330,12 +357,16 @@ function plainRecord(value, label) {
330
357
  export function backendRequestIdentity(backend) {
331
358
  if (backend === undefined)
332
359
  return undefined;
333
- const model = backend.model;
360
+ const normalized = (normalizeRuntimeBackendConfig(backend, { allowRuntimeSecrets: true }) ?? {});
361
+ // Sandbox message admission omits turn-only credentials from request identity;
362
+ // the SDK/sidecar independently keys the executing backend by their values.
363
+ const { runtimeSecrets: _runtimeSecrets, ...identity } = normalized;
364
+ const model = normalized.model;
334
365
  if (model === undefined)
335
- return { ...backend };
366
+ return identity;
336
367
  const { apiKey: _apiKey, authFiles, ...rest } = model;
337
368
  return {
338
- ...backend,
369
+ ...identity,
339
370
  model: {
340
371
  ...rest,
341
372
  ...(authFiles === undefined
@@ -411,15 +442,6 @@ const SANDBOX_OPTIONAL_RESULT_FIELDS = new Set([
411
442
  "usage",
412
443
  "costUsd",
413
444
  ]);
414
- /**
415
- * Completion is a bounded summary; cumulative tool history is retained separately.
416
- * The native session evidence owns the original arguments and outputs. Never
417
- * truncate that history or require the whole conversation to fit one event.
418
- */
419
- export function sandboxTerminalProjection(record) {
420
- const { toolInvocations: _toolInvocations, ...terminal } = record;
421
- return terminal;
422
- }
423
445
  export function validatedSandboxPromptResult(result) {
424
446
  if (!result || typeof result !== "object" || Array.isArray(result)) {
425
447
  throw new Error("Tangle prompt returned no result object");
@@ -432,7 +454,7 @@ export function validatedSandboxPromptResult(result) {
432
454
  // The Sandbox SDK materializes absent optional response fields as
433
455
  // `undefined`. They were absent on the JSON wire and must stay absent in the
434
456
  // provider-neutral result before the strict JSON check runs.
435
- const record = sandboxTerminalProjection(Object.fromEntries(Object.entries(source).filter(([field, value]) => value !== undefined || !SANDBOX_OPTIONAL_RESULT_FIELDS.has(field))));
457
+ const record = projectAgentTerminalRecord(Object.fromEntries(Object.entries(source).filter(([field, value]) => value !== undefined || !SANDBOX_OPTIONAL_RESULT_FIELDS.has(field))));
436
458
  const content = boundedEventContentRecordSchema.safeParse(record);
437
459
  if (!content.success) {
438
460
  throw new Error("Tangle prompt result exceeded its JSON bound", { cause: content.error });
@@ -4,7 +4,7 @@ import { createTangleExactProcessProvider, } from "./exact-process.js";
4
4
  import { capabilitiesForClient, defaultTangleSandboxCapabilities, narrowTangleCapabilitiesToBackend, } from "./tangle-capabilities.js";
5
5
  import { sandboxInstanceAsEnvironment } from "./tangle-environment.js";
6
6
  import { confidentialVerifierOption, createTangleWorkspaceBranching, } from "./tangle-workspace-branching.js";
7
- import { assertCreateInputShape, assertMappedCreateOptions, assertMappedSecretNames, assertNoInlineSecretValues, captureModelCredentials, sandboxOptionsFromCreateInput, sandboxRestoreFromCheckpoint } from "./tangle-create-options.js";
7
+ import { assertCreateInputShape, assertMappedCreateOptions, assertMappedSecretNames, assertNoInlineSecretValues, captureModelCredentials, NATIVE_RESUME_CHECKPOINT_METADATA_KEY, sandboxOptionsFromCreateInput, sandboxRestoreFromCheckpoint } from "./tangle-create-options.js";
8
8
  import { statusFromUnknown } from "./tangle-environment-values.js";
9
9
  import { requireNativeCaptureCapability, requireNativeCaptureProof } from "./tangle-native-capture-proof.js";
10
10
  import { awaitSandboxRunning, DEFAULT_TANGLE_READY_TIMEOUT_MS, } from "./tangle-readiness.js";
@@ -131,10 +131,16 @@ export function createTangleProvider(options) {
131
131
  createOptions.fromSandboxId !== restore?.fromSandboxId) {
132
132
  throw new Error("Tangle mapped create options must preserve the workspace checkpoint");
133
133
  }
134
+ if (createOptions.metadata?.[NATIVE_RESUME_CHECKPOINT_METADATA_KEY] !== checkpoint.checkpointId) {
135
+ throw new Error("Tangle mapped create options must preserve the native resume checkpoint binding");
136
+ }
134
137
  }
135
138
  else if (createOptions.fromSnapshot !== undefined || createOptions.fromSandboxId !== undefined) {
136
139
  throw new Error("Tangle mapped create options restore a snapshot the create input did not name");
137
140
  }
141
+ else if (createOptions.metadata?.[NATIVE_RESUME_CHECKPOINT_METADATA_KEY] !== undefined) {
142
+ throw new Error("Tangle mapped create options claim a native resume checkpoint without a restore");
143
+ }
138
144
  if (input.runtimeAttachments !== undefined &&
139
145
  (createOptions.backend?.runtimeAttachments === undefined ||
140
146
  canonicalCandidateDigest(input.runtimeAttachments) !== canonicalCandidateDigest(createOptions.backend.runtimeAttachments))) {
@@ -105,6 +105,7 @@ export interface SandboxRuntimeCapabilityDocument {
105
105
  /** The selected runtime resolves stored-secret native authentication references. */
106
106
  cliAuthReferences?: boolean;
107
107
  claudeTokenContinuations?: boolean;
108
+ codexCredentialContinuations?: boolean;
108
109
  nativeSessionCaptureVersion?: number;
109
110
  nativeSessionCaptureHarnesses?: readonly string[];
110
111
  agentInterface?: string;
@@ -427,7 +428,7 @@ export interface SandboxInstanceLike {
427
428
  }): SandboxSessionLike;
428
429
  /** Owner-authorized named grant; material never crosses this consumer boundary. */
429
430
  grantNativeCredential?(grant: {
430
- harness: "claude-code";
431
+ harness: "claude-code" | "codex";
431
432
  cliAuth: CliAuthReference;
432
433
  }, options?: {
433
434
  signal?: AbortSignal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "3.6.5",
3
+ "version": "3.6.7",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -128,10 +128,10 @@
128
128
  "dist/model-credential-capacity.d.ts"
129
129
  ],
130
130
  "dependencies": {
131
- "@tangle-network/agent-interface": "^3.0.0"
131
+ "@tangle-network/agent-interface": "^3.1.2"
132
132
  },
133
133
  "peerDependencies": {
134
- "@tangle-network/sandbox": ">=0.58.7 <1.0.0"
134
+ "@tangle-network/sandbox": ">=0.60.27 <1.0.0"
135
135
  },
136
136
  "peerDependenciesMeta": {
137
137
  "@tangle-network/sandbox": {
@@ -141,7 +141,7 @@
141
141
  "devDependencies": {
142
142
  "@tangle-network/agent-provider-testkit": "0.10.2",
143
143
  "@tangle-network/agent-runtime": "0.292.3",
144
- "@tangle-network/sandbox": "0.58.7",
144
+ "@tangle-network/sandbox": "0.60.27",
145
145
  "@types/node": "26.6.3",
146
146
  "typescript": "7.0.2",
147
147
  "vitest": "5.0.2"