agentfootprint 10.3.1 → 10.5.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 (749) hide show
  1. package/AGENTS.md +2 -2
  2. package/CAPABILITIES.md +12 -1
  3. package/README.md +44 -0
  4. package/ai-instructions/claude-code/SKILL.md +2 -2
  5. package/ai-instructions/clinerules +22 -11
  6. package/ai-instructions/copilot-instructions.md +22 -11
  7. package/ai-instructions/cursor/agentfootprint.md +22 -11
  8. package/ai-instructions/kiro/agentfootprint.md +22 -11
  9. package/ai-instructions/windsurfrules +22 -11
  10. package/dist/adapters/llm/AnthropicProvider.js +26 -8
  11. package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
  12. package/dist/adapters/llm/BedrockProvider.js +23 -7
  13. package/dist/adapters/llm/BedrockProvider.js.map +1 -1
  14. package/dist/adapters/llm/BrowserAnthropicProvider.js +57 -49
  15. package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  16. package/dist/adapters/llm/BrowserOpenAIProvider.js +50 -42
  17. package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
  18. package/dist/adapters/llm/FoundryLocalProvider.js +174 -212
  19. package/dist/adapters/llm/FoundryLocalProvider.js.map +1 -1
  20. package/dist/adapters/llm/GeminiProvider.js +23 -9
  21. package/dist/adapters/llm/GeminiProvider.js.map +1 -1
  22. package/dist/adapters/llm/InvokeModelGatewayProvider.js +32 -9
  23. package/dist/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
  24. package/dist/adapters/llm/MockProvider.js +11 -3
  25. package/dist/adapters/llm/MockProvider.js.map +1 -1
  26. package/dist/adapters/llm/OllamaProvider.js +129 -167
  27. package/dist/adapters/llm/OllamaProvider.js.map +1 -1
  28. package/dist/adapters/llm/OpenAIProvider.js +36 -9
  29. package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
  30. package/dist/adapters/mcp/agentcoreRuntime/errorType.js +24 -0
  31. package/dist/adapters/mcp/agentcoreRuntime/errorType.js.map +1 -0
  32. package/dist/adapters/mcp/agentcoreRuntime/invoke.js +272 -0
  33. package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -0
  34. package/dist/adapters/mcp/agentcoreRuntime/safeAnswer.js +415 -0
  35. package/dist/adapters/mcp/agentcoreRuntime/safeAnswer.js.map +1 -0
  36. package/dist/adapters/mcp/agentcoreRuntime/session.js +179 -0
  37. package/dist/adapters/mcp/agentcoreRuntime/session.js.map +1 -0
  38. package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +117 -0
  39. package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -0
  40. package/dist/adapters/mcp/agentcoreRuntime/strictJson.js +220 -0
  41. package/dist/adapters/mcp/agentcoreRuntime/strictJson.js.map +1 -0
  42. package/dist/adapters/mcp/agentcoreRuntime/transport.js +222 -0
  43. package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -0
  44. package/dist/adapters/memory/agentcore.js +435 -20
  45. package/dist/adapters/memory/agentcore.js.map +1 -1
  46. package/dist/adapters/memory/memoryBank.js +16 -3
  47. package/dist/adapters/memory/memoryBank.js.map +1 -1
  48. package/dist/adapters/memory/pgVector.js +10 -4
  49. package/dist/adapters/memory/pgVector.js.map +1 -1
  50. package/dist/adapters/memory/redis.js +11 -3
  51. package/dist/adapters/memory/redis.js.map +1 -1
  52. package/dist/adapters/memory/s3Vectors.js +8 -3
  53. package/dist/adapters/memory/s3Vectors.js.map +1 -1
  54. package/dist/adapters/memory/sqliteVector.js +10 -4
  55. package/dist/adapters/memory/sqliteVector.js.map +1 -1
  56. package/dist/ag-ui/adapter.js +126 -0
  57. package/dist/ag-ui/adapter.js.map +1 -0
  58. package/dist/ag-ui/framing.js +68 -0
  59. package/dist/ag-ui/framing.js.map +1 -0
  60. package/dist/ag-ui/frontendTools.js +69 -0
  61. package/dist/ag-ui/frontendTools.js.map +1 -0
  62. package/dist/ag-ui/ids.js +54 -0
  63. package/dist/ag-ui/ids.js.map +1 -0
  64. package/dist/ag-ui/index.js +29 -0
  65. package/dist/ag-ui/index.js.map +1 -0
  66. package/dist/ag-ui/request.js +416 -0
  67. package/dist/ag-ui/request.js.map +1 -0
  68. package/dist/ag-ui/serializer.js +899 -0
  69. package/dist/ag-ui/serializer.js.map +1 -0
  70. package/dist/ag-ui/types.js +22 -0
  71. package/dist/ag-ui/types.js.map +1 -0
  72. package/dist/answer-validation/index.js +8 -1
  73. package/dist/answer-validation/index.js.map +1 -1
  74. package/dist/answer-validation/toolLedger.js +130 -0
  75. package/dist/answer-validation/toolLedger.js.map +1 -0
  76. package/dist/answer-validation/types.js.map +1 -1
  77. package/dist/answer-validation/validate.js +25 -3
  78. package/dist/answer-validation/validate.js.map +1 -1
  79. package/dist/classify/typesafe.js +31 -23
  80. package/dist/classify/typesafe.js.map +1 -1
  81. package/dist/core/Agent.js +106 -20
  82. package/dist/core/Agent.js.map +1 -1
  83. package/dist/core/LLMCall.js +16 -6
  84. package/dist/core/LLMCall.js.map +1 -1
  85. package/dist/core/RunnerBase.js +99 -13
  86. package/dist/core/RunnerBase.js.map +1 -1
  87. package/dist/core/agent/buildAgentChart.js +17 -5
  88. package/dist/core/agent/buildAgentChart.js.map +1 -1
  89. package/dist/core/agent/buildAgentMessageApiChart.js +22 -2
  90. package/dist/core/agent/buildAgentMessageApiChart.js.map +1 -1
  91. package/dist/core/agent/buildDynamicAgentChart.js +23 -4
  92. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  93. package/dist/core/agent/buildMessageApiChart.js +22 -2
  94. package/dist/core/agent/buildMessageApiChart.js.map +1 -1
  95. package/dist/core/agent/callerIdentity.js +2 -1
  96. package/dist/core/agent/callerIdentity.js.map +1 -1
  97. package/dist/core/agent/stages/answerValidation.js +22 -1
  98. package/dist/core/agent/stages/answerValidation.js.map +1 -1
  99. package/dist/core/agent/stages/callLLM.js +19 -3
  100. package/dist/core/agent/stages/callLLM.js.map +1 -1
  101. package/dist/core/agent/stages/routeTurn.js +17 -4
  102. package/dist/core/agent/stages/routeTurn.js.map +1 -1
  103. package/dist/core/agent/stages/seed.js +58 -8
  104. package/dist/core/agent/stages/seed.js.map +1 -1
  105. package/dist/core/agent/stages/timeLayer.js +2 -2
  106. package/dist/core/agent/stages/timeLayer.js.map +1 -1
  107. package/dist/core/agent/stages/toolCalls.js +85 -25
  108. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  109. package/dist/core/agent/window/strategies/summarizeOldest.js +4 -0
  110. package/dist/core/agent/window/strategies/summarizeOldest.js.map +1 -1
  111. package/dist/core/agent/window/summarize.js +6 -3
  112. package/dist/core/agent/window/summarize.js.map +1 -1
  113. package/dist/core/memberRun.js +293 -0
  114. package/dist/core/memberRun.js.map +1 -0
  115. package/dist/core/requestOfRun.js +28 -0
  116. package/dist/core/requestOfRun.js.map +1 -0
  117. package/dist/core/slots/buildToolsSlot.js +11 -25
  118. package/dist/core/slots/buildToolsSlot.js.map +1 -1
  119. package/dist/core-flow/Conditional.js +39 -12
  120. package/dist/core-flow/Conditional.js.map +1 -1
  121. package/dist/core-flow/Graph.js +48 -17
  122. package/dist/core-flow/Graph.js.map +1 -1
  123. package/dist/core-flow/Loop.js +39 -13
  124. package/dist/core-flow/Loop.js.map +1 -1
  125. package/dist/core-flow/Parallel.js +53 -21
  126. package/dist/core-flow/Parallel.js.map +1 -1
  127. package/dist/core-flow/Sequence.js +39 -12
  128. package/dist/core-flow/Sequence.js.map +1 -1
  129. package/dist/core-flow/Workflow.js +44 -14
  130. package/dist/core-flow/Workflow.js.map +1 -1
  131. package/dist/doors/ag-ui.js +36 -0
  132. package/dist/doors/ag-ui.js.map +1 -0
  133. package/dist/doors/security.js +2 -1
  134. package/dist/doors/security.js.map +1 -1
  135. package/dist/esm/adapters/llm/AnthropicProvider.d.ts +9 -2
  136. package/dist/esm/adapters/llm/AnthropicProvider.js +26 -8
  137. package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
  138. package/dist/esm/adapters/llm/BedrockProvider.d.ts +6 -1
  139. package/dist/esm/adapters/llm/BedrockProvider.js +23 -7
  140. package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
  141. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +57 -49
  142. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  143. package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +50 -42
  144. package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
  145. package/dist/esm/adapters/llm/FoundryLocalProvider.js +171 -209
  146. package/dist/esm/adapters/llm/FoundryLocalProvider.js.map +1 -1
  147. package/dist/esm/adapters/llm/GeminiProvider.js +23 -9
  148. package/dist/esm/adapters/llm/GeminiProvider.js.map +1 -1
  149. package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js +32 -9
  150. package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
  151. package/dist/esm/adapters/llm/MockProvider.js +11 -3
  152. package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
  153. package/dist/esm/adapters/llm/OllamaProvider.js +126 -164
  154. package/dist/esm/adapters/llm/OllamaProvider.js.map +1 -1
  155. package/dist/esm/adapters/llm/OpenAIProvider.d.ts +6 -1
  156. package/dist/esm/adapters/llm/OpenAIProvider.js +36 -9
  157. package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
  158. package/dist/esm/adapters/mcp/agentcoreRuntime/errorType.d.ts +12 -0
  159. package/dist/esm/adapters/mcp/agentcoreRuntime/errorType.js +20 -0
  160. package/dist/esm/adapters/mcp/agentcoreRuntime/errorType.js.map +1 -0
  161. package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +116 -0
  162. package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +267 -0
  163. package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -0
  164. package/dist/esm/adapters/mcp/agentcoreRuntime/safeAnswer.d.ts +49 -0
  165. package/dist/esm/adapters/mcp/agentcoreRuntime/safeAnswer.js +409 -0
  166. package/dist/esm/adapters/mcp/agentcoreRuntime/safeAnswer.js.map +1 -0
  167. package/dist/esm/adapters/mcp/agentcoreRuntime/session.d.ts +80 -0
  168. package/dist/esm/adapters/mcp/agentcoreRuntime/session.js +175 -0
  169. package/dist/esm/adapters/mcp/agentcoreRuntime/session.js.map +1 -0
  170. package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +61 -0
  171. package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +112 -0
  172. package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -0
  173. package/dist/esm/adapters/mcp/agentcoreRuntime/strictJson.d.ts +37 -0
  174. package/dist/esm/adapters/mcp/agentcoreRuntime/strictJson.js +215 -0
  175. package/dist/esm/adapters/mcp/agentcoreRuntime/strictJson.js.map +1 -0
  176. package/dist/esm/adapters/mcp/agentcoreRuntime/transport.d.ts +199 -0
  177. package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +217 -0
  178. package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -0
  179. package/dist/esm/adapters/memory/agentcore.d.ts +152 -7
  180. package/dist/esm/adapters/memory/agentcore.js +433 -19
  181. package/dist/esm/adapters/memory/agentcore.js.map +1 -1
  182. package/dist/esm/adapters/memory/memoryBank.d.ts +3 -2
  183. package/dist/esm/adapters/memory/memoryBank.js +16 -3
  184. package/dist/esm/adapters/memory/memoryBank.js.map +1 -1
  185. package/dist/esm/adapters/memory/pgVector.js +10 -4
  186. package/dist/esm/adapters/memory/pgVector.js.map +1 -1
  187. package/dist/esm/adapters/memory/redis.d.ts +8 -3
  188. package/dist/esm/adapters/memory/redis.js +11 -3
  189. package/dist/esm/adapters/memory/redis.js.map +1 -1
  190. package/dist/esm/adapters/memory/s3Vectors.js +8 -3
  191. package/dist/esm/adapters/memory/s3Vectors.js.map +1 -1
  192. package/dist/esm/adapters/memory/sqliteVector.js +10 -4
  193. package/dist/esm/adapters/memory/sqliteVector.js.map +1 -1
  194. package/dist/esm/ag-ui/adapter.d.ts +118 -0
  195. package/dist/esm/ag-ui/adapter.js +122 -0
  196. package/dist/esm/ag-ui/adapter.js.map +1 -0
  197. package/dist/esm/ag-ui/framing.d.ts +52 -0
  198. package/dist/esm/ag-ui/framing.js +64 -0
  199. package/dist/esm/ag-ui/framing.js.map +1 -0
  200. package/dist/esm/ag-ui/frontendTools.d.ts +37 -0
  201. package/dist/esm/ag-ui/frontendTools.js +64 -0
  202. package/dist/esm/ag-ui/frontendTools.js.map +1 -0
  203. package/dist/esm/ag-ui/ids.d.ts +43 -0
  204. package/dist/esm/ag-ui/ids.js +49 -0
  205. package/dist/esm/ag-ui/ids.js.map +1 -0
  206. package/dist/esm/ag-ui/index.d.ts +19 -0
  207. package/dist/esm/ag-ui/index.js +19 -0
  208. package/dist/esm/ag-ui/index.js.map +1 -0
  209. package/dist/esm/ag-ui/request.d.ts +151 -0
  210. package/dist/esm/ag-ui/request.js +408 -0
  211. package/dist/esm/ag-ui/request.js.map +1 -0
  212. package/dist/esm/ag-ui/serializer.d.ts +173 -0
  213. package/dist/esm/ag-ui/serializer.js +895 -0
  214. package/dist/esm/ag-ui/serializer.js.map +1 -0
  215. package/dist/esm/ag-ui/types.d.ts +305 -0
  216. package/dist/esm/ag-ui/types.js +19 -0
  217. package/dist/esm/ag-ui/types.js.map +1 -0
  218. package/dist/esm/answer-validation/index.d.ts +2 -1
  219. package/dist/esm/answer-validation/index.js +1 -0
  220. package/dist/esm/answer-validation/index.js.map +1 -1
  221. package/dist/esm/answer-validation/toolLedger.d.ts +65 -0
  222. package/dist/esm/answer-validation/toolLedger.js +121 -0
  223. package/dist/esm/answer-validation/toolLedger.js.map +1 -0
  224. package/dist/esm/answer-validation/types.d.ts +48 -0
  225. package/dist/esm/answer-validation/types.js.map +1 -1
  226. package/dist/esm/answer-validation/validate.d.ts +2 -2
  227. package/dist/esm/answer-validation/validate.js +25 -3
  228. package/dist/esm/answer-validation/validate.js.map +1 -1
  229. package/dist/esm/classify/typesafe.js +30 -22
  230. package/dist/esm/classify/typesafe.js.map +1 -1
  231. package/dist/esm/core/Agent.d.ts +11 -1
  232. package/dist/esm/core/Agent.js +107 -21
  233. package/dist/esm/core/Agent.js.map +1 -1
  234. package/dist/esm/core/LLMCall.d.ts +2 -1
  235. package/dist/esm/core/LLMCall.js +17 -7
  236. package/dist/esm/core/LLMCall.js.map +1 -1
  237. package/dist/esm/core/RunnerBase.d.ts +39 -8
  238. package/dist/esm/core/RunnerBase.js +97 -12
  239. package/dist/esm/core/RunnerBase.js.map +1 -1
  240. package/dist/esm/core/agent/buildAgentChart.js +17 -5
  241. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  242. package/dist/esm/core/agent/buildAgentMessageApiChart.d.ts +16 -0
  243. package/dist/esm/core/agent/buildAgentMessageApiChart.js +22 -2
  244. package/dist/esm/core/agent/buildAgentMessageApiChart.js.map +1 -1
  245. package/dist/esm/core/agent/buildDynamicAgentChart.js +23 -4
  246. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  247. package/dist/esm/core/agent/buildMessageApiChart.d.ts +16 -0
  248. package/dist/esm/core/agent/buildMessageApiChart.js +22 -2
  249. package/dist/esm/core/agent/buildMessageApiChart.js.map +1 -1
  250. package/dist/esm/core/agent/callerIdentity.js +2 -1
  251. package/dist/esm/core/agent/callerIdentity.js.map +1 -1
  252. package/dist/esm/core/agent/stages/answerValidation.js +22 -1
  253. package/dist/esm/core/agent/stages/answerValidation.js.map +1 -1
  254. package/dist/esm/core/agent/stages/callLLM.js +19 -3
  255. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  256. package/dist/esm/core/agent/stages/routeTurn.d.ts +1 -1
  257. package/dist/esm/core/agent/stages/routeTurn.js +17 -4
  258. package/dist/esm/core/agent/stages/routeTurn.js.map +1 -1
  259. package/dist/esm/core/agent/stages/seed.d.ts +18 -1
  260. package/dist/esm/core/agent/stages/seed.js +58 -8
  261. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  262. package/dist/esm/core/agent/stages/timeLayer.js +2 -2
  263. package/dist/esm/core/agent/stages/timeLayer.js.map +1 -1
  264. package/dist/esm/core/agent/stages/toolCalls.d.ts +32 -1
  265. package/dist/esm/core/agent/stages/toolCalls.js +85 -25
  266. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  267. package/dist/esm/core/agent/types.d.ts +26 -6
  268. package/dist/esm/core/agent/window/strategies/summarizeOldest.js +4 -0
  269. package/dist/esm/core/agent/window/strategies/summarizeOldest.js.map +1 -1
  270. package/dist/esm/core/agent/window/summarize.js +6 -3
  271. package/dist/esm/core/agent/window/summarize.js.map +1 -1
  272. package/dist/esm/core/memberRun.d.ts +153 -0
  273. package/dist/esm/core/memberRun.js +273 -0
  274. package/dist/esm/core/memberRun.js.map +1 -0
  275. package/dist/esm/core/requestOfRun.d.ts +21 -0
  276. package/dist/esm/core/requestOfRun.js +24 -0
  277. package/dist/esm/core/requestOfRun.js.map +1 -0
  278. package/dist/esm/core/runner.d.ts +15 -3
  279. package/dist/esm/core/slots/buildToolsSlot.d.ts +0 -16
  280. package/dist/esm/core/slots/buildToolsSlot.js +11 -25
  281. package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
  282. package/dist/esm/core-flow/Conditional.d.ts +10 -1
  283. package/dist/esm/core-flow/Conditional.js +40 -13
  284. package/dist/esm/core-flow/Conditional.js.map +1 -1
  285. package/dist/esm/core-flow/Graph.d.ts +2 -1
  286. package/dist/esm/core-flow/Graph.js +49 -18
  287. package/dist/esm/core-flow/Graph.js.map +1 -1
  288. package/dist/esm/core-flow/Loop.d.ts +10 -1
  289. package/dist/esm/core-flow/Loop.js +40 -14
  290. package/dist/esm/core-flow/Loop.js.map +1 -1
  291. package/dist/esm/core-flow/Parallel.d.ts +10 -1
  292. package/dist/esm/core-flow/Parallel.js +54 -22
  293. package/dist/esm/core-flow/Parallel.js.map +1 -1
  294. package/dist/esm/core-flow/Sequence.d.ts +10 -1
  295. package/dist/esm/core-flow/Sequence.js +40 -13
  296. package/dist/esm/core-flow/Sequence.js.map +1 -1
  297. package/dist/esm/core-flow/Workflow.d.ts +2 -1
  298. package/dist/esm/core-flow/Workflow.js +45 -15
  299. package/dist/esm/core-flow/Workflow.js.map +1 -1
  300. package/dist/esm/doors/ag-ui.d.ts +19 -0
  301. package/dist/esm/doors/ag-ui.js +20 -0
  302. package/dist/esm/doors/ag-ui.js.map +1 -0
  303. package/dist/esm/doors/security.d.ts +2 -1
  304. package/dist/esm/doors/security.js +2 -1
  305. package/dist/esm/doors/security.js.map +1 -1
  306. package/dist/esm/events/payloads.d.ts +4 -2
  307. package/dist/esm/hosting/envelope.js +5 -0
  308. package/dist/esm/hosting/envelope.js.map +1 -1
  309. package/dist/esm/hosting/httpHost.js +5 -78
  310. package/dist/esm/hosting/httpHost.js.map +1 -1
  311. package/dist/esm/hosting/index.d.ts +5 -1
  312. package/dist/esm/hosting/index.js +2 -0
  313. package/dist/esm/hosting/index.js.map +1 -1
  314. package/dist/esm/hosting/pendingAsk.d.ts +19 -0
  315. package/dist/esm/hosting/pendingAsk.js +38 -0
  316. package/dist/esm/hosting/pendingAsk.js.map +1 -0
  317. package/dist/esm/hosting/protocolAdapter.d.ts +232 -0
  318. package/dist/esm/hosting/protocolAdapter.js +23 -0
  319. package/dist/esm/hosting/protocolAdapter.js.map +1 -0
  320. package/dist/esm/hosting/refusalStatus.d.ts +30 -0
  321. package/dist/esm/hosting/refusalStatus.js +85 -0
  322. package/dist/esm/hosting/refusalStatus.js.map +1 -0
  323. package/dist/esm/hosting/requestSealing.d.ts +65 -0
  324. package/dist/esm/hosting/requestSealing.js +79 -0
  325. package/dist/esm/hosting/requestSealing.js.map +1 -0
  326. package/dist/esm/hosting/standingAgent.js +24 -34
  327. package/dist/esm/hosting/standingAgent.js.map +1 -1
  328. package/dist/esm/hosting/stream.d.ts +60 -0
  329. package/dist/esm/hosting/stream.js +38 -2
  330. package/dist/esm/hosting/stream.js.map +1 -1
  331. package/dist/esm/hosting/streamHandler.d.ts +153 -0
  332. package/dist/esm/hosting/streamHandler.js +517 -0
  333. package/dist/esm/hosting/streamHandler.js.map +1 -0
  334. package/dist/esm/hosting/types.d.ts +44 -0
  335. package/dist/esm/hosting/types.js.map +1 -1
  336. package/dist/esm/hosting/verifiedThreads.d.ts +29 -0
  337. package/dist/esm/hosting/verifiedThreads.js +46 -0
  338. package/dist/esm/hosting/verifiedThreads.js.map +1 -0
  339. package/dist/esm/identity/requestContext.d.ts +96 -0
  340. package/dist/esm/identity/requestContext.js +131 -0
  341. package/dist/esm/identity/requestContext.js.map +1 -0
  342. package/dist/esm/identity/requestCredentials.d.ts +99 -0
  343. package/dist/esm/identity/requestCredentials.js +157 -0
  344. package/dist/esm/identity/requestCredentials.js.map +1 -0
  345. package/dist/esm/identity/types.d.ts +11 -0
  346. package/dist/esm/identity/types.js.map +1 -1
  347. package/dist/esm/identity.d.ts +2 -0
  348. package/dist/esm/identity.js +5 -0
  349. package/dist/esm/identity.js.map +1 -1
  350. package/dist/esm/index.d.ts +3 -1
  351. package/dist/esm/index.js +7 -0
  352. package/dist/esm/index.js.map +1 -1
  353. package/dist/esm/injection-engine/buildInjectionEngineSubflow.d.ts +11 -0
  354. package/dist/esm/injection-engine/buildInjectionEngineSubflow.js +39 -5
  355. package/dist/esm/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  356. package/dist/esm/injection-engine/constrainedEnumPick.js +4 -2
  357. package/dist/esm/injection-engine/constrainedEnumPick.js.map +1 -1
  358. package/dist/esm/injection-engine/evaluator.d.ts +6 -0
  359. package/dist/esm/injection-engine/evaluator.js +19 -1
  360. package/dist/esm/injection-engine/evaluator.js.map +1 -1
  361. package/dist/esm/injection-engine/skillGraph.js +26 -8
  362. package/dist/esm/injection-engine/skillGraph.js.map +1 -1
  363. package/dist/esm/injection-engine/skillIntent.d.ts +4 -2
  364. package/dist/esm/injection-engine/skillIntent.js +3 -0
  365. package/dist/esm/injection-engine/skillIntent.js.map +1 -1
  366. package/dist/esm/injection-engine/types.d.ts +27 -1
  367. package/dist/esm/injection-engine/types.js +15 -0
  368. package/dist/esm/injection-engine/types.js.map +1 -1
  369. package/dist/esm/lib/abort.d.ts +143 -0
  370. package/dist/esm/lib/abort.js +322 -0
  371. package/dist/esm/lib/abort.js.map +1 -0
  372. package/dist/esm/lib/humanizeLLMError.d.ts +15 -0
  373. package/dist/esm/lib/humanizeLLMError.js +22 -7
  374. package/dist/esm/lib/humanizeLLMError.js.map +1 -1
  375. package/dist/esm/maps/engagement/parkCard.d.ts +5 -1
  376. package/dist/esm/maps/engagement/parkCard.js +10 -3
  377. package/dist/esm/maps/engagement/parkCard.js.map +1 -1
  378. package/dist/esm/mcp/mcpClient.js +30 -2
  379. package/dist/esm/mcp/mcpClient.js.map +1 -1
  380. package/dist/esm/mcp/mcpServe.js +5 -1
  381. package/dist/esm/mcp/mcpServe.js.map +1 -1
  382. package/dist/esm/mcp/plainData.d.ts +44 -0
  383. package/dist/esm/mcp/plainData.js +204 -0
  384. package/dist/esm/mcp/plainData.js.map +1 -0
  385. package/dist/esm/mcp/sdkLoadFailure.d.ts +6 -7
  386. package/dist/esm/mcp/sdkLoadFailure.js +4 -4
  387. package/dist/esm/mcp/sdkLoadFailure.js.map +1 -1
  388. package/dist/esm/mcp/throttleRetry.d.ts +51 -0
  389. package/dist/esm/mcp/throttleRetry.js +37 -4
  390. package/dist/esm/mcp/throttleRetry.js.map +1 -1
  391. package/dist/esm/mcp/toolResult.js +8 -50
  392. package/dist/esm/mcp/toolResult.js.map +1 -1
  393. package/dist/esm/mcp/types.d.ts +10 -6
  394. package/dist/esm/memory/beats/llmExtractor.js +6 -3
  395. package/dist/esm/memory/beats/llmExtractor.js.map +1 -1
  396. package/dist/esm/memory/define.js +45 -1
  397. package/dist/esm/memory/define.js.map +1 -1
  398. package/dist/esm/memory/define.types.d.ts +24 -0
  399. package/dist/esm/memory/define.types.js.map +1 -1
  400. package/dist/esm/memory/facts/llmFactExtractor.js +6 -3
  401. package/dist/esm/memory/facts/llmFactExtractor.js.map +1 -1
  402. package/dist/esm/memory/stages/formatDefault.js +3 -1
  403. package/dist/esm/memory/stages/formatDefault.js.map +1 -1
  404. package/dist/esm/memory/stages/summarize.js +16 -5
  405. package/dist/esm/memory/stages/summarize.js.map +1 -1
  406. package/dist/esm/memory/store/InMemoryStore.d.ts +8 -3
  407. package/dist/esm/memory/store/InMemoryStore.js +12 -3
  408. package/dist/esm/memory/store/InMemoryStore.js.map +1 -1
  409. package/dist/esm/memory/store/index.d.ts +1 -0
  410. package/dist/esm/memory/store/index.js +5 -0
  411. package/dist/esm/memory/store/index.js.map +1 -1
  412. package/dist/esm/memory/store/types.d.ts +38 -4
  413. package/dist/esm/memory/store/writeOptions.d.ts +118 -0
  414. package/dist/esm/memory/store/writeOptions.js +242 -0
  415. package/dist/esm/memory/store/writeOptions.js.map +1 -0
  416. package/dist/esm/memory-providers.d.ts +1 -1
  417. package/dist/esm/memory-providers.js +4 -1
  418. package/dist/esm/memory-providers.js.map +1 -1
  419. package/dist/esm/patterns/LlmRouter.js +10 -5
  420. package/dist/esm/patterns/LlmRouter.js.map +1 -1
  421. package/dist/esm/patterns/MapReduce.js +8 -2
  422. package/dist/esm/patterns/MapReduce.js.map +1 -1
  423. package/dist/esm/redaction/conversation.js +3 -0
  424. package/dist/esm/redaction/conversation.js.map +1 -1
  425. package/dist/esm/redaction/knownStrings.js +1 -0
  426. package/dist/esm/redaction/knownStrings.js.map +1 -1
  427. package/dist/esm/reliability/buildReliabilityGateChart.js +7 -1
  428. package/dist/esm/reliability/buildReliabilityGateChart.js.map +1 -1
  429. package/dist/esm/resilience/withCircuitBreaker.js +5 -2
  430. package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
  431. package/dist/esm/resilience/withFallback.js +6 -0
  432. package/dist/esm/resilience/withFallback.js.map +1 -1
  433. package/dist/esm/resilience/withRetry.js +5 -0
  434. package/dist/esm/resilience/withRetry.js.map +1 -1
  435. package/dist/esm/time-travel/servedView.js +1 -1
  436. package/dist/esm/time-travel/servedView.js.map +1 -1
  437. package/dist/esm/tool-providers/index.d.ts +5 -0
  438. package/dist/esm/tool-providers/index.js +6 -0
  439. package/dist/esm/tool-providers/index.js.map +1 -1
  440. package/dist/esm/tools/hostFilled.d.ts +110 -0
  441. package/dist/esm/tools/hostFilled.js +509 -0
  442. package/dist/esm/tools/hostFilled.js.map +1 -0
  443. package/dist/esm/trace-toolpack/selfExplain.d.ts +8 -0
  444. package/dist/esm/trace-toolpack/selfExplain.js +25 -2
  445. package/dist/esm/trace-toolpack/selfExplain.js.map +1 -1
  446. package/dist/hosting/envelope.js +5 -0
  447. package/dist/hosting/envelope.js.map +1 -1
  448. package/dist/hosting/httpHost.js +5 -78
  449. package/dist/hosting/httpHost.js.map +1 -1
  450. package/dist/hosting/index.js +9 -3
  451. package/dist/hosting/index.js.map +1 -1
  452. package/dist/hosting/pendingAsk.js +42 -0
  453. package/dist/hosting/pendingAsk.js.map +1 -0
  454. package/dist/hosting/protocolAdapter.js +24 -0
  455. package/dist/hosting/protocolAdapter.js.map +1 -0
  456. package/dist/hosting/refusalStatus.js +88 -0
  457. package/dist/hosting/refusalStatus.js.map +1 -0
  458. package/dist/hosting/requestSealing.js +83 -0
  459. package/dist/hosting/requestSealing.js.map +1 -0
  460. package/dist/hosting/standingAgent.js +25 -35
  461. package/dist/hosting/standingAgent.js.map +1 -1
  462. package/dist/hosting/stream.js +39 -3
  463. package/dist/hosting/stream.js.map +1 -1
  464. package/dist/hosting/streamHandler.js +521 -0
  465. package/dist/hosting/streamHandler.js.map +1 -0
  466. package/dist/hosting/types.js.map +1 -1
  467. package/dist/hosting/verifiedThreads.js +50 -0
  468. package/dist/hosting/verifiedThreads.js.map +1 -0
  469. package/dist/identity/requestContext.js +139 -0
  470. package/dist/identity/requestContext.js.map +1 -0
  471. package/dist/identity/requestCredentials.js +165 -0
  472. package/dist/identity/requestCredentials.js.map +1 -0
  473. package/dist/identity/types.js.map +1 -1
  474. package/dist/identity.js +13 -1
  475. package/dist/identity.js.map +1 -1
  476. package/dist/index.js +20 -3
  477. package/dist/index.js.map +1 -1
  478. package/dist/injection-engine/buildInjectionEngineSubflow.js +38 -4
  479. package/dist/injection-engine/buildInjectionEngineSubflow.js.map +1 -1
  480. package/dist/injection-engine/constrainedEnumPick.js +4 -2
  481. package/dist/injection-engine/constrainedEnumPick.js.map +1 -1
  482. package/dist/injection-engine/evaluator.js +18 -0
  483. package/dist/injection-engine/evaluator.js.map +1 -1
  484. package/dist/injection-engine/skillGraph.js +25 -7
  485. package/dist/injection-engine/skillGraph.js.map +1 -1
  486. package/dist/injection-engine/skillIntent.js +3 -0
  487. package/dist/injection-engine/skillIntent.js.map +1 -1
  488. package/dist/injection-engine/types.js +17 -1
  489. package/dist/injection-engine/types.js.map +1 -1
  490. package/dist/lib/abort.js +336 -0
  491. package/dist/lib/abort.js.map +1 -0
  492. package/dist/lib/humanizeLLMError.js +23 -8
  493. package/dist/lib/humanizeLLMError.js.map +1 -1
  494. package/dist/maps/engagement/parkCard.js +10 -3
  495. package/dist/maps/engagement/parkCard.js.map +1 -1
  496. package/dist/mcp/mcpClient.js +30 -2
  497. package/dist/mcp/mcpClient.js.map +1 -1
  498. package/dist/mcp/mcpServe.js +5 -1
  499. package/dist/mcp/mcpServe.js.map +1 -1
  500. package/dist/mcp/plainData.js +208 -0
  501. package/dist/mcp/plainData.js.map +1 -0
  502. package/dist/mcp/sdkLoadFailure.js +4 -4
  503. package/dist/mcp/sdkLoadFailure.js.map +1 -1
  504. package/dist/mcp/throttleRetry.js +41 -6
  505. package/dist/mcp/throttleRetry.js.map +1 -1
  506. package/dist/mcp/toolResult.js +8 -50
  507. package/dist/mcp/toolResult.js.map +1 -1
  508. package/dist/memory/beats/llmExtractor.js +6 -3
  509. package/dist/memory/beats/llmExtractor.js.map +1 -1
  510. package/dist/memory/define.js +45 -1
  511. package/dist/memory/define.js.map +1 -1
  512. package/dist/memory/define.types.js.map +1 -1
  513. package/dist/memory/facts/llmFactExtractor.js +6 -3
  514. package/dist/memory/facts/llmFactExtractor.js.map +1 -1
  515. package/dist/memory/stages/formatDefault.js +3 -1
  516. package/dist/memory/stages/formatDefault.js.map +1 -1
  517. package/dist/memory/stages/summarize.js +16 -5
  518. package/dist/memory/stages/summarize.js.map +1 -1
  519. package/dist/memory/store/InMemoryStore.js +12 -3
  520. package/dist/memory/store/InMemoryStore.js.map +1 -1
  521. package/dist/memory/store/index.js +11 -1
  522. package/dist/memory/store/index.js.map +1 -1
  523. package/dist/memory/store/writeOptions.js +250 -0
  524. package/dist/memory/store/writeOptions.js.map +1 -0
  525. package/dist/memory-providers.js +4 -1
  526. package/dist/memory-providers.js.map +1 -1
  527. package/dist/patterns/LlmRouter.js +9 -4
  528. package/dist/patterns/LlmRouter.js.map +1 -1
  529. package/dist/patterns/MapReduce.js +8 -2
  530. package/dist/patterns/MapReduce.js.map +1 -1
  531. package/dist/redaction/conversation.js +3 -0
  532. package/dist/redaction/conversation.js.map +1 -1
  533. package/dist/redaction/knownStrings.js +1 -0
  534. package/dist/redaction/knownStrings.js.map +1 -1
  535. package/dist/reliability/buildReliabilityGateChart.js +7 -1
  536. package/dist/reliability/buildReliabilityGateChart.js.map +1 -1
  537. package/dist/resilience/withCircuitBreaker.js +5 -2
  538. package/dist/resilience/withCircuitBreaker.js.map +1 -1
  539. package/dist/resilience/withFallback.js +6 -0
  540. package/dist/resilience/withFallback.js.map +1 -1
  541. package/dist/resilience/withRetry.js +5 -0
  542. package/dist/resilience/withRetry.js.map +1 -1
  543. package/dist/time-travel/servedView.js +1 -1
  544. package/dist/time-travel/servedView.js.map +1 -1
  545. package/dist/tool-providers/index.js +10 -1
  546. package/dist/tool-providers/index.js.map +1 -1
  547. package/dist/tools/hostFilled.js +517 -0
  548. package/dist/tools/hostFilled.js.map +1 -0
  549. package/dist/trace-toolpack/selfExplain.js +25 -2
  550. package/dist/trace-toolpack/selfExplain.js.map +1 -1
  551. package/dist/types/adapters/llm/AnthropicProvider.d.ts +9 -2
  552. package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
  553. package/dist/types/adapters/llm/BedrockProvider.d.ts +6 -1
  554. package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
  555. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
  556. package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
  557. package/dist/types/adapters/llm/FoundryLocalProvider.d.ts.map +1 -1
  558. package/dist/types/adapters/llm/GeminiProvider.d.ts.map +1 -1
  559. package/dist/types/adapters/llm/InvokeModelGatewayProvider.d.ts.map +1 -1
  560. package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
  561. package/dist/types/adapters/llm/OllamaProvider.d.ts.map +1 -1
  562. package/dist/types/adapters/llm/OpenAIProvider.d.ts +6 -1
  563. package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
  564. package/dist/types/adapters/mcp/agentcoreRuntime/errorType.d.ts +13 -0
  565. package/dist/types/adapters/mcp/agentcoreRuntime/errorType.d.ts.map +1 -0
  566. package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +117 -0
  567. package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -0
  568. package/dist/types/adapters/mcp/agentcoreRuntime/safeAnswer.d.ts +50 -0
  569. package/dist/types/adapters/mcp/agentcoreRuntime/safeAnswer.d.ts.map +1 -0
  570. package/dist/types/adapters/mcp/agentcoreRuntime/session.d.ts +81 -0
  571. package/dist/types/adapters/mcp/agentcoreRuntime/session.d.ts.map +1 -0
  572. package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +62 -0
  573. package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -0
  574. package/dist/types/adapters/mcp/agentcoreRuntime/strictJson.d.ts +38 -0
  575. package/dist/types/adapters/mcp/agentcoreRuntime/strictJson.d.ts.map +1 -0
  576. package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts +200 -0
  577. package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -0
  578. package/dist/types/adapters/memory/agentcore.d.ts +152 -7
  579. package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
  580. package/dist/types/adapters/memory/memoryBank.d.ts +3 -2
  581. package/dist/types/adapters/memory/memoryBank.d.ts.map +1 -1
  582. package/dist/types/adapters/memory/pgVector.d.ts.map +1 -1
  583. package/dist/types/adapters/memory/redis.d.ts +8 -3
  584. package/dist/types/adapters/memory/redis.d.ts.map +1 -1
  585. package/dist/types/adapters/memory/s3Vectors.d.ts.map +1 -1
  586. package/dist/types/adapters/memory/sqliteVector.d.ts.map +1 -1
  587. package/dist/types/ag-ui/adapter.d.ts +119 -0
  588. package/dist/types/ag-ui/adapter.d.ts.map +1 -0
  589. package/dist/types/ag-ui/framing.d.ts +53 -0
  590. package/dist/types/ag-ui/framing.d.ts.map +1 -0
  591. package/dist/types/ag-ui/frontendTools.d.ts +38 -0
  592. package/dist/types/ag-ui/frontendTools.d.ts.map +1 -0
  593. package/dist/types/ag-ui/ids.d.ts +44 -0
  594. package/dist/types/ag-ui/ids.d.ts.map +1 -0
  595. package/dist/types/ag-ui/index.d.ts +20 -0
  596. package/dist/types/ag-ui/index.d.ts.map +1 -0
  597. package/dist/types/ag-ui/request.d.ts +152 -0
  598. package/dist/types/ag-ui/request.d.ts.map +1 -0
  599. package/dist/types/ag-ui/serializer.d.ts +174 -0
  600. package/dist/types/ag-ui/serializer.d.ts.map +1 -0
  601. package/dist/types/ag-ui/types.d.ts +306 -0
  602. package/dist/types/ag-ui/types.d.ts.map +1 -0
  603. package/dist/types/answer-validation/index.d.ts +2 -1
  604. package/dist/types/answer-validation/index.d.ts.map +1 -1
  605. package/dist/types/answer-validation/toolLedger.d.ts +66 -0
  606. package/dist/types/answer-validation/toolLedger.d.ts.map +1 -0
  607. package/dist/types/answer-validation/types.d.ts +48 -0
  608. package/dist/types/answer-validation/types.d.ts.map +1 -1
  609. package/dist/types/answer-validation/validate.d.ts +2 -2
  610. package/dist/types/answer-validation/validate.d.ts.map +1 -1
  611. package/dist/types/classify/typesafe.d.ts.map +1 -1
  612. package/dist/types/core/Agent.d.ts +11 -1
  613. package/dist/types/core/Agent.d.ts.map +1 -1
  614. package/dist/types/core/LLMCall.d.ts +2 -1
  615. package/dist/types/core/LLMCall.d.ts.map +1 -1
  616. package/dist/types/core/RunnerBase.d.ts +39 -8
  617. package/dist/types/core/RunnerBase.d.ts.map +1 -1
  618. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  619. package/dist/types/core/agent/buildAgentMessageApiChart.d.ts +16 -0
  620. package/dist/types/core/agent/buildAgentMessageApiChart.d.ts.map +1 -1
  621. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  622. package/dist/types/core/agent/buildMessageApiChart.d.ts +16 -0
  623. package/dist/types/core/agent/buildMessageApiChart.d.ts.map +1 -1
  624. package/dist/types/core/agent/callerIdentity.d.ts.map +1 -1
  625. package/dist/types/core/agent/stages/answerValidation.d.ts.map +1 -1
  626. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  627. package/dist/types/core/agent/stages/routeTurn.d.ts +1 -1
  628. package/dist/types/core/agent/stages/routeTurn.d.ts.map +1 -1
  629. package/dist/types/core/agent/stages/seed.d.ts +18 -1
  630. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  631. package/dist/types/core/agent/stages/toolCalls.d.ts +32 -1
  632. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  633. package/dist/types/core/agent/types.d.ts +26 -6
  634. package/dist/types/core/agent/types.d.ts.map +1 -1
  635. package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts.map +1 -1
  636. package/dist/types/core/agent/window/summarize.d.ts.map +1 -1
  637. package/dist/types/core/memberRun.d.ts +154 -0
  638. package/dist/types/core/memberRun.d.ts.map +1 -0
  639. package/dist/types/core/requestOfRun.d.ts +22 -0
  640. package/dist/types/core/requestOfRun.d.ts.map +1 -0
  641. package/dist/types/core/runner.d.ts +15 -3
  642. package/dist/types/core/runner.d.ts.map +1 -1
  643. package/dist/types/core/slots/buildToolsSlot.d.ts +0 -16
  644. package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
  645. package/dist/types/core-flow/Conditional.d.ts +10 -1
  646. package/dist/types/core-flow/Conditional.d.ts.map +1 -1
  647. package/dist/types/core-flow/Graph.d.ts +2 -1
  648. package/dist/types/core-flow/Graph.d.ts.map +1 -1
  649. package/dist/types/core-flow/Loop.d.ts +10 -1
  650. package/dist/types/core-flow/Loop.d.ts.map +1 -1
  651. package/dist/types/core-flow/Parallel.d.ts +10 -1
  652. package/dist/types/core-flow/Parallel.d.ts.map +1 -1
  653. package/dist/types/core-flow/Sequence.d.ts +10 -1
  654. package/dist/types/core-flow/Sequence.d.ts.map +1 -1
  655. package/dist/types/core-flow/Workflow.d.ts +2 -1
  656. package/dist/types/core-flow/Workflow.d.ts.map +1 -1
  657. package/dist/types/doors/ag-ui.d.ts +20 -0
  658. package/dist/types/doors/ag-ui.d.ts.map +1 -0
  659. package/dist/types/doors/security.d.ts +2 -1
  660. package/dist/types/doors/security.d.ts.map +1 -1
  661. package/dist/types/events/payloads.d.ts +4 -2
  662. package/dist/types/events/payloads.d.ts.map +1 -1
  663. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  664. package/dist/types/hosting/index.d.ts +5 -1
  665. package/dist/types/hosting/index.d.ts.map +1 -1
  666. package/dist/types/hosting/pendingAsk.d.ts +20 -0
  667. package/dist/types/hosting/pendingAsk.d.ts.map +1 -0
  668. package/dist/types/hosting/protocolAdapter.d.ts +233 -0
  669. package/dist/types/hosting/protocolAdapter.d.ts.map +1 -0
  670. package/dist/types/hosting/refusalStatus.d.ts +31 -0
  671. package/dist/types/hosting/refusalStatus.d.ts.map +1 -0
  672. package/dist/types/hosting/requestSealing.d.ts +66 -0
  673. package/dist/types/hosting/requestSealing.d.ts.map +1 -0
  674. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  675. package/dist/types/hosting/stream.d.ts +60 -0
  676. package/dist/types/hosting/stream.d.ts.map +1 -1
  677. package/dist/types/hosting/streamHandler.d.ts +154 -0
  678. package/dist/types/hosting/streamHandler.d.ts.map +1 -0
  679. package/dist/types/hosting/types.d.ts +44 -0
  680. package/dist/types/hosting/types.d.ts.map +1 -1
  681. package/dist/types/hosting/verifiedThreads.d.ts +30 -0
  682. package/dist/types/hosting/verifiedThreads.d.ts.map +1 -0
  683. package/dist/types/identity/requestContext.d.ts +97 -0
  684. package/dist/types/identity/requestContext.d.ts.map +1 -0
  685. package/dist/types/identity/requestCredentials.d.ts +100 -0
  686. package/dist/types/identity/requestCredentials.d.ts.map +1 -0
  687. package/dist/types/identity/types.d.ts +11 -0
  688. package/dist/types/identity/types.d.ts.map +1 -1
  689. package/dist/types/identity.d.ts +2 -0
  690. package/dist/types/identity.d.ts.map +1 -1
  691. package/dist/types/index.d.ts +3 -1
  692. package/dist/types/index.d.ts.map +1 -1
  693. package/dist/types/injection-engine/buildInjectionEngineSubflow.d.ts +11 -0
  694. package/dist/types/injection-engine/buildInjectionEngineSubflow.d.ts.map +1 -1
  695. package/dist/types/injection-engine/constrainedEnumPick.d.ts.map +1 -1
  696. package/dist/types/injection-engine/evaluator.d.ts +6 -0
  697. package/dist/types/injection-engine/evaluator.d.ts.map +1 -1
  698. package/dist/types/injection-engine/skillIntent.d.ts +4 -2
  699. package/dist/types/injection-engine/skillIntent.d.ts.map +1 -1
  700. package/dist/types/injection-engine/types.d.ts +27 -1
  701. package/dist/types/injection-engine/types.d.ts.map +1 -1
  702. package/dist/types/lib/abort.d.ts +144 -0
  703. package/dist/types/lib/abort.d.ts.map +1 -0
  704. package/dist/types/lib/humanizeLLMError.d.ts +15 -0
  705. package/dist/types/lib/humanizeLLMError.d.ts.map +1 -1
  706. package/dist/types/maps/engagement/parkCard.d.ts +5 -1
  707. package/dist/types/maps/engagement/parkCard.d.ts.map +1 -1
  708. package/dist/types/mcp/mcpServe.d.ts.map +1 -1
  709. package/dist/types/mcp/plainData.d.ts +45 -0
  710. package/dist/types/mcp/plainData.d.ts.map +1 -0
  711. package/dist/types/mcp/sdkLoadFailure.d.ts +6 -7
  712. package/dist/types/mcp/sdkLoadFailure.d.ts.map +1 -1
  713. package/dist/types/mcp/throttleRetry.d.ts +51 -0
  714. package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
  715. package/dist/types/mcp/toolResult.d.ts.map +1 -1
  716. package/dist/types/mcp/types.d.ts +10 -6
  717. package/dist/types/mcp/types.d.ts.map +1 -1
  718. package/dist/types/memory/beats/llmExtractor.d.ts.map +1 -1
  719. package/dist/types/memory/define.d.ts.map +1 -1
  720. package/dist/types/memory/define.types.d.ts +24 -0
  721. package/dist/types/memory/define.types.d.ts.map +1 -1
  722. package/dist/types/memory/facts/llmFactExtractor.d.ts.map +1 -1
  723. package/dist/types/memory/stages/formatDefault.d.ts.map +1 -1
  724. package/dist/types/memory/stages/summarize.d.ts.map +1 -1
  725. package/dist/types/memory/store/InMemoryStore.d.ts +8 -3
  726. package/dist/types/memory/store/InMemoryStore.d.ts.map +1 -1
  727. package/dist/types/memory/store/index.d.ts +1 -0
  728. package/dist/types/memory/store/index.d.ts.map +1 -1
  729. package/dist/types/memory/store/types.d.ts +38 -4
  730. package/dist/types/memory/store/types.d.ts.map +1 -1
  731. package/dist/types/memory/store/writeOptions.d.ts +119 -0
  732. package/dist/types/memory/store/writeOptions.d.ts.map +1 -0
  733. package/dist/types/memory-providers.d.ts +1 -1
  734. package/dist/types/memory-providers.d.ts.map +1 -1
  735. package/dist/types/patterns/LlmRouter.d.ts.map +1 -1
  736. package/dist/types/patterns/MapReduce.d.ts.map +1 -1
  737. package/dist/types/redaction/conversation.d.ts.map +1 -1
  738. package/dist/types/redaction/knownStrings.d.ts.map +1 -1
  739. package/dist/types/reliability/buildReliabilityGateChart.d.ts.map +1 -1
  740. package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
  741. package/dist/types/resilience/withFallback.d.ts.map +1 -1
  742. package/dist/types/resilience/withRetry.d.ts.map +1 -1
  743. package/dist/types/tool-providers/index.d.ts +5 -0
  744. package/dist/types/tool-providers/index.d.ts.map +1 -1
  745. package/dist/types/tools/hostFilled.d.ts +111 -0
  746. package/dist/types/tools/hostFilled.d.ts.map +1 -0
  747. package/dist/types/trace-toolpack/selfExplain.d.ts +8 -0
  748. package/dist/types/trace-toolpack/selfExplain.d.ts.map +1 -1
  749. package/package.json +25 -1
