agentfootprint 9.34.0 → 9.36.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/AGENTS.md +1 -1
- package/CLAUDE.md +3 -1
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/conventions.js +14 -0
- package/dist/conventions.js.map +1 -1
- package/dist/core/Agent.js +89 -5
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +161 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +8 -0
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +16 -0
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +7 -0
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/evidence/errors.js +55 -0
- package/dist/core/agent/evidence/errors.js.map +1 -0
- package/dist/core/agent/evidence/evidenceIndex.js +167 -0
- package/dist/core/agent/evidence/evidenceIndex.js.map +1 -0
- package/dist/core/agent/evidence/extract.js +145 -0
- package/dist/core/agent/evidence/extract.js.map +1 -0
- package/dist/core/agent/evidence/frames.js +44 -0
- package/dist/core/agent/evidence/frames.js.map +1 -0
- package/dist/core/agent/evidence/gate.js +206 -0
- package/dist/core/agent/evidence/gate.js.map +1 -0
- package/dist/core/agent/evidence/index.js +15 -0
- package/dist/core/agent/evidence/index.js.map +1 -0
- package/dist/core/agent/evidence/normalize.js +141 -0
- package/dist/core/agent/evidence/normalize.js.map +1 -0
- package/dist/core/agent/evidence/types.js +11 -0
- package/dist/core/agent/evidence/types.js.map +1 -0
- package/dist/core/agent/stages/evidenceRecheck.js +86 -0
- package/dist/core/agent/stages/evidenceRecheck.js.map +1 -0
- package/dist/core/agent/stages/route.js +152 -16
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/seed.js +7 -0
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/toolsFromActiveSkill.js +79 -0
- package/dist/core/agent/toolsFromActiveSkill.js.map +1 -0
- package/dist/esm/conventions.d.ts +7 -0
- package/dist/esm/conventions.js +14 -0
- package/dist/esm/conventions.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +34 -1
- package/dist/esm/core/Agent.js +87 -3
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +128 -0
- package/dist/esm/core/agent/AgentBuilder.js +161 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +21 -0
- package/dist/esm/core/agent/buildAgentChart.js +8 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +16 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.js +8 -1
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/evidence/errors.d.ts +55 -0
- package/dist/esm/core/agent/evidence/errors.js +51 -0
- package/dist/esm/core/agent/evidence/errors.js.map +1 -0
- package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +73 -0
- package/dist/esm/core/agent/evidence/evidenceIndex.js +162 -0
- package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -0
- package/dist/esm/core/agent/evidence/extract.d.ts +66 -0
- package/dist/esm/core/agent/evidence/extract.js +139 -0
- package/dist/esm/core/agent/evidence/extract.js.map +1 -0
- package/dist/esm/core/agent/evidence/frames.d.ts +36 -0
- package/dist/esm/core/agent/evidence/frames.js +40 -0
- package/dist/esm/core/agent/evidence/frames.js.map +1 -0
- package/dist/esm/core/agent/evidence/gate.d.ts +96 -0
- package/dist/esm/core/agent/evidence/gate.js +201 -0
- package/dist/esm/core/agent/evidence/gate.js.map +1 -0
- package/dist/esm/core/agent/evidence/index.d.ts +11 -0
- package/dist/esm/core/agent/evidence/index.js +11 -0
- package/dist/esm/core/agent/evidence/index.js.map +1 -0
- package/dist/esm/core/agent/evidence/normalize.d.ts +49 -0
- package/dist/esm/core/agent/evidence/normalize.js +134 -0
- package/dist/esm/core/agent/evidence/normalize.js.map +1 -0
- package/dist/esm/core/agent/evidence/types.d.ts +118 -0
- package/dist/esm/core/agent/evidence/types.js +10 -0
- package/dist/esm/core/agent/evidence/types.js.map +1 -0
- package/dist/esm/core/agent/stages/evidenceRecheck.d.ts +31 -0
- package/dist/esm/core/agent/stages/evidenceRecheck.js +82 -0
- package/dist/esm/core/agent/stages/evidenceRecheck.js.map +1 -0
- package/dist/esm/core/agent/stages/route.d.ts +3 -2
- package/dist/esm/core/agent/stages/route.js +152 -16
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.d.ts +8 -0
- package/dist/esm/core/agent/stages/seed.js +7 -0
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/toolsFromActiveSkill.d.ts +55 -0
- package/dist/esm/core/agent/toolsFromActiveSkill.js +75 -0
- package/dist/esm/core/agent/toolsFromActiveSkill.js.map +1 -0
- package/dist/esm/core/agent/types.d.ts +44 -0
- package/dist/esm/events/payloads.d.ts +53 -2
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +7 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillsFromDir.d.ts +80 -17
- package/dist/esm/lib/injection-engine/skillsFromDir.js +348 -46
- package/dist/esm/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/index.js +50 -38
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/lib/injection-engine/skillsFromDir.js +348 -46
- package/dist/lib/injection-engine/skillsFromDir.js.map +1 -1
- package/dist/types/conventions.d.ts +7 -0
- package/dist/types/conventions.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +34 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +128 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +21 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/errors.d.ts +56 -0
- package/dist/types/core/agent/evidence/errors.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts +74 -0
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/extract.d.ts +67 -0
- package/dist/types/core/agent/evidence/extract.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/frames.d.ts +37 -0
- package/dist/types/core/agent/evidence/frames.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/gate.d.ts +97 -0
- package/dist/types/core/agent/evidence/gate.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/index.d.ts +12 -0
- package/dist/types/core/agent/evidence/index.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/normalize.d.ts +50 -0
- package/dist/types/core/agent/evidence/normalize.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/types.d.ts +119 -0
- package/dist/types/core/agent/evidence/types.d.ts.map +1 -0
- package/dist/types/core/agent/stages/evidenceRecheck.d.ts +32 -0
- package/dist/types/core/agent/stages/evidenceRecheck.d.ts.map +1 -0
- package/dist/types/core/agent/stages/route.d.ts +3 -2
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts +8 -0
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/toolsFromActiveSkill.d.ts +56 -0
- package/dist/types/core/agent/toolsFromActiveSkill.d.ts.map +1 -0
- package/dist/types/core/agent/types.d.ts +44 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +53 -2
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +7 -0
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts +80 -17
- package/dist/types/lib/injection-engine/skillsFromDir.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* toolsFromActiveSkill — the AGENT-level tool posture (9.36.0).
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure fold over the final injection list, run once at `Agent.build()`.
|
|
6
|
+
* Role: core/ layer. One declaration replaces a per-skill discipline.
|
|
7
|
+
* Emits: nothing. It changes what the OFFER contains, and the tools slot
|
|
8
|
+
* already records every offered tool and the skill that unlocked it.
|
|
9
|
+
*
|
|
10
|
+
* ── The defect this exists for ───────────────────────────────────────────
|
|
11
|
+
* `buildToolRegistry` pre-loads a skill's `inject.tools` into the STATIC
|
|
12
|
+
* registry unless that skill declared `autoActivate: 'currentSkill'`. Static
|
|
13
|
+
* means on the wire from iteration 1, whatever the cursor says. So "only the
|
|
14
|
+
* active skill's tools are offered" was a promise you had to keep on EVERY
|
|
15
|
+
* skill, one field at a time, and the first skill you forgot leaked its tools
|
|
16
|
+
* for the life of the agent — silently, because a tool that is offered too
|
|
17
|
+
* early looks exactly like a tool that is offered.
|
|
18
|
+
*
|
|
19
|
+
* A skill graph can already say it once for the skills it WIRES
|
|
20
|
+
* (`skillGraph({ scopeTools: true })`, which stamps the same field at graph
|
|
21
|
+
* compile). Three kinds of skill fall outside that: a skill the graph lists
|
|
22
|
+
* but never routes to, a skill registered beside the graph, and every skill on
|
|
23
|
+
* an agent with no graph at all — including a whole directory loaded through
|
|
24
|
+
* `skillsFromDir`. This is the same decision made where every skill is in
|
|
25
|
+
* hand: at the agent.
|
|
26
|
+
*
|
|
27
|
+
* ── Why it stamps the shipped field instead of adding a second gate ──────
|
|
28
|
+
* The alternative was a flag threaded into `buildToolRegistry`. That would
|
|
29
|
+
* have created TWO ways for a tool to be held out, and only one of them
|
|
30
|
+
* visible to everyone else who asks the question: `ActiveInjection.autoActivate`
|
|
31
|
+
* (which the boundary projects), a consumer's own `ToolProvider`, a lens
|
|
32
|
+
* drawing the graph, `warnRedundantSkillScopedTools`. Stamping the declared
|
|
33
|
+
* field keeps ONE mechanism and one answer.
|
|
34
|
+
*
|
|
35
|
+
* ── Which wins: the per-skill flag or the agent posture ──────────────────
|
|
36
|
+
* Neither overrides the other, because they cannot disagree. `autoActivate`
|
|
37
|
+
* has exactly one legal value (`'currentSkill'`), so a skill can ask to be
|
|
38
|
+
* scoped and cannot ask to be exempt. The stamp is `existing ?? 'currentSkill'`
|
|
39
|
+
* — a DEFAULT, never an override — the same sentence `skillGraph`'s
|
|
40
|
+
* `scopeTools` already lives by. The result is monotone: turning the posture
|
|
41
|
+
* on can only ever REMOVE tools from the static registry, never add one.
|
|
42
|
+
*/
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.scopeToolsToActiveSkill = void 0;
|
|
45
|
+
/** The one legal `autoActivate` mode — see `AutoActivateMode` in defineSkill. */
|
|
46
|
+
const CURRENT_SKILL = 'currentSkill';
|
|
47
|
+
/**
|
|
48
|
+
* Stamp `autoActivate: 'currentSkill'` on every skill that carries tools and
|
|
49
|
+
* has not already declared the field.
|
|
50
|
+
*
|
|
51
|
+
* Only skills WITH tools are touched: `autoActivate` says where a skill's
|
|
52
|
+
* tools appear, and a skill with none has nothing to say — stamping it would
|
|
53
|
+
* put a field on the record that decides nothing, which is exactly the kind of
|
|
54
|
+
* metadata a reader later has to disprove.
|
|
55
|
+
*
|
|
56
|
+
* Called only from `Agent.build()` and only under the opt-in, so an agent that
|
|
57
|
+
* never asks for it never runs this code.
|
|
58
|
+
*/
|
|
59
|
+
function scopeToolsToActiveSkill(injections) {
|
|
60
|
+
return injections.map((injection) => {
|
|
61
|
+
if (injection.flavor !== 'skill')
|
|
62
|
+
return injection;
|
|
63
|
+
const tools = injection.inject.tools;
|
|
64
|
+
if (!tools || tools.length === 0)
|
|
65
|
+
return injection;
|
|
66
|
+
const declared = injection.metadata?.autoActivate;
|
|
67
|
+
if (declared !== undefined)
|
|
68
|
+
return injection; // a default, never an override
|
|
69
|
+
// Frozen like `defineSkill`'s own output: the injection list handed to the
|
|
70
|
+
// Agent is read by the engine, the slots and every recorder, and a copy
|
|
71
|
+
// that is mutable where the original was not is a copy that drifts.
|
|
72
|
+
return Object.freeze({
|
|
73
|
+
...injection,
|
|
74
|
+
metadata: Object.freeze({ ...injection.metadata, autoActivate: CURRENT_SKILL }),
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
exports.scopeToolsToActiveSkill = scopeToolsToActiveSkill;
|
|
79
|
+
//# sourceMappingURL=toolsFromActiveSkill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolsFromActiveSkill.js","sourceRoot":"","sources":["../../../src/core/agent/toolsFromActiveSkill.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;;;AAIH,iFAAiF;AACjF,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,SAAgB,uBAAuB,CAAC,UAAgC;IACtE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAClC,IAAI,SAAS,CAAC,MAAM,KAAK,OAAO;YAAE,OAAO,SAAS,CAAC;QACnD,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;QACrC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACnD,MAAM,QAAQ,GAAI,SAAS,CAAC,QAAkD,EAAE,YAAY,CAAC;QAC7F,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC,CAAC,+BAA+B;QAC7E,2EAA2E;QAC3E,wEAAwE;QACxE,oEAAoE;QACpE,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,GAAG,SAAS;YACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;SAChF,CAAc,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,0DAeC"}
|
|
@@ -95,6 +95,13 @@ export declare const STAGE_IDS: {
|
|
|
95
95
|
* the SchemaRetry mechanism verbatim (an ordinary iteration, not a mode).
|
|
96
96
|
* At most once per turn; never a forced continue. */
|
|
97
97
|
readonly STEP_NUDGE: "step-nudge";
|
|
98
|
+
/** The Route decider's evidence branch (9.35.0), mounted ONLY on an agent
|
|
99
|
+
* built with `.namesAndNumbersFromEvidence({ posture: 'guard' | 'rails' })`.
|
|
100
|
+
* When a would-be-final answer states names or numbers that appear in no
|
|
101
|
+
* tool result, they are named back to the model and the loop turns once
|
|
102
|
+
* more — the SchemaRetry mechanism verbatim (an ordinary iteration, not a
|
|
103
|
+
* mode). At most once per turn. */
|
|
104
|
+
readonly EVIDENCE_RECHECK: "evidence-recheck";
|
|
98
105
|
readonly FORMAT_MERGE: "format-merge";
|
|
99
106
|
readonly MERGE_LLM: "merge-llm";
|
|
100
107
|
readonly EXTRACT_MERGE: "extract-merge";
|
package/dist/esm/conventions.js
CHANGED
|
@@ -94,6 +94,13 @@ export const STAGE_IDS = {
|
|
|
94
94
|
* the SchemaRetry mechanism verbatim (an ordinary iteration, not a mode).
|
|
95
95
|
* At most once per turn; never a forced continue. */
|
|
96
96
|
STEP_NUDGE: 'step-nudge',
|
|
97
|
+
/** The Route decider's evidence branch (9.35.0), mounted ONLY on an agent
|
|
98
|
+
* built with `.namesAndNumbersFromEvidence({ posture: 'guard' | 'rails' })`.
|
|
99
|
+
* When a would-be-final answer states names or numbers that appear in no
|
|
100
|
+
* tool result, they are named back to the model and the loop turns once
|
|
101
|
+
* more — the SchemaRetry mechanism verbatim (an ordinary iteration, not a
|
|
102
|
+
* mode). At most once per turn. */
|
|
103
|
+
EVIDENCE_RECHECK: 'evidence-recheck',
|
|
97
104
|
FORMAT_MERGE: 'format-merge',
|
|
98
105
|
MERGE_LLM: 'merge-llm',
|
|
99
106
|
EXTRACT_MERGE: 'extract-merge',
|
|
@@ -215,6 +222,9 @@ const BOUNDARY_LOCAL_IDS = new Set([
|
|
|
215
222
|
// Same reasoning for the unfinished-steps nudge (9.18.0): the run telling
|
|
216
223
|
// the model its declared procedure is not done is a stop worth reading.
|
|
217
224
|
STAGE_IDS.STEP_NUDGE,
|
|
225
|
+
// And for the evidence recheck (9.35.0): the run telling the model it made
|
|
226
|
+
// a value up is the single most interesting stop a reader can find.
|
|
227
|
+
STAGE_IDS.EVIDENCE_RECHECK,
|
|
218
228
|
]);
|
|
219
229
|
/**
|
|
220
230
|
* Classify a stage id into its {@link StageRole}. Accepts a path-qualified id
|
|
@@ -289,6 +299,10 @@ export function milestoneFor(id) {
|
|
|
289
299
|
// explaining) its procedure.
|
|
290
300
|
case STAGE_IDS.STEP_NUDGE:
|
|
291
301
|
return { kind: 'decision', label: 'Step nudge' };
|
|
302
|
+
// The answer stated values no tool result carried and the one revision
|
|
303
|
+
// went back (9.35.0) — everything after it is the model's second try.
|
|
304
|
+
case STAGE_IDS.EVIDENCE_RECHECK:
|
|
305
|
+
return { kind: 'decision', label: 'Evidence recheck' };
|
|
292
306
|
default:
|
|
293
307
|
return null;
|
|
294
308
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conventions.js","sourceRoot":"","sources":["../../src/conventions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,gEAAgE;AAChE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;0EACsE;IACtE,gBAAgB,EAAE,qBAAqB;IACvC;;qDAEiD;IACjD,QAAQ,EAAE,aAAa;IACvB,+DAA+D;IAC/D,aAAa,EAAE,kBAAkB;IACjC,6BAA6B;IAC7B,QAAQ,EAAE,aAAa;IACvB,0BAA0B;IAC1B,KAAK,EAAE,UAAU;IACjB,2CAA2C;IAC3C,KAAK,EAAE,UAAU;IACjB,uDAAuD;IACvD,UAAU,EAAE,eAAe;IAC3B,kCAAkC;IAClC,KAAK,EAAE,UAAU;IACjB;;;;oCAIgC;IAChC,KAAK,EAAE,OAAO;IACd;;;;;;gCAM4B;IAC5B,KAAK,EAAE,UAAU;IACjB;;;wDAGoD;IACpD,cAAc,EAAE,mBAAmB;IACnC;;;;;iCAK6B;IAC7B,QAAQ,EAAE,aAAa;CACf,CAAC;AAIX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ;;oFAEgF;IAChF,UAAU,EAAE,YAAY;IACxB;;;;;0EAKsE;IACtE,OAAO,EAAE,SAAS;IAClB;;;yDAGqD;IACrD,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB;;;8DAG0D;IAC1D,aAAa,EAAE,eAAe;IAC9B,KAAK,EAAE,OAAO;IACd;;0EAEsE;IACtE,YAAY,EAAE,cAAc;IAC5B;;;;0DAIsD;IACtD,UAAU,EAAE,YAAY;IACxB,YAA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AE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QACnD,uEAAuE;QACvE,sEAAsE;QACtE,KAAK,SAAS,CAAC,gBAAgB;YAC7B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QACzD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa,EAAE,wBAAwB;IACvC,QAAQ,EAAE,oBAAoB;IAC9B,KAAK,EAAE,iBAAiB;CAChB,CAAC;AAIX,6CAA6C;AAC7C,MAAM,UAAU,mBAAmB,CAAC,IAA4C;IAC9E,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,eAAe;YAClB,OAAO,cAAc,CAAC,aAAa,CAAC;QACtC,KAAK,UAAU;YACb,OAAO,cAAc,CAAC,QAAQ,CAAC;QACjC,KAAK,OAAO;YACV,OAAO,cAAc,CAAC,KAAK,CAAC;IAChC,CAAC;AACH,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAQ,MAAM,CAAC,MAAM,CAAC,cAAc,CAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/esm/core/Agent.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { type CheckInBuilderOptions } from './checkin.js';
|
|
|
23
23
|
import type { MemoryDefinition } from '../memory/define.types.js';
|
|
24
24
|
import type { MemoryIdentity } from '../memory/identity/types.js';
|
|
25
25
|
import type { SelfExplainBinding } from '../lib/trace-toolpack/selfExplain.js';
|
|
26
|
+
import type { ResolvedEvidenceGate } from './agent/evidence/types.js';
|
|
26
27
|
import type { Injection, InjectionContext } from '../lib/injection-engine/types.js';
|
|
27
28
|
import type { CursorMove, EntryScoring, TurnRoutingPlan } from '../lib/injection-engine/skillGraph.js';
|
|
28
29
|
import { type ResolvedOutputFallback } from './outputFallback.js';
|
|
@@ -173,6 +174,13 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
173
174
|
* validated at `AgentBuilder.build()`. Undefined = no brain anywhere:
|
|
174
175
|
* callLLM, the gate, seed and RouteTurn wire nothing new. */
|
|
175
176
|
private readonly skillBrains?;
|
|
177
|
+
/**
|
|
178
|
+
* The evidence gate (9.35.0) — `.namesAndNumbersFromEvidence()`, resolved by
|
|
179
|
+
* the builder. Undefined for every agent that did not ask for it, and that
|
|
180
|
+
* undefined is the whole zero-cost guarantee: no decider change, no branch,
|
|
181
|
+
* no scope key, no event.
|
|
182
|
+
*/
|
|
183
|
+
private readonly evidenceGate?;
|
|
176
184
|
private readonly skillGraphCascade?;
|
|
177
185
|
/** Side channel for the conversation's inherited skill cursor (SG-C) —
|
|
178
186
|
* stashed by `applyContinuation`, consumed-and-cleared by seed. */
|
|
@@ -393,7 +401,7 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
393
401
|
readonly strictness: 'assist' | 'guard' | 'rails';
|
|
394
402
|
readonly continuity: 'turn' | 'conversation';
|
|
395
403
|
readonly nodeIds: ReadonlySet<string>;
|
|
396
|
-
}, skillBrains?: import('./agent/skillBrains.js').FoldedSkillBrains);
|
|
404
|
+
}, skillBrains?: import('./agent/skillBrains.js').FoldedSkillBrains, evidenceGate?: ResolvedEvidenceGate);
|
|
397
405
|
static create(opts: AgentOptions): AgentBuilder;
|
|
398
406
|
/**
|
|
399
407
|
* Cache policy for the base system prompt. Read by the CacheDecision
|
|
@@ -1126,6 +1134,31 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
1126
1134
|
* ```
|
|
1127
1135
|
*/
|
|
1128
1136
|
outputContractUnmet(): AgentState['outputContractUnmet'];
|
|
1137
|
+
/**
|
|
1138
|
+
* Did the last turn's answer state names or numbers that appear in NO tool
|
|
1139
|
+
* result (9.35.0)?
|
|
1140
|
+
*
|
|
1141
|
+
* `undefined` when every value was grounded — and on any agent without
|
|
1142
|
+
* `.namesAndNumbersFromEvidence()`. Set on a turn that shipped flagged
|
|
1143
|
+
* (`'assist'` / `'guard'`) and on one that was refused (`'rails'`, where
|
|
1144
|
+
* `run()` also raised `UnsupportedValuesError`, so this is what a caller
|
|
1145
|
+
* reads in the `catch`).
|
|
1146
|
+
*
|
|
1147
|
+
* `revised: true` means the model was asked once to correct the values and
|
|
1148
|
+
* they survived that turn — the fact worth alerting on, because it is a
|
|
1149
|
+
* model that cannot ground its own claims rather than one that slipped.
|
|
1150
|
+
*
|
|
1151
|
+
* Remember what the verdict does NOT say: values were invented. It cannot
|
|
1152
|
+
* tell you whether a claim built from real values is true.
|
|
1153
|
+
*
|
|
1154
|
+
* @example
|
|
1155
|
+
* ```ts
|
|
1156
|
+
* const answer = await agent.run({ message: 'which port is down?' });
|
|
1157
|
+
* const bad = agent.unsupportedValues();
|
|
1158
|
+
* if (bad) log.warn({ values: bad.values.map((v) => v.value), revised: bad.revised });
|
|
1159
|
+
* ```
|
|
1160
|
+
*/
|
|
1161
|
+
unsupportedValues(): AgentState['unsupportedValues'];
|
|
1129
1162
|
private finalizeResult;
|
|
1130
1163
|
private buildChart;
|
|
1131
1164
|
}
|
package/dist/esm/core/Agent.js
CHANGED
|
@@ -74,6 +74,9 @@ import { isDevMode } from 'footprintjs';
|
|
|
74
74
|
import { buildReadSkillTool } from '../lib/injection-engine/skillTools.js';
|
|
75
75
|
import { foldStepPlans } from '../lib/injection-engine/skillSteps.js';
|
|
76
76
|
import { buildStepNudgeStage } from './agent/stages/stepNudge.js';
|
|
77
|
+
import { buildEvidenceRecheckStage } from './agent/stages/evidenceRecheck.js';
|
|
78
|
+
import { evidenceRefusalSentence } from './agent/evidence/gate.js';
|
|
79
|
+
import { UnsupportedValuesError } from './agent/evidence/errors.js';
|
|
77
80
|
import { checkerGoverns } from '../adapters/types.js';
|
|
78
81
|
import { skillTarget } from '../security/skillTarget.js';
|
|
79
82
|
import { buildInjectionEngineSubflow } from '../lib/injection-engine/buildInjectionEngineSubflow.js';
|
|
@@ -180,6 +183,13 @@ export class Agent extends RunnerBase {
|
|
|
180
183
|
* validated at `AgentBuilder.build()`. Undefined = no brain anywhere:
|
|
181
184
|
* callLLM, the gate, seed and RouteTurn wire nothing new. */
|
|
182
185
|
skillBrains;
|
|
186
|
+
/**
|
|
187
|
+
* The evidence gate (9.35.0) — `.namesAndNumbersFromEvidence()`, resolved by
|
|
188
|
+
* the builder. Undefined for every agent that did not ask for it, and that
|
|
189
|
+
* undefined is the whole zero-cost guarantee: no decider change, no branch,
|
|
190
|
+
* no scope key, no event.
|
|
191
|
+
*/
|
|
192
|
+
evidenceGate;
|
|
183
193
|
skillGraphCascade;
|
|
184
194
|
/** Side channel for the conversation's inherited skill cursor (SG-C) —
|
|
185
195
|
* stashed by `applyContinuation`, consumed-and-cleared by seed. */
|
|
@@ -405,7 +415,7 @@ export class Agent extends RunnerBase {
|
|
|
405
415
|
* sf-llm-call subflow for richer Lens grouping). Set from `opts.reactMode`.
|
|
406
416
|
* See AgentOptions. */
|
|
407
417
|
reactMode;
|
|
408
|
-
constructor(opts, systemPromptValue, registry, voice, injections = [], memories = [], outputSchemaParser, toolProvider, systemPromptCachePolicy = 'always', cachingDisabled = false, cacheStrategy, outputFallbackCfg, reliabilityConfig, thinkingHandlerValue, thinkingBudgetValue, skillGraphNextSkill, skillGraphReachable, skillGraphScoreEntries, checkInOptions, runConfigFn, windowStrategy, toolMiddleware, messageMiddleware, outputEnforcement, skillGraphEdgeTargets, skillGraphExplainNextSkill, skillGraphIsTree, skillGraphSupersededEntries, skillGraphCascade, skillBrains) {
|
|
418
|
+
constructor(opts, systemPromptValue, registry, voice, injections = [], memories = [], outputSchemaParser, toolProvider, systemPromptCachePolicy = 'always', cachingDisabled = false, cacheStrategy, outputFallbackCfg, reliabilityConfig, thinkingHandlerValue, thinkingBudgetValue, skillGraphNextSkill, skillGraphReachable, skillGraphScoreEntries, checkInOptions, runConfigFn, windowStrategy, toolMiddleware, messageMiddleware, outputEnforcement, skillGraphEdgeTargets, skillGraphExplainNextSkill, skillGraphIsTree, skillGraphSupersededEntries, skillGraphCascade, skillBrains, evidenceGate) {
|
|
409
419
|
super();
|
|
410
420
|
this.provider = opts.provider;
|
|
411
421
|
this.name = opts.name ?? 'Agent';
|
|
@@ -436,6 +446,7 @@ export class Agent extends RunnerBase {
|
|
|
436
446
|
this.skillGraphIsTree = skillGraphIsTree ?? false;
|
|
437
447
|
this.skillGraphCascade = skillGraphCascade;
|
|
438
448
|
this.skillBrains = skillBrains;
|
|
449
|
+
this.evidenceGate = evidenceGate;
|
|
439
450
|
this.memories = memories;
|
|
440
451
|
this.outputSchemaParser = outputSchemaParser;
|
|
441
452
|
this.outputEnforcement = outputEnforcement;
|
|
@@ -1082,7 +1093,14 @@ export class Agent extends RunnerBase {
|
|
|
1082
1093
|
// checkpoint would hand the caller a retry handle for a wall, and
|
|
1083
1094
|
// would bury the `authorizationUrl` one `.cause` deep where the
|
|
1084
1095
|
// person who has to click it will not look.
|
|
1085
|
-
cause instanceof CredentialConsentRequiredError
|
|
1096
|
+
cause instanceof CredentialConsentRequiredError ||
|
|
1097
|
+
// 9.35.0 — an evidence refusal is a VERDICT, not a crash: the run
|
|
1098
|
+
// finished, the loop already spent its one revision, and resuming
|
|
1099
|
+
// would put the same model in front of the same evidence. Wrapping
|
|
1100
|
+
// it would hand the caller a retry handle for a wall and bury the
|
|
1101
|
+
// named values one `.cause` deep, where the person deciding what to
|
|
1102
|
+
// do about them will not look.
|
|
1103
|
+
cause instanceof UnsupportedValuesError);
|
|
1086
1104
|
if (cause instanceof Error && !isTerminalTypedError && tracker.history.length > 0) {
|
|
1087
1105
|
// Observation beats the heuristic: if a bracket was open, it says
|
|
1088
1106
|
// exactly what the run was doing. `classifyFailurePhase` only decides
|
|
@@ -2229,6 +2247,34 @@ export class Agent extends RunnerBase {
|
|
|
2229
2247
|
const state = this.getLastSnapshot()?.sharedState;
|
|
2230
2248
|
return state?.outputContractUnmet;
|
|
2231
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Did the last turn's answer state names or numbers that appear in NO tool
|
|
2252
|
+
* result (9.35.0)?
|
|
2253
|
+
*
|
|
2254
|
+
* `undefined` when every value was grounded — and on any agent without
|
|
2255
|
+
* `.namesAndNumbersFromEvidence()`. Set on a turn that shipped flagged
|
|
2256
|
+
* (`'assist'` / `'guard'`) and on one that was refused (`'rails'`, where
|
|
2257
|
+
* `run()` also raised `UnsupportedValuesError`, so this is what a caller
|
|
2258
|
+
* reads in the `catch`).
|
|
2259
|
+
*
|
|
2260
|
+
* `revised: true` means the model was asked once to correct the values and
|
|
2261
|
+
* they survived that turn — the fact worth alerting on, because it is a
|
|
2262
|
+
* model that cannot ground its own claims rather than one that slipped.
|
|
2263
|
+
*
|
|
2264
|
+
* Remember what the verdict does NOT say: values were invented. It cannot
|
|
2265
|
+
* tell you whether a claim built from real values is true.
|
|
2266
|
+
*
|
|
2267
|
+
* @example
|
|
2268
|
+
* ```ts
|
|
2269
|
+
* const answer = await agent.run({ message: 'which port is down?' });
|
|
2270
|
+
* const bad = agent.unsupportedValues();
|
|
2271
|
+
* if (bad) log.warn({ values: bad.values.map((v) => v.value), revised: bad.revised });
|
|
2272
|
+
* ```
|
|
2273
|
+
*/
|
|
2274
|
+
unsupportedValues() {
|
|
2275
|
+
const state = this.getLastSnapshot()?.sharedState;
|
|
2276
|
+
return state?.unsupportedValues;
|
|
2277
|
+
}
|
|
2232
2278
|
finalizeResult(executor, result) {
|
|
2233
2279
|
const paused = this.detectPause(executor, result);
|
|
2234
2280
|
if (paused)
|
|
@@ -2315,6 +2361,25 @@ export class Agent extends RunnerBase {
|
|
|
2315
2361
|
});
|
|
2316
2362
|
}
|
|
2317
2363
|
}
|
|
2364
|
+
// Evidence refusal (9.35.0, `posture: 'rails'` only) — the final answer
|
|
2365
|
+
// still states values that appear in no tool result, after the one
|
|
2366
|
+
// revision the posture allows. Surfaced the way a denied message is, and
|
|
2367
|
+
// for the same reason: `rails` was chosen precisely so an answer carrying
|
|
2368
|
+
// invented identifiers cannot reach the caller as a string they are free
|
|
2369
|
+
// to ignore. `'assist'` and `'guard'` never reach here — their verdict is
|
|
2370
|
+
// committed state and an event, and `run()` returns the answer.
|
|
2371
|
+
if (this.evidenceGate?.posture === 'rails') {
|
|
2372
|
+
const state = executor.getSnapshot().sharedState;
|
|
2373
|
+
const verdict = state.unsupportedValues;
|
|
2374
|
+
if (verdict !== undefined && verdict.refused) {
|
|
2375
|
+
throw new UnsupportedValuesError({
|
|
2376
|
+
values: verdict.values,
|
|
2377
|
+
candidates: verdict.candidates,
|
|
2378
|
+
revised: verdict.revised,
|
|
2379
|
+
message: evidenceRefusalSentence(verdict.values, 'rails', verdict.revised),
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2318
2383
|
// Credential-consent translation (8.6.0, `'tell-model'` only) — a tool
|
|
2319
2384
|
// DECLARED a credential, the provider answered `authorization-required`,
|
|
2320
2385
|
// and the model was told to route around it. The run reached the end
|
|
@@ -2423,6 +2488,10 @@ export class Agent extends RunnerBase {
|
|
|
2423
2488
|
// Escalation (9.19.0): same gate discipline — the per-run counter/flip
|
|
2424
2489
|
// reset exists only when the policy does (de-escalation IS the seed).
|
|
2425
2490
|
...(this.skillBrains?.escalation !== undefined && { hasEscalation: true }),
|
|
2491
|
+
// The evidence gate's one bounded revision (9.35.0) — a per-turn budget,
|
|
2492
|
+
// reset here. Only a posture that can revise writes the key.
|
|
2493
|
+
...(this.evidenceGate !== undefined &&
|
|
2494
|
+
this.evidenceGate.posture !== 'assist' && { hasEvidenceRevision: true }),
|
|
2426
2495
|
getCurrentRunId: () => this.currentRunContext?.runId,
|
|
2427
2496
|
// WHO this run is for, when the caller named nobody (9.10.0). Seed uses
|
|
2428
2497
|
// it for exactly one rung of the identity ladder — see `seedFrom` — and
|
|
@@ -2665,7 +2734,11 @@ export class Agent extends RunnerBase {
|
|
|
2665
2734
|
// active step procedure (nudge once / accept / cut-short) when a stepped
|
|
2666
2735
|
// skill is registered. Without steps this is the same function reference
|
|
2667
2736
|
// the chart has always been handed.
|
|
2668
|
-
|
|
2737
|
+
// 9.35.0 — and the decider grounds the would-be-final answer in the
|
|
2738
|
+
// turn's own tool results when `.namesAndNumbersFromEvidence()` is
|
|
2739
|
+
// configured. Without it this is the same function reference the chart
|
|
2740
|
+
// has always been handed.
|
|
2741
|
+
const routeDecider = buildRouteDeciderStage(this.messageMiddleware, this.outputEnforcement, stepPlanFor, this.evidenceGate);
|
|
2669
2742
|
// toolCallsHandler extracted to ./agent/stages/toolCalls.ts (v2.11.2).
|
|
2670
2743
|
const toolCallsHandler = buildToolCallsHandler({
|
|
2671
2744
|
registryByName,
|
|
@@ -2800,6 +2873,17 @@ export class Agent extends RunnerBase {
|
|
|
2800
2873
|
hasSteps: true,
|
|
2801
2874
|
stepNudgeStage: buildStepNudgeStage(stepPlanFor),
|
|
2802
2875
|
}),
|
|
2876
|
+
// The evidence gate (9.35.0). `hasEvidenceGate` rides ANY posture (the
|
|
2877
|
+
// grouped chart needs the system-prompt records bubbled out to exempt
|
|
2878
|
+
// what the app itself supplied); the BRANCH is mounted only for a
|
|
2879
|
+
// posture that can revise — `'assist'` records and never loops, so it
|
|
2880
|
+
// gets no branch and no stage, the same conditional-mount law as above.
|
|
2881
|
+
...(this.evidenceGate !== undefined && {
|
|
2882
|
+
hasEvidenceGate: true,
|
|
2883
|
+
...(this.evidenceGate.posture !== 'assist' && {
|
|
2884
|
+
evidenceRecheckStage: buildEvidenceRecheckStage(this.evidenceGate),
|
|
2885
|
+
}),
|
|
2886
|
+
}),
|
|
2803
2887
|
// Escalation (9.19.0): the grouped chart threads `skillEscalated`
|
|
2804
2888
|
// across the sf-llm-call boundary only when the policy exists.
|
|
2805
2889
|
...(this.skillBrains?.escalation !== undefined && { hasEscalation: true }),
|