agentfootprint 7.25.0 → 7.27.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 (185) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +5 -3
  3. package/ai-instructions/claude-code/SKILL.md +1 -1
  4. package/dist/adapters/hosting/agentcore.js +4 -0
  5. package/dist/adapters/hosting/agentcore.js.map +1 -1
  6. package/dist/adapters/llm/AnthropicProvider.js +10 -0
  7. package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
  8. package/dist/adapters/llm/BedrockProvider.js +13 -1
  9. package/dist/adapters/llm/BedrockProvider.js.map +1 -1
  10. package/dist/adapters/llm/BrowserAnthropicProvider.js +6 -0
  11. package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  12. package/dist/adapters/llm/BrowserOpenAIProvider.js +18 -0
  13. package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
  14. package/dist/adapters/llm/MockProvider.js +9 -0
  15. package/dist/adapters/llm/MockProvider.js.map +1 -1
  16. package/dist/adapters/llm/OpenAIProvider.js +21 -0
  17. package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
  18. package/dist/conventions.js +12 -0
  19. package/dist/conventions.js.map +1 -1
  20. package/dist/core/Agent.js +56 -2
  21. package/dist/core/Agent.js.map +1 -1
  22. package/dist/core/agent/AgentBuilder.js +98 -1
  23. package/dist/core/agent/AgentBuilder.js.map +1 -1
  24. package/dist/core/agent/buildAgentChart.js +12 -2
  25. package/dist/core/agent/buildAgentChart.js.map +1 -1
  26. package/dist/core/agent/buildDynamicAgentChart.js +12 -3
  27. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  28. package/dist/core/agent/outputEnforcement.js +192 -0
  29. package/dist/core/agent/outputEnforcement.js.map +1 -0
  30. package/dist/core/agent/stages/callLLM.js +31 -1
  31. package/dist/core/agent/stages/callLLM.js.map +1 -1
  32. package/dist/core/agent/stages/outputRetry.js +102 -0
  33. package/dist/core/agent/stages/outputRetry.js.map +1 -0
  34. package/dist/core/agent/stages/route.js +111 -6
  35. package/dist/core/agent/stages/route.js.map +1 -1
  36. package/dist/core/outputSchema.js.map +1 -1
  37. package/dist/esm/adapters/hosting/agentcore.d.ts +22 -0
  38. package/dist/esm/adapters/hosting/agentcore.js +4 -0
  39. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  40. package/dist/esm/adapters/llm/AnthropicProvider.d.ts +10 -0
  41. package/dist/esm/adapters/llm/AnthropicProvider.js +10 -0
  42. package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
  43. package/dist/esm/adapters/llm/BedrockProvider.d.ts +9 -0
  44. package/dist/esm/adapters/llm/BedrockProvider.js +13 -1
  45. package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
  46. package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +1 -0
  47. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +6 -0
  48. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  49. package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +4 -0
  50. package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +18 -0
  51. package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
  52. package/dist/esm/adapters/llm/MockProvider.d.ts +9 -0
  53. package/dist/esm/adapters/llm/MockProvider.js +9 -0
  54. package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
  55. package/dist/esm/adapters/llm/OpenAIProvider.d.ts +12 -0
  56. package/dist/esm/adapters/llm/OpenAIProvider.js +21 -0
  57. package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
  58. package/dist/esm/adapters/types.d.ts +46 -0
  59. package/dist/esm/conventions.d.ts +4 -0
  60. package/dist/esm/conventions.js +12 -0
  61. package/dist/esm/conventions.js.map +1 -1
  62. package/dist/esm/core/Agent.d.ts +26 -1
  63. package/dist/esm/core/Agent.js +56 -2
  64. package/dist/esm/core/Agent.js.map +1 -1
  65. package/dist/esm/core/agent/AgentBuilder.d.ts +15 -0
  66. package/dist/esm/core/agent/AgentBuilder.js +98 -1
  67. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  68. package/dist/esm/core/agent/buildAgentChart.d.ts +13 -1
  69. package/dist/esm/core/agent/buildAgentChart.js +12 -2
  70. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  71. package/dist/esm/core/agent/buildDynamicAgentChart.js +12 -3
  72. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  73. package/dist/esm/core/agent/outputEnforcement.d.ts +173 -0
  74. package/dist/esm/core/agent/outputEnforcement.js +180 -0
  75. package/dist/esm/core/agent/outputEnforcement.js.map +1 -0
  76. package/dist/esm/core/agent/stages/callLLM.d.ts +15 -0
  77. package/dist/esm/core/agent/stages/callLLM.js +31 -1
  78. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  79. package/dist/esm/core/agent/stages/outputRetry.d.ts +34 -0
  80. package/dist/esm/core/agent/stages/outputRetry.js +98 -0
  81. package/dist/esm/core/agent/stages/outputRetry.js.map +1 -0
  82. package/dist/esm/core/agent/stages/route.d.ts +18 -2
  83. package/dist/esm/core/agent/stages/route.js +111 -6
  84. package/dist/esm/core/agent/stages/route.js.map +1 -1
  85. package/dist/esm/core/agent/types.d.ts +18 -0
  86. package/dist/esm/core/outputSchema.d.ts +51 -0
  87. package/dist/esm/core/outputSchema.js.map +1 -1
  88. package/dist/esm/events/payloads.d.ts +47 -1
  89. package/dist/esm/events/registry.d.ts +3 -1
  90. package/dist/esm/events/registry.js +2 -0
  91. package/dist/esm/events/registry.js.map +1 -1
  92. package/dist/esm/hosting/httpHost.d.ts +75 -1
  93. package/dist/esm/hosting/httpHost.js +186 -10
  94. package/dist/esm/hosting/httpHost.js.map +1 -1
  95. package/dist/esm/hosting/nodeHost.d.ts +31 -0
  96. package/dist/esm/hosting/nodeHost.js +9 -0
  97. package/dist/esm/hosting/nodeHost.js.map +1 -1
  98. package/dist/esm/hosting/webSocketConversation.d.ts +5 -0
  99. package/dist/esm/hosting/webSocketConversation.js +79 -19
  100. package/dist/esm/hosting/webSocketConversation.js.map +1 -1
  101. package/dist/esm/hosting/webSocketFrames.d.ts +6 -0
  102. package/dist/esm/hosting/webSocketFrames.js +6 -0
  103. package/dist/esm/hosting/webSocketFrames.js.map +1 -1
  104. package/dist/esm/index.d.ts +2 -1
  105. package/dist/esm/index.js +5 -0
  106. package/dist/esm/index.js.map +1 -1
  107. package/dist/esm/resilience/withCircuitBreaker.js +5 -0
  108. package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
  109. package/dist/esm/resilience/withFallback.js +5 -0
  110. package/dist/esm/resilience/withFallback.js.map +1 -1
  111. package/dist/esm/resilience/withRetry.js +6 -0
  112. package/dist/esm/resilience/withRetry.js.map +1 -1
  113. package/dist/events/registry.js +2 -0
  114. package/dist/events/registry.js.map +1 -1
  115. package/dist/hosting/httpHost.js +186 -10
  116. package/dist/hosting/httpHost.js.map +1 -1
  117. package/dist/hosting/nodeHost.js +9 -0
  118. package/dist/hosting/nodeHost.js.map +1 -1
  119. package/dist/hosting/webSocketConversation.js +79 -19
  120. package/dist/hosting/webSocketConversation.js.map +1 -1
  121. package/dist/hosting/webSocketFrames.js +6 -0
  122. package/dist/hosting/webSocketFrames.js.map +1 -1
  123. package/dist/index.js +9 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/resilience/withCircuitBreaker.js +5 -0
  126. package/dist/resilience/withCircuitBreaker.js.map +1 -1
  127. package/dist/resilience/withFallback.js +5 -0
  128. package/dist/resilience/withFallback.js.map +1 -1
  129. package/dist/resilience/withRetry.js +6 -0
  130. package/dist/resilience/withRetry.js.map +1 -1
  131. package/dist/types/adapters/hosting/agentcore.d.ts +22 -0
  132. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  133. package/dist/types/adapters/llm/AnthropicProvider.d.ts +10 -0
  134. package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
  135. package/dist/types/adapters/llm/BedrockProvider.d.ts +9 -0
  136. package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
  137. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts +1 -0
  138. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
  139. package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +4 -0
  140. package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
  141. package/dist/types/adapters/llm/MockProvider.d.ts +9 -0
  142. package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
  143. package/dist/types/adapters/llm/OpenAIProvider.d.ts +12 -0
  144. package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
  145. package/dist/types/adapters/types.d.ts +46 -0
  146. package/dist/types/adapters/types.d.ts.map +1 -1
  147. package/dist/types/conventions.d.ts +4 -0
  148. package/dist/types/conventions.d.ts.map +1 -1
  149. package/dist/types/core/Agent.d.ts +26 -1
  150. package/dist/types/core/Agent.d.ts.map +1 -1
  151. package/dist/types/core/agent/AgentBuilder.d.ts +15 -0
  152. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  153. package/dist/types/core/agent/buildAgentChart.d.ts +13 -1
  154. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  155. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  156. package/dist/types/core/agent/outputEnforcement.d.ts +174 -0
  157. package/dist/types/core/agent/outputEnforcement.d.ts.map +1 -0
  158. package/dist/types/core/agent/stages/callLLM.d.ts +15 -0
  159. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  160. package/dist/types/core/agent/stages/outputRetry.d.ts +35 -0
  161. package/dist/types/core/agent/stages/outputRetry.d.ts.map +1 -0
  162. package/dist/types/core/agent/stages/route.d.ts +18 -2
  163. package/dist/types/core/agent/stages/route.d.ts.map +1 -1
  164. package/dist/types/core/agent/types.d.ts +18 -0
  165. package/dist/types/core/agent/types.d.ts.map +1 -1
  166. package/dist/types/core/outputSchema.d.ts +51 -0
  167. package/dist/types/core/outputSchema.d.ts.map +1 -1
  168. package/dist/types/events/payloads.d.ts +47 -1
  169. package/dist/types/events/payloads.d.ts.map +1 -1
  170. package/dist/types/events/registry.d.ts +3 -1
  171. package/dist/types/events/registry.d.ts.map +1 -1
  172. package/dist/types/hosting/httpHost.d.ts +75 -1
  173. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  174. package/dist/types/hosting/nodeHost.d.ts +31 -0
  175. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  176. package/dist/types/hosting/webSocketConversation.d.ts +5 -0
  177. package/dist/types/hosting/webSocketConversation.d.ts.map +1 -1
  178. package/dist/types/hosting/webSocketFrames.d.ts +6 -0
  179. package/dist/types/hosting/webSocketFrames.d.ts.map +1 -1
  180. package/dist/types/index.d.ts +2 -1
  181. package/dist/types/index.d.ts.map +1 -1
  182. package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
  183. package/dist/types/resilience/withFallback.d.ts.map +1 -1
  184. package/dist/types/resilience/withRetry.d.ts.map +1 -1
  185. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ /**
2
+ * outputRetry — the branch that asks again when the answer failed the schema.
3
+ *
4
+ * Mounted as a THIRD branch of the Route decider, and only on an agent that
5
+ * opted into `.outputSchema(parser, { retries })`. It carries `{ loopTo }`
6
+ * to the same target the `tool-calls` branch loops to, which is the whole
7
+ * mechanism: a retry is not a special mode, it is one more ordinary turn of
8
+ * the ReAct loop. The injection engine re-evaluates, the slots recompose,
9
+ * the cache decides, the model is called — so the attempt gets its own
10
+ * `iteration_start` / `llm_start` / `llm_end` bracket and its own `cost.tick`
11
+ * against `costBudget`.
12
+ *
13
+ * That is the difference from the in-stage schema retry the reliability gate
14
+ * has done since v2.13. There, N attempts happen inside ONE `call-llm` stage:
15
+ * one bracket for all of them, and one cost tick carrying only the last
16
+ * attempt's usage — attempts that were genuinely billed and are invisible in
17
+ * the recording. Here every attempt is a turn, and the recording says so.
18
+ *
19
+ * The two layers compose rather than collide. With `.reliability()` also
20
+ * configured, its in-stage rules run FIRST and decide what to do with a
21
+ * response before it is committed; `retries` governs answers that WERE
22
+ * committed and turned out invalid.
23
+ *
24
+ * Pure function apart from its enforcement config — no closure over Agent
25
+ * class state.
26
+ */
27
+ import type { TypedScope } from 'footprintjs';
28
+ import { type ResolvedOutputEnforcement } from '../outputEnforcement.js';
29
+ import type { AgentState } from '../types.js';
30
+ /**
31
+ * Build the retry stage. `enforcement.retries` is the cap the decider already
32
+ * checked before routing here — this stage does the work of asking again.
33
+ */
34
+ export declare function buildOutputRetryStage(enforcement: ResolvedOutputEnforcement): (scope: TypedScope<AgentState>) => void;
@@ -0,0 +1,98 @@
1
+ /**
2
+ * outputRetry — the branch that asks again when the answer failed the schema.
3
+ *
4
+ * Mounted as a THIRD branch of the Route decider, and only on an agent that
5
+ * opted into `.outputSchema(parser, { retries })`. It carries `{ loopTo }`
6
+ * to the same target the `tool-calls` branch loops to, which is the whole
7
+ * mechanism: a retry is not a special mode, it is one more ordinary turn of
8
+ * the ReAct loop. The injection engine re-evaluates, the slots recompose,
9
+ * the cache decides, the model is called — so the attempt gets its own
10
+ * `iteration_start` / `llm_start` / `llm_end` bracket and its own `cost.tick`
11
+ * against `costBudget`.
12
+ *
13
+ * That is the difference from the in-stage schema retry the reliability gate
14
+ * has done since v2.13. There, N attempts happen inside ONE `call-llm` stage:
15
+ * one bracket for all of them, and one cost tick carrying only the last
16
+ * attempt's usage — attempts that were genuinely billed and are invisible in
17
+ * the recording. Here every attempt is a turn, and the recording says so.
18
+ *
19
+ * The two layers compose rather than collide. With `.reliability()` also
20
+ * configured, its in-stage rules run FIRST and decide what to do with a
21
+ * response before it is committed; `retries` governs answers that WERE
22
+ * committed and turned out invalid.
23
+ *
24
+ * Pure function apart from its enforcement config — no closure over Agent
25
+ * class state.
26
+ */
27
+ import { typedEmit } from '../../../recorders/core/typedEmit.js';
28
+ import { buildCorrectiveTurn, correctiveMessageHash, recordOutputAttempt, } from '../outputEnforcement.js';
29
+ /**
30
+ * Build the retry stage. `enforcement.retries` is the cap the decider already
31
+ * checked before routing here — this stage does the work of asking again.
32
+ */
33
+ export function buildOutputRetryStage(enforcement) {
34
+ return (scope) => {
35
+ const iteration = scope.iteration;
36
+ const failure = scope.outputSchemaFailure;
37
+ if (failure === undefined) {
38
+ // Unreachable through the decider, which writes the carrier immediately
39
+ // before routing here. Returning quietly rather than throwing keeps a
40
+ // hand-built chart that mounts this branch without the decider from
41
+ // taking down a run over a missing diagnostic.
42
+ return;
43
+ }
44
+ const failedAnswer = scope.llmLatestContent;
45
+ const [answerTurn, correctionTurn] = buildCorrectiveTurn(failedAnswer, failure, {
46
+ attempt: failure.attempt,
47
+ // The total the run may spend: the first attempt plus its retries.
48
+ totalAttempts: enforcement.retries + 1,
49
+ });
50
+ const hash = correctiveMessageHash(correctionTurn.content);
51
+ // The conversation, as it really went: the answer that failed, then the
52
+ // correction. A plain local array — a TypedScope array read is a live
53
+ // proxy view, and both the commit and the event payload below must be
54
+ // detached plain data.
55
+ const newHistory = [
56
+ ...scope.history,
57
+ answerTurn,
58
+ correctionTurn,
59
+ ];
60
+ scope.history = newHistory;
61
+ recordOutputAttempt(scope, {
62
+ attempt: failure.attempt,
63
+ iteration,
64
+ outcome: 'retried',
65
+ stage: failure.stage,
66
+ error: failure.error,
67
+ ...(failure.path !== undefined && { path: failure.path }),
68
+ correctiveMessageHash: hash,
69
+ });
70
+ typedEmit(scope, 'agentfootprint.agent.output_schema_retry', {
71
+ attempt: failure.attempt,
72
+ // What is left AFTER this correction — `0` means this is the last ask.
73
+ retriesRemaining: enforcement.retries - failure.attempt,
74
+ iteration,
75
+ stage: failure.stage,
76
+ error: failure.error,
77
+ ...(failure.path !== undefined && { path: failure.path }),
78
+ correctiveMessageHash: hash,
79
+ });
80
+ // Close this iteration's bracket before the loop turns. Every recorder
81
+ // that synthesizes steps counts on `iteration_start` and `iteration_end`
82
+ // pairing per `iterIndex`, and the crash-checkpoint tracker takes its
83
+ // history snapshot from this payload — so a retry that skipped it would
84
+ // leave a run with one more start than end and a checkpoint one turn
85
+ // behind the conversation.
86
+ typedEmit(scope, 'agentfootprint.agent.iteration_end', {
87
+ turnIndex: 0,
88
+ iterIndex: iteration,
89
+ toolCallCount: 0,
90
+ history: newHistory,
91
+ });
92
+ // A retry consumes an iteration, exactly as a tool call does. It is one
93
+ // more real turn against the agent's declared budget, and the iteration
94
+ // counter is the vocabulary every bracket in the run is keyed on.
95
+ scope.iteration = iteration + 1;
96
+ };
97
+ }
98
+ //# sourceMappingURL=outputRetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputRetry.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/outputRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GAEpB,MAAM,yBAAyB,CAAC;AAGjC;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAsC;IAEtC,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,SAAS,GAAG,KAAK,CAAC,SAAmB,CAAC;QAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAC1C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,wEAAwE;YACxE,sEAAsE;YACtE,oEAAoE;YACpE,+CAA+C;YAC/C,OAAO;QACT,CAAC;QAED,MAAM,YAAY,GAAG,KAAK,CAAC,gBAA0B,CAAC;QACtD,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE;YAC9E,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,mEAAmE;YACnE,aAAa,EAAE,WAAW,CAAC,OAAO,GAAG,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,CAAC,CAAC;QAEH,wEAAwE;QACxE,wEAAwE;QACxE,kEAAkE;QAClE,KAAK,CAAC,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC"}
@@ -15,7 +15,8 @@
15
15
  import type { TypedScope } from 'footprintjs';
