agentfootprint 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +1 -1
  2. package/dist/cache/CacheDecisionSubflow.js +13 -18
  3. package/dist/cache/CacheDecisionSubflow.js.map +1 -1
  4. package/dist/cache/CacheGateDecider.js +18 -3
  5. package/dist/cache/CacheGateDecider.js.map +1 -1
  6. package/dist/cache/cacheRecorder.js +12 -3
  7. package/dist/cache/cacheRecorder.js.map +1 -1
  8. package/dist/conventions.js +152 -2
  9. package/dist/conventions.js.map +1 -1
  10. package/dist/core/Agent.js +46 -9
  11. package/dist/core/Agent.js.map +1 -1
  12. package/dist/core/LLMCall.js +177 -44
  13. package/dist/core/LLMCall.js.map +1 -1
  14. package/dist/core/RunnerBase.js +14 -0
  15. package/dist/core/RunnerBase.js.map +1 -1
  16. package/dist/core/agent/buildAgentChart.js +117 -48
  17. package/dist/core/agent/buildAgentChart.js.map +1 -1
  18. package/dist/core/agent/buildAgentMessageApiChart.js +201 -0
  19. package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -0
  20. package/dist/core/agent/buildCacheSubflow.js +62 -0
  21. package/dist/core/agent/buildCacheSubflow.js.map +1 -0
  22. package/dist/core/agent/buildDynamicAgentChart.js +364 -0
  23. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -0
  24. package/dist/core/agent/buildMessageApiChart.js +154 -0
  25. package/dist/core/agent/buildMessageApiChart.js.map +1 -0
  26. package/dist/core/agent/stages/callLLM.js +11 -0
  27. package/dist/core/agent/stages/callLLM.js.map +1 -1
  28. package/dist/core/agent/stages/reliabilityExecution.js +64 -9
  29. package/dist/core/agent/stages/reliabilityExecution.js.map +1 -1
  30. package/dist/core/humanizeLLMError.js +66 -0
  31. package/dist/core/humanizeLLMError.js.map +1 -0
  32. package/dist/core/slots/buildMessagesSlot.js +1 -1
  33. package/dist/core/slots/buildMessagesSlot.js.map +1 -1
  34. package/dist/core/slots/buildToolsSlot.js.map +1 -1
  35. package/dist/core-flow/Conditional.js +1 -1
  36. package/dist/core-flow/Conditional.js.map +1 -1
  37. package/dist/core-flow/Loop.js +1 -1
  38. package/dist/core-flow/Loop.js.map +1 -1
  39. package/dist/core-flow/Parallel.js +1 -1
  40. package/dist/core-flow/Parallel.js.map +1 -1
  41. package/dist/esm/cache/CacheDecisionSubflow.js +11 -17
  42. package/dist/esm/cache/CacheDecisionSubflow.js.map +1 -1
  43. package/dist/esm/cache/CacheGateDecider.js +18 -3
  44. package/dist/esm/cache/CacheGateDecider.js.map +1 -1
  45. package/dist/esm/cache/cacheRecorder.js +12 -3
  46. package/dist/esm/cache/cacheRecorder.js.map +1 -1
  47. package/dist/esm/conventions.js +148 -1
  48. package/dist/esm/conventions.js.map +1 -1
  49. package/dist/esm/core/Agent.js +47 -10
  50. package/dist/esm/core/Agent.js.map +1 -1
  51. package/dist/esm/core/LLMCall.js +177 -44
  52. package/dist/esm/core/LLMCall.js.map +1 -1
  53. package/dist/esm/core/RunnerBase.js +14 -0
  54. package/dist/esm/core/RunnerBase.js.map +1 -1
  55. package/dist/esm/core/agent/buildAgentChart.js +118 -49
  56. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  57. package/dist/esm/core/agent/buildAgentMessageApiChart.js +197 -0
  58. package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -0
  59. package/dist/esm/core/agent/buildCacheSubflow.js +58 -0
  60. package/dist/esm/core/agent/buildCacheSubflow.js.map +1 -0
  61. package/dist/esm/core/agent/buildDynamicAgentChart.js +360 -0
  62. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -0
  63. package/dist/esm/core/agent/buildMessageApiChart.js +150 -0
  64. package/dist/esm/core/agent/buildMessageApiChart.js.map +1 -0
  65. package/dist/esm/core/agent/stages/callLLM.js +11 -0
  66. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  67. package/dist/esm/core/agent/stages/reliabilityExecution.js +64 -9
  68. package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -1
  69. package/dist/esm/core/humanizeLLMError.js +61 -0
  70. package/dist/esm/core/humanizeLLMError.js.map +1 -0
  71. package/dist/esm/core/slots/buildMessagesSlot.js +1 -1
  72. package/dist/esm/core/slots/buildMessagesSlot.js.map +1 -1
  73. package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
  74. package/dist/esm/core-flow/Conditional.js +1 -1
  75. package/dist/esm/core-flow/Conditional.js.map +1 -1
  76. package/dist/esm/core-flow/Loop.js +1 -1
  77. package/dist/esm/core-flow/Loop.js.map +1 -1
  78. package/dist/esm/core-flow/Parallel.js +1 -1
  79. package/dist/esm/core-flow/Parallel.js.map +1 -1
  80. package/dist/esm/events/registry.js +10 -0
  81. package/dist/esm/events/registry.js.map +1 -1
  82. package/dist/esm/index.js +21 -1
  83. package/dist/esm/index.js.map +1 -1
  84. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js +15 -8
  85. package/dist/esm/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  86. package/dist/esm/recorders/core/ContextEvaluatedRecorder.js +31 -0
  87. package/dist/esm/recorders/core/ContextEvaluatedRecorder.js.map +1 -0
  88. package/dist/esm/recorders/core/ContextRecorder.js +12 -14
  89. package/dist/esm/recorders/core/ContextRecorder.js.map +1 -1
  90. package/dist/esm/recorders/core/ErrorBridge.js +59 -0
  91. package/dist/esm/recorders/core/ErrorBridge.js.map +1 -0
  92. package/dist/esm/recorders/core/ReliabilityRecorder.js +29 -0
  93. package/dist/esm/recorders/core/ReliabilityRecorder.js.map +1 -0
  94. package/dist/esm/recorders/observability/BoundaryRecorder.js +23 -0
  95. package/dist/esm/recorders/observability/BoundaryRecorder.js.map +1 -1
  96. package/dist/esm/recorders/observability/LiveStateRecorder.js +8 -0
  97. package/dist/esm/recorders/observability/LiveStateRecorder.js.map +1 -1
  98. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +1 -0
  99. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  100. package/dist/esm/reliability/buildReliabilityGateChart.js +10 -4
  101. package/dist/esm/reliability/buildReliabilityGateChart.js.map +1 -1
  102. package/dist/events/registry.js +10 -0
  103. package/dist/events/registry.js.map +1 -1
  104. package/dist/index.js +26 -3
  105. package/dist/index.js.map +1 -1
  106. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js +15 -8
  107. package/dist/lib/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  108. package/dist/recorders/core/ContextEvaluatedRecorder.js +35 -0
  109. package/dist/recorders/core/ContextEvaluatedRecorder.js.map +1 -0
  110. package/dist/recorders/core/ContextRecorder.js +11 -13
  111. package/dist/recorders/core/ContextRecorder.js.map +1 -1
  112. package/dist/recorders/core/ErrorBridge.js +64 -0
  113. package/dist/recorders/core/ErrorBridge.js.map +1 -0
  114. package/dist/recorders/core/ReliabilityRecorder.js +33 -0
  115. package/dist/recorders/core/ReliabilityRecorder.js.map +1 -0
  116. package/dist/recorders/observability/BoundaryRecorder.js +23 -0
  117. package/dist/recorders/observability/BoundaryRecorder.js.map +1 -1
  118. package/dist/recorders/observability/LiveStateRecorder.js +8 -0
  119. package/dist/recorders/observability/LiveStateRecorder.js.map +1 -1
  120. package/dist/recorders/observability/commentary/commentaryTemplates.js +1 -0
  121. package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  122. package/dist/reliability/buildReliabilityGateChart.js +10 -4
  123. package/dist/reliability/buildReliabilityGateChart.js.map +1 -1
  124. package/dist/types/cache/CacheDecisionSubflow.d.ts +7 -10
  125. package/dist/types/cache/CacheDecisionSubflow.d.ts.map +1 -1
  126. package/dist/types/cache/CacheGateDecider.d.ts +16 -2
  127. package/dist/types/cache/CacheGateDecider.d.ts.map +1 -1
  128. package/dist/types/cache/cacheRecorder.d.ts.map +1 -1
  129. package/dist/types/conventions.d.ts +101 -1
  130. package/dist/types/conventions.d.ts.map +1 -1
  131. package/dist/types/core/Agent.d.ts +8 -0
  132. package/dist/types/core/Agent.d.ts.map +1 -1
  133. package/dist/types/core/LLMCall.d.ts +48 -12
  134. package/dist/types/core/LLMCall.d.ts.map +1 -1
  135. package/dist/types/core/RunnerBase.d.ts +12 -0
  136. package/dist/types/core/RunnerBase.d.ts.map +1 -1
  137. package/dist/types/core/agent/buildAgentChart.d.ts +31 -18
  138. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  139. package/dist/types/core/agent/buildAgentMessageApiChart.d.ts +41 -0
  140. package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -0
  141. package/dist/types/core/agent/buildCacheSubflow.d.ts +36 -0
  142. package/dist/types/core/agent/buildCacheSubflow.d.ts.map +1 -0
  143. package/dist/types/core/agent/buildDynamicAgentChart.d.ts +57 -0
  144. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -0
  145. package/dist/types/core/agent/buildMessageApiChart.d.ts +48 -0
  146. package/dist/types/core/agent/buildMessageApiChart.d.ts.map +1 -0
  147. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  148. package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -1
  149. package/dist/types/core/agent/types.d.ts +69 -2
  150. package/dist/types/core/agent/types.d.ts.map +1 -1
  151. package/dist/types/core/humanizeLLMError.d.ts +24 -0
  152. package/dist/types/core/humanizeLLMError.d.ts.map +1 -0
  153. package/dist/types/core/slots/buildMessagesSlot.d.ts.map +1 -1
  154. package/dist/types/events/payloads.d.ts +84 -0
  155. package/dist/types/events/payloads.d.ts.map +1 -1
  156. package/dist/types/events/registry.d.ts +11 -1
  157. package/dist/types/events/registry.d.ts.map +1 -1
  158. package/dist/types/index.d.ts +4 -1
  159. package/dist/types/index.d.ts.map +1 -1
  160. package/dist/types/lib/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
  161. package/dist/types/recorders/core/ContextEvaluatedRecorder.d.ts +24 -0
  162. package/dist/types/recorders/core/ContextEvaluatedRecorder.d.ts.map +1 -0
  163. package/dist/types/recorders/core/ContextRecorder.d.ts +0 -2
  164. package/dist/types/recorders/core/ContextRecorder.d.ts.map +1 -1
  165. package/dist/types/recorders/core/ErrorBridge.d.ts +39 -0
  166. package/dist/types/recorders/core/ErrorBridge.d.ts.map +1 -0
  167. package/dist/types/recorders/core/ReliabilityRecorder.d.ts +25 -0
  168. package/dist/types/recorders/core/ReliabilityRecorder.d.ts.map +1 -0
  169. package/dist/types/recorders/observability/BoundaryRecorder.d.ts +7 -0
  170. package/dist/types/recorders/observability/BoundaryRecorder.d.ts.map +1 -1
  171. package/dist/types/recorders/observability/LiveStateRecorder.d.ts.map +1 -1
  172. package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
  173. package/dist/types/reliability/buildReliabilityGateChart.d.ts.map +1 -1
  174. package/package.json +4 -3
  175. package/dist/core/agent/stages/iterationStart.js +0 -24
  176. package/dist/core/agent/stages/iterationStart.js.map +0 -1
  177. package/dist/esm/core/agent/stages/iterationStart.js +0 -20
  178. package/dist/esm/core/agent/stages/iterationStart.js.map +0 -1
  179. package/dist/types/core/agent/stages/iterationStart.d.ts +0 -16
  180. package/dist/types/core/agent/stages/iterationStart.d.ts.map +0 -1
