agentfootprint 6.40.0 → 6.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/llm/BrowserOpenAIProvider.js +37 -13
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +49 -20
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +37 -13
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.js +49 -20
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/observability/contextError/finders/compareFinders.js +22 -0
- package/dist/esm/observability/contextError/finders/compareFinders.js.map +1 -0
- package/dist/esm/observability/contextError/finders/index.js +7 -0
- package/dist/esm/observability/contextError/finders/index.js.map +1 -0
- package/dist/esm/observability/contextError/finders/rankSuspects.js +50 -0
- package/dist/esm/observability/contextError/finders/rankSuspects.js.map +1 -0
- package/dist/esm/observability/contextError/finders/removeAndRetry.js +43 -0
- package/dist/esm/observability/contextError/finders/removeAndRetry.js.map +1 -0
- package/dist/esm/observability/contextError/finders/shrinkToCause.js +87 -0
- package/dist/esm/observability/contextError/finders/shrinkToCause.js.map +1 -0
- package/dist/esm/observability/contextError/finders/testManyCombos.js +94 -0
- package/dist/esm/observability/contextError/finders/testManyCombos.js.map +1 -0
- package/dist/esm/observability/contextError/finders/traceSteps.js +62 -0
- package/dist/esm/observability/contextError/finders/traceSteps.js.map +1 -0
- package/dist/esm/observability/contextError/finders/types.js +2 -0
- package/dist/esm/observability/contextError/finders/types.js.map +1 -0
- package/dist/observability/contextError/finders/compareFinders.js +26 -0
- package/dist/observability/contextError/finders/compareFinders.js.map +1 -0
- package/dist/observability/contextError/finders/index.js +16 -0
- package/dist/observability/contextError/finders/index.js.map +1 -0
- package/dist/observability/contextError/finders/rankSuspects.js +53 -0
- package/dist/observability/contextError/finders/rankSuspects.js.map +1 -0
- package/dist/observability/contextError/finders/removeAndRetry.js +46 -0
- package/dist/observability/contextError/finders/removeAndRetry.js.map +1 -0
- package/dist/observability/contextError/finders/shrinkToCause.js +90 -0
- package/dist/observability/contextError/finders/shrinkToCause.js.map +1 -0
- package/dist/observability/contextError/finders/testManyCombos.js +97 -0
- package/dist/observability/contextError/finders/testManyCombos.js.map +1 -0
- package/dist/observability/contextError/finders/traceSteps.js +65 -0
- package/dist/observability/contextError/finders/traceSteps.js.map +1 -0
- package/dist/observability/contextError/finders/types.js +3 -0
- package/dist/observability/contextError/finders/types.js.map +1 -0
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +7 -0
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +24 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/observability/contextError/finders/compareFinders.d.ts +20 -0
- package/dist/types/observability/contextError/finders/compareFinders.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/index.d.ts +23 -0
- package/dist/types/observability/contextError/finders/index.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/rankSuspects.d.ts +3 -0
- package/dist/types/observability/contextError/finders/rankSuspects.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/removeAndRetry.d.ts +12 -0
- package/dist/types/observability/contextError/finders/removeAndRetry.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/shrinkToCause.d.ts +12 -0
- package/dist/types/observability/contextError/finders/shrinkToCause.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/testManyCombos.d.ts +12 -0
- package/dist/types/observability/contextError/finders/testManyCombos.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/traceSteps.d.ts +3 -0
- package/dist/types/observability/contextError/finders/traceSteps.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/types.d.ts +89 -0
- package/dist/types/observability/contextError/finders/types.d.ts.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeAndRetry = void 0;
|
|
4
|
+
exports.removeAndRetry = {
|
|
5
|
+
name: 'removeAndRetry',
|
|
6
|
+
meta: {
|
|
7
|
+
label: 'Removes each piece and re-runs; keeps the ones whose removal fixes the answer',
|
|
8
|
+
method: 'leave-one-out ablation (counterfactual necessity)',
|
|
9
|
+
paper: 'CausalArmor (Kim 2026) / ContextCite (Cohen-Wang 2024)',
|
|
10
|
+
},
|
|
11
|
+
async find(input) {
|
|
12
|
+
if (!input.rerun)
|
|
13
|
+
throw new Error('removeAndRetry needs input.rerun');
|
|
14
|
+
const rerun = input.rerun;
|
|
15
|
+
const results = [];
|
|
16
|
+
for (const s of input.suspects) {
|
|
17
|
+
const r = await rerun([s.id]);
|
|
18
|
+
results.push({ id: s.id, recovered: r.recovered });
|
|
19
|
+
}
|
|
20
|
+
const flippers = results.filter((r) => r.recovered).map((r) => r.id);
|
|
21
|
+
// flippers first (causally necessary); stable for ties
|
|
22
|
+
const ranked = [...results].sort((a, b) => Number(b.recovered) - Number(a.recovered));
|
|
23
|
+
const explanation = [
|
|
24
|
+
`removeAndRetry: removed each of ${input.suspects.length} pieces and re-ran (${results.length} checks).`,
|
|
25
|
+
flippers.length
|
|
26
|
+
? `Removing these flipped the outcome (causally necessary): ${flippers.join(', ')}.`
|
|
27
|
+
: `No single removal flipped the outcome — possible over-determination (no necessary single cause).`,
|
|
28
|
+
flippers.length > 1
|
|
29
|
+
? `NOTE: ${flippers.length} pieces each flip — multiple necessary causes or incidental reroutes; narrow with a slice (rankSuspects) first.`
|
|
30
|
+
: '',
|
|
31
|
+
]
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.join('\n');
|
|
34
|
+
return {
|
|
35
|
+
finder: 'removeAndRetry',
|
|
36
|
+
suspects: ranked.map((r) => ({ id: r.id })),
|
|
37
|
+
lead: flippers[0],
|
|
38
|
+
shortlist: flippers,
|
|
39
|
+
evidence: 'proven',
|
|
40
|
+
granularity: 'piece',
|
|
41
|
+
checks: results.length,
|
|
42
|
+
explanation,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=removeAndRetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeAndRetry.js","sourceRoot":"","sources":["../../../../src/observability/contextError/finders/removeAndRetry.ts"],"names":[],"mappings":";;;AAWa,QAAA,cAAc,GAAW;IACpC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,KAAK,EAAE,+EAA+E;QACtF,MAAM,EAAE,mDAAmD;QAC3D,KAAK,EAAE,wDAAwD;KAChE;IACD,KAAK,CAAC,IAAI,CAAC,KAAgB;QACzB,IAAI,CAAC,KAAK,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,MAAM,OAAO,GAAyC,EAAE,CAAC;QACzD,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC/B,MAAM,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrE,uDAAuD;QACvD,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QACtF,MAAM,WAAW,GAAG;YAClB,mCAAmC,KAAK,CAAC,QAAQ,CAAC,MAAM,uBAAuB,OAAO,CAAC,MAAM,WAAW;YACxG,QAAQ,CAAC,MAAM;gBACb,CAAC,CAAC,4DAA4D,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBACpF,CAAC,CAAC,kGAAkG;YACtG,QAAQ,CAAC,MAAM,GAAG,CAAC;gBACjB,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,iHAAiH;gBAC3I,CAAC,CAAC,EAAE;SACP;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO;YACL,MAAM,EAAE,gBAAgB;YACxB,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3C,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;YACjB,SAAS,EAAE,QAAQ;YACnB,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,OAAO;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,WAAW;SACZ,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shrinkToCause = void 0;
|
|
4
|
+
exports.shrinkToCause = {
|
|
5
|
+
name: 'shrinkToCause',
|
|
6
|
+
meta: {
|
|
7
|
+
label: 'Shrinks the suspect set to the smallest whose removal still fixes the answer',
|
|
8
|
+
method: 'delta-debugging minimization (ddmin) to the minimal recovering set',
|
|
9
|
+
paper: 'BugDoc, Lourenço et al. 2020 (SIGMOD)',
|
|
10
|
+
},
|
|
11
|
+
async find(input) {
|
|
12
|
+
if (!input.rerun)
|
|
13
|
+
throw new Error('shrinkToCause needs input.rerun');
|
|
14
|
+
const rerun = input.rerun;
|
|
15
|
+
const ids = input.suspects.map((s) => s.id);
|
|
16
|
+
let checks = 0;
|
|
17
|
+
const recovers = async (removed) => {
|
|
18
|
+
checks++;
|
|
19
|
+
return (await rerun(removed)).recovered;
|
|
20
|
+
};
|
|
21
|
+
// Precondition: removing everything must recover, else there is no removable cause here.
|
|
22
|
+
if (ids.length === 0 || !(await recovers(ids))) {
|
|
23
|
+
return {
|
|
24
|
+
finder: 'shrinkToCause',
|
|
25
|
+
suspects: ids.map((id) => ({ id })),
|
|
26
|
+
shortlist: [],
|
|
27
|
+
lead: undefined,
|
|
28
|
+
evidence: 'guessed',
|
|
29
|
+
granularity: 'piece',
|
|
30
|
+
checks,
|
|
31
|
+
explanation: `shrinkToCause: removing all ${ids.length} pieces did not recover — no single removable cause (over-determined or absent).`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// ddmin: minimize the removal set that still recovers.
|
|
35
|
+
let candidates = [...ids];
|
|
36
|
+
let n = 2;
|
|
37
|
+
while (candidates.length > 1) {
|
|
38
|
+
const size = Math.ceil(candidates.length / n);
|
|
39
|
+
let reduced = false;
|
|
40
|
+
// a single chunk's removal already recovers → narrow to it
|
|
41
|
+
for (let i = 0; i < candidates.length; i += size) {
|
|
42
|
+
const chunk = candidates.slice(i, i + size);
|
|
43
|
+
if (chunk.length && (await recovers(chunk))) {
|
|
44
|
+
candidates = chunk;
|
|
45
|
+
n = 2;
|
|
46
|
+
reduced = true;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (!reduced) {
|
|
51
|
+
// removing a complement recovers → drop that chunk
|
|
52
|
+
for (let i = 0; i < candidates.length; i += size) {
|
|
53
|
+
const complement = [...candidates.slice(0, i), ...candidates.slice(i + size)];
|
|
54
|
+
if (complement.length && (await recovers(complement))) {
|
|
55
|
+
candidates = complement;
|
|
56
|
+
n = Math.max(n - 1, 2);
|
|
57
|
+
reduced = true;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!reduced) {
|
|
63
|
+
if (n >= candidates.length)
|
|
64
|
+
break;
|
|
65
|
+
n = Math.min(candidates.length, n * 2);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const rest = ids.filter((id) => !candidates.includes(id));
|
|
69
|
+
const explanation = [
|
|
70
|
+
`shrinkToCause: delta-debugging minimization over ${ids.length} pieces in ${checks} checks.`,
|
|
71
|
+
`Minimal recovering set: ${candidates.join(', ')} (removing it flips the outcome; nothing smaller does).`,
|
|
72
|
+
checks < ids.length
|
|
73
|
+
? `Reached the cause in fewer checks than leave-one-out (${checks} vs ${ids.length}).`
|
|
74
|
+
: '',
|
|
75
|
+
]
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
.join('\n');
|
|
78
|
+
return {
|
|
79
|
+
finder: 'shrinkToCause',
|
|
80
|
+
suspects: [...candidates, ...rest].map((id) => ({ id })),
|
|
81
|
+
shortlist: candidates,
|
|
82
|
+
lead: candidates[0],
|
|
83
|
+
evidence: 'proven',
|
|
84
|
+
granularity: 'piece',
|
|
85
|
+
checks,
|
|
86
|
+
explanation,
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=shrinkToCause.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shrinkToCause.js","sourceRoot":"","sources":["../../../../src/observability/contextError/finders/shrinkToCause.ts"],"names":[],"mappings":";;;AAWa,QAAA,aAAa,GAAW;IACnC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE;QACJ,KAAK,EAAE,8EAA8E;QACrF,MAAM,EAAE,oEAAoE;QAC5E,KAAK,EA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EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG;YAClB,oDAAoD,GAAG,CAAC,MAAM,cAAc,MAAM,UAAU;YAC5F,2BAA2B,UAAU,CAAC,IAAI,CACxC,IAAI,CACL,yDAAyD;YAC1D,MAAM,GAAG,GAAG,CAAC,MAAM;gBACjB,CAAC,CAAC,yDAAyD,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI;gBACtF,CAAC,CAAC,EAAE;SACP;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO;YACL,MAAM,EAAE,eAAe;YACvB,QAAQ,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACxD,SAAS,EAAE,UAAU;YACrB,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;YACnB,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,OAAO;YACpB,MAAM;YACN,WAAW;SACZ,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testManyCombos = void 0;
|
|
4
|
+
/** Deterministic LCG so the masking is reproducible across runs (and in tests). */
|
|
5
|
+
function lcg(seed) {
|
|
6
|
+
let s = seed >>> 0;
|
|
7
|
+
return () => {
|
|
8
|
+
s = (Math.imul(s, 1664525) + 1013904223) >>> 0;
|
|
9
|
+
return s / 0x100000000;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
exports.testManyCombos = {
|
|
13
|
+
name: 'testManyCombos',
|
|
14
|
+
meta: {
|
|
15
|
+
label: 'Turns pieces on/off in many combinations and learns which drive the answer',
|
|
16
|
+
method: 'random-subset ablation + linear-surrogate attribution, then one confirming ablation',
|
|
17
|
+
paper: 'ContextCite, Cohen-Wang et al. 2024 (arXiv:2409.00729)',
|
|
18
|
+
},
|
|
19
|
+
async find(input) {
|
|
20
|
+
if (!input.rerun)
|
|
21
|
+
throw new Error('testManyCombos needs input.rerun');
|
|
22
|
+
const rerun = input.rerun;
|
|
23
|
+
const ids = input.suspects.map((s) => s.id);
|
|
24
|
+
if (ids.length === 0) {
|
|
25
|
+
return {
|
|
26
|
+
finder: 'testManyCombos',
|
|
27
|
+
suspects: [],
|
|
28
|
+
shortlist: [],
|
|
29
|
+
evidence: 'guessed',
|
|
30
|
+
granularity: 'piece',
|
|
31
|
+
checks: 0,
|
|
32
|
+
explanation: 'testManyCombos: no suspects to test.',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const samples = Math.max(4, input.samples ?? Math.min(40, ids.length * 4));
|
|
36
|
+
const rand = lcg(0x9e3779b9 ^ ids.length);
|
|
37
|
+
// per-id recovery rate when the piece is removed vs kept
|
|
38
|
+
const stat = new Map(ids.map((id) => [id, { remHits: 0, remN: 0, keepHits: 0, keepN: 0 }]));
|
|
39
|
+
for (let k = 0; k < samples; k++) {
|
|
40
|
+
const removed = ids.filter(() => rand() < 0.5);
|
|
41
|
+
const removedSet = new Set(removed);
|
|
42
|
+
const recovered = (await rerun(removed)).recovered ? 1 : 0;
|
|
43
|
+
for (const id of ids) {
|
|
44
|
+
const st = stat.get(id);
|
|
45
|
+
if (removedSet.has(id)) {
|
|
46
|
+
st.remHits += recovered;
|
|
47
|
+
st.remN++;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
st.keepHits += recovered;
|
|
51
|
+
st.keepN++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// coefficient = P(recover | removed) − P(recover | kept): high ⇒ removing it fixes the answer
|
|
56
|
+
const scored = ids
|
|
57
|
+
.map((id) => {
|
|
58
|
+
const st = stat.get(id);
|
|
59
|
+
const remMean = st.remN ? st.remHits / st.remN : 0;
|
|
60
|
+
const keepMean = st.keepN ? st.keepHits / st.keepN : 0;
|
|
61
|
+
return { id, score: remMean - keepMean };
|
|
62
|
+
})
|
|
63
|
+
.sort((a, b) => b.score - a.score);
|
|
64
|
+
const lead = scored[0]?.id;
|
|
65
|
+
// confirm the top candidate with one clean single-piece ablation
|
|
66
|
+
let evidence = 'guessed';
|
|
67
|
+
let checks = samples;
|
|
68
|
+
if (lead) {
|
|
69
|
+
const r = await rerun([lead]);
|
|
70
|
+
checks++;
|
|
71
|
+
// 'proven' requires BOTH a positive learned contrast AND the lead flipping alone —
|
|
72
|
+
// guards against a degenerate rerun that recovers for every subset (no real signal,
|
|
73
|
+
// every score 0), which would otherwise falsely convict an arbitrary innocent.
|
|
74
|
+
evidence = r.recovered && (scored[0]?.score ?? 0) > 0 ? 'proven' : 'guessed';
|
|
75
|
+
}
|
|
76
|
+
const cutoff = Math.max(0.25, (scored[0]?.score ?? 0) / 2);
|
|
77
|
+
const shortlist = scored.filter((s) => s.score >= cutoff).map((s) => s.id);
|
|
78
|
+
const explanation = [
|
|
79
|
+
`testManyCombos: ran ${samples} random on/off combinations + 1 confirming check.`,
|
|
80
|
+
`Strongest learned effect: ${lead ?? '(none)'} (removing it most increases recovery).`,
|
|
81
|
+
evidence === 'proven'
|
|
82
|
+
? `Confirmed: removing ${lead} alone recovers the outcome.`
|
|
83
|
+
: `The top candidate did not confirm alone — treat as a guess (possible over-determination).`,
|
|
84
|
+
].join('\n');
|
|
85
|
+
return {
|
|
86
|
+
finder: 'testManyCombos',
|
|
87
|
+
suspects: scored,
|
|
88
|
+
lead,
|
|
89
|
+
shortlist: shortlist.length ? shortlist : lead ? [lead] : [],
|
|
90
|
+
evidence,
|
|
91
|
+
granularity: 'piece',
|
|
92
|
+
checks,
|
|
93
|
+
explanation,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=testManyCombos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testManyCombos.js","sourceRoot":"","sources":["../../../../src/observability/contextError/finders/testManyCombos.ts"],"names":[],"mappings":";;;AAWA,mFAAmF;AACnF,SAAS,GAAG,CAAC,IAAY;IACvB,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;IACnB,OAAO,GAAG,EAAE;QACV,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,WAAW,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;AAEY,QAAA,cAAc,GAAW;IACpC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,KAAK,EAAE,4EAA4E;QACnF,MAAM,EAAE,qFAAqF;QAC7F,KAAK,EAAE,wDAAwD;KAChE;IACD,KAAK,CAAC,IAAI,CAAC,KAAgB;QACzB,IAAI,CAAC,KAAK,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,MAAM,EAAE,gBAAgB;gBACxB,QAAQ,EAAE,EAAE;gBACZ,SAAS,EAAE,EAAE;gBACb,QAAQ,EAAE,SAAS;gBACnB,WAAW,EAAE,OAAO;gBACpB,MAAM,EAAE,CAAC;gBACT,WAAW,EAAE,sCAAsC;aAC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AAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3E,MAAM,WAAW,GAAG;YAClB,uBAAuB,OAAO,mDAAmD;YACjF,6BAA6B,IAAI,IAAI,QAAQ,yCAAyC;YACtF,QAAQ,KAAK,QAAQ;gBACnB,CAAC,CAAC,uBAAuB,IAAI,8BAA8B;gBAC3D,CAAC,CAAC,2FAA2F;SAChG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,OAAO;YACL,MAAM,EAAE,gBAAgB;YACxB,QAAQ,EAAE,MAAM;YAChB,IAAI;YACJ,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YAC5D,QAAQ;YACR,WAAW,EAAE,OAAO;YACpB,MAAM;YACN,WAAW;SACZ,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.traceSteps = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* traceSteps — the step-level finder. Traces backward through the agent's steps
|
|
6
|
+
* (tool-calls) from the failure to the most suspicious step, then optionally checks
|
|
7
|
+
* whether correcting that step recovers the outcome. Its UNIT is the STEP: if the
|
|
8
|
+
* root cause is a context element (an injected fact/instruction), that is outside
|
|
9
|
+
* this finder's vocabulary — pair it with rankSuspects/removeAndRetry for elements.
|
|
10
|
+
*
|
|
11
|
+
* Method: dependency-guided backward search + step-recovery counterfactual.
|
|
12
|
+
*/
|
|
13
|
+
const index_js_1 = require("../../../lib/influence-core/index.js");
|
|
14
|
+
exports.traceSteps = {
|
|
15
|
+
name: 'traceSteps',
|
|
16
|
+
meta: {
|
|
17
|
+
label: 'Traces backward through the agent steps to the one that led to the wrong answer',
|
|
18
|
+
method: 'dependency-guided backward search + step-recovery counterfactual (step granularity)',
|
|
19
|
+
paper: 'FALAT, Rafi et al. 2026 (arXiv:2606.00765)',
|
|
20
|
+
},
|
|
21
|
+
async find(input) {
|
|
22
|
+
if (!input.steps || !input.embedder)
|
|
23
|
+
throw new Error('traceSteps needs input.steps and input.embedder');
|
|
24
|
+
const evidence = input.steps.map((s) => ({
|
|
25
|
+
id: s.id,
|
|
26
|
+
text: s.text,
|
|
27
|
+
ancestorTexts: [],
|
|
28
|
+
}));
|
|
29
|
+
const ranked = await (0, index_js_1.scoreInfluence)({
|
|
30
|
+
evidence,
|
|
31
|
+
finalAnswerText: input.wrongOutput,
|
|
32
|
+
embedder: input.embedder,
|
|
33
|
+
});
|
|
34
|
+
const topId = ranked[0]?.id;
|
|
35
|
+
const step = input.steps.find((s) => s.id === topId);
|
|
36
|
+
let recovers;
|
|
37
|
+
let checks = 0;
|
|
38
|
+
if (input.rerun && topId) {
|
|
39
|
+
const r = await input.rerun([topId]);
|
|
40
|
+
recovers = r.recovered;
|
|
41
|
+
checks = 1;
|
|
42
|
+
}
|
|
43
|
+
const explanation = [
|
|
44
|
+
`traceSteps: backward dependency search over ${input.steps.length} agent steps.`,
|
|
45
|
+
`Most suspicious step: ${step?.label ?? topId ?? '(none)'}.`,
|
|
46
|
+
recovers === undefined
|
|
47
|
+
? ''
|
|
48
|
+
: `Correcting that step ${recovers ? 'recovered' : 'did NOT recover'} the outcome.`,
|
|
49
|
+
`Granularity is the STEP — if the root cause is a context element, it is outside this finder's vocabulary.`,
|
|
50
|
+
]
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.join('\n');
|
|
53
|
+
return {
|
|
54
|
+
finder: 'traceSteps',
|
|
55
|
+
suspects: ranked.map((s) => ({ id: s.id, score: s.score })),
|
|
56
|
+
lead: topId,
|
|
57
|
+
shortlist: topId ? [topId] : [],
|
|
58
|
+
evidence: input.rerun ? 'proven' : 'guessed',
|
|
59
|
+
granularity: 'step',
|
|
60
|
+
checks,
|
|
61
|
+
explanation,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=traceSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceSteps.js","sourceRoot":"","sources":["../../../../src/observability/contextError/finders/traceSteps.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,mEAAsE;AAGzD,QAAA,UAAU,GAAW;IAChC,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE;QACJ,KAAK,EAAE,iFAAiF;QACxF,MAAM,EAAE,qFAAqF;QAC7F,KAAK,EAAE,4CAA4C;KACpD;IACD,KAAK,CAAC,IAAI,CAAC,KAAgB;QACzB,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ;YACjC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,aAAa,EAAE,EAAc;SAC9B,CAAC,CAAC,CAAC;QACJ,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAc,EAAC;YAClC,QAAQ;YACR,eAAe,EAAE,KAAK,CAAC,WAAW;YAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,E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AM;YACN,WAAW;SACZ,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/observability/contextError/finders/types.ts"],"names":[],"mappings":""}
|
|
@@ -31,6 +31,10 @@ export interface BrowserOpenAIProviderOptions {
|
|
|
31
31
|
/** Auth header scheme. `'bearer'` (default) → `Authorization: Bearer <key>`;
|
|
32
32
|
* `'api-key'` → the `api-key` header (Azure OpenAI). */
|
|
33
33
|
readonly authScheme?: 'bearer' | 'api-key';
|
|
34
|
+
/** Treat the target as a **reasoning model** (o-series): omit `temperature` and send
|
|
35
|
+
* the `developer` role. Standard o-series ids are auto-detected; set for arbitrary
|
|
36
|
+
* Azure deployment names. */
|
|
37
|
+
readonly reasoning?: boolean;
|
|
34
38
|
/** @internal Custom fetch implementation for tests. */
|
|
35
39
|
readonly _fetch?: typeof fetch;
|
|
36
40
|
}
|
|
@@ -54,6 +58,9 @@ export interface BrowserAzureOpenAIProviderOptions {
|
|
|
54
58
|
readonly deployment: string;
|
|
55
59
|
/** Default max tokens. */
|
|
56
60
|
readonly defaultMaxTokens?: number;
|
|
61
|
+
/** Set when the Azure deployment is a **reasoning model** (o1/o3/o4-mini) — omits
|
|
62
|
+
* `temperature` and sends the `developer` role. */
|
|
63
|
+
readonly reasoning?: boolean;
|
|
57
64
|
/** @internal Custom fetch implementation for tests. */
|
|
58
65
|
readonly _fetch?: typeof fetch;
|
|
59
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserOpenAIProvider.d.ts","sourceRoot":"","sources":["../../../../src/adapters/llm/BrowserOpenAIProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,QAAQ,EAER,WAAW,EACX,UAAU,EACV,WAAW,EAEZ,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowserOpenAIProvider.d.ts","sour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MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;wDACoD;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,CAAC;CAChC;AASD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iCAAiC,GAAG,WAAW,CAqC1F;AAED,qBAAa,0BAA2B,YAAW,WAAW;IAC5D,QAAQ,CAAC,IAAI,0BAA0B;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;gBAExB,OAAO,EAAE,iCAAiC;IAItD,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAI/C,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC;CAIjD"}
|
|
@@ -30,13 +30,21 @@ interface OpenAICreateParams {
|
|
|
30
30
|
model: string;
|
|
31
31
|
messages: OpenAIMessage[];
|
|
32
32
|
tools?: OpenAITool[];
|
|
33
|
+
/** Legacy token cap — DEPRECATED by OpenAI and REJECTED by o-series reasoning
|
|
34
|
+
* models. Kept only for custom OpenAI-compatible endpoints (Ollama/vLLM/…). */
|
|
33
35
|
max_tokens?: number;
|
|
36
|
+
/** Current token cap — accepted by all OpenAI/Azure chat models incl. o-series. */
|
|
37
|
+
max_completion_tokens?: number;
|
|
34
38
|
temperature?: number;
|
|
35
39
|
stop?: string[];
|
|
36
40
|
stream?: boolean;
|
|
41
|
+
/** Ask OpenAI/Azure to emit a final usage chunk while streaming. */
|
|
42
|
+
stream_options?: {
|
|
43
|
+
include_usage: boolean;
|
|
44
|
+
};
|
|
37
45
|
}
|
|
38
46
|
interface OpenAIMessage {
|
|
39
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
47
|
+
role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
|
|
40
48
|
content: string | null;
|
|
41
49
|
tool_calls?: OpenAIToolCall[];
|
|
42
50
|
tool_call_id?: string;
|
|
@@ -111,6 +119,14 @@ export interface OpenAIProviderOptions {
|
|
|
111
119
|
readonly defaultModel?: string;
|
|
112
120
|
/** Default max tokens when the request doesn't set it. Optional. */
|
|
113
121
|
readonly defaultMaxTokens?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Treat the target as a **reasoning model** (o-series: o1 / o3 / o4-mini, or an
|
|
124
|
+
* Azure reasoning deployment). Reasoning models reject `max_tokens` and an explicit
|
|
125
|
+
* `temperature`, and use the `developer` role in place of `system`. Standard o-series
|
|
126
|
+
* model ids are auto-detected; set this explicitly for Azure deployments whose name
|
|
127
|
+
* does not reveal the underlying model.
|
|
128
|
+
*/
|
|
129
|
+
readonly reasoning?: boolean;
|
|
114
130
|
/** @internal Pre-built client for testing. Skips SDK import. */
|
|
115
131
|
readonly _client?: OpenAIClient;
|
|
116
132
|
}
|
|
@@ -153,6 +169,13 @@ export interface AzureOpenAIProviderOptions {
|
|
|
153
169
|
readonly deployment?: string;
|
|
154
170
|
/** Default max tokens when the request doesn't set it. Optional. */
|
|
155
171
|
readonly defaultMaxTokens?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Set when the Azure DEPLOYMENT is a **reasoning model** (o1/o3/o4-mini). Azure
|
|
174
|
+
* deployment names are arbitrary, so this cannot be auto-detected — declare it to
|
|
175
|
+
* omit `temperature` and send the `developer` role. (`max_completion_tokens` is used
|
|
176
|
+
* for all Azure deployments regardless.)
|
|
177
|
+
*/
|
|
178
|
+
readonly reasoning?: boolean;
|
|
156
179
|
/** @internal Pre-built client for testing. Skips SDK import. */
|
|
157
180
|
readonly _client?: OpenAIClient;
|
|
158
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAIProvider.d.ts","sourceRoot":"","sources":["../../../../src/adapters/llm/OpenAIProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EACV,QAAQ,EAER,WAAW,EACX,UAAU,EACV,WAAW,EAEZ,MAAM,aAAa,CAAC;AAKrB,UAAU,YAAY;IACpB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,MAAM,CACJ,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,oBAAoB,CAAC,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;SACrE,CAAC;KACH,CAAC;CACH;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenAIProvider.d.ts","sourceRoot":"","sources":["../../../../src/adapters/llm/OpenAIProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EACV,QAAQ,EAER,WAAW,EACX,UAAU,EACV,WAAW,EAEZ,MAAM,aAAa,CAAC;AAKrB,UAAU,YAAY;IACpB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,MAAM,CACJ,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,oBAAoB,CAAC,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;SACrE,CAAC;KACH,CAAC;CACH;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,C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* compareFinders — run several finders on the same case and collect their answers
|
|
3
|
+
* side by side (a leaderboard row per finder). PARAMETRIC: you pass the finders to
|
|
4
|
+
* compare, so nothing is auto-discovered or retained — unused finders stay
|
|
5
|
+
* tree-shakeable.
|
|
6
|
+
*/
|
|
7
|
+
import type { Finder, FindInput, FindResult } from './types.js';
|
|
8
|
+
/** One finder's result in a comparison (or the error it threw). */
|
|
9
|
+
export interface CompareRow {
|
|
10
|
+
readonly finder: string;
|
|
11
|
+
readonly result: FindResult | null;
|
|
12
|
+
readonly error?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Run each finder on `input`; a finder that throws (e.g. missing a dep it needs)
|
|
16
|
+
* becomes a row with `result: null` and `error` set, so one finder cannot abort
|
|
17
|
+
* the comparison.
|
|
18
|
+
*/
|
|
19
|
+
export declare function compareFinders(finders: readonly Finder[], input: FindInput): Promise<CompareRow[]>;
|
|
20
|
+
//# sourceMappingURL=compareFinders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compareFinders.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/compareFinders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEhE,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,EAAE,CAAC,CAcvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* observability / contextError / finders — pluggable context-bug localization.
|
|
3
|
+
*
|
|
4
|
+
* "Which piece of context made the agent's answer wrong?" Pick a finder and call
|
|
5
|
+
* `find(input)`. Each finder is a thin, self-explaining adapter over the engines in
|
|
6
|
+
* `src/lib/context-bisect` + `src/lib/influence-core`; the academic method + citation
|
|
7
|
+
* live in `meta`, never in the import name.
|
|
8
|
+
*
|
|
9
|
+
* import { rankSuspects } from 'agentfootprint/observability/contextError/finders';
|
|
10
|
+
* const r = await rankSuspects.find(input); // r.lead, r.evidence ('guessed'|'proven')
|
|
11
|
+
*
|
|
12
|
+
* Tree-shakeable: one finder = one file = one named export. Importing one finder does
|
|
13
|
+
* not pull the others (or the heavy ablation path behind removeAndRetry). This barrel
|
|
14
|
+
* is re-export-only — no runtime code, no registry.
|
|
15
|
+
*/
|
|
16
|
+
export type { ContextPiece, Evidence, Finder, FinderMeta, FindInput, FindResult, Granularity, ScoredSuspect, StepInput, } from './types.js';
|
|
17
|
+
export { rankSuspects } from './rankSuspects.js';
|
|
18
|
+
export { removeAndRetry } from './removeAndRetry.js';
|
|
19
|
+
export { traceSteps } from './traceSteps.js';
|
|
20
|
+
export { testManyCombos } from './testManyCombos.js';
|
|
21
|
+
export { shrinkToCause } from './shrinkToCause.js';
|
|
22
|
+
export { compareFinders, type CompareRow } from './compareFinders.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rankSuspects.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/rankSuspects.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,YAAY,EAAE,MAsC1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* removeAndRetry — the thorough finder. Removes each context piece, re-runs the
|
|
3
|
+
* agent, and a piece is the cause iff its removal flips the outcome back. No
|
|
4
|
+
* embedder, no heuristic: pure counterfactual. Exact, but pays one re-run per
|
|
5
|
+
* piece (`checks`), and on multi-loop runs it can over-attribute (several pieces
|
|
6
|
+
* each flip) — narrow with a slice first when that happens.
|
|
7
|
+
*
|
|
8
|
+
* Method: leave-one-out ablation (counterfactual necessity).
|
|
9
|
+
*/
|
|
10
|
+
import type { Finder } from './types.js';
|
|
11
|
+
export declare const removeAndRetry: Finder;
|
|
12
|
+
//# sourceMappingURL=removeAndRetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeAndRetry.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/removeAndRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,cAAc,EAAE,MAwC5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shrinkToCause — keeps cutting the suspect set down until the smallest subset whose
|
|
3
|
+
* removal still fixes the answer. For a single dominant cause it converges in fewer
|
|
4
|
+
* re-runs than leave-one-out (delta-debugging minimization); for co-necessary causes it
|
|
5
|
+
* still returns the minimal recovering set, but may cost more probes than leave-one-out.
|
|
6
|
+
* The returned set is verified to recover by construction.
|
|
7
|
+
*
|
|
8
|
+
* Method: delta-debugging minimization (ddmin) over the removal set that recovers.
|
|
9
|
+
*/
|
|
10
|
+
import type { Finder } from './types.js';
|
|
11
|
+
export declare const shrinkToCause: Finder;
|
|
12
|
+
//# sourceMappingURL=shrinkToCause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shrinkToCause.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/shrinkToCause.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,MAwF3B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* testManyCombos — turns context pieces on and off in many combinations, re-runs each,
|
|
3
|
+
* and learns which pieces drive the wrong answer (a linear-surrogate attribution), then
|
|
4
|
+
* confirms the top candidate with one clean ablation. The sampling one: it estimates an
|
|
5
|
+
* influence weight per piece from counterfactual data rather than ranking by similarity.
|
|
6
|
+
*
|
|
7
|
+
* Method: random-subset ablation + linear-surrogate attribution. Deterministic
|
|
8
|
+
* pseudo-random masking (a reproducible reimplementation of ContextCite's random subsets).
|
|
9
|
+
*/
|
|
10
|
+
import type { Finder } from './types.js';
|
|
11
|
+
export declare const testManyCombos: Finder;
|
|
12
|
+
//# sourceMappingURL=testManyCombos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testManyCombos.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/testManyCombos.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAWhE,eAAO,MAAM,cAAc,EAAE,MAkF5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceSteps.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/traceSteps.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,UAAU,EAAE,MAkDxB,CAAC"}
|