16
16
  import type { AgentState } from '../types.js';
17
17
  import type { MessageMiddleware } from '../middleware/types.js';
18
- export type RouteBranch = 'tool-calls' | 'final';
18
+ import { type ResolvedOutputEnforcement } from '../outputEnforcement.js';
19
+ export type RouteBranch = 'tool-calls' | 'final' | 'output-retry';
19
20
  export declare const routeDeciderStage: (scope: TypedScope<AgentState>) => RouteBranch;
20
21
  /**
21
22
  * Build the Route decider, optionally carrying the `'output'` half of the
@@ -43,5 +44,20 @@ export declare const routeDeciderStage: (scope: TypedScope<AgentState>) => Route
43
44
  * would be running it over something that is not the output.
44
45
  *
45
46
  * Empty chain → the exact synchronous decider this file has always exported.
47
+ *
48
+ * ## Why the schema is judged HERE too
49
+ *
50
+ * The same property that made this the output seam makes it the enforcement
51
+ * seam. `outputSchema` used to be judged only at the caller's boundary, after
52
+ * the run — a fine place to reject an answer and a useless place to fix one,
53
+ * because the loop has already stopped. Judged here, one stage before the
54
+ * Final branch, the run still HAS a loop: a failed answer can route to
55
+ * `'output-retry'`, which loops back for one more real turn.
56
+ *
57
+ * The judging runs AFTER the message chain, over the content the chain
58
+ * produced, because that is the string the caller will receive — validating
59
+ * the pre-chain value would judge an answer nobody gets. A DENIED answer is
60
+ * never judged or retried: it was withheld on purpose, and re-asking for it
61
+ * would be the library working around a rule the app wrote.
46
62
  */
