agentfootprint 6.24.0 → 6.26.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.
Files changed (87) hide show
  1. package/README.md +31 -0
  2. package/bin/agentfootprint-lint-tools.mjs +14 -0
  3. package/dist/esm/lib/context-bisect/ablation.js +183 -0
  4. package/dist/esm/lib/context-bisect/ablation.js.map +1 -0
  5. package/dist/esm/lib/context-bisect/bisect.js +129 -0
  6. package/dist/esm/lib/context-bisect/bisect.js.map +1 -0
  7. package/dist/esm/lib/context-bisect/index.js +22 -0
  8. package/dist/esm/lib/context-bisect/index.js.map +1 -0
  9. package/dist/esm/lib/context-bisect/llmEdgeWeigher.js +0 -0
  10. package/dist/esm/lib/context-bisect/llmEdgeWeigher.js.map +1 -0
  11. package/dist/esm/lib/context-bisect/localize.js +555 -0
  12. package/dist/esm/lib/context-bisect/localize.js.map +1 -0
  13. package/dist/esm/lib/context-bisect/types.js +56 -0
  14. package/dist/esm/lib/context-bisect/types.js.map +1 -0
  15. package/dist/esm/lib/tool-lint/analyze.js +235 -0
  16. package/dist/esm/lib/tool-lint/analyze.js.map +1 -0
  17. package/dist/esm/lib/tool-lint/cli.js +198 -0
  18. package/dist/esm/lib/tool-lint/cli.js.map +1 -0
  19. package/dist/esm/lib/tool-lint/format.js +61 -0
  20. package/dist/esm/lib/tool-lint/format.js.map +1 -0
  21. package/dist/esm/lib/tool-lint/index.js +23 -0
  22. package/dist/esm/lib/tool-lint/index.js.map +1 -0
  23. package/dist/esm/lib/tool-lint/rules.js +249 -0
  24. package/dist/esm/lib/tool-lint/rules.js.map +1 -0
  25. package/dist/esm/lib/tool-lint/types.js +25 -0
  26. package/dist/esm/lib/tool-lint/types.js.map +1 -0
  27. package/dist/esm/observe.js +20 -0
  28. package/dist/esm/observe.js.map +1 -1
  29. package/dist/esm/recorders/observability/ToolChoiceRecorder.js +261 -0
  30. package/dist/esm/recorders/observability/ToolChoiceRecorder.js.map +1 -0
  31. package/dist/lib/context-bisect/ablation.js +192 -0
  32. package/dist/lib/context-bisect/ablation.js.map +1 -0
  33. package/dist/lib/context-bisect/bisect.js +133 -0
  34. package/dist/lib/context-bisect/bisect.js.map +1 -0
  35. package/dist/lib/context-bisect/index.js +40 -0
  36. package/dist/lib/context-bisect/index.js.map +1 -0
  37. package/dist/lib/context-bisect/llmEdgeWeigher.js +0 -0
  38. package/dist/lib/context-bisect/llmEdgeWeigher.js.map +1 -0
  39. package/dist/lib/context-bisect/localize.js +563 -0
  40. package/dist/lib/context-bisect/localize.js.map +1 -0
  41. package/dist/lib/context-bisect/types.js +59 -0
  42. package/dist/lib/context-bisect/types.js.map +1 -0
  43. package/dist/lib/tool-lint/analyze.js +242 -0
  44. package/dist/lib/tool-lint/analyze.js.map +1 -0
  45. package/dist/lib/tool-lint/cli.js +203 -0
  46. package/dist/lib/tool-lint/cli.js.map +1 -0
  47. package/dist/lib/tool-lint/format.js +65 -0
  48. package/dist/lib/tool-lint/format.js.map +1 -0
  49. package/dist/lib/tool-lint/index.js +43 -0
  50. package/dist/lib/tool-lint/index.js.map +1 -0
  51. package/dist/lib/tool-lint/rules.js +256 -0
  52. package/dist/lib/tool-lint/rules.js.map +1 -0
  53. package/dist/lib/tool-lint/types.js +26 -0
  54. package/dist/lib/tool-lint/types.js.map +1 -0
  55. package/dist/observe.js +56 -1
  56. package/dist/observe.js.map +1 -1
  57. package/dist/recorders/observability/ToolChoiceRecorder.js +266 -0
  58. package/dist/recorders/observability/ToolChoiceRecorder.js.map +1 -0
  59. package/dist/types/lib/context-bisect/ablation.d.ts +97 -0
  60. package/dist/types/lib/context-bisect/ablation.d.ts.map +1 -0
  61. package/dist/types/lib/context-bisect/bisect.d.ts +76 -0
  62. package/dist/types/lib/context-bisect/bisect.d.ts.map +1 -0
  63. package/dist/types/lib/context-bisect/index.d.ts +22 -0
  64. package/dist/types/lib/context-bisect/index.d.ts.map +1 -0
  65. package/dist/types/lib/context-bisect/llmEdgeWeigher.d.ts +125 -0
  66. package/dist/types/lib/context-bisect/llmEdgeWeigher.d.ts.map +1 -0
  67. package/dist/types/lib/context-bisect/localize.d.ts +119 -0
  68. package/dist/types/lib/context-bisect/localize.d.ts.map +1 -0
  69. package/dist/types/lib/context-bisect/types.d.ts +356 -0
  70. package/dist/types/lib/context-bisect/types.d.ts.map +1 -0
  71. package/dist/types/lib/tool-lint/analyze.d.ts +84 -0
  72. package/dist/types/lib/tool-lint/analyze.d.ts.map +1 -0
  73. package/dist/types/lib/tool-lint/cli.d.ts +44 -0
  74. package/dist/types/lib/tool-lint/cli.d.ts.map +1 -0
  75. package/dist/types/lib/tool-lint/format.d.ts +19 -0
  76. package/dist/types/lib/tool-lint/format.d.ts.map +1 -0
  77. package/dist/types/lib/tool-lint/index.d.ts +24 -0
  78. package/dist/types/lib/tool-lint/index.d.ts.map +1 -0
  79. package/dist/types/lib/tool-lint/rules.d.ts +86 -0
  80. package/dist/types/lib/tool-lint/rules.d.ts.map +1 -0
  81. package/dist/types/lib/tool-lint/types.d.ts +156 -0
  82. package/dist/types/lib/tool-lint/types.d.ts.map +1 -0
  83. package/dist/types/observe.d.ts +3 -0
  84. package/dist/types/observe.d.ts.map +1 -1
  85. package/dist/types/recorders/observability/ToolChoiceRecorder.d.ts +165 -0
  86. package/dist/types/recorders/observability/ToolChoiceRecorder.d.ts.map +1 -0
  87. package/package.json +4 -2
