agentfootprint 18.0.0 → 18.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 (558) hide show
  1. package/CAPABILITIES.md +2 -1
  2. package/dist/adapters/llm/BedrockProvider/client.js +93 -0
  3. package/dist/adapters/llm/BedrockProvider/client.js.map +1 -0
  4. package/dist/adapters/llm/BedrockProvider/guardedStream.js +150 -0
  5. package/dist/adapters/llm/BedrockProvider/guardedStream.js.map +1 -0
  6. package/dist/adapters/llm/BedrockProvider/guardedStreamBuffer.js +109 -0
  7. package/dist/adapters/llm/BedrockProvider/guardedStreamBuffer.js.map +1 -0
  8. package/dist/adapters/llm/BedrockProvider/guardrailClassify.js +189 -0
  9. package/dist/adapters/llm/BedrockProvider/guardrailClassify.js.map +1 -0
  10. package/dist/adapters/llm/BedrockProvider/guardrailConfig.js +79 -0
  11. package/dist/adapters/llm/BedrockProvider/guardrailConfig.js.map +1 -0
  12. package/dist/adapters/llm/BedrockProvider/guardrailRead.js +101 -0
  13. package/dist/adapters/llm/BedrockProvider/guardrailRead.js.map +1 -0
  14. package/dist/adapters/llm/BedrockProvider/guardrailResponse.js +81 -0
  15. package/dist/adapters/llm/BedrockProvider/guardrailResponse.js.map +1 -0
  16. package/dist/adapters/llm/BedrockProvider/guardrailSchemas.js +95 -0
  17. package/dist/adapters/llm/BedrockProvider/guardrailSchemas.js.map +1 -0
  18. package/dist/adapters/llm/BedrockProvider/request.js +119 -0
  19. package/dist/adapters/llm/BedrockProvider/request.js.map +1 -0
  20. package/dist/adapters/llm/BedrockProvider/response.js +107 -0
  21. package/dist/adapters/llm/BedrockProvider/response.js.map +1 -0
  22. package/dist/adapters/llm/BedrockProvider/stream.js +109 -0
  23. package/dist/adapters/llm/BedrockProvider/stream.js.map +1 -0
  24. package/dist/adapters/llm/BedrockProvider/types.js +3 -0
  25. package/dist/adapters/llm/BedrockProvider/types.js.map +1 -0
  26. package/dist/adapters/llm/BedrockProvider.js +48 -381
  27. package/dist/adapters/llm/BedrockProvider.js.map +1 -1
  28. package/dist/adapters/llm/MockProvider.js +1 -0
  29. package/dist/adapters/llm/MockProvider.js.map +1 -1
  30. package/dist/ag-ui/serializer/settle.js +110 -0
  31. package/dist/ag-ui/serializer/settle.js.map +1 -0
  32. package/dist/ag-ui/serializer/translate.js +310 -0
  33. package/dist/ag-ui/serializer/translate.js.map +1 -0
  34. package/dist/ag-ui/serializer/types.js +3 -0
  35. package/dist/ag-ui/serializer/types.js.map +1 -0
  36. package/dist/ag-ui/serializer/values.js +72 -0
  37. package/dist/ag-ui/serializer/values.js.map +1 -0
  38. package/dist/ag-ui/serializer.js +110 -543
  39. package/dist/ag-ui/serializer.js.map +1 -1
  40. package/dist/core/LLMCall/chart.js +294 -0
  41. package/dist/core/LLMCall/chart.js.map +1 -0
  42. package/dist/core/LLMCall.js +30 -314
  43. package/dist/core/LLMCall.js.map +1 -1
  44. package/dist/core/agent/buildAgentMessageApiChart.js +10 -5
  45. package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -1
  46. package/dist/core/agent/buildDynamicAgentChart/boundary.js +148 -0
  47. package/dist/core/agent/buildDynamicAgentChart/boundary.js.map +1 -0
  48. package/dist/core/agent/buildDynamicAgentChart/engineBoundary.js +122 -0
  49. package/dist/core/agent/buildDynamicAgentChart/engineBoundary.js.map +1 -0
  50. package/dist/core/agent/buildDynamicAgentChart/finalBranch.js +26 -0
  51. package/dist/core/agent/buildDynamicAgentChart/finalBranch.js.map +1 -0
  52. package/dist/core/agent/buildDynamicAgentChart.js +14 -263
  53. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  54. package/dist/core/agent/buildMessageApiChart.js +11 -6
  55. package/dist/core/agent/buildMessageApiChart.js.map +1 -1
  56. package/dist/core/agent/composeRequest.js +1 -1
  57. package/dist/core/agent/dynamicTurnSeed.js +2 -0
  58. package/dist/core/agent/dynamicTurnSeed.js.map +1 -1
  59. package/dist/core/agent/findings/answerText.js +1 -1
  60. package/dist/core/agent/receipt/receipt.js +2 -2
  61. package/dist/core/agent/runtime/admission/owner.js +1 -1
  62. package/dist/core/agent/runtime/admission/owner.js.map +1 -1
  63. package/dist/core/agent/runtime/terminal/verdicts.js +4 -0
  64. package/dist/core/agent/runtime/terminal/verdicts.js.map +1 -1
  65. package/dist/core/agent/stagedRefs.js +1 -1
  66. package/dist/core/agent/stagedRefs.js.map +1 -1
  67. package/dist/core/agent/stages/callLLM/acceptResponse.js +226 -0
  68. package/dist/core/agent/stages/callLLM/acceptResponse.js.map +1 -0
  69. package/dist/core/agent/stages/callLLM/executeCall.js +254 -0
  70. package/dist/core/agent/stages/callLLM/executeCall.js.map +1 -0
  71. package/dist/core/agent/stages/callLLM/prepareCall.js +467 -0
  72. package/dist/core/agent/stages/callLLM/prepareCall.js.map +1 -0
  73. package/dist/core/agent/stages/callLLM/responseAccounting.js +34 -0
  74. package/dist/core/agent/stages/callLLM/responseAccounting.js.map +1 -0
  75. package/dist/core/agent/stages/callLLM.js +34 -852
  76. package/dist/core/agent/stages/callLLM.js.map +1 -1
  77. package/dist/core/agent/stages/reliabilityExecution/contracts.js +28 -0
  78. package/dist/core/agent/stages/reliabilityExecution/contracts.js.map +1 -0
  79. package/dist/core/agent/stages/reliabilityExecution/feedback.js +40 -0
  80. package/dist/core/agent/stages/reliabilityExecution/feedback.js.map +1 -0
  81. package/dist/core/agent/stages/reliabilityExecution/stuckLoop.js +48 -0
  82. package/dist/core/agent/stages/reliabilityExecution/stuckLoop.js.map +1 -0
  83. package/dist/core/agent/stages/reliabilityExecution.js +18 -156
  84. package/dist/core/agent/stages/reliabilityExecution.js.map +1 -1
  85. package/dist/core/agent/toolChoice/record.js +1 -1
  86. package/dist/core/agent/window/toolNames.js +1 -1
  87. package/dist/core/providerIntervention.js +115 -0
  88. package/dist/core/providerIntervention.js.map +1 -0
  89. package/dist/core/slots/buildMessagesSlot.js +1 -1
  90. package/dist/core/terminalVerdict.js +3 -0
  91. package/dist/core/terminalVerdict.js.map +1 -1
  92. package/dist/core-flow/Graph.js +1 -1
  93. package/dist/core-flow/Parallel/builder.js +101 -0
  94. package/dist/core-flow/Parallel/builder.js.map +1 -0
  95. package/dist/core-flow/Parallel/chart.js +221 -0
  96. package/dist/core-flow/Parallel/chart.js.map +1 -0
  97. package/dist/core-flow/Parallel/mapper.js +41 -0
  98. package/dist/core-flow/Parallel/mapper.js.map +1 -0
  99. package/dist/core-flow/Parallel/merge.js +63 -0
  100. package/dist/core-flow/Parallel/merge.js.map +1 -0
  101. package/dist/core-flow/Parallel/types.js +3 -0
  102. package/dist/core-flow/Parallel/types.js.map +1 -0
  103. package/dist/core-flow/Parallel.js +19 -395
  104. package/dist/core-flow/Parallel.js.map +1 -1
  105. package/dist/esm/adapters/llm/BedrockProvider/client.d.ts +11 -0
  106. package/dist/esm/adapters/llm/BedrockProvider/client.js +87 -0
  107. package/dist/esm/adapters/llm/BedrockProvider/client.js.map +1 -0
  108. package/dist/esm/adapters/llm/BedrockProvider/guardedStream.d.ts +7 -0
  109. package/dist/esm/adapters/llm/BedrockProvider/guardedStream.js +145 -0
  110. package/dist/esm/adapters/llm/BedrockProvider/guardedStream.js.map +1 -0
  111. package/dist/esm/adapters/llm/BedrockProvider/guardedStreamBuffer.d.ts +21 -0
  112. package/dist/esm/adapters/llm/BedrockProvider/guardedStreamBuffer.js +105 -0
  113. package/dist/esm/adapters/llm/BedrockProvider/guardedStreamBuffer.js.map +1 -0
  114. package/dist/esm/adapters/llm/BedrockProvider/guardrailClassify.d.ts +8 -0
  115. package/dist/esm/adapters/llm/BedrockProvider/guardrailClassify.js +183 -0
  116. package/dist/esm/adapters/llm/BedrockProvider/guardrailClassify.js.map +1 -0
  117. package/dist/esm/adapters/llm/BedrockProvider/guardrailConfig.d.ts +30 -0
  118. package/dist/esm/adapters/llm/BedrockProvider/guardrailConfig.js +74 -0
  119. package/dist/esm/adapters/llm/BedrockProvider/guardrailConfig.js.map +1 -0
  120. package/dist/esm/adapters/llm/BedrockProvider/guardrailRead.d.ts +19 -0
  121. package/dist/esm/adapters/llm/BedrockProvider/guardrailRead.js +96 -0
  122. package/dist/esm/adapters/llm/BedrockProvider/guardrailRead.js.map +1 -0
  123. package/dist/esm/adapters/llm/BedrockProvider/guardrailResponse.d.ts +13 -0
  124. package/dist/esm/adapters/llm/BedrockProvider/guardrailResponse.js +74 -0
  125. package/dist/esm/adapters/llm/BedrockProvider/guardrailResponse.js.map +1 -0
  126. package/dist/esm/adapters/llm/BedrockProvider/guardrailSchemas.d.ts +13 -0
  127. package/dist/esm/adapters/llm/BedrockProvider/guardrailSchemas.js +92 -0
  128. package/dist/esm/adapters/llm/BedrockProvider/guardrailSchemas.js.map +1 -0
  129. package/dist/esm/adapters/llm/BedrockProvider/request.d.ts +4 -0
  130. package/dist/esm/adapters/llm/BedrockProvider/request.js +115 -0
  131. package/dist/esm/adapters/llm/BedrockProvider/request.js.map +1 -0
  132. package/dist/esm/adapters/llm/BedrockProvider/response.d.ts +32 -0
  133. package/dist/esm/adapters/llm/BedrockProvider/response.js +100 -0
  134. package/dist/esm/adapters/llm/BedrockProvider/response.js.map +1 -0
  135. package/dist/esm/adapters/llm/BedrockProvider/stream.d.ts +4 -0
  136. package/dist/esm/adapters/llm/BedrockProvider/stream.js +105 -0
  137. package/dist/esm/adapters/llm/BedrockProvider/stream.js.map +1 -0
  138. package/dist/esm/adapters/llm/BedrockProvider/types.d.ts +174 -0
  139. package/dist/esm/adapters/llm/BedrockProvider/types.js +2 -0
  140. package/dist/esm/adapters/llm/BedrockProvider/types.js.map +1 -0
  141. package/dist/esm/adapters/llm/BedrockProvider.d.ts +5 -148
  142. package/dist/esm/adapters/llm/BedrockProvider.js +44 -377
  143. package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
  144. package/dist/esm/adapters/llm/MockProvider.js +1 -0
  145. package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
  146. package/dist/esm/ag-ui/serializer/settle.d.ts +28 -0
  147. package/dist/esm/ag-ui/serializer/settle.js +106 -0
  148. package/dist/esm/ag-ui/serializer/settle.js.map +1 -0
  149. package/dist/esm/ag-ui/serializer/translate.d.ts +39 -0
  150. package/dist/esm/ag-ui/serializer/translate.js +306 -0
  151. package/dist/esm/ag-ui/serializer/translate.js.map +1 -0
  152. package/dist/esm/ag-ui/serializer/types.d.ts +66 -0
  153. package/dist/esm/ag-ui/serializer/types.js +2 -0
  154. package/dist/esm/ag-ui/serializer/types.js.map +1 -0
  155. package/dist/esm/ag-ui/serializer/values.d.ts +39 -0
  156. package/dist/esm/ag-ui/serializer/values.js +59 -0
  157. package/dist/esm/ag-ui/serializer/values.js.map +1 -0
  158. package/dist/esm/ag-ui/serializer.d.ts +3 -146
  159. package/dist/esm/ag-ui/serializer.js +85 -522
  160. package/dist/esm/ag-ui/serializer.js.map +1 -1
  161. package/dist/esm/core/LLMCall/chart.d.ts +21 -0
  162. package/dist/esm/core/LLMCall/chart.js +290 -0
  163. package/dist/esm/core/LLMCall/chart.js.map +1 -0
  164. package/dist/esm/core/LLMCall.d.ts +3 -0
  165. package/dist/esm/core/LLMCall.js +31 -315
  166. package/dist/esm/core/LLMCall.js.map +1 -1
  167. package/dist/esm/core/agent/buildAgentMessageApiChart.js +10 -5
  168. package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -1
  169. package/dist/esm/core/agent/buildDynamicAgentChart/boundary.d.ts +100 -0
  170. package/dist/esm/core/agent/buildDynamicAgentChart/boundary.js +144 -0
  171. package/dist/esm/core/agent/buildDynamicAgentChart/boundary.js.map +1 -0
  172. package/dist/esm/core/agent/buildDynamicAgentChart/engineBoundary.d.ts +51 -0
  173. package/dist/esm/core/agent/buildDynamicAgentChart/engineBoundary.js +118 -0
  174. package/dist/esm/core/agent/buildDynamicAgentChart/engineBoundary.js.map +1 -0
  175. package/dist/esm/core/agent/buildDynamicAgentChart/finalBranch.d.ts +3 -0
  176. package/dist/esm/core/agent/buildDynamicAgentChart/finalBranch.js +22 -0
  177. package/dist/esm/core/agent/buildDynamicAgentChart/finalBranch.js.map +1 -0
  178. package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +0 -50
  179. package/dist/esm/core/agent/buildDynamicAgentChart.js +14 -263
  180. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  181. package/dist/esm/core/agent/buildMessageApiChart.js +11 -6
  182. package/dist/esm/core/agent/buildMessageApiChart.js.map +1 -1
  183. package/dist/esm/core/agent/composeRequest.d.ts +1 -1
  184. package/dist/esm/core/agent/composeRequest.js +1 -1
  185. package/dist/esm/core/agent/dynamicTurnSeed.js +2 -0
  186. package/dist/esm/core/agent/dynamicTurnSeed.js.map +1 -1
  187. package/dist/esm/core/agent/findings/answerText.d.ts +1 -1
  188. package/dist/esm/core/agent/findings/answerText.js +1 -1
  189. package/dist/esm/core/agent/receipt/receipt.d.ts +2 -2
  190. package/dist/esm/core/agent/receipt/receipt.js +2 -2
  191. package/dist/esm/core/agent/runtime/admission/owner.js +1 -1
  192. package/dist/esm/core/agent/runtime/admission/owner.js.map +1 -1
  193. package/dist/esm/core/agent/runtime/terminal/verdicts.js +4 -0
  194. package/dist/esm/core/agent/runtime/terminal/verdicts.js.map +1 -1
  195. package/dist/esm/core/agent/stagedRefs.js +1 -1
  196. package/dist/esm/core/agent/stagedRefs.js.map +1 -1
  197. package/dist/esm/core/agent/stages/callLLM/acceptResponse.d.ts +6 -0
  198. package/dist/esm/core/agent/stages/callLLM/acceptResponse.js +199 -0
  199. package/dist/esm/core/agent/stages/callLLM/acceptResponse.js.map +1 -0
  200. package/dist/esm/core/agent/stages/callLLM/executeCall.d.ts +26 -0
  201. package/dist/esm/core/agent/stages/callLLM/executeCall.js +250 -0
  202. package/dist/esm/core/agent/stages/callLLM/executeCall.js.map +1 -0
  203. package/dist/esm/core/agent/stages/callLLM/prepareCall.d.ts +88 -0
  204. package/dist/esm/core/agent/stages/callLLM/prepareCall.js +440 -0
  205. package/dist/esm/core/agent/stages/callLLM/prepareCall.js.map +1 -0
  206. package/dist/esm/core/agent/stages/callLLM/responseAccounting.d.ts +10 -0
  207. package/dist/esm/core/agent/stages/callLLM/responseAccounting.js +29 -0
  208. package/dist/esm/core/agent/stages/callLLM/responseAccounting.js.map +1 -0
  209. package/dist/esm/core/agent/stages/callLLM.d.ts +1 -1
  210. package/dist/esm/core/agent/stages/callLLM.js +34 -829
  211. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  212. package/dist/esm/core/agent/stages/reliabilityExecution/contracts.d.ts +53 -0
  213. package/dist/esm/core/agent/stages/reliabilityExecution/contracts.js +24 -0
  214. package/dist/esm/core/agent/stages/reliabilityExecution/contracts.js.map +1 -0
  215. package/dist/esm/core/agent/stages/reliabilityExecution/feedback.d.ts +19 -0
  216. package/dist/esm/core/agent/stages/reliabilityExecution/feedback.js +36 -0
  217. package/dist/esm/core/agent/stages/reliabilityExecution/feedback.js.map +1 -0
  218. package/dist/esm/core/agent/stages/reliabilityExecution/stuckLoop.d.ts +29 -0
  219. package/dist/esm/core/agent/stages/reliabilityExecution/stuckLoop.js +44 -0
  220. package/dist/esm/core/agent/stages/reliabilityExecution/stuckLoop.js.map +1 -0
  221. package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +4 -81
  222. package/dist/esm/core/agent/stages/reliabilityExecution.js +7 -147
  223. package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -1
  224. package/dist/esm/core/agent/toolChoice/record.d.ts +1 -1
  225. package/dist/esm/core/agent/toolChoice/record.js +1 -1
  226. package/dist/esm/core/agent/window/toolNames.d.ts +1 -1
  227. package/dist/esm/core/agent/window/toolNames.js +1 -1
  228. package/dist/esm/core/providerIntervention.d.ts +25 -0
  229. package/dist/esm/core/providerIntervention.js +106 -0
  230. package/dist/esm/core/providerIntervention.js.map +1 -0
  231. package/dist/esm/core/slots/buildMessagesSlot.d.ts +1 -1
  232. package/dist/esm/core/slots/buildMessagesSlot.js +1 -1
  233. package/dist/esm/core/terminalVerdict.d.ts +4 -0
  234. package/dist/esm/core/terminalVerdict.js +3 -0
  235. package/dist/esm/core/terminalVerdict.js.map +1 -1
  236. package/dist/esm/core-flow/Graph.d.ts +1 -1
  237. package/dist/esm/core-flow/Graph.js +1 -1
  238. package/dist/esm/core-flow/Parallel/builder.d.ts +39 -0
  239. package/dist/esm/core-flow/Parallel/builder.js +97 -0
  240. package/dist/esm/core-flow/Parallel/builder.js.map +1 -0
  241. package/dist/esm/core-flow/Parallel/chart.d.ts +15 -0
  242. package/dist/esm/core-flow/Parallel/chart.js +217 -0
  243. package/dist/esm/core-flow/Parallel/chart.js.map +1 -0
  244. package/dist/esm/core-flow/Parallel/mapper.d.ts +21 -0
  245. package/dist/esm/core-flow/Parallel/mapper.js +37 -0
  246. package/dist/esm/core-flow/Parallel/mapper.js.map +1 -0
  247. package/dist/esm/core-flow/Parallel/merge.d.ts +4 -0
  248. package/dist/esm/core-flow/Parallel/merge.js +58 -0
  249. package/dist/esm/core-flow/Parallel/merge.js.map +1 -0
  250. package/dist/esm/core-flow/Parallel/types.d.ts +179 -0
  251. package/dist/esm/core-flow/Parallel/types.js +2 -0
  252. package/dist/esm/core-flow/Parallel/types.js.map +1 -0
  253. package/dist/esm/core-flow/Parallel.d.ts +7 -233
  254. package/dist/esm/core-flow/Parallel.js +18 -394
  255. package/dist/esm/core-flow/Parallel.js.map +1 -1
  256. package/dist/esm/hosting/failedSettlement.d.ts +9 -0
  257. package/dist/esm/hosting/failedSettlement.js +15 -0
  258. package/dist/esm/hosting/failedSettlement.js.map +1 -0
  259. package/dist/esm/hosting/headers.d.ts +8 -0
  260. package/dist/esm/hosting/headers.js +18 -0
  261. package/dist/esm/hosting/headers.js.map +1 -1
  262. package/dist/esm/hosting/httpHost.js +5 -20
  263. package/dist/esm/hosting/httpHost.js.map +1 -1
  264. package/dist/esm/hosting/httpStreaming.d.ts +5 -2
  265. package/dist/esm/hosting/protocolRoute.js +9 -2
  266. package/dist/esm/hosting/protocolRoute.js.map +1 -1
  267. package/dist/esm/hosting/refusalStatus.d.ts +3 -0
  268. package/dist/esm/hosting/refusalStatus.js +5 -0
  269. package/dist/esm/hosting/refusalStatus.js.map +1 -1
  270. package/dist/esm/hosting/streamHandler/conversation.d.ts +17 -0
  271. package/dist/esm/hosting/streamHandler/conversation.js +32 -0
  272. package/dist/esm/hosting/streamHandler/conversation.js.map +1 -0
  273. package/dist/esm/hosting/streamHandler/request.d.ts +12 -0
  274. package/dist/esm/hosting/streamHandler/request.js +84 -0
  275. package/dist/esm/hosting/streamHandler/request.js.map +1 -0
  276. package/dist/esm/hosting/streamHandler/types.d.ts +106 -0
  277. package/dist/esm/hosting/streamHandler/types.js +5 -0
  278. package/dist/esm/hosting/streamHandler/types.js.map +1 -0
  279. package/dist/esm/hosting/streamHandler.d.ts +3 -133
  280. package/dist/esm/hosting/streamHandler.js +10 -119
  281. package/dist/esm/hosting/streamHandler.js.map +1 -1
  282. package/dist/esm/hosting/unstreamedText.d.ts +1 -1
  283. package/dist/esm/hosting/unstreamedText.js +1 -1
  284. package/dist/esm/lib/iterationBudget.js +1 -1
  285. package/dist/esm/lib/iterationBudget.js.map +1 -1
  286. package/dist/esm/lib/toolBytes.d.ts +1 -1
  287. package/dist/esm/lib/toolBytes.js +2 -2
  288. package/dist/esm/lib/toolBytes.js.map +1 -1
  289. package/dist/esm/ontology/serve.d.ts +2 -2
  290. package/dist/esm/ontology/serve.js +2 -2
  291. package/dist/esm/provider-contract/intervention.d.ts +56 -0
  292. package/dist/esm/provider-contract/intervention.js +112 -0
  293. package/dist/esm/provider-contract/intervention.js.map +1 -0
  294. package/dist/esm/provider-contract/replaySafety.d.ts +4 -0
  295. package/dist/esm/provider-contract/replaySafety.js +25 -0
  296. package/dist/esm/provider-contract/replaySafety.js.map +1 -0
  297. package/dist/esm/provider-contract/requestRefusal.js +3 -1
  298. package/dist/esm/provider-contract/requestRefusal.js.map +1 -1
  299. package/dist/esm/provider-contract/responseAdmission.d.ts +10 -0
  300. package/dist/esm/provider-contract/responseAdmission.js +91 -0
  301. package/dist/esm/provider-contract/responseAdmission.js.map +1 -0
  302. package/dist/esm/provider-contract/types/code.d.ts +434 -0
  303. package/dist/esm/provider-contract/types/code.js +27 -0
  304. package/dist/esm/provider-contract/types/code.js.map +1 -0
  305. package/dist/esm/provider-contract/types/message.d.ts +226 -0
  306. package/dist/esm/provider-contract/types/message.js +2 -0
  307. package/dist/esm/provider-contract/types/message.js.map +1 -0
  308. package/dist/esm/provider-contract/types/provider.d.ts +261 -0
  309. package/dist/esm/provider-contract/types/provider.js +2 -0
  310. package/dist/esm/provider-contract/types/provider.js.map +1 -0
  311. package/dist/esm/provider-contract/types/request.d.ts +93 -0
  312. package/dist/esm/provider-contract/types/request.js +2 -0
  313. package/dist/esm/provider-contract/types/request.js.map +1 -0
  314. package/dist/esm/provider-contract/types/response.d.ts +142 -0
  315. package/dist/esm/provider-contract/types/response.js +2 -0
  316. package/dist/esm/provider-contract/types/response.js.map +1 -0
  317. package/dist/esm/provider-contract/types.d.ts +7 -1149
  318. package/dist/esm/provider-contract/types.js +1 -25
  319. package/dist/esm/provider-contract/types.js.map +1 -1
  320. package/dist/esm/providers.d.ts +2 -1
  321. package/dist/esm/providers.js +1 -0
  322. package/dist/esm/providers.js.map +1 -1
  323. package/dist/esm/recorders/core/ErrorBridge.d.ts +3 -1
  324. package/dist/esm/recorders/core/ErrorBridge.js +14 -0
  325. package/dist/esm/recorders/core/ErrorBridge.js.map +1 -1
  326. package/dist/esm/recorders/core/ResilienceRecorder.d.ts +4 -4
  327. package/dist/esm/recorders/core/ResilienceRecorder.js +4 -4
  328. package/dist/esm/reliability/buildReliabilityGateChart.d.ts +1 -1
  329. package/dist/esm/reliability/buildReliabilityGateChart.js +2 -2
  330. package/dist/esm/reliability/buildReliabilityGateChart.js.map +1 -1
  331. package/dist/esm/resilience/replayAttempt.d.ts +1 -1
  332. package/dist/esm/resilience/replayAttempt.js +18 -6
  333. package/dist/esm/resilience/replayAttempt.js.map +1 -1
  334. package/dist/esm/resilience/withCircuitBreaker.js +29 -13
  335. package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
  336. package/dist/esm/resilience/withFallback.js +22 -7
  337. package/dist/esm/resilience/withFallback.js.map +1 -1
  338. package/dist/esm/resilience/withRetry.js +35 -11
  339. package/dist/esm/resilience/withRetry.js.map +1 -1
  340. package/dist/esm/time-travel/servedView/findings.js +2 -2
  341. package/dist/esm/time-travel/servedView/findings.js.map +1 -1
  342. package/dist/esm/time-travel/servedView/gaps.js +1 -1
  343. package/dist/esm/time-travel/servedView/gaps.js.map +1 -1
  344. package/dist/esm/time-travel/servedView/ontology.js +1 -1
  345. package/dist/esm/time-travel/servedView.d.ts +2 -2
  346. package/dist/esm/time-travel/servedView.js +2 -2
  347. package/dist/hosting/failedSettlement.js +19 -0
  348. package/dist/hosting/failedSettlement.js.map +1 -0
  349. package/dist/hosting/headers.js +20 -1
  350. package/dist/hosting/headers.js.map +1 -1
  351. package/dist/hosting/httpHost.js +5 -20
  352. package/dist/hosting/httpHost.js.map +1 -1
  353. package/dist/hosting/protocolRoute.js +9 -2
  354. package/dist/hosting/protocolRoute.js.map +1 -1
  355. package/dist/hosting/refusalStatus.js +5 -0
  356. package/dist/hosting/refusalStatus.js.map +1 -1
  357. package/dist/hosting/streamHandler/conversation.js +37 -0
  358. package/dist/hosting/streamHandler/conversation.js.map +1 -0
  359. package/dist/hosting/streamHandler/request.js +93 -0
  360. package/dist/hosting/streamHandler/request.js.map +1 -0
  361. package/dist/hosting/streamHandler/types.js +8 -0
  362. package/dist/hosting/streamHandler/types.js.map +1 -0
  363. package/dist/hosting/streamHandler.js +25 -132
  364. package/dist/hosting/streamHandler.js.map +1 -1
  365. package/dist/hosting/unstreamedText.js +1 -1
  366. package/dist/lib/iterationBudget.js +1 -1
  367. package/dist/lib/iterationBudget.js.map +1 -1
  368. package/dist/lib/toolBytes.js +2 -2
  369. package/dist/lib/toolBytes.js.map +1 -1
  370. package/dist/ontology/serve.js +2 -2
  371. package/dist/provider-contract/intervention.js +122 -0
  372. package/dist/provider-contract/intervention.js.map +1 -0
  373. package/dist/provider-contract/replaySafety.js +30 -0
  374. package/dist/provider-contract/replaySafety.js.map +1 -0
  375. package/dist/provider-contract/requestRefusal.js +3 -1
  376. package/dist/provider-contract/requestRefusal.js.map +1 -1
  377. package/dist/provider-contract/responseAdmission.js +96 -0
  378. package/dist/provider-contract/responseAdmission.js.map +1 -0
  379. package/dist/provider-contract/types/code.js +33 -0
  380. package/dist/provider-contract/types/code.js.map +1 -0
  381. package/dist/provider-contract/types/message.js +3 -0
  382. package/dist/provider-contract/types/message.js.map +1 -0
  383. package/dist/provider-contract/types/provider.js +3 -0
  384. package/dist/provider-contract/types/provider.js.map +1 -0
  385. package/dist/provider-contract/types/request.js +3 -0
  386. package/dist/provider-contract/types/request.js.map +1 -0
  387. package/dist/provider-contract/types/response.js +3 -0
  388. package/dist/provider-contract/types/response.js.map +1 -0
  389. package/dist/provider-contract/types.js +6 -29
  390. package/dist/provider-contract/types.js.map +1 -1
  391. package/dist/providers.js +5 -1
  392. package/dist/providers.js.map +1 -1
  393. package/dist/recorders/core/ErrorBridge.js +14 -0
  394. package/dist/recorders/core/ErrorBridge.js.map +1 -1
  395. package/dist/recorders/core/ResilienceRecorder.js +4 -4
  396. package/dist/reliability/buildReliabilityGateChart.js +2 -2
  397. package/dist/reliability/buildReliabilityGateChart.js.map +1 -1
  398. package/dist/resilience/replayAttempt.js +18 -6
  399. package/dist/resilience/replayAttempt.js.map +1 -1
  400. package/dist/resilience/withCircuitBreaker.js +29 -13
  401. package/dist/resilience/withCircuitBreaker.js.map +1 -1
  402. package/dist/resilience/withFallback.js +22 -7
  403. package/dist/resilience/withFallback.js.map +1 -1
  404. package/dist/resilience/withRetry.js +35 -11
  405. package/dist/resilience/withRetry.js.map +1 -1
  406. package/dist/time-travel/servedView/findings.js +2 -2
  407. package/dist/time-travel/servedView/findings.js.map +1 -1
  408. package/dist/time-travel/servedView/gaps.js +1 -1
  409. package/dist/time-travel/servedView/gaps.js.map +1 -1
  410. package/dist/time-travel/servedView/ontology.js +1 -1
  411. package/dist/time-travel/servedView.js +2 -2
  412. package/dist/types/adapters/llm/BedrockProvider/client.d.ts +12 -0
  413. package/dist/types/adapters/llm/BedrockProvider/client.d.ts.map +1 -0
  414. package/dist/types/adapters/llm/BedrockProvider/guardedStream.d.ts +8 -0
  415. package/dist/types/adapters/llm/BedrockProvider/guardedStream.d.ts.map +1 -0
  416. package/dist/types/adapters/llm/BedrockProvider/guardedStreamBuffer.d.ts +22 -0
  417. package/dist/types/adapters/llm/BedrockProvider/guardedStreamBuffer.d.ts.map +1 -0
  418. package/dist/types/adapters/llm/BedrockProvider/guardrailClassify.d.ts +9 -0
  419. package/dist/types/adapters/llm/BedrockProvider/guardrailClassify.d.ts.map +1 -0
  420. package/dist/types/adapters/llm/BedrockProvider/guardrailConfig.d.ts +31 -0
  421. package/dist/types/adapters/llm/BedrockProvider/guardrailConfig.d.ts.map +1 -0
  422. package/dist/types/adapters/llm/BedrockProvider/guardrailRead.d.ts +20 -0
  423. package/dist/types/adapters/llm/BedrockProvider/guardrailRead.d.ts.map +1 -0
  424. package/dist/types/adapters/llm/BedrockProvider/guardrailResponse.d.ts +14 -0
  425. package/dist/types/adapters/llm/BedrockProvider/guardrailResponse.d.ts.map +1 -0
  426. package/dist/types/adapters/llm/BedrockProvider/guardrailSchemas.d.ts +14 -0
  427. package/dist/types/adapters/llm/BedrockProvider/guardrailSchemas.d.ts.map +1 -0
  428. package/dist/types/adapters/llm/BedrockProvider/request.d.ts +5 -0
  429. package/dist/types/adapters/llm/BedrockProvider/request.d.ts.map +1 -0
  430. package/dist/types/adapters/llm/BedrockProvider/response.d.ts +33 -0
  431. package/dist/types/adapters/llm/BedrockProvider/response.d.ts.map +1 -0
  432. package/dist/types/adapters/llm/BedrockProvider/stream.d.ts +5 -0
  433. package/dist/types/adapters/llm/BedrockProvider/stream.d.ts.map +1 -0
  434. package/dist/types/adapters/llm/BedrockProvider/types.d.ts +175 -0
  435. package/dist/types/adapters/llm/BedrockProvider/types.d.ts.map +1 -0
  436. package/dist/types/adapters/llm/BedrockProvider.d.ts +5 -148
  437. package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
  438. package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
  439. package/dist/types/ag-ui/serializer/settle.d.ts +29 -0
  440. package/dist/types/ag-ui/serializer/settle.d.ts.map +1 -0
  441. package/dist/types/ag-ui/serializer/translate.d.ts +40 -0
  442. package/dist/types/ag-ui/serializer/translate.d.ts.map +1 -0
  443. package/dist/types/ag-ui/serializer/types.d.ts +67 -0
  444. package/dist/types/ag-ui/serializer/types.d.ts.map +1 -0
  445. package/dist/types/ag-ui/serializer/values.d.ts +40 -0
  446. package/dist/types/ag-ui/serializer/values.d.ts.map +1 -0
  447. package/dist/types/ag-ui/serializer.d.ts +3 -146
  448. package/dist/types/ag-ui/serializer.d.ts.map +1 -1
  449. package/dist/types/core/LLMCall/chart.d.ts +22 -0
  450. package/dist/types/core/LLMCall/chart.d.ts.map +1 -0
  451. package/dist/types/core/LLMCall.d.ts +3 -0
  452. package/dist/types/core/LLMCall.d.ts.map +1 -1
  453. package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -1
  454. package/dist/types/core/agent/buildDynamicAgentChart/boundary.d.ts +101 -0
  455. package/dist/types/core/agent/buildDynamicAgentChart/boundary.d.ts.map +1 -0
  456. package/dist/types/core/agent/buildDynamicAgentChart/engineBoundary.d.ts +52 -0
  457. package/dist/types/core/agent/buildDynamicAgentChart/engineBoundary.d.ts.map +1 -0
  458. package/dist/types/core/agent/buildDynamicAgentChart/finalBranch.d.ts +4 -0
  459. package/dist/types/core/agent/buildDynamicAgentChart/finalBranch.d.ts.map +1 -0
  460. package/dist/types/core/agent/buildDynamicAgentChart.d.ts +0 -50
  461. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  462. package/dist/types/core/agent/buildMessageApiChart.d.ts.map +1 -1
  463. package/dist/types/core/agent/composeRequest.d.ts +1 -1
  464. package/dist/types/core/agent/dynamicTurnSeed.d.ts.map +1 -1
  465. package/dist/types/core/agent/findings/answerText.d.ts +1 -1
  466. package/dist/types/core/agent/receipt/receipt.d.ts +2 -2
  467. package/dist/types/core/agent/runtime/terminal/verdicts.d.ts.map +1 -1
  468. package/dist/types/core/agent/stages/callLLM/acceptResponse.d.ts +7 -0
  469. package/dist/types/core/agent/stages/callLLM/acceptResponse.d.ts.map +1 -0
  470. package/dist/types/core/agent/stages/callLLM/executeCall.d.ts +27 -0
  471. package/dist/types/core/agent/stages/callLLM/executeCall.d.ts.map +1 -0
  472. package/dist/types/core/agent/stages/callLLM/prepareCall.d.ts +89 -0
  473. package/dist/types/core/agent/stages/callLLM/prepareCall.d.ts.map +1 -0
  474. package/dist/types/core/agent/stages/callLLM/responseAccounting.d.ts +11 -0
  475. package/dist/types/core/agent/stages/callLLM/responseAccounting.d.ts.map +1 -0
  476. package/dist/types/core/agent/stages/callLLM.d.ts +1 -1
  477. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  478. package/dist/types/core/agent/stages/reliabilityExecution/contracts.d.ts +54 -0
  479. package/dist/types/core/agent/stages/reliabilityExecution/contracts.d.ts.map +1 -0
  480. package/dist/types/core/agent/stages/reliabilityExecution/feedback.d.ts +20 -0
  481. package/dist/types/core/agent/stages/reliabilityExecution/feedback.d.ts.map +1 -0
  482. package/dist/types/core/agent/stages/reliabilityExecution/stuckLoop.d.ts +30 -0
  483. package/dist/types/core/agent/stages/reliabilityExecution/stuckLoop.d.ts.map +1 -0
  484. package/dist/types/core/agent/stages/reliabilityExecution.d.ts +4 -81
  485. package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -1
  486. package/dist/types/core/agent/toolChoice/record.d.ts +1 -1
  487. package/dist/types/core/agent/window/toolNames.d.ts +1 -1
  488. package/dist/types/core/providerIntervention.d.ts +26 -0
  489. package/dist/types/core/providerIntervention.d.ts.map +1 -0
  490. package/dist/types/core/slots/buildMessagesSlot.d.ts +1 -1
  491. package/dist/types/core/terminalVerdict.d.ts +4 -0
  492. package/dist/types/core/terminalVerdict.d.ts.map +1 -1
  493. package/dist/types/core-flow/Graph.d.ts +1 -1
  494. package/dist/types/core-flow/Parallel/builder.d.ts +40 -0
  495. package/dist/types/core-flow/Parallel/builder.d.ts.map +1 -0
  496. package/dist/types/core-flow/Parallel/chart.d.ts +16 -0
  497. package/dist/types/core-flow/Parallel/chart.d.ts.map +1 -0
  498. package/dist/types/core-flow/Parallel/mapper.d.ts +22 -0
  499. package/dist/types/core-flow/Parallel/mapper.d.ts.map +1 -0
  500. package/dist/types/core-flow/Parallel/merge.d.ts +5 -0
  501. package/dist/types/core-flow/Parallel/merge.d.ts.map +1 -0
  502. package/dist/types/core-flow/Parallel/types.d.ts +180 -0
  503. package/dist/types/core-flow/Parallel/types.d.ts.map +1 -0
  504. package/dist/types/core-flow/Parallel.d.ts +7 -233
  505. package/dist/types/core-flow/Parallel.d.ts.map +1 -1
  506. package/dist/types/hosting/failedSettlement.d.ts +10 -0
  507. package/dist/types/hosting/failedSettlement.d.ts.map +1 -0
  508. package/dist/types/hosting/headers.d.ts +8 -0
  509. package/dist/types/hosting/headers.d.ts.map +1 -1
  510. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  511. package/dist/types/hosting/httpStreaming.d.ts +5 -2
  512. package/dist/types/hosting/httpStreaming.d.ts.map +1 -1
  513. package/dist/types/hosting/protocolRoute.d.ts.map +1 -1
  514. package/dist/types/hosting/refusalStatus.d.ts +3 -0
  515. package/dist/types/hosting/refusalStatus.d.ts.map +1 -1
  516. package/dist/types/hosting/streamHandler/conversation.d.ts +18 -0
  517. package/dist/types/hosting/streamHandler/conversation.d.ts.map +1 -0
  518. package/dist/types/hosting/streamHandler/request.d.ts +13 -0
  519. package/dist/types/hosting/streamHandler/request.d.ts.map +1 -0
  520. package/dist/types/hosting/streamHandler/types.d.ts +107 -0
  521. package/dist/types/hosting/streamHandler/types.d.ts.map +1 -0
  522. package/dist/types/hosting/streamHandler.d.ts +3 -133
  523. package/dist/types/hosting/streamHandler.d.ts.map +1 -1
  524. package/dist/types/hosting/unstreamedText.d.ts +1 -1
  525. package/dist/types/lib/toolBytes.d.ts +1 -1
  526. package/dist/types/ontology/serve.d.ts +2 -2
  527. package/dist/types/provider-contract/intervention.d.ts +57 -0
  528. package/dist/types/provider-contract/intervention.d.ts.map +1 -0
  529. package/dist/types/provider-contract/replaySafety.d.ts +5 -0
  530. package/dist/types/provider-contract/replaySafety.d.ts.map +1 -0
  531. package/dist/types/provider-contract/requestRefusal.d.ts.map +1 -1
  532. package/dist/types/provider-contract/responseAdmission.d.ts +11 -0
  533. package/dist/types/provider-contract/responseAdmission.d.ts.map +1 -0
  534. package/dist/types/provider-contract/types/code.d.ts +435 -0
  535. package/dist/types/provider-contract/types/code.d.ts.map +1 -0
  536. package/dist/types/provider-contract/types/message.d.ts +227 -0
  537. package/dist/types/provider-contract/types/message.d.ts.map +1 -0
  538. package/dist/types/provider-contract/types/provider.d.ts +262 -0
  539. package/dist/types/provider-contract/types/provider.d.ts.map +1 -0
  540. package/dist/types/provider-contract/types/request.d.ts +94 -0
  541. package/dist/types/provider-contract/types/request.d.ts.map +1 -0
  542. package/dist/types/provider-contract/types/response.d.ts +143 -0
  543. package/dist/types/provider-contract/types/response.d.ts.map +1 -0
  544. package/dist/types/provider-contract/types.d.ts +7 -1149
  545. package/dist/types/provider-contract/types.d.ts.map +1 -1
  546. package/dist/types/providers.d.ts +2 -1
  547. package/dist/types/providers.d.ts.map +1 -1
  548. package/dist/types/recorders/core/ErrorBridge.d.ts +3 -1
  549. package/dist/types/recorders/core/ErrorBridge.d.ts.map +1 -1
  550. package/dist/types/recorders/core/ResilienceRecorder.d.ts +4 -4
  551. package/dist/types/reliability/buildReliabilityGateChart.d.ts +1 -1
  552. package/dist/types/resilience/replayAttempt.d.ts +1 -1
  553. package/dist/types/resilience/replayAttempt.d.ts.map +1 -1
  554. package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
  555. package/dist/types/resilience/withFallback.d.ts.map +1 -1
  556. package/dist/types/resilience/withRetry.d.ts.map +1 -1
  557. package/dist/types/time-travel/servedView.d.ts +2 -2
  558. package/package.json +1 -1
