@tangle-network/agent-provider-tangle 1.9.0 → 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-events.d.ts +2 -3
- package/dist/tangle-events.js +11 -14
- 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 +2 -2
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
|
|
package/dist/tangle-events.d.ts
CHANGED
|
@@ -6,9 +6,8 @@ export declare function isSandboxConnectionMarker(event: SandboxEvent): boolean;
|
|
|
6
6
|
* The session ids a Sandbox event carries, kept separate by field position.
|
|
7
7
|
*
|
|
8
8
|
* `runFrameSessionId` is `data.sessionId`/`data.sessionID`. The run/stream lane
|
|
9
|
-
* copies
|
|
10
|
-
*
|
|
11
|
-
* runtime session id.
|
|
9
|
+
* copies the public resume key from the adapter on `session.updated`.
|
|
10
|
+
* That key can differ from the Runtime session and is not native identity evidence.
|
|
12
11
|
*
|
|
13
12
|
* `envelopeSessionId` is the `properties` and `properties.info` position of an
|
|
14
13
|
* /agents/events frame, plus `properties.part` on a frame type that publishes a
|
package/dist/tangle-events.js
CHANGED
|
@@ -138,17 +138,15 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
|
|
|
138
138
|
if (Object.prototype.hasOwnProperty.call(data, "contextTransferReceipt")) {
|
|
139
139
|
throw new Error("Tangle Sandbox emitted an unsolicited context transfer receipt");
|
|
140
140
|
}
|
|
141
|
-
// A
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// every position of every other frame type, names the runtime session and is
|
|
148
|
-
// compared to the expected id.
|
|
141
|
+
// A bound public stream can carry the adapter's resume key in session.updated.
|
|
142
|
+
// It is content, not evidence of provider-native identity or Runtime ownership.
|
|
143
|
+
// Envelope identities still bind the frame to the expected Runtime session.
|
|
144
|
+
if (record.type === "native.session.observed") {
|
|
145
|
+
throw new Error("Tangle public stream exposed a private native identity event");
|
|
146
|
+
}
|
|
149
147
|
const identity = sandboxEventIdentity(event);
|
|
150
|
-
const
|
|
151
|
-
const identityBearingSessionIds = carriedSessionIds(
|
|
148
|
+
const runFrameCarriesPublicResumeKey = expected.streamBound === true && record.type === "session.updated";
|
|
149
|
+
const identityBearingSessionIds = carriedSessionIds(runFrameCarriesPublicResumeKey
|
|
152
150
|
? { envelopeSessionId: identity.envelopeSessionId }
|
|
153
151
|
: identity);
|
|
154
152
|
if (expected.executionId !== undefined) {
|
|
@@ -180,8 +178,7 @@ export function environmentEventFromSandboxEvent(event, expected = {}) {
|
|
|
180
178
|
// Other event names do not prove whether their usage is incremental.
|
|
181
179
|
const usageMode = declaredModes[0] ??
|
|
182
180
|
(record.type === "result" || record.type === "done" ? "cumulative" : undefined);
|
|
183
|
-
//
|
|
184
|
-
// including the native id an execution-bound stream just accepted as content.
|
|
181
|
+
// Preserve the public resume key without promoting it to native attribution.
|
|
185
182
|
const normalized = normalizeSandboxEvent(record.type, data, identity);
|
|
186
183
|
return {
|
|
187
184
|
type: record.type,
|
|
@@ -210,8 +207,8 @@ function normalizeSandboxEvent(type, data, identity) {
|
|
|
210
207
|
// of the frame's own positions carries and introduces none of its own. Each
|
|
211
208
|
// position it can repeat is already bound: the check above compared every
|
|
212
209
|
// position that names the runtime session, and the run-frame position of a
|
|
213
|
-
// stream-bound `session.updated` holds the
|
|
214
|
-
// carries too. A frame that carries no session id can supply none either.
|
|
210
|
+
// stream-bound `session.updated` holds the public resume key the computed
|
|
211
|
+
// block carries too. A frame that carries no session id can supply none either.
|
|
215
212
|
if (parsed.data.type === "session.updated") {
|
|
216
213
|
if (!carriedSessionIds(identity).includes(parsed.data.sessionId)) {
|
|
217
214
|
throw new Error("Tangle Sandbox normalized event named a session the frame does not carry");
|
|
@@ -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
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"LICENSE"
|
|
104
104
|
],
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@tangle-network/agent-interface": "^2.
|
|
106
|
+
"@tangle-network/agent-interface": "^2.15.0"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
109
|
"@tangle-network/sandbox": ">=0.58.0 <1.0.0"
|