@tangle-network/agent-provider-tangle 3.5.2 → 3.6.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/dist/tangle-evidence.d.ts +10 -2
- package/dist/tangle-evidence.js +15 -6
- package/package.json +1 -1
|
@@ -25,6 +25,13 @@ export interface TangleEnvironmentEvidenceOptions {
|
|
|
25
25
|
requireNativeSessionCapture?: boolean;
|
|
26
26
|
/** Exact Sandbox session id when execution was reattached after provider restart. */
|
|
27
27
|
sandboxSessionId?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* `none` exports the attributed sessions' native evidence without walking the workspace. A
|
|
30
|
+
* caller uses it to copy a harness session while its turn is still running, or when the
|
|
31
|
+
* workspace is over the byte bound, so neither the workspace's size nor its scan can lose the
|
|
32
|
+
* session. Defaults to `environment`, which captures both.
|
|
33
|
+
*/
|
|
34
|
+
workspace?: "environment" | "none";
|
|
28
35
|
maxBytes: number;
|
|
29
36
|
signal?: AbortSignal;
|
|
30
37
|
}
|
|
@@ -49,19 +56,20 @@ export interface TangleEnvironmentEvidence {
|
|
|
49
56
|
executionId: string;
|
|
50
57
|
controlRef?: AgentExactRunControlRef;
|
|
51
58
|
captureProof?: NativeCaptureProofLike;
|
|
52
|
-
workspaceScope: "environment";
|
|
59
|
+
workspaceScope: "environment" | "none";
|
|
53
60
|
workspaceRoot: string;
|
|
54
61
|
capturedAt: string;
|
|
55
62
|
entries: WorkspaceEntryMetadata[];
|
|
56
63
|
excludedPaths: Array<WorkspaceEntryMetadata & {
|
|
57
64
|
reason: "credential-path" | "symlink" | "runtime-owned";
|
|
58
65
|
}>;
|
|
66
|
+
/** `complete` is false only when `workspaceScope` is `none`: no workspace was scanned. */
|
|
59
67
|
workspace: {
|
|
60
68
|
scannedFiles: number;
|
|
61
69
|
scannedDirectories: number;
|
|
62
70
|
reportedFiles: number;
|
|
63
71
|
reportedDirectories: number;
|
|
64
|
-
complete:
|
|
72
|
+
complete: boolean;
|
|
65
73
|
};
|
|
66
74
|
attempts: TangleEvidenceAttemptLike[];
|
|
67
75
|
sessions: Array<{
|
package/dist/tangle-evidence.js
CHANGED
|
@@ -74,6 +74,7 @@ function evidenceContext(environment, options) {
|
|
|
74
74
|
requireNativeSessionCapture: options.requireNativeSessionCapture,
|
|
75
75
|
sandboxSessionIds: [...sessionIds],
|
|
76
76
|
sessionExecutionIds,
|
|
77
|
+
...(options.workspace === undefined ? {} : { workspace: options.workspace }),
|
|
77
78
|
maxBytes: options.maxBytes,
|
|
78
79
|
signal: options.signal,
|
|
79
80
|
} };
|
|
@@ -115,11 +116,19 @@ async function captureSandboxEvidence(box, options, writer) {
|
|
|
115
116
|
const workspaceRoot = options.workspaceRoot ?? ".";
|
|
116
117
|
if (workspaceRoot !== ".")
|
|
117
118
|
canonicalEntryPath(workspaceRoot);
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
119
|
+
const workspaceScope = options.workspace ?? "environment";
|
|
120
|
+
if (workspaceScope !== "environment" && workspaceScope !== "none")
|
|
121
|
+
throw new Error("Tangle evidence workspace scope is invalid");
|
|
122
|
+
const boxFs = box.fs;
|
|
123
|
+
if (workspaceScope === "environment" && (!boxFs?.list || !boxFs.usage || !boxFs.readBatch)) {
|
|
120
124
|
throw new Error("Tangle evidence requires workspace list, usage, and binary batch read");
|
|
125
|
+
}
|
|
126
|
+
// Only the environment scope reads through it, after the check above.
|
|
127
|
+
const fs = boxFs;
|
|
121
128
|
options.signal?.throwIfAborted();
|
|
122
|
-
const usage =
|
|
129
|
+
const usage = workspaceScope === "none"
|
|
130
|
+
? { complete: true, skippedEntries: 0, sizeBytes: 0, fileCount: 0, directoryCount: 0 }
|
|
131
|
+
: await fs.usage(workspaceRoot);
|
|
123
132
|
if (!usage.complete || usage.skippedEntries !== 0)
|
|
124
133
|
throw new Error("Tangle workspace usage scan is incomplete");
|
|
125
134
|
if (usage.sizeBytes > options.maxBytes)
|
|
@@ -127,7 +136,7 @@ async function captureSandboxEvidence(box, options, writer) {
|
|
|
127
136
|
const metadata = [];
|
|
128
137
|
const seenPaths = new Set();
|
|
129
138
|
const excludedPaths = [];
|
|
130
|
-
const stack = [workspaceRoot];
|
|
139
|
+
const stack = workspaceScope === "none" ? [] : [workspaceRoot];
|
|
131
140
|
let scannedFiles = 0;
|
|
132
141
|
let scannedDirectories = 0;
|
|
133
142
|
let scannedEntries = 0;
|
|
@@ -716,12 +725,12 @@ async function captureSandboxEvidence(box, options, writer) {
|
|
|
716
725
|
executionId: artifactExecutionId,
|
|
717
726
|
...(controlRef === undefined ? {} : { controlRef }),
|
|
718
727
|
...(captureProof ? { captureProof } : {}),
|
|
719
|
-
workspaceScope
|
|
728
|
+
workspaceScope,
|
|
720
729
|
workspaceRoot,
|
|
721
730
|
capturedAt: new Date().toISOString(),
|
|
722
731
|
entries: metadata.sort((a, b) => a.path.localeCompare(b.path)),
|
|
723
732
|
excludedPaths,
|
|
724
|
-
workspace: { scannedFiles, scannedDirectories, reportedFiles: usage.fileCount, reportedDirectories: usage.directoryCount, complete:
|
|
733
|
+
workspace: { scannedFiles, scannedDirectories, reportedFiles: usage.fileCount, reportedDirectories: usage.directoryCount, complete: workspaceScope === "environment" },
|
|
725
734
|
attempts,
|
|
726
735
|
sessions,
|
|
727
736
|
missing,
|