@adonis-agora/agent 0.31.0 → 0.33.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 (227) hide show
  1. package/CHANGELOG.md +752 -0
  2. package/dist/providers/agent_provider.d.ts.map +1 -1
  3. package/dist/providers/agent_provider.js +140 -2
  4. package/dist/providers/agent_provider.js.map +1 -1
  5. package/dist/src/agent-deps-factory.d.ts +16 -2
  6. package/dist/src/agent-deps-factory.d.ts.map +1 -1
  7. package/dist/src/agent-deps-factory.js +8 -0
  8. package/dist/src/agent-deps-factory.js.map +1 -1
  9. package/dist/src/agent-deps.d.ts +21 -1
  10. package/dist/src/agent-deps.d.ts.map +1 -1
  11. package/dist/src/agent-deps.js.map +1 -1
  12. package/dist/src/agent-loop.d.ts +226 -9
  13. package/dist/src/agent-loop.d.ts.map +1 -1
  14. package/dist/src/agent-loop.js +1311 -208
  15. package/dist/src/agent-loop.js.map +1 -1
  16. package/dist/src/agent-service.d.ts +27 -0
  17. package/dist/src/agent-service.d.ts.map +1 -1
  18. package/dist/src/agent-service.js +29 -0
  19. package/dist/src/agent-service.js.map +1 -1
  20. package/dist/src/ai-sdk/ai-sdk-model.d.ts.map +1 -1
  21. package/dist/src/ai-sdk/ai-sdk-model.js +21 -1
  22. package/dist/src/ai-sdk/ai-sdk-model.js.map +1 -1
  23. package/dist/src/client/sse.d.ts +32 -2
  24. package/dist/src/client/sse.d.ts.map +1 -1
  25. package/dist/src/client/sse.js +45 -2
  26. package/dist/src/client/sse.js.map +1 -1
  27. package/dist/src/define_config.d.ts +41 -7
  28. package/dist/src/define_config.d.ts.map +1 -1
  29. package/dist/src/define_config.js.map +1 -1
  30. package/dist/src/durable/agent-run-workflow.d.ts +10 -11
  31. package/dist/src/durable/agent-run-workflow.d.ts.map +1 -1
  32. package/dist/src/durable/agent-run-workflow.js +49 -21
  33. package/dist/src/durable/agent-run-workflow.js.map +1 -1
  34. package/dist/src/durable/durable-agent-runner.d.ts +3 -2
  35. package/dist/src/durable/durable-agent-runner.d.ts.map +1 -1
  36. package/dist/src/durable/durable-agent-runner.js +2 -2
  37. package/dist/src/durable/durable-agent-runner.js.map +1 -1
  38. package/dist/src/elicitation.d.ts +207 -0
  39. package/dist/src/elicitation.d.ts.map +1 -0
  40. package/dist/src/elicitation.js +315 -0
  41. package/dist/src/elicitation.js.map +1 -0
  42. package/dist/src/evals/approval-prior.d.ts +58 -0
  43. package/dist/src/evals/approval-prior.d.ts.map +1 -0
  44. package/dist/src/evals/approval-prior.js +82 -0
  45. package/dist/src/evals/approval-prior.js.map +1 -0
  46. package/dist/src/evals/evaluate.d.ts +51 -0
  47. package/dist/src/evals/evaluate.d.ts.map +1 -0
  48. package/dist/src/evals/evaluate.js +76 -0
  49. package/dist/src/evals/evaluate.js.map +1 -0
  50. package/dist/src/evals/governance-sample-source.d.ts +23 -0
  51. package/dist/src/evals/governance-sample-source.d.ts.map +1 -0
  52. package/dist/src/evals/governance-sample-source.js +93 -0
  53. package/dist/src/evals/governance-sample-source.js.map +1 -0
  54. package/dist/src/evals/in-memory-score-store.d.ts +16 -0
  55. package/dist/src/evals/in-memory-score-store.d.ts.map +1 -0
  56. package/dist/src/evals/in-memory-score-store.js +57 -0
  57. package/dist/src/evals/in-memory-score-store.js.map +1 -0
  58. package/dist/src/evals/index.d.ts +15 -0
  59. package/dist/src/evals/index.d.ts.map +1 -0
  60. package/dist/src/evals/index.js +14 -0
  61. package/dist/src/evals/index.js.map +1 -0
  62. package/dist/src/evals/judge.d.ts +30 -0
  63. package/dist/src/evals/judge.d.ts.map +1 -0
  64. package/dist/src/evals/judge.js +53 -0
  65. package/dist/src/evals/judge.js.map +1 -0
  66. package/dist/src/evals/live-scoring.d.ts +42 -0
  67. package/dist/src/evals/live-scoring.d.ts.map +1 -0
  68. package/dist/src/evals/live-scoring.js +103 -0
  69. package/dist/src/evals/live-scoring.js.map +1 -0
  70. package/dist/src/evals/sample-source.d.ts +40 -0
  71. package/dist/src/evals/sample-source.d.ts.map +1 -0
  72. package/dist/src/evals/sample-source.js +33 -0
  73. package/dist/src/evals/sample-source.js.map +1 -0
  74. package/dist/src/evals/score-store.d.ts +54 -0
  75. package/dist/src/evals/score-store.d.ts.map +1 -0
  76. package/dist/src/evals/score-store.js +2 -0
  77. package/dist/src/evals/score-store.js.map +1 -0
  78. package/dist/src/evals/scorers/answer-relevancy.scorer.d.ts +28 -0
  79. package/dist/src/evals/scorers/answer-relevancy.scorer.d.ts.map +1 -0
  80. package/dist/src/evals/scorers/answer-relevancy.scorer.js +42 -0
  81. package/dist/src/evals/scorers/answer-relevancy.scorer.js.map +1 -0
  82. package/dist/src/evals/scorers/approval-outcome.scorer.d.ts +22 -0
  83. package/dist/src/evals/scorers/approval-outcome.scorer.d.ts.map +1 -0
  84. package/dist/src/evals/scorers/approval-outcome.scorer.js +60 -0
  85. package/dist/src/evals/scorers/approval-outcome.scorer.js.map +1 -0
  86. package/dist/src/evals/scorers/approval-risk.scorer.d.ts +28 -0
  87. package/dist/src/evals/scorers/approval-risk.scorer.d.ts.map +1 -0
  88. package/dist/src/evals/scorers/approval-risk.scorer.js +54 -0
  89. package/dist/src/evals/scorers/approval-risk.scorer.js.map +1 -0
  90. package/dist/src/evals/scorers/run-completion.scorer.d.ts +18 -0
  91. package/dist/src/evals/scorers/run-completion.scorer.d.ts.map +1 -0
  92. package/dist/src/evals/scorers/run-completion.scorer.js +55 -0
  93. package/dist/src/evals/scorers/run-completion.scorer.js.map +1 -0
  94. package/dist/src/evals/summarize.d.ts +44 -0
  95. package/dist/src/evals/summarize.d.ts.map +1 -0
  96. package/dist/src/evals/summarize.js +87 -0
  97. package/dist/src/evals/summarize.js.map +1 -0
  98. package/dist/src/evals/types.d.ts +81 -0
  99. package/dist/src/evals/types.d.ts.map +1 -0
  100. package/dist/src/evals/types.js +15 -0
  101. package/dist/src/evals/types.js.map +1 -0
  102. package/dist/src/history-window.d.ts +50 -11
  103. package/dist/src/history-window.d.ts.map +1 -1
  104. package/dist/src/history-window.js +84 -12
  105. package/dist/src/history-window.js.map +1 -1
  106. package/dist/src/index.d.ts +9 -2
  107. package/dist/src/index.d.ts.map +1 -1
  108. package/dist/src/index.js +9 -2
  109. package/dist/src/index.js.map +1 -1
  110. package/dist/src/mcp/server.d.ts +8 -0
  111. package/dist/src/mcp/server.d.ts.map +1 -1
  112. package/dist/src/mcp/server.js +27 -1
  113. package/dist/src/mcp/server.js.map +1 -1
  114. package/dist/src/mcp-client/importer.d.ts +75 -0
  115. package/dist/src/mcp-client/importer.d.ts.map +1 -0
  116. package/dist/src/mcp-client/importer.js +161 -0
  117. package/dist/src/mcp-client/importer.js.map +1 -0
  118. package/dist/src/mcp-client/index.d.ts +9 -0
  119. package/dist/src/mcp-client/index.d.ts.map +1 -0
  120. package/dist/src/mcp-client/index.js +8 -0
  121. package/dist/src/mcp-client/index.js.map +1 -0
  122. package/dist/src/mcp-client/options.d.ts +99 -0
  123. package/dist/src/mcp-client/options.d.ts.map +1 -0
  124. package/dist/src/mcp-client/options.js +2 -0
  125. package/dist/src/mcp-client/options.js.map +1 -0
  126. package/dist/src/mcp-client/tool-input.d.ts +39 -0
  127. package/dist/src/mcp-client/tool-input.d.ts.map +1 -0
  128. package/dist/src/mcp-client/tool-input.js +61 -0
  129. package/dist/src/mcp-client/tool-input.js.map +1 -0
  130. package/dist/src/mcp-client/tool-kind.d.ts +37 -0
  131. package/dist/src/mcp-client/tool-kind.d.ts.map +1 -0
  132. package/dist/src/mcp-client/tool-kind.js +20 -0
  133. package/dist/src/mcp-client/tool-kind.js.map +1 -0
  134. package/dist/src/mcp-client/tool-name.d.ts +22 -0
  135. package/dist/src/mcp-client/tool-name.d.ts.map +1 -0
  136. package/dist/src/mcp-client/tool-name.js +35 -0
  137. package/dist/src/mcp-client/tool-name.js.map +1 -0
  138. package/dist/src/mcp-client/tool-source.d.ts +75 -0
  139. package/dist/src/mcp-client/tool-source.d.ts.map +1 -0
  140. package/dist/src/mcp-client/tool-source.js +244 -0
  141. package/dist/src/mcp-client/tool-source.js.map +1 -0
  142. package/dist/src/mcp-client/transient.d.ts +28 -0
  143. package/dist/src/mcp-client/transient.d.ts.map +1 -0
  144. package/dist/src/mcp-client/transient.js +126 -0
  145. package/dist/src/mcp-client/transient.js.map +1 -0
  146. package/dist/src/mcp-client/unsafe-regex.d.ts +23 -0
  147. package/dist/src/mcp-client/unsafe-regex.d.ts.map +1 -0
  148. package/dist/src/mcp-client/unsafe-regex.js +194 -0
  149. package/dist/src/mcp-client/unsafe-regex.js.map +1 -0
  150. package/dist/src/memory.d.ts +448 -0
  151. package/dist/src/memory.d.ts.map +1 -0
  152. package/dist/src/memory.js +330 -0
  153. package/dist/src/memory.js.map +1 -0
  154. package/dist/src/processors.d.ts +134 -0
  155. package/dist/src/processors.d.ts.map +1 -0
  156. package/dist/src/processors.js +215 -0
  157. package/dist/src/processors.js.map +1 -0
  158. package/dist/src/replay-integrity.d.ts +17 -0
  159. package/dist/src/replay-integrity.d.ts.map +1 -0
  160. package/dist/src/replay-integrity.js +19 -0
  161. package/dist/src/replay-integrity.js.map +1 -0
  162. package/dist/src/runners/inline-agent-runner.d.ts +33 -7
  163. package/dist/src/runners/inline-agent-runner.d.ts.map +1 -1
  164. package/dist/src/runners/inline-agent-runner.js +113 -27
  165. package/dist/src/runners/inline-agent-runner.js.map +1 -1
  166. package/dist/src/skills.d.ts +291 -0
  167. package/dist/src/skills.d.ts.map +1 -0
  168. package/dist/src/skills.js +0 -0
  169. package/dist/src/skills.js.map +1 -0
  170. package/dist/src/spi/agent-runner.d.ts +20 -6
  171. package/dist/src/spi/agent-runner.d.ts.map +1 -1
  172. package/dist/src/spi/agent-store.d.ts +53 -0
  173. package/dist/src/spi/agent-store.d.ts.map +1 -1
  174. package/dist/src/spi/governance-queries.d.ts +5 -0
  175. package/dist/src/spi/governance-queries.d.ts.map +1 -1
  176. package/dist/src/spi/history-window.d.ts +64 -10
  177. package/dist/src/spi/history-window.d.ts.map +1 -1
  178. package/dist/src/spi/model-provider.d.ts +18 -0
  179. package/dist/src/spi/model-provider.d.ts.map +1 -1
  180. package/dist/src/spi/processors.d.ts +161 -0
  181. package/dist/src/spi/processors.d.ts.map +1 -0
  182. package/dist/src/spi/processors.js +57 -0
  183. package/dist/src/spi/processors.js.map +1 -0
  184. package/dist/src/spi/token-stream-sink.d.ts +43 -0
  185. package/dist/src/spi/token-stream-sink.d.ts.map +1 -1
  186. package/dist/src/spi/token-stream-sink.js +17 -1
  187. package/dist/src/spi/token-stream-sink.js.map +1 -1
  188. package/dist/src/sse.d.ts +5 -2
  189. package/dist/src/sse.d.ts.map +1 -1
  190. package/dist/src/sse.js +11 -2
  191. package/dist/src/sse.js.map +1 -1
  192. package/dist/src/stores/lucid-governance-queries.d.ts.map +1 -1
  193. package/dist/src/stores/lucid-governance-queries.js +3 -0
  194. package/dist/src/stores/lucid-governance-queries.js.map +1 -1
  195. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  196. package/dist/src/stores/lucid-schema.js +15 -0
  197. package/dist/src/stores/lucid-schema.js.map +1 -1
  198. package/dist/src/stores/lucid.d.ts +11 -3
  199. package/dist/src/stores/lucid.d.ts.map +1 -1
  200. package/dist/src/stores/lucid.js +65 -0
  201. package/dist/src/stores/lucid.js.map +1 -1
  202. package/dist/src/structured-output.d.ts +57 -0
  203. package/dist/src/structured-output.d.ts.map +1 -0
  204. package/dist/src/structured-output.js +80 -0
  205. package/dist/src/structured-output.js.map +1 -0
  206. package/dist/src/testing/fake-model-provider.d.ts +8 -4
  207. package/dist/src/testing/fake-model-provider.d.ts.map +1 -1
  208. package/dist/src/testing/fake-model-provider.js +6 -9
  209. package/dist/src/testing/fake-model-provider.js.map +1 -1
  210. package/dist/src/testing/in-memory-governance-queries.d.ts.map +1 -1
  211. package/dist/src/testing/in-memory-governance-queries.js +1 -0
  212. package/dist/src/testing/in-memory-governance-queries.js.map +1 -1
  213. package/dist/src/testing/in-memory-store.d.ts +4 -3
  214. package/dist/src/testing/in-memory-store.d.ts.map +1 -1
  215. package/dist/src/testing/in-memory-store.js +13 -7
  216. package/dist/src/testing/in-memory-store.js.map +1 -1
  217. package/dist/src/testing/index.d.ts +1 -1
  218. package/dist/src/testing/index.d.ts.map +1 -1
  219. package/dist/src/testing/index.js.map +1 -1
  220. package/dist/src/tool-registry.d.ts +9 -0
  221. package/dist/src/tool-registry.d.ts.map +1 -1
  222. package/dist/src/tool-registry.js +11 -0
  223. package/dist/src/tool-registry.js.map +1 -1
  224. package/dist/src/types.d.ts +55 -2
  225. package/dist/src/types.d.ts.map +1 -1
  226. package/package.json +18 -8
  227. package/skills/agent-personas-agents/SKILL.md +16 -12
