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,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectCauseBasis = void 0;
|
|
4
|
+
const cause_1 = require("foottrace/cause");
|
|
5
|
+
const causeCapture_js_1 = require("./causeCapture.js");
|
|
6
|
+
const causeControl_js_1 = require("./causeControl.js");
|
|
7
|
+
/** A snapshot projection, not another dependence walker. The public reader owns all graph reasoning. */
|
|
8
|
+
function projectCauseBasis(snapshot, nodes, controlDeps, extras) {
|
|
9
|
+
// A snapshot-local namespace is not a storage address or a service-correlation claim.
|
|
10
|
+
const recordedAddress = (0, causeCapture_js_1.captureOwn)(snapshot, 'logAddress');
|
|
11
|
+
const runId = (0, causeCapture_js_1.captureOwn)(snapshot, 'runId');
|
|
12
|
+
const address = recordedAddress ??
|
|
13
|
+
(typeof runId === 'string' ? { logRunId: `snapshot:${runId}`, drillPath: [] } : undefined);
|
|
14
|
+
if (address === undefined)
|
|
15
|
+
return undefined;
|
|
16
|
+
const log = (0, causeCapture_js_1.captureOwn)(snapshot, 'commitLog');
|
|
17
|
+
if (!Array.isArray(log))
|
|
18
|
+
return undefined;
|
|
19
|
+
if (log.length > 4096)
|
|
20
|
+
return 'truncated';
|
|
21
|
+
let capture = extras?.sources
|
|
22
|
+
? (0, causeCapture_js_1.assessSourceCapture)(snapshot, log.length, extras.sources.status)
|
|
23
|
+
: (0, causeCapture_js_1.assessCapture)(snapshot, log.length);
|
|
24
|
+
const nativeControl = capture.status === 'admitted' ? (0, causeControl_js_1.capturedControl)(snapshot) : undefined;
|
|
25
|
+
if (capture.status === 'admitted' && nativeControl === undefined)
|
|
26
|
+
capture = (0, causeCapture_js_1.captureAssessment)('control-not-retained', capture.readSources);
|
|
27
|
+
const reads = Object.create(null);
|
|
28
|
+
const marks = Object.create(null);
|
|
29
|
+
const control = Object.create(null);
|
|
30
|
+
let visited = 0;
|
|
31
|
+
for (const [id, stage] of nodes) {
|
|
32
|
+
if (visited++ >= 4096)
|
|
33
|
+
return 'truncated';
|
|
34
|
+
const capturedReads = (0, causeCapture_js_1.captureOwn)(stage, 'stageReads');
|
|
35
|
+
if (capturedReads !== null && typeof capturedReads === 'object')
|
|
36
|
+
reads[id] = Object.keys(capturedReads);
|
|
37
|
+
else if (capture.status === 'admitted')
|
|
38
|
+
reads[id] = [];
|
|
39
|
+
const omitted = extras?.readKeys?.get(id);
|
|
40
|
+
if (omitted)
|
|
41
|
+
reads[id] = [...new Set([...(reads[id] ?? []), ...omitted])];
|
|
42
|
+
const attention = (0, causeCapture_js_1.captureOwn)(stage, 'attention');
|
|
43
|
+
if (attention !== undefined)
|
|
44
|
+
marks[id] = attention;
|
|
45
|
+
const parent = nativeControl === undefined ? controlDeps?.()?.(id) : nativeControl[id];
|
|
46
|
+
if (parent !== undefined)
|
|
47
|
+
control[id] = { deciderId: parent.deciderId };
|
|
48
|
+
}
|
|
49
|
+
if (capture.status === 'admitted' &&
|
|
50
|
+
log.some((bundle) => !nodes.has((0, causeCapture_js_1.captureOwn)(bundle, 'runtimeStageId'))))
|
|
51
|
+
capture = (0, causeCapture_js_1.captureAssessment)('projection-incomplete', capture.readSources);
|
|
52
|
+
const complete = capture.status === 'admitted';
|
|
53
|
+
const scopeAddress = (complete && (0, causeCapture_js_1.captureAddress)((0, causeCapture_js_1.captureOwn)(snapshot, 'logAddress'))) || address;
|
|
54
|
+
const scope = {
|
|
55
|
+
address: scopeAddress,
|
|
56
|
+
commitLog: log,
|
|
57
|
+
reads,
|
|
58
|
+
...(complete || Object.keys(marks).length
|
|
59
|
+
? { attention: marks }
|
|
60
|
+
: {}),
|
|
61
|
+
...(nativeControl === undefined && controlDeps?.() === undefined
|
|
62
|
+
? {}
|
|
63
|
+
: { controlDeps: control }),
|
|
64
|
+
complete,
|
|
65
|
+
...(extras?.initialState === undefined ? {} : { initialState: extras.initialState }),
|
|
66
|
+
...(extras?.sources === undefined ? {} : { readSources: extras.sources.scope }),
|
|
67
|
+
};
|
|
68
|
+
const graph = (0, cause_1.createRecordGraph)([scope], { maxCommits: 4096 });
|
|
69
|
+
// The public scope reader admits untrusted commits and creates its own official IDs.
|
|
70
|
+
return {
|
|
71
|
+
graph: { ...graph, roots: (context) => graph.openScope(scopeAddress, context) },
|
|
72
|
+
capture,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
exports.projectCauseBasis = projectCauseBasis;
|
|
76
|
+
//# sourceMappingURL=causeProjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"causeProjection.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeProjection.ts"],"names":[],"mappings":";;;AAAA,2CAAsE;AAItE,uDAQ2B;AAC3B,uDAAoD;AAMpD,wGAAwG;AACxG,SAAgB,iBAAiB,CAC/B,QAAiB,EACjB,KAAyC,EACzC,WAAgD,EAChD,MAOC;IAED,sFAAsF;IACtF,MAAM,eAAe,GAAG,IAAA,4BAAG,EAAC,QAAQ,EAAE,YAAY,CAAuC,CAAC;IAC1F,MAAM,KAAK,GAAG,IAAA,4BAAG,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,OAAO,GACX,eAAe;QACf,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7F,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAA,4BAAG,EAAC,QAAQ,EAAE,WAAW,CAA6B,CAAC;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI;QAAE,OAAO,WAAW,CAAC;IAC1C,IAAI,OAAO,GAAG,MAAM,EAAE,OAAO;QAC3B,CAAC,CAAC,IAAA,qCAAmB,EAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;QAClE,CAAC,CAAC,IAAA,+BAAa,EAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,aAAa,GAAG,OAAO,CA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,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QAC7B,QAAQ;QACR,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;QACpF,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;KAChF,CAAC;IACF,MAAM,KAAK,GAAG,IAAA,yBAAiB,EAAC,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,qFAAqF;IACrF,OAAO;QACL,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE;QAC/E,OAAO;KACR,CAAC;AACJ,CAAC;AAzED,8CAyEC"}
|
|
@@ -4,25 +4,33 @@ exports.readCause = void 0;
|
|
|
4
4
|
const cause_1 = require("foottrace/cause");
|
|
5
5
|
const causeSnapshot_js_1 = require("./causeSnapshot.js");
|
|
6
6
|
const causeResponse_js_1 = require("./causeResponse.js");
|
|
7
|
+
const causeContext_js_1 = require("./causeContext.js");
|
|
7
8
|
/** One public query, one cache/deadline/total ceiling. No model, rerun, storage URL or second walker. */
|
|
8
|
-
async function readCause(operation,
|
|
9
|
-
const
|
|
9
|
+
async function readCause(operation, context, question, limits, deadline, signal) {
|
|
10
|
+
const assessed = (0, causeContext_js_1.causeContextAssessment)(context);
|
|
11
|
+
if (assessed.kind === 'invalid')
|
|
12
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'invalid-data');
|
|
13
|
+
const snapshotOnly = context.kind === 'snapshot' && context.artifacts.cause === undefined ? true : undefined;
|
|
14
|
+
const storedCapture = assessed.kind === 'stored' ? assessed.capture : undefined;
|
|
15
|
+
const storage = assessed.kind === 'stored' ? assessed.admission.storage : undefined;
|
|
10
16
|
if (signal?.aborted)
|
|
11
|
-
return (0, causeResponse_js_1.causeGap)(operation, 'cancelled', snapshotOnly);
|
|
17
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'cancelled', storedCapture ?? snapshotOnly, storage, limits.maxChars);
|
|
12
18
|
if (performance.now() >= deadline)
|
|
13
|
-
return (0, causeResponse_js_1.causeGap)(operation, 'timeout', snapshotOnly);
|
|
14
|
-
const projection =
|
|
15
|
-
|
|
19
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'timeout', storedCapture ?? snapshotOnly, storage, limits.maxChars);
|
|
20
|
+
const projection = context.kind === 'snapshot' && context.artifacts.cause === undefined
|
|
21
|
+
? (0, causeSnapshot_js_1.snapshotCauseArtifacts)(context.artifacts, context.nodes)
|
|
22
|
+
: undefined;
|
|
23
|
+
const source = context.kind === 'graph' ? context.cause : context.artifacts.cause ?? projection;
|
|
16
24
|
if (source === 'truncated')
|
|
17
25
|
return (0, causeResponse_js_1.causeGap)(operation, 'truncated', snapshotOnly);
|
|
18
26
|
if (source === undefined)
|
|
19
27
|
return (0, causeResponse_js_1.causeGap)(operation, 'not-collected', snapshotOnly);
|
|
20
|
-
const capture = projection && projection !== 'truncated' ? projection.capture : undefined;
|
|
28
|
+
const capture = storedCapture ?? (projection && projection !== 'truncated' ? projection.capture : undefined);
|
|
21
29
|
const remaining = Math.floor(deadline - performance.now());
|
|
22
30
|
if (signal?.aborted)
|
|
23
|
-
return (0, causeResponse_js_1.causeGap)(operation, 'cancelled', capture);
|
|
31
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'cancelled', capture, storage, limits.maxChars);
|
|
24
32
|
if (remaining < 1)
|
|
25
|
-
return (0, causeResponse_js_1.causeGap)(operation, 'timeout', capture);
|
|
33
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'timeout', capture, storage, limits.maxChars);
|
|
26
34
|
const { maxChars, backward, impact, maxNodes, maxDepth, maxEdges, maxCalls } = limits;
|
|
27
35
|
const options = { maxNodes, maxDepth, maxEdges, maxCalls, timeoutMs: remaining, signal };
|
|
28
36
|
if (operation === 'attention_list') {
|
|
@@ -40,22 +48,22 @@ async function readCause(operation, artifacts, nodes, question, limits, deadline
|
|
|
40
48
|
: result;
|
|
41
49
|
return (0, causeResponse_js_1.causeResponse)(operation, finding, finding.confidence === 'incomplete'
|
|
42
50
|
? 'Not sure, because coverage is incomplete. An absent mark is not proof of a healthy or reached step.'
|
|
43
|
-
: 'Recorded attention within this query only. Cite the returned node and evidence IDs.', maxChars, capture);
|
|
51
|
+
: 'Recorded attention within this query only. Cite the returned node and evidence IDs.', maxChars, capture, storage);
|
|
44
52
|
}
|
|
45
53
|
// Each invocation projects one bounded query. Separate root/impact calls do not share a result yet.
|
|
46
54
|
if (question.nodeId === undefined)
|
|
47
|
-
return (0, causeResponse_js_1.causeGap)(operation, 'invalid-data', capture);
|
|
55
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'invalid-data', capture, storage, limits.maxChars);
|
|
48
56
|
const finding = await (0, cause_1.explain)(source.graph, question.nodeId, { ...options, backward, impact });
|
|
49
57
|
if (operation === 'impact') {
|
|
50
58
|
return (0, causeResponse_js_1.causeResponse)(operation, finding.impact, finding.impact.confidence === 'incomplete'
|
|
51
59
|
? 'Not sure of the full impact, because the returned gaps limit the recorded forward slice.'
|
|
52
|
-
: 'Recorded reachable impact only; this does not prove effects in unrecorded services or unreached branches.', maxChars, capture);
|
|
60
|
+
: 'Recorded reachable impact only; this does not prove effects in unrecorded services or unreached branches.', maxChars, capture, storage);
|
|
53
61
|
}
|
|
54
62
|
return (0, causeResponse_js_1.causeResponse)(operation, finding, finding.rootCause !== undefined
|
|
55
63
|
? 'A unique recorded dependency root is supported. Cite its node ID and path; this is not proof of a provider-internal physical cause.'
|
|
56
64
|
: finding.confidence === 'incomplete'
|
|
57
65
|
? 'Not sure, because the returned gaps prevent a unique supported root. Alternatives are not confirmed causes.'
|
|
58
|
-
: 'No unique marked root in the checked graph. Cite alternatives without selecting one as fact.', maxChars, capture);
|
|
66
|
+
: 'No unique marked root in the checked graph. Cite alternatives without selecting one as fact.', maxChars, capture, storage);
|
|
59
67
|
}
|
|
60
68
|
exports.readCause = readCause;
|
|
61
69
|
//# sourceMappingURL=causeReader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causeReader.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeReader.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;
|
|
1
|
+
{"version":3,"file":"causeReader.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeReader.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AAGzD,yDAA4D;AAC5D,yDAA6D;AAC7D,uDAA8E;AAE9E,yGAAyG;AAClG,KAAK,UAAU,SAAS,CAC7B,SAA8B,EAC9B,OAAqB,EACrB,QAA4B,EAC5B,MAAmB,EACnB,QAAgB,EAChB,MAAoB;IAEpB,MAAM,QAAQ,GAAG,IAAA,wCAAsB,EAAC,OAAO,CAAC,CAAC;IACjD,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,IAAA,2BAAQ,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAC5E,MAAM,YAAY,GAChB,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1F,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC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,OAAO,CACR,CAAC;IACJ,CAAC;IACD,oGAAoG;IACpG,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS;QAC/B,OAAO,IAAA,2BAAQ,EAAC,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChF,MAAM,OAAO,GAAG,MAAM,IAAA,eAAO,EAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/F,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IAAA,gCAAa,EAClB,SAAS,EACT,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,MAAM,CAAC,UAAU,KAAK,YAAY;YACxC,CAAC,CAAC,0FAA0F;YAC5F,CAAC,CAAC,2GAA2G,EAC/G,QAAQ,EACR,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,gCAAa,EAClB,SAAS,EACT,OAAO,EACP,OAAO,CAAC,SAAS,KAAK,SAAS;QAC7B,CAAC,CAAC,qIAAqI;QACvI,CAAC,CAAC,OAAO,CAAC,UAAU,KAAK,YAAY;YACrC,CAAC,CAAC,6GAA6G;YAC/G,CAAC,CAAC,8FAA8F,EAClG,QAAQ,EACR,OAAO,EACP,OAAO,CACR,CAAC;AACJ,CAAC;AA3FD,8BA2FC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.causeResponse = exports.causeGap = void 0;
|
|
4
|
+
const STORED_LIMITATION = 'The storage adapter acknowledged these saved root-history bytes only. The native note remains memory-only; this receipt is not producer authentication or whole-workflow delivery proof.';
|
|
4
5
|
const SNAPSHOT_LIMITATION = 'Snapshot-only records have no engine-written capture/end attestation. This reader cannot prove a root cause from them, even after a normally finished run.';
|
|
5
6
|
const CAPTURE_REASONS = {
|
|
6
7
|
'captured-root-log': 'Capture covers this in-memory root log only; exact read versions, child scopes and durable delivery remain unproven.',
|
|
@@ -16,35 +17,51 @@ const CAPTURE_REASONS = {
|
|
|
16
17
|
'control-not-retained': 'Same-run captured control-dependency data is missing, partial or ambiguous.',
|
|
17
18
|
'projection-incomplete': 'The execution-tree projection is missing a committed step.',
|
|
18
19
|
};
|
|
19
|
-
function interpretationFor(text, capture) {
|
|
20
|
-
|
|
20
|
+
function interpretationFor(text, capture, storage) {
|
|
21
|
+
const native = capture
|
|
21
22
|
? `${text} ${capture === true
|
|
22
23
|
? 'The capture/end attestation was not inspected. No completeness claim is made.'
|
|
23
|
-
:
|
|
24
|
+
: capture.reason === 'captured-root-log' && capture.readSources !== 'not-collected'
|
|
25
|
+
? 'Capture covers this saved root log segment only. Read-source observations use independently collected native ownership; unavailable reads retain gaps. Child scopes and whole-workflow durable delivery remain unproven.'
|
|
26
|
+
: CAPTURE_REASONS[capture.reason]}`
|
|
24
27
|
: text;
|
|
28
|
+
return storage === undefined ? native : `${native} ${STORED_LIMITATION}`;
|
|
25
29
|
}
|
|
26
30
|
/** Fixed wording: no exception messages, state values or provider payloads cross this boundary. */
|
|
27
|
-
function causeGap(tool, code, capture) {
|
|
28
|
-
|
|
31
|
+
function causeGap(tool, code, capture, storage, maxChars) {
|
|
32
|
+
const text = JSON.stringify({
|
|
29
33
|
tool,
|
|
30
34
|
mode: 'recorded-evidence',
|
|
31
35
|
confidence: 'incomplete',
|
|
32
36
|
gaps: [{ code, evidence: [] }],
|
|
33
37
|
...(capture && capture !== true ? { capture } : {}),
|
|
34
|
-
|
|
38
|
+
...(storage === undefined ? {} : { storage }),
|
|
39
|
+
interpretation: interpretationFor('Not sure: the requested evidence is incomplete. No root cause is asserted.', capture, storage),
|
|
35
40
|
});
|
|
41
|
+
// The native + saved assessments can themselves exceed a small output ceiling.
|
|
42
|
+
// Withhold them together with the proof; never clip a label into an apparent root.
|
|
43
|
+
return storage !== undefined && maxChars !== undefined && text.length > maxChars
|
|
44
|
+
? JSON.stringify({
|
|
45
|
+
tool,
|
|
46
|
+
mode: 'recorded-evidence',
|
|
47
|
+
confidence: 'incomplete',
|
|
48
|
+
gaps: [{ code, evidence: [] }],
|
|
49
|
+
interpretation: 'Recorded evidence response: output limit reached. The response contains a gap, no root or full assessment. The storage adapter acknowledged saved root-history bytes only; native capture is memory-only. Producer identity and whole-workflow delivery remain unproven.',
|
|
50
|
+
})
|
|
51
|
+
: text;
|
|
36
52
|
}
|
|
37
53
|
exports.causeGap = causeGap;
|
|
38
54
|
/** A clipped proof must never leave behind a seemingly supported root or apparently complete empty list. */
|
|
39
|
-
function causeResponse(tool, finding, interpretation, maxChars, capture) {
|
|
55
|
+
function causeResponse(tool, finding, interpretation, maxChars, capture, storage) {
|
|
40
56
|
const text = JSON.stringify({
|
|
41
57
|
tool,
|
|
42
58
|
mode: 'recorded-evidence',
|
|
43
59
|
finding,
|
|
44
60
|
...(capture && capture !== true ? { capture } : {}),
|
|
45
|
-
|
|
61
|
+
...(storage === undefined ? {} : { storage }),
|
|
62
|
+
interpretation: interpretationFor(interpretation, capture, storage),
|
|
46
63
|
});
|
|
47
|
-
return text.length <= maxChars ? text : causeGap(tool, 'truncated', capture);
|
|
64
|
+
return text.length <= maxChars ? text : causeGap(tool, 'truncated', capture, storage, maxChars);
|
|
48
65
|
}
|
|
49
66
|
exports.causeResponse = causeResponse;
|
|
50
67
|
//# sourceMappingURL=causeResponse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causeResponse.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeResponse.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"causeResponse.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeResponse.ts"],"names":[],"mappings":";;;AAMA,MAAM,iBAAiB,GACrB,0LAA0L,CAAC;AAE7L,MAAM,mBAAmB,GACvB,4JAA4J,CAAC;AAE/J,M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AAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAClG,CAAC;AAjBD,sCAiBC"}
|
|
@@ -1,70 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.snapshotCauseArtifacts = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const causeControl_js_1 = require("./causeControl.js");
|
|
7
|
-
/** A snapshot projection, not another dependence walker. The public reader owns all graph reasoning. */
|
|
4
|
+
const causeProjection_js_1 = require("./causeProjection.js");
|
|
5
|
+
/** Preserve the existing in-memory projection through the shared narrow basis. */
|
|
8
6
|
function snapshotCauseArtifacts(artifacts, nodes) {
|
|
9
|
-
|
|
10
|
-
// A snapshot-local namespace is not a storage address or a service-correlation claim.
|
|
11
|
-
const recordedAddress = (0, causeCapture_js_1.captureOwn)(snapshot, 'logAddress');
|
|
12
|
-
const runId = (0, causeCapture_js_1.captureOwn)(snapshot, 'runId');
|
|
13
|
-
const address = recordedAddress ??
|
|
14
|
-
(typeof runId === 'string' ? { logRunId: `snapshot:${runId}`, drillPath: [] } : undefined);
|
|
15
|
-
if (address === undefined)
|
|
16
|
-
return undefined;
|
|
17
|
-
const log = (0, causeCapture_js_1.captureOwn)(snapshot, 'commitLog');
|
|
18
|
-
if (!Array.isArray(log))
|
|
19
|
-
return undefined;
|
|
20
|
-
if (log.length > 4096)
|
|
21
|
-
return 'truncated';
|
|
22
|
-
let capture = (0, causeCapture_js_1.assessCapture)(snapshot, log.length);
|
|
23
|
-
const nativeControl = capture.status === 'admitted' ? (0, causeControl_js_1.capturedControl)(snapshot) : undefined;
|
|
24
|
-
if (capture.status === 'admitted' && nativeControl === undefined)
|
|
25
|
-
capture = (0, causeCapture_js_1.captureAssessment)('control-not-retained');
|
|
26
|
-
const reads = Object.create(null);
|
|
27
|
-
const marks = Object.create(null);
|
|
28
|
-
const control = Object.create(null);
|
|
29
|
-
let visited = 0;
|
|
30
|
-
for (const [id, stage] of nodes) {
|
|
31
|
-
if (visited++ >= 4096)
|
|
32
|
-
return 'truncated';
|
|
33
|
-
const capturedReads = (0, causeCapture_js_1.captureOwn)(stage, 'stageReads');
|
|
34
|
-
if (capturedReads !== null && typeof capturedReads === 'object')
|
|
35
|
-
reads[id] = Object.keys(capturedReads);
|
|
36
|
-
else if (capture.status === 'admitted')
|
|
37
|
-
reads[id] = [];
|
|
38
|
-
const attention = (0, causeCapture_js_1.captureOwn)(stage, 'attention');
|
|
39
|
-
if (attention !== undefined)
|
|
40
|
-
marks[id] = attention;
|
|
41
|
-
const parent = nativeControl === undefined ? artifacts.controlDeps?.(id) : nativeControl[id];
|
|
42
|
-
if (parent !== undefined)
|
|
43
|
-
control[id] = { deciderId: parent.deciderId };
|
|
44
|
-
}
|
|
45
|
-
if (capture.status === 'admitted' &&
|
|
46
|
-
log.some((bundle) => !nodes.has((0, causeCapture_js_1.captureOwn)(bundle, 'runtimeStageId'))))
|
|
47
|
-
capture = (0, causeCapture_js_1.captureAssessment)('projection-incomplete');
|
|
48
|
-
const complete = capture.status === 'admitted';
|
|
49
|
-
const scopeAddress = (complete && (0, causeCapture_js_1.captureAddress)((0, causeCapture_js_1.captureOwn)(snapshot, 'logAddress'))) || address;
|
|
50
|
-
const scope = {
|
|
51
|
-
address: scopeAddress,
|
|
52
|
-
commitLog: log,
|
|
53
|
-
reads,
|
|
54
|
-
...(complete || Object.keys(marks).length
|
|
55
|
-
? { attention: marks }
|
|
56
|
-
: {}),
|
|
57
|
-
...(nativeControl === undefined && artifacts.controlDeps === undefined
|
|
58
|
-
? {}
|
|
59
|
-
: { controlDeps: control }),
|
|
60
|
-
complete,
|
|
61
|
-
};
|
|
62
|
-
const graph = (0, cause_1.createRecordGraph)([scope], { maxCommits: 4096 });
|
|
63
|
-
// The public scope reader admits untrusted commits and creates its own official IDs.
|
|
64
|
-
return {
|
|
65
|
-
graph: { ...graph, roots: (context) => graph.openScope(scopeAddress, context) },
|
|
66
|
-
capture,
|
|
67
|
-
};
|
|
7
|
+
return (0, causeProjection_js_1.projectCauseBasis)(artifacts.snapshot, nodes, () => artifacts.controlDeps);
|
|
68
8
|
}
|
|
69
9
|
exports.snapshotCauseArtifacts = snapshotCauseArtifacts;
|
|
70
10
|
//# sourceMappingURL=causeSnapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causeSnapshot.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeSnapshot.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"causeSnapshot.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeSnapshot.ts"],"names":[],"mappings":";;;AAEA,6DAAyD;AAEzD,kFAAkF;AAClF,SAAgB,sBAAsB,CACpC,SAAiC,EACjC,KAAyC;IAEzC,OAAO,IAAA,sCAAiB,EAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AACnF,CAAC;AALD,wDAKC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildCauseTools = void 0;
|
|
3
|
+
exports.traceCauseTools = exports.buildCauseTools = void 0;
|
|
4
4
|
const tools_js_1 = require("../tools/tools.js");
|
|
5
5
|
const causeLimits_js_1 = require("./causeLimits.js");
|
|
6
6
|
const causeResponse_js_1 = require("./causeResponse.js");
|
|
7
7
|
const causeLoad_js_1 = require("./causeLoad.js");
|
|
8
|
+
const causeContext_js_1 = require("./causeContext.js");
|
|
8
9
|
const nodeId = {
|
|
9
10
|
type: 'string',
|
|
10
11
|
minLength: 1,
|
|
@@ -37,37 +38,60 @@ const CAUSE_OPERATIONS = {
|
|
|
37
38
|
};
|
|
38
39
|
/** Model questions select IDs only. The host owns all resource controls. */
|
|
39
40
|
function buildCauseTools(artifacts, nodes, options) {
|
|
41
|
+
return toolsForContext({ kind: 'snapshot', artifacts, nodes }, options);
|
|
42
|
+
}
|
|
43
|
+
exports.buildCauseTools = buildCauseTools;
|
|
44
|
+
/**
|
|
45
|
+
* Serve the three read-only cause questions over one host-authorized graph.
|
|
46
|
+
* Saved evidence must be the exact object returned by `readStoredCauseArtifacts`;
|
|
47
|
+
* copied display assessments do not grant saved-history authority.
|
|
48
|
+
* No snapshot is indexed, no storage is fetched and no business work is rerun.
|
|
49
|
+
*/
|
|
50
|
+
function traceCauseTools(cause, options) {
|
|
51
|
+
return toolsForContext({ kind: 'graph', cause }, options);
|
|
52
|
+
}
|
|
53
|
+
exports.traceCauseTools = traceCauseTools;
|
|
54
|
+
function toolsForContext(context, options) {
|
|
40
55
|
return Object.keys(CAUSE_OPERATIONS).map((operation) => (0, tools_js_1.defineTool)({
|
|
41
56
|
name: operation,
|
|
42
57
|
...CAUSE_OPERATIONS[operation],
|
|
43
|
-
execute: async (question,
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
return (0, causeResponse_js_1.causeGap)(operation, '
|
|
58
|
+
execute: async (question, execution) => {
|
|
59
|
+
const assessed = (0, causeContext_js_1.causeContextAssessment)(context);
|
|
60
|
+
if (assessed.kind === 'invalid')
|
|
61
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'invalid-data');
|
|
62
|
+
const capture = assessed.kind === 'stored'
|
|
63
|
+
? assessed.capture
|
|
64
|
+
: context.kind === 'snapshot' && context.artifacts.cause === undefined
|
|
65
|
+
? true
|
|
66
|
+
: undefined;
|
|
67
|
+
const storage = assessed.kind === 'stored' ? assessed.admission.storage : undefined;
|
|
68
|
+
if (execution.signal?.aborted && storage === undefined)
|
|
69
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'cancelled', capture);
|
|
47
70
|
let limits;
|
|
48
71
|
try {
|
|
49
72
|
limits = (0, causeLimits_js_1.causeLimits)(options);
|
|
50
73
|
}
|
|
51
74
|
catch {
|
|
52
|
-
return (0, causeResponse_js_1.causeGap)(operation, 'invalid-data',
|
|
75
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'invalid-data', capture, storage, 512);
|
|
53
76
|
}
|
|
77
|
+
if (execution.signal?.aborted)
|
|
78
|
+
return (0, causeResponse_js_1.causeGap)(operation, 'cancelled', capture, storage, limits.maxChars);
|
|
54
79
|
const deadline = performance.now() + limits.timeoutMs;
|
|
55
80
|
try {
|
|
56
|
-
const loaded = await (0, causeLoad_js_1.loadCauseReader)(deadline,
|
|
81
|
+
const loaded = await (0, causeLoad_js_1.loadCauseReader)(deadline, execution.signal);
|
|
57
82
|
if ('gap' in loaded)
|
|
58
|
-
return (0, causeResponse_js_1.causeGap)(operation, loaded.gap,
|
|
59
|
-
return await loaded.reader.readCause(operation,
|
|
83
|
+
return (0, causeResponse_js_1.causeGap)(operation, loaded.gap, capture, storage, limits.maxChars);
|
|
84
|
+
return await loaded.reader.readCause(operation, context, question, limits, deadline, execution.signal);
|
|
60
85
|
}
|
|
61
86
|
catch {
|
|
62
87
|
// Includes bounded loader refusals. Never echo an exception or disclose a private path.
|
|
63
|
-
return (0, causeResponse_js_1.causeGap)(operation,
|
|
88
|
+
return (0, causeResponse_js_1.causeGap)(operation, execution.signal?.aborted
|
|
64
89
|
? 'cancelled'
|
|
65
90
|
: performance.now() >= deadline
|
|
66
91
|
? 'timeout'
|
|
67
|
-
: 'unavailable',
|
|
92
|
+
: 'unavailable', capture, storage, limits.maxChars);
|
|
68
93
|
}
|
|
69
94
|
},
|
|
70
95
|
}));
|
|
71
96
|
}
|
|
72
|
-
exports.buildCauseTools = buildCauseTools;
|
|
73
97
|
//# sourceMappingURL=causeTools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"causeTools.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeTools.ts"],"names":[],"mappings":";;;AACA,gDAA0D;
|
|
1
|
+
{"version":3,"file":"causeTools.js","sourceRoot":"","sources":["../../src/trace-toolpack/causeTools.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AC3B,OAAO,IAAA,2BAAQ,EAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7E,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;YACtD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAe,EAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;gBACjE,IAAI,KAAK,IAAI,MAAM;oBACjB,OAAO,IAAA,2BAAQ,EAAC,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC5E,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAClC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,CAAC,MAAM,CACjB,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,wFAAwF;gBACxF,OAAO,IAAA,2BAAQ,EACb,SAAS,EACT,SAAS,CAAC,MAAM,EAAE,OAAO;oBACvB,CAAC,CAAC,WAAW;oBACb,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,QAAQ;wBAC/B,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,aAAa,EACjB,OAAO,EACP,OAAO,EACP,MAAM,CAAC,QAAQ,CAChB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* as navigable as this one.
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.TOOLPACK_HARD_CAPS = exports.SELF_EXPLAIN_MAX_EVENTS = exports.SelfExplainBinding = exports.buildSelfExplainToolProvider = exports.buildSelfExplainSkill = exports.traceDebugAgent = exports.mergeInnerRuns = exports.innerRunsOf = exports.innerRunStore = exports.INNER_RUN_RECORDS = exports.DEFAULT_INNER_RUN_LIMIT = exports.openRecording = exports.NO_COMPLETED_RUN_MESSAGE = exports.lazyTraceToolpack = exports.TRACE_TOOL_NAMES = exports.traceToolpack = exports.callTraceTool = void 0;
|
|
22
|
+
exports.TOOLPACK_HARD_CAPS = exports.SELF_EXPLAIN_MAX_EVENTS = exports.SelfExplainBinding = exports.buildSelfExplainToolProvider = exports.buildSelfExplainSkill = exports.traceDebugAgent = exports.mergeInnerRuns = exports.innerRunsOf = exports.innerRunStore = exports.INNER_RUN_RECORDS = exports.DEFAULT_INNER_RUN_LIMIT = exports.readStoredCauseArtifacts = exports.traceCauseTools = exports.openRecording = exports.NO_COMPLETED_RUN_MESSAGE = exports.lazyTraceToolpack = exports.TRACE_TOOL_NAMES = exports.traceToolpack = exports.callTraceTool = void 0;
|
|
23
23
|
var traceToolpack_js_1 = require("./traceToolpack.js");
|
|
24
24
|
Object.defineProperty(exports, "callTraceTool", { enumerable: true, get: function () { return traceToolpack_js_1.callTraceTool; } });
|
|
25
25
|
Object.defineProperty(exports, "traceToolpack", { enumerable: true, get: function () { return traceToolpack_js_1.traceToolpack; } });
|
|
@@ -32,6 +32,10 @@ Object.defineProperty(exports, "lazyTraceToolpack", { enumerable: true, get: fun
|
|
|
32
32
|
Object.defineProperty(exports, "NO_COMPLETED_RUN_MESSAGE", { enumerable: true, get: function () { return lazyToolpack_js_1.NO_COMPLETED_RUN_MESSAGE; } });
|
|
33
33
|
var openRecording_js_1 = require("./openRecording.js");
|
|
34
34
|
Object.defineProperty(exports, "openRecording", { enumerable: true, get: function () { return openRecording_js_1.openRecording; } });
|
|
35
|
+
var causeTools_js_1 = require("./causeTools.js");
|
|
36
|
+
Object.defineProperty(exports, "traceCauseTools", { enumerable: true, get: function () { return causeTools_js_1.traceCauseTools; } });
|
|
37
|
+
var storedCause_js_1 = require("./storedCause.js");
|
|
38
|
+
Object.defineProperty(exports, "readStoredCauseArtifacts", { enumerable: true, get: function () { return storedCause_js_1.readStoredCauseArtifacts; } });
|
|
35
39
|
// The record a TOOL keeps of its own run — what `inspect_tool_run` opens.
|
|
36
40
|
// `INNER_RUN_RECORDS` / `innerRunsOf` are the join key between a Tool and
|
|
37
41
|
// its store; `innerRunStore` / `mergeInnerRuns` exist for consumers wiring
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trace-toolpack/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,uDAAoF;AAA3E,iHAAA,aAAa,OAAA;AAAE,iHAAA,aAAa,OAAA;AAAE,oHAAA,gBAAgB,OAAA;AACvD,2EAA2E;AAC3E,6EAA6E;AAC7E,yCAAyC;AACzC,qDAAgF;AAAvE,oHAAA,iBAAiB,OAAA;AAAE,2HAAA,wBAAwB,OAAA;AACpD,uDAA2E;AAAlE,iHAAA,aAAa,OAAA;AAEtB,0EAA0E;AAC1E,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,iEAYoC;AAXlC,6HAAA,uBAAuB,OAAA;AACvB,uHAAA,iBAAiB,OAAA;AACjB,mHAAA,aAAa,OAAA;AACb,iHAAA,WAAW,OAAA;AACX,oHAAA,cAAc,OAAA;AAQhB,2DAAoF;AAA3E,qHAAA,eAAe,OAAA;AACxB,mDAS0B;AARxB,uHAAA,qBAAqB,OAAA;AACrB,8HAAA,4BAA4B,OAAA;AAC5B,oHAAA,kBAAkB,OAAA;AAClB,yHAAA,uBAAuB,OAAA;AAMzB,uCAIoB;AAHlB,8GAAA,kBAAkB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trace-toolpack/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,uDAAoF;AAA3E,iHAAA,aAAa,OAAA;AAAE,iHAAA,aAAa,OAAA;AAAE,oHAAA,gBAAgB,OAAA;AACvD,2EAA2E;AAC3E,6EAA6E;AAC7E,yCAAyC;AACzC,qDAAgF;AAAvE,oHAAA,iBAAiB,OAAA;AAAE,2HAAA,wBAAwB,OAAA;AACpD,uDAA2E;AAAlE,iHAAA,aAAa,OAAA;AAEtB,iDAAkD;AAAzC,gHAAA,eAAe,OAAA;AACxB,mDAA4D;AAAnD,0HAAA,wBAAwB,OAAA;AAQjC,0EAA0E;AAC1E,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,iEAYoC;AAXlC,6HAAA,uBAAuB,OAAA;AACvB,uHAAA,iBAAiB,OAAA;AACjB,mHAAA,aAAa,OAAA;AACb,iHAAA,WAAW,OAAA;AACX,oHAAA,cAAc,OAAA;AAQhB,2DAAoF;AAA3E,qHAAA,eAAe,OAAA;AACxB,mDAS0B;AARxB,uHAAA,qBAAqB,OAAA;AACrB,8HAAA,4BAA4B,OAAA;AAC5B,oHAAA,kBAAkB,OAAA;AAClB,yHAAA,uBAAuB,OAAA;AAMzB,uCAIoB;AAHlB,8GAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.readStoredCauseArtifacts = void 0;
|
|
27
|
+
const causeCapture_js_1 = require("./causeCapture.js");
|
|
28
|
+
const storedCauseOptions_js_1 = require("./storedCauseOptions.js");
|
|
29
|
+
const unknown = (reason) => ({ status: 'unknown', reason });
|
|
30
|
+
/**
|
|
31
|
+
* Admit one host-authorized saved root through the producer's public reader, without a runtime snapshot.
|
|
32
|
+
* Storage acknowledgement is not producer authentication. Missing source ownership remains unknown.
|
|
33
|
+
* Graph projection is capped at 4,096 nodes/commits and uses the producer's 256-level data depth.
|
|
34
|
+
* Cannot preempt a blocking host iterator; cancellation is checked before and after asynchronous admission.
|
|
35
|
+
*/
|
|
36
|
+
async function readStoredCauseArtifacts(entries, options) {
|
|
37
|
+
let configured;
|
|
38
|
+
try {
|
|
39
|
+
configured = (0, storedCauseOptions_js_1.storedCauseOptions)(options);
|
|
40
|
+
if ((0, storedCauseOptions_js_1.storedCauseCancelled)(configured.signal))
|
|
41
|
+
return unknown('cancelled');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return unknown('invalid-data');
|
|
45
|
+
}
|
|
46
|
+
if (!globalThis.crypto?.subtle)
|
|
47
|
+
return unknown('unavailable');
|
|
48
|
+
let reader;
|
|
49
|
+
try {
|
|
50
|
+
({ readStoredCapture: reader } = await Promise.resolve().then(() => __importStar(require('./storedCauseReader.js'))));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return unknown('unsupported');
|
|
54
|
+
}
|
|
55
|
+
if ((0, storedCauseOptions_js_1.storedCauseCancelled)(configured.signal))
|
|
56
|
+
return unknown('cancelled');
|
|
57
|
+
if (typeof reader !== 'function')
|
|
58
|
+
return unknown('unsupported');
|
|
59
|
+
try {
|
|
60
|
+
const result = await reader(entries, {
|
|
61
|
+
runId: configured.runId,
|
|
62
|
+
maxBytes: configured.maxBytes,
|
|
63
|
+
...(configured.readerLimits === undefined ? {} : { limits: configured.readerLimits }),
|
|
64
|
+
});
|
|
65
|
+
if ((0, storedCauseOptions_js_1.storedCauseCancelled)(configured.signal))
|
|
66
|
+
return unknown('cancelled');
|
|
67
|
+
if ((0, causeCapture_js_1.captureOwn)(result, 'status') !== 'acknowledged') {
|
|
68
|
+
const reason = (0, causeCapture_js_1.captureOwn)(result, 'reason');
|
|
69
|
+
return unknown(reason === 'reader-limit' || reason === 'history-too-large'
|
|
70
|
+
? 'reader-limit'
|
|
71
|
+
: 'stored-admission');
|
|
72
|
+
}
|
|
73
|
+
const history = (0, causeCapture_js_1.captureOwn)(result, 'history');
|
|
74
|
+
const { projectStoredCause } = await Promise.resolve().then(() => __importStar(require('./storedCauseProjection.js')));
|
|
75
|
+
if ((0, storedCauseOptions_js_1.storedCauseCancelled)(configured.signal))
|
|
76
|
+
return unknown('cancelled');
|
|
77
|
+
const projected = projectStoredCause(history, configured.runId, configured.maxBytes);
|
|
78
|
+
return (0, storedCauseOptions_js_1.storedCauseCancelled)(configured.signal) ? unknown('cancelled') : projected;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return unknown((0, storedCauseOptions_js_1.storedCauseCancelled)(configured.signal) ? 'cancelled' : 'unavailable');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.readStoredCauseArtifacts = readStoredCauseArtifacts;
|
|
85
|
+
//# sourceMappingURL=storedCause.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedCause.js","sourceRoot":"","sources":["../../src/trace-toolp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|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storedCauseAssessment = exports.bindStoredCause = void 0;
|
|
4
|
+
const bindings = new WeakMap();
|
|
5
|
+
function admissionFor(capture, version) {
|
|
6
|
+
return Object.freeze({
|
|
7
|
+
native: Object.freeze({
|
|
8
|
+
status: capture.status,
|
|
9
|
+
reason: capture.reason,
|
|
10
|
+
version,
|
|
11
|
+
scope: 'root-log',
|
|
12
|
+
persistence: 'memory-only',
|
|
13
|
+
}),
|
|
14
|
+
storage: Object.freeze({
|
|
15
|
+
status: 'adapter-acknowledged-history',
|
|
16
|
+
scope: 'root-log',
|
|
17
|
+
}),
|
|
18
|
+
readSources: capture.readSources,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** Internal issuer. This identity is intentionally not serializable or shared across module instances. */
|
|
22
|
+
function bindStoredCause(graph, capture, history, version) {
|
|
23
|
+
const frozenGraph = Object.freeze(graph);
|
|
24
|
+
const frozenCapture = Object.freeze({ ...capture });
|
|
25
|
+
const admission = admissionFor(frozenCapture, version);
|
|
26
|
+
// The display copy is separate from the authority retained by this module instance.
|
|
27
|
+
const cause = Object.freeze({
|
|
28
|
+
graph: frozenGraph,
|
|
29
|
+
admission: admissionFor(frozenCapture, version),
|
|
30
|
+
});
|
|
31
|
+
bindings.set(cause, { graph: frozenGraph, capture: frozenCapture, admission, history });
|
|
32
|
+
return cause;
|
|
33
|
+
}
|
|
34
|
+
exports.bindStoredCause = bindStoredCause;
|
|
35
|
+
/** Read identity, never the value of a caller's assessment property or an attached getter. */
|
|
36
|
+
function storedCauseAssessment(cause) {
|
|
37
|
+
if (cause === null || typeof cause !== 'object')
|
|
38
|
+
return { kind: 'none' };
|
|
39
|
+
try {
|
|
40
|
+
const binding = bindings.get(cause);
|
|
41
|
+
if (binding) {
|
|
42
|
+
const graph = Object.getOwnPropertyDescriptor(cause, 'graph');
|
|
43
|
+
return graph && 'value' in graph && graph.value === binding.graph
|
|
44
|
+
? { kind: 'stored', capture: binding.capture, admission: binding.admission }
|
|
45
|
+
: { kind: 'invalid' };
|
|
46
|
+
}
|
|
47
|
+
// Inherited copies carry the same claim but not the issuing identity. `in` invokes no getter.
|
|
48
|
+
return 'admission' in cause ? { kind: 'invalid' } : { kind: 'none' };
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return { kind: 'invalid' };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.storedCauseAssessment = storedCauseAssessment;
|
|
55
|
+
//# sourceMappingURL=storedCauseBinding.js.map
|