@@ -1,81 +1,39 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
2
+ /**
3
+ * callLLM — the LLM-invocation stage of the agent's chart.
4
+ *
5
+ * Reads the assembled prompt + messages from scope (populated by the
6
+ * upstream slot subflows: SystemPrompt, Messages, Tools, CacheDecision,
7
+ * CacheGate). Calls `provider.stream()` if available (token streaming
8
+ * with per-chunk events) else falls back to `provider.complete()`.
9
+ * Writes the response to scope (`llmLatestContent`, `llmLatestToolCalls`,
10
+ * cumulative tokens) for the downstream Route decider to read.
11
+ *
12
+ * Emits `agentfootprint.stream.llm_start` + `llm_end` brackets for
13
+ * observability adapters and per-chunk `stream.token` events during
14
+ * streaming. Emits `cost.tick` via `emitCostTick` when a `pricingTable`
15
+ * is configured.
16
+ *
17
+ * Factory signature so the chart-build-time provider/model/etc. deps
18
+ * are explicit. The `toolSchemas` value is late-bound via a getter
19
+ * because tool schema composition completes after the seed factory is
20
+ * built but before the chart actually runs.
21
+ */
25
22
  Object.defineProperty(exports, "__esModule", { value: true });
26
23
  exports.buildCallLLMStage = void 0;
