agency-lang 0.21.1 → 0.22.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 (366) hide show
  1. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency +2 -0
  2. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.js +9 -7
  3. package/dist/lib/agents/agency-agent/brains/coordinator/learn.agency +1 -1
  4. package/dist/lib/agents/agency-agent/brains/coordinator/learn.js +4 -4
  5. package/dist/lib/agents/agency-agent/brains/coordinator/prompts/main-large.md +11 -1
  6. package/dist/lib/agents/agency-agent/brains/coordinator/prompts/main-small.md +4 -0
  7. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/announce.js +384 -0
  8. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.agency +4 -0
  9. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.js +15 -10
  10. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/context.js +533 -0
  11. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/oracle.agency +2 -0
  12. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/oracle.js +7 -3
  13. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/research.agency +2 -1
  14. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/research.js +7 -5
  15. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/review.agency +2 -1
  16. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/review.js +10 -4
  17. package/dist/lib/agents/agency-agent/lib/capabilitiesUi.js +3 -3
  18. package/dist/lib/agents/agency-agent/lib/header.js +2 -2
  19. package/dist/lib/agents/agency-agent/lib/learned.js +4 -4
  20. package/dist/lib/agents/agency-agent/lib/modelRequest.js +3 -3
  21. package/dist/lib/agents/agency-agent/lib/policy.js +14 -14
  22. package/dist/lib/agents/agency-agent/lib/presets.js +7 -7
  23. package/dist/lib/agents/agency-agent/lib/repl.js +3 -3
  24. package/dist/lib/agents/agency-agent/lib/resolution.js +2 -2
  25. package/dist/lib/agents/agency-agent/lib/search.js +3 -3
  26. package/dist/lib/agents/agency-agent/lib/session.js +3 -3
  27. package/dist/lib/agents/agency-agent/lib/sessions.js +2 -2
  28. package/dist/lib/agents/agency-agent/lib/settings.js +12 -12
  29. package/dist/lib/agents/agency-agent/lib/slashCommands/policy.js +3 -3
  30. package/dist/lib/agents/agency-agent/lib/toolLimits.js +2 -2
  31. package/dist/lib/agents/agency-agent/lib/turn.js +2 -2
  32. package/dist/lib/agents/agency-agent/shared.js +3 -3
  33. package/dist/lib/agents/gepaReflect.js +316 -0
  34. package/dist/lib/agents/mutatePrompt.js +301 -0
  35. package/dist/lib/analysis/bodyFacts.d.ts +31 -0
  36. package/dist/lib/analysis/bodyFacts.js +57 -1
  37. package/dist/lib/analysis/effects.js +20 -12
  38. package/dist/lib/analysis/interrupts.d.ts +4 -0
  39. package/dist/lib/analysis/interrupts.js +28 -37
  40. package/dist/lib/backends/agencyGenerator.js +11 -2
  41. package/dist/lib/backends/typescriptBuilder/nodeWrapperParams.d.ts +14 -11
  42. package/dist/lib/backends/typescriptBuilder/nodeWrapperParams.js +40 -16
  43. package/dist/lib/backends/typescriptBuilder.d.ts +3 -0
  44. package/dist/lib/backends/typescriptBuilder.js +15 -7
  45. package/dist/lib/backends/typescriptGenerator/validationDescriptor.d.ts +5 -0
  46. package/dist/lib/backends/typescriptGenerator/validationDescriptor.js +7 -0
  47. package/dist/lib/cli/doc.js +4 -4
  48. package/dist/lib/cli/interrupts.js +6 -0
  49. package/dist/lib/cli/logsView.d.ts +10 -4
  50. package/dist/lib/cli/logsView.js +26 -4
  51. package/dist/lib/cli/remote/commands/logs.js +5 -1
  52. package/dist/lib/compilationUnit.d.ts +3 -1
  53. package/dist/lib/compilationUnit.js +32 -25
  54. package/dist/lib/compiler/compile.js +20 -67
  55. package/dist/lib/compiler/compileClosure.js +13 -0
  56. package/dist/lib/compiler/compileSandboxed.d.ts +3 -2
  57. package/dist/lib/compiler/compileValidatedClosure.d.ts +11 -2
  58. package/dist/lib/compiler/compileValidatedClosure.js +9 -7
  59. package/dist/lib/compiler/importCycle.d.ts +9 -0
  60. package/dist/lib/compiler/importCycle.js +57 -0
  61. package/dist/lib/compiler/initDepGraph.js +20 -1
  62. package/dist/lib/compiler/prepareProgram.d.ts +90 -0
  63. package/dist/lib/compiler/prepareProgram.js +200 -0
  64. package/dist/lib/compiler/splice/eligibility.d.ts +11 -0
  65. package/dist/lib/compiler/splice/eligibility.js +11 -0
  66. package/dist/lib/compiler/splice/runGenerator.js +19 -11
  67. package/dist/lib/compiler/typecheck.d.ts +5 -0
  68. package/dist/lib/compiler/typecheck.js +46 -48
  69. package/dist/lib/config/config.d.ts +2 -2
  70. package/dist/lib/eval/extract.js +4 -1
  71. package/dist/lib/eval/types.d.ts +8 -1
  72. package/dist/lib/importResolutionError.d.ts +3 -0
  73. package/dist/lib/importResolutionError.js +7 -3
  74. package/dist/lib/logsViewer/detailTarget.d.ts +4 -0
  75. package/dist/lib/logsViewer/detailTarget.js +15 -0
  76. package/dist/lib/logsViewer/escLadder.d.ts +18 -0
  77. package/dist/lib/logsViewer/escLadder.js +25 -0
  78. package/dist/lib/logsViewer/forest.d.ts +22 -0
  79. package/dist/lib/logsViewer/forest.js +79 -0
  80. package/dist/lib/logsViewer/format.d.ts +4 -0
  81. package/dist/lib/logsViewer/format.js +36 -0
  82. package/dist/lib/logsViewer/keymap.d.ts +5 -0
  83. package/dist/lib/logsViewer/keymap.js +5 -0
  84. package/dist/lib/logsViewer/messageDelta.d.ts +17 -0
  85. package/dist/lib/logsViewer/messageDelta.js +45 -0
  86. package/dist/lib/logsViewer/overviewData.d.ts +10 -0
  87. package/dist/lib/logsViewer/overviewData.js +14 -0
  88. package/dist/lib/logsViewer/payload.d.ts +33 -0
  89. package/dist/lib/logsViewer/payload.js +212 -0
  90. package/dist/lib/logsViewer/roundInputPayload.d.ts +5 -0
  91. package/dist/lib/logsViewer/roundInputPayload.js +62 -0
  92. package/dist/lib/logsViewer/run.d.ts +16 -1
  93. package/dist/lib/logsViewer/run.js +353 -132
  94. package/dist/lib/logsViewer/screenHost.d.ts +35 -0
  95. package/dist/lib/logsViewer/screenHost.js +103 -0
  96. package/dist/lib/logsViewer/screens/charts.d.ts +12 -0
  97. package/dist/lib/logsViewer/screens/charts.js +54 -0
  98. package/dist/lib/logsViewer/screens/chrome.d.ts +19 -0
  99. package/dist/lib/logsViewer/screens/chrome.js +59 -0
  100. package/dist/lib/logsViewer/screens/lineNumbers.d.ts +7 -0
  101. package/dist/lib/logsViewer/screens/lineNumbers.js +26 -0
  102. package/dist/lib/logsViewer/screens/overviewCharts.d.ts +7 -0
  103. package/dist/lib/logsViewer/screens/overviewCharts.js +151 -0
  104. package/dist/lib/logsViewer/screens/overviewScreen.d.ts +48 -0
  105. package/dist/lib/logsViewer/screens/overviewScreen.js +338 -0
  106. package/dist/lib/logsViewer/screens/payloadPaint.d.ts +3 -0
  107. package/dist/lib/logsViewer/screens/payloadPaint.js +60 -0
  108. package/dist/lib/logsViewer/screens/screen.d.ts +12 -0
  109. package/dist/lib/logsViewer/screens/screen.js +6 -0
  110. package/dist/lib/logsViewer/{views/flameView.d.ts → screens/timelineScreen.d.ts} +34 -8
  111. package/dist/lib/logsViewer/screens/timelineScreen.js +586 -0
  112. package/dist/lib/logsViewer/screens/tracePicker.d.ts +43 -0
  113. package/dist/lib/logsViewer/screens/tracePicker.js +254 -0
  114. package/dist/lib/logsViewer/screens/traceScreen.d.ts +74 -0
  115. package/dist/lib/logsViewer/screens/traceScreen.js +697 -0
  116. package/dist/lib/logsViewer/screens/transcriptScreen.d.ts +49 -0
  117. package/dist/lib/logsViewer/screens/transcriptScreen.js +355 -0
  118. package/dist/lib/logsViewer/spanText.d.ts +4 -4
  119. package/dist/lib/logsViewer/spanText.js +24 -21
  120. package/dist/lib/logsViewer/story.d.ts +87 -0
  121. package/dist/lib/logsViewer/story.js +297 -0
  122. package/dist/lib/logsViewer/storyFixture.d.ts +5 -0
  123. package/dist/lib/logsViewer/storyFixture.js +65 -0
  124. package/dist/lib/logsViewer/structured.d.ts +7 -0
  125. package/dist/lib/logsViewer/structured.js +33 -0
  126. package/dist/lib/logsViewer/summary.d.ts +0 -3
  127. package/dist/lib/logsViewer/summary.js +3 -41
  128. package/dist/lib/logsViewer/theme.d.ts +28 -0
  129. package/dist/lib/logsViewer/theme.js +44 -0
  130. package/dist/lib/logsViewer/thresholds.js +4 -4
  131. package/dist/lib/logsViewer/timeline/groups.d.ts +9 -8
  132. package/dist/lib/logsViewer/timeline/groups.js +50 -53
  133. package/dist/lib/logsViewer/timeline/rounds.d.ts +37 -0
  134. package/dist/lib/logsViewer/timeline/rounds.js +82 -0
  135. package/dist/lib/logsViewer/timeline/rows.d.ts +19 -0
  136. package/dist/lib/logsViewer/timeline/rows.js +98 -0
  137. package/dist/lib/logsViewer/timeline/spans.d.ts +3 -0
  138. package/dist/lib/logsViewer/timeline/spans.js +40 -22
  139. package/dist/lib/logsViewer/traceFixture.d.ts +8 -0
  140. package/dist/lib/logsViewer/traceFixture.js +35 -0
  141. package/dist/lib/logsViewer/traceSearch.d.ts +22 -0
  142. package/dist/lib/logsViewer/traceSearch.js +60 -0
  143. package/dist/lib/logsViewer/traceSummaries.d.ts +13 -0
  144. package/dist/lib/logsViewer/traceSummaries.js +24 -0
  145. package/dist/lib/logsViewer/transcript.d.ts +41 -0
  146. package/dist/lib/logsViewer/transcript.js +227 -0
  147. package/dist/lib/logsViewer/transcriptPayload.d.ts +3 -0
  148. package/dist/lib/logsViewer/transcriptPayload.js +81 -0
  149. package/dist/lib/logsViewer/tree.js +6 -19
  150. package/dist/lib/logsViewer/types.d.ts +1 -15
  151. package/dist/lib/logsViewer/views/detailScreen.d.ts +13 -9
  152. package/dist/lib/logsViewer/views/detailScreen.js +82 -130
  153. package/dist/lib/logsViewer/views/occurrencesView.d.ts +6 -1
  154. package/dist/lib/logsViewer/views/occurrencesView.js +70 -58
  155. package/dist/lib/logsViewer/views/shared.d.ts +1 -5
  156. package/dist/lib/logsViewer/views/shared.js +7 -11
  157. package/dist/lib/logsViewer/views/view.d.ts +15 -13
  158. package/dist/lib/logsViewer/views/view.js +6 -5
  159. package/dist/lib/lsp/builtinHover.js +3 -0
  160. package/dist/lib/lsp/diagnostics.js +62 -180
  161. package/dist/lib/parser.js +32 -15
  162. package/dist/lib/parsers/messages.d.ts +7 -1
  163. package/dist/lib/parsers/messages.js +18 -1
  164. package/dist/lib/parsers/parsers.d.ts +15 -0
  165. package/dist/lib/parsers/parsers.js +185 -44
  166. package/dist/lib/parsers/reservedNames.cases.d.ts +6 -0
  167. package/dist/lib/parsers/reservedNames.cases.js +53 -0
  168. package/dist/lib/parsers/vitest.setup.js +2 -2
  169. package/dist/lib/preprocessors/expandSplices.js +26 -1
  170. package/dist/lib/preprocessors/hoistCalls.d.ts +7 -3
  171. package/dist/lib/preprocessors/hoistCalls.js +38 -20
  172. package/dist/lib/preprocessors/hoistPositions.d.ts +33 -0
  173. package/dist/lib/preprocessors/hoistPositions.js +93 -0
  174. package/dist/lib/preprocessors/importResolver.d.ts +1 -0
  175. package/dist/lib/preprocessors/importResolver.js +25 -4
  176. package/dist/lib/preprocessors/liftCallbacks.d.ts +16 -0
  177. package/dist/lib/preprocessors/liftCallbacks.js +63 -52
  178. package/dist/lib/preprocessors/typescriptPreprocessor.js +16 -1
  179. package/dist/lib/reservedNames.d.ts +10 -0
  180. package/dist/lib/reservedNames.js +22 -0
  181. package/dist/lib/runDirectory/annotations.d.ts +1 -1
  182. package/dist/lib/runsExplorer/run.d.ts +2 -0
  183. package/dist/lib/runsExplorer/run.js +1 -0
  184. package/dist/lib/runtime/abortedResult.d.ts +4 -0
  185. package/dist/lib/runtime/abortedResult.js +8 -0
  186. package/dist/lib/runtime/prompt.js +2 -0
  187. package/dist/lib/runtime/state/messageThread.d.ts +1 -0
  188. package/dist/lib/runtime/state/messageThread.js +4 -0
  189. package/dist/lib/runtime/state/schemas.d.ts +6 -0
  190. package/dist/lib/runtime/state/schemas.js +1 -0
  191. package/dist/lib/runtime/template/fill.js +6 -0
  192. package/dist/lib/runtime/template/hygiene.d.ts +2 -1
  193. package/dist/lib/runtime/template/hygiene.js +4 -2
  194. package/dist/lib/runtime/threadRepair.js +5 -0
  195. package/dist/lib/statelog/wireAccessors.d.ts +37 -4
  196. package/dist/lib/statelog/wireAccessors.js +130 -9
  197. package/dist/lib/statelogClient.d.ts +5 -1
  198. package/dist/lib/statelogClient.js +3 -1
  199. package/dist/lib/stdlib/agency.d.ts +2 -2
  200. package/dist/lib/stdlib/agency.js +59 -7
  201. package/dist/lib/stdlib/cli.d.ts +5 -1
  202. package/dist/lib/stdlib/cli.js +5 -3
  203. package/dist/lib/stdlib/speech.d.ts +1 -1
  204. package/dist/lib/stdlib/speech.js +3 -1
  205. package/dist/lib/symbolTable.d.ts +6 -0
  206. package/dist/lib/symbolTable.js +12 -0
  207. package/dist/lib/templates/backends/typescriptGenerator/finalizeClosure.d.ts +1 -1
  208. package/dist/lib/templates/backends/typescriptGenerator/finalizeClosure.js +1 -1
  209. package/dist/lib/tui/index.d.ts +2 -0
  210. package/dist/lib/tui/index.js +2 -0
  211. package/dist/lib/tui/input/terminal.js +5 -0
  212. package/dist/lib/tui/keymap.d.ts +25 -0
  213. package/dist/lib/tui/keymap.js +45 -0
  214. package/dist/lib/tui/paint.d.ts +38 -0
  215. package/dist/lib/tui/paint.js +108 -0
  216. package/dist/lib/tui/table.d.ts +5 -4
  217. package/dist/lib/tui/table.js +15 -24
  218. package/dist/lib/typeChecker/castPositions.d.ts +2 -0
  219. package/dist/lib/typeChecker/castPositions.js +53 -0
  220. package/dist/lib/typeChecker/castTestUtils.d.ts +6 -0
  221. package/dist/lib/typeChecker/castTestUtils.js +10 -0
  222. package/dist/lib/typeChecker/checker.d.ts +0 -2
  223. package/dist/lib/typeChecker/checker.js +2 -9
  224. package/dist/lib/typeChecker/diagnosticExplanations.js +44 -1
  225. package/dist/lib/typeChecker/diagnostics.d.ts +56 -1
  226. package/dist/lib/typeChecker/diagnostics.js +56 -1
  227. package/dist/lib/typeChecker/flow.js +2 -42
  228. package/dist/lib/typeChecker/index.d.ts +1 -0
  229. package/dist/lib/typeChecker/index.js +5 -1
  230. package/dist/lib/typeChecker/interruptAnalysis.js +48 -23
  231. package/dist/lib/typeChecker/nameReferences.d.ts +5 -0
  232. package/dist/lib/typeChecker/nameReferences.js +5 -4
  233. package/dist/lib/typeChecker/narrowing.d.ts +6 -2
  234. package/dist/lib/typeChecker/narrowing.js +38 -15
  235. package/dist/lib/typeChecker/resolveCall.d.ts +5 -1
  236. package/dist/lib/typeChecker/resolveCall.js +4 -0
  237. package/dist/lib/typeChecker/resolvePath.d.ts +12 -0
  238. package/dist/lib/typeChecker/resolvePath.js +44 -0
  239. package/dist/lib/typeChecker/sandboxNameCheck.js +9 -0
  240. package/dist/lib/typeChecker/scope.d.ts +9 -0
  241. package/dist/lib/typeChecker/scope.js +22 -0
  242. package/dist/lib/typeChecker/scopes.js +18 -2
  243. package/dist/lib/typeChecker/staticInitRules.d.ts +19 -0
  244. package/dist/lib/typeChecker/staticInitRules.js +50 -5
  245. package/dist/lib/typeChecker/synthesizer.js +80 -7
  246. package/dist/lib/typeChecker/templateNames.js +9 -1
  247. package/dist/lib/typeChecker/toolBlockBinding.d.ts +12 -1
  248. package/dist/lib/typeChecker/toolBlockBinding.js +10 -6
  249. package/dist/lib/typeChecker/toolElementTypes.d.ts +4 -0
  250. package/dist/lib/typeChecker/toolElementTypes.js +55 -0
  251. package/dist/lib/typeChecker/undefinedVariableDiagnostic.d.ts +3 -0
  252. package/dist/lib/typeChecker/undefinedVariableDiagnostic.js +6 -0
  253. package/dist/lib/typeChecker/validateStaticInit.d.ts +2 -1
  254. package/dist/lib/typeChecker/validateStaticInit.js +4 -2
  255. package/dist/lib/typeChecker/valueArgReferences.js +2 -0
  256. package/dist/lib/types/binop.d.ts +3 -0
  257. package/dist/lib/types/binop.js +7 -0
  258. package/dist/lib/types/castExpression.d.ts +13 -0
  259. package/dist/lib/types/castExpression.js +1 -0
  260. package/dist/lib/types/function.d.ts +4 -1
  261. package/dist/lib/types.d.ts +4 -2
  262. package/dist/lib/types.js +2 -0
  263. package/dist/lib/utils/expressionSlots.js +4 -0
  264. package/dist/lib/utils/findReservedName.d.ts +5 -0
  265. package/dist/lib/utils/findReservedName.js +88 -0
  266. package/dist/lib/utils/identifierSlots.js +8 -5
  267. package/dist/lib/utils/moduleDoc.d.ts +12 -0
  268. package/dist/lib/utils/moduleDoc.js +22 -1
  269. package/dist/lib/utils/node.js +34 -0
  270. package/dist/lib/utils/topLevel.js +1 -0
  271. package/dist/scripts/agency.js +52 -23
  272. package/package.json +1 -1
  273. package/stdlib/agency.agency +10 -4
  274. package/stdlib/agency.js +44 -13
  275. package/stdlib/agent.agency +4 -1
  276. package/stdlib/agent.js +6 -3
  277. package/stdlib/agents/agency/coding.agency +40 -14
  278. package/stdlib/agents/agency/coding.js +238 -65
  279. package/stdlib/agents/agency/expert.js +2 -2
  280. package/stdlib/agents/agency/researcher.js +2 -2
  281. package/stdlib/agents/agency/review.agency +12 -5
  282. package/stdlib/agents/agency/review.js +89 -38
  283. package/stdlib/agents/agency/verifier.js +2 -2
  284. package/stdlib/agents/coding.agency +2 -1
  285. package/stdlib/agents/coding.js +6 -5
  286. package/stdlib/agents/data.agency +2 -2
  287. package/stdlib/agents/data.js +5 -4
  288. package/stdlib/agents/expert.js +2 -2
  289. package/stdlib/agents/explorer.agency +7 -5
  290. package/stdlib/agents/explorer.js +11 -9
  291. package/stdlib/agents/lib/toolkits.agency +15 -3
  292. package/stdlib/agents/lib/toolkits.js +19 -5
  293. package/stdlib/agents/oracle.js +2 -2
  294. package/stdlib/agents/planner.agency +2 -2
  295. package/stdlib/agents/planner.js +4 -3
  296. package/stdlib/agents/prompts/agency-tutorial.md +21 -1
  297. package/stdlib/agents/researcher.agency +3 -3
  298. package/stdlib/agents/researcher.js +6 -5
  299. package/stdlib/agents/review.agency +2 -2
  300. package/stdlib/agents/review.js +5 -4
  301. package/stdlib/agents/typescript/review.agency +2 -1
  302. package/stdlib/agents/typescript/review.js +6 -5
  303. package/stdlib/agents/verifier.agency +2 -2
  304. package/stdlib/agents/verifier.js +4 -3
  305. package/stdlib/agents/writing/review.agency +2 -1
  306. package/stdlib/agents/writing/review.js +6 -5
  307. package/stdlib/docs/diagnostics/index.md +12 -1
  308. package/stdlib/docs/diagnostics/names.md +12 -0
  309. package/stdlib/docs/diagnostics/static-init.md +12 -0
  310. package/stdlib/docs/diagnostics/templates.md +16 -2
  311. package/stdlib/docs/diagnostics/tools.md +12 -0
  312. package/stdlib/docs/diagnostics/types-aliases.md +70 -0
  313. package/stdlib/docs/guide/observability.md +101 -49
  314. package/stdlib/docs/stdlib/agency.md +51 -43
  315. package/stdlib/docs/stdlib/agent.md +4 -1
  316. package/stdlib/docs/stdlib/agents/agency/coding.md +21 -2
  317. package/stdlib/docs/stdlib/agents/agency/review.md +3 -0
  318. package/stdlib/docs/stdlib/agents/coding.md +2 -2
  319. package/stdlib/docs/stdlib/agents/explorer.md +4 -4
  320. package/stdlib/docs/stdlib/agents/lib/toolkits.md +30 -15
  321. package/stdlib/docs/stdlib/agents/oracle.md +2 -2
  322. package/stdlib/docs/stdlib/agents/typescript/review.md +3 -3
  323. package/stdlib/docs/stdlib/agents/writing/review.md +3 -3
  324. package/stdlib/docs/stdlib/agents/writing/rewrite.md +13 -13
  325. package/stdlib/docs/stdlib/fs.md +4 -4
  326. package/stdlib/docs/stdlib/llm.md +3 -3
  327. package/stdlib/docs/stdlib/math.md +9 -8
  328. package/stdlib/docs/stdlib/memory.md +24 -24
  329. package/stdlib/docs/stdlib/policy.md +228 -228
  330. package/stdlib/docs/stdlib/safeBash/actions.md +9 -9
  331. package/stdlib/docs/stdlib/safeBash.md +5 -5
  332. package/stdlib/docs/stdlib/shell.md +6 -6
  333. package/stdlib/docs/stdlib/speech.md +19 -15
  334. package/stdlib/docs/stdlib/statelog.md +14 -14
  335. package/stdlib/docs/stdlib/syntax.md +12 -12
  336. package/stdlib/docs/stdlib/thread.md +13 -13
  337. package/stdlib/docs/stdlib/toolbox.md +23 -20
  338. package/stdlib/docs/stdlib/ui/cli.md +7 -4
  339. package/stdlib/docs/stdlib/ui/layout.md +5 -5
  340. package/stdlib/docs/stdlib/ui/table.md +16 -16
  341. package/stdlib/docs/stdlib/ui.md +93 -93
  342. package/stdlib/math.agency +4 -3
  343. package/stdlib/math.js +10 -8
  344. package/stdlib/policy.agency +36 -8
  345. package/stdlib/policy.js +267 -15
  346. package/stdlib/speech.agency +5 -0
  347. package/stdlib/speech.js +22 -7
  348. package/stdlib/toolbox.agency +220 -45
  349. package/stdlib/toolbox.js +1829 -693
  350. package/stdlib/ui/cli.agency +3 -1
  351. package/stdlib/ui/cli.js +21 -7
  352. package/dist/lib/logsViewer/conversation.d.ts +0 -22
  353. package/dist/lib/logsViewer/conversation.js +0 -147
  354. package/dist/lib/logsViewer/help.d.ts +0 -9
  355. package/dist/lib/logsViewer/help.js +0 -62
  356. package/dist/lib/logsViewer/search.d.ts +0 -8
  357. package/dist/lib/logsViewer/search.js +0 -167
  358. package/dist/lib/logsViewer/treeRows.d.ts +0 -23
  359. package/dist/lib/logsViewer/treeRows.js +0 -400
  360. package/dist/lib/logsViewer/views/byNameView.d.ts +0 -49
  361. package/dist/lib/logsViewer/views/byNameView.js +0 -284
  362. package/dist/lib/logsViewer/views/flameView.js +0 -389
  363. package/dist/lib/logsViewer/views/treeReducer.d.ts +0 -15
  364. package/dist/lib/logsViewer/views/treeReducer.js +0 -229
  365. package/dist/lib/logsViewer/views/treeView.d.ts +0 -50
  366. package/dist/lib/logsViewer/views/treeView.js +0 -292