@@ -1 +1 @@
1
- {"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MA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ACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qFAAqF;IACrF,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,8GAA8G;IAC9G,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,iGAAiG;IACjG,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAChC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,2GAA2G;IAC3G,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAE7D;AAED,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,CAAC;AACF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,UAAU,GACX,CAAC"}
1
+ {"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA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;OAMG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,2GAA2G;IAC3G,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAE7D;AAED,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,CAAC;AACF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,UAAU,GACX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAwCA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,UAAU,GACX,MAAM,qBAAqB,CAAC;AA6M7B,mEAAmE;AACnE,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC;AA4BD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,UAAU,GACX,CAAC"}
1
+ {"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AA2CA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,UAAU,GACX,MAAM,qBAAqB,CAAC;AA4O7B,mEAAmE;AACnE,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC;AA4BD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,UAAU,GACX,CAAC"}
@@ -1,17 +1,13 @@
1
1
  import { BaseWorkflow, type WorkflowCtx } from '@adonis-agora/durable';
2
2
  import type { AgentRunInput } from '../types.js';
3
3
  /**
4
- * The workflow input. A superset of {@link AgentRunInput} carrying the two fields only the durable
5
- * runner threads:
6
- * - `sinkRunId` — the TOP-LEVEL run whose live stream this run writes into. A sub-agent (child
7
- * workflow) forwards its tokens into its ancestor's sink so the human watching the parent sees
8
- * the delegate's output; a top-level run leaves it unset (it owns its own sink, keyed by runId).
9
- * - `delegationDepth` — how many delegations deep this run is (0 for top-level), carried so a future
10
- * guard can cap runaway sub-agent chains.
4
+ * The workflow input. A superset of {@link AgentRunInput} carrying the one field only the durable
5
+ * runner threads: `sinkRunId`, the TOP-LEVEL run whose live stream this run writes into. A sub-agent
6
+ * (child workflow) forwards its tokens into its ancestor's sink so the human watching the parent
7
+ * sees the delegate's output; a top-level run leaves it unset (it owns its own sink, keyed by runId).
11
8
  */