@@ -1,15 +1,42 @@
1
1
  /**
2
- * LLMCall — the leaf primitive for a single LLM invocation (no tools, no loop).
2
+ * LLMCall — the leaf primitive for a single LLM invocation (no tools).
3
3
  *
4
4
  * Pattern: Builder (GoF) → produces a Runner backed by a footprintjs FlowChart.
5
- * Role: Layer-5 primitive (core/). Uses the 3-slot model internally:
6
- * Seed sf-system-prompt sf-messages sf-tools call-llm
7
- * Slot subflows write convention-keyed injections observed by
8
- * ContextRecorder. The call-llm stage typedEmits stream.llm_start
9
- * and stream.llm_end observed by StreamRecorder.
10
- * Emits: Through its internally-attached recorders:
11
- * agentfootprint.stream.llm_start / llm_end
12
- * agentfootprint.context.injected / slot_composed
5
+ *
6
+ * Chart shape outer client wrapper around an inner llm-subflow:
7
+ *
8
+ * Client sf-llm-call loopTo(client)
9
+ *
10
+ * Outer `Client` stage:
11
+ * - First visit: receives args, writes userMessage to scope.
12
+ * - Second visit (after the loop completes): $break()s with
13
+ * scope.answer as the chart's TraversalResult.
14
+ *
15
+ * Inner `sf-llm-call` subflow (drill-down view):
16
+ * Initialize → sf-system-prompt → sf-messages → call-llm
17
+ * → [sf-thinking if handler] → extract-final
18
+ *
19
+ * NO `sf-tools` slot — LLMCall has no tools by design (that's Agent's
20
+ * territory). Atomic LLMCall's lens chart is a clean 3-node top-level
21
+ * view (Client + LLM + loop edge) that drills into the real flowchart
22
+ * below.
23
+ *
24
+ * Loop semantics: LLMCall is one-shot. The loop fires once; the
25
+ * second Client visit immediately breaks. The shape is identical to
26
+ * chat-mode (future): swap `$break()` for `pause()` and the same
27
+ * chart supports multi-turn conversation.
28
+ *
29
+ * Slot subflows write convention-keyed injections observed by
30
+ * ContextRecorder. The call-llm stage typedEmits stream.llm_start
31
+ * and stream.llm_end observed by StreamRecorder. When a
32
+ * `ThinkingHandler` resolves for the provider, `sf-thinking` mounts
33
+ * automatically (auto-wired by provider.name — same convention Agent
34
+ * uses).
35
+ *
36
+ * Emits (through internally-attached recorders):
37
+ * agentfootprint.stream.llm_start / llm_end
38
+ * agentfootprint.context.injected / slot_composed
39
+ * agentfootprint.stream.thinking_end (when sf-thinking mounted)
13
40
  */
