agentfootprint 9.17.0 → 9.18.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 +1 -1
- package/README.md +19 -0
- 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 +31 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +107 -0
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +26 -0
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +32 -0
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/buildToolRegistry.js +23 -0
- package/dist/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/core/agent/stages/route.js +130 -4
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/seed.js +11 -0
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/stepNudge.js +82 -0
- package/dist/core/agent/stages/stepNudge.js.map +1 -0
- package/dist/core/agent/stages/toolCalls.js +178 -5
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +106 -7
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/conventions.d.ts +6 -0
- package/dist/esm/conventions.js +14 -0
- package/dist/esm/conventions.js.map +1 -1
- package/dist/esm/core/Agent.js +31 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.js +107 -0
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +22 -0
- package/dist/esm/core/agent/buildAgentChart.js +26 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +32 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildToolRegistry.js +23 -0
- package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
- package/dist/esm/core/agent/stages/route.d.ts +3 -2
- package/dist/esm/core/agent/stages/route.js +130 -4
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.d.ts +7 -0
- package/dist/esm/core/agent/stages/seed.js +11 -0
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/stepNudge.d.ts +29 -0
- package/dist/esm/core/agent/stages/stepNudge.js +78 -0
- package/dist/esm/core/agent/stages/stepNudge.js.map +1 -0
- package/dist/esm/core/agent/stages/toolCalls.d.ts +24 -0
- package/dist/esm/core/agent/stages/toolCalls.js +178 -5
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +19 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +22 -0
- package/dist/esm/core/slots/buildToolsSlot.js +106 -7
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +60 -2
- package/dist/esm/events/registry.d.ts +7 -1
- package/dist/esm/events/registry.js +6 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.d.ts +10 -0
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +31 -5
- package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineSkill.d.ts +34 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js +17 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineStepsHint.d.ts +39 -0
- package/dist/esm/lib/injection-engine/factories/defineStepsHint.js +51 -0
- package/dist/esm/lib/injection-engine/factories/defineStepsHint.js.map +1 -0
- package/dist/esm/lib/injection-engine/index.d.ts +2 -0
- package/dist/esm/lib/injection-engine/index.js +7 -0
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillSteps.d.ts +185 -0
- package/dist/esm/lib/injection-engine/skillSteps.js +276 -0
- package/dist/esm/lib/injection-engine/skillSteps.js.map +1 -0
- package/dist/esm/lib/injection-engine/types.d.ts +17 -2
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +16 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +193 -8
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/events/registry.js +6 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +31 -5
- package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineSkill.js +17 -0
- package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineStepsHint.js +55 -0
- package/dist/lib/injection-engine/factories/defineStepsHint.js.map +1 -0
- package/dist/lib/injection-engine/index.js +13 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillSteps.js +297 -0
- package/dist/lib/injection-engine/skillSteps.js.map +1 -0
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js +16 -1
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/recorders/observability/commentary/commentaryTemplates.js +193 -8
- package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/types/conventions.d.ts +6 -0
- package/dist/types/conventions.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +22 -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/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 +7 -0
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/stepNudge.d.ts +30 -0
- package/dist/types/core/agent/stages/stepNudge.d.ts.map +1 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts +24 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +19 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +22 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +60 -2
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +7 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts +10 -0
- package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +34 -0
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineStepsHint.d.ts +40 -0
- package/dist/types/lib/injection-engine/factories/defineStepsHint.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/index.d.ts +2 -0
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillSteps.d.ts +186 -0
- package/dist/types/lib/injection-engine/skillSteps.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/types.d.ts +17 -2
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAiH1D;;;GAGG;AACH,SAAS,cAAc,CAAC,OAA8B;IACpD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,OAAO,IAAI,OAAO;QAAE,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;YAAE,KAAK,EAAE,CAAC;IACpE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,gBAAgB,CAC7B,KAA6B,EAC7B,MAA8B;IAE9B,KAAK,CAAC,UAAU,GAAG,MAAM,iBAAiB,CAAC;QACzC,MAAM;QACN,QAAQ,EAAE,KAAK,CAAC,WAAW;QAC3B,QAAQ,EAAE,KAA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AAK,IAAI,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,GAAG,EAAE,CAAC;QACvB,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,uEAAuE;IACvE,qEAAqE;IACrE,uEAAuE;IACvE,oEAAoE;IACpE,6CAA6C;IAC7C,EAAE;IACF,wEAAwE;IACxE,uEAAuE;IACvE,uCAAuC;IACvC,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC;QACxE,IAAI,QAAQ,EAAE,YAAY,KAAK,SAAS;YAAE,KAAK,CAAC,oBAAoB,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC/F,CAAC;IAED,SAAS,CAAC,KAAK,EAAE,iCAAiC,EAAE;QAClD,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,OAAO;KACpB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* stepNudge — the branch that asks once when a final answer left declared
|
|
3
|
+
* steps unrun (9.18.0).
|
|
4
|
+
*
|
|
5
|
+
* Mounted as a branch of the Route decider, and only on an agent with ≥1
|
|
6
|
+
* STEPPED skill. It carries `{ loopTo }` to the same target the
|
|
7
|
+
* `tool-calls` branch loops to — the SchemaRetry mechanism verbatim: a
|
|
8
|
+
* nudge is not a special mode, it is one more ordinary turn of the ReAct
|
|
9
|
+
* loop, with its own `iteration_start` / `llm_start` bracket and its own
|
|
10
|
+
* `cost.tick` against `costBudget`.
|
|
11
|
+
*
|
|
12
|
+
* What it appends is the conversation as it really went: the premature
|
|
13
|
+
* answer as the assistant turn, then a `role: 'user'` teaching message
|
|
14
|
+
* naming every unrun step and its note — "finish them, or say why you are
|
|
15
|
+
* stopping". At most once per turn (`stepNudgeSpent`); the model stopping
|
|
16
|
+
* AGAIN is honored (`steps_unfinished { action: 'accepted' }`, judged by
|
|
17
|
+
* the decider) — a procedure is a declared order, never a forced march.
|
|
18
|
+
*
|
|
19
|
+
* Pure function apart from its plan closure — no Agent class state.
|
|
20
|
+
*/
|
|
21
|
+
import type { TypedScope } from 'footprintjs';
|
|
22
|
+
import { type StepPlanFor } from '../../../lib/injection-engine/skillSteps.js';
|
|
23
|
+
import type { AgentState } from '../types.js';
|
|
24
|
+
/**
|
|
25
|
+
* Build the nudge stage. The decider already judged the table (steps
|
|
26
|
+
* remain, no limit fired, nudge unspent) before routing here — this stage
|
|
27
|
+
* does the work of asking.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildStepNudgeStage(stepPlanFor: StepPlanFor): (scope: TypedScope<AgentState>) => void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* stepNudge — the branch that asks once when a final answer left declared
|
|
3
|
+
* steps unrun (9.18.0).
|
|
4
|
+
*
|
|
5
|
+
* Mounted as a branch of the Route decider, and only on an agent with ≥1
|
|
6
|
+
* STEPPED skill. It carries `{ loopTo }` to the same target the
|
|
7
|
+
* `tool-calls` branch loops to — the SchemaRetry mechanism verbatim: a
|
|
8
|
+
* nudge is not a special mode, it is one more ordinary turn of the ReAct
|
|
9
|
+
* loop, with its own `iteration_start` / `llm_start` bracket and its own
|
|
10
|
+
* `cost.tick` against `costBudget`.
|
|
11
|
+
*
|
|
12
|
+
* What it appends is the conversation as it really went: the premature
|
|
13
|
+
* answer as the assistant turn, then a `role: 'user'` teaching message
|
|
14
|
+
* naming every unrun step and its note — "finish them, or say why you are
|
|
15
|
+
* stopping". At most once per turn (`stepNudgeSpent`); the model stopping
|
|
16
|
+
* AGAIN is honored (`steps_unfinished { action: 'accepted' }`, judged by
|
|
17
|
+
* the decider) — a procedure is a declared order, never a forced march.
|
|
18
|
+
*
|
|
19
|
+
* Pure function apart from its plan closure — no Agent class state.
|
|
20
|
+
*/
|
|
21
|
+
import { typedEmit } from '../../../recorders/core/typedEmit.js';
|
|
22
|
+
import { nudgeTeachingMessage, pointerOf, remainingStepsOf, stepInProgress, } from '../../../lib/injection-engine/skillSteps.js';
|
|
23
|
+
/**
|
|
24
|
+
* Build the nudge stage. The decider already judged the table (steps
|
|
25
|
+
* remain, no limit fired, nudge unspent) before routing here — this stage
|
|
26
|
+
* does the work of asking.
|
|
27
|
+
*/
|
|
28
|
+
export function buildStepNudgeStage(stepPlanFor) {
|
|
29
|
+
return (scope) => {
|
|
30
|
+
const ptr = pointerOf(scope.stepPointer);
|
|
31
|
+
const plan = stepInProgress(ptr) ? stepPlanFor(ptr.skillId) : undefined;
|
|
32
|
+
if (!ptr || !plan) {
|
|
33
|
+
// Unreachable through the decider, which judges the pointer
|
|
34
|
+
// immediately before routing here. Returning quietly rather than
|
|
35
|
+
// throwing keeps a hand-built chart that mounts this branch without
|
|
36
|
+
// the decider from taking down a run (the SchemaRetry discipline).
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const iteration = scope.iteration;
|
|
40
|
+
const prematureAnswer = scope.llmLatestContent;
|
|
41
|
+
const teaching = nudgeTeachingMessage(ptr, plan);
|
|
42
|
+
// The conversation, as it really went: the answer that stopped early,
|
|
43
|
+
// then the teaching ask. A plain local array — a TypedScope array read
|
|
44
|
+
// is a live proxy view, and both the commit and the event payload below
|
|
45
|
+
// must be detached plain data.
|
|
46
|
+
const newHistory = [
|
|
47
|
+
...scope.history,
|
|
48
|
+
{ role: 'assistant', content: prematureAnswer },
|
|
49
|
+
{ role: 'user', content: teaching },
|
|
50
|
+
];
|
|
51
|
+
scope.history = newHistory;
|
|
52
|
+
// The one-per-turn latch. Spent BEFORE the loop turns, so a second
|
|
53
|
+
// premature stop is accepted rather than re-nudged — never a forced
|
|
54
|
+
// continue.
|
|
55
|
+
scope.stepNudgeSpent = true;
|
|
56
|
+
typedEmit(scope, 'agentfootprint.skill.steps_unfinished', {
|
|
57
|
+
skillId: ptr.skillId,
|
|
58
|
+
remaining: remainingStepsOf(ptr, plan),
|
|
59
|
+
total: ptr.total,
|
|
60
|
+
action: 'nudged',
|
|
61
|
+
iteration,
|
|
62
|
+
});
|
|
63
|
+
// Close this iteration's bracket before the loop turns — every recorder
|
|
64
|
+
// that synthesizes steps pairs `iteration_start`/`iteration_end` per
|
|
65
|
+
// `iterIndex`, and the crash-checkpoint tracker snapshots history from
|
|
66
|
+
// this payload (the SchemaRetry stage's reasoning, verbatim).
|
|
67
|
+
typedEmit(scope, 'agentfootprint.agent.iteration_end', {
|
|
68
|
+
turnIndex: 0,
|
|
69
|
+
iterIndex: iteration,
|
|
70
|
+
toolCallCount: 0,
|
|
71
|
+
history: newHistory,
|
|
72
|
+
});
|
|
73
|
+
// A nudge consumes an iteration, exactly as a tool call does — one more
|
|
74
|
+
// real turn against the agent's declared budget.
|
|
75
|
+
scope.iteration = iteration + 1;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=stepNudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepNudge.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/stepNudge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,cAAc,GAEf,MAAM,6CAA6C,CAAC;AAGrD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAwB;IAExB,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS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,CAAC;AACJ,CAAC"}
|
|
@@ -54,6 +54,7 @@ import type { MemoryIdentity } from '../../../memory/identity/types.js';
|
|
|
54
54
|
import type { ToolSessionTier } from '../../toolSessions.js';
|
|
55
55
|
import type { ToolMiddleware } from '../middleware/types.js';
|
|
56
56
|
import { type ToolArgValidationMode } from '../toolArgsValidation.js';
|
|
57
|
+
import { type StepPlanFor } from '../../../lib/injection-engine/skillSteps.js';
|
|
57
58
|
import type { AgentState } from '../types.js';
|
|
58
59
|
export interface ToolCallsHandlerDeps {
|
|
59
60
|
/** Map from tool name → Tool instance, built from the augmented
|
|
@@ -120,6 +121,29 @@ export interface ToolCallsHandlerDeps {
|
|
|
120
121
|
* why the graph cannot be jumped at all, so the model stops asking and answers.
|
|
121
122
|
*/
|
|
122
123
|
readonly skillGraphIsTree?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The frozen step plans, keyed by skill id (9.18.0) — set only when ≥1
|
|
126
|
+
* registered skill declares `steps`. This stage owns the pointer's two
|
|
127
|
+
* RESULT-BOUNDARY moves, applied at EVERY site a result becomes final and
|
|
128
|
+
* is pushed (the batch loop AND all the pausable resume paths — a step
|
|
129
|
+
* whose tool paused, an `askHuman` step first among them, must advance on
|
|
130
|
+
* the resumed call exactly as it would have inline):
|
|
131
|
+
*
|
|
132
|
+
* • ADVANCE — the finalized call is the current step's tool, ran, and
|
|
133
|
+
* was not an error/denial/refusal → pointer + 1, `step_advanced`, and
|
|
134
|
+
* the model-visible result gains the "now on step k+1" suffix
|
|
135
|
+
* (composed BEFORE the history push — one past, no splicing).
|
|
136
|
+
* • SKIP — a `skip_step` call: reason validated (empty → teaching
|
|
137
|
+
* result, no event), `step_skipped` emitted, pointer moved or held
|
|
138
|
+
* per the skill's declared `onSkip`, and the model-visible result is
|
|
139
|
+
* OVERWRITTEN with the authoritative sentence (the read_skill-refusal
|
|
140
|
+
* precedent — bookkeeping lives where the batch order lives).
|
|
141
|
+
*
|
|
142
|
+
* Postures never gate `skip_step`: skipping is judgment INSIDE a step,
|
|
143
|
+
* not routing. Undefined → no stepped skill anywhere; not one new line
|
|
144
|
+
* runs (zero-cost-when-unused).
|
|
145
|
+
*/
|
|
146
|
+
readonly stepPlanFor?: StepPlanFor;
|
|
123
147
|
/**
|
|
124
148
|
* The mount's routing POSTURE beyond reachability (SG-C `strictness`).
|
|
125
149
|
* Undefined = `'assist'` = today's gate, byte-for-byte — not one new line
|
|
@@ -56,6 +56,7 @@ import { recordDecisions } from '../middleware/ledger.js';
|
|
|
56
56
|
import { formatToolArgIssues, validateToolArgs, } from '../toolArgsValidation.js';
|
|
57
57
|
import { safeStringify } from '../validators.js';
|
|
58
58
|
import { capToolResult } from '../toolResultCap.js';
|
|
59
|
+
import { currentStepOf, pointerOf, readSkillStepIntro, skipAdvanceSentence, skipHoldSentence, skipNeedsReasonSentence, skipNothingActiveSentence, stepAdvanceSuffix, stepInProgress, SKIP_STEP_TOOL_NAME, } from '../../../lib/injection-engine/skillSteps.js';
|
|
59
60
|
/** Declaration order preserved, ids de-duplicated — the shape the gate's re-prompt
|
|
60
61
|
* and the `skill.rejected` payload both report as "what this gate accepts". */
|
|
61
62
|
function dedupeIds(ids) {
|
|
@@ -249,6 +250,104 @@ export function buildToolCallsHandler(deps) {
|
|
|
249
250
|
: capToolResult(values.modelResult, { toolName, maxChars: max }).value,
|
|
250
251
|
};
|
|
251
252
|
};
|
|
253
|
+
// ── Step-procedure boundary (9.18.0) — ONE implementation, five sites ──
|
|
254
|
+
// The batch loop and the four resume paths all finalize results; each
|
|
255
|
+
// calls these where its result becomes final, so a pointer can never miss
|
|
256
|
+
// a move because of which door the result came through (the resume-path
|
|
257
|
+
// law: the checkpoint carries the pointer for free in sharedState, and
|
|
258
|
+
// the answered call advances it HERE on resume).
|
|
259
|
+
/** The in-progress procedure, when there is one: pointer + plan + the
|
|
260
|
+
* current step. Undefined on every agent without steps, between tenures,
|
|
261
|
+
* and once a procedure completed. */
|
|
262
|
+
const stepStateOf = (scope) => {
|
|
263
|
+
if (!deps.stepPlanFor)
|
|
264
|
+
return undefined;
|
|
265
|
+
const ptr = pointerOf(scope.stepPointer);
|
|
266
|
+
if (!stepInProgress(ptr))
|
|
267
|
+
return undefined;
|
|
268
|
+
const plan = deps.stepPlanFor(ptr.skillId);
|
|
269
|
+
if (!plan)
|
|
270
|
+
return undefined;
|
|
271
|
+
const step = currentStepOf(ptr, plan);
|
|
272
|
+
return step ? { ptr, plan, step } : undefined;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* `skip_step` bookkeeping — returns the AUTHORITATIVE result that
|
|
276
|
+
* replaces the tool's placeholder (both channels, the read_skill-refusal
|
|
277
|
+
* precedent). Emits `step_skipped` and moves/holds the pointer per the
|
|
278
|
+
* declared policy; a teaching answer (no active procedure / empty
|
|
279
|
+
* reason) emits nothing.
|
|
280
|
+
*/
|
|
281
|
+
const applySkipStep = (scope, call) => {
|
|
282
|
+
const state = stepStateOf(scope);
|
|
283
|
+
if (!state)
|
|
284
|
+
return skipNothingActiveSentence();
|
|
285
|
+
const raw = call.args.reason;
|
|
286
|
+
const reason = typeof raw === 'string' ? raw.trim() : '';
|
|
287
|
+
if (reason.length === 0)
|
|
288
|
+
return skipNeedsReasonSentence();
|
|
289
|
+
const { ptr, plan, step } = state;
|
|
290
|
+
typedEmit(scope, 'agentfootprint.skill.step_skipped', {
|
|
291
|
+
skillId: ptr.skillId,
|
|
292
|
+
step: { index: ptr.step, total: ptr.total, tool: step.tool, note: step.note },
|
|
293
|
+
reason,
|
|
294
|
+
policy: plan.onSkip,
|
|
295
|
+
iteration: call.iteration,
|
|
296
|
+
toolCallId: call.toolCallId,
|
|
297
|
+
});
|
|
298
|
+
// 'hold': recorded and held — the step stays the offer; repeated skips
|
|
299
|
+
// of a held step are each recorded, because each is a fact.
|
|
300
|
+
if (plan.onSkip === 'hold')
|
|
301
|
+
return skipHoldSentence(ptr, reason, plan);
|
|
302
|
+
const next = {
|
|
303
|
+
skillId: ptr.skillId,
|
|
304
|
+
step: ptr.step + 1,
|
|
305
|
+
total: ptr.total,
|
|
306
|
+
skipped: [...ptr.skipped, ptr.step],
|
|
307
|
+
};
|
|
308
|
+
scope.stepPointer = [next];
|
|
309
|
+
return skipAdvanceSentence(ptr.step, reason, next, plan);
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Advance-on-return — the caller has just finalized a NON-error,
|
|
313
|
+
* NON-denied, NON-refused result for `toolName`. When that call is the
|
|
314
|
+
* current step's tool: pointer + 1, `step_advanced` (with `completed` on
|
|
315
|
+
* the last), and the returned suffix joins the model-visible result
|
|
316
|
+
* BEFORE the history push. Empty string otherwise. Eligibility (ran,
|
|
317
|
+
* not denied/rejected/errored) is judged by the CALLING site, because
|
|
318
|
+
* each dispatch path knows its own truth about that.
|
|
319
|
+
*/
|
|
320
|
+
const applyStepReturn = (scope, call) => {
|
|
321
|
+
const state = stepStateOf(scope);
|
|
322
|
+
if (!state || state.step.tool !== call.toolName)
|
|
323
|
+
return '';
|
|
324
|
+
const { ptr, plan, step } = state;
|
|
325
|
+
const next = {
|
|
326
|
+
skillId: ptr.skillId,
|
|
327
|
+
step: ptr.step + 1,
|
|
328
|
+
total: ptr.total,
|
|
329
|
+
skipped: [...ptr.skipped],
|
|
330
|
+
};
|
|
331
|
+
scope.stepPointer = [next];
|
|
332
|
+
const completed = next.step > next.total;
|
|
333
|
+
typedEmit(scope, 'agentfootprint.skill.step_advanced', {
|
|
334
|
+
skillId: ptr.skillId,
|
|
335
|
+
step: { index: ptr.step, total: ptr.total, tool: step.tool, note: step.note },
|
|
336
|
+
iteration: call.iteration,
|
|
337
|
+
toolCallId: call.toolCallId,
|
|
338
|
+
...(completed && { completed: true }),
|
|
339
|
+
});
|
|
340
|
+
return stepAdvanceSuffix(next, plan);
|
|
341
|
+
};
|
|
342
|
+
/** The `read_skill` activation intro for a STEPPED skill — where its
|
|
343
|
+
* procedure starts. Rides the same "activated for the next iteration"
|
|
344
|
+
* promise the read_skill result already makes (a same-batch declared
|
|
345
|
+
* edge that outruns the pick reports itself via `reroute_superseded`,
|
|
346
|
+
* exactly as it does for the activation sentence). */
|
|
347
|
+
const readSkillStepIntroFor = (pickedId) => {
|
|
348
|
+
const plan = deps.stepPlanFor?.(pickedId);
|
|
349
|
+
return plan ? readSkillStepIntro(plan) : '';
|
|
350
|
+
};
|
|
252
351
|
/**
|
|
253
352
|
* Every teardown scope an Agent run can honour (9.7.0).
|
|
254
353
|
*
|
|
@@ -1158,6 +1257,17 @@ export function buildToolCallsHandler(deps) {
|
|
|
1158
1257
|
}
|
|
1159
1258
|
}
|
|
1160
1259
|
}
|
|
1260
|
+
// ── skip_step bookkeeping (9.18.0) ─────────────────────────────
|
|
1261
|
+
// Same block as the read_skill gate, same mechanism: the stage
|
|
1262
|
+
// OVERWRITES the tool's placeholder with the authoritative sentence
|
|
1263
|
+
// BEFORE the after-tool moment, so governance rules and the cap
|
|
1264
|
+
// compose over what the model will actually read, on both channels.
|
|
1265
|
+
// Postures never gate it — skipping is judgment inside a step, not
|
|
1266
|
+
// routing. Zero-cost gate: `stepPlanFor` is undefined on every agent
|
|
1267
|
+
// without a stepped skill.
|
|
1268
|
+
if (deps.stepPlanFor && tc.name === SKIP_STEP_TOOL_NAME && !error && !denied) {
|
|
1269
|
+
result = applySkipStep(scope, { args: callArgs, toolCallId: tc.id, iteration });
|
|
1270
|
+
}
|
|
1161
1271
|
// ── The after-tool moment ────────────────────────────────────────
|
|
1162
1272
|
// Last thing before the result becomes history, and only for a call
|
|
1163
1273
|
// that ran. `modelResult` is what the model reads; `result` stays the
|
|
@@ -1188,7 +1298,32 @@ export function buildToolCallsHandler(deps) {
|
|
|
1188
1298
|
durationMs,
|
|
1189
1299
|
...(error === true && { error: true }),
|
|
1190
1300
|
});
|
|
1191
|
-
|
|
1301
|
+
let resultStr = typeof modelResult === 'string' ? modelResult : safeStringify(modelResult);
|
|
1302
|
+
// ── Step boundary (9.18.0): advance decided, then decorate, THEN
|
|
1303
|
+
// push — the suffix must be part of the one past every reader sees
|
|
1304
|
+
// (history, `lastToolResult`, the batch), never spliced in later.
|
|
1305
|
+
// `stream.tool_end` above keeps reporting the tool's own truth.
|
|
1306
|
+
if (deps.stepPlanFor) {
|
|
1307
|
+
// The activation intro: an ACCEPTED read_skill pick of a stepped
|
|
1308
|
+
// skill says where the procedure starts (recency channel §1).
|
|
1309
|
+
if (tc.name === 'read_skill' && !error && !denied && !skillRejected) {
|
|
1310
|
+
const pickedId = callArgs.id;
|
|
1311
|
+
if (typeof pickedId === 'string' && pickedId.length > 0) {
|
|
1312
|
+
resultStr += readSkillStepIntroFor(pickedId);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
// The advance: only a call that RAN clean completes a step — an
|
|
1316
|
+
// error result never advances (the pointer holds; the model
|
|
1317
|
+
// retries, skips with a reason, or routes around), and neither
|
|
1318
|
+
// does a permission denial or a gate refusal.
|
|
1319
|
+
if (executed && !error && !denied && !skillRejected) {
|
|
1320
|
+
resultStr += applyStepReturn(scope, {
|
|
1321
|
+
toolName: tc.name,
|
|
1322
|
+
toolCallId: tc.id,
|
|
1323
|
+
iteration,
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1192
1327
|
newHistory.push({
|
|
1193
1328
|
role: 'tool',
|
|
1194
1329
|
content: resultStr,
|
|
@@ -1323,6 +1458,9 @@ export function buildToolCallsHandler(deps) {
|
|
|
1323
1458
|
* after-tool moment transformed or withheld it. */
|
|
1324
1459
|
let modelResult;
|
|
1325
1460
|
let error;
|
|
1461
|
+
/** The call REALLY ran, clean — the step-advance eligibility this
|
|
1462
|
+
* path knows about itself (a decline or a chain-deny never ran). */
|
|
1463
|
+
let stepToolRan = false;
|
|
1326
1464
|
if (!decision.approved) {
|
|
1327
1465
|
result = decision.note ? `declined by human: ${decision.note}` : 'declined by human';
|
|
1328
1466
|
recordDecisions(scope, [
|
|
@@ -1429,6 +1567,14 @@ export function buildToolCallsHandler(deps) {
|
|
|
1429
1567
|
const dispatched = await resolveCredentialAndExecute(scope, tool, toolName, rest.args, toolCallId, iteration, env);
|
|
1430
1568
|
result = dispatched.result;
|
|
1431
1569
|
error = dispatched.error;
|
|
1570
|
+
stepToolRan = dispatched.executed === true && error !== true;
|
|
1571
|
+
// skip_step behind a middleware ask, approved (9.18.0): the
|
|
1572
|
+
// placeholder just landed — replace it with the authoritative
|
|
1573
|
+
// sentence BEFORE the chain's last word, the execute loop's
|
|
1574
|
+
// composition kept.
|
|
1575
|
+
if (deps.stepPlanFor && toolName === SKIP_STEP_TOOL_NAME && stepToolRan) {
|
|
1576
|
+
result = applySkipStep(scope, { args: rest.args, toolCallId, iteration });
|
|
1577
|
+
}
|
|
1432
1578
|
// The tool ran on this side of the pause, so the chain gets its
|
|
1433
1579
|
// last word here too — a rule about results cannot be skipped by
|
|
1434
1580
|
// routing a call through a human.
|
|
@@ -1454,7 +1600,13 @@ export function buildToolCallsHandler(deps) {
|
|
|
1454
1600
|
modelResult = result;
|
|
1455
1601
|
const askCapped = capResults(toolName, { result, modelResult });
|
|
1456
1602
|
modelResult = askCapped.modelResult;
|
|
1457
|
-
|
|
1603
|
+
let askResultStr = typeof modelResult === 'string' ? modelResult : safeStringify(modelResult);
|
|
1604
|
+
// Step boundary (9.18.0) — a result finalized HERE is as final as one
|
|
1605
|
+
// from the batch loop; the answered call advances the pointer before
|
|
1606
|
+
// the push, exactly as it would have inline.
|
|
1607
|
+
if (deps.stepPlanFor && stepToolRan) {
|
|
1608
|
+
askResultStr += applyStepReturn(scope, { toolName, toolCallId, iteration });
|
|
1609
|
+
}
|
|
1458
1610
|
const askHistory = [
|
|
1459
1611
|
...scope.history,
|
|
1460
1612
|
{ role: 'tool', content: askResultStr, toolCallId, toolName },
|
|
@@ -1512,12 +1664,15 @@ export function buildToolCallsHandler(deps) {
|
|
|
1512
1664
|
/** What the model reads — see the ask path above. */
|
|
1513
1665
|
let modelResult;
|
|
1514
1666
|
let error;
|
|
1667
|
+
/** Step-advance eligibility, judged by this path (a decline ran nothing). */
|
|
1668
|
+
let stepToolRan = false;
|
|
1515
1669
|
if (decision.approved) {
|
|
1516
1670
|
const env = scope.$getEnv();
|
|
1517
1671
|
const tool = lookupTool(toolName);
|
|
1518
1672
|
const dispatched = await resolveCredentialAndExecute(scope, tool, toolName, args, toolCallId, iteration, env);
|
|
1519
1673
|
result = dispatched.result;
|
|
1520
1674
|
error = dispatched.error;
|
|
1675
|
+
stepToolRan = dispatched.executed === true && error !== true;
|
|
1521
1676
|
// Consent moved the execution to this side of the pause; the rules
|
|
1522
1677
|
// about results move with it.
|
|
1523
1678
|
if (dispatched.executed === true) {
|
|
@@ -1542,7 +1697,12 @@ export function buildToolCallsHandler(deps) {
|
|
|
1542
1697
|
modelResult = result;
|
|
1543
1698
|
const decisionCapped = capResults(toolName, { result, modelResult });
|
|
1544
1699
|
modelResult = decisionCapped.modelResult;
|
|
1545
|
-
|
|
1700
|
+
let decisionResultStr = typeof modelResult === 'string' ? modelResult : safeStringify(modelResult);
|
|
1701
|
+
// Step boundary (9.18.0) — an approved consequential step (a checkIn
|
|
1702
|
+
// tool CAN be a step's tool) advances on the resumed dispatch.
|
|
1703
|
+
if (deps.stepPlanFor && stepToolRan) {
|
|
1704
|
+
decisionResultStr += applyStepReturn(scope, { toolName, toolCallId, iteration });
|
|
1705
|
+
}
|
|
1546
1706
|
const decisionHistory = [
|
|
1547
1707
|
...scope.history,
|
|
1548
1708
|
{ role: 'tool', content: decisionResultStr, toolCallId, toolName },
|
|
@@ -1612,7 +1772,12 @@ export function buildToolCallsHandler(deps) {
|
|
|
1612
1772
|
modelResult = result;
|
|
1613
1773
|
const consentCapped = capResults(toolName, { result, modelResult });
|
|
1614
1774
|
modelResult = consentCapped.modelResult;
|
|
1615
|
-
|
|
1775
|
+
let consentResultStr = typeof modelResult === 'string' ? modelResult : safeStringify(modelResult);
|
|
1776
|
+
// Step boundary (9.18.0) — a step tool that waited on 3LO consent
|
|
1777
|
+
// advances the moment its resumed dispatch really ran, clean.
|
|
1778
|
+
if (deps.stepPlanFor && dispatched.executed === true && error !== true) {
|
|
1779
|
+
consentResultStr += applyStepReturn(scope, { toolName, toolCallId, iteration });
|
|
1780
|
+
}
|
|
1616
1781
|
const consentHistory = [
|
|
1617
1782
|
...scope.history,
|
|
1618
1783
|
{ role: 'tool', content: consentResultStr, toolCallId, toolName },
|
|
@@ -1690,7 +1855,15 @@ export function buildToolCallsHandler(deps) {
|
|
|
1690
1855
|
// as a tool's rows do.
|
|
1691
1856
|
const pauseCapped = capResults(toolName, { result: input, modelResult: rawPauseResult });
|
|
1692
1857
|
const modelResult = pauseCapped.modelResult;
|
|
1693
|
-
|
|
1858
|
+
let resultStr = typeof modelResult === 'string' ? modelResult : safeStringify(modelResult);
|
|
1859
|
+
// Step boundary (9.18.0) — THE HITL step ("ask a human, then export"):
|
|
1860
|
+
// the tool paused mid-step, the person's answer IS its result, and the
|
|
1861
|
+
// completed step advances here at the same boundary it would have
|
|
1862
|
+
// inline. The pointer itself crossed the checkpoint for free (it is
|
|
1863
|
+
// committed shared state); this is the half that has to be wired.
|
|
1864
|
+
if (deps.stepPlanFor) {
|
|
1865
|
+
resultStr += applyStepReturn(scope, { toolName, toolCallId, iteration });
|
|
1866
|
+
}
|
|
1694
1867
|
const newHistory = [
|
|
1695
1868
|
...scope.history,
|
|
1696
1869
|
{
|