27
- const sourceContract_js_1 = require("../sourceContract.js");
28
- const recordModelContext_js_1 = require("../../../recorders/core/recordModelContext.js");
29
- const groundedText_js_1 = require("./callLLM/groundedText.js");
30
- const admission_js_1 = require("../findings/admission.js");
31
- const placedTickets_js_1 = require("../placedTickets.js");
32
- const servedRequest_js_1 = require("./callLLM/servedRequest.js");
33
- const callOccurrence_js_1 = require("../../../lib/callOccurrence.js");
34
- const iterationBudget_js_1 = require("../../../lib/iterationBudget.js");
35
- const cacheStrategyFor_js_1 = require("../../../cache/cacheStrategyFor.js");
36
- const typedEmit_js_1 = require("../../../recorders/core/typedEmit.js");
37
- const recordToolSelection_js_1 = require("./callLLM/recordToolSelection.js");
38
- const recordWireFindings_js_1 = require("./callLLM/recordWireFindings.js");
39
- const selectionAtRequest_js_1 = require("./callLLM/selectionAtRequest.js");
40
- const check_js_1 = require("../../../integrity/dangling-reference/check.js");
41
- const check_js_2 = require("../../../integrity/unsupported-argument/check.js");
42
- const toolNames_js_1 = require("../window/toolNames.js");
43
- const recovery_js_1 = require("../evidence/recovery.js");
44
- const composeRequest_js_1 = require("../composeRequest.js");
45
- const externalGrounds_js_1 = require("./callLLM/externalGrounds.js");
46
- const commitResponse_js_1 = require("./callLLM/commitResponse.js");
47
- const citationProjection_js_1 = require("./callLLM/citationProjection.js");
48
- const liveChunks_js_1 = require("./callLLM/liveChunks.js");
49
- const requestOnly_js_1 = require("./callLLM/requestOnly.js");
50
- const providerRequest_js_1 = require("./callLLM/providerRequest.js");
51
- const receipt_js_1 = require("../receipt/receipt.js");
52
- const conventions_js_1 = require("../../../lib/conventions.js");
53
- const integrityFindings_js_1 = require("../integrityFindings.js");
54
- const resilienceHooks_js_1 = require("../../../recorders/core/resilienceHooks.js");
55
- const replayAttempt_js_1 = require("../../../resilience/replayAttempt.js");
56
- const abort_js_1 = require("../../../lib/abort.js");
57
- const dispatch_js_1 = require("../../../thinking/dispatch.js");
58
- const cost_js_1 = require("../../cost.js");
59
- const outputSchema_js_1 = require("../../../answer-validation/outputSchema.js");
60
- const reserved_js_1 = require("../findings/reserved.js");
61
- const serve_js_1 = require("../findings/serve.js");
62
- const replayPrefix_js_1 = require("../requestTurn/replayPrefix.js");
63
- const state_js_1 = require("../requestTurn/state.js");
64
- const native_js_1 = require("../requestTurn/native.js");
65
- const requestProjection_js_1 = require("./callLLM/requestProjection.js");
66
- const recallRequest_js_1 = require("./callLLM/recallRequest.js");
67
- const outputEnforcement_js_1 = require("../outputEnforcement.js");
68
- const reliabilityExecution_js_1 = require("./reliabilityExecution.js");
69
- /** The wrap-up call's tool list (9.56.0). A frozen module constant so the
70
- * withholding allocates nothing on the one call it applies to. */
71
- const EMPTY_TOOL_SCHEMAS = Object.freeze([]);
24
+ const prepareCall_js_1 = require("./callLLM/prepareCall.js");
25
+ const executeCall_js_1 = require("./callLLM/executeCall.js");
26
+ const acceptResponse_js_1 = require("./callLLM/acceptResponse.js");
27
+ const providerIntervention_js_1 = require("../../providerIntervention.js");
28
+ const responseAccounting_js_1 = require("./callLLM/responseAccounting.js");
72
29
  // LENS · system-text + tool-list · request-ephemeral
