agentfootprint 2.12.1 → 2.14.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/AnthropicProvider.js +69 -2
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +110 -2
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/core/Agent.js +50 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +112 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +20 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +51 -1
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/prepareFinal.js +12 -1
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/reliabilityExecution.js +194 -9
- package/dist/core/agent/stages/reliabilityExecution.js.map +1 -1
- package/dist/core/agent/stages/seed.js +4 -0
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +7 -0
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/slots/buildThinkingSubflow.js +112 -0
- package/dist/core/slots/buildThinkingSubflow.js.map +1 -0
- package/dist/esm/adapters/llm/AnthropicProvider.js +69 -2
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +110 -2
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/core/Agent.js +50 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.js +112 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.js +20 -1
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.js +52 -2
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.js +12 -1
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/reliabilityExecution.js +191 -8
- package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.js +4 -0
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.js +7 -0
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/slots/buildThinkingSubflow.js +108 -0
- package/dist/esm/core/slots/buildThinkingSubflow.js.map +1 -0
- package/dist/esm/events/registry.js +8 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/reliability/index.js +6 -0
- package/dist/esm/reliability/index.js.map +1 -1
- package/dist/esm/reliability/types.js.map +1 -1
- package/dist/esm/security/index.js +1 -0
- package/dist/esm/security/index.js.map +1 -1
- package/dist/esm/security/thinkingRedaction.js +66 -0
- package/dist/esm/security/thinkingRedaction.js.map +1 -0
- package/dist/esm/thinking/AnthropicThinkingHandler.js +111 -0
- package/dist/esm/thinking/AnthropicThinkingHandler.js.map +1 -0
- package/dist/esm/thinking/MockThinkingHandler.js +94 -0
- package/dist/esm/thinking/MockThinkingHandler.js.map +1 -0
- package/dist/esm/thinking/OpenAIThinkingHandler.js +72 -0
- package/dist/esm/thinking/OpenAIThinkingHandler.js.map +1 -0
- package/dist/esm/thinking/index.js +51 -0
- package/dist/esm/thinking/index.js.map +1 -0
- package/dist/esm/thinking/registry.js +46 -0
- package/dist/esm/thinking/registry.js.map +1 -0
- package/dist/esm/thinking/types.js +30 -0
- package/dist/esm/thinking/types.js.map +1 -0
- package/dist/events/registry.js +8 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/reliability/index.js +10 -1
- package/dist/reliability/index.js.map +1 -1
- package/dist/reliability/types.js.map +1 -1
- package/dist/security/index.js +4 -1
- package/dist/security/index.js.map +1 -1
- package/dist/security/thinkingRedaction.js +70 -0
- package/dist/security/thinkingRedaction.js.map +1 -0
- package/dist/thinking/AnthropicThinkingHandler.js +114 -0
- package/dist/thinking/AnthropicThinkingHandler.js.map +1 -0
- package/dist/thinking/MockThinkingHandler.js +99 -0
- package/dist/thinking/MockThinkingHandler.js.map +1 -0
- package/dist/thinking/OpenAIThinkingHandler.js +75 -0
- package/dist/thinking/OpenAIThinkingHandler.js.map +1 -0
- package/dist/thinking/index.js +61 -0
- package/dist/thinking/index.js.map +1 -0
- package/dist/thinking/registry.js +50 -0
- package/dist/thinking/registry.js.map +1 -0
- package/dist/thinking/types.js +31 -0
- package/dist/thinking/types.js.map +1 -0
- package/dist/types/adapters/llm/AnthropicProvider.d.ts +11 -0
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +121 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +16 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +99 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +8 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts +13 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts +72 -2
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +12 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/slots/buildThinkingSubflow.d.ts +41 -0
- package/dist/types/core/slots/buildThinkingSubflow.d.ts.map +1 -0
- package/dist/types/events/payloads.d.ts +149 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +9 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/reliability/index.d.ts +2 -0
- package/dist/types/reliability/index.d.ts.map +1 -1
- package/dist/types/reliability/types.d.ts +72 -0
- package/dist/types/reliability/types.d.ts.map +1 -1
- package/dist/types/security/index.d.ts +1 -0
- package/dist/types/security/index.d.ts.map +1 -1
- package/dist/types/security/thinkingRedaction.d.ts +51 -0
- package/dist/types/security/thinkingRedaction.d.ts.map +1 -0
- package/dist/types/thinking/AnthropicThinkingHandler.d.ts +43 -0
- package/dist/types/thinking/AnthropicThinkingHandler.d.ts.map +1 -0
- package/dist/types/thinking/MockThinkingHandler.d.ts +51 -0
- package/dist/types/thinking/MockThinkingHandler.d.ts.map +1 -0
- package/dist/types/thinking/OpenAIThinkingHandler.d.ts +38 -0
- package/dist/types/thinking/OpenAIThinkingHandler.d.ts.map +1 -0
- package/dist/types/thinking/index.d.ts +52 -0
- package/dist/types/thinking/index.d.ts.map +1 -0
- package/dist/types/thinking/registry.d.ts +34 -0
- package/dist/types/thinking/registry.d.ts.map +1 -0
- package/dist/types/thinking/types.d.ts +163 -0
- package/dist/types/thinking/types.d.ts.map +1 -0
- package/package.json +6 -1
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* these interfaces — never on concrete adapters.
|
|
14
14
|
*/
|
|
15
15
|
import type { ContextRole, ContextSlot, ContextSource } from '../events/types.js';
|
|
16
|
+
import type { ThinkingBlock } from '../thinking/types.js';
|
|
16
17
|
export interface LLMMessage {
|
|
17
18
|
readonly role: ContextRole;
|
|
18
19
|
readonly content: string;
|
|
@@ -33,6 +34,50 @@ export interface LLMMessage {
|
|
|
33
34
|
readonly name: string;
|
|
34
35
|
readonly args: Readonly<Record<string, unknown>>;
|
|
35
36
|
}[];
|
|
37
|
+
/**
|
|
38
|
+
* v2.14 — Thinking blocks emitted by the LLM on assistant turns.
|
|
39
|
+
*
|
|
40
|
+
* Required for Anthropic extended-thinking + tool-use flows: signed
|
|
41
|
+
* blocks MUST be echoed BYTE-EXACT in subsequent assistant turns or
|
|
42
|
+
* Anthropic's API rejects with 400. The framework persists blocks
|
|
43
|
+
* here so the AnthropicProvider's serializer (Phase 4b) can restore
|
|
44
|
+
* them on the next request.
|
|
45
|
+
*
|
|
46
|
+
* **Persistence model — DIFFERENT from `ephemeral`:**
|
|
47
|
+
* - `ephemeral` messages: NOT persisted to scope.history
|
|
48
|
+
* - `thinkingBlocks`: PERSISTED (required for signature round-trip)
|
|
49
|
+
*
|
|
50
|
+
* Visible to recorders + audit by default. Use
|
|
51
|
+
* `RedactionPolicy.thinkingPatterns` (Phase 3) to scrub sensitive
|
|
52
|
+
* reasoning content before audit-log adapters fire.
|
|
53
|
+
*
|
|
54
|
+
* Empty array OR undefined when no thinking is present (most calls).
|
|
55
|
+
*/
|
|
56
|
+
readonly thinkingBlocks?: readonly ThinkingBlock[];
|
|
57
|
+
/**
|
|
58
|
+
* v2.13 — PERSISTENCE flag (NOT a visibility flag). When `true`:
|
|
59
|
+
* • The message IS sent to the LLM as part of the next request
|
|
60
|
+
* (visible to the model, counts toward its context window).
|
|
61
|
+
* • The message is OBSERVABLE via narrative/recorders/audit log
|
|
62
|
+
* (visible to humans for debugging + forensics).
|
|
63
|
+
* • The message is NOT persisted to `scope.history` after the gate
|
|
64
|
+
* loop that produced it completes — long-term memory writes,
|
|
65
|
+
* `getNarrative()` snapshots, and downstream consumers see only
|
|
66
|
+
* non-ephemeral messages.
|
|
67
|
+
*
|
|
68
|
+
* Use case: Instructor-style schema retry. The reliability gate
|
|
69
|
+
* appends `{ role: 'user', content: feedbackForLLM, ephemeral: true }`
|
|
70
|
+
* before retry — the LLM sees the validation feedback for the next
|
|
71
|
+
* call, but the conversation history (and any memory persistence
|
|
72
|
+
* downstream) sees only the final accepted exchange.
|
|
73
|
+
*
|
|
74
|
+
* Audit-trail safety: ephemeral DOES NOT mean invisible to security
|
|
75
|
+
* review. `getNarrative()`, recorders, and the typed-event stream all
|
|
76
|
+
* see ephemeral messages; only the persistent conversation log filters
|
|
77
|
+
* them out. An attacker cannot use the ephemeral marker to construct
|
|
78
|
+
* audit-invisible prompts.
|
|
79
|
+
*/
|
|
80
|
+
readonly ephemeral?: boolean;
|
|
36
81
|
}
|
|
37
82
|
export interface LLMToolSchema {
|
|
38
83
|
readonly name: string;
|
|
@@ -59,6 +104,32 @@ export interface LLMRequest {
|
|
|
59
104
|
* cache support (OpenAI auto-cache, Mock, NoOp) ignore it.
|
|
60
105
|
*/
|
|
61
106
|
readonly cacheMarkers?: readonly import('../cache/types.js').CacheMarker[];
|
|
107
|
+
/**
|
|
108
|
+
* v2.14 — request the LLM emit reasoning/thinking content on this call.
|
|
109
|
+
*
|
|
110
|
+
* Activation: presence of this field tells the provider to ASK for
|
|
111
|
+
* thinking. Anthropic translates to `thinking: { type: 'enabled',
|
|
112
|
+
* budget_tokens: budget }` on the wire. OpenAI ignores (o1/o3
|
|
113
|
+
* thinking is selected at the model id level, not per-request).
|
|
114
|
+
*
|
|
115
|
+
* `budget` is the maximum reasoning tokens the model may spend.
|
|
116
|
+
* Anthropic requires it; recommended range 1024-32000 for
|
|
117
|
+
* claude-sonnet-4-5 / opus-4-5. Models that don't support extended
|
|
118
|
+
* thinking will reject the request with HTTP 400 — pick a supported
|
|
119
|
+
* model when setting this field.
|
|
120
|
+
*
|
|
121
|
+
* Independent from `LLMMessage.thinkingBlocks` (the response side):
|
|
122
|
+
* - `request.thinking` = activation (consumer ASKS for thinking)
|
|
123
|
+
* - `message.thinkingBlocks` = round-trip (consumer ECHOES prior
|
|
124
|
+
* assistant turn's signed blocks back to the model)
|
|
125
|
+
*
|
|
126
|
+
* Set via `AgentBuilder.thinking({ budget })` — applied to every
|
|
127
|
+
* LLM call the agent makes. Leave undefined to call without thinking
|
|
128
|
+
* (the v2.13 default).
|
|
129
|
+
*/
|
|
130
|
+
readonly thinking?: {
|
|
131
|
+
readonly budget: number;
|
|
132
|
+
};
|
|
62
133
|
}
|
|
63
134
|
export interface LLMResponse {
|
|
64
135
|
readonly content: string;
|
|
@@ -72,9 +143,43 @@ export interface LLMResponse {
|
|
|
72
143
|
readonly output: number;
|
|
73
144
|
readonly cacheRead?: number;
|
|
74
145
|
readonly cacheWrite?: number;
|
|
146
|
+
/**
|
|
147
|
+
* v2.14 — count of reasoning/thinking tokens used by the model.
|
|
148
|
+
* Distinct from `output` (which is visible-content tokens).
|
|
149
|
+
*
|
|
150
|
+
* Semantics:
|
|
151
|
+
* - `undefined` — provider doesn't expose / no thinking enabled
|
|
152
|
+
* on this call / call without extended thinking
|
|
153
|
+
* - `0` — thinking enabled but model produced no
|
|
154
|
+
* thinking tokens this call
|
|
155
|
+
* - `>0` — actual reasoning token count (billing-relevant
|
|
156
|
+
* for both Anthropic extended thinking and
|
|
157
|
+
* OpenAI o1/o3 reasoning_tokens)
|
|
158
|
+
*
|
|
159
|
+
* Cost dashboards reading `cost.tick` events should track this
|
|
160
|
+
* separately from `output` — pricing differs (Anthropic charges
|
|
161
|
+
* extended thinking at output rates; OpenAI o1/o3 reasoning tokens
|
|
162
|
+
* are billed as a separate line item).
|
|
163
|
+
*/
|
|
164
|
+
readonly thinking?: number;
|
|
75
165
|
};
|
|
76
166
|
readonly stopReason: string;
|
|
77
167
|
readonly providerRef?: string;
|
|
168
|
+
/**
|
|
169
|
+
* v2.14 — Provider-specific raw thinking data, opaque to the
|
|
170
|
+
* framework. Providers that support extended thinking populate this
|
|
171
|
+
* with their native shape (Anthropic: array of `{type, thinking,
|
|
172
|
+
* signature}` blocks; OpenAI: `reasoning_summary` value; custom:
|
|
173
|
+
* whatever the provider emits). The framework hands this to a
|
|
174
|
+
* configured `ThinkingHandler.normalize(rawThinking)` to produce
|
|
175
|
+
* the normalized `ThinkingBlock[]` that lands on
|
|
176
|
+
* `LLMMessage.thinkingBlocks`.
|
|
177
|
+
*
|
|
178
|
+
* Undefined when the provider has no thinking content for this call
|
|
179
|
+
* — most calls (gpt-4o, claude without extended thinking enabled,
|
|
180
|
+
* etc.). The thinking subflow's stage early-returns in this case.
|
|
181
|
+
*/
|
|
182
|
+
readonly rawThinking?: unknown;
|
|
78
183
|
}
|
|
79
184
|
export interface LLMChunk {
|
|
80
185
|
readonly tokenIndex: number;
|
|
@@ -95,6 +200,22 @@ export interface LLMChunk {
|
|
|
95
200
|
* authoritative payload in that case.
|
|
96
201
|
*/
|
|
97
202
|
readonly response?: LLMResponse;
|
|
203
|
+
/**
|
|
204
|
+
* v2.14 — streaming thinking-content tokens. Parallel to `content`
|
|
205
|
+
* but for the model's reasoning chain rather than visible output.
|
|
206
|
+
* Set on chunks that carry thinking deltas (Anthropic emits these
|
|
207
|
+
* via `content_block_delta` events with `delta.type === 'thinking_delta'`);
|
|
208
|
+
* undefined or empty on chunks that carry only visible-content tokens.
|
|
209
|
+
*
|
|
210
|
+
* Frameworks: this field drives `agentfootprint.stream.thinking_delta`
|
|
211
|
+
* events when a `ThinkingHandler.parseChunk()` returns one. Consumers
|
|
212
|
+
* who want to render thinking-as-it-streams subscribe to that event.
|
|
213
|
+
*
|
|
214
|
+
* Default consumer behavior: thinking tokens are NOT shown to end
|
|
215
|
+
* users via `enable.thinking({ stream: false })` (the default).
|
|
216
|
+
* Consumers explicitly opt in with `enable.thinking({ stream: true })`.
|
|
217
|
+
*/
|
|
218
|
+
readonly thinkingDelta?: string;
|
|
98
219
|
}
|
|
99
220
|
export interface LLMProvider {
|
|
100
221
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"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CAAC,cAAc,EAAE,MAAM,CAAC;KACjC,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;IACzD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;CACrF;AAID,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;CACvD"}
|
|
@@ -27,6 +27,7 @@ import type { ToolRegistryEntry } from './tools.js';
|
|
|
27
27
|
import type { ToolProvider } from '../tool-providers/types.js';
|
|
28
28
|
import type { AgentInput, AgentOptions, AgentOutput } from './agent/types.js';
|
|
29
29
|
import { AgentBuilder } from './agent/AgentBuilder.js';
|
|
30
|
+
import type { ThinkingHandler } from '../thinking/types.js';
|
|
30
31
|
export { AgentBuilder };
|
|
31
32
|
export type { AgentInput, AgentOptions, AgentOutput };
|
|
32
33
|
export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
@@ -137,11 +138,25 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
137
138
|
* by `preCheck` and `postDecide` rules. Consumed by `buildCallLLMStage`.
|
|
138
139
|
*/
|
|
139
140
|
private readonly reliabilityConfig?;
|
|
141
|
+
/**
|
|
142
|
+
* Resolved ThinkingHandler (v2.14+). Auto-wired by `provider.name`
|
|
143
|
+
* via `findThinkingHandler` UNLESS the builder explicitly set one
|
|
144
|
+
* (or `null` to opt out). When undefined, the NormalizeThinking
|
|
145
|
+
* sub-subflow is NOT mounted at chart build time — zero overhead
|
|
146
|
+
* for non-thinking agents.
|
|
147
|
+
*/
|
|
148
|
+
private readonly thinkingHandler?;
|
|
149
|
+
/**
|
|
150
|
+
* v2.14+ — request-side thinking budget. When set, every LLMRequest
|
|
151
|
+
* carries `thinking: { budget }`. AnthropicProvider translates to the
|
|
152
|
+
* wire format. Undefined = no thinking activation (default behavior).
|
|
153
|
+
*/
|
|
154
|
+
private readonly thinkingBudget?;
|
|
140
155
|
constructor(opts: AgentOptions, systemPromptValue: string, registry: readonly ToolRegistryEntry[], voice: {
|
|
141
156
|
readonly appName: string;
|
|
142
157
|
readonly commentaryTemplates: Readonly<Record<string, string>>;
|
|
143
158
|
readonly thinkingTemplates: Readonly<Record<string, string>>;
|
|
144
|
-
}, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown>, reliabilityConfig?: ReliabilityConfig);
|
|
159
|
+
}, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown>, reliabilityConfig?: ReliabilityConfig, thinkingHandlerValue?: ThinkingHandler | null, thinkingBudgetValue?: number);
|
|
145
160
|
static create(opts: AgentOptions): AgentBuilder;
|
|
146
161
|
toFlowChart(): FlowChart;
|
|
147
162
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../src/core/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAUjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAkBrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAKL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAwC,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM/D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,C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AqCtB,OAAO,CAAC,cAAc;IA2FtB,OAAO,CAAC,UAAU;CA4InB"}
|
|
@@ -12,6 +12,7 @@ import type { CachePolicy } from '../../cache/types.js';
|
|
|
12
12
|
import type { Injection } from '../../lib/injection-engine/types.js';
|
|
13
13
|
import type { MemoryDefinition } from '../../memory/define.types.js';
|
|
14
14
|
import type { ReliabilityConfig } from '../../reliability/types.js';
|
|
15
|
+
import type { ThinkingHandler } from '../../thinking/types.js';
|
|
15
16
|
import type { Tool } from '../tools.js';
|
|
16
17
|
import type { ToolProvider } from '../../tool-providers/types.js';
|
|
17
18
|
import { Agent } from '../Agent.js';
|
|
@@ -82,6 +83,27 @@ export declare class AgentBuilder {
|
|
|
82
83
|
* rules. See `ReliabilityConfig` for the rule shape.
|
|
83
84
|
*/
|
|
84
85
|
private reliabilityConfig?;
|
|
86
|
+
/**
|
|
87
|
+
* Optional ThinkingHandler (v2.14+). Three states:
|
|
88
|
+
* - undefined (default): auto-wire by `provider.name` via
|
|
89
|
+
* `findThinkingHandler` from the registry
|
|
90
|
+
* - explicit handler: override the auto-wire
|
|
91
|
+
* - explicit `null`: opt out (no thinking handler mounted at all,
|
|
92
|
+
* even if the provider would auto-match)
|
|
93
|
+
*
|
|
94
|
+
* The framework wraps the configured handler in a real footprintjs
|
|
95
|
+
* sub-subflow at chart build time (see `buildThinkingSubflow`).
|
|
96
|
+
* Mounted as a stage AFTER CallLLM inside `sf-call-llm`. Build-time
|
|
97
|
+
* conditional — no stage when no handler resolves.
|
|
98
|
+
*/
|
|
99
|
+
private thinkingHandlerValue?;
|
|
100
|
+
/**
|
|
101
|
+
* v2.14+ — request-side thinking activation. When set, every LLM
|
|
102
|
+
* call carries `LLMRequest.thinking = { budget }`, asking the
|
|
103
|
+
* provider (Anthropic) to emit reasoning blocks. Independent from
|
|
104
|
+
* `.thinkingHandler()` (response-side normalization choice).
|
|
105
|
+
*/
|
|
106
|
+
private thinkingBudgetValue?;
|
|
85
107
|
constructor(opts: AgentOptions);
|
|
86
108
|
/**
|
|
87
109
|
* Set the base system prompt.
|
|
@@ -404,6 +426,83 @@ export declare class AgentBuilder {
|
|
|
404
426
|
* }
|
|
405
427
|
*/
|
|
406
428
|
reliability(config: ReliabilityConfig): this;
|
|
429
|
+
/**
|
|
430
|
+
* Wire a thinking handler (v2.14+). Three usage patterns:
|
|
431
|
+
*
|
|
432
|
+
* • OMITTED (default) — framework auto-wires by `provider.name` via
|
|
433
|
+
* `findThinkingHandler` from the registry. Most consumers using
|
|
434
|
+
* a shipped provider get thinking support for free.
|
|
435
|
+
*
|
|
436
|
+
* • EXPLICIT handler — override the auto-wire. For custom providers
|
|
437
|
+
* or for swapping in a custom Anthropic/OpenAI handler with
|
|
438
|
+
* different normalization (e.g. redacting blocks before they
|
|
439
|
+
* land).
|
|
440
|
+
*
|
|
441
|
+
* • EXPLICIT `null` — opt out entirely. The thinking subflow is NOT
|
|
442
|
+
* mounted even if the provider would auto-match. Use when you
|
|
443
|
+
* want to skip thinking parsing for this agent (cost / latency /
|
|
444
|
+
* UX reasons).
|
|
445
|
+
*
|
|
446
|
+
* Calling twice throws — same shape as `.reliability()` /
|
|
447
|
+
* `.outputSchema()` to enforce single-source intent.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* // Default — auto-wire AnthropicThinkingHandler for anthropic provider
|
|
451
|
+
* Agent.create({ provider: anthropic({...}), model: '...' }).build();
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* // Custom handler that redacts thinking content
|
|
455
|
+
* Agent.create({...}).thinkingHandler(myRedactingHandler).build();
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* // Opt out of thinking parsing entirely
|
|
459
|
+
* Agent.create({ provider: anthropic({...}), model: '...' })
|
|
460
|
+
* .thinkingHandler(null)
|
|
461
|
+
* .build();
|
|
462
|
+
*/
|
|
463
|
+
thinkingHandler(handler: ThinkingHandler | null): this;
|
|
464
|
+
/**
|
|
465
|
+
* v2.14+ — REQUEST-side thinking activation. Tells the provider to
|
|
466
|
+
* emit reasoning blocks alongside its response.
|
|
467
|
+
*
|
|
468
|
+
* **What this does:** every LLM call carries
|
|
469
|
+
* `LLMRequest.thinking = { budget }`. The AnthropicProvider
|
|
470
|
+
* translates to `thinking: { type: 'enabled', budget_tokens: N }`
|
|
471
|
+
* on the wire. The model spends up to `budget` reasoning tokens
|
|
472
|
+
* before producing the visible response.
|
|
473
|
+
*
|
|
474
|
+
* **Distinct from `.thinkingHandler()`:**
|
|
475
|
+
* - `.thinking({ budget })` = ASK the model to think (request side)
|
|
476
|
+
* - `.thinkingHandler(h)` = NORMALIZE the response (response side)
|
|
477
|
+
*
|
|
478
|
+
* Most consumers want both; auto-wired handler covers the response
|
|
479
|
+
* side automatically when `.thinking()` is set on a thinking-capable
|
|
480
|
+
* provider. Setting `.thinking()` without `.thinkingHandler(null)`
|
|
481
|
+
* is the typical happy path.
|
|
482
|
+
*
|
|
483
|
+
* **Provider compatibility:**
|
|
484
|
+
* - Anthropic: requires claude-sonnet-4-5 / opus-4-5 (or newer).
|
|
485
|
+
* Older models reject with HTTP 400.
|
|
486
|
+
* - OpenAI: ignores. o1/o3 reasoning is selected at the model id
|
|
487
|
+
* level; this field is a no-op for OpenAIProvider.
|
|
488
|
+
*
|
|
489
|
+
* **Budget guidance:** Anthropic recommends 1024-32000 reasoning
|
|
490
|
+
* tokens. `budget` MUST be less than the request's `max_tokens`
|
|
491
|
+
* (defaults to 4096 in AnthropicProvider — bump via the request
|
|
492
|
+
* `maxTokens` if budget > ~3000).
|
|
493
|
+
*
|
|
494
|
+
* Calling twice throws — same shape as `.reliability()` /
|
|
495
|
+
* `.outputSchema()`.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* Agent.create({ provider: anthropic({...}), model: 'claude-sonnet-4-5' })
|
|
499
|
+
* .system('You are a careful reasoning agent.')
|
|
500
|
+
* .thinking({ budget: 5000 }) // ask Anthropic to think
|
|
501
|
+
* .build();
|
|
502
|
+
*/
|
|
503
|
+
thinking(opts: {
|
|
504
|
+
budget: number;
|
|
505
|
+
}): this;
|
|
407
506
|
build(): Agent;
|
|
408
507
|
}
|
|
409
508
|
//# sourceMappingURL=AgentBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,iBAAiB,CAAM;IAC/B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB,CAAyB;IACxD;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB,CAAS;IACrC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB,CAAC,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;IACpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,O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AAG,IAAI;IAW1C;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAIvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI;IAqBhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI;IAwB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAU5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI;IAUtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAiBxC,KAAK,IAAI,KAAK;CAsCf"}
|
|
@@ -63,6 +63,14 @@ export interface AgentChartDeps {
|
|
|
63
63
|
readonly systemPromptSubflow: FlowChart;
|
|
64
64
|
readonly messagesSubflow: FlowChart;
|
|
65
65
|
readonly toolsSubflow: FlowChart;
|
|
66
|
+
/**
|
|
67
|
+
* Optional thinking-normalization sub-subflow (v2.14+). Mounted as a
|
|
68
|
+
* stage AFTER CallLLM, BEFORE Route, only when a `ThinkingHandler`
|
|
69
|
+
* resolved (either auto-wired by `provider.name` or explicitly set
|
|
70
|
+
* via `.thinkingHandler()`). When undefined, the stage is NOT added —
|
|
71
|
+
* zero overhead for non-thinking agents (build-time conditional mount).
|
|
72
|
+
*/
|
|
73
|
+
readonly thinkingSubflow?: FlowChart;
|
|
66
74
|
readonly cacheDecisionSubflow: FlowChart;
|
|
67
75
|
readonly updateSkillHistoryStage: (scope: never) => void;
|
|
68
76
|
readonly cacheGateDecide: (scope: never) => unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAQrE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAE/C;uEACmE;IACnE,QAAQ,CAAC,uBAAuB,EAAE,WAAW,CAAC;IAE9C;kDAC8C;IAC9C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAG/B,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,YAAY,GAAG,OAAO,CAAC;IAChE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,aAAa,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAGxE,QAAQ,CAAC,sBAAsB,EAAE,SAAS,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC;IACxC,QAAQ,C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;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC;IAGrC,QAAQ,CAAC,oBAAoB,EAAE,SAAS,CAAC;IACzC,QAAQ,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;CACrD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAuP/D"}
|
|
@@ -22,6 +22,7 @@ import type { TypedScope } from 'footprintjs';
|
|
|
22
22
|
import type { LLMProvider, LLMToolSchema, PricingTable } from '../../../adapters/types.js';
|
|
23
23
|
import type { CacheStrategy } from '../../../cache/types.js';
|
|
24
24
|
import type { ReliabilityConfig } from '../../../reliability/types.js';
|
|
25
|
+
import { type OutputSchemaParser } from '../../outputSchema.js';
|
|
25
26
|
import type { AgentState } from '../types.js';
|
|
26
27
|
export interface CallLLMStageDeps {
|
|
27
28
|
/** The LLM provider to invoke. */
|
|
@@ -52,6 +53,18 @@ export interface CallLLMStageDeps {
|
|
|
52
53
|
* see `reliabilityExecution.ts` and the streaming + reliability
|
|
53
54
|
* design memo. */
|
|
54
55
|
readonly reliability?: ReliabilityConfig;
|
|
56
|
+
/** Optional output-schema parser (v2.13+). When set AND `reliability`
|
|
57
|
+
* is also set, the loop validates the LLM response against this
|
|
58
|
+
* parser on terminal turns (no toolCalls). Failures classify as
|
|
59
|
+
* `errorKind: 'schema-fail'` so PostDecide rules can route to
|
|
60
|
+
* retry-with-feedback (Instructor pattern). When `reliability` is
|
|
61
|
+
* NOT set, validation only happens at `agent.parseOutput()` boundary
|
|
62
|
+
* (existing v2.4 behavior). */
|
|
63
|
+
readonly outputSchemaParser?: OutputSchemaParser<unknown>;
|
|
64
|
+
/** v2.14+ — request-side thinking budget. When set, every LLMRequest
|
|
65
|
+
* carries `thinking: { budget }` so the provider activates extended
|
|
66
|
+
* thinking. Undefined = no activation (default). */
|
|
67
|
+
readonly thinkingBudget?: number;
|
|
55
68
|
}
|
|
56
69
|
/**
|
|
57
70
|
* Build the callLLM stage function. Captures the LLM provider + model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callLLM.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,WAAW,EAGX,aAAa,EACb,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"callLLM.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,WAAW,EAGX,aAAa,EACb,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;qDACiD;IACjD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;;sEAEkE;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;uBAKmB;IACnB,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IACzC;;;;;;oCAMgC;IAChC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC1D;;yDAEqD;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,GACrB,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAwMlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareFinal.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/prepareFinal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,iBAAiB,UAAW,WAAW,UAAU,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"prepareFinal.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/prepareFinal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,iBAAiB,UAAW,WAAW,UAAU,CAAC,KAAG,IAkCjE,CAAC"}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
*/
|
|
45
45
|
import type { TypedScope } from 'footprintjs';
|
|
46
46
|
import type { LLMProvider, LLMRequest, LLMResponse } from '../../../adapters/types.js';
|
|
47
|
-
import type { ReliabilityConfig } from '../../../reliability/types.js';
|
|
47
|
+
import type { ReliabilityConfig, ReliabilityRule, ReliabilityScope } from '../../../reliability/types.js';
|
|
48
48
|
import type { AgentState } from '../types.js';
|
|
49
49
|
/** A single-shot LLM call function. Built once by `callLLM.ts` and
|
|
50
50
|
* passed into this helper; we invoke it once per loop iteration. */
|
|
@@ -54,6 +54,41 @@ export type LLMCallFn = (request: LLMRequest, hooks: {
|
|
|
54
54
|
* fail-fast. */
|
|
55
55
|
onFirstChunk?: () => void;
|
|
56
56
|
}) => Promise<LLMResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* v2.13 — Output-schema validation hook. Called by the reliability loop
|
|
59
|
+
* AFTER a successful LLM response, BEFORE the response is committed.
|
|
60
|
+
* Throw to signal validation failure — the gate treats the throw as a
|
|
61
|
+
* `'schema-fail'` errorKind and routes via PostDecide rules (which can
|
|
62
|
+
* `retry` with `feedbackForLLM` for Instructor-style schema retry).
|
|
63
|
+
*
|
|
64
|
+
* Sentinel error type — the loop unwraps `ValidationFailure` instances
|
|
65
|
+
* to extract `message` / `path` / `rawOutput` for the
|
|
66
|
+
* `agentfootprint.agent.output_schema_validation_failed` event payload.
|
|
67
|
+
*
|
|
68
|
+
* MUST-FIX #1 from the v2.13 7-panel review: the hook fires ONLY when
|
|
69
|
+
* `response.toolCalls.length === 0` (final-answer turn). Tool-call
|
|
70
|
+
* turns aren't terminal output and validation would be premature.
|
|
71
|
+
* Caller is responsible for the guard; this helper just runs whatever
|
|
72
|
+
* the caller passes.
|
|
73
|
+
*/
|
|
74
|
+
export type OutputSchemaValidator = (response: LLMResponse) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Sentinel error class thrown by an `OutputSchemaValidator` to signal
|
|
77
|
+
* a validation failure. Distinct subclass so the reliability loop can
|
|
78
|
+
* `instanceof` check and route to the schema-fail branch instead of
|
|
79
|
+
* treating it as a generic provider error.
|
|
80
|
+
*/
|
|
81
|
+
export declare class ValidationFailure extends Error {
|
|
82
|
+
readonly stage: 'json-parse' | 'schema-validate';
|
|
83
|
+
readonly path?: string;
|
|
84
|
+
readonly rawOutput?: string;
|
|
85
|
+
constructor(opts: {
|
|
86
|
+
message: string;
|
|
87
|
+
stage: 'json-parse' | 'schema-validate';
|
|
88
|
+
path?: string;
|
|
89
|
+
rawOutput?: string;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
57
92
|
/** Sentinel kind written to scope on a mid-stream failure that the
|
|
58
93
|
* rules wanted to retry. Surfaces in `ReliabilityFailFastError.kind`. */
|
|
59
94
|
export declare const MID_STREAM_KIND = "mid-stream-not-retryable";
|
|
@@ -62,5 +97,40 @@ export declare const MID_STREAM_KIND = "mid-stream-not-retryable";
|
|
|
62
97
|
* on success; calls `scope.$break(reason)` and returns `undefined` on
|
|
63
98
|
* fail-fast (caller short-circuits when undefined is returned).
|
|
64
99
|
*/
|
|
65
|
-
export declare function executeWithReliability(scope: TypedScope<AgentState>, request: LLMRequest, config: ReliabilityConfig, defaultProvider: LLMProvider, defaultProviderName: string, defaultModel: string, callFn: LLMCallFn
|
|
100
|
+
export declare function executeWithReliability(scope: TypedScope<AgentState>, request: LLMRequest, config: ReliabilityConfig, defaultProvider: LLMProvider, defaultProviderName: string, defaultModel: string, callFn: LLMCallFn,
|
|
101
|
+
/** v2.13 — optional output-schema validator. When supplied, the loop
|
|
102
|
+
* invokes it after every successful LLM call WHERE
|
|
103
|
+
* `response.toolCalls.length === 0` (final-answer turn). Throws of
|
|
104
|
+
* type `ValidationFailure` signal schema-fail and route via
|
|
105
|
+
* PostDecide rules. Caller is responsible for guarding tool-call
|
|
106
|
+
* turns; this helper assumes the validator is already gated. */
|
|
107
|
+
postValidate?: OutputSchemaValidator): Promise<LLMResponse | undefined>;
|
|
108
|
+
/**
|
|
109
|
+
* v2.13 — stuck-loop detection helper. Returns `true` when the last
|
|
110
|
+
* `n` validation errors are IDENTICAL — a hallucinating model that
|
|
111
|
+
* keeps making the same mistake won't make progress on more retries.
|
|
112
|
+
*
|
|
113
|
+
* Default rule template — spread into your `postDecide` to short-circuit
|
|
114
|
+
* stuck loops:
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* postDecide: [
|
|
118
|
+
* defaultStuckLoopRule, // ← spread first; fail-fast on stuck
|
|
119
|
+
* { when: (s) => s.validationError !== undefined && s.attempt < 3, then: 'retry', ... },
|
|
120
|
+
* ]
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param scope The reliability scope view passed to rule predicates.
|
|
124
|
+
* @param n How many trailing identical errors trigger detection. Default 2.
|
|
125
|
+
*/
|
|
126
|
+
export declare function lastNValidationErrorsMatch(scope: ReliabilityScope, n?: number): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* v2.13 — drop-in PostDecide rule that fail-fasts when the last 2
|
|
129
|
+
* validation errors match. Spread into `postDecide` BEFORE retry
|
|
130
|
+
* rules so it short-circuits before another wasted attempt.
|
|
131
|
+
*
|
|
132
|
+
* The matched-rule kind `'schema-stuck-loop'` surfaces on
|
|
133
|
+
* `ReliabilityFailFastError.kind` for caller branching.
|
|
134
|
+
*/
|
|
135
|
+
export declare const defaultStuckLoopRule: ReliabilityRule;
|
|
66
136
|
//# sourceMappingURL=reliabilityExecution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reliabilityExecution.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/reliabilityExecution.ts"],"names":[],"mappings":"AAAA;;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;;;;;;OAMG;IACH,QAAQ,CAAC,2BAA2B,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC5B;4BACwB;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC;;iEAE6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,2BAA2B,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAuE3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolCalls.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/toolCalls.ts"],"names":[],"mappings":"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KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACnC;;4DAEwD;IACxD,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnD;;qDAEiD;IACjD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,YAAY,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAC/C;;4DAEwD;IACxD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CAChD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,oBAAoB,GACzB,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CA+SzC"}
|
|
@@ -12,6 +12,7 @@ import type { CacheMarker, CacheStrategy } from '../../cache/types.js';
|
|
|
12
12
|
import type { ActiveInjection } from '../../lib/injection-engine/types.js';
|
|
13
13
|
import type { InjectionRecord } from '../../recorders/core/types.js';
|
|
14
14
|
import type { MemoryIdentity } from '../../memory/identity/types.js';
|
|
15
|
+
import type { ThinkingBlock } from '../../thinking/types.js';
|
|
15
16
|
export interface AgentOptions {
|
|
16
17
|
readonly provider: LLMProvider;
|
|
17
18
|
/** Human-friendly name shown in events/metrics. Default: 'Agent'. */
|
|
@@ -167,5 +168,16 @@ export interface AgentState {
|
|
|
167
168
|
policyHaltIteration?: number;
|
|
168
169
|
/** Identifier of the PermissionChecker that returned `'halt'`. */
|
|
169
170
|
policyHaltCheckerId?: string;
|
|
171
|
+
/** Provider-specific raw thinking data, set by callLLM after the
|
|
172
|
+
* LLM response lands. The NormalizeThinking sub-subflow reads this
|
|
173
|
+
* and feeds it to the configured `ThinkingHandler.normalize()`.
|
|
174
|
+
* Undefined when the provider has no thinking content for this call. */
|
|
175
|
+
rawThinking?: unknown;
|
|
176
|
+
/** Normalized thinking blocks from the most recent LLM response.
|
|
177
|
+
* Written by the NormalizeThinking sub-subflow; read by toolCalls.ts
|
|
178
|
+
* + prepareFinal.ts when constructing the assistant message for
|
|
179
|
+
* `scope.history` (ensures Anthropic signature round-trip). Empty
|
|
180
|
+
* array when no thinking present. */
|
|
181
|
+
thinkingBlocks: readonly ThinkingBlock[];
|
|
170
182
|
}
|
|
171
183
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,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