@tangle-network/agent-provider-tangle 1.9.1 → 2.0.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.
- package/README.md +22 -2
- package/dist/tangle-environment-session.d.ts +1 -1
- package/dist/tangle-environment-session.js +15 -9
- package/dist/tangle-environment.js +1 -3
- package/dist/tangle-evidence.d.ts +23 -6
- package/dist/tangle-evidence.js +340 -69
- package/dist/tangle-native-capture-proof.d.ts +6 -2
- package/dist/tangle-native-capture-proof.js +27 -4
- package/dist/tangle-provider.js +9 -2
- package/dist/tangle-types.d.ts +54 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @tangle-network/agent-provider-tangle
|
|
2
2
|
|
|
3
3
|
Wraps `@tangle-network/sandbox` as an `AgentEnvironmentProvider`.
|
|
4
|
-
The peer range is `>=0.
|
|
4
|
+
The Sandbox peer range is `>=0.58.4 <1.0.0`.
|
|
5
5
|
The floor includes runtime MCP attachment transport and preservation across per-turn model credential overrides.
|
|
6
6
|
|
|
7
7
|
Runtime MCP bindings travel through `CreateAgentEnvironmentInput.runtimeAttachments` to Sandbox's `backend.runtimeAttachments`.
|
|
@@ -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
|
|
|
@@ -467,6 +469,24 @@ Both functions return private binary files and provenance for the workspace, nat
|
|
|
467
469
|
The caller must store those bytes in private durable custody before deleting the box.
|
|
468
470
|
Credential exclusions remain listed with path, type, owner IDs, timestamps, mode, size, and reason.
|
|
469
471
|
Each process stream has exact frame order and a terminal receipt.
|
|
472
|
+
The attempt inventory binds each Sidecar execution and retry to provider sessions, observed native sessions, and recorded processes.
|
|
473
|
+
Each session has one `raw-manifest.json` in its private archive.
|
|
474
|
+
Each execution binds to its original HOME through `evidenceSources`.
|
|
475
|
+
Native files and process streams use that source ID in their archive paths.
|
|
476
|
+
Rotations keep earlier HOMEs until durable capture permits session deletion.
|
|
477
|
+
Every readable process spool keeps its exact original bytes in `processSources`.
|
|
478
|
+
It preserves all response metadata, including unknown fields, attempts, event buffers, terminal results, exclusions, and skipped paths.
|
|
479
|
+
Known `contentBase64` fields become JSON pointers in `contentRefs`.
|
|
480
|
+
Each pointer names the archive file whose verified bytes reconstruct that field.
|
|
481
|
+
Binary bytes are stored once.
|
|
482
|
+
An unavailable response also keeps its original metadata.
|
|
483
|
+
Sidecar execution IDs join `sessions[].executionIds`; the outer execution ID names the Runtime node.
|
|
484
|
+
Partial capture retains the readable native files, process frames, and events in the same archive.
|
|
485
|
+
Its missing reasons prevent a complete receipt and keep the source available for recovery.
|
|
486
|
+
An unknown attempt outcome or native session identity remains explicit.
|
|
487
|
+
Reconnecting uses the execution ID from the validated durable control reference.
|
|
488
|
+
Earlier executions without retained caller attribution stay in the raw manifest with explicit gaps.
|
|
489
|
+
The caller's attempt projection includes only its known execution IDs.
|
|
470
490
|
The capture records the running sidecar image digest and the served Sidecar bundle revision.
|
|
471
491
|
The image digest can be compared with the pre-create proof only when that proof identifies the actual placement image.
|
|
472
492
|
An incomplete inventory, missing stream, unrelated backend, or mismatched digest does not produce complete evidence.
|
|
@@ -23,5 +23,5 @@ type ExactExecutionEventStream = (options: {
|
|
|
23
23
|
* environment observation reads it, because Sandbox reports usage per
|
|
24
24
|
* execution result and never for the environment.
|
|
25
25
|
*/
|
|
26
|
-
export declare function sandboxSessionAsAgentSession(session: SandboxSessionLike, controlRef: AgentRunControlRef | undefined, provider: string, environmentId: string, dispatch: ((input: AgentTurnInput) => Promise<AgentSessionRef>) | undefined, exactExecutionEvents: ExactExecutionEventStream | undefined, retainedControl: boolean, interactionResponses: boolean, usageLog?: ExecutionUsageLog, nativeContinuation?: boolean): AgentSession;
|
|
26
|
+
export declare function sandboxSessionAsAgentSession(session: SandboxSessionLike, controlRef: AgentRunControlRef | undefined, provider: string, environmentId: string, dispatch: ((input: AgentTurnInput) => Promise<AgentSessionRef>) | undefined, exactExecutionEvents: ExactExecutionEventStream | undefined, retainedControl: boolean, interactionResponses: boolean, usageLog?: ExecutionUsageLog, nativeContinuation?: boolean, onExecution?: (executionId: string) => void): AgentSession;
|
|
27
27
|
export {};
|
|
@@ -24,14 +24,16 @@ import { hasReplayPayload, interruptExecutionAfterAbort, sessionPromptRequestDig
|
|
|
24
24
|
* environment observation reads it, because Sandbox reports usage per
|
|
25
25
|
* execution result and never for the environment.
|
|
26
26
|
*/
|
|
27
|
-
export function sandboxSessionAsAgentSession(session, controlRef, provider, environmentId, dispatch, exactExecutionEvents, retainedControl, interactionResponses, usageLog, nativeContinuation = false) {
|
|
27
|
+
export function sandboxSessionAsAgentSession(session, controlRef, provider, environmentId, dispatch, exactExecutionEvents, retainedControl, interactionResponses, usageLog, nativeContinuation = false, onExecution) {
|
|
28
28
|
const measured = (executionId, result) => {
|
|
29
29
|
usageLog?.record(executionId, result.usage);
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
|
-
let activeControlRef = controlRef
|
|
33
|
-
?
|
|
34
|
-
:
|
|
32
|
+
let activeControlRef = controlRef === undefined
|
|
33
|
+
? undefined
|
|
34
|
+
: resolveRetainedSessionControlRef(controlRef, session.id, provider, environmentId);
|
|
35
|
+
if (activeControlRef !== undefined)
|
|
36
|
+
onExecution?.(activeControlRef.executionId);
|
|
35
37
|
let promptInFlight = false;
|
|
36
38
|
const respondToInteraction = interactionResponses && typeof session.respondToInteraction === "function"
|
|
37
39
|
? tangleInteractionResponder({
|
|
@@ -356,6 +358,7 @@ export function sandboxSessionAsAgentSession(session, controlRef, provider, envi
|
|
|
356
358
|
// The admission receipt is the durability boundary. Store it before
|
|
357
359
|
// waiting for the result so an aborted caller can reconnect later.
|
|
358
360
|
activeControlRef = nextControlRef;
|
|
361
|
+
onExecution?.(nextControlRef.executionId);
|
|
359
362
|
const result = await awaitWithSignal(session.result({
|
|
360
363
|
executionId: nextControlRef.executionId,
|
|
361
364
|
...(input.signal ? { signal: input.signal } : {}),
|
|
@@ -429,12 +432,15 @@ export function sandboxSessionAsAgentSession(session, controlRef, provider, envi
|
|
|
429
432
|
executionId,
|
|
430
433
|
controlRef: targetControlRef,
|
|
431
434
|
};
|
|
435
|
+
const prompt = promptFromTurnInput(input);
|
|
436
|
+
const promptOptions = promptOptionsFromTurnInput(promptInput, {
|
|
437
|
+
provider,
|
|
438
|
+
environmentId,
|
|
439
|
+
sessionId: session.id,
|
|
440
|
+
});
|
|
441
|
+
onExecution?.(executionId);
|
|
432
442
|
try {
|
|
433
|
-
const result = await awaitWithSignal(session.prompt(
|
|
434
|
-
provider,
|
|
435
|
-
environmentId,
|
|
436
|
-
sessionId: session.id,
|
|
437
|
-
})), input.signal);
|
|
443
|
+
const result = await awaitWithSignal(session.prompt(prompt, promptOptions), input.signal);
|
|
438
444
|
input.signal?.throwIfAborted();
|
|
439
445
|
const resultRecord = validatedSandboxPromptResult(result);
|
|
440
446
|
if (resultRecord.executionId !== executionId) {
|
|
@@ -2,7 +2,6 @@ import { AgentTurnInputSchema, deepFreeze } from "@tangle-network/agent-interfac
|
|
|
2
2
|
import { AgentEnvironmentCapabilitiesSchema } from "@tangle-network/agent-interface/environment-provider";
|
|
3
3
|
import { environmentEventFromSandboxEvent } from "./tangle-events.js";
|
|
4
4
|
import { executionIdFromTurnInput, promptFromTurnInput, promptOptionsFromTurnInput, } from "./tangle-prompt.js";
|
|
5
|
-
import { resolveRetainedSessionControlRef } from "./tangle-session-control.js";
|
|
6
5
|
import { creationFromSandboxCreateReceipt, placementInfoFromLoopPlacement, statusFromUnknown, } from "./tangle-environment-values.js";
|
|
7
6
|
import { execResultFromSandboxExecResult } from "./tangle-result-values.js";
|
|
8
7
|
import { capabilitiesForSandbox, frozenCapabilityDocument, sandboxCapabilitySupport, } from "./tangle-capabilities.js";
|
|
@@ -175,7 +174,6 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
|
|
|
175
174
|
? {
|
|
176
175
|
session(id, options) {
|
|
177
176
|
boundedIdentifier(id, "Tangle session id");
|
|
178
|
-
noteTangleSession(environment, id);
|
|
179
177
|
assertOptionKeys(options, ["controlRef", "signal"], "Tangle session");
|
|
180
178
|
options?.signal?.throwIfAborted();
|
|
181
179
|
const session = box.session?.(id, options?.signal ? { signal: options.signal } : undefined);
|
|
@@ -186,7 +184,7 @@ export async function sandboxInstanceAsEnvironment(box, providerName, client, de
|
|
|
186
184
|
if (session.id !== id) {
|
|
187
185
|
throw new Error("sandbox session(id) returned an unrelated session");
|
|
188
186
|
}
|
|
189
|
-
const agentSession = sandboxSessionAsAgentSession(session,
|
|
187
|
+
const agentSession = sandboxSessionAsAgentSession(session, options?.controlRef, providerName, environmentId, dispatch, exactExecutionEvents, retainedControl, interactionResponses, usageLog, capabilities.nativeContinuation !== undefined, (executionId) => noteTangleSession(environment, id, executionId));
|
|
190
188
|
// sessions.continue was granted from the probe session and the
|
|
191
189
|
// deployment document together; this backstop holds every
|
|
192
190
|
// concrete session to that grant, so a client whose sessions
|
|
@@ -1,14 +1,16 @@
|
|
|
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
|
-
import type { NativeCaptureProofLike, SandboxClientLike, SandboxInstanceLike } from "./tangle-types.js";
|
|
3
|
+
import type { NativeCaptureProofLike, SandboxClientLike, SandboxInstanceLike, TangleEvidenceAttemptLike, TangleEvidenceSourceLike } from "./tangle-types.js";
|
|
4
4
|
export interface TangleEvidenceCapabilities {
|
|
5
5
|
readonly workspaceCaptureV1: true;
|
|
6
|
-
readonly nativeSessionCaptureV1:
|
|
6
|
+
readonly nativeSessionCaptureV1: boolean;
|
|
7
|
+
readonly nativeSessionCaptureVersion: 2;
|
|
8
|
+
readonly nativeSessionCaptureHarnesses: readonly HarnessType[];
|
|
7
9
|
readonly sidecarImageDigest: string;
|
|
8
10
|
}
|
|
9
11
|
/** Read a deployment guarantee once, before Runtime starts creating environments. */
|
|
10
12
|
export declare function readTangleEvidenceCapabilities(client: SandboxClientLike): Promise<TangleEvidenceCapabilities>;
|
|
11
|
-
/**
|
|
13
|
+
/** Require the exact profile harness in the deployment's verified admission list. */
|
|
12
14
|
export declare function assertTangleEvidenceProfileCapability(document: TangleEvidenceCapabilities, profile: AgentProfile): void;
|
|
13
15
|
/** Refuse unsupported or unproven native trace retention before Sandbox create. */
|
|
14
16
|
export declare function assertTangleEvidenceCapability(client: SandboxClientLike, profile: AgentProfile): Promise<void>;
|
|
@@ -68,6 +70,7 @@ export interface TangleEnvironmentEvidence {
|
|
|
68
70
|
reportedDirectories: number;
|
|
69
71
|
complete: true;
|
|
70
72
|
};
|
|
73
|
+
attempts: TangleEvidenceAttemptLike[];
|
|
71
74
|
sessions: Array<{
|
|
72
75
|
id: string;
|
|
73
76
|
executionId: string;
|
|
@@ -82,11 +85,13 @@ export interface TangleEnvironmentEvidence {
|
|
|
82
85
|
messageScope: "session";
|
|
83
86
|
nativeSessionId: string | null;
|
|
84
87
|
nativeReason: string | null;
|
|
88
|
+
evidenceSources: TangleEvidenceSourceLike[];
|
|
85
89
|
nativeStore: {
|
|
86
90
|
scope: "session";
|
|
87
91
|
roots: Array<{
|
|
88
92
|
scope: "session-home" | "workspace-session";
|
|
89
93
|
path: string;
|
|
94
|
+
sourceId?: string;
|
|
90
95
|
}>;
|
|
91
96
|
inventory: {
|
|
92
97
|
scannedFiles: number;
|
|
@@ -98,10 +103,11 @@ export interface TangleEnvironmentEvidence {
|
|
|
98
103
|
scannedSymlinks: number;
|
|
99
104
|
reportedSymlinks: number;
|
|
100
105
|
excludedSymlinks: number;
|
|
101
|
-
skippedEntries:
|
|
106
|
+
skippedEntries: number;
|
|
102
107
|
} | null;
|
|
103
108
|
complete: boolean;
|
|
104
109
|
entries: Array<{
|
|
110
|
+
sourceId?: string;
|
|
105
111
|
rootScope: "session-home" | "workspace-session";
|
|
106
112
|
path: string;
|
|
107
113
|
kind: "file" | "directory" | "symlink";
|
|
@@ -115,6 +121,7 @@ export interface TangleEnvironmentEvidence {
|
|
|
115
121
|
linkTarget: string | null;
|
|
116
122
|
}>;
|
|
117
123
|
excludedPaths: Array<{
|
|
124
|
+
sourceId?: string;
|
|
118
125
|
rootScope: "session-home" | "workspace-session";
|
|
119
126
|
path: string;
|
|
120
127
|
kind: "file" | "directory" | "symlink";
|
|
@@ -136,8 +143,17 @@ export interface TangleEnvironmentEvidence {
|
|
|
136
143
|
stdoutBytes: number;
|
|
137
144
|
stderrBytes: number;
|
|
138
145
|
protocolBytes: number;
|
|
146
|
+
sources: Array<{
|
|
147
|
+
sourceId: string;
|
|
148
|
+
path: string;
|
|
149
|
+
sizeBytes: number;
|
|
150
|
+
sha256: string;
|
|
151
|
+
}>;
|
|
139
152
|
terminals: Array<{
|
|
140
153
|
processId: string;
|
|
154
|
+
executionId?: string;
|
|
155
|
+
ordinal?: number;
|
|
156
|
+
providerSessionId?: string;
|
|
141
157
|
sequence: number;
|
|
142
158
|
at: string;
|
|
143
159
|
result: {
|
|
@@ -145,12 +161,13 @@ export interface TangleEnvironmentEvidence {
|
|
|
145
161
|
signal: string | null;
|
|
146
162
|
timedOut: boolean;
|
|
147
163
|
timeoutReason: string | null;
|
|
148
|
-
captureError: null;
|
|
164
|
+
captureError: string | null;
|
|
149
165
|
spawnError?: string;
|
|
150
166
|
};
|
|
151
167
|
}>;
|
|
152
168
|
};
|
|
153
169
|
nativeEvents: {
|
|
170
|
+
scope: "execution";
|
|
154
171
|
complete: boolean;
|
|
155
172
|
count: number;
|
|
156
173
|
};
|
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,31 @@ 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
|
+
document.nativeSessionCaptureVersion !== 2 ||
|
|
15
16
|
!/^sha256:[0-9a-f]{64}$/.test(document.sidecarImageDigest ?? "")) {
|
|
16
17
|
throw new Error("Tangle deployment has not proven complete workspace and native session capture for next-create placement");
|
|
17
18
|
}
|
|
18
19
|
const verified = Object.freeze({
|
|
19
20
|
workspaceCaptureV1: true,
|
|
20
|
-
nativeSessionCaptureV1:
|
|
21
|
+
nativeSessionCaptureV1: document.nativeSessionCaptureV1,
|
|
22
|
+
nativeSessionCaptureVersion: 2,
|
|
23
|
+
nativeSessionCaptureHarnesses: nativeCaptureHarnesses(document.nativeSessionCaptureHarnesses),
|
|
21
24
|
sidecarImageDigest: document.sidecarImageDigest,
|
|
22
25
|
});
|
|
23
26
|
verifiedCapabilities.add(verified);
|
|
24
27
|
return verified;
|
|
25
28
|
}
|
|
26
|
-
/**
|
|
29
|
+
/** Require the exact profile harness in the deployment's verified admission list. */
|
|
27
30
|
export function assertTangleEvidenceProfileCapability(document, profile) {
|
|
28
31
|
if (!verifiedCapabilities.has(document))
|
|
29
32
|
throw new Error("Tangle evidence capability was not read from the deployment");
|
|
30
33
|
if (!profile.harness)
|
|
31
34
|
throw new Error("Tangle complete native session capture requires an exact profile harness");
|
|
32
35
|
parseBackendType(profile.harness);
|
|
36
|
+
if (!document.nativeSessionCaptureHarnesses.includes(profile.harness)) {
|
|
37
|
+
throw new Error(`Tangle deployment has not proven native session capture for harness ${JSON.stringify(profile.harness)}`);
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
/** Refuse unsupported or unproven native trace retention before Sandbox create. */
|
|
35
41
|
export async function assertTangleEvidenceCapability(client, profile) {
|
|
@@ -179,6 +185,7 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
179
185
|
}
|
|
180
186
|
const sessionIds = new Set(options.sandboxSessionIds);
|
|
181
187
|
const sessions = [];
|
|
188
|
+
const attempts = [];
|
|
182
189
|
const missing = [];
|
|
183
190
|
if (sessionIds.size === 0)
|
|
184
191
|
missing.push("No exact Sandbox session id was attributed to this execution");
|
|
@@ -251,23 +258,29 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
251
258
|
const processStreams = {
|
|
252
259
|
complete: false, streamCount: 0, processCount: 0, terminalCount: 0,
|
|
253
260
|
stdinBytes: 0, stdoutBytes: 0, stderrBytes: 0, protocolBytes: 0, terminals: [],
|
|
261
|
+
sources: [],
|
|
254
262
|
};
|
|
255
263
|
const nativeEvents = {
|
|
256
|
-
complete: false, count: 0,
|
|
264
|
+
scope: "execution", complete: false, count: 0,
|
|
257
265
|
};
|
|
258
266
|
let nativeSessionId = null;
|
|
259
267
|
let sidecarImageDigest = null;
|
|
260
268
|
let sidecarBundleRevision = null;
|
|
261
269
|
let nativeReason = "raw-session-capture-capability-absent";
|
|
270
|
+
let evidenceSources = [];
|
|
262
271
|
if (native !== undefined) {
|
|
272
|
+
let manifestSource = native;
|
|
273
|
+
const contentRefs = [];
|
|
263
274
|
if (native.sessionId !== id || native.backendType !== options.harness) {
|
|
264
275
|
throw new Error("Tangle raw evidence returned an unrelated session or profile backend");
|
|
265
276
|
}
|
|
266
|
-
if (native.nativeSessionId
|
|
277
|
+
if (native.nativeSessionId != null && !safeIdentifier(native.nativeSessionId)) {
|
|
267
278
|
throw new Error("Tangle raw evidence native session id is invalid");
|
|
268
279
|
}
|
|
269
280
|
nativeSessionId = native.nativeSessionId ?? null;
|
|
270
|
-
if (native.status === "captured") {
|
|
281
|
+
if (native.status === "captured" || native.status === "partial") {
|
|
282
|
+
const declaredPartial = native.status === "partial";
|
|
283
|
+
let partial = declaredPartial;
|
|
271
284
|
if (captureProof && (native.proofStatus !== "verified" ||
|
|
272
285
|
native.containerId !== captureProof.containerId ||
|
|
273
286
|
native.sidecarImageDigest !== captureProof.imageId ||
|
|
@@ -285,37 +298,105 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
285
298
|
}
|
|
286
299
|
sidecarImageDigest = native.sidecarImageDigest;
|
|
287
300
|
sidecarBundleRevision = native.sidecarBundleRevision;
|
|
288
|
-
if (native.completeness?.nativeStore !==
|
|
289
|
-
native.completeness.events !==
|
|
301
|
+
if (typeof native.completeness?.nativeStore !== "boolean" || typeof native.completeness.processIo !== "boolean" ||
|
|
302
|
+
typeof native.completeness.events !== "boolean" || !Array.isArray(native.files) ||
|
|
290
303
|
!Array.isArray(native.processIo) || !Array.isArray(native.events) ||
|
|
304
|
+
!Array.isArray(native.processSources) || !Array.isArray(native.evidenceSources) ||
|
|
291
305
|
!Array.isArray(native.excluded) || !Array.isArray(native.nativeRoots) || !native.inventory ||
|
|
292
|
-
!Array.isArray(native.processTerminals) || native.coverageComplete !==
|
|
306
|
+
!Array.isArray(native.processTerminals) || typeof native.coverageComplete !== "boolean" ||
|
|
307
|
+
!Array.isArray(native.missingReasons) || native.missingReasons.some((reason) => !safeReason(reason))) {
|
|
308
|
+
throw new Error("Tangle raw session capture is malformed");
|
|
309
|
+
}
|
|
310
|
+
if ((!declaredPartial && (native.completeness.nativeStore !== true || native.completeness.processIo !== true ||
|
|
311
|
+
native.completeness.events !== true || native.coverageComplete !== true || native.missingReasons.length > 0)) ||
|
|
312
|
+
(declaredPartial && native.coverageComplete !== false)) {
|
|
293
313
|
throw new Error("Tangle raw session capture is incomplete");
|
|
294
314
|
}
|
|
315
|
+
if (!Array.isArray(native.attempts) || native.attempts.length > MAX_ENTRIES) {
|
|
316
|
+
throw new Error("Tangle raw session attempt inventory is missing or invalid");
|
|
317
|
+
}
|
|
318
|
+
const unattributedExecutions = [...new Set(native.attempts.filter(isEvidenceAttempt)
|
|
319
|
+
.map((attempt) => attempt.executionId).filter((executionId) => !executionIds.includes(executionId)))];
|
|
320
|
+
if (unattributedExecutions.length) {
|
|
321
|
+
partial = true;
|
|
322
|
+
for (const executionId of unattributedExecutions) {
|
|
323
|
+
missing.push(`Sandbox session ${id} has an execution without retained caller attribution: ${executionId}`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const sessionAttempts = readNativeAttempts(native.attempts, executionIds, partial);
|
|
327
|
+
const sourceBindings = new Map();
|
|
328
|
+
const sourceHomes = new Map();
|
|
329
|
+
for (const source of native.evidenceSources) {
|
|
330
|
+
if (!source || !safeIdentifier(source.executionId) || !safeIdentifier(source.sourceId) ||
|
|
331
|
+
source.backendType !== options.harness || !canonicalNativeRoot(source.runtimeHome) ||
|
|
332
|
+
!Array.isArray(source.credentialPaths) || sourceBindings.has(source.executionId) ||
|
|
333
|
+
(sourceHomes.has(source.sourceId) && sourceHomes.get(source.sourceId) !== source.runtimeHome)) {
|
|
334
|
+
throw new Error("Tangle raw session evidence source identity is invalid");
|
|
335
|
+
}
|
|
336
|
+
for (const path of source.credentialPaths)
|
|
337
|
+
canonicalEntryPath(path);
|
|
338
|
+
sourceBindings.set(source.executionId, source);
|
|
339
|
+
sourceHomes.set(source.sourceId, source.runtimeHome);
|
|
340
|
+
}
|
|
341
|
+
const sourceCoverage = executionIds.every((executionId) => sourceBindings.has(executionId)) &&
|
|
342
|
+
native.evidenceSources.every((source) => executionIds.includes(source.executionId));
|
|
343
|
+
if (!sourceCoverage) {
|
|
344
|
+
if (!partial)
|
|
345
|
+
throw new Error("Tangle raw session sources do not cover the exact executions");
|
|
346
|
+
missing.push(`Sandbox session ${id} evidence sources do not cover the exact executions`);
|
|
347
|
+
}
|
|
348
|
+
evidenceSources = native.evidenceSources;
|
|
349
|
+
let processAttributionComplete = sourceCoverage;
|
|
350
|
+
const nativeEventCoverage = nativeEventsMatch(native.events, id, executionIds, partial);
|
|
351
|
+
attempts.push(...sessionAttempts.filter((attempt) => executionIds.includes(attempt.executionId)));
|
|
352
|
+
if (partial)
|
|
353
|
+
missing.push(`Sandbox session ${id} declared partial raw capture`);
|
|
354
|
+
for (const reason of native.missingReasons)
|
|
355
|
+
missing.push(`Sandbox session ${id}: ${reason}`);
|
|
356
|
+
for (const attempt of sessionAttempts) {
|
|
357
|
+
for (const reason of attempt.missingReasons) {
|
|
358
|
+
missing.push(`Sandbox session ${id} attempt ${attempt.executionId}/${attempt.ordinal}: ${reason}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (!sessionAttempts.length)
|
|
362
|
+
missing.push(`Sandbox session ${id} has no attempt inventory`);
|
|
363
|
+
const nativeIds = new Set(sessionAttempts.flatMap((attempt) => attempt.nativeSessionIds));
|
|
364
|
+
if (nativeSessionId !== null && !nativeIds.has(nativeSessionId)) {
|
|
365
|
+
throw new Error("Tangle raw session identity differs from its attempt inventory");
|
|
366
|
+
}
|
|
295
367
|
if (native.files.length + native.processIo.length + native.processTerminals.length +
|
|
296
368
|
native.events.length > MAX_ENTRIES) {
|
|
297
369
|
throw new Error("Tangle raw session capture exceeds entry limit");
|
|
298
370
|
}
|
|
299
371
|
const roots = new Set();
|
|
300
372
|
for (const root of native.nativeRoots) {
|
|
301
|
-
if (!["session-home", "workspace-session"].includes(root.rootScope) || roots.has(root
|
|
302
|
-
(root.path
|
|
373
|
+
if (!["session-home", "workspace-session"].includes(root.rootScope) || roots.has(nativeRootKey(root)) ||
|
|
374
|
+
!canonicalNativeRoot(root.path) ||
|
|
375
|
+
(root.sourceId !== undefined && (!safeIdentifier(root.sourceId) || !sourceHomes.has(root.sourceId) ||
|
|
376
|
+
(root.rootScope === "session-home" && sourceHomes.get(root.sourceId) !== root.path)))) {
|
|
303
377
|
throw new Error("Tangle raw session native root is invalid");
|
|
304
378
|
}
|
|
305
|
-
roots.add(root
|
|
306
|
-
nativeStore.roots.push({ scope: root.rootScope, path: root.path
|
|
379
|
+
roots.add(nativeRootKey(root));
|
|
380
|
+
nativeStore.roots.push({ scope: root.rootScope, path: root.path,
|
|
381
|
+
...(root.sourceId === undefined ? {} : { sourceId: root.sourceId }) });
|
|
307
382
|
}
|
|
308
|
-
if (!roots.size)
|
|
383
|
+
if (!roots.size && (!partial || native.completeness.nativeStore))
|
|
309
384
|
throw new Error("Tangle raw session has no native root");
|
|
385
|
+
const nativeRootCoverage = [...sourceHomes.keys()].every((sourceId) => roots.has(sourceId + "/session-home"));
|
|
386
|
+
if (!nativeRootCoverage) {
|
|
387
|
+
if (!partial)
|
|
388
|
+
throw new Error("Tangle raw session has an unretained native source root");
|
|
389
|
+
missing.push(`Sandbox session ${id} has an unretained native source root`);
|
|
390
|
+
}
|
|
310
391
|
const nativePaths = new Set();
|
|
311
392
|
const included = { file: 0, directory: 0, symlink: 0 };
|
|
312
393
|
const excluded = { file: 0, directory: 0, symlink: 0 };
|
|
313
|
-
for (const entry of native.files) {
|
|
394
|
+
for (const [index, entry] of native.files.entries()) {
|
|
314
395
|
options.signal?.throwIfAborted();
|
|
315
396
|
const path = canonicalEntryPath(entry.path);
|
|
316
|
-
if (!roots.has(entry
|
|
397
|
+
if (!roots.has(nativeRootKey(entry)))
|
|
317
398
|
throw new Error("Tangle raw session entry has no native root");
|
|
318
|
-
const identity = entry
|
|
399
|
+
const identity = nativeRootKey(entry) + "/" + path;
|
|
319
400
|
if (nativePaths.has(identity))
|
|
320
401
|
throw new Error("Tangle raw session repeats a native path");
|
|
321
402
|
nativePaths.add(identity);
|
|
@@ -325,7 +406,10 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
325
406
|
const content = exactNativeBytes(entry.contentBase64, entry.sizeBytes, entry.sha256, options.maxBytes - capturedBytes);
|
|
326
407
|
if (capturedBytes + content.byteLength > options.maxBytes)
|
|
327
408
|
throw new Error("Tangle evidence exceeds byte limit");
|
|
328
|
-
|
|
409
|
+
const contentPath = "__retention__/sessions/" + id + "/native/" +
|
|
410
|
+
(entry.sourceId === undefined ? "" : entry.sourceId + "/") + entry.rootScope + "/" + path;
|
|
411
|
+
files.push({ path: contentPath, bytes: content, mode: entry.mode & 0o777 });
|
|
412
|
+
contentRefs.push({ jsonPointer: `/files/${index}/contentBase64`, path: contentPath });
|
|
329
413
|
capturedBytes += content.byteLength;
|
|
330
414
|
}
|
|
331
415
|
else if (entry.kind === "directory" || entry.kind === "symlink") {
|
|
@@ -339,6 +423,7 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
339
423
|
}
|
|
340
424
|
included[entry.kind] += 1;
|
|
341
425
|
nativeStore.entries.push({
|
|
426
|
+
...(entry.sourceId === undefined ? {} : { sourceId: entry.sourceId }),
|
|
342
427
|
rootScope: entry.rootScope, path, kind: entry.kind, mode: entry.mode,
|
|
343
428
|
uid: entry.uid, gid: entry.gid, mtimeMs: entry.mtimeMs, ctimeMs: entry.ctimeMs,
|
|
344
429
|
sizeBytes: entry.sizeBytes, sha256: entry.sha256 ?? null, linkTarget: entry.linkTarget ?? null,
|
|
@@ -346,8 +431,8 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
346
431
|
}
|
|
347
432
|
for (const exclusion of native.excluded) {
|
|
348
433
|
const path = canonicalEntryPath(exclusion.path);
|
|
349
|
-
const identity = exclusion
|
|
350
|
-
if (!roots.has(exclusion
|
|
434
|
+
const identity = nativeRootKey(exclusion) + "/" + path;
|
|
435
|
+
if (!roots.has(nativeRootKey(exclusion)) || nativePaths.has(identity) ||
|
|
351
436
|
exclusion.reason !== "credential" || !["file", "directory", "symlink"].includes(exclusion.kind) ||
|
|
352
437
|
!nativeStatMetadata(exclusion)) {
|
|
353
438
|
throw new Error("Tangle raw session exclusion is invalid");
|
|
@@ -355,6 +440,7 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
355
440
|
nativePaths.add(identity);
|
|
356
441
|
excluded[exclusion.kind] += 1;
|
|
357
442
|
nativeStore.excludedPaths.push({
|
|
443
|
+
...(exclusion.sourceId === undefined ? {} : { sourceId: exclusion.sourceId }),
|
|
358
444
|
rootScope: exclusion.rootScope, path, kind: exclusion.kind, mode: exclusion.mode,
|
|
359
445
|
uid: exclusion.uid, gid: exclusion.gid, mtimeMs: exclusion.mtimeMs, ctimeMs: exclusion.ctimeMs,
|
|
360
446
|
sizeBytes: exclusion.sizeBytes, reason: exclusion.reason,
|
|
@@ -367,16 +453,20 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
367
453
|
inventory.reportedSymlinks, inventory.scannedSymlinks, inventory.excludedSymlinks,
|
|
368
454
|
];
|
|
369
455
|
if (counts.some((value) => !Number.isSafeInteger(value) || value < 0) ||
|
|
370
|
-
inventory.skippedEntries
|
|
456
|
+
!Number.isSafeInteger(inventory.skippedEntries) || inventory.skippedEntries < 0 ||
|
|
457
|
+
(!partial && inventory.skippedEntries !== 0) ||
|
|
371
458
|
inventory.reportedFiles !== included.file ||
|
|
372
459
|
inventory.reportedDirectories !== included.directory ||
|
|
373
460
|
inventory.reportedSymlinks !== included.symlink ||
|
|
374
461
|
inventory.excludedFiles !== excluded.file ||
|
|
375
462
|
inventory.excludedDirectories !== excluded.directory ||
|
|
376
463
|
inventory.excludedSymlinks !== excluded.symlink ||
|
|
377
|
-
inventory.scannedFiles
|
|
378
|
-
inventory.scannedDirectories
|
|
379
|
-
inventory.scannedSymlinks
|
|
464
|
+
inventory.scannedFiles < inventory.reportedFiles + inventory.excludedFiles ||
|
|
465
|
+
inventory.scannedDirectories < inventory.reportedDirectories + inventory.excludedDirectories ||
|
|
466
|
+
inventory.scannedSymlinks < inventory.reportedSymlinks + inventory.excludedSymlinks ||
|
|
467
|
+
(!partial && (inventory.scannedFiles !== inventory.reportedFiles + inventory.excludedFiles ||
|
|
468
|
+
inventory.scannedDirectories !== inventory.reportedDirectories + inventory.excludedDirectories ||
|
|
469
|
+
inventory.scannedSymlinks !== inventory.reportedSymlinks + inventory.excludedSymlinks))) {
|
|
380
470
|
throw new Error("Tangle raw session inventory does not reconcile");
|
|
381
471
|
}
|
|
382
472
|
nativeStore.inventory = {
|
|
@@ -389,33 +479,54 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
389
479
|
scannedSymlinks: inventory.scannedSymlinks,
|
|
390
480
|
reportedSymlinks: inventory.reportedSymlinks,
|
|
391
481
|
excludedSymlinks: inventory.excludedSymlinks,
|
|
392
|
-
skippedEntries:
|
|
482
|
+
skippedEntries: inventory.skippedEntries,
|
|
393
483
|
};
|
|
484
|
+
if (native.skipped !== undefined) {
|
|
485
|
+
if (!Array.isArray(native.skipped) || native.skipped.length !== inventory.skippedEntries ||
|
|
486
|
+
native.skipped.some((entry) => !roots.has(nativeRootKey(entry)) || !safeReason(entry.reason))) {
|
|
487
|
+
throw new Error("Tangle raw session skipped inventory does not reconcile");
|
|
488
|
+
}
|
|
489
|
+
for (const entry of native.skipped) {
|
|
490
|
+
if (entry.path !== ".")
|
|
491
|
+
canonicalEntryPath(entry.path);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
394
494
|
const ioSequences = new Map();
|
|
395
495
|
const frameMetadata = [];
|
|
396
|
-
for (const frame of native.processIo) {
|
|
496
|
+
for (const [index, frame] of native.processIo.entries()) {
|
|
397
497
|
options.signal?.throwIfAborted();
|
|
398
|
-
if (!safeIdentifier(frame.processId) || !
|
|
498
|
+
if (!safeIdentifier(frame.processId) || (frame.sourceId !== undefined && !safeIdentifier(frame.sourceId)) ||
|
|
499
|
+
!Number.isSafeInteger(frame.sequence) ||
|
|
399
500
|
frame.sequence < 0 || !Number.isFinite(Date.parse(frame.at)) ||
|
|
400
501
|
!["stdin", "stdout", "stderr", "protocol"].includes(frame.stream)) {
|
|
401
502
|
throw new Error("Tangle raw session process stream metadata is invalid");
|
|
402
503
|
}
|
|
403
|
-
const
|
|
504
|
+
const processKey = sourceProcessKey(frame);
|
|
505
|
+
const sequences = ioSequences.get(processKey) ?? new Set();
|
|
404
506
|
if (sequences.has(frame.sequence))
|
|
405
507
|
throw new Error("Tangle raw session repeats a process frame");
|
|
406
508
|
sequences.add(frame.sequence);
|
|
407
|
-
ioSequences.set(
|
|
509
|
+
ioSequences.set(processKey, sequences);
|
|
510
|
+
if (!processAttemptMatches(frame, sessionAttempts, partial)) {
|
|
511
|
+
processAttributionComplete = false;
|
|
512
|
+
missing.push(`Sandbox session ${id} process ${frame.processId} has no exact attempt attribution`);
|
|
513
|
+
}
|
|
514
|
+
if (frame.sourceId === undefined || sourceBindings.get(frame.executionId ?? "")?.sourceId !== frame.sourceId) {
|
|
515
|
+
if (!partial)
|
|
516
|
+
throw new Error("Tangle raw session process has conflicting source attribution");
|
|
517
|
+
processAttributionComplete = false;
|
|
518
|
+
missing.push(`Sandbox session ${id} process ${frame.processId} has no exact source attribution`);
|
|
519
|
+
}
|
|
408
520
|
const content = exactNativeBytes(frame.contentBase64, frame.sizeBytes, frame.sha256, options.maxBytes - capturedBytes);
|
|
409
521
|
if (capturedBytes + content.byteLength > options.maxBytes)
|
|
410
522
|
throw new Error("Tangle evidence exceeds byte limit");
|
|
411
523
|
const label = String(frame.sequence).padStart(16, "0");
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
});
|
|
524
|
+
const contentPath = "__retention__/sessions/" + id + "/io/" +
|
|
525
|
+
(frame.sourceId === undefined ? "" : frame.sourceId + "/") + frame.processId + "/" + label +
|
|
526
|
+
"-" + frame.stream + ".bin";
|
|
527
|
+
files.push({ path: contentPath, bytes: content, mode: 0o600 });
|
|
528
|
+
contentRefs.push({ jsonPointer: `/processIo/${index}/contentBase64`, path: contentPath });
|
|
529
|
+
frameMetadata.push(withoutNativeContent(frame));
|
|
419
530
|
capturedBytes += content.byteLength;
|
|
420
531
|
const counter = (frame.stream + "Bytes");
|
|
421
532
|
processStreams[counter] += content.byteLength;
|
|
@@ -423,10 +534,12 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
423
534
|
}
|
|
424
535
|
const terminals = new Set();
|
|
425
536
|
for (const terminal of native.processTerminals) {
|
|
426
|
-
|
|
537
|
+
const processKey = sourceProcessKey(terminal);
|
|
538
|
+
if (!safeIdentifier(terminal.processId) || (terminal.sourceId !== undefined && !safeIdentifier(terminal.sourceId)) ||
|
|
539
|
+
terminals.has(processKey) ||
|
|
427
540
|
!Number.isSafeInteger(terminal.sequence) || terminal.sequence < 0 ||
|
|
428
541
|
!Number.isFinite(Date.parse(terminal.at)) ||
|
|
429
|
-
terminal.result?.captureError
|
|
542
|
+
!(terminal.result?.captureError === null || (partial && typeof terminal.result?.captureError === "string")) ||
|
|
430
543
|
!(terminal.result.code === null || Number.isSafeInteger(terminal.result.code)) ||
|
|
431
544
|
!(terminal.result.signal === null || typeof terminal.result.signal === "string") ||
|
|
432
545
|
typeof terminal.result.timedOut !== "boolean" ||
|
|
@@ -434,47 +547,98 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
434
547
|
(terminal.result.spawnError !== undefined && typeof terminal.result.spawnError !== "string")) {
|
|
435
548
|
throw new Error("Tangle raw session process terminal metadata is invalid");
|
|
436
549
|
}
|
|
437
|
-
const sequences = ioSequences.get(
|
|
438
|
-
if (terminal
|
|
439
|
-
|
|
550
|
+
const sequences = ioSequences.get(processKey) ?? new Set();
|
|
551
|
+
if (!processAttemptMatches(terminal, sessionAttempts, partial)) {
|
|
552
|
+
processAttributionComplete = false;
|
|
553
|
+
missing.push(`Sandbox session ${id} terminal ${terminal.processId} has no exact attempt attribution`);
|
|
554
|
+
}
|
|
555
|
+
if (terminal.sourceId === undefined || sourceBindings.get(terminal.executionId ?? "")?.sourceId !== terminal.sourceId) {
|
|
556
|
+
if (!partial)
|
|
557
|
+
throw new Error("Tangle raw session terminal has conflicting source attribution");
|
|
558
|
+
processAttributionComplete = false;
|
|
559
|
+
missing.push(`Sandbox session ${id} terminal ${terminal.processId} has no exact source attribution`);
|
|
560
|
+
}
|
|
561
|
+
if (!partial && (terminal.sequence !== sequences.size ||
|
|
562
|
+
[...sequences].some((sequence) => sequence < 0 || sequence >= terminal.sequence))) {
|
|
440
563
|
throw new Error("Tangle raw session process sequence is incomplete");
|
|
441
564
|
}
|
|
442
|
-
terminals.add(
|
|
565
|
+
terminals.add(processKey);
|
|
443
566
|
processStreams.terminals.push(terminal);
|
|
444
567
|
}
|
|
445
|
-
if ([...ioSequences.keys()].some((processId) => !terminals.has(processId))) {
|
|
568
|
+
if (!partial && [...ioSequences.keys()].some((processId) => !terminals.has(processId))) {
|
|
446
569
|
throw new Error("Tangle raw session has a process without a terminal receipt");
|
|
447
570
|
}
|
|
448
|
-
|
|
571
|
+
const observedProcesses = [...native.processIo, ...native.processTerminals];
|
|
572
|
+
const observedAttemptProcesses = new Set(observedProcesses.map(attemptProcessKey));
|
|
573
|
+
for (const attempt of sessionAttempts) {
|
|
574
|
+
for (const processId of attempt.processIds) {
|
|
575
|
+
const key = attemptProcessKey({ ...attempt, processId,
|
|
576
|
+
sourceId: sourceBindings.get(attempt.executionId)?.sourceId });
|
|
577
|
+
if (observedAttemptProcesses.has(key))
|
|
578
|
+
continue;
|
|
579
|
+
if (!partial)
|
|
580
|
+
throw new Error("Tangle raw session attempt names an unretained attributed process");
|
|
581
|
+
processAttributionComplete = false;
|
|
582
|
+
missing.push(`Sandbox session ${id} attempt ${attempt.executionId}/${attempt.ordinal} names an unretained attributed process: ${processId}`);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
processStreams.processCount = new Set([...ioSequences.keys(), ...terminals]).size;
|
|
449
586
|
processStreams.terminalCount = terminals.size;
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
587
|
+
const spoolSources = new Set();
|
|
588
|
+
for (const [index, processSource] of native.processSources.entries()) {
|
|
589
|
+
if (!safeIdentifier(processSource.sourceId) || !sourceHomes.has(processSource.sourceId) ||
|
|
590
|
+
spoolSources.has(processSource.sourceId))
|
|
591
|
+
throw new Error("Tangle raw session process source identity is invalid");
|
|
592
|
+
spoolSources.add(processSource.sourceId);
|
|
593
|
+
const source = exactNativeBytes(processSource.contentBase64, processSource.sizeBytes, processSource.sha256, options.maxBytes - capturedBytes);
|
|
594
|
+
const sourcePath = "__retention__/sessions/" + id + "/process-sources/" + processSource.sourceId + ".jsonl";
|
|
595
|
+
files.push({ path: sourcePath, bytes: source, mode: 0o600 });
|
|
596
|
+
capturedBytes += source.byteLength;
|
|
597
|
+
processStreams.sources.push({ sourceId: processSource.sourceId, path: sourcePath, sizeBytes: source.byteLength, sha256: processSource.sha256 });
|
|
598
|
+
contentRefs.push({ jsonPointer: `/processSources/${index}/contentBase64`, path: sourcePath });
|
|
599
|
+
}
|
|
600
|
+
const missingSpoolSources = [...sourceHomes.keys()].filter((sourceId) => !spoolSources.has(sourceId));
|
|
601
|
+
if (!partial && missingSpoolSources.length > 0) {
|
|
602
|
+
throw new Error("Tangle raw session omits an original process source");
|
|
603
|
+
}
|
|
604
|
+
for (const sourceId of missingSpoolSources) {
|
|
605
|
+
missing.push(`Sandbox session ${id} has no original process source: ${sourceId}`);
|
|
606
|
+
}
|
|
607
|
+
manifestSource = {
|
|
608
|
+
...native,
|
|
609
|
+
files: native.files.map((entry) => entry.kind === "file" ? withoutNativeContent(entry) : entry),
|
|
610
|
+
processIo: frameMetadata,
|
|
611
|
+
processSources: native.processSources.map(withoutNativeContent),
|
|
612
|
+
};
|
|
613
|
+
nativeStore.complete = sourceCoverage && nativeRootCoverage && native.completeness.nativeStore && inventory.skippedEntries === 0 &&
|
|
614
|
+
inventory.scannedFiles === inventory.reportedFiles + inventory.excludedFiles &&
|
|
615
|
+
inventory.scannedDirectories === inventory.reportedDirectories + inventory.excludedDirectories &&
|
|
616
|
+
inventory.scannedSymlinks === inventory.reportedSymlinks + inventory.excludedSymlinks;
|
|
617
|
+
processStreams.complete = missingSpoolSources.length === 0 && processAttributionComplete && native.completeness.processIo && [...ioSequences.keys()].every((processId) => terminals.has(processId)) &&
|
|
618
|
+
native.processTerminals.every((terminal) => {
|
|
619
|
+
const sequences = ioSequences.get(sourceProcessKey(terminal)) ?? new Set();
|
|
620
|
+
return terminal.result.captureError === null && terminal.sequence === sequences.size &&
|
|
621
|
+
[...sequences].every((sequence) => sequence >= 0 && sequence < terminal.sequence);
|
|
622
|
+
});
|
|
623
|
+
nativeEvents.complete = sourceCoverage && unattributedExecutions.length === 0 && native.completeness.events && nativeEventCoverage;
|
|
470
624
|
nativeEvents.count = native.events.length;
|
|
471
|
-
nativeReason = null;
|
|
625
|
+
nativeReason = partial ? (native.missingReasons.join("; ") || "incomplete-execution-attribution") : null;
|
|
472
626
|
}
|
|
473
|
-
else {
|
|
474
|
-
if (!
|
|
627
|
+
else if (native.status === "unavailable") {
|
|
628
|
+
if (!safeReason(native.reason))
|
|
475
629
|
throw new Error("Tangle raw session unavailability reason is invalid");
|
|
476
630
|
nativeReason = native.reason;
|
|
477
631
|
}
|
|
632
|
+
else {
|
|
633
|
+
throw new Error("Tangle raw session capture status is invalid");
|
|
634
|
+
}
|
|
635
|
+
const manifest = Buffer.from(JSON.stringify({
|
|
636
|
+
kind: "tangle-native-session-evidence.v1", source: manifestSource, contentEncoding: "base64", contentRefs,
|
|
637
|
+
}));
|
|
638
|
+
if (capturedBytes + manifest.byteLength > options.maxBytes)
|
|
639
|
+
throw new Error("Tangle evidence exceeds byte limit");
|
|
640
|
+
files.push({ path: "__retention__/sessions/" + id + "/raw-manifest.json", bytes: manifest, mode: 0o600 });
|
|
641
|
+
capturedBytes += manifest.byteLength;
|
|
478
642
|
}
|
|
479
643
|
sessions.push({
|
|
480
644
|
id, executionId: options.executionId, executionIds: [...executionIds], eventCountsByExecutionId,
|
|
@@ -482,6 +646,7 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
482
646
|
transportEvents: executionIds.every((executionId) => eventCountsByExecutionId[executionId] > 0) ? "complete" : "unavailable",
|
|
483
647
|
eventCount: events.length, messageCount: messages.length, messageScope: "session",
|
|
484
648
|
nativeSessionId, nativeReason, nativeStore, processStreams, nativeEvents,
|
|
649
|
+
evidenceSources,
|
|
485
650
|
});
|
|
486
651
|
for (const executionId of executionIds) {
|
|
487
652
|
if (!eventCountsByExecutionId[executionId]) {
|
|
@@ -503,6 +668,7 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
503
668
|
entries: metadata.sort((a, b) => a.path.localeCompare(b.path)),
|
|
504
669
|
excludedPaths,
|
|
505
670
|
workspace: { scannedFiles, scannedDirectories, reportedFiles: usage.fileCount, reportedDirectories: usage.directoryCount, complete: true },
|
|
671
|
+
attempts,
|
|
506
672
|
sessions,
|
|
507
673
|
missing,
|
|
508
674
|
};
|
|
@@ -512,8 +678,113 @@ export async function captureTangleSandboxEvidence(box, options) {
|
|
|
512
678
|
files.push({ path: "__retention__/provenance.json", bytes: provenanceBytes, mode: 0o600 });
|
|
513
679
|
return { files: files.sort((a, b) => a.path.localeCompare(b.path)), provenance };
|
|
514
680
|
}
|
|
681
|
+
/** Keep every source field; store validated binary content once in the archive. */
|
|
682
|
+
function withoutNativeContent(source) {
|
|
683
|
+
const metadata = { ...source };
|
|
684
|
+
delete metadata.contentBase64;
|
|
685
|
+
return metadata;
|
|
686
|
+
}
|
|
515
687
|
function safeIdentifier(value) {
|
|
516
|
-
return /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(value);
|
|
688
|
+
return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(value);
|
|
689
|
+
}
|
|
690
|
+
function safeReason(value) {
|
|
691
|
+
return typeof value === "string" && value.length > 0 && value.length <= 1024 && !/[\u0000-\u001f\u007f]/.test(value);
|
|
692
|
+
}
|
|
693
|
+
function nativeRootKey(value) {
|
|
694
|
+
return `${value.sourceId ?? ""}/${value.rootScope}`;
|
|
695
|
+
}
|
|
696
|
+
function sourceProcessKey(value) {
|
|
697
|
+
return `${value.sourceId ?? ""}/${value.processId}`;
|
|
698
|
+
}
|
|
699
|
+
function attemptProcessKey(value) {
|
|
700
|
+
return `${sourceProcessKey(value)}/${value.executionId ?? ""}/${value.ordinal ?? ""}/${value.providerSessionId ?? ""}`;
|
|
701
|
+
}
|
|
702
|
+
/** Source roots are metadata; archive entry paths remain relative. */
|
|
703
|
+
function canonicalNativeRoot(value) {
|
|
704
|
+
if (typeof value !== "string" || value.includes("\\") || value.includes("\0"))
|
|
705
|
+
return false;
|
|
706
|
+
if (value === ".")
|
|
707
|
+
return true;
|
|
708
|
+
const parts = (value.startsWith("/") ? value.slice(1) : value).split("/");
|
|
709
|
+
return parts.every((part) => part.length > 0 && part !== "." && part !== "..");
|
|
710
|
+
}
|
|
711
|
+
function readNativeAttempts(value, executionIds, partial) {
|
|
712
|
+
if (!Array.isArray(value) || value.length > MAX_ENTRIES || (!partial && value.length === 0)) {
|
|
713
|
+
throw new Error("Tangle raw session attempt inventory is missing or invalid");
|
|
714
|
+
}
|
|
715
|
+
const ordinals = new Map();
|
|
716
|
+
const attempts = [];
|
|
717
|
+
for (const entry of value) {
|
|
718
|
+
if (!isEvidenceAttempt(entry) || (!partial && !executionIds.includes(entry.executionId))) {
|
|
719
|
+
throw new Error("Tangle raw session attempt has invalid identity or an unrelated execution");
|
|
720
|
+
}
|
|
721
|
+
const seen = ordinals.get(entry.executionId) ?? new Set();
|
|
722
|
+
if (seen.has(entry.ordinal))
|
|
723
|
+
throw new Error("Tangle raw session repeats an attempt ordinal");
|
|
724
|
+
seen.add(entry.ordinal);
|
|
725
|
+
ordinals.set(entry.executionId, seen);
|
|
726
|
+
if (!partial && (!entry.nativeSessionIds.length ||
|
|
727
|
+
entry.outcome === "unknown" || entry.missingReasons.length > 0)) {
|
|
728
|
+
throw new Error("Tangle raw session attempt coverage is incomplete");
|
|
729
|
+
}
|
|
730
|
+
attempts.push({ ...entry, nativeSessionIds: [...entry.nativeSessionIds], processIds: [...entry.processIds], missingReasons: [...entry.missingReasons] });
|
|
731
|
+
}
|
|
732
|
+
if (!partial && executionIds.some((id) => {
|
|
733
|
+
const seen = ordinals.get(id);
|
|
734
|
+
return !seen || Array.from({ length: seen.size }, (_, i) => i + 1).some((ordinal) => !seen.has(ordinal));
|
|
735
|
+
})) {
|
|
736
|
+
throw new Error("Tangle raw session attempt inventory does not cover every execution and retry");
|
|
737
|
+
}
|
|
738
|
+
return attempts;
|
|
739
|
+
}
|
|
740
|
+
function isEvidenceAttempt(value) {
|
|
741
|
+
if (value === null || typeof value !== "object")
|
|
742
|
+
return false;
|
|
743
|
+
const entry = value;
|
|
744
|
+
const identifiers = (candidate) => Array.isArray(candidate) &&
|
|
745
|
+
candidate.every((id) => typeof id === "string" && safeIdentifier(id)) && new Set(candidate).size === candidate.length;
|
|
746
|
+
return typeof entry.executionId === "string" && safeIdentifier(entry.executionId) &&
|
|
747
|
+
Number.isSafeInteger(entry.ordinal) && Number(entry.ordinal) > 0 &&
|
|
748
|
+
typeof entry.providerSessionId === "string" && safeIdentifier(entry.providerSessionId) &&
|
|
749
|
+
identifiers(entry.nativeSessionIds) && identifiers(entry.processIds) &&
|
|
750
|
+
typeof entry.outcome === "string" && ["succeeded", "failed", "cancelled", "unknown"].includes(entry.outcome) &&
|
|
751
|
+
identifiers(entry.missingReasons);
|
|
752
|
+
}
|
|
753
|
+
function processAttemptMatches(value, attempts, partial) {
|
|
754
|
+
const owners = attempts.filter((attempt) => attempt.processIds.includes(value.processId) &&
|
|
755
|
+
attempt.executionId === value.executionId && attempt.ordinal === value.ordinal &&
|
|
756
|
+
attempt.providerSessionId === value.providerSessionId);
|
|
757
|
+
const exact = owners.length === 1;
|
|
758
|
+
if (!exact && !partial)
|
|
759
|
+
throw new Error("Tangle raw session process has missing or conflicting attempt attribution");
|
|
760
|
+
return exact;
|
|
761
|
+
}
|
|
762
|
+
function nativeEventsMatch(events, sessionId, executionIds, partial) {
|
|
763
|
+
const seen = new Set();
|
|
764
|
+
let countsComplete = true;
|
|
765
|
+
for (const event of events) {
|
|
766
|
+
if (event === null || typeof event !== "object")
|
|
767
|
+
throw new Error("Tangle raw session event buffer is malformed");
|
|
768
|
+
const entry = event;
|
|
769
|
+
if (entry.metadata === null || typeof entry.metadata !== "object" || !Array.isArray(entry.frames)) {
|
|
770
|
+
throw new Error("Tangle raw session event buffer is malformed");
|
|
771
|
+
}
|
|
772
|
+
const metadata = entry.metadata;
|
|
773
|
+
if (metadata.sessionId !== sessionId || typeof metadata.executionId !== "string" ||
|
|
774
|
+
!safeIdentifier(metadata.executionId) || (!partial && !executionIds.includes(metadata.executionId)) || seen.has(metadata.executionId)) {
|
|
775
|
+
throw new Error("Tangle raw session event buffer has unrelated or duplicate execution identity");
|
|
776
|
+
}
|
|
777
|
+
if (!Number.isSafeInteger(metadata.eventCount) || Number(metadata.eventCount) < 0 || metadata.eventCount !== entry.frames.length) {
|
|
778
|
+
if (!partial)
|
|
779
|
+
throw new Error("Tangle raw session event buffer count is inconsistent");
|
|
780
|
+
countsComplete = false;
|
|
781
|
+
}
|
|
782
|
+
seen.add(metadata.executionId);
|
|
783
|
+
}
|
|
784
|
+
const complete = countsComplete && executionIds.every((executionId) => seen.has(executionId));
|
|
785
|
+
if (!complete && !partial)
|
|
786
|
+
throw new Error("Tangle raw session event buffers do not cover every execution");
|
|
787
|
+
return complete;
|
|
517
788
|
}
|
|
518
789
|
function canonicalEntryPath(value) {
|
|
519
790
|
if (!value || value.startsWith("/") || value.includes("\\") || value.includes("\0"))
|
|
@@ -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,32 @@ 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 (document.nativeSessionCaptureVersion !== 2) {
|
|
44
|
+
throw new Error("Tangle deployment has not proven native session capture protocol 2 for next-create placement");
|
|
45
|
+
}
|
|
46
|
+
if (harness === undefined) {
|
|
47
|
+
if (document.nativeSessionCaptureV1 !== true) {
|
|
48
|
+
throw new Error("Tangle deployment has not proven native session capture for unprofiled next-create placement");
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const selected = harnessTypeSchema.safeParse(harness);
|
|
53
|
+
if (!selected.success || !nativeCaptureHarnesses(document.nativeSessionCaptureHarnesses).includes(selected.data)) {
|
|
54
|
+
throw new Error(`Tangle deployment has not proven native session capture for harness ${JSON.stringify(harness)}`);
|
|
55
|
+
}
|
|
33
56
|
}
|
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,8 @@ 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
|
+
nativeSessionCaptureVersion?: number;
|
|
30
|
+
nativeSessionCaptureHarnesses?: readonly HarnessType[];
|
|
29
31
|
workspaceCaptureV1?: boolean;
|
|
30
32
|
sidecarImageDigest?: string;
|
|
31
33
|
}>;
|
|
@@ -553,22 +555,42 @@ export interface SandboxInstanceLike {
|
|
|
553
555
|
attestationNonce?: string;
|
|
554
556
|
}): Promise<SandboxTeeAttestationResponseLike>;
|
|
555
557
|
}
|
|
558
|
+
/** Exact observed attempts within one Sidecar execution. */
|
|
559
|
+
export interface TangleEvidenceAttemptLike {
|
|
560
|
+
executionId: string;
|
|
561
|
+
ordinal: number;
|
|
562
|
+
providerSessionId: string;
|
|
563
|
+
nativeSessionIds: string[];
|
|
564
|
+
processIds: string[];
|
|
565
|
+
outcome: "succeeded" | "failed" | "cancelled" | "unknown";
|
|
566
|
+
missingReasons: string[];
|
|
567
|
+
}
|
|
568
|
+
export interface TangleEvidenceSourceLike {
|
|
569
|
+
executionId: string;
|
|
570
|
+
sourceId: string;
|
|
571
|
+
backendType: string;
|
|
572
|
+
runtimeHome: string;
|
|
573
|
+
credentialPaths: string[];
|
|
574
|
+
}
|
|
556
575
|
export type TangleRawEvidenceLike = {
|
|
557
|
-
status: "captured";
|
|
576
|
+
status: "captured" | "partial";
|
|
558
577
|
sessionId: string;
|
|
559
578
|
backendType: string;
|
|
560
|
-
nativeSessionId?: string;
|
|
579
|
+
nativeSessionId?: string | null;
|
|
561
580
|
proofStatus?: "verified" | "unverified";
|
|
562
581
|
containerId?: string;
|
|
563
582
|
sidecarImageDigest: string;
|
|
564
583
|
sidecarBundleRevision: string;
|
|
565
584
|
sidecarBundleChecksum?: string;
|
|
585
|
+
evidenceSources: TangleEvidenceSourceLike[];
|
|
566
586
|
nativeRoots: Array<{
|
|
567
587
|
rootScope: "session-home" | "workspace-session";
|
|
568
588
|
path: string;
|
|
589
|
+
sourceId?: string;
|
|
569
590
|
}>;
|
|
570
591
|
inventory: Record<string, number>;
|
|
571
592
|
files: Array<{
|
|
593
|
+
sourceId?: string;
|
|
572
594
|
rootScope: "session-home" | "workspace-session";
|
|
573
595
|
path: string;
|
|
574
596
|
kind: "file" | "directory" | "symlink";
|
|
@@ -583,7 +605,11 @@ export type TangleRawEvidenceLike = {
|
|
|
583
605
|
linkTarget?: string;
|
|
584
606
|
}>;
|
|
585
607
|
processIo: Array<{
|
|
608
|
+
sourceId?: string;
|
|
586
609
|
processId: string;
|
|
610
|
+
executionId?: string;
|
|
611
|
+
ordinal?: number;
|
|
612
|
+
providerSessionId?: string;
|
|
587
613
|
sequence: number;
|
|
588
614
|
at: string;
|
|
589
615
|
stream: "stdin" | "stdout" | "stderr" | "protocol";
|
|
@@ -592,8 +618,19 @@ export type TangleRawEvidenceLike = {
|
|
|
592
618
|
contentBase64: string;
|
|
593
619
|
metadata?: unknown;
|
|
594
620
|
}>;
|
|
621
|
+
/** Exact original spool for every readable source. */
|
|
622
|
+
processSources: Array<{
|
|
623
|
+
sourceId: string;
|
|
624
|
+
contentBase64: string;
|
|
625
|
+
sizeBytes: number;
|
|
626
|
+
sha256: string;
|
|
627
|
+
}>;
|
|
595
628
|
processTerminals: Array<{
|
|
629
|
+
sourceId?: string;
|
|
596
630
|
processId: string;
|
|
631
|
+
executionId?: string;
|
|
632
|
+
ordinal?: number;
|
|
633
|
+
providerSessionId?: string;
|
|
597
634
|
sequence: number;
|
|
598
635
|
at: string;
|
|
599
636
|
result: {
|
|
@@ -601,12 +638,13 @@ export type TangleRawEvidenceLike = {
|
|
|
601
638
|
signal: string | null;
|
|
602
639
|
timedOut: boolean;
|
|
603
640
|
timeoutReason: string | null;
|
|
604
|
-
captureError: null;
|
|
641
|
+
captureError: string | null;
|
|
605
642
|
spawnError?: string;
|
|
606
643
|
};
|
|
607
644
|
}>;
|
|
608
645
|
events: unknown[];
|
|
609
646
|
excluded: Array<{
|
|
647
|
+
sourceId?: string;
|
|
610
648
|
rootScope: "session-home" | "workspace-session";
|
|
611
649
|
path: string;
|
|
612
650
|
kind: "file" | "directory" | "symlink";
|
|
@@ -618,12 +656,20 @@ export type TangleRawEvidenceLike = {
|
|
|
618
656
|
sizeBytes: number;
|
|
619
657
|
reason: "credential";
|
|
620
658
|
}>;
|
|
659
|
+
attempts: TangleEvidenceAttemptLike[];
|
|
660
|
+
skipped?: Array<{
|
|
661
|
+
rootScope: "session-home" | "workspace-session";
|
|
662
|
+
path: string;
|
|
663
|
+
reason: string;
|
|
664
|
+
sourceId?: string;
|
|
665
|
+
}>;
|
|
621
666
|
completeness: {
|
|
622
|
-
nativeStore:
|
|
623
|
-
processIo:
|
|
624
|
-
events:
|
|
667
|
+
nativeStore: boolean;
|
|
668
|
+
processIo: boolean;
|
|
669
|
+
events: boolean;
|
|
625
670
|
};
|
|
626
|
-
coverageComplete:
|
|
671
|
+
coverageComplete: boolean;
|
|
672
|
+
missingReasons: string[];
|
|
627
673
|
} | {
|
|
628
674
|
status: "unavailable";
|
|
629
675
|
sessionId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-tangle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@tangle-network/agent-interface": "^2.15.0"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@tangle-network/sandbox": ">=0.58.
|
|
109
|
+
"@tangle-network/sandbox": ">=0.58.4 <1.0.0"
|
|
110
110
|
},
|
|
111
111
|
"peerDependenciesMeta": {
|
|
112
112
|
"@tangle-network/sandbox": {
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@tangle-network/agent-provider-testkit": "0.10.0",
|
|
118
|
-
"@tangle-network/agent-runtime": "0.
|
|
119
|
-
"@tangle-network/sandbox": "0.58.
|
|
118
|
+
"@tangle-network/agent-runtime": "0.286.0",
|
|
119
|
+
"@tangle-network/sandbox": "0.58.4",
|
|
120
120
|
"@types/node": "26.6.3",
|
|
121
121
|
"typescript": "7.0.2",
|
|
122
122
|
"vitest": "5.0.2"
|