73
30
  // reads: systemPrompt ← scope.systemPromptInjections, joined by `systemPrompt` below (the system-prompt slot's output)
74
31
  // messages ← scope.history (`history`; `messages` is its wire-only collapse of judged tool results under `.findings()` — `collapseJudged`); tools ← scope.dynamicToolSchemas (`registeredToolSchemas`), EMPTIED to EMPTY_TOOL_SCHEMAS under scope.wrapUpAsked
75
32
  // ontology piece ← scope.ontology (`ontologyPieceRecord`, under `deps.ontology` only), joined after the recovery piece
76
33
  // findings DATA ← scope.findingsLedger (under `deps.hasFindingsLedger` only), appended after committed history
77
34
  // brain ← deps.brainFor(nextSkillCursor ?? currentSkillId)
78
- // THIS is the wire, and it is assembled inside `buildCallLLMStage` — cite THAT, not this header,
35
+ // THIS is the wire, assembled by `callLLM/prepareCall.ts · prepareCall` inside the
36
+ // native stage `buildCallLLMStage` wires — cite that assembly owner, not this header,
79
37
  // when another file points at the assembly. The three slots feed it; they are not it. The staged-refs
80
38
  // nudge appended by `wireMessages` exists on THIS request only — scope.history is untouched, which is the right