@@ -0,0 +1,563 @@
1
+ "use strict";
2
+ /**
3
+ * localizeContextBug — the contextual-bug LOCALIZER, "git bisect for
4
+ * context" (RFC-003 Part B, block D8).
5
+ *
6
+ * The five-stage pipeline (each stage is a shipped piece — this file only
7
+ * ASSEMBLES):
8
+ *
9
+ * 1. TRIGGER — an explicit `atStep`, a custom trigger strategy, or
10
+ * the QualityRecorder's lowest-scoring step.
11
+ * 2. SLICE — footprintjs `causalChain` over the commit log, WITH
12
+ * control-dependence edges (D3) and honesty markers
13
+ * (A2/A4) when the artifacts carry them.
14
+ * 3. WEIGH — D7's `llmEdgeWeigher` stamps influence weights on
15
+ * every LLM-call parent edge (two-pass: prime, re-slice).
16
+ * 4. RANK — suspects = slice nodes classified into ablatable
17
+ * context sources (tool / injection / memory / arg),
18
+ * scored by max-product path weight × per-item semantic
19
+ * refinement. CORRELATIONAL tier — and marked so.
20
+ * 5. ABLATE — optional: the consumer's `AblationRunner` re-runs the
21
+ * scenario without each top suspect, N seeded times.
22
+ * Verdicts (the ONLY causal claims, §B2) + variance.
23
+ *
24
+ * Without a runner the report stops at stage 4 with
25
+ * `mode: 'correlational'` — explicitly a ranking of proxies, no causal
26
+ * claim anywhere.
27
+ *
28
+ * Every `source` / `step` id in the report is a plain runtimeStageId —
29
+ * drill any of them with the trace-toolpack tools (`trace_node`,
30
+ * `trace_slice`, `get_value`) over the same artifacts bag.
31
+ */
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.formatContextBugReport = exports.suspectLabel = exports.localizeContextBug = exports.defaultSuspectClassifier = exports.llmCallIdsFromEvents = void 0;
34
+ const trace_1 = require("footprintjs/trace");
35
+ const index_js_1 = require("../influence-core/index.js");
36
+ const ablation_js_1 = require("./ablation.js");
37
+ const llmEdgeWeigher_js_1 = require("./llmEdgeWeigher.js");
38
+ const types_js_1 = require("./types.js");
39
+ // ─── LLM-call id extraction ──────────────────────────────────────────
40
+ /**
41
+ * Extract LLM-call step ids from captured typed events: the
42
+ * `meta.runtimeStageId` of every `agentfootprint.stream.llm_start`
43
+ * envelope, deduplicated in event order. Collect events with
44
+ * `agent.on('*', (e) => events.push(e))`.
45
+ */
46
+ function llmCallIdsFromEvents(events) {
47
+ const ids = [];
48
+ const seen = new Set();
49
+ for (const event of events) {
50
+ if (event.type !== 'agentfootprint.stream.llm_start')
51
+ continue;
52
+ const id = event.meta.runtimeStageId;
53
+ if (seen.has(id))
54
+ continue;
55
+ seen.add(id);
56
+ ids.push(id);
57
+ }
58
+ return ids;
59
+ }
60
+ exports.llmCallIdsFromEvents = llmCallIdsFromEvents;
61
+ /** Injection flavors that are engineered context (ablatable by id). */
62
+ const ENGINEERED_SOURCES = new Set([
63
+ 'rag',
64
+ 'skill',
65
+ 'memory',
66
+ 'instructions',
67
+ 'steering',
68
+ 'fact',
69
+ 'custom',
70
+ ]);
71
+ const INJECTION_SLOT_KEYS = ['systemPromptInjections', 'messagesInjections', 'toolsInjections'];
72
+ /**
73
+ * The default classifier — reads the node's COMMITTED values (already
74
+ * redaction-scrubbed) and recognizes the agent chart's shapes:
75
+ *
76
+ * - `systemPromptInjections` / `messagesInjections` / `toolsInjections`
77
+ * records with an engineered source → one suspect per `Injection.id`
78
+ * (kind `'memory'` for source `'memory'`, else `'injection'`).
79
+ * - `lastToolResult` → a `'tool'` suspect for the tool that ran.
80
+ * - footprintjs A2 honesty marker `args` → an `'arg'` suspect (the
81
+ * consumer's runner must override the input — nothing to filter).
82
+ * - anything else → the honest `'stage'` fallback (no ablation spec).
83
+ */
84
+ function defaultSuspectClassifier(ctx) {
85
+ const seeds = [];
86
+ const seenInjection = new Set();
87
+ for (const slotKey of INJECTION_SLOT_KEYS) {
88
+ if (!ctx.keysWritten.includes(slotKey))
89
+ continue;
90
+ const records = ctx.valueOf(slotKey);
91
+ if (!Array.isArray(records))
92
+ continue;
93
+ for (const record of records) {
94
+ const source = typeof record?.source === 'string' ? record.source : undefined;
95
+ const sourceId = typeof record?.sourceId === 'string' ? record.sourceId : undefined;
96
+ if (source === undefined || sourceId === undefined)
97
+ continue;
98
+ if (!ENGINEERED_SOURCES.has(source))
99
+ continue; // baseline flow (user/base/registry/…)
100
+ const kind = source === 'memory' ? 'memory' : 'injection';
101
+ const dedupeKey = `${kind}:${sourceId}`;
102
+ if (seenInjection.has(dedupeKey))
103
+ continue;
104
+ seenInjection.add(dedupeKey);
105
+ const text = typeof record.rawContent === 'string'
106
+ ? record.rawContent
107
+ : typeof record.contentSummary === 'string'
108
+ ? record.contentSummary
109
+ : undefined;
110
+ seeds.push({
111
+ kind,
112
+ detail: {
113
+ injectionId: sourceId,
114
+ flavor: source,
115
+ ...(text !== undefined ? { text } : {}),
116
+ },
117
+ });
118
+ }
119
+ }
120
+ if (ctx.keysWritten.includes('lastToolResult')) {
121
+ const value = ctx.valueOf('lastToolResult');
122
+ if (value && typeof value.toolName === 'string') {
123
+ seeds.push({
124
+ kind: 'tool',
125
+ detail: {
126
+ toolName: value.toolName,
127
+ ...(typeof value.result === 'string' ? { text: value.result } : {}),
128
+ },
129
+ });
130
+ }
131
+ }
132
+ if (ctx.node.incompleteSources?.includes('args')) {
133
+ seeds.push({ kind: 'arg' });
134
+ }
135
+ return seeds.length > 0 ? seeds : [{ kind: 'stage' }];
136
+ }
137
+ exports.defaultSuspectClassifier = defaultSuspectClassifier;
138
+ function buildArtifactIndex(artifacts) {
139
+ const commitLog = (artifacts.snapshot.commitLog ?? []);
140
+ const lastIdxOf = new Map();
141
+ for (let i = 0; i < commitLog.length; i++)
142
+ lastIdxOf.set(commitLog[i].runtimeStageId, i);
143
+ const readsOf = new Map();
144
+ let hasReadTracking = false;
145
+ const visit = (node) => {
146
+ if (!node)
147
+ return;
148
+ const id = node.runtimeStageId;
149
+ if (id && !readsOf.has(id)) {
150
+ const keys = node.stageReads ? Object.keys(node.stageReads) : [];
151
+ readsOf.set(id, keys);
152
+ if (keys.length > 0)
153
+ hasReadTracking = true;
154
+ }
155
+ for (const child of node.children ?? [])
156
+ visit(child);
157
+ visit(node.next);
158
+ };
159
+ visit(artifacts.snapshot.executionTree);
160
+ return { commitLog, lastIdxOf, readsOf, hasReadTracking };
161
+ }
162
+ /**
163
+ * Best (max-product) path weight from the root to every slice node.
164
+ * The slice DAG is topologically ordered by commit index (a writer always
165
+ * commits before its reader; a decider before its branch), so one pass in
166
+ * DESCENDING commit order finalizes children before their parents.
167
+ */
168
+ function computePathScores(root, nodes, lastIdxOf) {
169
+ const info = new Map();
170
+ info.set(root.runtimeStageId, { score: 1 });
171
+ const ordered = [...nodes].sort((a, b) => (lastIdxOf.get(b.runtimeStageId) ?? -1) - (lastIdxOf.get(a.runtimeStageId) ?? -1));
172
+ for (const node of ordered) {
173
+ const current = info.get(node.runtimeStageId);
174
+ if (!current)
175
+ continue; // unreachable from root (defensive)
176
+ for (const edge of node.parentEdges) {
177
+ const candidate = current.score * edge.weight;
178
+ const existing = info.get(edge.parent.runtimeStageId);
179
+ if (!existing || candidate > existing.score) {
180
+ info.set(edge.parent.runtimeStageId, {
181
+ score: candidate,
182
+ via: { child: node, kind: edge.kind, key: edge.key, weight: edge.weight },
183
+ });
184
+ }
185
+ }
186
+ }
187
+ return info;
188
+ }
189
+ function buildEdgePath(node, info) {
190
+ const steps = [];
191
+ let cur = node;
192
+ for (;;) {
193
+ const via = info.get(cur.runtimeStageId)?.via;
194
+ if (!via)
195
+ break;
196
+ steps.push({
197
+ from: via.child.runtimeStageId,
198
+ fromName: via.child.stageName,
199
+ to: cur.runtimeStageId,
200
+ toName: cur.stageName,
201
+ kind: via.kind,
202
+ ...(via.key !== undefined ? { key: via.key } : {}),
203
+ weight: via.weight,
204
+ });
205
+ cur = via.child;
206
+ }
207
+ return steps.reverse(); // trigger → … → suspect
208
+ }
209
+ // ─── The localizer ───────────────────────────────────────────────────
210
+ /**
211
+ * Localize a contextual bug: trigger → causal slice → influence-weighted
212
+ * ranking → (optional) counterfactual ablation. See module docs for the
213
+ * pipeline and the §B2 claim tiers.
214
+ *
215
+ * @throws when no trigger can be resolved (no `atStep`, no custom
216
+ * strategy hit, no `artifacts.quality`), or when the trigger step
217
+ * is not in the commit log.
218
+ */
219
+ async function localizeContextBug(options) {
220
+ const { artifacts, embedder } = options;
221
+ const maxDepth = options.maxDepth ?? types_js_1.CONTEXT_BISECT_DEFAULTS.maxDepth;
222
+ const maxNodes = options.maxNodes ?? types_js_1.CONTEXT_BISECT_DEFAULTS.maxNodes;
223
+ const maxSuspects = options.maxSuspects ?? types_js_1.CONTEXT_BISECT_DEFAULTS.maxSuspects;
224
+ const index = buildArtifactIndex(artifacts);
225
+ // ── 1. Trigger ────────────────────────────────────────────────────
226
+ let step;
227
+ let triggerSource;
228
+ let triggerScore;
229
+ if (options.atStep !== undefined) {
230
+ step = options.atStep;
231
+ triggerSource = 'explicit';
232
+ }
233
+ else if (options.trigger !== undefined) {
234
+ step = options.trigger(artifacts);
235
+ triggerSource = 'custom';
236
+ }
237
+ else {
238
+ const lowest = artifacts.quality?.getLowest();
239
+ step = lowest?.runtimeStageId;
240
+ triggerScore = lowest?.entry.score;
241
+ triggerSource = 'quality';
242
+ }
243
+ if (step === undefined) {
244
+ throw new Error('localizeContextBug: no trigger step — pass atStep, supply a trigger strategy, ' +
245
+ 'or provide artifacts.quality (a QualityRecorder from the run).');
246
+ }
247
+ if (!index.lastIdxOf.has(step)) {
248
+ throw new Error(`localizeContextBug: trigger step '${step}' is not in the commit log — ` +
249
+ 'pass a runtimeStageId of a step that committed (see snapshot.commitLog).');
250
+ }
251
+ // ── 2 + 3. Slice, then weigh (two-pass over the same evidence) ─────
252
+ const keysReadOf = (id) => index.readsOf.get(id) ?? [];
253
+ const sliceOptions = {
254
+ maxDepth,
255
+ maxNodes,
256
+ ...(artifacts.controlDeps ? { controlDeps: artifacts.controlDeps } : {}),
257
+ };
258
+ const unweighted = (0, trace_1.causalChain)(index.commitLog, step, keysReadOf, sliceOptions);
259
+ if (!unweighted) {
260
+ throw new Error(`localizeContextBug: causalChain found no node for '${step}'.`);
261
+ }
262
+ const llmCallIds = artifacts.llmCallIds ?? (artifacts.events ? llmCallIdsFromEvents(artifacts.events) : []);
263
+ const weigher = (0, llmEdgeWeigher_js_1.llmEdgeWeigher)({
264
+ embedder,
265
+ llmCallIds,
266
+ commitLog: index.commitLog,
267
+ });
268
+ await weigher.prime(unweighted);
269
+ const root = (0, trace_1.causalChain)(index.commitLog, step, keysReadOf, { ...sliceOptions, weigh: weigher.weigh }) ??
270
+ unweighted;
271
+ // ── 4. Rank ─────────────────────────────────────────────────────────
272
+ const nodes = collectNodes(root);
273
+ const pathInfo = computePathScores(root, nodes, index.lastIdxOf);
274
+ const classify = options.classify;
275
+ const drafts = [];
276
+ for (const node of nodes) {
277
+ if (node.runtimeStageId === root.runtimeStageId)
278
+ continue; // the trigger itself
279
+ const info = pathInfo.get(node.runtimeStageId);
280
+ if (!info)
281
+ continue;
282
+ const ctx = {
283
+ node,
284
+ keysWritten: node.keysWritten,
285
+ valueOf: (key) => {
286
+ const idx = index.lastIdxOf.get(node.runtimeStageId);
287
+ return idx === undefined ? undefined : (0, trace_1.commitValueAt)(index.commitLog, idx, key);
288
+ },
289
+ };
290
+ const seeds = classify?.(ctx) ?? defaultSuspectClassifier(ctx);
291
+ const edgePath = buildEdgePath(node, pathInfo);
292
+ for (const seed of seeds) {
293
+ drafts.push({ node, seed, structuralScore: info.score, edgePath });
294
+ }
295
+ }
296
+ // Semantic refinement: ONE influence-core pass over every suspect that
297
+ // has its own content text, against the trigger step's output. Ancestor
298
+ // texts = LLM-call outputs on the suspect's path (the FDL casting).
299
+ const triggerOutput = (0, llmEdgeWeigher_js_1.stepOutputText)(index.commitLog, index.lastIdxOf, root.runtimeStageId, types_js_1.CONTEXT_BISECT_DEFAULTS.maxTextChars);
300
+ if (triggerOutput !== undefined) {
301
+ const llmIdSet = new Set(llmCallIds);
302
+ const evidence = [];
303
+ const evidenceDraft = [];
304
+ drafts.forEach((draft, i) => {
305
+ const text = draft.seed.detail?.text;
306
+ if (text === undefined || text.length === 0)
307
+ return;
308
+ const ancestorTexts = [];
309
+ for (const hop of draft.edgePath) {
310
+ // Intermediate LLM steps between trigger and suspect (exclusive).
311
+ if (hop.from !== root.runtimeStageId && llmIdSet.has(hop.from)) {
312
+ const ancestorText = (0, llmEdgeWeigher_js_1.stepOutputText)(index.commitLog, index.lastIdxOf, hop.from, types_js_1.CONTEXT_BISECT_DEFAULTS.maxTextChars);
313
+ if (ancestorText !== undefined)
314
+ ancestorTexts.push(ancestorText);
315
+ }
316
+ }
317
+ evidence.push({ id: String(i), text, ancestorTexts });
318
+ evidenceDraft.push(draft);
319
+ });
320
+ if (evidence.length > 0) {
321
+ const scores = await (0, index_js_1.scoreInfluence)({ evidence, finalAnswerText: triggerOutput, embedder });
322
+ const byId = new Map(scores.map((s) => [s.id, s.score]));
323
+ evidence.forEach((item, i) => {
324
+ const composite = byId.get(item.id);
325
+ if (composite !== undefined) {
326
+ evidenceDraft[i].semanticScore = Math.max(0, Math.min(1, composite));
327
+ }
328
+ });
329
+ }
330
+ }
331
+ const ranked = drafts
332
+ .map((draft) => {
333
+ const score = draft.semanticScore !== undefined
334
+ ? draft.structuralScore * draft.semanticScore
335
+ : draft.structuralScore;
336
+ const suspect = {
337
+ source: draft.node.runtimeStageId,
338
+ stageName: draft.node.stageName,
339
+ kind: draft.seed.kind,
340
+ ...(draft.seed.detail !== undefined ? { detail: draft.seed.detail } : {}),
341
+ score,
342
+ structuralScore: draft.structuralScore,
343
+ ...(draft.semanticScore !== undefined ? { semanticScore: draft.semanticScore } : {}),
344
+ hasContentEvidence: draft.semanticScore !== undefined,
345
+ edgePath: draft.edgePath,
346
+ };
347
+ const ablation = (0, ablation_js_1.ablationForSuspect)(suspect);
348
+ return ablation !== undefined ? { ...suspect, ablation } : suspect;
349
+ })
350
+ .sort((a, b) => b.score - a.score) // stable: ties keep slice order
351
+ .slice(0, maxSuspects);
352
+ // ── Slice stats + honesty flags ─────────────────────────────────────
353
+ const sliceStats = buildSliceStats(root, nodes, maxDepth, maxNodes);
354
+ const honestyFlags = buildHonestyFlags(artifacts, index, sliceStats, llmCallIds.length);
355
+ // ── 5. Ablate (the causal tier) ─────────────────────────────────────
356
+ if (options.rerun === undefined) {
357
+ return {
358
+ step,
359
+ stepName: root.stageName,
360
+ triggerSource,
361
+ ...(triggerScore !== undefined ? { triggerScore } : {}),
362
+ mode: 'correlational',
363
+ suspects: ranked,
364
+ sliceStats,
365
+ honestyFlags,
366
+ };
367
+ }
368
+ const probeConfig = { rerun: options.rerun, embedder };
369
+ const maxAblations = options.rerun.maxSuspects ?? 5;
370
+ // Baseline first: an unstable scenario invalidates every verdict.
371
+ const baseline = await (0, ablation_js_1.runAblationProbe)(probeConfig, []);
372
+ const baselineStable = baseline.flips === 0;
373
+ const flags = baselineStable
374
+ ? honestyFlags
375
+ : [
376
+ ...honestyFlags,
377
+ {
378
+ flag: 'baseline-unstable',
379
+ note: `the un-ablated baseline changed outcome in ${baseline.flips}/${baseline.samples} ` +
380
+ 'seeded reruns — all ablation verdicts are inconclusive.',
381
+ },
382
+ ];
383
+ const withVerdicts = [];
384
+ let ablated = 0;
385
+ for (const suspect of ranked) {
386
+ if (suspect.ablation === undefined ||
387
+ suspect.ablation.kind === 'arg' ||
388
+ ablated >= maxAblations) {
389
+ withVerdicts.push(suspect);
390
+ continue;
391
+ }
392
+ ablated++;
393
+ const stats = await (0, ablation_js_1.runAblationProbe)(probeConfig, [suspect.ablation]);
394
+ const verdict = (0, ablation_js_1.verdictFor)(suspectLabel(suspect), stats, baselineStable);
395
+ withVerdicts.push({ ...suspect, runs: stats, verdict });
396
+ }
397
+ return {
398
+ step,
399
+ stepName: root.stageName,
400
+ triggerSource,
401
+ ...(triggerScore !== undefined ? { triggerScore } : {}),
402
+ mode: 'causal',
403
+ suspects: withVerdicts,
404
+ sliceStats,
405
+ honestyFlags: flags,
406
+ baseline,
407
+ };
408
+ }
409
+ exports.localizeContextBug = localizeContextBug;
410
+ // ─── Internals ───────────────────────────────────────────────────────
411
+ function collectNodes(root) {
412
+ const out = [];
413
+ const seen = new Set();
414
+ const queue = [root];
415
+ while (queue.length > 0) {
416
+ const node = queue.shift();
417
+ if (seen.has(node.runtimeStageId))
418
+ continue;
419
+ seen.add(node.runtimeStageId);
420
+ out.push(node);
421
+ for (const parent of node.parents)
422
+ queue.push(parent);
423
+ }
424
+ return out;
425
+ }
426
+ function buildSliceStats(root, nodes, maxDepth, maxNodes) {
427
+ let dataEdges = 0;
428
+ let controlEdges = 0;
429
+ let weightedEdges = 0;
430
+ let incompleteNodes = 0;
431
+ for (const node of nodes) {
432
+ if (node.incompleteSources && node.incompleteSources.length > 0)
433
+ incompleteNodes++;
434
+ for (const edge of node.parentEdges) {
435
+ if (edge.kind === 'data')
436
+ dataEdges++;
437
+ else
438
+ controlEdges++;
439
+ if (edge.weight !== 1)
440
+ weightedEdges++;
441
+ }
442
+ }
443
+ return {
444
+ nodes: nodes.length,
445
+ dataEdges,
446
+ controlEdges,
447
+ weightedEdges,
448
+ incompleteNodes,
449
+ maxDepth,
450
+ maxNodes,
451
+ ...(root.truncated !== undefined ? { truncated: root.truncated } : {}),
452
+ };
453
+ }
454
+ function buildHonestyFlags(artifacts, index, sliceStats, llmCallIdCount) {
455
+ const flags = [];
456
+ if (sliceStats.truncated !== undefined) {
457
+ const causes = [
458
+ sliceStats.truncated.byDepth && `maxDepth (${sliceStats.maxDepth})`,
459
+ sliceStats.truncated.byNodes && `maxNodes (${sliceStats.maxNodes})`,
460
+ ]
461
+ .filter(Boolean)
462
+ .join(' + ');
463
+ flags.push({
464
+ flag: 'slice-truncated',
465
+ note: `the slice was cut by ${causes} — older causes exist beyond this horizon; the ranking cannot see them.`,
466
+ });
467
+ }
468
+ if (sliceStats.incompleteNodes > 0) {
469
+ flags.push({
470
+ flag: 'untracked-sources',
471
+ note: `${sliceStats.incompleteNodes} slice node(s) also consumed untracked inputs ` +
472
+ '(args/env/silent reads) — those inputs produce no edges; the slice through them is incomplete.',
473
+ });
474
+ }
475
+ if (!artifacts.controlDeps) {
476
+ flags.push({
477
+ flag: 'no-control-deps',
478
+ note: 'no control-dependence lookup in the artifacts (attach controlDepRecorder() to the run) — ' +
479
+ 'decisions that routed execution are missing from the slice.',
480
+ });
481
+ }
482
+ if (!index.hasReadTracking) {
483
+ flags.push({
484
+ flag: 'no-read-tracking',
485
+ note: 'the snapshot carries no per-step read tracking — read→write edges cannot be followed; ' +
486
+ 'the slice may contain only the trigger step.',
487
+ });
488
+ }
489
+ if (llmCallIdCount === 0) {
490
+ flags.push({
491
+ flag: 'no-llm-call-ids',
492
+ note: 'no LLM-call step ids (pass llmCallIds or captured events) — no edge received an ' +
493
+ 'influence weight; the ranking is structure-only.',
494
+ });
495
+ }
496
+ return flags;
497
+ }
498
+ function suspectLabel(suspect) {
499
+ const id = suspect.detail?.toolName ?? suspect.detail?.injectionId ?? suspect.source;
500
+ return `${suspect.kind} '${id}'`;
501
+ }
502
+ exports.suspectLabel = suspectLabel;
503
+ // ─── Formatting ──────────────────────────────────────────────────────
504
+ /**
505
+ * Human-readable report. The claim tiers are spelled out in the output
506
+ * itself (§B2): scores are proxies; verdict lines are the only causal
507
+ * claims; every ⚠ honesty flag prints.
508
+ */
509
+ function formatContextBugReport(report) {
510
+ const lines = [];
511
+ lines.push(`CONTEXT BUG LOCALIZATION — trigger ${report.step} "${report.stepName}" ` +
512
+ `(${report.triggerSource}${report.triggerScore !== undefined ? `, score ${report.triggerScore.toFixed(2)}` : ''})`);
513
+ lines.push(report.mode === 'causal'
514
+ ? 'mode: CAUSAL — ranked proxies + counterfactual ablation verdicts (verdicts are the only causal claims)'
515
+ : 'mode: CORRELATIONAL — ranking only; every score is an embedding-geometry proxy, no causal claim is made');
516
+ const s = report.sliceStats;
517
+ lines.push(`slice: ${s.nodes} nodes · ${s.dataEdges} data edges · ${s.controlEdges} control edges · ` +
518
+ `${s.weightedEdges} influence-weighted`);
519
+ lines.push('', `SUSPECTS (${report.suspects.length}, ranked by correlational proxy score):`);
520
+ report.suspects.forEach((suspect, i) => {
521
+ const scoreParts = suspect.semanticScore !== undefined
522
+ ? `${suspect.score.toFixed(3)} (path ${suspect.structuralScore.toFixed(3)} × content ${suspect.semanticScore.toFixed(3)})`
523
+ : `${suspect.score.toFixed(3)} (path only — no content signal; an upper bound)`;
524
+ lines.push(`${String(i + 1).padStart(2)}. [${suspectLabel(suspect)}] at ${suspect.source} ` +
525
+ `"${suspect.stageName}" — score ${scoreParts}`);
526
+ if (suspect.edgePath.length > 0) {
527
+ const hops = suspect.edgePath
528
+ .map((hop) => {
529
+ const link = hop.kind === 'control'
530
+ ? `[control${hop.key ? `: ${hop.key}` : ''}]`
531
+ : hop.key ?? 'data';
532
+ const weight = hop.weight !== 1 ? ` ${hop.weight.toFixed(3)}` : '';
533
+ return `←(${link}${weight})— ${hop.to}`;
534
+ })
535
+ .join(' ');
536
+ lines.push(` path: ${suspect.edgePath[0].from} ${hops}`);
537
+ }
538
+ if (suspect.verdict !== undefined && suspect.runs !== undefined) {
539
+ lines.push(` verdict: ${suspect.verdict.claim}`);
540
+ lines.push(` runs: ${suspect.runs.flips}/${suspect.runs.samples} flipped · similarity to original ` +
541
+ `${suspect.runs.similarity.mean.toFixed(3)} ± ${suspect.runs.similarity.stdev.toFixed(3)} ` +
542
+ `[${suspect.runs.similarity.min.toFixed(3)}, ${suspect.runs.similarity.max.toFixed(3)}]`);
543
+ }
544
+ else if (report.mode === 'correlational') {
545
+ lines.push(' verdict: (none — correlational ranking only; supply an AblationRunner to test causally)');
546
+ }
547
+ });
548
+ if (report.baseline !== undefined) {
549
+ lines.push('', `baseline (no ablation): ${report.baseline.flips}/${report.baseline.samples} flipped · ` +
550
+ `similarity ${report.baseline.similarity.mean.toFixed(3)} ± ${report.baseline.similarity.stdev.toFixed(3)}`);
551
+ }
552
+ if (report.honestyFlags.length > 0) {
553
+ lines.push('', 'HONESTY:');
554
+ for (const flag of report.honestyFlags)
555
+ lines.push(`⚠ [${flag.flag}] ${flag.note}`);
556
+ }
557
+ lines.push('', 'claims: scores/weights are deterministic embedding-geometry PROXIES (semantic alignment, ' +
558
+ 'not model internals); slice completeness is bounded by tracking (see HONESTY); only ' +
559
+ 'ablation verdicts make causal claims.');
560
+ return lines.join('\n');
561
+ }
562
+ exports.formatContextBugReport = formatContextBugReport;
563
+ //# sourceMappingURL=localize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/lib/context-bisect/localize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAIH,6CAA+D;AAE/D,yDAA+F;AAC/F,+CAA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E,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,KAAK,CAAC,IAAI,CACR,EAAE,EACF,2FAA2F;QACzF,sFAAsF;QACtF,uCAAuC,CAC1C,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAjFD,wDAiFC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /**
3
+ * context-bisect types — RFC-003 Part B: the contextual-bug localizer
4
+ * ("git bisect for context").
5
+ *
6
+ * Pattern: assembly contract. Part B is pure ASSEMBLY over shipped pieces:
7
+ * footprintjs 9.8.0's complete causal DAG (control edges, honesty
8
+ * markers, `EdgeWeigher` hook) × influence-core scoring (D6) ×
9
+ * consumer-run counterfactual ablation. No new engine features,
10
+ * no new typed events.
11
+ * Role: `src/lib/context-bisect/` leaf. Exported via
12
+ * `agentfootprint/observe`.
13
+ *
14
+ * ## The two-tier honest-claims discipline (RFC-003 §B2)
15
+ *
16
+ * Every number in these types belongs to exactly ONE of two tiers, and the
17
+ * docs say which:
18
+ *
19
+ * - **CORRELATIONAL** — edge weights, suspect scores, rankings. These are
20
+ * deterministic embedding-geometry PROXIES (influence-core composite:
21
+ * semantic alignment between what a source wrote and what the LLM step
22
+ * produced). They mean "high semantic alignment", never "the model
23
+ * answered BECAUSE of this". A report without reruns stops here and is
24
+ * marked `mode: 'correlational'`.
25
+ *
26
+ * - **CAUSAL** — ablation verdicts ONLY. A suspect earns `verdict:
27
+ * 'confirmed'` exclusively by counterfactual evidence: the consumer's
28
+ * `AblationRunner` re-ran the scenario WITHOUT the suspect N seeded
29
+ * times and the outcome flipped (with baseline stability checked and
30
+ * variance reported — never a single-run verdict).
31
+ *
32
+ * Slice completeness is bounded by tracking — and SAYS so: untracked reads
33
+ * (`$getArgs()` / env / silent reads), missing control-dependence lookups,
34
+ * missing read tracking, and depth/node truncation all surface as
35
+ * `honestyFlags` on the report, mirrored from footprintjs's own A2/A4
36
+ * markers.
37
+ */
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.CONTEXT_BISECT_DEFAULTS = void 0;
40
+ // ─── Defaults ────────────────────────────────────────────────────────
41
+ exports.CONTEXT_BISECT_DEFAULTS = {
42
+ /** Slice depth budget (forwarded to `causalChain`). */
43
+ maxDepth: 12,
44
+ /** Slice node budget (forwarded to `causalChain`). */
45
+ maxNodes: 80,
46
+ /** Ranked suspects kept on the report. */
47
+ maxSuspects: 12,
48
+ /** Chars of written content embedded per step text (D7). */
49
+ maxTextChars: 2000,
50
+ /** Seeded reruns per ablation probe (D9 — never single-run verdicts). */
51
+ samples: 3,
52
+ /** Default similarity floor for the default outcome comparator. */
53
+ flipThreshold: 0.8,
54
+ /** Ablation probes budget for `bisectCulprits`. */
55
+ maxProbes: 24,
56
+ /** Independent-culprit search rounds for `bisectCulprits`. */
57
+ maxCulprits: 4,
58
+ };
59
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/context-bisect/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;;;AAyTH,wEAAwE;AAE3D,QAAA,uBAAuB,GAAG;IACrC,uDAAuD;IACvD,QAAQ,EAAE,EAAE;IACZ,sDAAsD;IACtD,QAAQ,EAAE,EAAE;IACZ,0CAA0C;IAC1C,WAAW,EAAE,EAAE;IACf,4DAA4D;IAC5D,YAAY,EAAE,IAAI;IAClB,yEAAyE;IACzE,OAAO,EAAE,CAAC;IACV,mEAAmE;IACnE,aAAa,EAAE,GAAG;IAClB,mDAAmD;IACnD,SAAS,EAAE,EAAE;IACb,8DAA8D;IAC9D,WAAW,EAAE,CAAC;CACN,CAAC"}