@@ -4,6 +4,7 @@
4
4
  and lib/) owns the CLI, the REPL, the policy handler, and the per-turn
5
5
  guard; this module only answers turns.
6
6
  */
7
+ import { question } from "std::agent"
7
8
  import { readOnlyFileTools, whatIAmDoing } from "std::agents/lib/toolkits"
8
9
  import { now, elapsedTime } from "std::date"
9
10
  import { edit } from "std::fs"
@@ -116,6 +117,7 @@ export def turnTools(turnStart: any): any[] {
116
117
  ...getMcpTools(),
117
118
  ...learnedExtras(),
118
119
  whatIAmDoing,
120
+ question,
119
121
  elapsedTime.partial(since: turnStart),
120
122
  ]
121
123
  }
@@ -1,4 +1,5 @@
1
1
  import { print, printJSON, input, sleep, saveDraft, _guard, _pairsOf, read, write, writeBinary, readBinary, range, callback, map, mapWithIndex, filter, exclude, find, findIndex, reduce, flatMap, every, some, count, sortBy, unique, groupBy, flatten, setAgentCwd, getAgentCwd, applyAgentCwd } from "agency-lang/stdlib/index.js";
2
+ import { question } from "agency-lang/stdlib/agent.js";
2
3
  import { readOnlyFileTools, whatIAmDoing } from "agency-lang/stdlib/agents/lib/toolkits.js";