81
39
  // lifetime for a forward-looking sentence.
@@ -87,789 +45,13 @@ const EMPTY_TOOL_SCHEMAS = Object.freeze([]);
87
45
  */
88
46
  function buildCallLLMStage(deps) {
89
47
  return async (scope) => {
90
- if (deps.servedTools?.selection?.accepted)
91
- delete deps.servedTools.selection.accepted;
92
- // The answer-text scanner (`findings/peel.ts`), loaded ONCE per call and
93
- // only under `.findings()` — the optional-family law of docs-next's site
94
- // budget: an unarmed agent never loads the module. Every armed use below
95
- // reads this binding; `undefined` IS the unarmed path.
96
- const peel = deps.findings === true ? await Promise.resolve().then(() => __importStar(require('../findings/peel.js'))) : undefined;
97
- const systemPromptInjections = scope.systemPromptInjections ?? [];
98
- // `scope.messagesInjections` is read by ContextRecorder for
99
- // observability; the LLM-wire path now reads scope.history directly.
100
- const iteration = scope.iteration;
101
- // "The cursor picks the brain" (9.19.0) — ONE consult, at the top, with
102
- // the advanced cursor and the escalation flag. Gated on `deps.brainFor`
103
- // so an agent without brains reads no new scope key and resolves on the
104
- // exact line it always did.
105
- const brain = deps.brainFor
106
- ? deps.brainFor((scope.nextSkillCursor ?? scope.currentSkillId), scope.skillEscalated === true)
107
- : undefined;
108
- const firstReliabilityProvider = deps.reliability?.providers?.[0];
109
- const provider = firstReliabilityProvider?.provider ?? brain?.provider ?? deps.provider;
110
- // The model for this run. `.configure()` resolved it at seed and
111
- // COMMITTED it to scope, so what gets called, what the `llm_start`
112
- // event reports and what cost is priced against are all one value —
113
- // the one the trace records. Without `.configure()` this is the
114
- // build-time model and scope is never touched. A winning brain rung
115
- // (9.19.0) outranks both — the stated precedence chain.
116
- const model = firstReliabilityProvider?.model ??
117
- brain?.model ??
118
- (deps.runConfigured ? scope.resolvedModel : undefined) ??
119
- deps.model;
120
- // A configured/skill model can differ from the build default. Resolve the
121
- // adapter's same capability for the model actually being sent, while a
122
- // host's explicit strategy remains authoritative.
123
- const cacheStrategy = deps.cacheStrategyIsOverride === true && provider === deps.provider
124
- ? deps.cacheStrategy
125
- : typeof provider.promptCaching === 'function'
126
- ? (0, cacheStrategyFor_js_1.cacheStrategyFor)(provider, model)
127
- : brain?.cacheStrategy ?? deps.cacheStrategy;
128
- // Per-iteration boundary marker (was a dedicated `IterationStart` stage —
129
- // folded here since emitting is passive observability, not work that needs
130
- // its own execution stage). Fires FIRST, before the LLM call, so recorders
131
- // still bracket each ReAct iteration. Payload unchanged (turnIndex reserved
132
- // for future multi-turn; iterIndex is the per-iteration counter).
133
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_start', {
134
- turnIndex: 0,
135
- iterIndex: iteration,
136
- });
137
- // ── the system-prompt join ────────────────────────────────────────
138
- // The pieces are committed (`systemPromptInjections`); THIS STRING IS NOT.
139
- // It lives and dies inside this stage, which is why the join is one
140
- // exported function rather than four lines here — a reader rebuilding what
141
- // the model was served has to apply the identical rule to the identical
142
- // records (`composeRequest.ts` · `joinSystemPrompt`).
143
- const trustedSystemPrompt = (0, composeRequest_js_1.joinSystemPrompt)(systemPromptInjections);
144
- const recoveryPiece = deps.hasEvidenceRecovery === true
145
- ? (0, recovery_js_1.evidenceRecoveryPiece)(scope.evidenceRecovery, scope.evidenceRecoveryUsed, iteration)
146
- : undefined;
147
- // Read the LLM message stream from `scope.history` directly. The
148
- // `messagesInjections` projection is for observability — it
149
- // flattens InjectionRecords for event reporting and doesn't carry
150
- // the full LLM-protocol shape (assistant `toolCalls[]`, etc.). For
151
- // Anthropic's API contract we need the original LLMMessage with
152
- // `toolCalls` intact so tool_use → tool_result correlation survives.
153
- // `stripFrameworkFields` takes off `injectedBy` — the marker the delivery
154
- // stage stamps so the messages slot can say WHO put a message here — and
155
- // `notDispatched`, the batch settlement's marker (9.113.0). Both are
156
- // framework bookkeeping, not conversation, and are removed BEFORE the
157
- // request exists rather than trusted to be ignored: a consumer-authored
158
- // adapter that serializes a message wholesale would otherwise put library
159
- // internals on someone's wire. Stripping removes a FIELD, never a message,
160
- // so `messages[i]` is still the message the cache marker's index names.
161
- // `committed` keeps both markers for the readers below that must see them.
162
- const committed = scope.history ?? [];
163
- const projected = (0, composeRequest_js_1.stripFrameworkFields)(committed, true);
164
- // Receipt assembly keeps a stable list even when stripping returns a live array.
165
- const history = projected === committed ? [...projected] : projected;
166
- // ── the findings ledger, served (9.101.0, step 3) ──────────────────
167
- // ONE gated read of the committed key, used twice. The COLLAPSE rewrites,
168
- // on the wire only, the `content` of `role: 'tool'` messages the model
169
- // has already judged noise or ruled-out (facts too under the bench-gated
170
- // `'ledger-only'`) to a ticket with no model words in it — the
171
- // `placedToolResult` precedent. It runs HERE, before the staged-refs
172
- // nudge and before the receipt mint, so `findStagedRefs` reads the
173
- // conversation the model reads and the receipt hashes what was sent.
174
- // Count, order, `toolCallId` and `toolName` are unchanged, so
175
- // `messages[i]` is still the message the cache marker's index names and
176
- // The tool_use/tool_result pair remains valid. Collapse changes only the
177
- // wire copy, never committed history. Current declarations and advisory
178
- // IDs are composed later as request-only DATA, outside the cached prefix.
179
- // Both DATA and collapse read the committed twin, whose notDispatched
180
- // marker distinguishes a settlement notice from an actual result.
181
- const ledger = deps.hasFindingsLedger === true
182
- ? scope.findingsLedger
183
- : undefined;
184
- const collapsed = deps.hasFindingsLedger === true
185
- ? (0, serve_js_1.collapseJudged)(committed, ledger, deps.findingsServe ?? 'ledger-and-facts')
186
- : committed;
187
- const rendered = collapsed === committed ? history : (0, composeRequest_js_1.stripFrameworkFields)(collapsed, true);
188
- // ── the declared ontology, served (9.106.0) ──────────────────────────
189
- // ONE gated read of the run constant seed wrote; the piece is a pure
190
- // function of the spec and nothing else (no call number, no clock — the
191
- // cached system-prefix contract), so an unchanged map serves unchanged bytes
192
- // on every call of the run. The composer is loaded through `import()` —
193
- // the optional-family law of docs-next's site budget (`toolCalls/evidence/judgeLanded.ts ·
194
- // judgeLanded`): an unarmed agent never loads the module. The event
195
- // carries identities and counts only.
196
- let ontologyPieceRecord;
197
- if (deps.ontology === true) {
198
- const record = scope.ontology;
199
- if (record !== undefined) {
200
- const { ontologyPiece } = await Promise.resolve().then(() => __importStar(require('../../../ontology/serve.js')));
201
- // The join (9.108.0): the record's tool → skills map and this
202
- // iteration's hidden skill ids — the same filter every model-facing
203
- // sentence applies, so the piece names no skill the caller may not see.
204
- const hidden = scope.hiddenSkillIds;
205
- ontologyPieceRecord = ontologyPiece(record.spec, {
206
- ...(record.tools !== undefined && { tools: record.tools }),
207
- ...(hidden !== undefined && { hiddenSkillIds: hidden }),
208
- });
209
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.ontology.served', {
210
- iteration,
211
- id: record.id,
212
- version: record.version,
213
- hash: record.hash,
214
- nodes: Object.keys(record.spec.nodes).length,
215
- sources: Object.keys(record.spec.sources).length,
216
- edges: record.spec.edges.length,
217
- });
218
- }
219
- }
220
- // Dynamic schemas — registry tools + injection-supplied tools (Skills'
221
- // `inject.tools` when their Injection is active). Falls back to the static
222
- // schemas at startup before the tools slot has run. Computed BEFORE the
223
- // llm_start emit so the event reports what the model ACTUALLY saw this call
224
- // (count + the name/description catalog), not the static startup set.
225
- //
226
- // 9.56.0 — unless this is the WRAP-UP call, in which case the tools come
227
- // OFF. They are withheld HERE, at request assembly, for the same reason
228
- // the schema tool is ADDED here: this is the one seam that decides what
229
- // goes on the wire, so the change never has to be known by the tools slot,
230
- // the registry, `tools.offered`, an MCP server's served list or the
231
- // dispatcher that runs tools. Nothing downstream learns a new mode — the
232
- // model is simply handed a request with no tools, which is what makes the
233
- // wrap-up terminal by construction rather than by another rule.
234
- //
235
- // `llm_start` reports the truth (`toolsCount: 0`, no catalog), because its
236
- // whole claim is what the model actually saw this call.
237
- //
238
- // The same seam withholds them once the evidence gate asked for its
239
- // revision under an ENFORCING answer validation
240
- // (`AgentState.toolsOffAfterRevision`): the answer may yet be withheld, so
241
- // no tool that writes or sends may run again, and the library cannot tell
242
- // one that only reads. Route refuses any call the model returns anyway.
243
- const withheld = (0, composeRequest_js_1.toolsWithheld)(scope.wrapUpAsked, deps.toolsOffAfterRevision === true ? scope.toolsOffAfterRevision : undefined);
244
- const registeredToolSchemas = withheld !== null
245
- ? EMPTY_TOOL_SCHEMAS
246
- : scope.dynamicToolSchemas ?? deps.toolSchemas;
247
- const { replayFrames, closure, continuing, messages } = (0, requestProjection_js_1.projectCallHistory)(scope, history, rendered, recoveryPiece !== undefined && withheld !== null);
248
- // The forced schema rides on the wire and in `llm_start`. Offered contracts
249
- // specialize the findings instruction in request-only copies that replay rebuilds.
250
- const recoveryNote = recoveryPiece !== undefined && continuing !== undefined && withheld === null
251
- ? (0, requestOnly_js_1.recoveryFeedback)(recoveryPiece.rawContent)
252
- : undefined;
253
- const systemRecovery = recoveryNote === undefined ? recoveryPiece : undefined;
254
- const systemPieces = (0, sourceContract_js_1.projectSourceInstructions)(systemRecovery === undefined && ontologyPieceRecord === undefined
255
- ? systemPromptInjections
256
- : [
257
- ...systemPromptInjections,
258
- ...(systemRecovery === undefined ? [] : [systemRecovery]),
259
- ...(ontologyPieceRecord === undefined ? [] : [ontologyPieceRecord]),
260
- ], registeredToolSchemas);
261
- const systemPrompt = (0, composeRequest_js_1.joinSystemPrompt)(systemPieces);
262
- const activeToolSchemas = deps.schemaTool
263
- ? [...registeredToolSchemas, deps.schemaTool]
264
- : registeredToolSchemas;
265
- const freshNotes = (0, requestOnly_js_1.requestOnlyMessages)(scope, deps, {
266
- iteration,
267
- committed,
268
- messages,
269
- ledger,
270
- registeredToolSchemas,
271
- withheld,
272
- });
273
- const recoveryContext = closure ?? recoveryNote;
274
- const tail = recoveryContext === undefined ? freshNotes : [recoveryContext, ...freshNotes];
275
- const prefixWire = continuing?.wire ?? messages;
276
- const wireMessages = tail.length === 0 ? prefixWire : [...prefixWire, ...tail.map(({ message }) => message)];
277
- const requestOnly = continuing === undefined
278
- ? tail
279
- : [
280
- ...continuing.additions.map(({ message, reason, wireIndex }) => ({
281
- message,
282
- reason: `native-turn-prefix:${wireIndex}:${reason}`,
283
- })),
284
- ...tail,
285
- ];
286
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.llm_start', {
287
- iteration,
288
- provider: provider.name,
289
- model,
290
- systemPromptChars: systemPrompt.length,
291
- // Opt-in (9.50.0): the assembled prompt VERBATIM, exactly the string
292
- // handed to the provider below — never re-joined by a consumer.
293
- ...(deps.recordSystemPrompt === true && { systemPromptText: systemPrompt }),
294
- messagesCount: wireMessages.length,
295
- toolsCount: activeToolSchemas.length,
296
- // WHICH BRAIN answered (9.19.0) — stamped ONLY when a brain rung won,
297
- // so configured/default runs keep byte-identical events.
298
- ...(brain !== undefined && {
299
- brain: {
300
- via: brain.via,
301
- ...(brain.skillId !== undefined && { skillId: brain.skillId }),
302
- },
303
- }),
304
- ...(activeToolSchemas.length > 0 && {
305
- tools: activeToolSchemas.map((t) => ({
306
- name: t.name,
307
- ...(t.description ? { description: t.description } : {}),
308
- })),
309
- }),
310
- ...(deps.temperature !== undefined && { temperature: deps.temperature }),
311
- });
312
- const startMs = Date.now();
313
- // Auto follows the actual provider/model, including cache-selected models
314
- // and each reliability fallback. Explicit strategies retain their refusals.
315
- const baseRequest = (0, providerRequest_js_1.selectOutputFormat)({
316
- ...(systemPrompt.length > 0 && { systemPrompt }),
317
- messages: wireMessages,
318
- ...(activeToolSchemas.length > 0 && { tools: activeToolSchemas }),
319
- model,
320
- ...(deps.temperature !== undefined && { temperature: deps.temperature }),
321
- ...(deps.maxTokens !== undefined && { maxTokens: deps.maxTokens }),
322
- ...(deps.thinkingBudget !== undefined && {
323
- thinking: { budget: deps.thinkingBudget },
324
- }),
325
- ...(deps.schemaTool !== undefined && {
326
- toolChoice: { type: 'tool', name: deps.schemaTool.name },
327
- }),
328
- ...(deps.outputFormat !== undefined && { outputFormat: deps.outputFormat }),
329
- }, provider, deps.nativeOutputAuto === true, deps.outputFormat);
330
- // v2.6+ — call cache strategy to attach provider-specific cache
331
- // hints. CacheGate has already routed (apply-markers / no-markers)
332
- // and populated scope.cacheMarkers accordingly. Strategy.prepareRequest
333
- // is a pass-through for empty markers.
334
- // A custom strategy can create remote cache handles, so refuse a known
335
- // unsupported effective request before even that preparation does I/O.
336
- (0, providerRequest_js_1.assertForcedRequestSupported)(provider, baseRequest);
337
- const cacheMarkers = (0, replayPrefix_js_1.replayCacheMarkers)(scope.cacheMarkers ?? [], continuing);
338
- const detached = (0, providerRequest_js_1.detachProviderInput)(baseRequest, cacheMarkers, deps.outputFormat);
339
- const citations = (0, citationProjection_js_1.prepareCitationProjection)(scope, deps.offerCitations === true &&
340
- continuing === undefined &&
341
- deps.outputSchemaParser === undefined &&
342
- deps.outputFormat === undefined, committed, wireMessages, detached.request.messages);
343
- const selection = deps.servedTools?.selection &&
344
- (0, selectionAtRequest_js_1.selectionAtRequest)(deps, iteration, scope.$attempt?.(), baseRequest, withheld !== null);
345
- const serving = deps.recordReceipt === false
346
- ? undefined
347
- : (0, servedRequest_js_1.servedRequestRecorder)(scope, committed, messages, wireMessages, detached);
348
- const cachePrepared = await cacheStrategy.prepareRequest(detached.request, detached.markers, {
349
- iteration,
350
- iterationsRemaining: (0, iterationBudget_js_1.iterationsRemainingOf)(deps.maxIterations, iteration),
351
- recentHitRate: scope.recentHitRate,
352
- cachingDisabled: scope.cachingDisabled ?? false,
353
- });
354
- const llmRequest = (0, providerRequest_js_1.selectOutputFormat)(cachePrepared.request, provider, deps.nativeOutputAuto === true, detached.outputFormat);
355
- // Judge the final request on the effective brain/configured model, not
356
- // the agent's build-time default. This is before provider I/O and outside
357
- // the reliability loop: retrying cannot repair an unsupported contract.
358
- (0, providerRequest_js_1.assertForcedRequestSupported)(provider, llmRequest);
359
- // ── THE RECEIPT ──────────────────────────────────────────────────────
360
- // Written HERE, immediately before the provider is called, so it is
361
- // committed in the call-llm bundle that already exists — the llm-turn stop
362
- // a reader already scrubs to. Before rather than after on purpose: the
363
- // stage commits on the error path too, so a call that throws still leaves
364
- // the record of what it was about to send.
365
- //
366
- // Hashes and references only. Every law this record obeys — no bytes, no
367
- // authority omissions, run-salted digests — is stated once, at
368
- // `receipt.ts` · `Receipt`, and enforced by the shape it fills in.
369
- //
370
- // `omittedForAttention` comes from the WINDOW, through `deps.evictedTurns`
371
- // (9.93.0) — never from a scope read. The slots were the first place this
372
- // was looked for, and they drop nothing; the one measured pass that read
373
- // `slotCompositions` here put a tracked get of an always-absent key on
374
- // every call-llm stage's read set, which gave `trajectory.ts` a phantom
375
- // context source per loop and moved the localizer's ranking. The window's
376
- // `compactions` key is absent on every run without a window and would do
377
- // the same. A receipt records what the run knows; it does not go looking —
378
- // so the window hands the turns across, and an agent with no window hands
379
- // nothing.
380
- if (deps.recordReceipt !== false) {
381
- const evictedForAttention = deps.evictedTurns?.read(iteration) ?? [];
382
- const hostStrategy = deps.cacheStrategyIsOverride === true && cacheStrategy === deps.cacheStrategy;
383
- scope[conventions_js_1.RECEIPT_KEY] = (0, receipt_js_1.buildReceipt)({
384
- runId: deps.getRunId?.() ?? '',
385
- epoch: iteration,
386
- model,
387
- provider: provider.name,
388
- systemText: systemPrompt,
389
- systemPieces: (0, receipt_js_1.receiptPieces)(systemPieces),
390
- messages,
391
- requestOnly,
392
- tools: activeToolSchemas,
393
- forced: deps.schemaTool?.name ?? null,
394
- // Read as it always was; the revision's rule rides `withheld`.
395
- withheld: scope.wrapUpAsked === true ? 'wrap-up' : withheld,
396
- baseRequest,
397
- preparedRequest: (0, providerRequest_js_1.receiptProviderRequest)(llmRequest, detached.request, baseRequest, hostStrategy),
398
- // The breakpoints the strategy really APPLIED, not the candidates it
399
- // was offered. `scope.cacheMarkers` already records the offer; which of
400
- // them survived the provider's clamp is the half that decides the bill,
401
- // and it existed only in this local until now.
402
- markersApplied: cachePrepared.markersApplied,
403
- // WHICH strategy the request went through — its `name`, which for the
404
- // built-ins is the capability the provider declared (`'breakpoints'`,
405
- // `'automatic'`, `'none'` for the pass-through). Every agent has one,
406
- // so this is never `null` here; the charts that run none say `null` at
407
- // their own mints. A strategy handed in past the type with no `name`
408
- // is still a strategy, and is recorded as one under the empty name
409
- // rather than denied.
410
- strategy: typeof cacheStrategy.name === 'string' ? cacheStrategy.name : '',
411
- ...(evictedForAttention.length > 0 && { omittedForAttention: evictedForAttention }),
412
- },
413
- // Host strategies can reissue their own objects with nested edits.
414
- hostStrategy ? undefined : deps.receiptDigests);
415
- }
416
- (0, recordModelContext_js_1.recordModelContext)(scope, () => ({
417
- iteration,
418
- systemPieces,
419
- tools: activeToolSchemas,
420
- requestOnly: freshNotes,
421
- }));
422
- // THE CLOSURE CHECK (9.60.0, dangling-reference). At assembly, BEFORE the
423
- // call — the composition defect exists whether or not the call lands. A
424
- // served tool whose declared argument ground (`Tool.argumentsFrom`) has
425
- // left the window (the union of every visit's droppedObservations) and
426
- // has no fresh result in the frame is being offered without its evidence.
427
- // Both fences live in the check: never-dropped is silent (not-yet-grounded
428
- // is legitimate sequencing) and a re-fetched ground is silent.
429
- //
430
- // ONE HELPER, BOTH SIDES. The dropped side is the window ledger, which
431
- // names a result with `toolNameOfMessage` — the helper that recovers the
432
- // name from the assistant turn that asked when the result itself carries
433
- // no `toolName`. The present side asks the SAME helper the SAME question,
434
- // because `LLMMessage.toolName` is optional and a conversation restored
435
- // from an older release (or a host that speaks only the wire shape) names
436
- // its tools through `toolCalls[].id` alone. Reading `m.toolName` here
437
- // instead made the same message evidence-that-left on one side and
438
- // not-present on the other, and the check then accused a window that had
439
- // been RE-GROUNDED — a legitimate re-fetch reported as a dangling
440
- // reference. A false accusation is this family's unrecoverable failure.
441
- if (deps.toolGrounding !== undefined && deps.toolGrounding.size > 0) {
442
- const grounding = deps.toolGrounding;
443
- const servedGrounded = (llmRequest.tools ?? [])
444
- .filter((t) => grounding.has(t.name))
445
- .map((t) => ({ name: t.name, argumentsFrom: grounding.get(t.name) }));
446
- const windowVisits = scope.compactions ??
447
- [];
448
- const droppedResults = new Set(windowVisits.flatMap((v) => v.droppedObservations ?? []));
449
- if (servedGrounded.length > 0 && droppedResults.size > 0) {
450
- // The frame's tool messages, named from `committed` — the stage's ONE
451
- // read of `scope.history`, at its top — rather than
452
- // `llmRequest.messages`: the same messages in the same order
453
- // (stripping removes a FIELD, never a message; the collapse rewrites
454
- // `content` only; the staged-refs nudge is a `role: 'user'` line that
455
- // names no tool), but the wire has lost the batch settlement's marker
456
- // (9.113.0), and a settled sentence is no fresh result — the helper
457
- // says so only when it can see `LLMMessage.notDispatched`
458
- // (`window/toolNames.ts` · "A settled message is not a result at
459
- // all"). Never a second `scope.history` read: every tracked read is a
460
- // narrative step, and one more here renumbered every step after it on
461
- // runs that never settle anything (pinned by
462
- // `src/integrity/dangling-reference/danglingReference.test.ts` · "the narrative").
463
- const frame = committed;
464
- const presentResults = new Set(frame
465
- .map((m) => (0, toolNames_js_1.toolNameOfMessage)(m, frame))
466
- .filter((name) => name !== undefined));
467
- const danglingFindings = (0, check_js_1.danglingReferencesOf)(servedGrounded, droppedResults, presentResults, iteration);
468
- deps.integrityLedger?.current?.note('dangling-reference', 'compose', danglingFindings.length > 0 ? 'checked-fail' : 'checked-pass', danglingFindings.length > 0 ? Date.now() : undefined);
469
- (0, integrityFindings_js_1.fileIntegrityFindings)(scope, danglingFindings, iteration, deps.integrityLedger);
470
- }
471
- else {
472
- // No grounded tool served, or nothing has dropped: nothing this call
473
- // could violate — stated, never silence.
474
- deps.integrityLedger?.current?.note('dangling-reference', 'compose', 'not-applicable');
475
- }
476
- }
477
- // Streaming-first: when the provider implements `stream()` we
478
- // consume chunk-by-chunk so consumers see tokens as they arrive
479
- // instead of waiting for the full LLM call to finish. Non-terminal
480
- // chunks can carry thinking, visible text, or both. The
481
- // terminal chunk SHOULD carry the authoritative `LLMResponse`;
482
- // when it doesn't (older providers, partial implementations) we
483
- // fall back to `complete()` for the authoritative payload —
484
- // keeping the ReAct loop deterministic.
485
- //
486
- // `singleProviderCall` is the per-attempt call function. Used
487
- // directly when reliability is OFF; passed into `executeWithReliability`
488
- // when reliability is configured (the helper invokes it once per
489
- // retry-loop iteration).
490
- //
491
- // `providerHooks` is the resilience-report channel handed to the
492
- // provider on every call. When `deps.provider` is decorated
493
- // (withFallback / withRetry / withCircuitBreaker) its reports become
494
- // in-run typed events with this stage's real runtimeStageId. Built
495
- // once per stage — reused across reliability-loop
496
- // iterations. Named to avoid shadowing `singleProviderCall`'s own
497
- // `hooks` parameter, which is the unrelated `{ onFirstChunk }` bag.
498
- const ordinaryProviderHooks = (0, resilienceHooks_js_1.resilienceHooks)(scope, deps.recordReceipt !== false, deps.onReplayPrepared);
499
- const providerHooks = citations?.attach(ordinaryProviderHooks) ?? ordinaryProviderHooks;
500
- const recall = deps.recallRequests === undefined
501
- ? undefined
502
- : (0, recallRequest_js_1.trackRecallRequests)(systemPieces, committed, wireMessages, continuing?.historyPositions, systemPrompt);
503
- let answeredBy = { provider: provider.name, model, native: false };
504
- let localFallback = false;
505
- let acceptedFindingsRequest;
506
- const choice = deps.sourceConsultation;
507
- let acceptedOffer;
508
- const preserveReplay = deps.hasEvidenceRecovery === true ||
509
- deps.hasFindingsLedger === true ||
510
- tail.length > 0 ||
511
- continuing !== undefined;
512
- let acceptedProjection = false;
513
- const issued = deps.findings === true ? (0, placedTickets_js_1.issuedTicketsOf)(scope.placedTickets) : undefined;
514
- const capture = (req) => (0, admission_js_1.captureFindingsRequest)(req, committed, iteration, issued);
515
- // The run signal reaches the wire. See callLLM/README.md#dispatch-lifetime.
516
- const runSignal = scope.$getEnv?.()?.signal;
517
- const dispatchFor = (0, providerRequest_js_1.providerDispatchFor)(runSignal, deps.nativeOutputAuto === true, detached.outputFormat);
518
- const singleProviderCall = async (req, hooks) => {
519
- const selectedProvider = hooks.provider ?? provider;
520
- req = dispatchFor.forAttempt(req, selectedProvider);
521
- (0, providerRequest_js_1.assertForcedRequestSupported)(selectedProvider, req);
522
- (0, abort_js_1.throwIfAborted)(runSignal);
523
- const attempts = (0, replayAttempt_js_1.replayAttempts)(req, hooks.providerHooks ?? providerHooks);
524
- let dispatch = (0, providerRequest_js_1.describeProviderDispatch)(selectedProvider, req);
525
- let candidate = deps.findings === true ? capture(req) : undefined;
526
- let offer = choice?.capture(scope, req, baseRequest);
527
- let stableProjection = preserveReplay && (0, state_js_1.sameReplayProjection)(wireMessages, req.messages);
528
- if (selectedProvider !== provider)
529
- serving?.discard();
530
- const selectionAttempt = selection?.attempt();
531
- const ordinaryHooks = (0, servedRequest_js_1.observeCallRequests)(attempts.hooks, !selectionAttempt &&
532
- serving === undefined &&
533
- deps.findings !== true &&
534
- !preserveReplay &&
535
- choice === undefined
536
- ? undefined
537
- : (request) => {
538
- selectionAttempt?.observe(request);
539
- serving?.beforeRequest(request);
540
- if (deps.findings === true)
541
- candidate = capture(request);
542
- if (choice !== undefined)
543
- offer = choice.capture(scope, request, baseRequest, offer);
544
- if (preserveReplay)
545
- stableProjection = (0, state_js_1.sameReplayProjection)(wireMessages, request.messages);
546
- }, serving?.discard);
547
- const attemptHooks = recall?.hooks(ordinaryHooks) ?? ordinaryHooks;
548
- // THE STREAM CARRIES WHAT STANDS (9.114.2, `.findings()`): each chunk
549
- // goes through the scanner the answer's peel uses, so a token never
550
- // carries the model's `_findings` notes — not even when a chunk ends
551
- // part way through the key — and the tokens join to exactly the text
552
- // the run hands back. A fresh scanner per attempt; unarmed, the chunks
553
- // go out as the provider sent them.
554
- const shown = deps.suppressDraftTokens === true ? undefined : peel?.reservedMemberFilter();
555
- const liveChunks = (0, liveChunks_js_1.liveChunkEmitter)(scope, runSignal, {
556
- providerName: selectedProvider.name,
557
- iteration,
558
- suppressDraftTokens: deps.suppressDraftTokens === true,
559
- allowHeldProviderSummary: deps.allowHeldProviderSummary === true,
560
- textFilter: shown,
561
- onFirstChunk: hooks.onFirstChunk,
562
- });
563
- let resp = await (0, servedRequest_js_1.callObserved)(selectedProvider, attempts.request, attemptHooks, runSignal, liveChunks, () => {
564
- const completion = selectedProvider.stream
565
- ? dispatchFor.select(attempts.request, selectedProvider)
566
- : attempts.request;
567
- dispatch = (0, providerRequest_js_1.describeProviderDispatch)(selectedProvider, completion);
568
- if (deps.findings === true)
569
- candidate = capture(completion);
570
- if (choice !== undefined)
571
- offer = choice.capture(scope, completion, baseRequest);
572
- if (preserveReplay)
573
- stableProjection = (0, state_js_1.sameReplayProjection)(wireMessages, completion.messages);
574
- return completion;
575
- });
576
- // An answer that arrived after the abort is not an answer: refused here,
577
- // before the usage is counted, the turn committed or `llm_end` fired.
578
- (0, abort_js_1.throwIfAborted)(runSignal);
579
- // `'tool-forced'`: the answer arrived as the synthetic tool's ARGUMENTS,
580
- // so it is moved into `content` and the call is taken off the list here,
581
- // at the single seam every later reader goes through. Everything
582
- // downstream — the reliability validator, the scope writes, the Route
583
- // decider, the retry loop — then sees the response it would have seen
584
- // under `'instruct'`: a final answer that is a JSON string, and no tool
585
- // calls. One normalization, no second code path, and nothing further
586
- // down has to know which strategy is in force.
587
- const forcedName = deps.schemaTool?.name;
588
- if (forcedName !== undefined) {
589
- const answer = (0, outputEnforcement_js_1.readSchemaToolAnswer)(resp);
590
- if (answer !== undefined) {
591
- resp = {
592
- ...resp,
593
- content: answer,
594
- toolCalls: resp.toolCalls.filter((tc) => tc.name !== forcedName),
595
- };
596
- }
597
- }
598
- const answered = hooks.providerIndex === undefined
599
- ? resp
600
- : (0, dispatch_js_1.tagThinkingResponse)(resp, String(hooks.providerIndex));
601
- answeredBy = dispatch;
602
- acceptedFindingsRequest = candidate;
603
- acceptedOffer = offer;
604
- acceptedProjection = stableProjection;
605
- const result = attempts.response(answered);
606
- selectionAttempt?.finish(result);
607
- return result;
608
- };
609
- // v2.13 — build the output-schema validator hook when both
610
- // reliability + outputSchemaParser are configured. The reliability
611
- // loop applies the validator only on terminal turns (toolCalls
612
- // empty) so tool-using turns aren't rejected for failing the final-
613
- // answer schema. ValidationFailure carries `stage` + `path` for the
614
- // typed event payload.
615
- let postValidate;
616
- if (deps.outputSchemaParser !== undefined) {
617
- const parser = deps.outputSchemaParser;
618
- postValidate = (response) => {
619
- try {
620
- // Judged with the reserved answer key peeled under the arm
621
- // (9.101.0): this runs BEFORE the route decider's own peel, and a
622
- // strict schema must see the answer the model meant, not the
623
- // envelope its standings rode in on. Unarmed: the content itself.
624
- (0, outputSchema_js_1.applyOutputSchema)(peel !== undefined
625
- ? peel.peelAnswerFindings(response.content).content
626
- : response.content, parser);
627
- }
628
- catch (err) {
629
- // applyOutputSchema throws OutputSchemaError with
630
- // {stage, rawOutput, cause}. Convert to ValidationFailure for
631
- // the gate's typed handling. Pull a `path` if the underlying
632
- // cause exposes Zod-style issues. Use the cause's message
633
- // (the actual parser error) when available, falling back to
634
- // the wrapper's message for parsers without a cause.
635
- const e = err;
636
- let path;
637
- const firstIssue = e.cause?.issues?.[0];
638
- if (firstIssue?.path && firstIssue.path.length > 0) {
639
- path = firstIssue.path.join('.');
640
- }
641
- // Use cause message when present (parsers like Zod attach the
642
- // real error as cause); fall back to wrapper message.
643
- const message = e.cause?.message ?? e.message;
644
- throw new reliabilityExecution_js_1.ValidationFailure({
645
- message,
646
- stage: e.stage ?? 'schema-validate',
647
- ...(path !== undefined && { path }),
648
- ...(e.rawOutput !== undefined && { rawOutput: e.rawOutput }),
649
- });
650
- }
651
- };
652
- }
653
- let response;
654
- if (deps.reliability) {
655
- response = await (0, reliabilityExecution_js_1.executeWithReliability)(scope, llmRequest, deps.reliability, provider, provider.name, model, singleProviderCall, postValidate, {
656
- ...(deps.withholdDraftContent === true && { withholdDraftContent: true }),
657
- providerHooks,
658
- prepareFallback: (request) => {
659
- serving?.discard();
660
- const witness = deps.findings === true ? capture(request) : undefined;
661
- return () => {
662
- // A local answer does not inherit the replaced provider's stop reason
663
- // or native generation. The callback may return arbitrary text.
664
- localFallback = true;
665
- acceptedFindingsRequest = witness;
666
- };
667
- },
668
- ...(deps.outputFormat !== undefined && {
669
- isTerminalRefusal: (response) => answeredBy.native && response.stopReason === 'refusal',
670
- }),
671
- });
672
- // `executeWithReliability` returns `undefined` when it took the
673
- // fail-fast path. It already wrote scope state and called
674
- // `$break(reason)` — `Agent.run()` translates the propagated
675
- // break into a `ReliabilityFailFastError` at the API boundary.
676
- // File the incomplete request when armed. There is no response to commit.
677
- if (response === undefined) {
678
- if (recall !== undefined)
679
- deps.recallRequests?.(scope, iteration, recall.summary('incomplete'));
680
- return;
681
- }
682
- }
683
- else {
684
- response = await singleProviderCall(llmRequest, {});
685
- }
686
- // Preserve the pending carrier if the provider fails, so crash recovery
687
- // retries the same instruction. The prior committed value proves delivery.
688
- if (recoveryPiece !== undefined)
689
- scope.evidenceRecoveryUsed = true;
690
- const durationMs = Date.now() - startMs;
691
- scope.totalInputTokens = scope.totalInputTokens + response.usage.input;
692
- scope.totalOutputTokens = scope.totalOutputTokens + response.usage.output;
693
- // Cache reads as a cost (9.110.0) — VALUE-conditional: the key exists
694
- // only once a provider has reported one, so a provider that reports
695
- // none (the mock, a local model) writes nothing and keeps its bytes.
696
- if (typeof response.usage.cacheRead === 'number') {
697
- scope.totalCacheReadTokens = (scope.totalCacheReadTokens ?? 0) + response.usage.cacheRead;
698
- }
699
- const acceptedToolCalls = (0, commitResponse_js_1.commitAcceptedResponse)(scope, deps, response, serving, {
700
- localFallback,
701
- answeredBy,
702
- findingsRequest: acceptedFindingsRequest,
703
- citationOffer: citations?.accepted(response),
704
- sourceOffer: acceptedOffer,
705
- iteration,
706
- recall: recall?.summary(localFallback ? 'local' : 'provider'),
707
- });
708
- // A response owns its replay evidence, never the previous response's.
709
- // The presence trap does not record a read on never-replay providers.
710
- if (response.replay !== undefined || 'llmLatestReplay' in scope) {
711
- scope.llmLatestReplay = response.replay === undefined ? undefined : [response.replay];
712
- }
713
- const nextReplay = !localFallback && acceptedProjection
714
- ? (0, state_js_1.afterReplayResponse)(response, continuing === undefined ? [] : replayFrames ?? [], (replay) => (0, replayPrefix_js_1.captureReplayPrefix)(replay, history, messages, tail, continuing?.frozenBefore ?? 0), deps.toolsOffAfterRevision === true)
715
- : undefined;
716
- if (nextReplay !== undefined || replayFrames !== undefined)
717
- (0, native_js_1.writeRequestReplay)(scope, nextReplay);
718
- // v2.14 — hand provider-specific raw thinking data to the
719
- // NormalizeThinking sub-subflow (the next stage in sf-call-llm
720
- // when a ThinkingHandler is configured). Undefined when the
721
- // provider has no thinking content for this call (most calls).
722
- if (response.rawThinking !== undefined || 'rawThinking' in scope) {
723
- scope.rawThinking =
724
- response.rawThinking;
725
- }
726
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.llm_end', {
727
- iteration,
728
- // Under the arm, the content as the stream showed it (9.114.2) — the
729
- // committed `llmLatestContent` below keeps what the model sent.
730
- content: deps.withholdDraftContent === true
731
- ? ''
732
- : peel !== undefined
733
- ? peel.withoutReservedMembers(response.content).text
734
- : response.content,
735
- ...(deps.withholdDraftContent === true && { contentWithheld: true }),
736
- toolCallCount: response.toolCalls.length,
737
- usage: response.usage,
738
- stopReason: response.stopReason,
739
- durationMs,
740
- });
741
- (0, recordWireFindings_js_1.recordWireFindings)(scope, llmRequest, response, answeredBy, iteration, deps);
742
- // THE CHOICE SEAM (9.63.0, unsupported-argument). The wire check above
743
- // asks what the library put in front of the model; this asks what the
744
- // model did with it. For every call to an ARMED tool (one whose author
745
- // declared `argumentsFrom`), each identifier-like string argument must
746
- // appear somewhere in the frame this very call was assembled from.
747
- //
748
- // THE CORPUS IS SPLIT, and the split is the whole check. The system
749
- // prompt, every user message and every tool result are things the RUN
750
- // served. The assistant turns are things the MODEL wrote — deliberately
751
- // not ground, because a value whose only source is the model's own
752
- // rendered prose has been re-derived from a rendering instead of read
753
- // from evidence. That is the recorded failure exactly: a truncated job
754
- // name mined out of a prior answer, passed as a machine name, answered
755
- // with an honest "nothing found", reported to a person as fact.
756
- //
757
- // `llmRequest` is the frame — the object handed to the adapter, after the
758
- // cache strategy's transform — so the check judges the choice against
759
- // what the model actually saw, never against scope history it did not.
760
- if (deps.toolGrounding !== undefined && deps.toolGrounding.size > 0) {
761
- const grounding = deps.toolGrounding;
762
- const armedCalls = acceptedToolCalls.filter((c) => grounding.has(c.name));
763
- if (armedCalls.length > 0) {
764
- const schemaOf = new Map((llmRequest.tools ?? []).map((t) => [t.name, t.inputSchema]));
765
- const frameMessages = llmRequest.messages;
766
- // THE EXTERNAL-GROUND DOOR (9.72.0). The app may vouch for values the
767
- // run never served — a human clicked a row, the app verified the
768
- // clicked cells against the artifact the panel renders — and those
769
- // entries join the grounded corpus for THIS response only, consulted
770
- // fresh each time because the selection moves between turns. The
771
- // library records what the app asserts; the source label rides every
772
- // excusal so a reader can audit the chain.
773
- const external = (0, externalGrounds_js_1.readExternalGrounds)(deps.externalGrounds);
774
- const { findings: argumentFindings, externalGroundings, occurrences, } = (0, check_js_2.unsupportedArgumentsOf)(armedCalls.map((c) => ({
775
- toolName: c.name,
776
- toolCallId: c.id,
777
- ...(0, callOccurrence_js_1.callOccurrenceField)(c.callOccurrenceKey),
778
- // Peel the model's `_findings` metadata before reading argument
779
- // leaves. Grounded registry tools reserve that key. With sources
780
- // alone, only ruled tools advertise it in their served schemas.
781
- args: deps.findings === true ||
782
- (deps.argumentSources === true && (0, reserved_js_1.carriesFindingsDecoration)(schemaOf.get(c.name)))
783
- ? (0, reserved_js_1.splitFindings)(c.args).args
784
- : c.args,
785
- argumentsFrom: grounding.get(c.name) ?? [],
786
- // The enum fence reads the schema WITHOUT the decoration: the
787
- // reserved words (`direct`, `fact`, `noise`, `user`, …) are the
788
- // model's vocabulary for a declaration, never an excuse for an
789
- // argument.
790
- declaredEnums: (0, check_js_2.declaredEnumValuesOf)(deps.findings === true || deps.argumentSources === true
791
- ? (0, reserved_js_1.withoutFindingsArgument)(schemaOf.get(c.name))
792
- : schemaOf.get(c.name)),
793
- })), {
794
- grounded: [
795
- // The recovery piece quotes the model's words; only the trusted
796
- // system injections count as grounds when that piece is present.
797
- // Findings DATA is a request-only message after history.
798
- ...(systemRecovery === undefined
799
- ? llmRequest.systemPrompt === undefined
800
- ? []
801
- : [llmRequest.systemPrompt]
802
- : // A cache strategy can rewrite the request. If it rewrote
803
- // this mixed-trust system slot, its provenance is unknown;
804
- // never credit either the rejected draft or an unsent base.
805
- llmRequest.systemPrompt === systemPrompt
806
- ? [trustedSystemPrompt]
807
- : []),
808
- // Every tool result as the TOOL's own bytes — the inputs layer's note
809
- // after a filled call's result is the library's words (`groundedTextOf`).
810
- ...(0, groundedText_js_1.groundedTextOf)(frameMessages, committed, continuing?.historyPositions),
811
- ],
812
- assistant: frameMessages.filter((m) => m.role === 'assistant').map((m) => m.content),
813
- ...(external.length > 0 && { external }),
814
- }, iteration);
815
- deps.integrityLedger?.current?.note('unsupported-argument', 'choice', argumentFindings.length > 0 ? 'checked-fail' : 'checked-pass', argumentFindings.length > 0 ? Date.now() : undefined);
816
- (0, integrityFindings_js_1.fileIntegrityFindings)(scope, argumentFindings, iteration, deps.integrityLedger, (finding) => occurrences.get(finding));
817
- // Each excusal is a per-attempt fact and rides the emit channel —
818
- // deliberately NOT deduplicated the way findings are: a repeated call
819
- // is a fresh choice, and each excusal names the assertion that stood
820
- // between that choice and a finding.
821
- for (const g of externalGroundings) {
822
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.integrity.external_ground_used', {
823
- toolName: g.toolName,
824
- toolCallId: g.toolCallId,
825
- path: g.path,
826
- value: g.value,
827
- source: g.source,
828
- iteration,
829
- });
830
- }
831
- }
832
- else {
833
- // No armed tool was called this turn — a response with nothing this
834
- // check could be about. Stated, never silence.
835
- deps.integrityLedger?.current?.note('unsupported-argument', 'choice', 'not-applicable');
836
- }
837
- // THE WRITE SEAM'S other half (9.77.0). `empty-lookup` is judged where
838
- // the RESULT is — the tool-dispatch boundary — but a response that
839
- // asked for no armed tool can never produce an armed result, and that
840
- // is decidable here, at the one stage every iteration passes through.
841
- // Saying it out loud is what keeps an armed row from sitting untouched
842
- // through a run that simply never called a declaring tool: a
843
- // not-applicable row is an answer, and an untouched one reads as rot.
844
- if (deps.noticeEmptyLookups === true && armedCalls.length === 0) {
845
- deps.integrityLedger?.current?.note('empty-lookup', 'write', 'not-applicable');
846
- }
847
- }
848
- // Column checks arm independently of argumentsFrom. Results are judged at
849
- // write; here, a response with no currently declaring call states NA in
850
- // both rows. An opaque provider still owes this note when its set is empty.
851
- // A function observes declarations after this iteration's actual discovery.
852
- if (deps.columnDeclaringTools !== undefined) {
853
- const declaring = typeof deps.columnDeclaringTools === 'function'
854
- ? deps.columnDeclaringTools(response.toolCalls.map((call) => call.name))
855
- : deps.columnDeclaringTools;
856
- if (!response.toolCalls.some((c) => declaring.has(c.name))) {
857
- deps.integrityLedger?.current?.note('column-type-mismatch', 'write', 'not-applicable');
858
- deps.integrityLedger?.current?.note('missing-column', 'write', 'not-applicable');
859
- }
860
- }
861
- if (deps.toolChoice === true) {
862
- // `import()` — the optional-family law of docs-next's site budget (the
863
- // `toolCalls/evidence/judgeLanded.ts · judgeLanded` precedent): an unarmed agent never loads
864
- // the module; the slot loads the same one under the same gate.
865
- const { recordToolChoiceOutcome } = await Promise.resolve().then(() => __importStar(require('../toolChoice/record.js')));
866
- recordToolChoiceOutcome(scope, response, iteration);
867
- }
868
- // Attribute the successful response to its actual selected transport/model.
869
- (0, cost_js_1.emitCostTick)(scope, deps.pricingTable, deps.costBudget, answeredBy, response.usage);
870
- const selected = localFallback ? undefined : selection?.accept(response);
871
- if (selected && deps.servedTools && deps.canRecordToolSelection?.())
872
- (0, recordToolSelection_js_1.recordToolSelection)(scope, selected, deps.servedTools, choice);
48
+ const prepared = await (0, prepareCall_js_1.prepareCall)(scope, deps);
49
+ const executed = await (0, executeCall_js_1.executeCall)(scope, deps, prepared);
50
+ if (executed === undefined)
51
+ return;
52
+ if ((0, providerIntervention_js_1.admitProviderIntervention)(scope, executed.response, () => (0, responseAccounting_js_1.recordTerminalResponse)(scope, deps, prepared, executed)))
53
+ return;
54
+ await (0, acceptResponse_js_1.acceptResponse)(scope, deps, prepared, executed);
873
55
  };
874
56
  }
875
57
  exports.buildCallLLMStage = buildCallLLMStage;