14
41
  import { type FlowchartCheckpoint, type RunOptions, type StructureRecorder } from 'footprintjs';
15
42
  import type { GroupMetadata, GroupTranslator } from './translator.js';
@@ -45,7 +72,7 @@ export interface LLMCallOptions {
45
72
  * Optional build-time recorders threaded into footprintjs's
46
73
  * `flowChart()` factory. Each recorder observes per-node build
47
74
  * events (`onStageAdded` / `onSubflowMounted` / etc.) for this
48
- * LLMCall's internal chart (Seed + slot mounts + CallLLM). When
75
+ * LLMCall's internal chart (Initialize + slot mounts + CallLLM). When
49
76
  * omitted, no build-time observation is wired up.
50
77
  */
51
78
  readonly structureRecorders?: readonly StructureRecorder[];
@@ -76,14 +103,23 @@ export declare class LLMCall extends RunnerBase<LLMCallInput, LLMCallOutput> {
76
103
  private readonly costBudget?;
77
104
  private readonly structureRecorders?;
78
105
  private readonly groupTranslator?;
106
+ /** Auto-resolved from provider.name at construction time (same
107
+ * convention Agent uses — see findThinkingHandler). When undefined,
108
+ * sf-thinking is NOT mounted and the chart has zero thinking
109
+ * overhead (build-time conditional mount). */
110
+ private readonly thinkingHandler?;
79
111
  private currentRunContext;
80
112
  constructor(opts: LLMCallOptions, systemPromptValue: string);
81
113
  static create(opts: LLMCallOptions): LLMCallBuilder;
82
114
  protected getGroupTranslator(): GroupTranslator | undefined;
83
115
  /** LLMCall has no nested-runner members (slots are subflows of
84
- * the LLMCall's own chart, not Runner instances). The 3 slot ids
116
+ * the LLMCall's own chart, not Runner instances). The slot ids
85
117
  * are surfaced via `extra` so Lens can render the slot cards
86
- * inside an LLMCall card without inspecting `buildTimeStructure`. */
118
+ * inside an LLMCall card without inspecting `buildTimeStructure`.
119
+ *
120
+ * TWO slots only — LLMCall does not have tools (that's Agent's
121
+ * affordance). Atomic LLMCall renders as a clean 2-pill card in
122
+ * collapsed (top-level) view. */
87
123
  protected buildUIGroupMetadata(): GroupMetadata;
88
124
  run(input: LLMCallInput, options?: RunOptions): Promise<LLMCallOutput | RunnerPauseOutcome>;
89
125
  resume(checkpoint: FlowchartCheckpoint, input?: unknown, options?: RunOptions): Promise<LLMCallOutput | RunnerPauseOutcome>;
@@ -1 +1 @@
1
- {"version":3,"file":"LLMCall.d.ts","sourceRoot":"","sources":["../../../src/core/LLMCall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;A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EAAE,cAAc;IAIhC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK5B,KAAK,IAAI,OAAO;CAGjB"}
@@ -65,6 +65,18 @@ export declare abstract class RunnerBase<TIn = unknown, TOut = unknown> implemen
65
65
  * across multi-turn reuse of the same runner instance).
66
66
  */
67
67
  getLastSnapshot(): ReturnType<FlowChartExecutor['getSnapshot']> | undefined;
68
+ /**
69
+ * Alias for `getLastSnapshot()` that mirrors `FlowChartExecutor.getSnapshot()`
70
+ * so consumers (lens, playground, ExplainableShell) can read the live or
71
+ * just-completed snapshot through the same method name they'd use on a
72
+ * footprintjs executor — without having to know whether they're holding
73
+ * an agentfootprint Runner or a raw executor.
74
+ *
75
+ * During an active run, returns the live snapshot (commit log + execution
76
+ * tree built incrementally as stages execute). Between runs, returns the
77
+ * last completed run's snapshot. Undefined before any run has started.
78
+ */
79
+ getSnapshot(): ReturnType<FlowChartExecutor['getSnapshot']> | undefined;
68
80
  /**
69
81
  * Return the footprintjs FlowChart for this runner — the canonical
70
82
  * design-time blueprint. STABLE REFERENCE across calls (`getSpec()
@@ -1 +1 @@
1
- {"version":3,"file":"RunnerBase.d.ts","sourceRoot":"","sources":["../../../src/core/RunnerBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAGV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;A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,EAAE;IAI9C;;;;OAIG;IACH,SAAS,CAAC,aAAa,IAAI,eAAe;CAG3C"}
@@ -15,27 +15,27 @@
15
15
  *
16
16
  * Chart shape:
17
17
  *
18
- * Seed
18
+ * Initialize
19
19
  * → [memory READ subflows for each .memory()]
20
- * → InjectionEngine (subflow)
21
- * → SystemPrompt (slot subflow)
22
- * Messages (slot subflow)
23
- * Tools (slot subflow)
24
- * → CacheDecision (subflow)
20
+ * → InjectionEngine (subflow) ← loop target (tool-calls loops here)
21
+ * → Context (selector, PARALLEL fan-out, failFast)
22
+ * {System Prompt ‖ Messages ‖ Tools} (slot subflows)
23
+ * converge
25
24
  * → UpdateSkillHistory
26
- * → CacheGate (decider) ApplyMarkers / SkipCaching
27
- * IterationStart
28
- * → CallLLM
29
- * → Route (decider) tool-calls (pausable) / final (subflow)
30
- * |
31
- * ┌────── PrepareFinal ▼
25
+ * → Cache (sf-cache subflow: decideCacheMarkers CacheGate
26
+ * ApplyMarkers / SkipCaching)
27
+ * → CallLLM (also emits the per-iteration iteration_start marker)
28
+ * → [NormalizeThinking] (subflow, only when a ThinkingHandler resolved)
29
+ * → Route (decider)
30
+ * ├─ tool-calls (pausable) → loopTo(InjectionEngine) ← branch-sourced loop
31
+ * └─ final (subflow) → terminal leaf
32
+ * ┌────── PrepareFinal
32
33
  * ├──── [memory WRITE subflows]
33
34
  * └──── BreakFinal ($break)
34
- * loopTo(InjectionEngine)
35
35
  *
36
36
  * (When v2.11.x reliability is configured, the reliability gate chart
37
- * mounts as a subflow between IterationStart and CallLLM with a
38
- * TranslateFailFast stage after it. Lands in the next commit.)
37
+ * mounts as a subflow before CallLLM with a TranslateFailFast stage
38
+ * after it. Lands in the next commit.)
39
39
  */
40
40
  import type { FlowChart, StructureRecorder } from 'footprintjs';
41
41
  import type { CachePolicy } from '../../cache/types.js';
@@ -55,7 +55,6 @@ export interface AgentChartDeps {
55
55
  * inputMapper for max-iteration policies. */
56
56
  readonly maxIterations: number;
57
57
  readonly seed: (scope: never) => void;
58
- readonly iterationStart: (scope: never) => void;
59
58
  readonly callLLM: (scope: never) => Promise<void>;
60
59
  readonly routeDecider: (scope: never) => 'tool-calls' | 'final';
61
60
  readonly toolCallsHandler: import('footprintjs').PausableHandler<never>;
@@ -71,9 +70,23 @@ export interface AgentChartDeps {
71
70
  * zero overhead for non-thinking agents (build-time conditional mount).
72
71
  */
73
72
  readonly thinkingSubflow?: FlowChart;
74
- readonly cacheDecisionSubflow: FlowChart;
75
73
  readonly updateSkillHistoryStage: (scope: never) => void;
76
- readonly cacheGateDecide: (scope: never) => unknown;
74
+ /**
75
+ * Whether ≥1 Skill is registered. The `UpdateSkillHistory` stage (and
76
+ * therefore the cache's skill-churn rule) is mounted ONLY when true:
77
+ * with no skills the window would record "no skill" every iteration and
78
+ * `detectSkillChurn` could never fire, so the stage would be pure dead
79
+ * weight + a misleading box. Mirrors the `skills.length > 0` gate that
80
+ * auto-attaches `read_skill`, and the `thinkingSubflow` conditional mount.
81
+ */
82
+ readonly hasSkills: boolean;
83
+ /**
84
+ * ReAct loop semantics. `'dynamic'` (default) re-runs the InjectionEngine +
85
+ * all 3 slots every iteration (loop → InjectionEngine). `'classic'`
86
+ * engineers context ONCE (InjectionEngine + system-prompt + tools up front)
87
+ * and loops only the Messages slot (loop → Messages). See AgentOptions.reactMode.
88
+ */
89
+ readonly reactMode?: 'classic' | 'dynamic';
77
90
  /** Structure recorders threaded into both `flowChart()` calls (the
78
91
  * main chart and the PrepareFinal sub-chart). Each recorder
79
92
  * observes per-node build events (`onStageAdded` /
@@ -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,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,s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AAS,CAAC;IAMrC,QAAQ,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEzD;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAG3C;;;;0CAIsC;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAqT/D"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * buildAgentMessageApiChart — the Agent (ReAct) form of the messageAPI
3
+ * merge-tree, as ONE FLAT main chart (no inner LLM-call sub-box).
4
+ *
5
+ * The whole ReAct cycle lives directly in the single Agent chart:
6
+ *
7
+ * Context (ROOT selector — inits + picks which context slots to engineer)
8
+ * ├─ system-prompt ┐
9
+ * ├─ messages ─────┼─→ messageAPI → Call-LLM
10
+ * └─ tools ────────┘
11
+ * → Route (decider) → [ ToolCalls (execute) → loop ] / Final (response)
12
+ * loopTo(Context)
13
+ *
14
+ * WHY flat (the user's call): the entire agent — context engineering, the LLM
15
+ * call, routing, tool execution, the loop, and the final response — is ONE
16
+ * visible flowchart in ONE Agent box. No nested LLM-call box: Lens wraps the
17
+ * whole chart in the Agent main-box and renders the slots as pills. This is
18
+ * simpler than the composed (sf-llm-call subflow) shape and avoids box-in-box
19
+ * nesting entirely.
20
+ *
21
+ * The three context slots are DIRECT children of Context; all converge at
22
+ * messageAPI (which assembles system-prompt + messages); Call-LLM then sends
23
+ * the assembled payload plus the tool schemas. Route decides tool-calls (loop)
24
+ * vs final (terminate). The same chart serves Static and Dynamic agents — only
25
+ * which slots the Context selector lights per iteration differs.
26
+ */
27
+ import type { FlowChart } from 'footprintjs';
28
+ import type { LLMProvider, LLMToolSchema } from '../../adapters/types.js';
29
+ export interface AgentMessageApiChartDeps {
30
+ readonly provider: LLMProvider;
31
+ readonly model: string;
32
+ readonly systemPrompt: string;
33
+ readonly tools: readonly LLMToolSchema[];
34
+ readonly maxIterations?: number;
35
+ readonly structureRecorders?: readonly import('footprintjs').StructureRecorder[];
36
+ }
37
+ /**
38
+ * Build the Agent merge-tree chart as one flat ReAct flowchart.
39
+ */
40
+ export declare function buildAgentMessageApiChart(deps: AgentMessageApiChartDeps): FlowChart;
41
+ //# sourceMappingURL=buildAgentMessageApiChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildAgentMessageApiChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildAgentMessageApiChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAc,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA8BtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,OAAO,aAAa,EAAE,iBAAiB,EAAE,CAAC;CAClF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,GAAG,SAAS,CA8LnF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * buildCacheSubflow — the per-turn prompt-cache decision, as ONE subflow.
3
+ *
4
+ * Collapses the cache machinery into a single `sf-cache` boundary so the
5
+ * agent chart reads cleanly (one "Cache" box you can drill into) while the
6
+ * execution tree stays honest:
7
+ *
8
+ * decideCacheMarkers → CacheGate (decider) → ApplyMarkers / SkipCaching
9
+ *
10
+ * Layering (see src/cache/types.ts):
11
+ * - This subflow is the provider-AGNOSTIC DECISION layer — it only computes
12
+ * and gates provider-neutral `CacheMarker[]`. It knows nothing about any
13
+ * provider.
14
+ * - The provider-SPECIFIC MECHANISM (Anthropic `cache_control`, OpenAI
15
+ * automatic, …) is the attached provider's `CacheStrategy`, selected by
16
+ * `provider.name`, applied later when the request is built.
17
+ *
18
+ * Why `UpdateSkillHistory` is NOT in here: the `skillHistory` rolling window
19
+ * must persist across loop iterations. Keeping `UpdateSkillHistory` in the
20
+ * main loop (just before this subflow) lets `skillHistory` live in the parent
21
+ * scope without round-tripping through this subflow's in/out mappers — the
22
+ * subflow stays pure (reads the turn's state, writes only `cacheMarkers`).
23
+ *
24
+ * Deps-free: every input (`activeInjections`, `iteration`, `skillHistory`,
25
+ * `recentHitRate`, `systemPromptCachePolicy`, …) is supplied by the PARENT's
26
+ * `inputMapper` at the mount site; the output is just `cacheMarkers`.
27
+ */
28
+ import { type FlowChart } from 'footprintjs';
29
+ /**
30
+ * Build the `sf-cache` subflow chart. Called by `buildAgentChart` and
31
+ * `buildDynamicAgentChart` and mounted via `addSubFlowChartNext(
32
+ * SUBFLOW_IDS.CACHE, buildCacheSubflow(), 'Cache', { inputMapper,
33
+ * outputMapper, arrayMerge: Replace })`.
34
+ */
35
+ export declare function buildCacheSubflow(): FlowChart;
36
+ //# sourceMappingURL=buildCacheSubflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCacheSubflow.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildCacheSubflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,CAqC7C"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * buildDynamicAgentChart — the Dynamic-ReAct agent chart, where the
3
+ * whole LLM turn (context engineering + the call) is ONE `sf-llm-call`
4
+ * subflow, exactly like the `LLMCall` primitive produces.
5
+ *
6
+ * WHY a second builder (vs `buildAgentChart`)
7
+ * ───────────────────────────────────────────
8
+ * `buildAgentChart` mounts the LLM as a flat `call-llm` STAGE with the
9
+ * slot subflows as its siblings. That renders as nothing in Lens — a
10
+ * bare stage is dropped by the subflow-level collapser, so the slots
11
+ * have no LLM card to fold into and the chart comes up empty.
12
+ *
13
+ * This builder wraps that same region in an `sf-llm-call` SUBFLOW. The
14
+ * payoff is purely structural — Lens already maps `sf-llm-call → LLM
15
+ * group` (same boundary `LLMCall` produces), so the Dynamic agent
16
+ * renders as an LLM group with its slots inside, a peer Tool node, and
17
+ * the loop arc, with ZERO Lens-specific special-casing.
18
+ *
19
+ * The data flow is IDENTICAL to `buildAgentChart` — every stage handler
20
+ * + slot subflow is reused verbatim from the same `AgentChartDeps`. The
21
+ * ONLY new thing is the subflow boundary, which means:
22
+ *
23
+ * • A small inner seed (`dynamicTurnSeed`) initialises the per-turn
24
+ * working keys the OUTER seed used to set, since the inner subflow
25
+ * gets a fresh scope each loop re-entry.
26
+ * • Cross-iteration accumulators (token totals, cost counters,
27
+ * skill-history) round-trip out→in: the boundary `outputMapper`
28
+ * bubbles them to the outer scope, and the next iteration's
29
+ * `inputMapper` feeds them back under `prior*` aliases (because
30
+ * keys passed via `inputMapper` are FROZEN inside the subflow —
31
+ * `ScopeFacade.setValue` throws on them — so the writable working
32
+ * key must have a different name from the read-only input).
33
+ *
34
+ * Chart shape (mirrors the diagram the team locked):
35
+ *
36
+ * Initialize
37
+ * → [memory READ subflows]
38
+ * → sf-llm-call (SUBFLOW — same boundary LLMCall produces)
39
+ * dynamicTurnSeed → InjectionEngine
40
+ * → Context (selector, PARALLEL fan-out, failFast)
41
+ * ⇉ {System Prompt ‖ Messages ‖ Tools} → converge
42
+ * → UpdateSkillHistory → Cache (sf-cache subflow)
43
+ * → CallLLM (emits iteration_start) → [NormalizeThinking]
44
+ * → Route (decider)
45
+ * ├─ tool-calls (pausable) → loopTo(sf-llm-call) ← branch-sourced loop
46
+ * └─ sf-final (the answer) → terminal leaf
47
+ *
48
+ * Classic ReAct keeps using `buildAgentChart` until its own shape is
49
+ * designed — this builder is Dynamic-only.
50
+ */
51
+ import type { FlowChart } from 'footprintjs';
52
+ import type { AgentChartDeps } from './buildAgentChart.js';
53
+ /**
54
+ * Build the Dynamic-ReAct agent chart from the shared `AgentChartDeps`.
55
+ */
56
+ export declare function buildDynamicAgentChart(deps: AgentChartDeps): FlowChart;
57
+ //# sourceMappingURL=buildDynamicAgentChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildDynamicAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAUzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgD3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAkTtE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * buildMessageApiChart — PROOF of the locked "messageAPI merge-tree" shape
3
+ * (MENTAL_MODEL.md ★ LOCKED DESIGN), LLM-only (no tools subflow yet).
4
+ *
5
+ * This is Step 1 of the agreed build order: prove the Context-selector →
6
+ * slot subflows → messageAPI stage → Call-LLM tree works + renders, BEFORE
7
+ * bringing it to the Agent (Step 2 adds the tools subflow + the loop).
8
+ *
9
+ * Chart shape (LLM-only):
10
+ *
11
+ * Seed
12
+ * → Context (SELECTOR stage — picks which slots to engineer)
13
+ * ├─ sf-system-prompt ┐ (selected branches run in parallel)
14
+ * └─ sf-messages ──────┴─→ messageAPI stage (the join point)
15
+ * → Call-LLM
16
+ *
17
+ * WHY a selector (not a plain fork): "Context = Selector stage" — it RETURNS
18
+ * the list of slot branch ids to engineer this iteration, and `select()`
19
+ * captures evidence (which slots + why). That is what will unify Static and
20
+ * Dynamic agent in ONE chart later: Static picks only `messages` per loop;
21
+ * Dynamic also picks `system-prompt` (and `tools`) when they re-engineer.
22
+ * The picked-set IS the lit/unlit-pill signal. For this LLM-only proof the
23
+ * selector picks BOTH slots (a one-shot call engineers everything once).
24
+ *
25
+ * WHY messageAPI is a REAL stage: it assembles the LLM request bulk that the
26
+ * agent's `callLLM` builds invisibly today (callLLM.ts:132) — `systemPrompt`
27
+ * (separate field) + `messages` (the conversation, incl. tool-results) → the
28
+ * message-API payload. Making it a stage makes that assembly visible +
29
+ * inspectable in Lens/Trace. (Tools is a separate field added at Call-LLM —
30
+ * it joins in Step 2.)
31
+ *
32
+ * Slots are REAL subflows (reused verbatim: buildSystemPromptSlot /
33
+ * buildMessagesSlot) writing the convention INJECTION_KEYS, so ContextRecorder
34
+ * emits context.injected and Lens renders them — no bespoke collapser.
35
+ */
36
+ import type { FlowChart } from 'footprintjs';
37
+ import type { LLMProvider } from '../../adapters/types.js';
38
+ export interface MessageApiChartDeps {
39
+ readonly provider: LLMProvider;
40
+ readonly model: string;
41
+ readonly systemPrompt: string;
42
+ readonly structureRecorders?: readonly import('footprintjs').StructureRecorder[];
43
+ }
44
+ /**
45
+ * Build the LLM-only messageAPI merge-tree chart.
46
+ */
47
+ export declare function buildMessageApiChart(deps: MessageApiChartDeps): FlowChart;
48
+ //# sourceMappingURL=buildMessageApiChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildMessageApiChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildMessageApiChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAC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AK,EAAE,gBAAgB,EAAE,CAAC,SAAI,GAAG,OAAO,CAQlF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAKlC,CAAC"}
1
+ {"version":3,"file":"reliabilityExecution.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/reliabilityExecution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAWvF,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;qEACqE;AACrE,MAAM,MAAM,SAAS,GAAG,CACtB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE;IACL;;qBAEiB;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,KACE,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAChB,IAAI,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC;QACxC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CAOF;AAED;0EAC0E;AAC1E,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,EAC7B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,iBAAiB,EACzB,eAAe,EAAE,WAAW,EAC5B,mBAAmB,EAAE,MAAM,EAC3B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,SAAS;AACjB;;;;;iEAKiE;AACjE,YAAY,CAAC,EAAE,qBAAqB,GACnC,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA8ZlC;AAwCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,EAAE,CAAC,SAAI,GAAG,OAAO,CAQlF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAKlC,CAAC"}
@@ -15,6 +15,7 @@ import type { ActiveInjection } from '../../lib/injection-engine/types.js';
15
15
  import type { InjectionRecord } from '../../recorders/core/types.js';
16
16
  import type { MemoryIdentity } from '../../memory/identity/types.js';
17
17
  import type { ThinkingBlock } from '../../thinking/types.js';
18
+ import type { ReliabilityScope } from '../../reliability/types.js';
18
19
  export interface AgentOptions {
19
20
  readonly provider: LLMProvider;
20
21
  /** Human-friendly name shown in events/metrics. Default: 'Agent'. */
@@ -69,8 +70,8 @@ export interface AgentOptions {
69
70
  /**
70
71
  * Optional build-time recorders threaded into footprintjs's
71
72
  * `flowChart()` factory. Each recorder fires `onStageAdded` once per
72
- * node in the Agent's internal chart (Seed, IterationStart, CallLLM,
73
- * Route, tool handler, slot mounts, PrepareFinal, BreakFinal), and
73
+ * node in the Agent's internal chart (Seed, CallLLM, Route, tool
74
+ * handler, slot mounts, PrepareFinal, BreakFinal), and
74
75
  * `onSubflowMounted` once per mounted subflow. Recorders own their
75
76
  * own accumulators — agentfootprint just threads them through.
76
77
  *
@@ -93,6 +94,58 @@ export interface AgentOptions {
93
94
  * Returns `undefined` when omitted.
94
95
  */
95
96
  readonly groupTranslator?: GroupTranslator;
97
+ /**
98
+ * Chart structure for the ReAct loop. Default `'flat'` keeps the
99
+ * historical shape (`buildAgentChart`): the LLM call is a bare
100
+ * `call-llm` STAGE with the slot subflows as its siblings.
101
+ *
102
+ * `'subflow'` wraps the whole LLM turn (injection engine + the 3
103
+ * slots + cache + the call + thinking) in a single `sf-llm-call`
104
+ * SUBFLOW — the SAME boundary the `LLMCall` primitive produces. This
105
+ * is the structurally-correct shape: the LLM invocation IS a subflow,
106
+ * so Lens (and any explainable-ui consumer) renders it as an LLM
107
+ * group with its slots inside, with zero bespoke collapsing. Behaviour
108
+ * is identical to `'flat'`; only the chart's nesting differs.
109
+ *
110
+ * Opt-in while the subflow shape proves out; will become the default
111
+ * once verified end-to-end. See `agent/buildDynamicAgentChart.ts`.
112
+ */
113
+ readonly reactStructure?: 'flat' | 'subflow';
114
+ /**
115
+ * ReAct loop SEMANTICS — how much of the request is re-engineered each
116
+ * iteration. Default `'dynamic'`.
117
+ *
118
+ * `'dynamic'` (default) — every iteration re-runs the InjectionEngine and
119
+ * all three slots (system-prompt ‖ messages ‖ tools), because which
120
+ * injections are active can change per turn (a skill activates, a rule
121
+ * fires, a tool-return triggers something). The loop targets the
122
+ * InjectionEngine. This is the right shape when the agent uses skills,
123
+ * rule/on-tool-return triggers, or any per-turn context steering.
124
+ *
125
+ * `'classic'` — textbook ReAct: context is engineered ONCE. The
126
+ * InjectionEngine, system-prompt and tools run a single time up front;
127
+ * the loop targets only the Messages slot, so each iteration just appends
128
+ * the new tool result and re-calls the LLM. Use this when the system
129
+ * prompt and tool set are fixed for the whole run (the common case). The
130
+ * chart then reads honestly — `ToolCalls → Messages` loops, the static
131
+ * slots sit outside the loop.
132
+ *
133
+ * Both modes produce identical LLM requests for a static agent (no dynamic
134
+ * triggers); `'classic'` just avoids re-computing fixed slots and shows in the
135
+ * chart that only the messages re-run (after turn 1 only the Messages slot
136
+ * lights up). Implementation-wise the chart is the SAME as Dynamic — the only
137
+ * difference is that the Context selector stops re-selecting the system-prompt
138
+ * and tools slots after the first turn, so their outputs are reused.
139
+ *
140
+ * CAVEAT: because the static slots are cached after turn 1, `'classic'` is for
141
+ * agents whose system-prompt + tools are FIXED. If you register skills or
142
+ * dynamic-trigger injections (rule / on-tool-return / llm-activated), an
143
+ * activation that happens mid-run would NOT surface into the cached
144
+ * system-prompt/tools — use `'dynamic'` (the default) for those. Currently
145
+ * `'classic'` uses the flat chart shape (the `reactStructure: 'subflow'`
146
+ * grouping re-seeds context every turn by design, so it stays dynamic-only).
147
+ */
148
+ readonly reactMode?: 'classic' | 'dynamic';
96
149
  }
97
150
  export interface AgentInput {
98
151
  readonly message: string;
@@ -208,5 +261,19 @@ export interface AgentState {
208
261
  * `scope.history` (ensures Anthropic signature round-trip). Empty
209
262
  * array when no thinking present. */
210
263
  thinkingBlocks: readonly ThinkingBlock[];
264
+ /** Set when the rules-based reliability loop takes the fail-fast path.
265
+ * `Agent.run()` reads these from the post-run snapshot and throws a
266
+ * typed `ReliabilityFailFastError`. Mirrors `policyHalt*` — because the
267
+ * loop stops the chart with `$break` (not a throw), durable scope is the
268
+ * only courier of the structured fail context across the break to the
269
+ * API boundary. (Telemetry ALSO fires via the `reliability.fail_fast`
270
+ * emit event; these scope fields are the business-logic control signal.) */
271
+ reliabilityFailKind?: string;
272
+ reliabilityFailPayload?: ReliabilityScope['failPayload'];
273
+ reliabilityFailReason?: string;
274
+ /** Originating error message/name — stringified because Error objects
275
+ * don't survive footprintjs's `structuredClone` of scope. */
276
+ reliabilityFailCauseMessage?: string;
277
+ reliabilityFailCauseName?: string;
211
278
  }
212
279
  //# 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,EAAE,iBAAiB,EAAE,MAAM,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AE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,yCAAyC;IACzC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B;;;6EAGyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;0CAIsC;IACtC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IAGzC;;;;;;iFAM6E;IAC7E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;kEAC8D;IAC9D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * humanizeLLMError — turn a raw provider/SDK error into a plain-language
3
+ * sentence a NON-developer can act on.
4
+ *
5
+ * agentfootprint targets vibe-coding / non-developer builders. A raw
6
+ * "[browser-anthropic] Failed to fetch" or "401 Unauthorized" means
7
+ * nothing to them. This maps the common failure shapes to a friendly,
8
+ * actionable message. The raw error is preserved on `.cause` (and via
9
+ * `wrapLLMError`) so developers can still dig in.
10
+ *
11
+ * Pure + dependency-light: string/shape matching only. Extend the cases
12
+ * as new provider failure modes surface — keep each message short and
13
+ * tell the user what to DO.
14
+ */
15
+ /** Map a thrown provider/SDK error to a friendly, actionable sentence. */
16
+ export declare function humanizeLLMError(err: unknown): string;
17
+ /**
18
+ * Wrap a raw provider error in a fresh Error whose `.message` is the
19
+ * humanized sentence, preserving the original on `.cause` for developers
20
+ * (and "Copy for LLM"). Re-throw this from the LLM call site so the
21
+ * friendly message flows through onError → onRunFailed → the monitor.
22
+ */
23
+ export declare function wrapLLMError(err: unknown): Error;
24
+ //# sourceMappingURL=humanizeLLMError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humanizeLLMError.d.ts","sourceRoot":"","sources":["../../../src/core/humanizeLLMError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAUH,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA8CrD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAIhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildMessagesSlot.d.ts","sourceRoot":"","sources":["../../../../src/core/slots/buildMessagesSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMzE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,kBAAuB,GAAG,SAAS,CA6D5E"}
1
+ {"version":3,"file":"buildMessagesSlot.d.ts","sourceRoot":"","sources":["../../../../src/core/slots/buildMessagesSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMzE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,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