@@ -0,0 +1,119 @@
1
+ /**
2
+ * adapter — AG-UI as a protocol adapter: what `streamHandler` takes to serve
3
+ * runs to any AG-UI frontend — or to a gateway that speaks AG-UI in its own
4
+ * request body and its own envelope.
5
+ *
6
+ * Three strategies, each replaceable on its own, around one CORE that is not:
7
+ * - the READER — a request body → the turn it asks for (`reader`; default:
8
+ * the body is a `RunAgentInput`). Mapping only;
9
+ * - the TRANSLATION — one run's served events → AG-UI events (`translation`;
10
+ * default `agUiSerializer`, tuned by `custom` and `reasoning`), one per
11
+ * request;
12
+ * - the FRAMING — AG-UI events → bytes (`framing`; default `agUiSse`,
13
+ * `encoder` for bundles). The host numbers each stream's frames and hands
14
+ * the number to the framing, so a gateway envelope's sequence is per run.
15
+ * - the CORE (`request.ts`), whichever reader ran: the request's shape and
16
+ * ids checked as plain JSON, a system/developer message refused, frontend
17
+ * tools only by the app's allow-list, `state`/`context` only through the
18
+ * app's validators (`accept`), an answer only for the pause the server
19
+ * keeps. No strategy can reach past it.
20
+ *
21
+ * Holds no state between requests: its options are read once and frozen, and
22
+ * every request gets its own translation and its own frontend tools.
23
+ */
24
+ import type { ProtocolAdapter, RunTranslation } from '../hosting/protocolAdapter.js';
25
+ import type { SseFraming } from '../hosting/stream.js';
26
+ import { type AgUiEncoderModule } from './framing.js';
27
+ import { type AgUiFrontendTool } from './frontendTools.js';
28
+ import { type AgUiRequestReader, type AgUiValidator } from './request.js';
29
+ import { type AgUiSerializerOptions } from './serializer.js';
30
+ import type { AgUiEvent, AgUiRunInput, AgUiSuspension } from './types.js';
31
+ /** What a translation is opened with — one run's ids, and the pause it continues. */
32
+ export interface AgUiTranslationRun {
33
+ /** The conversation the request named (already format-checked). */
34
+ readonly threadId: string;
35
+ /** The run id the request named (already format-checked). */
36
+ readonly runId: string;
37
+ /** The paused run this one continues — its translation's `suspension()`, as the server kept it. */
38
+ readonly resume?: AgUiSuspension;
39
+ }
40
+ /**
41
+ * The translation strategy: opens ONE run's translation — the run's served
42
+ * events → AG-UI events. Default: `agUiSerializer`. Called once per request;
43
+ * a translation it returns is fed only that request's run. One that pauses
44
+ * hands out an `AgUiSuspension` from `suspension()`, or the core cannot match
45
+ * the next request's answer to the pause and refuses it.
46
+ */
47
+ export type AgUiTranslationStrategy = (run: AgUiTranslationRun) => RunTranslation<AgUiEvent>;
48
+ /** Options for {@link agUi}. */
49
+ export interface AgUiOptions {
50
+ /**
51
+ * The tools a page may run, allow-listed by NAME with the app's own contract
52
+ * (description, input schema) — never the page's. A request that declares a
53
+ * tool not listed here is refused by name; one listed here and declared by
54
+ * the page is handed to the agent factory (`StreamRunContext.tools`) for that
55
+ * request. Needs a host that keeps the paused run (`threads` + `sessions`).
56
+ */
57
+ readonly frontendTools?: Readonly<Record<string, AgUiFrontendTool>>;
58
+ /**
59
+ * The page's `state` and `context` reach the agent only through these: each
60
+ * gets the value and the bound thread, and returns what the agent is given
61
+ * (`StreamRunContext.accepted`) — or throws a `WireRequestRefusal`. Without
62
+ * one, a request carrying a non-empty value is refused by name.
63
+ */
64
+ readonly accept?: {
65
+ readonly state?: AgUiValidator;
66
+ readonly context?: AgUiValidator;
67
+ };
68
+ /**
69
+ * How a request body becomes the turn it asks for ({@link AgUiRequestReader}).
70
+ * Default: the body is an AG-UI `RunAgentInput`. A gateway that sends its own
71
+ * body passes a reader that maps it. The reader only MAPS: what it produces is
72
+ * checked by the same core as a `RunAgentInput` — shape and ids, no system or
73
+ * developer message, frontend tools by `frontendTools`, `state`/`context` by
74
+ * `accept`, an answer only for the pause the server keeps.
75
+ */
76
+ readonly reader?: AgUiRequestReader;
77
+ /**
78
+ * How one run's served events become AG-UI events ({@link AgUiTranslationStrategy}).
79
+ * Default: `agUiSerializer` with `custom` and `reasoning`. Refused together
80
+ * with either, which tune the default only.
81
+ */
82
+ readonly translation?: AgUiTranslationStrategy;
83
+ /** The CUSTOM allow-list — see {@link AgUiSerializerOptions.custom}. */
84
+ readonly custom?: AgUiSerializerOptions['custom'];
85
+ /** Write the model's reasoning — see {@link AgUiSerializerOptions.reasoning}. */
86
+ readonly reasoning?: boolean;
87
+ /**
88
+ * How each AG-UI event is written ({@link SseFraming}). Default: `agUiSse()`,
89
+ * the official `@ag-ui/encoder`'s frames. A gateway that expects its own
90
+ * envelope passes a framing that writes it; the frame's number in its stream
91
+ * arrives as `frame(event, { sequence })`, counted by the host per stream —
92
+ * keep no counter in the framing. Refused together with `encoder`, which
93
+ * feeds the default only.
94
+ */
95
+ readonly framing?: SseFraming<AgUiEvent>;
96
+ /** `@ag-ui/encoder`, imported by you — for a bundle this package cannot load it in. */
97
+ readonly encoder?: AgUiEncoderModule;
98
+ }
99
+ /**
100
+ * The AG-UI protocol adapter. Hand it to a host:
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { memorySessions, streamHandler } from 'agentfootprint/hosting';
105
+ * import { agUi } from 'agentfootprint/ag-ui';
106
+ *
107
+ * export const POST = streamHandler({
108
+ * agent: ({ tools }) => Agent.create({ provider, model }).tools([...mine, ...tools]).build(),
109
+ * adapter: agUi(),
110
+ * threads: { bind: ({ conversation, headers }) => bindToSignedInUser(conversation, headers) },
111
+ * sessions: memorySessions(),
112
+ * });
113
+ * ```
114
+ *
115
+ * @throws TypeError at construction for a frontend tool whose name or contract
116
+ * is not usable, and a validator that is not a function.
117
+ */
118
+ export declare function agUi(options?: AgUiOptions): ProtocolAdapter<AgUiRunInput, AgUiEvent>;
119
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E,qFAAqF;AACrF,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mGAAmG;IACnG,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,kBAAkB,KAAK,cAAc,CAAC,SAAS,CAAC,CAAC;AAE7F,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACpE;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;KAClC,CAAC;IACF;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IAC/C,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAClD,iFAAiF;IACjF,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACzC,uFAAuF;IACvF,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,eAAe,CAAC,YAAY,EAAE,SAAS,CAAC,CA2BxF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * framing — AG-UI events → Server-Sent Events frames: the second framing
3
+ * strategy beside `toSSE`'s own (`hosting/stream.ts` · `agentfootprintSse`).
4
+ *
5
+ * The frames are written by the official encoder, `@ag-ui/encoder`'s
6
+ * `EventEncoder.encodeSSE` — a `data:` line holding the event's JSON, nothing
7
+ * else — so a frame here is byte for byte what an AG-UI SDK writes and an AG-UI
8
+ * client reads. The encoder is an OPTIONAL peer: it loads when a framing is
9
+ * built (never when this module is imported), and a missing package is refused
10
+ * at that moment by name, with the install line. A runtime whose loader cannot
11
+ * reach it (a browser or edge bundle) passes the module it imported instead.
12
+ *
13
+ * Every value inside an event already passed the wire rule
14
+ * (`lib/wireJson.ts`): the serializer renders an `Error` as its name, message
15
+ * and code before an event is built, so the encoder's own `JSON.stringify`
16
+ * never meets one.
17
+ */
18
+ import type { SseFraming } from '../hosting/stream.js';
19
+ import type { AgUiEvent } from './types.js';
20
+ /** What this framing needs from `@ag-ui/encoder` — its `EventEncoder`, structurally. */
21
+ export interface AgUiEncoderModule {
22
+ readonly EventEncoder: new () => {
23
+ encodeSSE(event: never): string;
24
+ };
25
+ }
26
+ /** Options for {@link agUiSse}. */
27
+ export interface AgUiSseOptions {
28
+ /**
29
+ * `@ag-ui/encoder`, imported by you — for a runtime where this package cannot
30
+ * load it with its Node loader (a browser or edge bundle):
31
+ * `import * as encoder from '@ag-ui/encoder'; agUiSse({ encoder })`.
32
+ * Absent, the package is loaded here, once per framing.
33
+ */
34
+ readonly encoder?: AgUiEncoderModule;
35
+ }
36
+ /** The refusal for a missing `@ag-ui/encoder` — stated once, so every site says the same. */
37
+ export declare const AG_UI_ENCODER_MISSING: string;
38
+ /**
39
+ * The AG-UI framing strategy: each AG-UI event → one `data: <json>` frame, as
40
+ * `@ag-ui/encoder` writes it, under `text/event-stream`.
41
+ *
42
+ * @throws Error when `@ag-ui/encoder` is not installed (or cannot be loaded
43
+ * here) and no `encoder` was passed — the message names the install line.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const framing = agUiSse();
48
+ * let sequence = 0; // this stream's own count
49
+ * for (const event of serializer.event(e)) res.write(framing.frame(event, { sequence: ++sequence }));
50
+ * ```
51
+ */
52
+ export declare function agUiSse(options?: AgUiSseOptions): SseFraming<AgUiEvent>;
53
+ //# sourceMappingURL=framing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framing.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/framing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,UAAU;QAAE,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;CACtE;AAED,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED,6FAA6F;AAC7F,eAAO,MAAM,qBAAqB,QAG0B,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,CAc3E"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * frontendTools — tools the PAGE runs (AG-UI "frontend tools"), as tools an
3
+ * agent can be given.
4
+ *
5
+ * A frontend tool does its work in the browser: a date picker, a confirmation
6
+ * dialog, a chart the person adjusts. The server never runs it. Its tool here
7
+ * has no body: a call PAUSES the run, the page receives the call
8
+ * (`RUN_FINISHED { outcome: success, pendingToolCallIds }`), runs it, and sends
9
+ * the result as a `tool` message in its next request, which continues the
10
+ * paused run with that result as the call's answer.
11
+ *
12
+ * WHAT IT CAN NEVER DO. The tool runs nothing on the server, so it holds no
13
+ * server privilege: no credential (`needs`), no artifact (`wants`), no
14
+ * capability. Its NAME and its contract (description, input schema) are the
15
+ * APP's — `agUi({ frontendTools })` allow-lists it — never the page's: a
16
+ * description the model reads is an instruction, and a page does not get to
17
+ * write the agent's instructions. A page that declares a tool the app did not
18
+ * list is refused by name. Its result is the page's word, read by the model
19
+ * like any tool result.
20
+ */
21
+ import { type Tool } from '../tools/tools.js';
22
+ /** A frontend tool's contract, as the APP declares it. */
23
+ export interface AgUiFrontendTool {
24
+ /** What the tool does, in the words the model reads. */
25
+ readonly description: string;
26
+ /** The JSON Schema of its arguments. */
27
+ readonly inputSchema: Readonly<Record<string, unknown>>;
28
+ }
29
+ /**
30
+ * Check the app's frontend tools at construction and return, per name, how to
31
+ * build the tool an agent is given — fresh for every request.
32
+ *
33
+ * @throws TypeError naming the tool when its name or contract is not usable.
34
+ */
35
+ export declare function frontendToolBuilders(declared: Readonly<Record<string, AgUiFrontendTool>> | undefined): ReadonlyMap<string, () => Tool>;
36
+ /** Does this pause wait on the page — a frontend tool's call? Read from the pause's own data. */
37
+ export declare function isFrontendToolPause(pauseData: unknown): boolean;
38
+ //# sourceMappingURL=frontendTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontendTools.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/frontendTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAG1D,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD;AAQD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,GAAG,SAAS,GAC/D,WAAW,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAgCjC;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAM/D"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * ids — every id the AG-UI adapter mints, from ONE grammar.
3
+ *
4
+ * <run>/<kind>/<n>/<address>
5
+ *
6
+ * run the AG-UI `runId`, through `encodeIdentityField` — `%` and `/`
7
+ * escaped, so it holds no `/`;
8
+ * kind one of {@link AgUiIdKind} — no `/`;
9
+ * n a decimal ordinal — no `/`;
10
+ * address the agentfootprint `runtimeStageId` of the event that opened the
11
+ * entity (`call-llm#18`, `step-p/x/tool-calls#97`) — any string.
12
+ *
13
+ * INJECTIVE by construction: the first three `/` end the three segments that
14
+ * cannot hold one, so two different (run, kind, n, address) tuples never spell
15
+ * the same id. `test/ag-ui/ids.test.ts` pins it with a property test.
16
+ *
17
+ * WHY THE ADDRESS, NOT THE PROVIDER'S ID. A model's tool-call id is not unique
18
+ * in a run: a provider may reuse it across iterations, and two parallel branches
19
+ * routinely mint the same one (`call_1`, `c1`). An AG-UI client finds a tool
20
+ * call by its id across the WHOLE conversation, so a reused id would land a new
21
+ * call's arguments on an old message. And under a redaction policy the record
22
+ * serves every id as the placeholder. The address — the stage execution that
23
+ * produced the entity, unique within a run — is unique, survives redaction (it
24
+ * is the record's own key, never a value a policy selects) and lines up with the
25
+ * recording; the run segment makes it unique across the thread. The provider's
26
+ * id, as the record serves it, rides `metadata.agentfootprint.toolCallId`.
27
+ */
28
+ /** The kinds of entity the adapter mints ids for. */
29
+ export type AgUiIdKind = 'text' | 'reasoning' | 'tool' | 'result' | 'agent' | 'interrupt';
30
+ /** One run's minter: ordinals counted per (kind, address), ids spelled by {@link agUiId}. */
31
+ export interface AgUiIdMinter {
32
+ /** The next id of `kind` at `address` — `n` counts up from 0 per (kind, address). */
33
+ next(kind: AgUiIdKind, address: string): {
34
+ readonly id: string;
35
+ readonly n: number;
36
+ };
37
+ /** The id of `kind` at `address` with a KNOWN ordinal — a tool result reuses its call's. */
38
+ at(kind: AgUiIdKind, n: number, address: string): string;
39
+ }
40
+ /** Spell one id. Exported for the property test; the minter is the only caller. */
41
+ export declare function agUiId(runId: string, kind: AgUiIdKind, n: number, address: string): string;
42
+ /** A minter for the AG-UI run `runId`. Refuses an empty run id: it would mint `_` ids. */
43
+ export declare function agUiIdMinter(runId: string): AgUiIdMinter;
44
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;AAE1F,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,qFAAqF;IACrF,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrF,4FAA4F;IAC5F,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1D;AAED,mFAAmF;AACnF,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1F;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAgBxD"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ag-ui — the AG-UI protocol adapter over agentfootprint's event stream.
3
+ *
4
+ * `agUi()` is the adapter a host takes (`streamHandler` on
5
+ * `agentfootprint/hosting`): it reads an untrusted request (a `RunAgentInput`,
6
+ * or a gateway's own body through a `reader`), plans the turn against what the
7
+ * server holds, translates the run and frames it (`agUiSse`, or a gateway's
8
+ * own envelope through `framing`).
9
+ * `agUiSerializer` turns one run's served events into AG-UI events; `agUiSse`
10
+ * frames them for the wire with the official `@ag-ui/encoder`. Published
11
+ * through the `agentfootprint/ag-ui` door. The fixed sentences and the id
12
+ * grammar stay internal — tests import them by module path.
13
+ */
14
+ export { agUiSerializer, AG_UI_CUSTOM_EVENTS, type AgUiCustomContext, type AgUiCustomProjection, type AgUiSerializerOptions, type AgUiTranslation, } from './serializer.js';
15
+ export { agUiSse, type AgUiEncoderModule, type AgUiSseOptions } from './framing.js';
16
+ export { agUi, type AgUiOptions, type AgUiTranslationRun, type AgUiTranslationStrategy, } from './adapter.js';
17
+ export type { AgUiFrontendTool } from './frontendTools.js';
18
+ export { AG_UI_MAX_ID_LENGTH, readAgUiRunInput, type AgUiRequestFacts, type AgUiRequestReader, type AgUiTurnRequest, type AgUiValidator, } from './request.js';
19
+ export { AG_UI_PROTOCOL_VERSION, type AgUiAddress, type AgUiEvent, type AgUiEventType, type AgUiInterrupt, type AgUiMessage, type AgUiMetadata, type AgUiResumeEntry, type AgUiRunInput, type AgUiRunOutcome, type AgUiSuspendedCall, type AgUiSuspendedScope, type AgUiSuspension, } from './types.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EACL,IAAI,EACJ,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * request — an AG-UI request (`RunAgentInput`) read as UNTRUSTED browser input,
3
+ * and the one turn it may ask for.
4
+ *
5
+ * Three steps. The first is the app's to replace; the other two are the CORE,
6
+ * and run whichever reader produced the request — so a reader can map another
7
+ * body onto a turn, and never weaken a rule:
8
+ *
9
+ * the READER a body → an {@link AgUiTurnRequest}. The default takes
10
+ * the body as an AG-UI `RunAgentInput`; a gateway that
11
+ * sends its own body shape passes its own
12
+ * ({@link AgUiRequestReader}). Mapping only — it decides
13
+ * nothing below;
14
+ * readAgUiRequest what a custom reader produced, copied as plain JSON (so
15
+ * a getter or a proxy cannot answer the check one way and
16
+ * the plan another; the default reader's body is parsed
17
+ * JSON already and is read as it is), then
18
+ * readAgUiRunInput its SHAPE, field by field, and
19
+ * the ids' FORMAT and length — nothing here is trusted,
20
+ * nothing the server holds is read;
21
+ * planAgUiTurn the turn, from the request AND what the server holds
22
+ * for the bound conversation.
23
+ *
24
+ * The core's steps refuse by NAME (a `WireRequestRefusal`: its own status and
25
+ * code; the field named, the value never quoted back).
26
+ *
27
+ * WHAT A REQUEST MAY DECIDE, and what it may not:
28
+ * - the newest USER message is the run's message. Nothing else the browser
29
+ * sends is ever conversation: its assistant and tool messages are its own
30
+ * copy of what the server said, and the server's copy is the one kept
31
+ * (`sessions`, or the agent's memory under the bound session). A system or
32
+ * developer message is refused — the agent's instructions are its own;
33
+ * - an ANSWER is taken only for the pause the server is keeping, matched to
34
+ * the ids that pause handed out (`AgUiSuspension`): a resume entry naming
35
+ * its interrupt, or the tool message answering the frontend tool call it is
36
+ * waiting on. Any other tool result is refused — never folded in;
37
+ * - a frontend tool runs only when the app allow-listed its NAME — with the
38
+ * app's own description and schema, never the page's (a description the
39
+ * model reads is an instruction) — and only on a host that keeps the paused
40
+ * run until the page answers;
41
+ * - `state` and `context` reach the agent only through the app's validators;
42
+ * without one, a request carrying either is refused;
43
+ * - identity, credentials and redaction never come from a request: the host
44
+ * binds the thread to the caller the app authenticates (`ThreadBinder`).
45
+ * `forwardedProps` is never read.
46
+ */
47
+ import type { HeldConversation, PlanFacts, ProtocolPlan, ProtocolRequestFacts, ThreadBinding } from '../hosting/protocolAdapter.js';
48
+ import type { Tool } from '../tools/tools.js';
49
+ import type { AgUiMessage, AgUiResumeEntry, AgUiRunInput, AgUiSuspension } from './types.js';
50
+ /** The longest thread or run id read — longer is refused, never truncated. */
51
+ export declare const AG_UI_MAX_ID_LENGTH = 128;
52
+ /**
53
+ * Read one AG-UI request body — its shape and its ids — refusing what the
54
+ * protocol does not allow by the field's NAME, never by its value.
55
+ *
56
+ * @throws WireRequestRefusal (400, `ERR_INVALID_RUN_INPUT`)
57
+ */
58
+ export declare function readAgUiRunInput(body: unknown): AgUiRunInput;
59
+ /**
60
+ * What a request reader hands the core: the one turn a request asks for, in
61
+ * AG-UI's terms. `AgUiRunInput` is one (a `RunAgentInput` as sent); a reader
62
+ * for another body builds one from it — `tools` and `context` may be left out.
63
+ *
64
+ * It carries no identity, credential or redaction setting, and the core reads
65
+ * nothing else a reader adds: the caller is bound by the host's `ThreadBinder`,
66
+ * a credential reaches a run only through the host's `sealRequest`.
67
+ */
68
+ export interface AgUiTurnRequest {
69
+ /** The conversation the request NAMES — format-checked, never a key. */
70
+ readonly threadId: string;
71
+ /** The run id the stream names this run by — format-checked. */
72
+ readonly runId: string;
73
+ readonly parentRunId?: string;
74
+ /**
75
+ * The messages, newest last. Only the newest is read — a user message (the
76
+ * run's message), or the `tool` message answering the frontend tool call a
77
+ * paused run waits on. A system or developer message anywhere is refused.
78
+ */
79
+ readonly messages: readonly AgUiMessage[];
80
+ /** The frontend tools the caller offers — run only when the app allow-listed the name. */
81
+ readonly tools?: AgUiRunInput['tools'];
82
+ /** Reaches the agent only through the app's `accept.context` validator. */
83
+ readonly context?: AgUiRunInput['context'];
84
+ /** Reaches the agent only through the app's `accept.state` validator. */
85
+ readonly state?: unknown;
86
+ /** Answers to the interrupt a paused run waits on — matched to the server's own record. */
87
+ readonly resume?: readonly AgUiResumeEntry[];
88
+ }
89
+ /**
90
+ * What a request reader is given: the request as the host read it — UNTRUSTED.
91
+ * The host port's own `ProtocolRequestFacts` (the parsed body, the headers).
92
+ */
93
+ export type AgUiRequestFacts = ProtocolRequestFacts;
94
+ /**
95
+ * The request-reading strategy: a body → the turn it asks for. Mapping only;
96
+ * every rule runs after it, in the core. Refuse a body it cannot read by
97
+ * throwing a `WireRequestRefusal` (its status and code reach the caller);
98
+ * anything else it throws is refused as a malformed request, in fixed words.
99
+ *
100
+ * @example A gateway that sends `{ conversationId, requestId, text }`
101
+ * ```ts
102
+ * const reader: AgUiRequestReader = ({ body }) => {
103
+ * const b = body as { conversationId?: unknown; requestId?: unknown; text?: unknown };
104
+ * return {
105
+ * threadId: String(b.conversationId),
106
+ * runId: String(b.requestId),
107
+ * messages: [{ id: 'gateway-turn', role: 'user', content: String(b.text) }],
108
+ * };
109
+ * };
110
+ * ```
111
+ */
112
+ export type AgUiRequestReader = (request: AgUiRequestFacts) => AgUiTurnRequest;
113
+ /** The default reader: the body IS an AG-UI `RunAgentInput`. */
114
+ export declare const runAgentInputReader: AgUiRequestReader;
115
+ /**
116
+ * The core's read of one request: `reader` maps the body, and what it produced
117
+ * is checked by {@link readAgUiRunInput} — whichever reader it was. A custom
118
+ * reader's answer is copied as plain JSON first; the default reader's is the
119
+ * parsed body itself, read exactly as before readers were replaceable.
120
+ *
121
+ * @throws WireRequestRefusal — the reader's own refusal, or the core's by name
122
+ * (400, `ERR_INVALID_RUN_INPUT`).
123
+ */
124
+ export declare function readAgUiRequest(reader: AgUiRequestReader, request: AgUiRequestFacts): AgUiRunInput;
125
+ /** What a page's `state` or `context` is checked by before the agent may see it. */
126
+ export type AgUiValidator = (value: unknown, at: {
127
+ /** The conversation the request was bound to — whose state this claims to be. */
128
+ readonly thread?: ThreadBinding;
129
+ readonly headers: Readonly<Record<string, string>>;
130
+ }) => unknown;
131
+ /** The rules one adapter plans by — built from `agUi()`'s options. */
132
+ export interface AgUiTurnRules {
133
+ /** The frontend tools the app allow-listed, by name: each builds the tool the agent is given. */
134
+ readonly frontendTools: ReadonlyMap<string, () => Tool>;
135
+ readonly accept: {
136
+ readonly state?: AgUiValidator;
137
+ readonly context?: AgUiValidator;
138
+ };
139
+ }
140
+ /**
141
+ * Plan one turn: the request (read by {@link readAgUiRunInput}) against what
142
+ * the server holds for its bound conversation.
143
+ *
144
+ * @throws WireRequestRefusal — by name, for everything a page may not decide.
145
+ */
146
+ export declare function planAgUiTurn(input: AgUiRunInput, held: HeldConversation, facts: PlanFacts, rules: AgUiTurnRules): ProtocolPlan;
147
+ /**
148
+ * A stored suspension record, checked — the store holds bytes; a record that
149
+ * is not one this adapter wrote is `undefined`, and nothing is matched to it.
150
+ */
151
+ export declare function readAgUiSuspension(value: unknown): AgUiSuspension | undefined;
152
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,oBAAoB,EAEpB,aAAa,EACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAEV,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,MAAM,CAAC;AA0GvC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAuC5D;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,eAAe,CAAC;AAE/E,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,EAAE,iBAAyD,CAAC;AAE5F;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,gBAAgB,GACxB,YAAY,CAiBd;AAiBD,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,CAC1B,KAAK,EAAE,OAAO,EACd,EAAE,EAAE;IACF,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD,KACE,OAAO,CAAC;AAEb,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;IACxD,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;KAClC,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,aAAa,GACnB,YAAY,CAyBd;AAyKD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAuB7E"}
@@ -0,0 +1,174 @@
1
+ /**
2
+ * serializer — one run's served agentfootprint events → AG-UI events.
3
+ *
4
+ * Pattern: a per-run state machine (`RunTranslation`), pure — no I/O, no clock,
5
+ * no import of `@ag-ui/*`. Frames are the framing strategy's job
6
+ * (`framing.ts`); reading a request is the adapter's (`adapter.ts`).
7
+ * Role: the Lens over a run for an AG-UI reader. It composes what that reader
8
+ * is served, from the RECORD only: every value it writes comes from a
9
+ * served event (the placeholder wherever a redaction policy selected a
10
+ * value), from the record's address (`meta.runtimeStageId`,
11
+ * `meta.subflowPath` — never selected by a policy), or from the
12
+ * AG-UI request's own ids. It never reads the run's live values, so
13
+ * nothing a policy hides can reach an AG-UI event. The record's own
14
+ * run id is never written: it counts every run the process made.
15
+ *
16
+ * THE MAPPING
17
+ * agent.turn_start (nested) → SUBAGENT_STARTED (a sub-agent's turn)
18
+ * agent.turn_end → SUBAGENT_FINISHED / the root answer
19
+ * agent.iteration_start/_end → STEP_STARTED/_FINISHED `iteration <n>`
20
+ * composition.enter/exit → STEP_STARTED/_FINISHED `<Kind>[:<mount>]`
21
+ * stream.token → TEXT_MESSAGE_START/CONTENT/END
22
+ * stream.llm_end (no agent around) → one whole TEXT message (an LLM call that streams nothing)
23
+ * stream.thinking_delta/_end → REASONING_START … REASONING_END (only with `reasoning: true`)
24
+ * stream.tool_start → TOOL_CALL_START + TOOL_CALL_ARGS + TOOL_CALL_END
25
+ * stream.tool_end → TOOL_CALL_RESULT
26
+ * pause.request + settle('paused') → RUN_FINISHED { outcome: interrupt }
27
+ * settle('paused', awaiting caller) → RUN_FINISHED { outcome: success, pendingToolCallIds }
28
+ * (a tool the client runs: its call is left to answer)
29
+ * error.fatal + settle('failed') → RUN_ERROR — the served error.fatal's words when they
30
+ * are a fixed sentence, else "The run failed."
31
+ * an allow-listed event → CUSTOM { name: <event type>, value: <its listed fields> }
32
+ * anything else → nothing
33
+ *
34
+ * WHAT LEAVES THE PROCESS. An AG-UI stream goes to a browser, so nothing goes
35
+ * out by default that a person is not meant to read. Every value comes from a
36
+ * served payload; `CUSTOM` carries only the event types on an allow-list, each
37
+ * with the fields its projection picks ({@link AG_UI_CUSTOM_EVENTS} — the whole
38
+ * record, such as `context.injected`'s assembled prompt or `error.retried`'s
39
+ * raw error, stays off the wire unless the app lists it); the model's
40
+ * reasoning goes out only when the app says so; and a failure is described by
41
+ * the record, never by the thrown value. Identity on the meta (`principal`,
42
+ * `tenant`, `sessionId`) is never written.
43
+ *
44
+ * WHO OWNS AN EVENT. Each agent's turn opens a SCOPE at its mount — the
45
+ * subflow path its `turn_start` fired at (`[]` for the root agent, `step-p/x`
46
+ * for an agent in a parallel branch). An event belongs to the deepest open scope
47
+ * whose mount prefixes its own subflow path, segment by segment, and carries
48
+ * that scope's `subagentRunId`. Parallel branches have different mounts, so
49
+ * their interleaved events can never be attributed to each other.
50
+ *
51
+ * A RUN THAT CONTINUES A PAUSE. A paused run hands back `suspension()` — the
52
+ * ids it gave the client (the interrupt, the open call) and every scope and
53
+ * step open at the pause. The run that continues it passes that as `resume`:
54
+ * the same sub-agents re-open (AG-UI: "a later run may continue the same
55
+ * invocation"), their steps re-open, and the first result in the paused call's
56
+ * scope answers that call under its own id — or, for a tool the client ran, is
57
+ * not written at all, because the client holds the result it sent.
58
+ *
59
+ * TEXT. The reply is what the record streamed (`stream.token`) — the channel
60
+ * `toSSE({ format: 'text' })` and a hosted reply read. An agent turn whose
61
+ * answer streamed no token (a provider without `stream()`) is written whole
62
+ * from `turn_end.finalContent`, unless the record marks it refused. An
63
+ * agent's `llm_end.content` is a DRAFT the library may be holding back
64
+ * (answer validation, an output policy) and is never written.
65
+ */
66
+ import type { AgentfootprintEvent } from '../events/registry.js';
67
+ import type { RunTranslation } from '../hosting/protocolAdapter.js';
68
+ import { type AgUiEvent, type AgUiSuspension } from './types.js';
69
+ /** What a CUSTOM projection is told beside the payload: where the event landed. */
70
+ export interface AgUiCustomContext {
71
+ /** The AG-UI id of the tool call open where the event happened, when one is. */
72
+ readonly toolCallId?: string;
73
+ }
74
+ /**
75
+ * One allow-listed event's `CUSTOM` value: the fields of its SERVED payload
76
+ * that go out (the payload is the one every listener receives — the
77
+ * placeholder wherever a redaction policy selected a value). Return only what
78
+ * a person using the frontend is meant to read.
79
+ */
80
+ export type AgUiCustomProjection = (payload: Readonly<Record<string, unknown>>, at: AgUiCustomContext) => unknown;
81
+ /**
82
+ * The agentfootprint events that go out as AG-UI `CUSTOM` by default, each with
83
+ * the fields it carries: progress (which call, which iteration), spend, the
84
+ * loop's route, the answer's standing and a provider's retries — counts and the
85
+ * library's own words. Content (a tool's own progress `payload`,
86
+ * `context.injected`'s assembled prompt, `error.retried`'s raw error, memory,
87
+ * permission and credential facts) stays off the wire unless an app lists it:
88
+ * `agUiSerializer({ ..., custom: { ...AG_UI_CUSTOM_EVENTS, [type]: projection } })`.
89
+ */
90
+ export declare const AG_UI_CUSTOM_EVENTS: Readonly<Record<string, AgUiCustomProjection>>;
91
+ /** Options for {@link agUiSerializer}. */
92
+ export interface AgUiSerializerOptions {
93
+ /** The conversation this run belongs to — `RunAgentInput.threadId`. */
94
+ readonly threadId: string;
95
+ /** This run's AG-UI id — `RunAgentInput.runId`. Every id the run mints is under it. */
96
+ readonly runId: string;
97
+ /**
98
+ * The events with no AG-UI equivalent that go out as `CUSTOM`, keyed by event
99
+ * type, each with the projection that picks its fields. Default
100
+ * {@link AG_UI_CUSTOM_EVENTS}; `{}` sends none. An event not listed sends
101
+ * nothing. Events the mapping consumes (tokens, tool calls, turns,
102
+ * iterations, compositions, the pause and the fatal error) are never CUSTOM.
103
+ */
104
+ readonly custom?: Readonly<Record<string, AgUiCustomProjection>>;
105
+ /**
106
+ * Write the model's reasoning — `REASONING_*` events from the served
107
+ * `stream.thinking_*` events. Default `false`: a model's chain of thought is
108
+ * shown to a person only when the app decides it is.
109
+ */
110
+ readonly reasoning?: boolean;
111
+ /**
112
+ * What a FAILED tool call's result says. Default `'withheld'`: the fixed words
113
+ * "The tool failed." — the record's result for a failed call is the thrown
114
+ * text, which may hold a connection string, a path or a provider's response.
115
+ * `'served'` sends the record's own result (still the served value: the
116
+ * placeholder wherever a redaction policy selected one).
117
+ */
118
+ readonly toolErrors?: 'withheld' | 'served';
119
+ /**
120
+ * Which served events are this run's. Default: the events of the first run
121
+ * an event names (plus events that name no run). Pass it when the listener
122
+ * can hear more than one run — an instance several callers share — so the
123
+ * translation never binds to whichever run spoke first.
124
+ */
125
+ readonly owns?: (event: AgentfootprintEvent) => boolean;
126
+ /**
127
+ * The paused run this one continues — what that run's translation returned
128
+ * from `suspension()` after it settled `'paused'`. Its suspended sub-agents
129
+ * and open steps re-open under the same ids, and the call it stopped in is
130
+ * answered under its own id (or, for a frontend tool, not at all: the client
131
+ * already holds the result it sent).
132
+ */
133
+ readonly resume?: AgUiSuspension;
134
+ }
135
+ /** One run's AG-UI translation — and, once it pauses, what its continuation needs. */
136
+ export interface AgUiTranslation extends RunTranslation<AgUiEvent> {
137
+ /**
138
+ * The record to `resume` from. Before settling, what a `'paused'` settlement
139
+ * with the same `awaiting` will hand out (keep it first, then settle); after
140
+ * `settle({ kind: 'paused' })`, what it handed out; after any other ending,
141
+ * `undefined`.
142
+ */
143
+ suspension(awaiting?: 'person' | 'caller'): AgUiSuspension | undefined;
144
+ }
145
+ /** Said by `TOOL_CALL_RESULT` for a failed call, unless `toolErrors: 'served'`. */
146
+ export declare const AG_UI_TOOL_FAILED = "The tool failed.";
147
+ /** Said by `RUN_ERROR` when the run's `error.fatal` is not one of the record's fixed sentences. */
148
+ export declare const AG_UI_RUN_FAILED = "The run failed.";
149
+ /** Said by `SUBAGENT_ERROR` for a sub-agent whose turn ended without an answer. */
150
+ export declare const AG_UI_SUBAGENT_UNFINISHED = "The sub-agent's turn ended without an answer.";
151
+ /** Said by `SUBAGENT_ERROR` for a sub-agent still running when its run was cancelled. */
152
+ export declare const AG_UI_SUBAGENT_CANCELLED = "The run was cancelled before this sub-agent finished.";
153
+ /**
154
+ * The AG-UI serializer for ONE run: feed it every served agentfootprint event
155
+ * of the run, in order, then settle it once. `RUN_STARTED` comes before the
156
+ * first event it returns; `RUN_FINISHED` or `RUN_ERROR` is the last thing
157
+ * `settle` returns, with everything still open closed before it.
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * const ag = agUiSerializer({ threadId, runId });
162
+ * const off = agent.on('*', (event) => send(ag.event(event)));
163
+ * try {
164
+ * const out = await agent.run({ message });
165
+ * send(ag.settle({ kind: isPaused(out) ? 'paused' : 'finished' }));
166
+ * } catch {
167
+ * send(ag.settle({ kind: 'failed' })); // described by the record, never by the thrown value
168
+ * } finally {
169
+ * off();
170
+ * }
171
+ * ```
172
+ */
173
+ export declare function agUiSerializer(options: AgUiSerializerOptions): AgUiTranslation;
174
+ //# sourceMappingURL=serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAIpE,OAAO,EAGL,KAAK,SAAS,EAId,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,EAAE,EAAE,iBAAiB,KAClB,OAAO,CAAC;AAYb;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAuB7E,CAAC;AAEH,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACjE;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC;IACxD;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC;AAED,sFAAsF;AACtF,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,SAAS,CAAC;IAChE;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;CACxE;AAED,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AAEpD,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAMlD,mFAAmF;AACnF,eAAO,MAAM,yBAAyB,kDAAkD,CAAC;AAEzF,yFAAyF;AACzF,eAAO,MAAM,wBAAwB,0DAA0D,CAAC;AAyFhG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAgvB9E"}