agentfootprint 11.0.0 → 11.1.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/CAPABILITIES.md +2 -0
- package/dist/debug.js +5 -3
- package/dist/debug.js.map +1 -1
- package/dist/esm/debug.d.ts +1 -1
- package/dist/esm/debug.js +1 -1
- package/dist/esm/debug.js.map +1 -1
- package/dist/esm/lib/boundedJson.d.ts +1 -1
- package/dist/esm/lib/boundedJson.js +4 -2
- package/dist/esm/lib/boundedJson.js.map +1 -1
- package/dist/esm/trace-toolpack/causeCapture.d.ts +5 -2
- package/dist/esm/trace-toolpack/causeCapture.js +32 -18
- package/dist/esm/trace-toolpack/causeCapture.js.map +1 -1
- package/dist/esm/trace-toolpack/causeContext.d.ts +14 -0
- package/dist/esm/trace-toolpack/causeContext.js +14 -0
- package/dist/esm/trace-toolpack/causeContext.js.map +1 -0
- package/dist/esm/trace-toolpack/causeProjection.d.ts +17 -0
- package/dist/esm/trace-toolpack/causeProjection.js +72 -0
- package/dist/esm/trace-toolpack/causeProjection.js.map +1 -0
- package/dist/esm/trace-toolpack/causeReader.d.ts +2 -3
- package/dist/esm/trace-toolpack/causeReader.js +21 -13
- package/dist/esm/trace-toolpack/causeReader.js.map +1 -1
- package/dist/esm/trace-toolpack/causeResponse.d.ts +5 -2
- package/dist/esm/trace-toolpack/causeResponse.js +26 -9
- package/dist/esm/trace-toolpack/causeResponse.js.map +1 -1
- package/dist/esm/trace-toolpack/causeSnapshot.d.ts +2 -8
- package/dist/esm/trace-toolpack/causeSnapshot.js +3 -63
- package/dist/esm/trace-toolpack/causeSnapshot.js.map +1 -1
- package/dist/esm/trace-toolpack/causeTools.d.ts +8 -1
- package/dist/esm/trace-toolpack/causeTools.js +33 -10
- package/dist/esm/trace-toolpack/causeTools.js.map +1 -1
- package/dist/esm/trace-toolpack/index.d.ts +3 -0
- package/dist/esm/trace-toolpack/index.js +2 -0
- package/dist/esm/trace-toolpack/index.js.map +1 -1
- package/dist/esm/trace-toolpack/storedCause.d.ts +8 -0
- package/dist/esm/trace-toolpack/storedCause.js +58 -0
- package/dist/esm/trace-toolpack/storedCause.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseBinding.d.ts +16 -0
- package/dist/esm/trace-toolpack/storedCauseBinding.js +50 -0
- package/dist/esm/trace-toolpack/storedCauseBinding.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseOptions.d.ts +5 -0
- package/dist/esm/trace-toolpack/storedCauseOptions.js +53 -0
- package/dist/esm/trace-toolpack/storedCauseOptions.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseProjection.d.ts +3 -0
- package/dist/esm/trace-toolpack/storedCauseProjection.js +117 -0
- package/dist/esm/trace-toolpack/storedCauseProjection.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseReader.d.ts +3 -0
- package/dist/esm/trace-toolpack/storedCauseReader.js +9 -0
- package/dist/esm/trace-toolpack/storedCauseReader.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseSources.d.ts +8 -0
- package/dist/esm/trace-toolpack/storedCauseSources.js +28 -0
- package/dist/esm/trace-toolpack/storedCauseSources.js.map +1 -0
- package/dist/esm/trace-toolpack/storedCauseTypes.d.ts +48 -0
- package/dist/esm/trace-toolpack/storedCauseTypes.js +2 -0
- package/dist/esm/trace-toolpack/storedCauseTypes.js.map +1 -0
- package/dist/esm/trace-toolpack/traceToolpack.js +18 -0
- package/dist/esm/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/lib/boundedJson.js +4 -2
- package/dist/lib/boundedJson.js.map +1 -1
- package/dist/trace-toolpack/causeCapture.js +35 -20
- package/dist/trace-toolpack/causeCapture.js.map +1 -1
- package/dist/trace-toolpack/causeContext.js +18 -0
- package/dist/trace-toolpack/causeContext.js.map +1 -0
- package/dist/trace-toolpack/causeProjection.js +76 -0
- package/dist/trace-toolpack/causeProjection.js.map +1 -0
- package/dist/trace-toolpack/causeReader.js +21 -13
- package/dist/trace-toolpack/causeReader.js.map +1 -1
- package/dist/trace-toolpack/causeResponse.js +26 -9
- package/dist/trace-toolpack/causeResponse.js.map +1 -1
- package/dist/trace-toolpack/causeSnapshot.js +3 -63
- package/dist/trace-toolpack/causeSnapshot.js.map +1 -1
- package/dist/trace-toolpack/causeTools.js +36 -12
- package/dist/trace-toolpack/causeTools.js.map +1 -1
- package/dist/trace-toolpack/index.js +5 -1
- package/dist/trace-toolpack/index.js.map +1 -1
- package/dist/trace-toolpack/storedCause.js +85 -0
- package/dist/trace-toolpack/storedCause.js.map +1 -0
- package/dist/trace-toolpack/storedCauseBinding.js +55 -0
- package/dist/trace-toolpack/storedCauseBinding.js.map +1 -0
- package/dist/trace-toolpack/storedCauseOptions.js +58 -0
- package/dist/trace-toolpack/storedCauseOptions.js.map +1 -0
- package/dist/trace-toolpack/storedCauseProjection.js +121 -0
- package/dist/trace-toolpack/storedCauseProjection.js.map +1 -0
- package/dist/trace-toolpack/storedCauseReader.js +35 -0
- package/dist/trace-toolpack/storedCauseReader.js.map +1 -0
- package/dist/trace-toolpack/storedCauseSources.js +32 -0
- package/dist/trace-toolpack/storedCauseSources.js.map +1 -0
- package/dist/trace-toolpack/storedCauseTypes.js +3 -0
- package/dist/trace-toolpack/storedCauseTypes.js.map +1 -0
- package/dist/trace-toolpack/traceToolpack.js +18 -0
- package/dist/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/types/debug.d.ts +1 -1
- package/dist/types/debug.d.ts.map +1 -1
- package/dist/types/lib/boundedJson.d.ts +1 -1
- package/dist/types/lib/boundedJson.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeCapture.d.ts +5 -2
- package/dist/types/trace-toolpack/causeCapture.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeContext.d.ts +15 -0
- package/dist/types/trace-toolpack/causeContext.d.ts.map +1 -0
- package/dist/types/trace-toolpack/causeProjection.d.ts +18 -0
- package/dist/types/trace-toolpack/causeProjection.d.ts.map +1 -0
- package/dist/types/trace-toolpack/causeReader.d.ts +2 -3
- package/dist/types/trace-toolpack/causeReader.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeResponse.d.ts +5 -2
- package/dist/types/trace-toolpack/causeResponse.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeSnapshot.d.ts +2 -8
- package/dist/types/trace-toolpack/causeSnapshot.d.ts.map +1 -1
- package/dist/types/trace-toolpack/causeTools.d.ts +8 -1
- package/dist/types/trace-toolpack/causeTools.d.ts.map +1 -1
- package/dist/types/trace-toolpack/index.d.ts +3 -0
- package/dist/types/trace-toolpack/index.d.ts.map +1 -1
- package/dist/types/trace-toolpack/storedCause.d.ts +9 -0
- package/dist/types/trace-toolpack/storedCause.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseBinding.d.ts +17 -0
- package/dist/types/trace-toolpack/storedCauseBinding.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseOptions.d.ts +6 -0
- package/dist/types/trace-toolpack/storedCauseOptions.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseProjection.d.ts +4 -0
- package/dist/types/trace-toolpack/storedCauseProjection.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseReader.d.ts +4 -0
- package/dist/types/trace-toolpack/storedCauseReader.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseSources.d.ts +9 -0
- package/dist/types/trace-toolpack/storedCauseSources.d.ts.map +1 -0
- package/dist/types/trace-toolpack/storedCauseTypes.d.ts +49 -0
- package/dist/types/trace-toolpack/storedCauseTypes.d.ts.map +1 -0
- package/dist/types/trace-toolpack/traceToolpack.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { copyJson } from '../lib/boundedJson.js';
|
|
2
|
+
import { captureOwn as own } from './causeCapture.js';
|
|
3
|
+
import { projectCauseBasis } from './causeProjection.js';
|
|
4
|
+
import { bindStoredCause } from './storedCauseBinding.js';
|
|
5
|
+
import { storedCauseSources } from './storedCauseSources.js';
|
|
6
|
+
function savedNodes(history) {
|
|
7
|
+
const nodes = new Map();
|
|
8
|
+
const paths = new Map();
|
|
9
|
+
const pending = [
|
|
10
|
+
{ node: history.executionTree, path: ['executionTree'] },
|
|
11
|
+
];
|
|
12
|
+
let visited = 0;
|
|
13
|
+
while (pending.length) {
|
|
14
|
+
const current = pending.pop();
|
|
15
|
+
if (!current)
|
|
16
|
+
break;
|
|
17
|
+
const { node, path } = current;
|
|
18
|
+
if (++visited > 4096 || node === null || typeof node !== 'object' || Array.isArray(node))
|
|
19
|
+
throw Error('Invalid saved tree.');
|
|
20
|
+
for (const field of ['stageReads', 'stageWrites']) {
|
|
21
|
+
const view = own(node, field);
|
|
22
|
+
if (view !== undefined &&
|
|
23
|
+
(view === null ||
|
|
24
|
+
typeof view !== 'object' ||
|
|
25
|
+
Array.isArray(view) ||
|
|
26
|
+
![Object.prototype, null].includes(Object.getPrototypeOf(view))))
|
|
27
|
+
throw Error('Invalid saved captured view.');
|
|
28
|
+
}
|
|
29
|
+
const id = own(node, 'runtimeStageId');
|
|
30
|
+
if (id !== undefined) {
|
|
31
|
+
if (typeof id !== 'string' || !id.length || id.length > 128 || nodes.has(id))
|
|
32
|
+
throw Error('Ambiguous saved tree.');
|
|
33
|
+
nodes.set(id, node);
|
|
34
|
+
// JSON arrays of literal segments are injective; dotted/slashed business keys stay whole.
|
|
35
|
+
paths.set(JSON.stringify(path), id);
|
|
36
|
+
}
|
|
37
|
+
const next = own(node, 'next');
|
|
38
|
+
if (next !== undefined)
|
|
39
|
+
pending.push({ node: next, path: [...path, 'next'] });
|
|
40
|
+
const children = own(node, 'children');
|
|
41
|
+
if (children !== undefined) {
|
|
42
|
+
if (!Array.isArray(children) || children.length > 4096)
|
|
43
|
+
throw Error('Invalid saved tree.');
|
|
44
|
+
for (let index = children.length - 1; index >= 0; index--)
|
|
45
|
+
pending.push({ node: children[index], path: [...path, 'children', String(index)] });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const readKeys = new Map();
|
|
49
|
+
// FootPrint already validated the paths and their digest. Only project their recorded meaning.
|
|
50
|
+
for (const path of history.absent ?? []) {
|
|
51
|
+
const id = paths.get(JSON.stringify(path.slice(0, -2)));
|
|
52
|
+
if (id === undefined)
|
|
53
|
+
throw Error('Missing saved observation owner.');
|
|
54
|
+
if (path[path.length - 2] !== 'stageReads')
|
|
55
|
+
continue;
|
|
56
|
+
const keys = readKeys.get(id) ?? [];
|
|
57
|
+
const key = path[path.length - 1];
|
|
58
|
+
if (key === undefined)
|
|
59
|
+
throw Error('Missing saved observation key.');
|
|
60
|
+
keys.push(key);
|
|
61
|
+
readKeys.set(id, keys);
|
|
62
|
+
}
|
|
63
|
+
return { nodes, readKeys };
|
|
64
|
+
}
|
|
65
|
+
/** A narrow graph projection over admitted producer history, never a synthetic RuntimeSnapshot. */
|
|
66
|
+
export function projectStoredCause(value, runId, maxBytes) {
|
|
67
|
+
try {
|
|
68
|
+
// Reuse the shared data-only copier. Its detached tree/sidecar/log are retained privately together.
|
|
69
|
+
const history = copyJson(value, maxBytes * 4, true, 256);
|
|
70
|
+
if (history.runId !== runId || !Array.isArray(history.commitLog))
|
|
71
|
+
return { status: 'unknown', reason: 'native-capture' };
|
|
72
|
+
if (history.commitLog.length > 4096)
|
|
73
|
+
return { status: 'unknown', reason: 'projection-incomplete' };
|
|
74
|
+
const version = own(history.capture, 'version');
|
|
75
|
+
if ((version !== 1 && version !== 2) ||
|
|
76
|
+
(version === 1 && own(history, 'readSources') !== undefined))
|
|
77
|
+
return { status: 'unknown', reason: 'native-capture' };
|
|
78
|
+
const sources = version === 2 ? storedCauseSources(history) : undefined;
|
|
79
|
+
if (typeof sources === 'string')
|
|
80
|
+
return { status: 'unknown', reason: sources };
|
|
81
|
+
const { nodes, readKeys } = savedNodes(history);
|
|
82
|
+
// These are facts from this one history; no runtime-only fields or alternate history are synthesized.
|
|
83
|
+
const basis = {
|
|
84
|
+
runId: history.runId,
|
|
85
|
+
capture: history.capture,
|
|
86
|
+
logAddress: own(history.capture, 'logAddress'),
|
|
87
|
+
commitValues: own(own(history.capture, 'modes'), 'commitValues'),
|
|
88
|
+
writeProvenance: own(own(history.capture, 'modes'), 'writeProvenance'),
|
|
89
|
+
commitLog: history.commitLog,
|
|
90
|
+
recorders: history.recorders,
|
|
91
|
+
};
|
|
92
|
+
const projected = projectCauseBasis(basis, nodes, undefined, {
|
|
93
|
+
readKeys,
|
|
94
|
+
...(history.initialState === undefined ? {} : { initialState: history.initialState }),
|
|
95
|
+
...(sources === undefined ? {} : { sources }),
|
|
96
|
+
});
|
|
97
|
+
if (projected === undefined || projected === 'truncated')
|
|
98
|
+
return { status: 'unknown', reason: 'projection-incomplete' };
|
|
99
|
+
if ([
|
|
100
|
+
'missing-attestation',
|
|
101
|
+
'invalid-attestation',
|
|
102
|
+
'run-mismatch',
|
|
103
|
+
'scope-not-covered',
|
|
104
|
+
'incomplete-extent',
|
|
105
|
+
'capture-limited',
|
|
106
|
+
].includes(projected.capture.reason))
|
|
107
|
+
return { status: 'unknown', reason: 'native-capture' };
|
|
108
|
+
return {
|
|
109
|
+
status: 'ready',
|
|
110
|
+
cause: bindStoredCause(projected.graph, projected.capture, history, version),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return { status: 'unknown', reason: 'projection-incomplete' };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=storedCauseProjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedCauseProjection.js","sourceRoot":"","sources":["../../../src/trace-toolpack/storedCauseProjection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MA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AiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE;YAC3D,QAAQ;YACR,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;YACrF,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;SAC9C,CAAC,CAAC;QACH,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,WAAW;YACtD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;QAChE,IACE;YACE,qBAAqB;YACrB,qBAAqB;YACrB,cAAc;YACd,mBAAmB;YACnB,mBAAmB;YACnB,iBAAiB;SAClB,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;YAEpC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;QACzD,OAAO;YACL,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;SAC7E,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Older supported producers lack this optional reader. A named value import would
|
|
2
|
+
// break browser linking even when unused; the named type still checks ownership.
|
|
3
|
+
// The architecture test pins this exception to this one reader and public door.
|
|
4
|
+
// eslint-disable-next-line no-restricted-syntax -- Optional reader; test/architecture/storedCauseReader.test.ts guards this single boundary.
|
|
5
|
+
import * as producer from 'footprintjs/trace';
|
|
6
|
+
const candidate = Reflect.get(producer, 'readStoredCapture');
|
|
7
|
+
/** The public reader when present; absent exports stay unsupported without a linking failure. */
|
|
8
|
+
export const readStoredCapture = typeof candidate === 'function' ? candidate : undefined;
|
|
9
|
+
//# sourceMappingURL=storedCauseReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedCauseReader.js","sourceRoot":"","sources":["../../../src/trace-toolpack/storedCauseReader.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,6IAA6I;AAC7I,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,MAAM,SAAS,GAAY,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAEtE,iGAAiG;AACjG,MAAM,CAAC,MAAM,iBAAiB,GAC5B,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAE,SAAmC,CAAC,CAAC,CAAC,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoredCaptureHistory } from 'footprintjs/trace';
|
|
2
|
+
import type { RecordScope } from 'foottrace/cause';
|
|
3
|
+
import type { SourceCaptureStatus } from './causeCapture.js';
|
|
4
|
+
/** Policy over one public-reader-admitted history, not a second stored protocol validator. */
|
|
5
|
+
export declare function storedCauseSources(history: StoredCaptureHistory): {
|
|
6
|
+
readonly status: SourceCaptureStatus;
|
|
7
|
+
readonly scope: NonNullable<RecordScope['readSources']>;
|
|
8
|
+
} | 'source-ownership-unproven' | 'source-incomplete';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Policy over one public-reader-admitted history, not a second stored protocol validator. */
|
|
2
|
+
export function storedCauseSources(history) {
|
|
3
|
+
const sources = history.readSources;
|
|
4
|
+
if (sources?.version !== 2 ||
|
|
5
|
+
sources.ownership.version !== 1 ||
|
|
6
|
+
sources.ownership.status !== 'captured' ||
|
|
7
|
+
sources.ownership.limitations.length !== 0)
|
|
8
|
+
return 'source-ownership-unproven';
|
|
9
|
+
if (!sources.record ||
|
|
10
|
+
sources.record.version !== 1 ||
|
|
11
|
+
sources.record.segment !== 1 ||
|
|
12
|
+
!['captured', 'partial', 'failed', 'unknown'].includes(sources.status))
|
|
13
|
+
return 'source-incomplete';
|
|
14
|
+
return {
|
|
15
|
+
status: sources.status,
|
|
16
|
+
scope: {
|
|
17
|
+
record: sources.record,
|
|
18
|
+
// Only independently collected native ownership authorizes bindings. No source row,
|
|
19
|
+
// filename, receipt, guessed root namespace or fabricated attempt may supply them.
|
|
20
|
+
executions: sources.ownership.executions.map(({ runtimeStageId, stateAddress, attemptIds }) => ({
|
|
21
|
+
runtimeStageId,
|
|
22
|
+
stateAddress,
|
|
23
|
+
attemptIds,
|
|
24
|
+
})),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=storedCauseSources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedCauseSources.js","sourceRoot":"","sources":["../../../src/trace-toolpack/storedCauseSources.ts"],"names":[],"mappings":"AAIA,8FAA8F;AAC9F,MAAM,UAAU,kBAAkB,CAAC,OAA6B;IAO9D,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IACpC,IACE,OAAO,EAAE,OAAO,KAAK,CAAC;QACtB,OAAO,CAAC,SAAS,CAAC,OAAO,KAAK,CAAC;QAC/B,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,UAAU;QACvC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;QAE1C,OAAO,2BAA2B,CAAC;IACrC,IACE,CAAC,OAAO,CAAC,MAAM;QACf,OAAO,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC;QAC5B,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;QAEtE,OAAO,mBAAmB,CAAC;IAC7B,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAA6B;QAC7C,KAAK,EAAE;YACL,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,oFAAoF;YACpF,mFAAmF;YACnF,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAC1C,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;gBACjD,cAAc;gBACd,YAAY;gBACZ,UAAU;aACX,CAAC,CACH;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { StoredRecordLimits } from 'foottrace';
|
|
2
|
+
import type { CaptureReason, SnapshotCapture } from './causeCapture.js';
|
|
3
|
+
import type { TraceCauseArtifacts } from './causeTypes.js';
|
|
4
|
+
/** Host-only options for one already authorized saved root; no model storage selector. */
|
|
5
|
+
export interface ReadStoredCauseOptions {
|
|
6
|
+
readonly runId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Structural producer-reader allowances: finite non-negative integers only.
|
|
9
|
+
* Defaults: entries 16,384; missingCommits 4,096; drillDepth 64; addressLength 2,048.
|
|
10
|
+
* Entry ceiling: 65,536. The other defaults are their ceilings; lower values, including zero, are allowed.
|
|
11
|
+
* Requests above a ceiling are refused, never silently clamped.
|
|
12
|
+
*/
|
|
13
|
+
readonly readerLimits?: StoredRecordLimits;
|
|
14
|
+
/** Producer-reader evidence limit. Default 1 MiB; integer 1..8 MiB. */
|
|
15
|
+
readonly maxBytes?: number;
|
|
16
|
+
/** Checked before and after admission; cannot preempt a synchronous host iterator. */
|
|
17
|
+
readonly signal?: AbortSignal;
|
|
18
|
+
}
|
|
19
|
+
/** Fixed failure vocabulary; private receipt data and exceptions are never returned. */
|
|
20
|
+
export type StoredCauseUnknown = 'invalid-data' | 'reader-limit' | 'stored-admission' | 'native-capture' | 'projection-incomplete' | 'source-ownership-unproven' | 'source-incomplete' | 'cancelled' | 'unsupported' | 'unavailable';
|
|
21
|
+
/** Separate native observation and adapter acknowledgement; neither authenticates a producer. */
|
|
22
|
+
export interface StoredCauseAdmission {
|
|
23
|
+
readonly native: {
|
|
24
|
+
readonly status: 'admitted' | 'incomplete';
|
|
25
|
+
readonly reason: CaptureReason;
|
|
26
|
+
readonly version: 1 | 2;
|
|
27
|
+
readonly scope: 'root-log';
|
|
28
|
+
readonly persistence: 'memory-only';
|
|
29
|
+
};
|
|
30
|
+
readonly storage: {
|
|
31
|
+
readonly status: 'adapter-acknowledged-history';
|
|
32
|
+
readonly scope: 'root-log';
|
|
33
|
+
};
|
|
34
|
+
readonly readSources: SnapshotCapture['readSources'];
|
|
35
|
+
}
|
|
36
|
+
/** Factory-owned cause. This display assessment is not transferable serving authority. */
|
|
37
|
+
export interface StoredCauseArtifacts extends TraceCauseArtifacts {
|
|
38
|
+
readonly admission: StoredCauseAdmission;
|
|
39
|
+
}
|
|
40
|
+
/** Unknown has no graph to query; ready does not promise a unique root. */
|
|
41
|
+
export type StoredCauseResult = {
|
|
42
|
+
readonly status: 'ready';
|
|
43
|
+
readonly cause: StoredCauseArtifacts;
|
|
44
|
+
} | {
|
|
45
|
+
readonly status: 'unknown';
|
|
46
|
+
readonly reason: StoredCauseUnknown;
|
|
47
|
+
readonly cause?: never;
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedCauseTypes.js","sourceRoot":"","sources":["../../../src/trace-toolpack/storedCauseTypes.ts"],"names":[],"mappings":""}
|
|
@@ -43,6 +43,8 @@ import { boundedPreview, clampParam, displayKey, displayText, normalizeKey, rend
|
|
|
43
43
|
import { askInner, framed, innerPackSlot } from './innerDescent.js';
|
|
44
44
|
import { openRecording } from './openRecording.js';
|
|
45
45
|
import { buildCauseTools } from './causeTools.js';
|
|
46
|
+
import { storedCauseAssessment } from './storedCauseBinding.js';
|
|
47
|
+
import { captureOwn } from './causeCapture.js';
|
|
46
48
|
import { homeMountOf, innerCommitCount, mountChain, openSubflow, opensWithSeed, subflowResultsOf, subflowWrote, } from './subflowRecords.js';
|
|
47
49
|
import { resolveToolpackOptions, TOOLPACK_HARD_CAPS, } from './types.js';
|
|
48
50
|
// ── Display caps that are structural (not consumer-tunable) ───────────────
|
|
@@ -356,6 +358,22 @@ function matchWindow(text, needleLower, radius) {
|
|
|
356
358
|
* agent mid-run — and treat tool outputs as data, not instructions.
|
|
357
359
|
*/
|
|
358
360
|
export function traceToolpack(artifacts, options) {
|
|
361
|
+
// Saved-only evidence has its own graph-only door. Inspect the claim as data
|
|
362
|
+
// before a snapshot getter, indexing or any graph code can run.
|
|
363
|
+
let savedClaim = true;
|
|
364
|
+
try {
|
|
365
|
+
const cause = Object.getOwnPropertyDescriptor(artifacts, 'cause');
|
|
366
|
+
savedClaim =
|
|
367
|
+
storedCauseAssessment(artifacts).kind !== 'none' ||
|
|
368
|
+
(cause === undefined
|
|
369
|
+
? 'cause' in artifacts
|
|
370
|
+
: storedCauseAssessment(captureOwn(artifacts, 'cause')).kind !== 'none');
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
// An accessor or hostile object cannot supply evidence for a mixed bag.
|
|
374
|
+
}
|
|
375
|
+
if (savedClaim)
|
|
376
|
+
throw new TypeError('Stored capture evidence requires traceCauseTools.');
|
|
359
377
|
const opts = resolveToolpackOptions(options);
|
|
360
378
|
const index = buildIndex(artifacts);
|
|
361
379
|
// ONE reader over the scattered tool-call evidence, shared by the two
|