@tangle-network/agent-provider-tangle 1.9.1 → 1.9.2
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 +3 -1
- package/dist/tangle-evidence.d.ts +4 -3
- package/dist/tangle-evidence.js +8 -4
- package/dist/tangle-native-capture-proof.d.ts +6 -2
- package/dist/tangle-native-capture-proof.js +24 -4
- package/dist/tangle-provider.js +9 -2
- package/dist/tangle-types.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -456,7 +456,9 @@ The adapter rejects ordinary sandboxes during create, recovery, and list operati
|
|
|
456
456
|
## Private session evidence
|
|
457
457
|
|
|
458
458
|
Call `readTangleEvidenceCapabilities(client)` before creating a sandbox when complete evidence is required.
|
|
459
|
-
It
|
|
459
|
+
It requires workspace capture, an explicit native capture harness list, and the next-create sidecar image digest.
|
|
460
|
+
A global capture flag cannot admit a profile whose harness is absent from that list.
|
|
461
|
+
Unprofiled exact-process and checkpoint restores retain the stricter global guarantee.
|
|
460
462
|
Apply `assertTangleEvidenceProfileCapability(proof, profile)` to the exact profile in each create hook.
|
|
461
463
|
An unavailable or unproven capability fails before the sandbox spends resources.
|
|
462
464
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type { AgentProfile } from "@tangle-network/agent-interface";
|
|
1
|
+
import type { AgentProfile, HarnessType } from "@tangle-network/agent-interface";
|
|
2
2
|
import type { AgentEnvironment } from "@tangle-network/agent-interface/environment-provider";
|
|
3
3
|
import type { NativeCaptureProofLike, SandboxClientLike, SandboxInstanceLike } from "./tangle-types.js";
|
|
4
4
|
export interface TangleEvidenceCapabilities {
|
|
5
5
|
readonly workspaceCaptureV1: true;
|
|
6
|
-
readonly nativeSessionCaptureV1:
|
|
6
|
+
readonly nativeSessionCaptureV1: boolean;
|
|
7
|
+
readonly nativeSessionCaptureHarnesses: readonly HarnessType[];
|
|
7
8
|
readonly sidecarImageDigest: string;
|
|
8
9
|
}
|
|
9
10
|
/** Read a deployment guarantee once, before Runtime starts creating environments. */
|
|
10
11
|
export declare function readTangleEvidenceCapabilities(client: SandboxClientLike): Promise<TangleEvidenceCapabilities>;
|
|
11
|
-
/**
|
|
12
|
+
/** Require the exact profile harness in the deployment's verified admission list. */
|
|
12
13
|
export declare function assertTangleEvidenceProfileCapability(document: TangleEvidenceCapabilities, profile: AgentProfile): void;
|
|
13
14
|
/** Refuse unsupported or unproven native trace retention before Sandbox create. */
|
|
14
15
|
export declare function assertTangleEvidenceCapability(client: SandboxClientLike, profile: AgentProfile): Promise<void>;
|
package/dist/tangle-evidence.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { parseBackendType } from "@tangle-network/sandbox";
|
|
3
|
-
import { requireNativeCaptureProof } from "./tangle-native-capture-proof.js";
|
|
3
|
+
import { nativeCaptureHarnesses, requireNativeCaptureProof } from "./tangle-native-capture-proof.js";
|
|
4
4
|
const handles = new WeakMap();
|
|
5
5
|
const blockedNames = new Set([".ssh", ".config", ".claude", ".codex", ".opencode", ".env", ".env.local", ".npmrc", ".sidecar"]);
|
|
6
6
|
const MAX_ENTRIES = 100_000;
|
|
@@ -11,25 +11,29 @@ export async function readTangleEvidenceCapabilities(client) {
|
|
|
11
11
|
if (typeof client.evidenceCapabilities !== "function")
|
|
12
12
|
throw new Error("Tangle deployment has no pre-create evidence capability query");
|
|
13
13
|
const document = await client.evidenceCapabilities();
|
|
14
|
-
if (document?.workspaceCaptureV1 !== true || document.nativeSessionCaptureV1 !==
|
|
14
|
+
if (document?.workspaceCaptureV1 !== true || typeof document.nativeSessionCaptureV1 !== "boolean" ||
|
|
15
15
|
!/^sha256:[0-9a-f]{64}$/.test(document.sidecarImageDigest ?? "")) {
|
|
16
16
|
throw new Error("Tangle deployment has not proven complete workspace and native session capture for next-create placement");
|
|
17
17
|
}
|
|
18
18
|
const verified = Object.freeze({
|
|
19
19
|
workspaceCaptureV1: true,
|
|
20
|
-
nativeSessionCaptureV1:
|
|
20
|
+
nativeSessionCaptureV1: document.nativeSessionCaptureV1,
|
|
21
|
+
nativeSessionCaptureHarnesses: nativeCaptureHarnesses(document.nativeSessionCaptureHarnesses),
|
|
21
22
|
sidecarImageDigest: document.sidecarImageDigest,
|
|
22
23
|
});
|
|
23
24
|
verifiedCapabilities.add(verified);
|
|
24
25
|
return verified;
|
|
25
26
|
}
|
|
26
|
-
/**
|
|
27
|
+
/** Require the exact profile harness in the deployment's verified admission list. */
|
|
27
28
|
export function assertTangleEvidenceProfileCapability(document, profile) {
|
|
28
29
|
if (!verifiedCapabilities.has(document))
|
|
29
30
|
throw new Error("Tangle evidence capability was not read from the deployment");
|
|
30
31
|
if (!profile.harness)
|
|
31
32
|
throw new Error("Tangle complete native session capture requires an exact profile harness");
|
|
32
33
|
parseBackendType(profile.harness);
|
|
34
|
+
if (!document.nativeSessionCaptureHarnesses.includes(profile.harness)) {
|
|
35
|
+
throw new Error(`Tangle deployment has not proven native session capture for harness ${JSON.stringify(profile.harness)}`);
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
38
|
/** Refuse unsupported or unproven native trace retention before Sandbox create. */
|
|
35
39
|
export async function assertTangleEvidenceCapability(client, profile) {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { type HarnessType } from "@tangle-network/agent-interface";
|
|
1
2
|
import type { NativeCaptureProofLike, SandboxClientLike, SandboxInstanceLike } from "./tangle-types.js";
|
|
2
3
|
/** Require a current host proof; a create must also prove its receipt names that same container. */
|
|
3
4
|
export declare function requireNativeCaptureProof(box: SandboxInstanceLike, create?: boolean): NativeCaptureProofLike;
|
|
4
|
-
/**
|
|
5
|
-
export declare function
|
|
5
|
+
/** Parse the deployment's explicit per-harness admission without inferring from a global flag. */
|
|
6
|
+
export declare function nativeCaptureHarnesses(raw: unknown): readonly HarnessType[];
|
|
7
|
+
/** Refuse an unsupported deployment before creating a billable sandbox.
|
|
8
|
+
* Unprofiled exact-process and checkpoint restores retain the stricter universal guarantee. */
|
|
9
|
+
export declare function requireNativeCaptureCapability(client: SandboxClientLike, harness?: string): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessTypeSchema } from "@tangle-network/agent-interface";
|
|
1
2
|
const imageId = /^sha256:[0-9a-f]{64}$/;
|
|
2
3
|
const containerId = /^[0-9a-f]{64}$/;
|
|
3
4
|
const revision = /^[0-9a-f]{40}$/;
|
|
@@ -24,10 +25,29 @@ export function requireNativeCaptureProof(box, create = false) {
|
|
|
24
25
|
}
|
|
25
26
|
return proof;
|
|
26
27
|
}
|
|
27
|
-
/**
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/** Parse the deployment's explicit per-harness admission without inferring from a global flag. */
|
|
29
|
+
export function nativeCaptureHarnesses(raw) {
|
|
30
|
+
const parsed = harnessTypeSchema.array().max(harnessTypeSchema.options.length).safeParse(raw);
|
|
31
|
+
if (!parsed.success || new Set(parsed.data).size !== parsed.data.length) {
|
|
32
|
+
throw new Error("Tangle deployment has not proven native session capture with a valid harness list");
|
|
33
|
+
}
|
|
34
|
+
return Object.freeze(parsed.data);
|
|
35
|
+
}
|
|
36
|
+
/** Refuse an unsupported deployment before creating a billable sandbox.
|
|
37
|
+
* Unprofiled exact-process and checkpoint restores retain the stricter universal guarantee. */
|
|
38
|
+
export async function requireNativeCaptureCapability(client, harness) {
|
|
39
|
+
if (!client.evidenceCapabilities) {
|
|
31
40
|
throw new Error("Tangle deployment has not proven native session capture for next-create placement");
|
|
32
41
|
}
|
|
42
|
+
const document = await client.evidenceCapabilities();
|
|
43
|
+
if (harness === undefined) {
|
|
44
|
+
if (document.nativeSessionCaptureV1 !== true) {
|
|
45
|
+
throw new Error("Tangle deployment has not proven native session capture for unprofiled next-create placement");
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const selected = harnessTypeSchema.safeParse(harness);
|
|
50
|
+
if (!selected.success || !nativeCaptureHarnesses(document.nativeSessionCaptureHarnesses).includes(selected.data)) {
|
|
51
|
+
throw new Error(`Tangle deployment has not proven native session capture for harness ${JSON.stringify(harness)}`);
|
|
52
|
+
}
|
|
33
53
|
}
|
package/dist/tangle-provider.js
CHANGED
|
@@ -113,8 +113,15 @@ export function createTangleProvider(options) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
input.signal?.throwIfAborted();
|
|
116
|
-
if (options.requireNativeSessionCapture)
|
|
117
|
-
|
|
116
|
+
if (options.requireNativeSessionCapture) {
|
|
117
|
+
if (createOptions.backend?.type === undefined) {
|
|
118
|
+
throw new Error("Tangle complete native session capture requires an explicit selected backend before create");
|
|
119
|
+
}
|
|
120
|
+
if (typeof input.profile !== "string" && input.profile.harness !== undefined && input.profile.harness !== createOptions.backend.type) {
|
|
121
|
+
throw new Error("Tangle native capture selected backend differs from the exact profile harness");
|
|
122
|
+
}
|
|
123
|
+
await requireNativeCaptureCapability(options.client, createOptions.backend.type);
|
|
124
|
+
}
|
|
118
125
|
const createPromise = options.client.create(createOptions, input.signal ? { signal: input.signal } : undefined);
|
|
119
126
|
let box;
|
|
120
127
|
try {
|
package/dist/tangle-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BackendRegistryEntry, BackendRegistryResponse, BackendType, CreateSandboxOptions, ExecResult as SandboxExecResult, PromptOptions, PromptResult, SandboxEvent } from "@tangle-network/sandbox";
|
|
2
|
-
import type { AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionAttach, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStatus, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, ConfidentialAttestation, ConfidentialExecutionEnvironment, InputPart, InteractionRequest, InteractionResponseCommand } from "@tangle-network/agent-interface";
|
|
2
|
+
import type { AgentRunCancellationAcknowledgement, AgentRunCancellationRequest, AgentInteractiveSessionControlClaim, AgentInteractiveSessionControlClaimAcknowledgement, AgentInteractiveSessionControlClaimRequest, AgentInteractiveSessionAttach, AgentInteractiveSessionPromptAcknowledgement, AgentInteractiveSessionPromptCommand, AgentInteractiveSessionRef, AgentInteractiveSessionStart, AgentInteractiveSessionStatus, AgentInteractiveSessionStopAcknowledgement, AgentInteractiveSessionStopCommand, AgentInteractiveTerminalSession, ConfidentialAttestation, ConfidentialExecutionEnvironment, HarnessType, InputPart, InteractionRequest, InteractionResponseCommand } from "@tangle-network/agent-interface";
|
|
3
3
|
import type { AgentEnvironmentCapabilities, AgentEnvironmentProvider, CreateAgentEnvironmentInput } from "@tangle-network/agent-interface/environment-provider";
|
|
4
4
|
/**
|
|
5
5
|
* The platform verdict for the create call that returned a sandbox.
|
|
@@ -26,6 +26,7 @@ export interface SandboxClientLike {
|
|
|
26
26
|
/** Deployment-scoped evidence guarantees for a new sandbox on this client. */
|
|
27
27
|
evidenceCapabilities?(): Promise<{
|
|
28
28
|
nativeSessionCaptureV1?: boolean;
|
|
29
|
+
nativeSessionCaptureHarnesses?: readonly HarnessType[];
|
|
29
30
|
workspaceCaptureV1?: boolean;
|
|
30
31
|
sidecarImageDigest?: string;
|
|
31
32
|
}>;
|