47
- export declare function buildRouteDeciderStage(messageMiddleware?: readonly MessageMiddleware[]): (scope: TypedScope<AgentState>) => RouteBranch | Promise<RouteBranch>;
63
+ export declare function buildRouteDeciderStage(messageMiddleware?: readonly MessageMiddleware[], enforcement?: ResolvedOutputEnforcement): (scope: TypedScope<AgentState>) => RouteBranch | Promise<RouteBranch>;
@@ -15,20 +15,35 @@
15
15
  import { typedEmit } from '../../../recorders/core/typedEmit.js';
16
16
  import { runMessageChain } from '../middleware/runChain.js';
17
17
  import { recordDecisions } from '../middleware/ledger.js';
18
- export const routeDeciderStage = (scope) => {
18
+ import { judgeAnswer, recordOutputAttempt, } from '../outputEnforcement.js';
19
+ /** The base decision, with the sentence that explains it. Split out so the
20
+ * enforcement-enabled path can decide, then judge, then announce ONCE — an
21
+ * agent whose answer is about to be re-asked should not have a route event
22
+ * saying it finished. */
23
+ function decideBranch(scope) {
19
24
  const toolCalls = scope.llmLatestToolCalls;
20
25
  const iteration = scope.iteration;
21
26
  const chosen = toolCalls.length > 0 && iteration < scope.maxIterations ? 'tool-calls' : 'final';
22
- typedEmit(scope, 'agentfootprint.agent.route_decided', {
23
- turnIndex: 0,
24
- iterIndex: iteration,
27
+ return {
25
28
  chosen,
26
29
  rationale: chosen === 'tool-calls'
27
30
  ? `LLM requested ${toolCalls.length} tool call(s)`
28
31
  : iteration >= scope.maxIterations
29
32
  ? 'maxIterations reached — forcing final'
30
33
  : 'LLM produced no tool calls — final answer',
34
+ };
35
+ }
36
+ function emitRouteDecided(scope, chosen, rationale) {
37
+ typedEmit(scope, 'agentfootprint.agent.route_decided', {
38
+ turnIndex: 0,
39
+ iterIndex: scope.iteration,
40
+ chosen,
41
+ rationale,
31
42
  });
43
+ }
44
+ export const routeDeciderStage = (scope) => {
45
+ const { chosen, rationale } = decideBranch(scope);
46
+ emitRouteDecided(scope, chosen, rationale);
32
47
  return chosen;
33
48
  };
34
49
  /**
@@ -57,11 +72,28 @@ export const routeDeciderStage = (scope) => {
57
72
  * would be running it over something that is not the output.
58
73
  *
59
74
  * Empty chain → the exact synchronous decider this file has always exported.
75
+ *
76
+ * ## Why the schema is judged HERE too
77
+ *
78
+ * The same property that made this the output seam makes it the enforcement
79
+ * seam. `outputSchema` used to be judged only at the caller's boundary, after
80
+ * the run — a fine place to reject an answer and a useless place to fix one,
81
+ * because the loop has already stopped. Judged here, one stage before the
82
+ * Final branch, the run still HAS a loop: a failed answer can route to
83
+ * `'output-retry'`, which loops back for one more real turn.
84
+ *
85
+ * The judging runs AFTER the message chain, over the content the chain
86
+ * produced, because that is the string the caller will receive — validating
87
+ * the pre-chain value would judge an answer nobody gets. A DENIED answer is
88
+ * never judged or retried: it was withheld on purpose, and re-asking for it
89
+ * would be the library working around a rule the app wrote.
60
90
  */
61
- export function buildRouteDeciderStage(messageMiddleware) {
91
+ export function buildRouteDeciderStage(messageMiddleware, enforcement) {
62
92
  const chain = messageMiddleware ?? [];
63
- if (chain.length === 0)
93
+ if (chain.length === 0 && enforcement === undefined)
64
94
  return routeDeciderStage;
95
+ if (enforcement !== undefined)
96
+ return buildEnforcingDecider(chain, enforcement);
65
97
  return async (scope) => {
66
98
  const chosen = routeDeciderStage(scope);
67
99
  if (chosen !== 'final')
@@ -89,4 +121,77 @@ export function buildRouteDeciderStage(messageMiddleware) {
89
121
  return chosen;
90
122
  };
91
123
  }
124
+ /**
125
+ * The decider an agent with `.outputSchema(parser, { retries })` runs:
126
+ * decide, run the output chain if there is one, judge the answer, THEN
127
+ * announce the branch — so `route_decided` names the branch the run actually
128
+ * took rather than the one it was heading for.
129
+ */
130
+ function buildEnforcingDecider(chain, enforcement) {
131
+ return async (scope) => {
132
+ const base = decideBranch(scope);
133
+ if (base.chosen !== 'final') {
134
+ emitRouteDecided(scope, base.chosen, base.rationale);
135
+ return base.chosen;
136
+ }
137
+ let denied = false;
138
+ if (chain.length > 0) {
139
+ const verdict = await runMessageChain(chain, {
140
+ phase: 'output',
141
+ content: scope.llmLatestContent,
142
+ history: [...scope.history],
143
+ iteration: scope.iteration,
144
+ ...(scope.runIdentity && { identity: scope.runIdentity }),
145
+ });
146
+ recordDecisions(scope, verdict.decisions);
147
+ if (verdict.kind === 'deny') {
148
+ denied = true;
149
+ scope.messageDeniedReason = verdict.reason;
150
+ scope.messageDeniedPhase = 'output';
151
+ scope.messageDeniedBy = verdict.middleware;
152
+ }
153
+ scope.llmLatestContent = verdict.content;
154
+ }
155
+ // A withheld answer is not judged and never re-asked. The app decided
156
+ // nobody gets this string; asking the model for a better-shaped version
157
+ // of it would be the library routing around that decision.
158
+ if (denied) {
159
+ emitRouteDecided(scope, 'final', base.rationale);
160
+ return 'final';
161
+ }
162
+ const attempt = (scope.outputAttempts?.length ?? 0) + 1;
163
+ const failure = judgeAnswer(scope.llmLatestContent, enforcement.parser);
164
+ if (failure === undefined) {
165
+ recordOutputAttempt(scope, {
166
+ attempt,
167
+ iteration: scope.iteration,
168
+ outcome: 'passed',
169
+ });
170
+ emitRouteDecided(scope, 'final', base.rationale);
171
+ return 'final';
172
+ }
173
+ if (attempt <= enforcement.retries) {
174
+ // The retry stage writes the correction and files the row, because it
175
+ // is the one that knows what it wrote. This is the hand-off.
176
+ scope.outputSchemaFailure = { attempt, ...failure };
177
+ emitRouteDecided(scope, 'output-retry', `final answer failed the output schema (${failure.stage}) — ` +
178
+ `asking again, attempt ${attempt + 1} of ${enforcement.retries + 1}`);
179
+ return 'output-retry';
180
+ }
181
+ // Out of retries. The answer stands as the run's answer; `runTyped()`
182
+ // throws on it at the boundary exactly as it did before any of this
183
+ // existed, and `.outputFallback()` still gets its turn there.
184
+ recordOutputAttempt(scope, {
185
+ attempt,
186
+ iteration: scope.iteration,
187
+ outcome: 'exhausted',
188
+ stage: failure.stage,
189
+ error: failure.error,
190
+ ...(failure.path !== undefined && { path: failure.path }),
191
+ });
192
+ emitRouteDecided(scope, 'final', `final answer failed the output schema (${failure.stage}) and ` +
193
+ `${enforcement.retries} retry/retries were spent`);
194
+ return 'final';
195
+ };
196
+ }
92
197
  //# sourceMappingURL=route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../src/core/agent/stages/route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2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C,SAAmB;gBACpC,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;YACH,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACjD,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACnC,sEAAsE;YACtE,6DAA6D;YAC7D,KAAK,CAAC,mBAAmB,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;YACpD,gBAAgB,CACd,KAAK,EACL,cAAc,EACd,0CAA0C,OAAO,CAAC,KAAK,MAAM;gBAC3D,yBAAyB,OAAO,GAAG,CAAC,OAAO,WAAW,CAAC,OAAO,GAAG,CAAC,EAAE,CACvE,CAAC;YACF,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,sEAAsE;QACtE,oEAAoE;QACpE,8DAA8D;QAC9D,mBAAmB,CAAC,KAAK,EAAE;YACzB,OAAO;YACP,SAAS,EAAE,KAAK,CAAC,SAAmB;YACpC,OAAO,EAAE,WAAW;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;SAC1D,CAAC,CAAC;QACH,gBAAgB,CACd,KAAK,EACL,OAAO,EACP,0CAA0C,OAAO,CAAC,KAAK,QAAQ;YAC7D,GAAG,WAAW,CAAC,OAAO,2BAA2B,CACpD,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
@@ -21,6 +21,7 @@ import type { ReliabilityScope } from '../../reliability/types.js';
21
21
  import type { WindowRecord } from './window/types.js';
22
22
  import type { MessagesDelivery } from './delivery/types.js';
23
23
  import type { MiddlewareDecision } from './middleware/types.js';
24
+ import type { OutputAttempt } from './outputEnforcement.js';
24
25
  /**
25
26
  * Dials for the deferred observer queue (RFC-001) — only meaningful with
26
27
  * `observerDelivery: 'deferred'` (passing them without it throws at
@@ -360,6 +361,23 @@ export interface AgentState {
360
361
  * taken later can find the moment the text changed and who changed it.
361
362
  * Written only by an agent that configured a chain; absent otherwise. */
362
363
  middlewareDecisions?: readonly MiddlewareDecision[];
364
+ /** One row per final-answer attempt, in order: what was answered, whether
365
+ * it satisfied the schema, and — when it did not — the validator's own
366
+ * words and the correction that went back. Read it from
367
+ * `snapshot.sharedState` to see why a run took three turns to answer.
368
+ * Written only by an agent that opted into `retries`; absent otherwise. */
369
+ outputAttempts?: readonly OutputAttempt[];
370
+ /** In-flight hand-off from the Route decider (which judges the answer and
371
+ * picks the branch) to the retry stage (which writes the correction). Not
372
+ * a record — the record is `outputAttempts`. Always freshly written by the
373
+ * decider immediately before the retry branch runs, so it is never read
374
+ * stale. */
375
+ outputSchemaFailure?: {
376
+ readonly attempt: number;
377
+ readonly stage: 'json-parse' | 'schema-validate';
378
+ readonly error: string;
379
+ readonly path?: string;
380
+ };
363
381
  /** Set by the seed / prepare-final stage when a `messageMiddleware` returned
364
382
  * `deny`. Read at the API boundary, where it becomes a `MessageDeniedError`.
365
383
  * Never carries the refused content — see MessageDeniedError. */
@@ -69,6 +69,21 @@ export interface OutputSchemaParser<T> {
69
69
  */
70
70
  readonly description?: string;
71
71
  }
72
+ /**
73
+ * How the schema reaches the model.
74
+ *
75
+ * • `'instruct'` (default) — the shape is described in the system prompt
76
+ * and the model is asked for JSON. Works on every provider, because it
77
+ * is only words.
78
+ * • `'tool-forced'` — the shape is presented as a synthetic tool and the
79
+ * provider's tool choice is FORCED to it, so generation is constrained
80
+ * at the source instead of requested in prose. Requires a provider that
81
+ * declares `carriesForcedToolChoice`; a provider that does not is
82
+ * refused BY NAME at run start rather than quietly downgraded, because
83
+ * a strategy that silently falls back to the other one is config that
84
+ * lies.
85
+ */
86
+ export type OutputSchemaStrategy = 'instruct' | 'tool-forced';
72
87
  /**
73
88
  * Optional configuration for `outputSchema`.
74
89
  */
@@ -88,6 +103,42 @@ export interface OutputSchemaOptions {
88
103
  * domain-specific framing.
89
104
  */
90
105
  readonly instruction?: string;
106
+ /**
107
+ * How many corrective re-asks the run may spend when the final answer
108
+ * fails the schema. Default `0` — the historical behaviour, where the
109
+ * first answer is the only answer and `runTyped()` throws on a bad one.
110
+ *
111
+ * Each retry is a REAL turn: the failed answer and an authored corrective
112
+ * message join the conversation, the ReAct loop re-enters, and the next
113
+ * attempt gets its own `llm_start`/`llm_end` bracket and its own
114
+ * `cost.tick` against `costBudget`. A retry therefore consumes one
115
+ * iteration of the agent's budget, the same way a tool call does.
116
+ *
117
+ * When the cap is spent the last answer stands and `runTyped()` throws
118
+ * `OutputSchemaError` exactly as it always has — `.outputFallback()`
119
+ * composes on top, unchanged.
120
+ */
121
+ readonly retries?: number;
122
+ /**
123
+ * How the schema reaches the model. Default `'instruct'`.
124
+ * See {@link OutputSchemaStrategy}.
125
+ */
126
+ readonly strategy?: OutputSchemaStrategy;
127
+ /**
128
+ * The JSON Schema for the synthetic tool, required by
129
+ * `strategy: 'tool-forced'` unless the parser can produce one itself
130
+ * (a `toJsonSchema()` method, which ArkType has). The library will not
131
+ * infer a shape from a `parse()` function — guessing what your schema
132
+ * means is not a thing it gets to do.
133
+ *
134
+ * This value and the parser CAN disagree. Nothing here prevents that,
135
+ * and nothing needs to: the forced shape satisfies the wire, the parser
136
+ * still judges the answer, and a disagreement surfaces as an ordinary
137
+ * validation failure that the retry loop corrects using the validator's
138
+ * own words. The schema constrains generation; the parser remains the
139
+ * judge.
140
+ */
141
+ readonly jsonSchema?: Readonly<Record<string, unknown>>;
91
142
  }
92
143
  /**
93
144
  * Thrown by `agent.parseOutput(...)` / `agent.runTyped(...)` when the
@@ -1 +1 @@
1
- {"version":3,"file":"outputSchema.js","sourceRoot":"","sources":["../../../src/core/outputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAC/C,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,iBAAiB,CAAC,iEAAiE,EAAE;YAC7F,SAAS,EAAE,GAAG;YACd,KAAK,EAAE,iBAAiB;YACxB,KAAK;SACN,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -106,7 +106,13 @@ export interface AgentIterationEndPayload {
106
106
  export interface AgentRouteDecidedPayload {
107
107
  readonly turnIndex: number;
108
108
  readonly iterIndex: number;
109
- readonly chosen: 'tool-calls' | 'final';
109
+ /**
110
+ * The branch the turn took. `'output-retry'` (7.26) appears only on an
111
+ * agent built with `.outputSchema(parser, { retries })`, and only on a
112
+ * turn whose answer failed the schema with retries left — the loop is
113
+ * about to ask again rather than finish.
114
+ */
115
+ readonly chosen: 'tool-calls' | 'final' | 'output-retry';
110
116
  readonly rationale?: string;
111
117
  }
112
118
  export interface AgentHandoffPayload {
@@ -621,6 +627,46 @@ export interface EvalThresholdCrossedPayload {
621
627
  * Fires BEFORE PostDecide rules evaluate, so observability sees the
622
628
  * failure even if a buggy rule routes to fail-fast or swallows it.
623
629
  */
630
+ /**
631
+ * Emitted (7.26) once per failed final answer that the run is about to
632
+ * ASK AGAIN about, on an agent built with
633
+ * `.outputSchema(parser, { retries })`.
634
+ *
635
+ * Its sibling `agent.output_schema_validation_failed` reports a failure the
636
+ * reliability gate is handling INSIDE one `call-llm` stage. This one reports
637
+ * a failure the LOOP is handling: the corrective message named here joins the
638
+ * conversation, the ReAct loop re-enters, and the next attempt arrives with
639
+ * its own `stream.llm_start` / `stream.llm_end` bracket and its own
640
+ * `cost.tick`. Subscribe to it to see how often a model needs a second ask —
641
+ * a leading indicator of drift, and of a schema that is harder to hit than
642
+ * its author thinks.
643
+ *
644
+ * Fires from the retry branch, after the corrective turn is committed, so a
645
+ * consumer that reads `snapshot.sharedState.outputAttempts` finds the
646
+ * matching row (joined by `correctiveMessageHash`) already there.
647
+ */
648
+ export interface AgentOutputSchemaRetryPayload {
649
+ /** 1-based attempt that just failed. `1` is the first answer. */
650
+ readonly attempt: number;
651
+ /** Corrective asks left AFTER this one. `0` means this is the last. */
652
+ readonly retriesRemaining: number;
653
+ /** The ReAct iteration the failed answer came from. A retry consumes an
654
+ * iteration, so the next attempt reports `iteration + 1`. */
655
+ readonly iteration: number;
656
+ /** Which half of validation failed — `'json-parse'` (the model emitted
657
+ * prose) vs `'schema-validate'` (JSON, wrong shape). They trend
658
+ * differently under model drift. */
659
+ readonly stage: 'json-parse' | 'schema-validate';
660
+ /** The validator's own message, verbatim. DATA, not narrative: it is
661
+ * quoted into the corrective message after an authored frame, and it is
662
+ * quoted here the same way. */
663
+ readonly error: string;
664
+ /** Failing field path when the parser exposes one (Zod-style issues). */
665
+ readonly path?: string;
666
+ /** `fnv1a` of the corrective message that went back to the model — the
667
+ * join to the message in `history` and to the `outputAttempts` row. */
668
+ readonly correctiveMessageHash: string;
669
+ }
624
670
  export interface AgentOutputSchemaValidationFailedPayload {
625
671
  /** Validation error message (from Zod / parser). */
626
672
  readonly message: string;
@@ -16,7 +16,7 @@
16
16
  * major bump. See agentfootprint_v2_detailed_design.md for rules.
17
17
  */
18
18
  import type { AgentfootprintEventEnvelope } from './types.js';
19
- import type { AgentHandoffPayload, AgentIterationEndPayload, AgentIterationStartPayload, AgentRouteDecidedPayload, AgentTurnEndPayload, AgentTurnStartPayload, CompositionEnterPayload, CompositionExitPayload, ConditionalRouteDecidedPayload, ContextBudgetPressurePayload, ContextEvaluatedPayload, ContextEvictedPayload, ContextInjectedPayload, ContextSlotComposedPayload, CostLimitHitPayload, CostTickPayload, EmbeddingGeneratedPayload, ErrorFatalPayload, ErrorRecoveredPayload, ErrorRetriedPayload, EvalScorePayload, EvalThresholdCrossedPayload, AgentOutputSchemaValidationFailedPayload, AgentThinkingParseFailedPayload, StreamThinkingDeltaPayload, StreamThinkingEndPayload, FallbackTriggeredPayload, LLMEndPayload, LLMStartPayload, LLMTokenPayload, LoopIterationExitPayload, LoopIterationStartPayload, MemoryAttachedPayload, MemoryDetachedPayload, MemoryStrategyAppliedPayload, MemoryWrittenPayload, ParallelBranchCompletePayload, ParallelForkStartPayload, ParallelMergeEndPayload, PauseRequestPayload, PauseResumePayload, CheckInRequestPayload, CheckInDecisionPayload, PermissionCheckPayload, PermissionGateClosedPayload, PermissionHaltPayload, PermissionGateOpenedPayload, CredentialRequestedPayload, CredentialAcquiredPayload, CredentialAuthorizationRequiredPayload, CredentialFailedPayload, ReliabilityFailFastPayload, ReliabilityRetriedPayload, ReliabilityRecoveredPayload, RiskFlaggedPayload, SkillActivatedPayload, SkillDeactivatedPayload, SkillRejectedPayload, ToolEndPayload, ToolsActivatedPayload, ToolsDeactivatedPayload, ToolsDiscoveryStartedPayload, ToolsDiscoveryCompletedPayload, ToolsDiscoveryFailedPayload, ToolsOfferedPayload, ToolStartPayload, ValidationArgsInvalidPayload, MiddlewareDecisionPayload } from './payloads.js';
19
+ import type { AgentHandoffPayload, AgentIterationEndPayload, AgentIterationStartPayload, AgentRouteDecidedPayload, AgentTurnEndPayload, AgentTurnStartPayload, CompositionEnterPayload, CompositionExitPayload, ConditionalRouteDecidedPayload, ContextBudgetPressurePayload, ContextEvaluatedPayload, ContextEvictedPayload, ContextInjectedPayload, ContextSlotComposedPayload, CostLimitHitPayload, CostTickPayload, EmbeddingGeneratedPayload, ErrorFatalPayload, ErrorRecoveredPayload, ErrorRetriedPayload, EvalScorePayload, EvalThresholdCrossedPayload, AgentOutputSchemaValidationFailedPayload, AgentOutputSchemaRetryPayload, AgentThinkingParseFailedPayload, StreamThinkingDeltaPayload, StreamThinkingEndPayload, FallbackTriggeredPayload, LLMEndPayload, LLMStartPayload, LLMTokenPayload, LoopIterationExitPayload, LoopIterationStartPayload, MemoryAttachedPayload, MemoryDetachedPayload, MemoryStrategyAppliedPayload, MemoryWrittenPayload, ParallelBranchCompletePayload, ParallelForkStartPayload, ParallelMergeEndPayload, PauseRequestPayload, PauseResumePayload, CheckInRequestPayload, CheckInDecisionPayload, PermissionCheckPayload, PermissionGateClosedPayload, PermissionHaltPayload, PermissionGateOpenedPayload, CredentialRequestedPayload, CredentialAcquiredPayload, CredentialAuthorizationRequiredPayload, CredentialFailedPayload, ReliabilityFailFastPayload, ReliabilityRetriedPayload, ReliabilityRecoveredPayload, RiskFlaggedPayload, SkillActivatedPayload, SkillDeactivatedPayload, SkillRejectedPayload, ToolEndPayload, ToolsActivatedPayload, ToolsDeactivatedPayload, ToolsDiscoveryStartedPayload, ToolsDiscoveryCompletedPayload, ToolsDiscoveryFailedPayload, ToolsOfferedPayload, ToolStartPayload, ValidationArgsInvalidPayload, MiddlewareDecisionPayload } from './payloads.js';
20
20
  export declare const EVENT_NAMES: {
21
21
  readonly composition: {
22
22
  readonly enter: "agentfootprint.composition.enter";
@@ -36,6 +36,7 @@ export declare const EVENT_NAMES: {
36
36
  readonly routeDecided: "agentfootprint.agent.route_decided";
37
37
  readonly handoff: "agentfootprint.agent.handoff";
38
38
  readonly outputSchemaValidationFailed: "agentfootprint.agent.output_schema_validation_failed";
39
+ readonly outputSchemaRetry: "agentfootprint.agent.output_schema_retry";
39
40
  readonly thinkingParseFailed: "agentfootprint.agent.thinking_parse_failed";
40
41
  };
41
42
  readonly stream: {
@@ -143,6 +144,7 @@ export interface AgentfootprintEventMap {
143
144
  'agentfootprint.agent.route_decided': AgentfootprintEventEnvelope<'agentfootprint.agent.route_decided', AgentRouteDecidedPayload>;
144
145
  'agentfootprint.agent.handoff': AgentfootprintEventEnvelope<'agentfootprint.agent.handoff', AgentHandoffPayload>;
145
146
  'agentfootprint.agent.output_schema_validation_failed': AgentfootprintEventEnvelope<'agentfootprint.agent.output_schema_validation_failed', AgentOutputSchemaValidationFailedPayload>;
147
+ 'agentfootprint.agent.output_schema_retry': AgentfootprintEventEnvelope<'agentfootprint.agent.output_schema_retry', AgentOutputSchemaRetryPayload>;
146
148
  'agentfootprint.agent.thinking_parse_failed': AgentfootprintEventEnvelope<'agentfootprint.agent.thinking_parse_failed', AgentThinkingParseFailedPayload>;
147
149
  'agentfootprint.stream.llm_start': AgentfootprintEventEnvelope<'agentfootprint.stream.llm_start', LLMStartPayload>;
148
150
  'agentfootprint.stream.llm_end': AgentfootprintEventEnvelope<'agentfootprint.stream.llm_end', LLMEndPayload>;
@@ -37,6 +37,7 @@ export const EVENT_NAMES = {
37
37
  routeDecided: 'agentfootprint.agent.route_decided',
38
38
  handoff: 'agentfootprint.agent.handoff',
39
39
  outputSchemaValidationFailed: 'agentfootprint.agent.output_schema_validation_failed',
40
+ outputSchemaRetry: 'agentfootprint.agent.output_schema_retry',
40
41
  thinkingParseFailed: 'agentfootprint.agent.thinking_parse_failed',
41
42
  },
42
43
  stream: {
@@ -148,6 +149,7 @@ export const ALL_EVENT_TYPES = [
148
149
  'agentfootprint.agent.route_decided',
149
150
  'agentfootprint.agent.handoff',
150
151
  'agentfootprint.agent.output_schema_validation_failed',
152
+ 'agentfootprint.agent.output_schema_retry',
151
153
  'agentfootprint.agent.thinking_parse_failed',
152
154
  'agentfootprint.stream.llm_start',
153
155
  'agentfootprint.stream.llm_end',
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/events/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA0EH,yEAAyE;AACzE,gEAAgE;AAChE,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,IAAI,EAAE,iCAAiC;QACvC,SAAS,EAAE,uCAAuC;QAClD,cAAc,EAAE,4CAA4C;QAC5D,QAAQ,EAAE,sCAAsC;QAChD,YAAY,EAAE,0CAA0C;QACxD,cAAc,EAAE,4CAA4C;QAC5D,aAAa,EAAE,2C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ACtC,oCAAoC;IACpC,iCAAiC;IACjC,gCAAgC;IAChC,sCAAsC;IACtC,wCAAwC;IACxC,kCAAkC;IAClC,wCAAwC;IACxC,gCAAgC;IAChC,gCAAgC;IAChC,+BAA+B;IAC/B,8BAA8B;IAC9B,gCAAgC;IAChC,kCAAkC;IAClC,wCAAwC;IACxC,0CAA0C;IAC1C,uCAAuC;IACvC,wCAAwC;IACxC,gCAAgC;IAChC,kCAAkC;IAClC,+BAA+B;IAC/B,iCAAiC;IACjC,uCAAuC;IACvC,uCAAuC;IACvC,gCAAgC;IAChC,qCAAqC;IACrC,oCAAoC;IACpC,kDAAkD;IAClD,kCAAkC;IAClC,6BAA6B;IAC7B,mCAAmC;IACnC,0BAA0B;IAC1B,+BAA+B;IAC/B,2BAA2B;IAC3B,uCAAuC;IACvC,8BAA8B;IAC9B,gCAAgC;IAChC,4BAA4B;IAC5B,sCAAsC;IACtC,oCAAoC;IACpC,sCAAsC;IACtC,8BAA8B;IAC9B,6BAA6B;IAC7B,gCAAgC;IAChC,iCAAiC;IACjC,oCAAoC;IACpC,oCAAoC;CAC5B,CAAC"}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/events/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA2EH,yEAAyE;AACzE,gEAAgE;AAChE,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,IAAI,EAAE,iCAAiC;QACvC,SAAS,EAAE,uCAAuC;QAClD,cAAc,EAAE,4CAA4C;QAC5D,QAAQ,EAAE,sCAAsC;QAChD,YAAY,EAAE,0CAA0C;QACxD,cAAc,EAAE,4CAA4C;QAC5D,aAAa,EAAE,2CAA2C;KAC3D;IACD,KAAK,EAAE;QACL,SAAS,EAAE,iCAAiC;QAC5C,OAAO,EAAE,+BAA+B;QACxC,cAAc,EAAE,sCAAsC;QACtD,YAAY,EAAE,oCAA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