3
4
  import { now, elapsedTime } from "agency-lang/stdlib/date.js";
4
5
  import { edit } from "agency-lang/stdlib/fs.js";
@@ -184,7 +185,7 @@ function registerTools(tools) {
184
185
  }
185
186
  }
186
187
  }
187
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency", "675ae7180984b98430dd12f38a6db8ad49fde614ace46490020932ca8d116cc4", import.meta.url);
188
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency", "93a22a29ec8339bd249d199e45accbcbaa793c2efb69e791e91e6bb3ae7d1a9f", import.meta.url);
188
189
  __registerTool(print);
189
190
  __registerTool(printJSON);
190
191
  __registerTool(input);
@@ -216,6 +217,7 @@ __registerTool(flatten);
216
217
  __registerTool(setAgentCwd);
217
218
  __registerTool(getAgentCwd);
218
219
  __registerTool(applyAgentCwd);
220
+ __registerTool(question);
219
221
  __registerTool(readOnlyFileTools);
220
222
  __registerTool(whatIAmDoing);
221
223
  __registerTool(now);
@@ -290,10 +292,10 @@ async function __initializeStatic(__ctx) {
290
292
  } finally {
291
293
  getRuntimeContext().ctx.popHandler();
292
294
  }
293
- mainAgentTools = __deepFreeze([__readStatic(researchAgent, "researchAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/research.agency"), __readStatic(codeAgent, "codeAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.agency"), __readStatic(reviewAgent, "reviewAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/review.agency"), __readStatic(oracleAgent, "oracleAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/oracle.agency"), __readStatic(explorerAgent, "explorerAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/explorer.agency"), __readStatic(writingAgent, "writingAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/writing.agency"), __readStatic(rewriteAgent, "rewriteAgent", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/rewrite.agency"), __readStatic(generateImageFile, "generateImageFile", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/lib/images.agency"), __readStatic(viewImageFile, "viewImageFile", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/lib/images.agency"), __readStatic(learnSkill, "learnSkill", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/learn.agency"), __readStatic(writeToolFor, "writeToolFor", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/learn.agency"), __readStatic(coordinatorSkills, "coordinatorSkills", "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency"), __readStatic(listPresets, "listPresets", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), __readStatic(savePreset, "savePreset", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), __readStatic(deletePreset, "deletePreset", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), __readStatic(setDefaultPreset, "setDefaultPreset", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), ...await __call(readOnlyFileTools, {
295
+ mainAgentTools = __deepFreeze([__readStatic(researchAgent, "researchAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/research.agency"), __readStatic(codeAgent, "codeAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.agency"), __readStatic(reviewAgent, "reviewAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/review.agency"), __readStatic(oracleAgent, "oracleAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/oracle.agency"), __readStatic(explorerAgent, "explorerAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/explorer.agency"), __readStatic(writingAgent, "writingAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/writing.agency"), __readStatic(rewriteAgent, "rewriteAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/rewrite.agency"), __readStatic(generateImageFile, "generateImageFile", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/images.agency"), __readStatic(viewImageFile, "viewImageFile", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/images.agency"), __readStatic(learnSkill, "learnSkill", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/learn.agency"), __readStatic(writeToolFor, "writeToolFor", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/learn.agency"), __readStatic(coordinatorSkills, "coordinatorSkills", "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency"), __readStatic(listPresets, "listPresets", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), __readStatic(savePreset, "savePreset", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), __readStatic(deletePreset, "deletePreset", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), __readStatic(setDefaultPreset, "setDefaultPreset", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/presetTools.agency"), ...await __call(readOnlyFileTools, {
294
296
  type: "positional",
295
297
  args: []
296
- }), await __callMethod(__readStatic(edit, "edit", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/stdlib/fs.agency"), "partial", {
298
+ }), await __callMethod(__readStatic(edit, "edit", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/fs.agency"), "partial", {
297
299
  type: "named",
298
300
  positionalArgs: [],
299
301
  namedArgs: {
@@ -635,7 +637,7 @@ async function __coordinatorInit_impl(context) {
635
637
  await runner.step(5, async (runner2) => {
636
638
  __stack.locals.__hoist_4 = await __call(checkBundledSkill, {
637
639
  type: "positional",
638
- args: [__readStatic(superpowersSkill, "superpowersSkill", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.agency"), `brainstorming`]
640
+ args: [__readStatic(superpowersSkill, "superpowersSkill", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.agency"), `brainstorming`]
639
641
  });
640
642
  if (hasInterrupts(__stack.locals.__hoist_4)) {
641
643
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -852,7 +854,7 @@ async function __turnTools_impl(turnStart) {
852
854
  }
853
855
  });
854
856
  await runner.step(3, async (runner2) => {
855
- __stack.locals.__hoist_2 = await __callMethod(__readStatic(elapsedTime, "elapsedTime", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/stdlib/date.agency"), "partial", {
857
+ __stack.locals.__hoist_2 = await __callMethod(__readStatic(elapsedTime, "elapsedTime", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/date.agency"), "partial", {
856
858
  type: "named",
857
859
  positionalArgs: [],
858
860
  namedArgs: {
@@ -862,7 +864,7 @@ async function __turnTools_impl(turnStart) {
862
864
  });
863
865
  await runner.step(4, async (runner2) => {
864
866
  __functionCompleted = true;
865
- runner2.halt([...__readStatic(mainAgentTools, "mainAgentTools", "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency"), ...__stack.locals.__hoist_0, ...__stack.locals.__hoist_1, __readStatic(whatIAmDoing, "whatIAmDoing", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/stdlib/agents/lib/toolkits.agency"), __stack.locals.__hoist_2]);
867
+ runner2.halt([...__readStatic(mainAgentTools, "mainAgentTools", "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency"), ...__stack.locals.__hoist_0, ...__stack.locals.__hoist_1, __readStatic(whatIAmDoing, "whatIAmDoing", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agents/lib/toolkits.agency"), __readStatic(question, "question", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), __stack.locals.__hoist_2]);
866
868
  return;
867
869
  });
868
870
  });
@@ -2482,7 +2484,7 @@ const coordinatorBrain = __AgencyFunction.create({
2482
2484
  exported: true
2483
2485
  }, __toolRegistry);
2484
2486
  var stdin_default = graph;
2485
- const __sourceMap = { "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:exitIfBroken": { "1": { "line": 78, "col": 2 }, "2": { "line": 79, "col": 4 }, "3": { "line": 78, "col": 2 }, "3.0": { "line": 78, "col": 2 }, "3.1": { "line": 80, "col": 12 }, "3.2": { "line": 80, "col": 6 }, "3.3": { "line": 81, "col": 6 }, "3.4": { "line": 83, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorInit": { "1": { "line": 88, "col": 6 }, "2": { "line": 88, "col": 2 }, "3": { "line": 94, "col": 6 }, "4": { "line": 94, "col": 2 }, "5": { "line": 100, "col": 15 }, "6": { "line": 100, "col": 2 }, "7": { "line": 101, "col": 15 }, "8": { "line": 101, "col": 2 }, "9": { "line": 102, "col": 2 }, "10": { "line": 103, "col": 2 }, "11": { "line": 106, "col": 2 }, "2.0": { "line": 90, "col": 6 }, "2.1": { "line": 89, "col": 4 }, "2.2": { "line": 92, "col": 4 }, "4.0": { "line": 96, "col": 6 }, "4.1": { "line": 95, "col": 4 }, "4.2": { "line": 98, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:turnTools": { "1": { "line": 115, "col": 7 }, "2": { "line": 116, "col": 7 }, "3": { "line": 118, "col": 4 }, "4": { "line": 113, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:mainAgent": { "2": { "line": 126, "col": 2 }, "3": { "line": 127, "col": 2 }, "4": { "line": 153, "col": 2 }, "3.0": { "line": 128, "col": 4 }, "3.1.1": { "line": 130, "col": 6 }, "3.1.2": { "line": 131, "col": 24 }, "3.1.3": { "line": 131, "col": 6 }, "3.1.4": { "line": 135, "col": 6 }, "3.1.5": { "line": 136, "col": 6 }, "3.1": { "line": 129, "col": 4 }, "3.3": { "line": 144, "col": 13 }, "3.4": { "line": 142, "col": 4 }, "3.5": { "line": 146, "col": 4 }, "3.6.0": { "line": 148, "col": 6 }, "3.6.1": { "line": 149, "col": 6 }, "3.6": { "line": 147, "col": 4 }, "3.7": { "line": 151, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:promptText": { "1": { "line": 159, "col": 9 }, "2": { "line": 159, "col": 9 }, "3": { "line": 159, "col": 2 }, "2.0": { "line": 159, "col": 9 }, "2.1": { "line": 160, "col": 20 }, "2.2": { "line": 160, "col": 20 }, "2.3": { "line": 159, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:replyText": { "1": { "line": 167, "col": 6 }, "2": { "line": 167, "col": 2 }, "3": { "line": 170, "col": 2 }, "2.0": { "line": 168, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:researchTurn": { "1": { "line": 174, "col": 37 }, "2": { "line": 174, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:oracleTurn": { "1": { "line": 182, "col": 2 }, "2": { "line": 183, "col": 2 }, "3": { "line": 186, "col": 2 }, "2.0": { "line": 184, "col": 36 }, "2.1": { "line": 184, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:explorerTurn": { "1": { "line": 190, "col": 2 }, "2": { "line": 191, "col": 2 }, "3": { "line": 194, "col": 2 }, "2.0": { "line": 192, "col": 38 }, "2.1": { "line": 192, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorRunTurn": { "1": { "line": 201, "col": 9 }, "2": { "line": 201, "col": 2 }, "1.0": { "line": 202, "col": 24 }, "1.1": { "line": 202, "col": 14 }, "1.2": { "line": 202, "col": 14 }, "1.3": { "line": 203, "col": 31 }, "1.4": { "line": 203, "col": 18 }, "1.5": { "line": 203, "col": 18 }, "1.6": { "line": 204, "col": 27 }, "1.7": { "line": 204, "col": 16 }, "1.8": { "line": 204, "col": 16 }, "1.9": { "line": 205, "col": 31 }, "1.10": { "line": 205, "col": 18 }, "1.11": { "line": 205, "col": 18 }, "1.12": { "line": 206, "col": 28 }, "1.13": { "line": 206, "col": 16 }, "1.14": { "line": 206, "col": 16 }, "1.15": { "line": 207, "col": 30 }, "1.16": { "line": 207, "col": 17 }, "1.17": { "line": 207, "col": 17 }, "1.18": { "line": 208, "col": 30 }, "1.19": { "line": 208, "col": 17 }, "1.20": { "line": 208, "col": 17 }, "1.21": { "line": 209, "col": 9 }, "1.22": { "line": 209, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorBrain": { "1": { "line": 214, "col": 2 } } };
2487
+ const __sourceMap = { "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:exitIfBroken": { "1": { "line": 79, "col": 2 }, "2": { "line": 80, "col": 4 }, "3": { "line": 79, "col": 2 }, "3.0": { "line": 79, "col": 2 }, "3.1": { "line": 81, "col": 12 }, "3.2": { "line": 81, "col": 6 }, "3.3": { "line": 82, "col": 6 }, "3.4": { "line": 84, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorInit": { "1": { "line": 89, "col": 6 }, "2": { "line": 89, "col": 2 }, "3": { "line": 95, "col": 6 }, "4": { "line": 95, "col": 2 }, "5": { "line": 101, "col": 15 }, "6": { "line": 101, "col": 2 }, "7": { "line": 102, "col": 15 }, "8": { "line": 102, "col": 2 }, "9": { "line": 103, "col": 2 }, "10": { "line": 104, "col": 2 }, "11": { "line": 107, "col": 2 }, "2.0": { "line": 91, "col": 6 }, "2.1": { "line": 90, "col": 4 }, "2.2": { "line": 93, "col": 4 }, "4.0": { "line": 97, "col": 6 }, "4.1": { "line": 96, "col": 4 }, "4.2": { "line": 99, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:turnTools": { "1": { "line": 116, "col": 7 }, "2": { "line": 117, "col": 7 }, "3": { "line": 120, "col": 4 }, "4": { "line": 114, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:mainAgent": { "2": { "line": 128, "col": 2 }, "3": { "line": 129, "col": 2 }, "4": { "line": 155, "col": 2 }, "3.0": { "line": 130, "col": 4 }, "3.1.1": { "line": 132, "col": 6 }, "3.1.2": { "line": 133, "col": 24 }, "3.1.3": { "line": 133, "col": 6 }, "3.1.4": { "line": 137, "col": 6 }, "3.1.5": { "line": 138, "col": 6 }, "3.1": { "line": 131, "col": 4 }, "3.3": { "line": 146, "col": 13 }, "3.4": { "line": 144, "col": 4 }, "3.5": { "line": 148, "col": 4 }, "3.6.0": { "line": 150, "col": 6 }, "3.6.1": { "line": 151, "col": 6 }, "3.6": { "line": 149, "col": 4 }, "3.7": { "line": 153, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:promptText": { "1": { "line": 161, "col": 9 }, "2": { "line": 161, "col": 9 }, "3": { "line": 161, "col": 2 }, "2.0": { "line": 161, "col": 9 }, "2.1": { "line": 162, "col": 20 }, "2.2": { "line": 162, "col": 20 }, "2.3": { "line": 161, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:replyText": { "1": { "line": 169, "col": 6 }, "2": { "line": 169, "col": 2 }, "3": { "line": 172, "col": 2 }, "2.0": { "line": 170, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:researchTurn": { "1": { "line": 176, "col": 37 }, "2": { "line": 176, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:oracleTurn": { "1": { "line": 184, "col": 2 }, "2": { "line": 185, "col": 2 }, "3": { "line": 188, "col": 2 }, "2.0": { "line": 186, "col": 36 }, "2.1": { "line": 186, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:explorerTurn": { "1": { "line": 192, "col": 2 }, "2": { "line": 193, "col": 2 }, "3": { "line": 196, "col": 2 }, "2.0": { "line": 194, "col": 38 }, "2.1": { "line": 194, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorRunTurn": { "1": { "line": 203, "col": 9 }, "2": { "line": 203, "col": 2 }, "1.0": { "line": 204, "col": 24 }, "1.1": { "line": 204, "col": 14 }, "1.2": { "line": 204, "col": 14 }, "1.3": { "line": 205, "col": 31 }, "1.4": { "line": 205, "col": 18 }, "1.5": { "line": 205, "col": 18 }, "1.6": { "line": 206, "col": 27 }, "1.7": { "line": 206, "col": 16 }, "1.8": { "line": 206, "col": 16 }, "1.9": { "line": 207, "col": 31 }, "1.10": { "line": 207, "col": 18 }, "1.11": { "line": 207, "col": 18 }, "1.12": { "line": 208, "col": 28 }, "1.13": { "line": 208, "col": 16 }, "1.14": { "line": 208, "col": 16 }, "1.15": { "line": 209, "col": 30 }, "1.16": { "line": 209, "col": 17 }, "1.17": { "line": 209, "col": 17 }, "1.18": { "line": 210, "col": 30 }, "1.19": { "line": 210, "col": 17 }, "1.20": { "line": 210, "col": 17 }, "1.21": { "line": 211, "col": 9 }, "1.22": { "line": 211, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorBrain": { "1": { "line": 216, "col": 2 } } };
2486
2488
  export {
2487
2489
  __getCheckpoints,
2488
2490
  __invokeFunction,
@@ -44,7 +44,7 @@ export def writeToolFor(name: string, purpose: string, request: string): string
44
44
  model calls. In a one-shot run nothing is saved.
45
45
 
46
46
  @param name - camelCase name: a lowercase letter, then letters and digits
47
- @param purpose - What the tool should do, in plain language
47
+ @param purpose - What the tool should do, in plain language. State only what the user said; ask the user first for anything the tool needs that they have not told you
48
48
  @param request - The tool's input type as Agency type text, such as { topics: string[]; maxItems: number }
49
49
  """
50
50
  const cap = maxLearnedToolName()
@@ -154,7 +154,7 @@ function registerTools(tools) {
154
154
  }
155
155
  }
156
156
  }
157
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/learn.agency", "5f8bcd559a05e049f772f9b5367344e6db1ce5f3f53d8e256745a42c681a4a25", import.meta.url);
157
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/learn.agency", "bd71c5f741e508e5dc8b9f88ec98b6d30781383d7a53267a1ebcd32bcc3f4b8a", import.meta.url);
158
158
  __registerTool(print);
159
159
  __registerTool(printJSON);
160
160
  __registerTool(input);
@@ -484,7 +484,7 @@ async function __writeToolFor_impl(name, purpose, request) {
484
484
  body: async (runner2) => {
485
485
  await runner2.step(0, async (runner3) => {
486
486
  __functionCompleted = true;
487
- runner3.halt(`Not saved: the name must be at most ${__stack.locals.cap} characters, because the tool is offered as ${__readStatic(LEARNED_TOOL_PREFIX, "LEARNED_TOOL_PREFIX", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/lib/learned.agency")}${__stack.args.name} and providers cap a tool name at ${__readStatic(MAX_TOOL_NAME_LEN, "MAX_TOOL_NAME_LEN", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/stdlib/skills.agency")}`);
487
+ runner3.halt(`Not saved: the name must be at most ${__stack.locals.cap} characters, because the tool is offered as ${__readStatic(LEARNED_TOOL_PREFIX, "LEARNED_TOOL_PREFIX", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/learned.agency")}${__stack.args.name} and providers cap a tool name at ${__readStatic(MAX_TOOL_NAME_LEN, "MAX_TOOL_NAME_LEN", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/skills.agency")}`);
488
488
  return;
489
489
  });
490
490
  }
@@ -552,7 +552,7 @@ async function __writeToolFor_impl(name, purpose, request) {
552
552
  ]);
553
553
  await runner.step(7, async (runner2) => {
554
554
  __functionCompleted = true;
555
- runner2.halt(`Saved the '${__stack.locals.saved.value.name}' tool to the learned catalog as ${__readStatic(LEARNED_TOOL_PREFIX, "LEARNED_TOOL_PREFIX", "/Users/adityabhargava/bmo/.worktrees/agency-respond-invocation/packages/agency-lang/dist/lib/agents/agency-agent/lib/learned.agency")}${__stack.locals.saved.value.name}.`);
555
+ runner2.halt(`Saved the '${__stack.locals.saved.value.name}' tool to the learned catalog as ${__readStatic(LEARNED_TOOL_PREFIX, "LEARNED_TOOL_PREFIX", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/learned.agency")}${__stack.locals.saved.value.name}.`);
556
556
  return;
557
557
  });
558
558
  });
@@ -634,7 +634,7 @@ const writeToolFor = __AgencyFunction.create({
634
634
  model calls. In a one-shot run nothing is saved.
635
635
 
636
636
  @param name - camelCase name: a lowercase letter, then letters and digits
637
- @param purpose - What the tool should do, in plain language
637
+ @param purpose - What the tool should do, in plain language. State only what the user said; ask the user first for anything the tool needs that they have not told you
638
638
  @param request - The tool's input type as Agency type text, such as { topics: string[]; maxItems: number }`,
639
639
  schema: z.object({ "name": z.string(), "purpose": z.string(), "request": z.string() })
640
640
  },
@@ -116,6 +116,13 @@ name, the purpose, and the request type. The user reviews the complete
116
116
  draft before anything is saved and can send feedback for another draft.
117
117
  Never claim a skill or tool was saved unless the reply said so.
118
118
 
119
+ Before you call `writeToolFor`, list what the tool needs that the user
120
+ has not told you: an address, an account, a provider, the name of an
121
+ environment variable. Ask the user for those first, and put the answers
122
+ in the purpose. In the purpose, state only what the user said. Do not
123
+ call something "configured" or "existing" unless the user said it is:
124
+ the author will go looking for it.
125
+
119
126
  A saved tool is in your tools as `learned_<name>`, and `learned_skills`
120
127
  reads your saved skills. Both appear from the next turn on. When the
121
128
  user asks for something one of them covers, call it rather than doing
@@ -170,7 +177,9 @@ When the user asks you to look at, debug, or change a file or some
170
177
  code, look at it — read it yourself, or delegate changes to
171
178
  `codeAgent`. Don't ask the user to paste a file or describe code you
172
179
  can read. Only ask the user for information you genuinely cannot
173
- obtain yourself.
180
+ obtain yourself. A fact about the user that no file holds, such as which
181
+ address, account, or service they mean, is that kind of information:
182
+ ask for it and do not guess.
174
183
 
175
184
  ## Answer before action
176
185
 
@@ -184,6 +193,7 @@ with them — don't sprint to implementation.
184
193
  ## Communicating with the user
185
194
 
186
195
  - Make sure the user is following what you're doing. Use the `whatIAmDoing` tool frequently to tell the user what you're doing. (Subagent dispatches are announced automatically — narrate everything else.)
196
+ - When the work turns on something only the user can tell you — which account they mean, which of two readings of the request, a value you cannot look up — ask with the `question` tool, and ask before you build on the guess rather than after. Do not ask for anything you could find yourself. When nobody can answer, your question comes back rejected; when that happens, pick the most reasonable reading, say which one you picked, and carry on.
187
197
  - Also use the `elapsedTime` tool frequently to check how much time has elapsed since you started the task. If the user gave you a time constraint to work within, make sure you finish the task within that time constraint. For simple tasks, make sure you don't spend too long researching things before giving an answer.
188
198
 
189
199
  ## Budgets and subagents that stop early
@@ -52,6 +52,9 @@ short unless the task demands detail.
52
52
  `learnSkill` saves a skill you write to your learned catalog; `writeToolFor`
53
53
  has a tool written and saved there. The user reviews before anything
54
54
  is saved. Never claim a save the reply did not confirm.
55
+ Before `writeToolFor`, ask the user for anything the tool needs that
56
+ they have not told you (an address, an account, a provider). In the
57
+ purpose, state only what the user said.
55
58
  A saved tool is in your tools as `learned_<name>`, and `learned_skills`
56
59
  reads your saved skills. Call them when they cover the request. A saved
57
60
  tool's code is at `~/.agency-agent/tools/<name>/impl.agency`.
@@ -74,6 +77,7 @@ Only reference files that live in the user's own working directory. Never cite a
74
77
  ## Communicating with the user
75
78
 
76
79
  - Make sure the user is following what you're doing. Use the `whatIAmDoing` tool frequently to tell the user what you're doing. (Subagent dispatches are announced automatically — narrate everything else.)
80
+ - When the work turns on something only the user can tell you — which account they mean, which of two readings of the request, a value you cannot look up — ask with the `question` tool, and ask before you build on the guess rather than after. Do not ask for anything you could find yourself. When nobody can answer, your question comes back rejected; when that happens, pick the most reasonable reading, say which one you picked, and carry on.
77
81
  - Also use the `elapsedTime` tool frequently to check how much time has elapsed since you started the task. If the user gave you a time constraint to work within, make sure you finish the task within that time constraint. For simple tasks, make sure you don't spend too long researching things before giving an answer.
78
82
 
79
83
  ## Budgets and subagents that stop early
@@ -0,0 +1,384 @@
1
+ import { print, printJSON, input, sleep, saveDraft, _guard, _pairsOf, read, write, writeBinary, readBinary, range, callback, map, mapWithIndex, filter, exclude, find, findIndex, reduce, flatMap, every, some, count, sortBy, unique, groupBy, flatten, setAgentCwd, getAgentCwd, applyAgentCwd } from "agency-lang/stdlib/index.js";
2
+ import { fileURLToPath } from "url";
3
+ import __process from "process";
4
+ import { readFileSync } from "fs";
5
+ import { z } from "agency-lang/zod";
6
+ import { color, nanoid } from "agency-lang";
7
+ import path from "path";
8
+ import {
9
+ RuntimeContext,
10
+ Runner,
11
+ setupFunction,
12
+ claimFrameForScope,
13
+ callHook,
14
+ checkpoint as __checkpoint_impl,
15
+ getCheckpoint as __getCheckpoint_impl,
16
+ restore as __restore_impl,
17
+ _run as __runtime_run_impl,
18
+ interrupt,
19
+ isInterrupt,
20
+ hasInterrupts,
21
+ isDebugger,
22
+ respondToInterrupts as _respondToInterrupts,
23
+ respondToInterruptsForServe as _respondToInterruptsForServe,
24
+ rewindFrom as _rewindFrom,
25
+ runExportedFunction as _runExportedFunction,
26
+ runExportedFunctionForServe as _runExportedFunctionForServe,
27
+ runNodeForServe as _runNodeForServe,
28
+ RestoreSignal,
29
+ AgencyAbort,
30
+ AbortedResult,
31
+ isAborted,
32
+ __registerGlobalsInit,
33
+ __registerCallbacksInit,
34
+ registerModuleFingerprint as __registerModuleFingerprint,
35
+ failure,
36
+ isFailure,
37
+ stampFailureBoundary,
38
+ __nn,
39
+ AgencyFunction as __AgencyFunction,
40
+ __call,
41
+ __callMethod,
42
+ __stateStack,
43
+ __globals,
44
+ getRuntimeContext,
45
+ agencyStore,
46
+ functionRefReviver as __functionRefReviver,
47
+ DeterministicClient as __DeterministicClient,
48
+ installFetchMock as __installFetchMock,
49
+ createLogger as __createLogger
50
+ } from "agency-lang/runtime";
51
+ const __filename = fileURLToPath(import.meta.url);
52
+ const __dirname = path.dirname(__filename);
53
+ const __cwd = __process.cwd();
54
+ const __globalCtx = new RuntimeContext({
55
+ statelogConfig: {
56
+ host: "https://statelog.adit.io",
57
+ apiKey: __process.env["STATELOG_API_KEY"] || "",
58
+ projectId: "agency-lang",
59
+ debugMode: false,
60
+ observability: true,
61
+ logFile: "log.jsonl"
62
+ },
63
+ smoltalkDefaults: {
64
+ apiKey: {
65
+ openAi: __process.env["OPENAI_API_KEY"] || "",
66
+ google: __process.env["GEMINI_API_KEY"] || "",
67
+ anthropic: __process.env["ANTHROPIC_API_KEY"] || "",
68
+ openRouter: __process.env["OPENROUTER_API_KEY"] || "",
69
+ deepInfra: __process.env["DEEPINFRA_API_KEY"] || "",
70
+ liteLlm: __process.env["LITELLM_API_KEY"] || "",
71
+ openAiCompat: __process.env["OPENAI_COMPAT_API_KEY"] || ""
72
+ },
73
+ baseUrl: {
74
+ liteLlm: __process.env["LITELLM_BASE_URL"] || "",
75
+ openAiCompat: __process.env["OPENAI_COMPAT_BASE_URL"] || ""
76
+ },
77
+ model: "gpt-5-mini",
78
+ logLevel: "warn",
79
+ statelog: {
80
+ host: "https://statelog.adit.io",
81
+ projectId: "smoltalk",
82
+ apiKey: __process.env["STATELOG_SMOLTALK_API_KEY"] || "",
83
+ traceId: nanoid()
84
+ },
85
+ provider: "openai-responses"
86
+ },
87
+ dirname: __dirname,
88
+ logLevel: "info",
89
+ traceConfig: {
90
+ program: "lib/agents/agency-agent/brains/coordinator/subagents/announce.agency"
91
+ }
92
+ });
93
+ const graph = __globalCtx.graph;
94
+ function approve(value) {
95
+ return { type: "approve", value };
96
+ }
97
+ function reject(value) {
98
+ return { type: "reject", value };
99
+ }
100
+ function propagate() {
101
+ return { type: "propagate" };
102
+ }
103
+ function pass() {
104
+ return { type: "pass" };
105
+ }
106
+ const respondToInterrupts = (interrupts, responses, opts) => _respondToInterrupts({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata });
107
+ const rewindFrom = (checkpoint2, overrides, opts) => _rewindFrom({ ctx: __globalCtx, checkpoint: checkpoint2, overrides, metadata: opts?.metadata });
108
+ const __invokeFunction = (fn, namedArgs) => _runExportedFunction({ ctx: __globalCtx, fn, namedArgs, initializeGlobals: __initializeGlobals });
109
+ const __invokeFunctionForServe = (fn, namedArgs, invocation) => _runExportedFunctionForServe({ ctx: __globalCtx, fn, namedArgs, invocation, initializeGlobals: __initializeGlobals });
110
+ const __invokeNodeForServe = (nodeName, data, invocation) => _runNodeForServe({ ctx: __globalCtx, nodeName, data, invocation, initializeGlobals: __initializeGlobals });
111
+ const __respondToInterruptsForServe = (interrupts, responses, opts) => _respondToInterruptsForServe({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata, invocation: opts?.invocation });
112
+ const __setDebugger = (dbg) => {
113
+ __globalCtx.debuggerState = dbg;
114
+ };
115
+ const __setTraceFile = (filePath) => {
116
+ __globalCtx.traceConfig.traceFile = filePath;
117
+ };
118
+ const __setLLMClient = (client) => {
119
+ __globalCtx.setLLMClient(client);
120
+ };
121
+ const __getCheckpoints = () => __globalCtx.checkpoints;
122
+ if (__process.env.AGENCY_LLM_MOCKS) {
123
+ __globalCtx.setLLMClient(
124
+ new __DeterministicClient(JSON.parse(__process.env.AGENCY_LLM_MOCKS))
125
+ );
126
+ }
127
+ if (__process.env.AGENCY_FETCH_MOCKS_FILE) {
128
+ __installFetchMock(JSON.parse(readFileSync(__process.env.AGENCY_FETCH_MOCKS_FILE, "utf-8")));
129
+ }
130
+ const __toolRegistry = __functionRefReviver.registry ??= {};
131
+ function __registerTool(value, _aliasName) {
132
+ if (__AgencyFunction.isAgencyFunction(value)) {
133
+ __toolRegistry[`${value.module}:${value.name}`] = value;
134
+ }
135
+ }
136
+ const checkpoint = __AgencyFunction.create({ name: "checkpoint", module: "__runtime", fn: __checkpoint_impl, params: [], toolDefinition: null }, __toolRegistry);
137
+ const getCheckpoint = __AgencyFunction.create({ name: "getCheckpoint", module: "__runtime", fn: __getCheckpoint_impl, params: [{ name: "checkpointId", hasDefault: false, defaultValue: void 0, variadic: false }], toolDefinition: null }, __toolRegistry);
138
+ const restore = __AgencyFunction.create({ name: "restore", module: "__runtime", fn: __restore_impl, params: [{ name: "checkpointIdOrCheckpoint", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "options", hasDefault: false, defaultValue: void 0, variadic: false }], toolDefinition: null }, __toolRegistry);
139
+ const _run = __AgencyFunction.create({ name: "_run", module: "__runtime", fn: __runtime_run_impl, params: [{ name: "compiled", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "node", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "args", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "wallClock", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "memory", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "ipcPayload", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "stdout", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "configOverrides", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "cwd", hasDefault: false, defaultValue: void 0, variadic: false }, { name: "maxDepth", hasDefault: false, defaultValue: void 0, variadic: false }], toolDefinition: null }, __toolRegistry);
140
+ function setLLMClient(client) {
141
+ __globalCtx.setLLMClient(client);
142
+ }
143
+ function registerTools(tools) {
144
+ for (const tool of tools) {
145
+ if (__AgencyFunction.isAgencyFunction(tool)) {
146
+ __toolRegistry[`${tool.module}:${tool.name}`] = tool;
147
+ }
148
+ }
149
+ }
150
+ __registerTool(print);
151
+ __registerTool(printJSON);
152
+ __registerTool(input);
153
+ __registerTool(sleep);
154
+ __registerTool(saveDraft);
155
+ __registerTool(_guard);
156
+ __registerTool(_pairsOf);
157
+ __registerTool(read);
158
+ __registerTool(write);
159
+ __registerTool(writeBinary);
160
+ __registerTool(readBinary);
161
+ __registerTool(range);
162
+ __registerTool(callback);
163
+ __registerTool(map);
164
+ __registerTool(mapWithIndex);
165
+ __registerTool(filter);
166
+ __registerTool(exclude);
167
+ __registerTool(find);
168
+ __registerTool(findIndex);
169
+ __registerTool(reduce);
170
+ __registerTool(flatMap);
171
+ __registerTool(every);
172
+ __registerTool(some);
173
+ __registerTool(count);
174
+ __registerTool(sortBy);
175
+ __registerTool(unique);
176
+ __registerTool(groupBy);
177
+ __registerTool(flatten);
178
+ __registerTool(setAgentCwd);
179
+ __registerTool(getAgentCwd);
180
+ __registerTool(applyAgentCwd);
181
+ async function __initializeGlobals(__ctx) {
182
+ if (__ctx.globals.isInitialized("lib/agents/agency-agent/brains/coordinator/subagents/announce.agency")) {
183
+ return;
184
+ }
185
+ __ctx.globals.markInitialized("lib/agents/agency-agent/brains/coordinator/subagents/announce.agency");
186
+ }
187
+ __registerGlobalsInit("lib/agents/agency-agent/brains/coordinator/subagents/announce.agency", __initializeGlobals);
188
+ async function __registerTopLevelCallbacks(__ctx) {
189
+ }
190
+ __registerCallbacksInit("lib/agents/agency-agent/brains/coordinator/subagents/announce.agency", __registerTopLevelCallbacks);
191
+ __functionRefReviver.registry = __toolRegistry;
192
+ async function __announce_impl(agentName, userMsg) {
193
+ const __setupData = setupFunction();
194
+ const __stack = __setupData.stack;
195
+ const __step = __setupData.step;
196
+ const __self = __setupData.self;
197
+ const __ctx = getRuntimeContext().ctx;
198
+ let __forked;
199
+ let __functionCompleted = false;
200
+ claimFrameForScope(__stack, "announce", "lib/agents/agency-agent/brains/coordinator/subagents/announce.agency");
201
+ if (!__globals().isInitialized("lib/agents/agency-agent/brains/coordinator/subagents/announce.agency")) {
202
+ await __initializeGlobals(__ctx);
203
+ }
204
+ let __funcStartTime = performance.now();
205
+ __stack.args["agentName"] = agentName;
206
+ __stack.args["userMsg"] = userMsg;
207
+ __self.__destructiveRan = __self.__destructiveRan ?? false;
208
+ const runner = new Runner(__ctx, __stack, { state: __stack, moduleId: "lib/agents/agency-agent/brains/coordinator/subagents/announce.agency", scopeName: "announce", threads: __setupData.threads });
209
+ let __resultCheckpointId = -1;
210
+ if (__ctx._pendingArgOverrides) {
211
+ const __overrides = __ctx._pendingArgOverrides;
212
+ __ctx._pendingArgOverrides = void 0;
213
+ if ("agentName" in __overrides) {
214
+ agentName = __overrides["agentName"];
215
+ __stack.args["agentName"] = agentName;
216
+ }
217
+ if ("userMsg" in __overrides) {
218
+ userMsg = __overrides["userMsg"];
219
+ __stack.args["userMsg"] = userMsg;
220
+ }
221
+ }
222
+ try {
223
+ await agencyStore.run({
224
+ ...getRuntimeContext(),
225
+ ctx: __ctx,
226
+ stack: __setupData.stateStack,
227
+ threads: __setupData.threads
228
+ }, async () => {
229
+ await runner.hook(0, async () => {
230
+ await callHook({
231
+ name: "onFunctionStart",
232
+ data: {
233
+ functionName: "announce",
234
+ args: {
235
+ agentName,
236
+ userMsg
237
+ },
238
+ moduleId: "lib/agents/agency-agent/brains/coordinator/subagents/announce.agency"
239
+ }
240
+ });
241
+ });
242
+ await runner.step(1, async (runner2) => {
243
+ __stack.locals.gist = __nn((await __callMethod(__stack.args.userMsg, "split", {
244
+ type: "positional",
245
+ args: [`
246
+ `]
247
+ }))[0]);
248
+ });
249
+ await runner.ifElse(2, [
250
+ {
251
+ condition: async () => __stack.locals.gist.length > 100,
252
+ body: async (runner2) => {
253
+ await runner2.step(0, async (runner3) => {
254
+ __stack.locals.__hoist_0 = await __callMethod(__stack.locals.gist, "slice", {
255
+ type: "positional",
256
+ args: [0, 100]
257
+ });
258
+ });
259
+ await runner2.step(1, async (runner3) => {
260
+ __stack.locals.gist = __stack.locals.__hoist_0 + `\u2026`;
261
+ });
262
+ }
263
+ }
264
+ ]);
265
+ await runner.step(3, async (runner2) => {
266
+ __stack.locals.__hoist_1 = await __callMethod(color, "dim", {
267
+ type: "positional",
268
+ args: [`\u2192 ${__stack.args.agentName}: ${__stack.locals.gist}`]
269
+ });
270
+ });
271
+ await runner.step(4, async (runner2) => {
272
+ const __funcResult = await __call(print, {
273
+ type: "positional",
274
+ args: [__stack.locals.__hoist_1]
275
+ });
276
+ if (hasInterrupts(__funcResult)) {
277
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
278
+ runner2.halt(__funcResult);
279
+ return;
280
+ }
281
+ if (isAborted(__funcResult)) {
282
+ runner2.halt(__funcResult.carryThrough(__stack, "announce"));
283
+ return;
284
+ }
285
+ });
286
+ });
287
+ if (runner.halted) {
288
+ if (isFailure(runner.haltResult)) {
289
+ stampFailureBoundary(runner.haltResult, __self.__destructiveRan);
290
+ }
291
+ return runner.haltResult;
292
+ }
293
+ } catch (__error) {
294
+ if (__error instanceof RestoreSignal) {
295
+ throw __error;
296
+ }
297
+ if (__error instanceof AgencyAbort) {
298
+ return AbortedResult.fromError(__error, __stack, "announce");
299
+ }
300
+ {
301
+ const __errMsg = __error instanceof Error ? __error.message : String(__error);
302
+ const __errStack = __error instanceof Error && __error.stack ? __error.stack : "";
303
+ const __log = __createLogger(__ctx.logLevel);
304
+ __log.error("Function announce threw an exception (converted to Failure): " + __errMsg);
305
+ if (__errStack) __log.error(__errStack);
306
+ __ctx.statelogClient?.error?.({
307
+ errorType: "runtimeError",
308
+ message: __errMsg,
309
+ functionName: "announce"
310
+ });
311
+ }
312
+ return failure(
313
+ __error instanceof Error ? __error.message : String(__error),
314
+ {
315
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
316
+ destructiveRan: __self.__destructiveRan,
317
+ functionName: "announce",
318
+ args: __stack.args
319
+ }
320
+ );
321
+ } finally {
322
+ __stateStack()?.pop();
323
+ if (__functionCompleted) {
324
+ await callHook({
325
+ name: "onFunctionEnd",
326
+ data: {
327
+ functionName: "announce",
328
+ timeTaken: performance.now() - __funcStartTime
329
+ }
330
+ });
331
+ }
332
+ }
333
+ }
334
+ const announce = __AgencyFunction.create({
335
+ name: "announce",
336
+ module: "lib/agents/agency-agent/brains/coordinator/subagents/announce.agency",
337
+ fn: __announce_impl,
338
+ params: [{
339
+ name: "agentName",
340
+ hasDefault: false,
341
+ defaultValue: void 0,
342
+ variadic: false,
343
+ isFunctionTyped: false,
344
+ acceptsResult: false
345
+ }, {
346
+ name: "userMsg",
347
+ hasDefault: false,
348
+ defaultValue: void 0,
349
+ variadic: false,
350
+ isFunctionTyped: false,
351
+ acceptsResult: false
352
+ }],
353
+ toolDefinition: {
354
+ name: "announce",
355
+ description: "No description provided.",
356
+ schema: z.object({ "agentName": z.string(), "userMsg": z.string() })
357
+ },
358
+ exported: true
359
+ }, __toolRegistry);
360
+ var stdin_default = graph;
361
+ const __sourceMap = { "lib/agents/agency-agent/brains/coordinator/subagents/announce.agency:announce": { "1": { "line": 11, "col": 2 }, "2": { "line": 12, "col": 2 }, "3": { "line": 15, "col": 8 }, "4": { "line": 15, "col": 2 }, "2.0": { "line": 13, "col": 11 }, "2.1": { "line": 13, "col": 4 } } };
362
+ __registerModuleFingerprint("lib/agents/agency-agent/brains/coordinator/subagents/announce.agency", "d310c5805b420f38d30475b8af3a4a42eadf9ddf1b19eeebafdcc74b71a5d1d8", import.meta.url);
363
+ export {
364
+ __getCheckpoints,
365
+ __invokeFunction,
366
+ __invokeFunctionForServe,
367
+ __invokeNodeForServe,
368
+ __respondToInterruptsForServe,
369
+ __setDebugger,
370
+ __setLLMClient,
371
+ __setTraceFile,
372
+ __sourceMap,
373
+ __toolRegistry,
374
+ announce,
375
+ approve,
376
+ stdin_default as default,
377
+ hasInterrupts,
378
+ interrupt,
379
+ isDebugger,
380
+ isInterrupt,
381
+ reject,
382
+ respondToInterrupts,
383
+ rewindFrom
384
+ };
@@ -10,6 +10,7 @@
10
10
  * (`setAgentCwd`/`getAgentCwd`), which `agent.agency` pins to the user's
11
11
  * cwd at startup.
12
12
  */
13
+ import { question } from "std::agent"
13
14
  import { cli, cliHandles, CLI_NOT_AVAILABLE } from "std::agency"
14
15
  import { filter } from "std::array"
15
16
  import { agencyCodingAgent } from "std::agents/agency/coding"
@@ -203,6 +204,7 @@ def consultExpert(task: string, agencyTask: boolean): Result<ExpertGuidance> {
203
204
  maxTime: 5m,
204
205
  model: getSlowModel(),
205
206
  provider: getSlowProvider(),
207
+ extraTools: [question],
206
208
  )
207
209
  }
208
210
  return expertAgent(
@@ -211,6 +213,7 @@ def consultExpert(task: string, agencyTask: boolean): Result<ExpertGuidance> {
211
213
  maxTime: 5m,
212
214
  model: getSlowModel(),
213
215
  provider: getSlowProvider(),
216
+ extraTools: [question],
214
217
  )
215
218
  }
216
219
 
@@ -260,6 +263,7 @@ Deliverable: ONLY the Agency module source that will be saved as ${target}. The
260
263
  requireMain: target == "",
261
264
  maxCost: ESCALATE_MAX_COST,
262
265
  maxTime: ESCALATE_MAX_TIME,
266
+ extraTools: [question],
263
267
  )
264
268
  if (isFailure(written)) {
265
269
  return failure("could not write valid Agency code: ${written.error}")