12
9
  export interface DurableAgentRunInput extends AgentRunInput {
13
10
  sinkRunId?: string;
14
- delegationDepth?: number;
15
11
  }
16
12
  /**
17
13
  * The agent turn AS a durable workflow — the replay-safe counterpart of `InlineAgentRunner`. The
@@ -24,9 +20,12 @@ export interface DurableAgentRunInput extends AgentRunInput {
24
20
  * skips the bodies — never re-emits them. Unlike the inline runner, the durable workflow does NOT
25
21
  * emit a body-level root `turn` span (the body replays, which would duplicate it); the trace is
26
22
  * rooted implicitly by `traceId = runId`, which every child span already carries.
27
- * - `awaitApproval(call)` → `ctx.waitForSignal('tool:<runId>:<callId>')` — an action tool suspends the
28
- * run with zero compute until an approve/reject signal arrives (namespaced by run, so one run's
29
- * decision can never satisfy another's).
23
+ * - `awaitApproval(call)` / `awaitAnswers(request)` → `ctx.waitForSignal('tool:<runId>:<callId>')` —
24
+ * an action tool or a question set suspends the run with zero compute until an approve/reject or
25
+ * answers signal arrives (namespaced by run, so one run's reply can never satisfy another's).
26
+ * A DELEGATED run suspends the same way, on its own runId — which is what `sinkRunId` exists for:
27
+ * its frames land in the stream the human is already watching and carry that runId, so a
28
+ * sub-agent's own HITL wait can be seen, and therefore answered.
30
29
  * - `runAgent(name, task)` → `ctx.child(AgentRunWorkflow, …)` — sub-agent delegation is a tracked,
31
30
  * replay-safe CHILD run (a node in the durable dashboard) that streams into the top-level sink.
32
31
  * - `openSink()` → the run's own sink writer (top-level) or a {@link childSinkWriter} (a child).
@@ -1 +1 @@
1
- {"version":3,"file":"agent-run-workflow.d.ts","sourceRoot":"","sources":["../../../src/durable/agent-run-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,KAAK,WAAW,EAEjB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAC;AAG3D;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+BD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,OAAgB,QAAQ;QAAK,IAAI;QAAqB,OAAO;MAAQ;IAE/D,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAsElF;CACF"}
1
+ {"version":3,"file":"agent-run-workflow.d.ts","sourceRoot":"","sources":["../../../src/durable/agent-run-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,KAAK,WAAW,EAEjB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,OAAgB,QAAQ;QAAK,IAAI;QAAqB,OAAO;MAAQ;IAE/D,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAyGlF;CACF"}
@@ -1,6 +1,8 @@
1
1
  import { BaseWorkflow, ContinueAsNew, WorkflowSuspended, } from '@adonis-agora/durable';
2
2
  import { utcDay } from '../agent-deps.js';
3
- import { runAgentLoop } from '../agent-loop.js';
3
+ import { runAgentLoop, settleAll } from '../agent-loop.js';
4
+ import { isReplayIntegrityError } from '../replay-integrity.js';
5
+ import { childSinkWriter } from '../spi/token-stream-sink.js';
4
6
  import { getDurableAgentContext } from './agent-run-context.js';
5
7
  /**
6
8
  * A control-flow signal (suspend / continue-as-new) the durable engine throws THROUGH the workflow
@@ -16,19 +18,6 @@ function isControlFlowSignal(error) {
16
18
  const name = error?.name;
17
19
  return name === 'WorkflowSuspended' || name === 'ContinueAsNew';
18
20
  }
19
- /**
20
- * Wrap a {@link SinkWriter} so a CHILD run forwards tokens into the top-level stream but never closes
21
- * it: the top-level run owns the stream's lifecycle across however many delegations it spans, so a
22
- * child's `end()` must be a no-op (ending the shared stream mid-parent-run would cut the human off).
23
- */
24
- function childSinkWriter(inner) {
25
- return {
26
- write: (chunk) => inner.write(chunk),
27
- end: () => {
28
- /* the top-level run owns end() */
29
- },
30
- };
31
- }
32
21
  /**
33
22
  * The agent turn AS a durable workflow — the replay-safe counterpart of `InlineAgentRunner`. The
34
23
  * shared `runAgentLoop` body drives model→tools→model exactly as inline; the durable hooks make it
@@ -40,9 +29,12 @@ function childSinkWriter(inner) {
40
29
  * skips the bodies — never re-emits them. Unlike the inline runner, the durable workflow does NOT
41
30
  * emit a body-level root `turn` span (the body replays, which would duplicate it); the trace is
42
31
  * rooted implicitly by `traceId = runId`, which every child span already carries.
43
- * - `awaitApproval(call)` → `ctx.waitForSignal('tool:<runId>:<callId>')` — an action tool suspends the
44
- * run with zero compute until an approve/reject signal arrives (namespaced by run, so one run's
45
- * decision can never satisfy another's).
32
+ * - `awaitApproval(call)` / `awaitAnswers(request)` → `ctx.waitForSignal('tool:<runId>:<callId>')` —
33
+ * an action tool or a question set suspends the run with zero compute until an approve/reject or
34
+ * answers signal arrives (namespaced by run, so one run's reply can never satisfy another's).
35
+ * A DELEGATED run suspends the same way, on its own runId — which is what `sinkRunId` exists for:
36
+ * its frames land in the stream the human is already watching and carry that runId, so a
37
+ * sub-agent's own HITL wait can be seen, and therefore answered.
46
38
  * - `runAgent(name, task)` → `ctx.child(AgentRunWorkflow, …)` — sub-agent delegation is a tracked,
47
39
  * replay-safe CHILD run (a node in the durable dashboard) that streams into the top-level sink.
48
40
  * - `openSink()` → the run's own sink writer (top-level) or a {@link childSinkWriter} (a child).
@@ -57,20 +49,41 @@ export class AgentRunWorkflow extends BaseWorkflow {
57
49
  const deps = factory.forAgent(input.agentName);
58
50
  const isChild = input.sinkRunId !== undefined;
59
51
  const sinkRunId = input.sinkRunId ?? ctx.runId;
52
+ // The chain this run sits on, with its own agent appended — what lets a child recognise a
53
+ // delegation back to an agent the chain has already passed through. Derived from the workflow's
54
+ // input, so it is the same on every replay and on every pod.
55
+ const chainBelow = [
56
+ ...(input.delegationPath ?? []),
57
+ ...(input.agentName !== undefined ? [input.agentName] : []),
58
+ ];
60
59
  const hooks = {
61
60
  runId: ctx.runId,
62
61
  durable: true,
63
- // A child forwards into the top-level sink (so the human watching the parent sees it) but must
64
- // not end it; a top-level run opens and owns its own sink keyed by its runId.
65
- openSink: async () => isChild ? childSinkWriter(await deps.sink.open(sinkRunId)) : deps.sink.open(ctx.runId),
66
62
  // HITL: suspend until the run-namespaced signal arrives. This throw escapes the loop cleanly —
67
63
  // it happens BEFORE the loop's tool try/catch, so a suspend is never seen as a tool failure.
64
+ // A DELEGATED run suspends on its OWN runId, and that wait is answerable: the pending row it
65
+ // writes carries that runId, and so does the `elicitation` frame it forwards into the stream
66
+ // the human is already watching.
68
67
  awaitApproval: (call) => ctx.waitForSignal(`tool:${ctx.runId}:${call.id}`),
68
+ // A question set parks on the SAME signal an approval does, under the tool call's own id — so
69
+ // `POST /agent/tool-call/answer` and `/approve` are one delivery path, and a deployment that
70
+ // only ever wired approval still settles an elicitation.
71
+ awaitAnswers: (request) => ctx.waitForSignal(`tool:${ctx.runId}:${request.id}`),
72
+ // A child forwards into the top-level sink (so the human watching the parent sees it) but must
73
+ // not end it; a top-level run opens and owns its own sink keyed by its runId.
74
+ openSink: async () => isChild ? childSinkWriter(await deps.sink.open(sinkRunId)) : deps.sink.open(ctx.runId),
69
75
  // Every side effect + control-flow read is a durable local step (memoized on replay).
70
76
  step: (name, fn) => ctx.localStep(name, fn),
71
77
  // Lets the tool transient-retry loop tell a real suspend/continue-as-new apart from a
72
78
  // retryable tool error, so a control-flow signal is never swallowed by a retry.
73
79
  isControlFlowError: isControlFlowSignal,
80
+ // `ctx.localStep` takes its position on the CALL, before its first await, so a batch of tool
81
+ // invocations launched in one tick occupies the positions in call order however they settle.
82
+ // That is the whole precondition the loop asks for before overlapping anything.
83
+ parallel: settleAll,
84
+ // The version gate for in-place loop-shape changes, so a run that suspended under an older
85
+ // shape replays against the shape its own history holds.
86
+ patched: (id) => ctx.patched(id),
74
87
  // Delegation: a fresh transient subthread (checkpointed so its id is replay-stable), then a
75
88
  // tracked child run that streams into this run's own top-level sink.
76
89
  runAgent: async (agentName, task) => {
@@ -89,6 +102,8 @@ export class AgentRunWorkflow extends BaseWorkflow {
89
102
  userText: task,
90
103
  day,
91
104
  delegationDepth: (input.delegationDepth ?? 0) + 1,
105
+ delegationPath: chainBelow,
106
+ parentRunId: ctx.runId,
92
107
  sinkRunId,
93
108
  });
94
109
  },
@@ -101,11 +116,24 @@ export class AgentRunWorkflow extends BaseWorkflow {
101
116
  if (isControlFlowSignal(error)) {
102
117
  throw error;
103
118
  }
119
+ const message = error instanceof Error ? error.message : String(error);
120
+ // A replay-integrity failure gets the stream half of this path but NOT the checkpoint half.
121
+ // The journal has already diverged, so `persist:run:fail` below would ask for a position the
122
+ // history cannot supply and raise its own refusal — burying the one that names the checkpoints
123
+ // that actually disagreed. The stream still has to be settled, or the subscriber hangs on a
124
+ // run the engine is about to fail.
125
+ if (isReplayIntegrityError(error)) {
126
+ if (!isChild) {
127
+ const writer = await deps.sink.open(ctx.runId);
128
+ await writer.write({ t: 'text', v: `\n[error] ${message}` });
129
+ await writer.end();
130
+ }
131
+ throw error;
132
+ }
104
133
  // A real failure (e.g. quota exceeded, which throws before the sink is opened) would otherwise
105
134
  // leave an HTTP subscriber hanging on a stream that never ends. Surface it on the stream and
106
135
  // close it, then rethrow so the engine still records the run as failed. Only a top-level run
107
136
  // owns the stream — a child defers the surfaced error to its ancestor, which also unwinds.
108
- const message = error instanceof Error ? error.message : String(error);
109
137
  // Settle the run's persisted outcome (the loop only records completions — it can't catch its
110
138
  // own crash). A checkpointed step so a replay re-settles the ONE row idempotently; first-
111
139
  // terminal, so it can't clobber a completion. Each run (parent AND child) owns its own row.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-run-workflow.js","sourceRoot":"","sources":["../../../src/durable/agent-run-workflow.ts"],"names":[],"m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AC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -1,7 +1,8 @@
1
1
  import type { WorkflowEngine } from '@adonis-agora/durable';
2
+ import type { HumanReply } from '../elicitation.js';
2
3
  import type { AgentRunner } from '../spi/agent-runner.js';
3
4
  import type { AgentStore } from '../spi/agent-store.js';
4
- import type { AgentRunInput, Decision } from '../types.js';
5
+ import type { AgentRunInput } from '../types.js';
5
6
  /**
6
7
  * Runs the agent turn as an `@adonis-agora/durable` workflow ({@link AgentRunWorkflow}) — the opt-in
7
8
  * runner (`durable: true`). `start` enqueues the run and returns its id immediately (a worker runs the
@@ -19,7 +20,7 @@ export declare class DurableAgentRunner implements AgentRunner {
19
20
  start(input: AgentRunInput): Promise<{
20
21
  runId: string;
21
22
  }>;
22
- signal(runId: string, toolCallId: string, decision: Decision): Promise<void>;
23
+ signal(runId: string, toolCallId: string, reply: HumanReply): Promise<void>;
23
24
  cancel(runId: string): Promise<void>;
24
25
  }
25
26
  //# sourceMappingURL=durable-agent-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"durable-agent-runner.d.ts","sourceRoot":"","sources":["../../../src/durable/durable-agent-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAe3D;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IAMlD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IANzB;;;OAGG;IACH,YACmB,MAAM,EAAE,cAAc,EACtB,KAAK,CAAC,EAAE,UAAU,YAAA,EACjC;IAEE,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAe5D;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjF;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzC;CACF"}
1
+ {"version":3,"file":"durable-agent-runner.d.ts","sourceRoot":"","sources":["../../../src/durable/durable-agent-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAejD;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IAMlD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IANzB;;;OAGG;IACH,YACmB,MAAM,EAAE,cAAc,EACtB,KAAK,CAAC,EAAE,UAAU,YAAA,EACjC;IAEE,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAe5D;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzC;CACF"}
@@ -45,8 +45,8 @@ export class DurableAgentRunner {
45
45
  }
46
46
  return { runId };
47
47
  }
48
- async signal(runId, toolCallId, decision) {
49
- await this.engine.signal(`tool:${runId}:${toolCallId}`, decision);
48
+ async signal(runId, toolCallId, reply) {
49
+ await this.engine.signal(`tool:${runId}:${toolCallId}`, reply);
50
50
  }
51
51
  async cancel(runId) {
52
52
  // Best-effort: cascade cancellation to children and broadcast to the owning worker. A run that
@@ -1 +1 @@
1
- {"version":3,"file":"durable-agent-runner.js","sourceRoot":"","sources":["../../../src/durable/durable-agent-runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C,OAAO,EAAE,gBAAgB,EAA6B,MAAM,yBAAyB,CAAC;AAEtF;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,MAAM,IAAI,GAAI,KAAmC,EAAE,IAAI,CAAC;IACxD,OAAO,IAAI,KAAK,mBAAmB,IAAI,IAAI,KAAK,eAAe,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAMV,MAAM;IACN,KAAK;IANxB;;;OAGG;IACH,YACmB,MAAsB,EACtB,KAAkB;sBADlB,MAAM;qBACN,KAAK;IACrB,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,KAAoB;QAC9B,MAAM,OAAO,GAAyB,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,MAAM,EAAE,EAAE,CAAC;QAC/E,iGAAiG;QACjG,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2FAA2F;YAC3F,+FAA+F;YAC/F,kEAAkE;YAClE,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,UAAkB,EAAE,QAAkB;QAChE,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,+FAA+F;QAC/F,0FAA0F;QAC1F,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACvD,iGAAiG;QACjG,MAAM,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACxF,CAAC;CACF"}
1
+ {"version":3,"file":"durable-agent-runner.js","sourceRoot":"","sources":["../../../src/durable/durable-agent-runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAK1C,OAAO,EAAE,gBAAgB,EAA6B,MAAM,yBAAyB,CAAC;AAEtF;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,MAAM,IAAI,GAAI,KAAmC,EAAE,IAAI,CAAC;IACxD,OAAO,IAAI,KAAK,mBAAmB,IAAI,IAAI,KAAK,eAAe,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAMV,MAAM;IACN,KAAK;IANxB;;;OAGG;IACH,YACmB,MAAsB,EACtB,KAAkB;sBADlB,MAAM;qBACN,KAAK;IACrB,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,KAAoB;QAC9B,MAAM,OAAO,GAAyB,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,MAAM,EAAE,EAAE,CAAC;QAC/E,iGAAiG;QACjG,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2FAA2F;YAC3F,+FAA+F;YAC/F,kEAAkE;YAClE,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,UAAkB,EAAE,KAAiB;QAC/D,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,+FAA+F;QAC/F,0FAA0F;QAC1F,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACvD,iGAAiG;QACjG,MAAM,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACxF,CAAC;CACF"}
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Asking the USER a structured question, and waiting for the answer.
3
+ *
4
+ * `awaitApproval` collects a yes/no about work already proposed; this collects the scope BEFORE the
5
+ * work. Two surfaces produce it — a configured intake (`AgentLoopDeps.intake`) and the model-callable
6
+ * `ask` tool (`AgentLoopDeps.ask`) — and they deliberately produce the SAME {@link
7
+ * ElicitationRequest}, persist through the same tool-call row, and resume through the same
8
+ * `tool:<runId>:<callId>` signal. A consumer cannot tell which one asked, and should not have to.
9
+ */
10
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
11
+ import type { Decision, ToolDefinition } from './types.js';
12
+ /**
13
+ * Whatever a human sent into a parked run. One channel carries both, because a question set is
14
+ * persisted as a `pending_approval` action so it lands in the approvals inbox a deployment already
15
+ * has — which means an operator pressing Approve there delivers a {@link Decision} to a run that is
16
+ * waiting on answers. The loop reduces one to the other; see {@link normalizeElicitationReply}.
17
+ */
18
+ export type HumanReply = Decision | ElicitationReply;
19
+ /**
20
+ * Thrown when a reply is the wrong shape for the wait it was delivered to: answers to a question
21
+ * set, addressed to a tool call that is waiting on an approve/reject.
22
+ *
23
+ * Refused rather than reduced, because there is no honest reduction in that direction. A yes/no can
24
+ * be read as "confirmed the pre-picked answers" (see {@link normalizeElicitationReply}); a set of
25
+ * answers says nothing at all about whether the proposed work should go ahead, and reading its
26
+ * absent `approved` as `false` would record a rejection the person never made.
27
+ */
28
+ export declare class HumanReplyMismatchError extends Error {
29
+ readonly runId: string;
30
+ readonly toolCallId: string;
31
+ constructor(runId: string, toolCallId: string);
32
+ }
33
+ /**
34
+ * Is this a human's yes/no {@link Decision}, rather than answers to a question set? Structural
35
+ * rather than by class: both shapes are plain JSON off an HTTP body by the time they arrive, and
36
+ * `approved` is the only field a `Decision` carries.
37
+ */
38
+ export declare function isHumanDecision(reply: HumanReply): reply is Decision;
39
+ /** One choice a question offers. */
40
+ export interface ElicitationOption {
41
+ /** Stable identifier submitted back. Never shown to the user. */
42
+ value: string;
43
+ /** What the user reads. */
44
+ label: string;
45
+ /**
46
+ * A single character a UI may bind as a keyboard shortcut for this option. Advisory — nothing in
47
+ * the library reads it, and a client is free to render its own.
48
+ */
49
+ hotkey?: string;
50
+ }
51
+ /** One question in a set. */
52
+ export interface ElicitationQuestion {
53
+ /** Unique within its request; the key answers come back under. */
54
+ id: string;
55
+ prompt: string;
56
+ options: ElicitationOption[];
57
+ /** More than one option may be chosen. Omit → single choice. */
58
+ multiple?: boolean;
59
+ /**
60
+ * The options already picked for the user. The claim this whole surface makes is that confirming
61
+ * is enough, so a question with no defaults is a question the user must stop and think about —
62
+ * which is the case the design is trying to avoid. Empty/omitted is allowed and means exactly
63
+ * that: submitting without answering leaves this question unanswered.
64
+ */
65
+ defaults?: string[];
66
+ /** Accept values that are not among `options` (a typed-in answer). Omit → options only. */
67
+ allowFreeText?: boolean;
68
+ }
69
+ /**
70
+ * A question set awaiting a human. Identical in shape whether an `@Agent`'s configured intake or
71
+ * the model's `ask` tool authored it — `source` records which, for audit, not for control flow.
72
+ *
73
+ * `questions.length` is known when the request is written, which is what lets a client render
74
+ * "Question 1 of 3" without guessing whether a fourth is coming.
75
+ */
76
+ export interface ElicitationRequest {
77
+ /** The tool-call id this request is persisted under, and the signal it is answered through. */
78
+ id: string;
79
+ source: 'intake' | 'ask';
80
+ /** What the assistant says above the form. */
81
+ preamble?: string;
82
+ questions: ElicitationQuestion[];
83
+ }
84
+ /** What a human sent back for an {@link ElicitationRequest}. */
85
+ export interface ElicitationReply {
86
+ /**
87
+ * questionId → chosen values. A question whose id is ABSENT takes the request's own `defaults` —
88
+ * that is what makes "just submit" mean "yes, your pre-picked answers". A present-but-empty array
89
+ * is an explicit "none of these" and does NOT fall back.
90
+ */
91
+ answers: Record<string, string[]>;
92
+ /**
93
+ * The user declined to answer and told the agent to proceed on its own assumptions. Distinct from
94
+ * confirming the defaults even though the resulting values are the same: one is a decision the
95
+ * user made, the other is one they refused to make, and only the first is evidence of intent.
96
+ */
97
+ skipped?: boolean;
98
+ /** Opaque ref of WHO answered, when it wasn't the run's own actor. */
99
+ answeredByRef?: string;
100
+ }
101
+ /** A settled elicitation: what the agent proceeds on, and how it got there. */
102
+ export interface ElicitationOutcome {
103
+ /** One entry per question, in request order — always present, so a caller never re-applies defaults. */
104
+ answers: Record<string, string[]>;
105
+ skipped: boolean;
106
+ /** Question ids filled from the request's `defaults` rather than by the human. */
107
+ defaulted: string[];
108
+ }
109
+ /**
110
+ * Read whatever the human channel delivered as an {@link ElicitationReply}.
111
+ *
112
+ * A question set is persisted as an `action` tool call in `pending_approval` — that is what puts it
113
+ * in the approvals inbox a deployment already has, instead of needing one of its own. The cost of
114
+ * that choice is that the thing which comes back may be a {@link Decision} someone pressed
115
+ * Approve/Reject on rather than a set of answers, and a `Decision` carries no `answers` at all.
116
+ *
117
+ * Approve means every question keeps its own pre-picked `defaults`, which is exactly what "just
118
+ * submit" already means on this surface; Reject is the same declining-to-answer a skip is. Neither
119
+ * reading is a guess — a yes/no channel cannot say more than that, and saying it here is what lets
120
+ * one inbox settle both kinds of pending work.
121
+ *
122
+ * Returns the reply UNCHANGED when it already carries answers, so the common path allocates nothing
123
+ * and a caller can identity-compare.
124
+ */
125
+ export declare function normalizeElicitationReply(reply: HumanReply): ElicitationReply;
126
+ /**
127
+ * Settle a reply against the request it answers: fill every unanswered question from its own
128
+ * `defaults`, drop submitted values that aren't on offer, and collapse a single-choice question to
129
+ * one value.
130
+ *
131
+ * PURE, and deliberately so. Both of its inputs are already journaled by the time the loop calls it
132
+ * — the request came from module config or from an `llm:<i>` checkpoint, the reply from the signal
133
+ * checkpoint — so every process replaying the turn reaches the same values without a checkpoint of
134
+ * its own. Resolving defaults in the HTTP layer instead would put them behind a store read that a
135
+ * replay would have to repeat.
136
+ */
137
+ export declare function resolveElicitation(args: {
138
+ request: ElicitationRequest;
139
+ reply: HumanReply;
140
+ }): ElicitationOutcome;
141
+ /**
142
+ * What a settled elicitation looks like to everyone downstream: the model reading it back as a tool
143
+ * result, the thread reader rendering it, the auditor asking what the agent was told to do. One
144
+ * shape for both surfaces — nothing here records which of them asked.
145
+ */
146
+ export interface ElicitationResult extends ElicitationOutcome {
147
+ /** The questions against the chosen LABELS, so a reader (and a model) can act on it. */
148
+ summary: string;
149
+ }
150
+ /** {@link resolveElicitation} plus its human-readable rendering. Pure, for the same reason. */
151
+ export declare function settleElicitation(args: {
152
+ request: ElicitationRequest;
153
+ reply: HumanReply;
154
+ }): ElicitationResult;
155
+ /**
156
+ * The answers as the model reads them: the question's own prompt against the chosen options' LABELS,
157
+ * not their opaque `value`s — a model shown `{"scope":["b"]}` has been told nothing.
158
+ */
159
+ export declare function renderElicitationAnswers(args: {
160
+ request: ElicitationRequest;
161
+ outcome: ElicitationOutcome;
162
+ }): string;
163
+ /** The reserved tool name the model calls to ask the user something. */
164
+ export declare const ASK_TOOL_NAME = "ask";
165
+ /** What the model must supply when it calls `ask`. */
166
+ export interface AskToolInput {
167
+ preamble?: string;
168
+ questions: ElicitationQuestion[];
169
+ }
170
+ /** How many questions one `ask` may carry. A form the user has to scroll is a form they skip. */
171
+ export declare const MAX_ASK_QUESTIONS = 5;
172
+ /**
173
+ * The `ask` tool's input schema, hand-written rather than borrowed from a validation library: core
174
+ * depends on no validator, and the schema has to carry a JSON Schema a provider can constrain
175
+ * generation against. It publishes one through the Standard JSON Schema extension
176
+ * (`~standard.jsonSchema.input`), which is the path the AI SDK adapter already recognises for
177
+ * Valibot / ArkType / Zod 4.
178
+ */
179
+ export declare const askInputSchema: StandardSchemaV1<unknown, AskToolInput>;
180
+ /**
181
+ * What the model is told the `ask` tool is for. Written to discourage the two failure modes that
182
+ * make a clarifying question worse than a guess: asking about something the conversation already
183
+ * settled, and asking without saying what you would have done.
184
+ */
185
+ export declare const ASK_TOOL_DESCRIPTION = "Ask the user to settle the scope of the work before you do it. Use it when a reasonable person would produce a materially different result depending on the answer \u2014 not to confirm something the conversation already says. Every question must pre-pick the answer you would choose, so the user can confirm instead of deciding. The user may decline, in which case you proceed on those pre-picked answers.";
186
+ /**
187
+ * The `ask` tool as the model sees it. NOT a `ToolSpec` and never registered: `ask` has no handler,
188
+ * because the loop settles it against a human instead of invoking anything. Keeping it out of the
189
+ * `ToolRegistry` is also what keeps the kind decision off a process-local lookup — see
190
+ * `claimToolCall`.
191
+ */
192
+ export declare function askToolDefinition(): ToolDefinition;
193
+ /** A question set an `@Agent` asks before it starts working. See `AgentLoopDeps.intake`. */
194
+ export interface AgentIntake {
195
+ questions: ElicitationQuestion[];
196
+ /** What the assistant says above the form. Omit → {@link DEFAULT_INTAKE_PREAMBLE}. */
197
+ preamble?: string;
198
+ /**
199
+ * `'thread-start'` (default) asks once, on the first turn of a thread; `'every-turn'` asks before
200
+ * every turn. Both are decided from what `load:thread` recorded about the thread when the turn
201
+ * began, never from anything this process happens to know — by the time a replay reaches the
202
+ * question, the thread already holds the assistant message the first attempt wrote.
203
+ */
204
+ when?: 'thread-start' | 'every-turn';
205
+ }
206
+ export declare const DEFAULT_INTAKE_PREAMBLE = "A few questions before I start. I have pre-picked what I would choose, so confirming is enough.";
207
+ //# sourceMappingURL=elicitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../../src/elicitation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAErD;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAE9B,KAAK,EAAE,MAAM;aACb,UAAU,EAAE,MAAM;IAFpC,YACkB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAMnC;CACF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,QAAQ,CAMpE;AAED,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;A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