agency-lang 0.16.0 → 0.17.1

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 (549) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +35 -14
  2. package/dist/lib/agents/agency-agent/agent.js +198 -59
  3. package/dist/lib/agents/agency-agent/brains/brain.agency +4 -1
  4. package/dist/lib/agents/agency-agent/brains/brain.js +4 -3
  5. package/dist/lib/agents/agency-agent/brains/coordinator/README.md +5 -3
  6. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency +10 -3
  7. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.js +98 -14
  8. package/dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.js +3 -2
  9. package/dist/lib/agents/agency-agent/brains/coordinator/prompts/main-large.md +9 -1
  10. package/dist/lib/agents/agency-agent/brains/coordinator/prompts/main-small.md +5 -0
  11. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/brainstorm.js +3 -2
  12. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.js +3 -2
  13. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/explorer.js +3 -2
  14. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/oracle.js +3 -2
  15. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/research.js +3 -2
  16. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/review.js +3 -2
  17. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/rewrite.agency +41 -0
  18. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/rewrite.js +600 -0
  19. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/supervisor.js +3 -2
  20. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/writing.agency +24 -0
  21. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/writing.js +392 -0
  22. package/dist/lib/agents/agency-agent/brains/coordinator/tests/agentTurn.js +3 -2
  23. package/dist/lib/agents/agency-agent/brains/coordinator/tests/attachmentsTurn.js +3 -2
  24. package/dist/lib/agents/agency-agent/brains/coordinator/tests/brainstorm.js +3 -2
  25. package/dist/lib/agents/agency-agent/brains/coordinator/tests/supervisor.js +3 -2
  26. package/dist/lib/agents/agency-agent/brains/coordinator/tests/toolWiring.js +3 -2
  27. package/dist/lib/agents/agency-agent/brains/registry.js +3 -2
  28. package/dist/lib/agents/agency-agent/brains/simple/README.md +1 -1
  29. package/dist/lib/agents/agency-agent/brains/simple/simple.agency +1 -0
  30. package/dist/lib/agents/agency-agent/brains/simple/simple.js +4 -2
  31. package/dist/lib/agents/agency-agent/brains/simple/tests/simpleTurn.js +3 -2
  32. package/dist/lib/agents/agency-agent/images/images.js +3 -2
  33. package/dist/lib/agents/agency-agent/lib/agentName.js +3 -2
  34. package/dist/lib/agents/agency-agent/lib/args.agency +9 -0
  35. package/dist/lib/agents/agency-agent/lib/args.js +12 -2
  36. package/dist/lib/agents/agency-agent/lib/attachments.js +3 -2
  37. package/dist/lib/agents/agency-agent/lib/budget.js +3 -2
  38. package/dist/lib/agents/agency-agent/lib/capabilities.js +3 -2
  39. package/dist/lib/agents/agency-agent/lib/capabilitiesUi.js +3 -2
  40. package/dist/lib/agents/agency-agent/lib/commandPalette.agency +1 -0
  41. package/dist/lib/agents/agency-agent/lib/commandPalette.js +5 -3
  42. package/dist/lib/agents/agency-agent/lib/config.agency +2 -76
  43. package/dist/lib/agents/agency-agent/lib/config.js +17 -67
  44. package/dist/lib/agents/agency-agent/lib/grounding.js +3 -2
  45. package/dist/lib/agents/agency-agent/lib/header.js +3 -2
  46. package/dist/lib/agents/agency-agent/lib/images.js +3 -2
  47. package/dist/lib/agents/agency-agent/lib/mcp.js +3 -2
  48. package/dist/lib/agents/agency-agent/lib/modelFilters.js +3 -2
  49. package/dist/lib/agents/agency-agent/lib/models.agency +10 -4
  50. package/dist/lib/agents/agency-agent/lib/models.js +62 -25
  51. package/dist/lib/agents/agency-agent/lib/policy.js +3 -2
  52. package/dist/lib/agents/agency-agent/lib/repl.agency +33 -8
  53. package/dist/lib/agents/agency-agent/lib/repl.js +424 -88
  54. package/dist/lib/agents/agency-agent/lib/resolution.js +3 -2
  55. package/dist/lib/agents/agency-agent/lib/resume.agency +220 -0
  56. package/dist/lib/agents/agency-agent/lib/resume.js +1927 -0
  57. package/dist/lib/agents/agency-agent/lib/search.agency +17 -4
  58. package/dist/lib/agents/agency-agent/lib/search.js +194 -95
  59. package/dist/lib/agents/agency-agent/lib/session.js +3 -2
  60. package/dist/lib/agents/agency-agent/lib/sessionTitle.agency +93 -0
  61. package/dist/lib/agents/agency-agent/lib/sessionTitle.js +1114 -0
  62. package/dist/lib/agents/agency-agent/lib/sessions.agency +108 -0
  63. package/dist/lib/agents/agency-agent/lib/sessions.js +1727 -0
  64. package/dist/lib/agents/agency-agent/lib/settings.js +3 -2
  65. package/dist/lib/agents/agency-agent/lib/slots.js +3 -2
  66. package/dist/lib/agents/agency-agent/lib/trace.agency +2 -1
  67. package/dist/lib/agents/agency-agent/lib/trace.js +14 -7
  68. package/dist/lib/agents/agency-agent/lib/transcript.agency +25 -0
  69. package/dist/lib/agents/agency-agent/lib/transcript.js +648 -0
  70. package/dist/lib/agents/agency-agent/lib/turn.agency +1 -3
  71. package/dist/lib/agents/agency-agent/lib/turn.js +4 -6
  72. package/dist/lib/agents/agency-agent/lib/utils/renderLLMCallResponse.js +3 -2
  73. package/dist/lib/agents/agency-agent/lib/utils.js +3 -2
  74. package/dist/lib/agents/agency-agent/shared.agency +4 -1
  75. package/dist/lib/agents/agency-agent/shared.js +20 -17
  76. package/dist/lib/agents/agency-agent/tests/agentDir.js +3 -2
  77. package/dist/lib/agents/agency-agent/tests/agentName.js +3 -2
  78. package/dist/lib/agents/agency-agent/tests/attachments.js +3 -2
  79. package/dist/lib/agents/agency-agent/tests/capabilities.js +3 -2
  80. package/dist/lib/agents/agency-agent/tests/envPolicy.agency +18 -0
  81. package/dist/lib/agents/agency-agent/tests/envPolicy.js +446 -0
  82. package/dist/lib/agents/agency-agent/tests/envPolicy.test.json +11 -0
  83. package/dist/lib/agents/agency-agent/tests/execPolicy.js +3 -2
  84. package/dist/lib/agents/agency-agent/tests/gitPolicy.js +3 -2
  85. package/dist/lib/agents/agency-agent/tests/imageTool.js +3 -2
  86. package/dist/lib/agents/agency-agent/tests/mcpGating.js +3 -2
  87. package/dist/lib/agents/agency-agent/tests/memoryWiring.js +3 -2
  88. package/dist/lib/agents/agency-agent/tests/modelFilters.js +3 -2
  89. package/dist/lib/agents/agency-agent/tests/models.js +3 -2
  90. package/dist/lib/agents/agency-agent/tests/oneShotRounds.js +3 -2
  91. package/dist/lib/agents/agency-agent/tests/readPolicy.js +3 -2
  92. package/dist/lib/agents/agency-agent/tests/registry.agency +1 -1
  93. package/dist/lib/agents/agency-agent/tests/registry.js +6 -11
  94. package/dist/lib/agents/agency-agent/tests/registry.test.json +1 -1
  95. package/dist/lib/agents/agency-agent/tests/resolution.js +3 -2
  96. package/dist/lib/agents/agency-agent/tests/search.js +3 -2
  97. package/dist/lib/agents/agency-agent/tests/settings.js +3 -2
  98. package/dist/lib/agents/agency-agent/tests/slots.js +3 -2
  99. package/dist/lib/agents/agency-agent/tests/stubBrains.agency +3 -0
  100. package/dist/lib/agents/agency-agent/tests/stubBrains.js +7 -3
  101. package/dist/lib/agents/agency-agent/tests/threadText.js +3 -2
  102. package/dist/lib/agents/agency-agent/tests/turn.js +3 -2
  103. package/dist/lib/agents/agency-agent/tests/turnFailure.js +3 -2
  104. package/dist/lib/agents/eval/goalJudge.js +3 -2
  105. package/dist/lib/agents/eval/judge.js +3 -2
  106. package/dist/lib/agents/eval/judgePairwise.js +3 -2
  107. package/dist/lib/agents/eval/rubricJudge.agency +33 -0
  108. package/dist/lib/agents/eval/rubricJudge.js +371 -0
  109. package/dist/lib/agents/optimize/gepaReflect.agency +9 -3
  110. package/dist/lib/agents/optimize/gepaReflect.js +16 -8
  111. package/dist/lib/agents/optimize/mutatePrompt.agency +1 -1
  112. package/dist/lib/agents/optimize/mutatePrompt.js +4 -3
  113. package/dist/lib/agents/policy/agent.js +3 -2
  114. package/dist/lib/agents/review/agent.js +3 -2
  115. package/dist/lib/backends/agencyGenerator.js +18 -20
  116. package/dist/lib/backends/typescriptBuilder/sectionAssembler.d.ts +2 -0
  117. package/dist/lib/backends/typescriptBuilder/sectionAssembler.js +3 -0
  118. package/dist/lib/backends/typescriptBuilder.d.ts +18 -1
  119. package/dist/lib/backends/typescriptBuilder.js +96 -36
  120. package/dist/lib/cli/commandLine.d.ts +1 -1
  121. package/dist/lib/cli/commands.d.ts +7 -0
  122. package/dist/lib/cli/commands.js +15 -1
  123. package/dist/lib/cli/coverage.js +1 -1
  124. package/dist/lib/cli/doc.d.ts +7 -5
  125. package/dist/lib/cli/doc.js +64 -32
  126. package/dist/lib/cli/docLedger.d.ts +7 -2
  127. package/dist/lib/cli/docLedger.js +6 -2
  128. package/dist/lib/cli/eval/formatGrade.d.ts +2 -0
  129. package/dist/lib/cli/eval/formatGrade.js +12 -2
  130. package/dist/lib/cli/eval/grade.d.ts +28 -8
  131. package/dist/lib/cli/eval/grade.js +52 -29
  132. package/dist/lib/cli/eval/optimize.d.ts +4 -1
  133. package/dist/lib/cli/eval/optimize.js +9 -5
  134. package/dist/lib/cli/eval/run.d.ts +0 -5
  135. package/dist/lib/cli/eval/run.js +0 -27
  136. package/dist/lib/cli/eval/upload.js +6 -2
  137. package/dist/lib/cli/precompile.js +8 -1
  138. package/dist/lib/cli/remote/commands/call.d.ts +2 -0
  139. package/dist/lib/cli/remote/commands/call.js +3 -8
  140. package/dist/lib/cli/remote/commands/deploy.js +1 -15
  141. package/dist/lib/cli/remote/commands/logsMode.js +1 -1
  142. package/dist/lib/cli/remote/commands/ls.d.ts +4 -3
  143. package/dist/lib/cli/remote/commands/ls.js +8 -30
  144. package/dist/lib/cli/remote/commands/open.d.ts +5 -1
  145. package/dist/lib/cli/remote/commands/open.js +5 -8
  146. package/dist/lib/cli/remote/commands/util.d.ts +30 -12
  147. package/dist/lib/cli/remote/commands/util.js +60 -39
  148. package/dist/lib/cli/remote/render.d.ts +2 -3
  149. package/dist/lib/cli/remote/render.js +4 -11
  150. package/dist/lib/cli/schedule/backends/pinnedActions.js +3 -3
  151. package/dist/lib/cli/schedule/remote.js +2 -2
  152. package/dist/lib/cli/statelog/serveUrl.d.ts +13 -2
  153. package/dist/lib/cli/statelog/serveUrl.js +7 -1
  154. package/dist/lib/cli/statelog/statelogRequest.d.ts +5 -2
  155. package/dist/lib/cli/statelog/statelogRequest.js +22 -5
  156. package/dist/lib/cli/test.js +17 -6
  157. package/dist/lib/cli/util.d.ts +2 -0
  158. package/dist/lib/cli/util.js +10 -2
  159. package/dist/lib/compiler/compileSandboxed.d.ts +3 -0
  160. package/dist/lib/compiler/compileSandboxed.js +6 -2
  161. package/dist/lib/compiler/compileValidatedClosure.d.ts +8 -1
  162. package/dist/lib/compiler/compileValidatedClosure.js +17 -2
  163. package/dist/lib/compiler/depFingerprint.js +1 -1
  164. package/dist/lib/compiler/splice/calleeName.d.ts +3 -0
  165. package/dist/lib/compiler/splice/calleeName.js +7 -0
  166. package/dist/lib/compiler/splice/runGenerator.js +5 -5
  167. package/dist/lib/compiler/typecheck.d.ts +18 -3
  168. package/dist/lib/compiler/typecheck.js +43 -12
  169. package/dist/lib/config.d.ts +62 -14
  170. package/dist/lib/config.js +26 -4
  171. package/dist/lib/eval/batchStatistics.d.ts +14 -0
  172. package/dist/lib/eval/batchStatistics.js +21 -1
  173. package/dist/lib/eval/grading/agencyRunner.d.ts +10 -2
  174. package/dist/lib/eval/grading/agencyRunner.js +19 -5
  175. package/dist/lib/eval/grading/agencyTestGrader.d.ts +2 -0
  176. package/dist/lib/eval/grading/agencyTestGrader.js +4 -3
  177. package/dist/lib/eval/grading/baseGrader.d.ts +0 -2
  178. package/dist/lib/eval/grading/baseGrader.js +0 -11
  179. package/dist/lib/eval/grading/functionGrader.d.ts +38 -17
  180. package/dist/lib/eval/grading/functionGrader.js +16 -6
  181. package/dist/lib/eval/grading/gradeRun.d.ts +22 -9
  182. package/dist/lib/eval/grading/gradeRun.js +106 -34
  183. package/dist/lib/eval/grading/gradeSuite.d.ts +4 -2
  184. package/dist/lib/eval/grading/gradeSuite.js +5 -4
  185. package/dist/lib/eval/grading/graderFilesSnapshot.d.ts +10 -0
  186. package/dist/lib/eval/grading/graderFilesSnapshot.js +44 -0
  187. package/dist/lib/eval/grading/harnessSnapshot.d.ts +1 -1
  188. package/dist/lib/eval/grading/harnessSnapshot.js +2 -1
  189. package/dist/lib/eval/grading/rubricJudgeFile.d.ts +10 -0
  190. package/dist/lib/eval/grading/rubricJudgeFile.js +14 -0
  191. package/dist/lib/eval/grading/types.d.ts +5 -10
  192. package/dist/lib/eval/grading/workdirFile.d.ts +3 -0
  193. package/dist/lib/eval/grading/workdirFile.js +18 -0
  194. package/dist/lib/eval/loadInputs.js +23 -0
  195. package/dist/lib/eval/public.d.ts +3 -0
  196. package/dist/lib/eval/public.js +2 -0
  197. package/dist/lib/eval/run/batchBudget.d.ts +19 -0
  198. package/dist/lib/eval/run/batchBudget.js +37 -0
  199. package/dist/lib/eval/run/childSupervisor.d.ts +31 -0
  200. package/dist/lib/eval/run/childSupervisor.js +46 -0
  201. package/dist/lib/eval/run/runSuite.d.ts +1 -1
  202. package/dist/lib/eval/run/runSuite.js +72 -40
  203. package/dist/lib/eval/run/spawnRunner.js +2 -36
  204. package/dist/lib/eval/run/subprocess.js +5 -9
  205. package/dist/lib/eval/runDirectoryFixture.d.ts +4 -0
  206. package/dist/lib/eval/runDirectoryFixture.js +2 -1
  207. package/dist/lib/eval/runTypes.d.ts +20 -4
  208. package/dist/lib/ir/tsIR.d.ts +1 -1
  209. package/dist/lib/linter/registry.d.ts +1 -1
  210. package/dist/lib/linter/registry.js +1 -1
  211. package/dist/lib/lowering/comprehensionDesugar.js +1 -1
  212. package/dist/lib/lowering/patternLowering.js +24 -1
  213. package/dist/lib/optimize/baseOptimizer.d.ts +23 -10
  214. package/dist/lib/optimize/baseOptimizer.js +111 -29
  215. package/dist/lib/optimize/constraint.js +1 -1
  216. package/dist/lib/optimize/gepaReflect.d.ts +2 -1
  217. package/dist/lib/optimize/gepaReflect.js +3 -3
  218. package/dist/lib/optimize/mutator.d.ts +15 -2
  219. package/dist/lib/optimize/mutator.js +27 -8
  220. package/dist/lib/optimize/optimizer.d.ts +15 -2
  221. package/dist/lib/optimize/optimizers/gepa.d.ts +1 -1
  222. package/dist/lib/optimize/optimizers/gepa.js +10 -4
  223. package/dist/lib/optimize/optimizers/greedyReflective.js +6 -1
  224. package/dist/lib/optimize/reflectionFeedback.js +9 -3
  225. package/dist/lib/optimize/report.d.ts +3 -1
  226. package/dist/lib/optimize/report.js +11 -1
  227. package/dist/lib/optimize/reporter.js +3 -0
  228. package/dist/lib/optimize/sourceMutator.d.ts +6 -0
  229. package/dist/lib/optimize/sourceMutator.js +50 -38
  230. package/dist/lib/optimize/targets.d.ts +22 -7
  231. package/dist/lib/optimize/targets.js +33 -13
  232. package/dist/lib/optimize/testUtils.d.ts +1 -1
  233. package/dist/lib/optimize/testUtils.js +2 -2
  234. package/dist/lib/optimize/types.d.ts +19 -0
  235. package/dist/lib/optimize/validation.d.ts +23 -7
  236. package/dist/lib/optimize/validation.js +60 -43
  237. package/dist/lib/parsers/parsers.js +48 -17
  238. package/dist/lib/preprocessors/expandSplices.js +22 -7
  239. package/dist/lib/preprocessors/hoistCalls.js +6 -1
  240. package/dist/lib/preprocessors/parallelDesugar.js +1 -1
  241. package/dist/lib/preprocessors/typescriptPreprocessor.d.ts +9 -1
  242. package/dist/lib/preprocessors/typescriptPreprocessor.js +26 -2
  243. package/dist/lib/runDirectory/annotations.d.ts +9 -3
  244. package/dist/lib/runDirectory/annotations.js +5 -0
  245. package/dist/lib/runDirectory/mutations.js +6 -3
  246. package/dist/lib/runsExplorer/csv.js +3 -0
  247. package/dist/lib/runsExplorer/rows.d.ts +25 -0
  248. package/dist/lib/runsExplorer/rows.js +38 -0
  249. package/dist/lib/runsExplorer/run.js +15 -1
  250. package/dist/lib/runsExplorer/views/explorerView.d.ts +14 -1
  251. package/dist/lib/runsExplorer/views/gradersTableView.d.ts +30 -0
  252. package/dist/lib/runsExplorer/views/gradersTableView.js +189 -0
  253. package/dist/lib/runsExplorer/views/rowFormat.d.ts +3 -0
  254. package/dist/lib/runsExplorer/views/rowFormat.js +9 -0
  255. package/dist/lib/runsExplorer/views/runsTableView.d.ts +4 -1
  256. package/dist/lib/runsExplorer/views/runsTableView.js +34 -9
  257. package/dist/lib/runsExplorer/views/testsTableView.js +8 -2
  258. package/dist/lib/runsExplorer/views/verdictScreen.d.ts +33 -0
  259. package/dist/lib/runsExplorer/views/verdictScreen.js +150 -0
  260. package/dist/lib/runtime/abortBoundary.d.ts +34 -0
  261. package/dist/lib/runtime/abortBoundary.js +42 -0
  262. package/dist/lib/runtime/abortedResult.d.ts +5 -0
  263. package/dist/lib/runtime/abortedResult.js +18 -5
  264. package/dist/lib/runtime/alwaysScope.d.ts +29 -0
  265. package/dist/lib/runtime/alwaysScope.js +70 -0
  266. package/dist/lib/runtime/asyncContext.d.ts +1 -1
  267. package/dist/lib/runtime/asyncContext.js +1 -1
  268. package/dist/lib/runtime/builtinPolicies.js +5 -9
  269. package/dist/lib/runtime/callbackForwarding.d.ts +1 -1
  270. package/dist/lib/runtime/callbackForwarding.js +1 -1
  271. package/dist/lib/runtime/checkpoint.d.ts +2 -2
  272. package/dist/lib/runtime/checkpoint.js +6 -1
  273. package/dist/lib/runtime/eq.d.ts +1 -1
  274. package/dist/lib/runtime/eq.js +1 -1
  275. package/dist/lib/runtime/errors.d.ts +5 -0
  276. package/dist/lib/runtime/errors.js +19 -5
  277. package/dist/lib/runtime/index.d.ts +3 -1
  278. package/dist/lib/runtime/index.js +2 -0
  279. package/dist/lib/runtime/interrupts.js +10 -6
  280. package/dist/lib/runtime/invocationOptions.d.ts +13 -0
  281. package/dist/lib/runtime/invocationOptions.js +19 -2
  282. package/dist/lib/runtime/ipc.d.ts +9 -9
  283. package/dist/lib/runtime/ipc.js +11 -4
  284. package/dist/lib/runtime/llmRetry.d.ts +1 -1
  285. package/dist/lib/runtime/llmRetry.js +17 -2
  286. package/dist/lib/runtime/memory/manager.js +2 -1
  287. package/dist/lib/runtime/memory/registry.d.ts +1 -1
  288. package/dist/lib/runtime/memory/registry.js +1 -1
  289. package/dist/lib/runtime/memory/types.d.ts +1 -1
  290. package/dist/lib/runtime/nn.d.ts +1 -1
  291. package/dist/lib/runtime/nn.js +1 -1
  292. package/dist/lib/runtime/node.js +10 -3
  293. package/dist/lib/runtime/policy.d.ts +4 -0
  294. package/dist/lib/runtime/policy.js +6 -0
  295. package/dist/lib/runtime/prompt.d.ts +4 -3
  296. package/dist/lib/runtime/prompt.js +12 -5
  297. package/dist/lib/runtime/replyAttachments.d.ts +1 -1
  298. package/dist/lib/runtime/rewind.js +2 -0
  299. package/dist/lib/runtime/runPolicyHandler.d.ts +1 -1
  300. package/dist/lib/runtime/runPolicyHandler.js +14 -10
  301. package/dist/lib/runtime/simpleOpenAIClient.js +2 -1
  302. package/dist/lib/runtime/state/schemas.d.ts +170 -0
  303. package/dist/lib/runtime/state/schemas.js +42 -0
  304. package/dist/lib/runtime/toolLoopGuards.js +1 -1
  305. package/dist/lib/statelogClient.d.ts +3 -2
  306. package/dist/lib/statelogClient.js +3 -2
  307. package/dist/lib/stdlib/agency.d.ts +7 -1
  308. package/dist/lib/stdlib/agency.js +77 -13
  309. package/dist/lib/stdlib/agentSessions.d.ts +47 -0
  310. package/dist/lib/stdlib/agentSessions.js +148 -0
  311. package/dist/lib/stdlib/cli.d.ts +4 -0
  312. package/dist/lib/stdlib/cli.js +14 -2
  313. package/dist/lib/stdlib/llm.d.ts +16 -18
  314. package/dist/lib/stdlib/llm.js +46 -35
  315. package/dist/lib/stdlib/policy.d.ts +2 -1
  316. package/dist/lib/stdlib/policy.js +2 -1
  317. package/dist/lib/stdlib/skills.d.ts +2 -0
  318. package/dist/lib/stdlib/skills.js +5 -1
  319. package/dist/lib/stdlib/system.d.ts +5 -0
  320. package/dist/lib/stdlib/system.js +8 -0
  321. package/dist/lib/stdlib/threads.d.ts +3 -0
  322. package/dist/lib/stdlib/threads.js +10 -0
  323. package/dist/lib/symbolTable.js +2 -5
  324. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  325. package/dist/lib/templates/backends/typescriptGenerator/imports.js +1 -1
  326. package/dist/lib/templates/cli/optimizeReport.d.ts +1 -1
  327. package/dist/lib/templates/cli/optimizeReport.js +2 -2
  328. package/dist/lib/tui/table.js +1 -1
  329. package/dist/lib/typeChecker/assignability.js +1 -1
  330. package/dist/lib/typeChecker/diagnosticExplanations.js +39 -0
  331. package/dist/lib/typeChecker/diagnostics.d.ts +35 -0
  332. package/dist/lib/typeChecker/diagnostics.js +35 -0
  333. package/dist/lib/typeChecker/effectPayloadCheck.js +68 -6
  334. package/dist/lib/typeChecker/index.js +6 -1
  335. package/dist/lib/typeChecker/nameReferences.d.ts +3 -2
  336. package/dist/lib/typeChecker/nameReferences.js +6 -1
  337. package/dist/lib/typeChecker/narrowing.js +1 -1
  338. package/dist/lib/typeChecker/pathSegments.js +1 -1
  339. package/dist/lib/typeChecker/resolveCall.d.ts +29 -4
  340. package/dist/lib/typeChecker/resolveCall.js +81 -9
  341. package/dist/lib/typeChecker/resolveVariable.d.ts +4 -0
  342. package/dist/lib/typeChecker/resolveVariable.js +1 -1
  343. package/dist/lib/typeChecker/sandboxNameCheck.d.ts +18 -0
  344. package/dist/lib/typeChecker/sandboxNameCheck.js +234 -0
  345. package/dist/lib/typeChecker/synthesizer.js +2 -0
  346. package/dist/lib/typeChecker/undefinedFunctionDiagnostic.js +23 -13
  347. package/dist/lib/typeChecker/undefinedVariableDiagnostic.js +17 -6
  348. package/dist/lib/types/binop.d.ts +3 -1
  349. package/dist/lib/types/binop.js +3 -0
  350. package/dist/lib/types/codeLiteral.d.ts +1 -1
  351. package/dist/lib/types/effectDeclaration.d.ts +2 -0
  352. package/dist/lib/types/typeHints.d.ts +1 -1
  353. package/dist/lib/utils/alwaysTag.d.ts +21 -0
  354. package/dist/lib/utils/alwaysTag.js +53 -0
  355. package/dist/lib/utils/bodySlots.js +1 -1
  356. package/dist/lib/utils/hiddenTag.d.ts +5 -0
  357. package/dist/lib/utils/hiddenTag.js +6 -0
  358. package/dist/lib/utils/identifierSlots.d.ts +2 -2
  359. package/dist/lib/utils/parallelMap.d.ts +6 -0
  360. package/dist/lib/utils/parallelMap.js +20 -0
  361. package/dist/lib/utils/tagsAbove.d.ts +22 -0
  362. package/dist/lib/utils/tagsAbove.js +36 -0
  363. package/dist/scripts/agency.js +52 -35
  364. package/package.json +2 -2
  365. package/stdlib/agency/eval.js +3 -2
  366. package/stdlib/agency/local.js +3 -2
  367. package/stdlib/agency.agency +14 -9
  368. package/stdlib/agency.js +27 -9
  369. package/stdlib/agent.js +3 -2
  370. package/stdlib/agents/agency/coding.agency +168 -10
  371. package/stdlib/agents/agency/coding.js +497 -26
  372. package/stdlib/agents/agency/expert.js +3 -2
  373. package/stdlib/agents/agency/researcher.js +3 -2
  374. package/stdlib/agents/agency/review.agency +154 -6
  375. package/stdlib/agents/agency/review.js +406 -17
  376. package/stdlib/agents/agency/verifier.js +3 -2
  377. package/stdlib/agents/coding.agency +1 -1
  378. package/stdlib/agents/coding.js +4 -3
  379. package/stdlib/agents/composable/promptRewriter.js +3 -2
  380. package/stdlib/agents/composable/researcher.js +3 -2
  381. package/stdlib/agents/composable/utils.js +3 -2
  382. package/stdlib/agents/data.agency +1 -1
  383. package/stdlib/agents/data.js +4 -3
  384. package/stdlib/agents/expert.agency +1 -1
  385. package/stdlib/agents/expert.js +4 -3
  386. package/stdlib/agents/explorer.agency +1 -1
  387. package/stdlib/agents/explorer.js +4 -3
  388. package/stdlib/agents/lib/expertGuidance.js +3 -2
  389. package/stdlib/agents/lib/feedback.js +3 -2
  390. package/stdlib/agents/lib/search.agency +11 -7
  391. package/stdlib/agents/lib/search.js +58 -37
  392. package/stdlib/agents/lib/shared.agency +24 -2
  393. package/stdlib/agents/lib/shared.js +238 -14
  394. package/stdlib/agents/lib/toolkits.js +3 -2
  395. package/stdlib/agents/oracle.agency +1 -1
  396. package/stdlib/agents/oracle.js +4 -3
  397. package/stdlib/agents/planner.js +3 -2
  398. package/stdlib/agents/researcher.agency +89 -10
  399. package/stdlib/agents/researcher.js +601 -13
  400. package/stdlib/agents/review.agency +1 -1
  401. package/stdlib/agents/review.js +4 -3
  402. package/stdlib/agents/typescript/review.agency +234 -0
  403. package/stdlib/agents/typescript/review.js +1444 -0
  404. package/stdlib/agents/verifier.js +3 -2
  405. package/stdlib/agents/writing/review.agency +554 -0
  406. package/stdlib/agents/writing/review.js +3267 -0
  407. package/stdlib/agents/writing/rewrite.agency +177 -0
  408. package/stdlib/agents/writing/rewrite.js +1238 -0
  409. package/stdlib/args.js +3 -2
  410. package/stdlib/array.js +3 -2
  411. package/stdlib/auth/keyring.agency +3 -0
  412. package/stdlib/auth/keyring.js +8 -3
  413. package/stdlib/auth/oauth.agency +7 -2
  414. package/stdlib/auth/oauth.js +8 -3
  415. package/stdlib/aws/s3.js +3 -2
  416. package/stdlib/calendar.agency +6 -1
  417. package/stdlib/calendar.js +8 -3
  418. package/stdlib/capabilities.js +3 -2
  419. package/stdlib/clipboard.js +3 -2
  420. package/stdlib/concurrency.js +3 -2
  421. package/stdlib/data/connector.agency +1 -1
  422. package/stdlib/data/connector.js +3 -2
  423. package/stdlib/data/finance/dbnomics.js +3 -2
  424. package/stdlib/data/finance/edgar.agency +2 -1
  425. package/stdlib/data/finance/edgar.js +14 -7
  426. package/stdlib/data/finance/fred.agency +9 -4
  427. package/stdlib/data/finance/fred.js +36 -31
  428. package/stdlib/data/news/gdelt.js +3 -2
  429. package/stdlib/data/people/littlesis.js +3 -2
  430. package/stdlib/data/social/bluesky.js +3 -2
  431. package/stdlib/data/tech/hackernews.js +3 -2
  432. package/stdlib/data/tech/yc.js +3 -2
  433. package/stdlib/data/usaspending.js +3 -2
  434. package/stdlib/data/wikidata.agency +2 -1
  435. package/stdlib/data/wikidata.js +14 -7
  436. package/stdlib/date.js +3 -2
  437. package/stdlib/docs/cli/doc.md +38 -1
  438. package/stdlib/docs/cli/eval.md +40 -29
  439. package/stdlib/docs/cli/optimize.md +7 -3
  440. package/stdlib/docs/diagnostics/effects.md +66 -0
  441. package/stdlib/docs/diagnostics/index.md +7 -0
  442. package/stdlib/docs/diagnostics/names.md +8 -0
  443. package/stdlib/docs/diagnostics/templates.md +14 -0
  444. package/stdlib/docs/guide/agency-config-file.md +1 -1
  445. package/stdlib/docs/guide/graders.md +8 -9
  446. package/stdlib/docs/guide/handlers.md +19 -3
  447. package/stdlib/docs/guide/memory.md +1 -1
  448. package/stdlib/docs/stdlib/agency.md +67 -58
  449. package/stdlib/docs/stdlib/agent.md +1 -3
  450. package/stdlib/docs/stdlib/agents/agency/coding.md +7 -3
  451. package/stdlib/docs/stdlib/agents/agency/review.md +6 -3
  452. package/stdlib/docs/stdlib/agents/lib/search.md +15 -9
  453. package/stdlib/docs/stdlib/agents/lib/shared.md +30 -5
  454. package/stdlib/docs/stdlib/agents/planner.md +2 -4
  455. package/stdlib/docs/stdlib/agents/researcher.md +26 -2
  456. package/stdlib/docs/stdlib/agents/typescript/review.md +108 -0
  457. package/stdlib/docs/stdlib/agents/writing/review.md +115 -0
  458. package/stdlib/docs/stdlib/agents/writing/rewrite.md +82 -0
  459. package/stdlib/docs/stdlib/auth/keyring.md +10 -7
  460. package/stdlib/docs/stdlib/auth/oauth.md +14 -9
  461. package/stdlib/docs/stdlib/calendar.md +17 -14
  462. package/stdlib/docs/stdlib/data/connector.md +1 -1
  463. package/stdlib/docs/stdlib/data/finance/edgar.md +2 -2
  464. package/stdlib/docs/stdlib/data/finance/fred.md +6 -6
  465. package/stdlib/docs/stdlib/data/wikidata.md +5 -5
  466. package/stdlib/docs/stdlib/fs.md +17 -14
  467. package/stdlib/docs/stdlib/git.md +55 -38
  468. package/stdlib/docs/stdlib/http.md +10 -7
  469. package/stdlib/docs/stdlib/index.md +61 -33
  470. package/stdlib/docs/stdlib/llm.md +2 -0
  471. package/stdlib/docs/stdlib/mcp.md +7 -6
  472. package/stdlib/docs/stdlib/messaging/email.md +5 -6
  473. package/stdlib/docs/stdlib/messaging/imessage.md +3 -4
  474. package/stdlib/docs/stdlib/messaging/sms.md +3 -4
  475. package/stdlib/docs/stdlib/notes/apple.md +19 -13
  476. package/stdlib/docs/stdlib/policy.md +100 -59
  477. package/stdlib/docs/stdlib/shell.md +19 -14
  478. package/stdlib/docs/stdlib/skills.md +22 -9
  479. package/stdlib/docs/stdlib/system.md +38 -19
  480. package/stdlib/docs/stdlib/thread.md +41 -22
  481. package/stdlib/docs/stdlib/toolbox.md +271 -0
  482. package/stdlib/docs/stdlib/ui/cli.md +26 -6
  483. package/stdlib/docs/stdlib/weather.md +0 -2
  484. package/stdlib/docs/stdlib/web/browser.md +0 -2
  485. package/stdlib/docs/stdlib/web/search.md +0 -2
  486. package/stdlib/docs/stdlib/wikipedia.md +2 -4
  487. package/stdlib/fs.agency +5 -0
  488. package/stdlib/fs.js +10 -3
  489. package/stdlib/git.agency +17 -0
  490. package/stdlib/git.js +22 -3
  491. package/stdlib/http.agency +3 -0
  492. package/stdlib/http.js +8 -3
  493. package/stdlib/image.js +3 -2
  494. package/stdlib/index.agency +16 -0
  495. package/stdlib/index.js +10 -3
  496. package/stdlib/llm.agency +1 -1
  497. package/stdlib/llm.js +19 -16
  498. package/stdlib/markdown.js +3 -2
  499. package/stdlib/math.js +3 -2
  500. package/stdlib/mcp.agency +1 -0
  501. package/stdlib/mcp.js +6 -3
  502. package/stdlib/memory.js +3 -2
  503. package/stdlib/messaging/email.agency +1 -0
  504. package/stdlib/messaging/email.js +6 -3
  505. package/stdlib/messaging/imessage.agency +1 -0
  506. package/stdlib/messaging/imessage.js +6 -3
  507. package/stdlib/messaging/sms.agency +1 -0
  508. package/stdlib/messaging/sms.js +6 -3
  509. package/stdlib/notes/apple.agency +6 -0
  510. package/stdlib/notes/apple.js +11 -3
  511. package/stdlib/object.js +3 -2
  512. package/stdlib/path.js +3 -2
  513. package/stdlib/policy.agency +105 -60
  514. package/stdlib/policy.js +688 -80
  515. package/stdlib/safeBash/actions.js +3 -2
  516. package/stdlib/safeBash.js +3 -2
  517. package/stdlib/shell.agency +5 -0
  518. package/stdlib/shell.js +10 -3
  519. package/stdlib/skills.agency +11 -1
  520. package/stdlib/skills.js +115 -4
  521. package/stdlib/speech.js +3 -2
  522. package/stdlib/statelog.js +3 -2
  523. package/stdlib/strategy.js +3 -2
  524. package/stdlib/supervise.js +3 -2
  525. package/stdlib/syntax.js +3 -2
  526. package/stdlib/system.agency +38 -6
  527. package/stdlib/system.js +346 -15
  528. package/stdlib/tag.js +3 -2
  529. package/stdlib/thread.agency +9 -0
  530. package/stdlib/thread.js +126 -4
  531. package/stdlib/toolbox.agency +991 -0
  532. package/stdlib/toolbox.js +8322 -0
  533. package/stdlib/ui/chart.js +3 -2
  534. package/stdlib/ui/cli.agency +10 -1
  535. package/stdlib/ui/cli.js +133 -5
  536. package/stdlib/ui/layout.js +3 -2
  537. package/stdlib/ui/table.js +3 -2
  538. package/stdlib/ui.js +3 -2
  539. package/stdlib/validation.js +3 -2
  540. package/stdlib/weather.js +3 -2
  541. package/stdlib/web/browser.js +3 -2
  542. package/stdlib/web/search.js +3 -2
  543. package/stdlib/wikipedia.js +3 -2
  544. package/dist/lib/cli/eval/graders.d.ts +0 -17
  545. package/dist/lib/cli/eval/graders.js +0 -40
  546. package/dist/lib/cli/remote/binding.d.ts +0 -10
  547. package/dist/lib/cli/remote/binding.js +0 -48
  548. package/dist/lib/cli/remote/commands/link.d.ts +0 -4
  549. package/dist/lib/cli/remote/commands/link.js +0 -22
@@ -4,6 +4,7 @@ import { setLlmOptions } from "std::llm"
4
4
  import { evalOutput, evalValue, setAgentName } from "std::statelog"
5
5
  import { cwd, env, isTTY, readStdin, setTitle } from "std::system"
6
6
  import { getCost } from "std::thread"
7
+ import { setSlashPalette } from "std::ui/cli"
7
8
  import {
8
9
  clearMessages,
9
10
  pushMessage,
@@ -13,11 +14,13 @@ import {
13
14
 
14
15
  import { brainByName, allBrains, brainFlagHelp } from "./brains/registry.agency"
15
16
  import { agentNameFor } from "./lib/agentName.agency"
17
+ import { mergedPalette } from "./lib/commandPalette.agency"
16
18
  import { parseAgentArgs } from "./lib/args.agency"
17
19
  import { getHeader } from "./lib/header.agency"
18
20
  import { maybeLoadMcp } from "./lib/mcp.agency"
19
21
  import { printPolicyHelp } from "./lib/policy.agency"
20
- import { startInteractive } from "./lib/repl.agency"
22
+ import { chooseSession, startSession } from "./lib/resume.agency"
23
+ import { installSessionHooks, startInteractive } from "./lib/repl.agency"
21
24
  import { pickModelsForAgent, maybeEnableMemory } from "./lib/session.agency"
22
25
  import { loadSettings } from "./lib/settings.agency"
23
26
  import { setDebug, setVerbose, setInteractive } from "./lib/trace.agency"
@@ -102,6 +105,19 @@ node main() {
102
105
  return
103
106
  }
104
107
  setBrain(brain)
108
+
109
+ // Positional args (everything after flags) are joined with spaces to
110
+ // form the starting prompt. `--` ends flag parsing if a positional
111
+ // would otherwise look like a flag.
112
+ const positionalQuery = args.positionals.join(" ")
113
+ const hasQuery = positionalQuery != ""
114
+ const wantInteractive = args.flags.interactive
115
+
116
+ // Seeded interactive: run the prompt as the first turn, then hand over the
117
+ // REPL (needs a TTY + query, and not --print). Everything else is one-shot.
118
+ const seededInteractive = wantInteractive && hasQuery && isTTY() && !args.flags.print
119
+ const isOneShot = !seededInteractive && (args.flags.print || hasQuery || !isTTY())
120
+
105
121
  // Group this trace under its brain wherever runs are compared.
106
122
  setAgentName(agentNameFor(brain))
107
123
 
@@ -128,19 +144,6 @@ node main() {
128
144
  // coordinator. Must run before the first turn (mcpTools ordering contract).
129
145
  maybeLoadMcp(loadSettings())
130
146
 
131
- // Positional args (everything after flags) are joined with spaces to
132
- // form the starting prompt. `--` ends flag parsing if a positional
133
- // would otherwise look like a flag.
134
- const positionalQuery = args.positionals.join(" ")
135
- const hasQuery = positionalQuery != ""
136
-
137
- const wantInteractive = args.flags.interactive
138
-
139
- // Seeded interactive: run the prompt as the first turn, then hand over the
140
- // REPL (needs a TTY + query, and not --print). Everything else is one-shot.
141
- const seededInteractive = wantInteractive && hasQuery && isTTY() && !args.flags.print
142
- const isOneShot = !seededInteractive && (args.flags.print || hasQuery || !isTTY())
143
-
144
147
  const maxRounds = resolveMaxToolCallRounds(
145
148
  args.flags["max-tool-call-rounds"] ?? null,
146
149
  isOneShot,
@@ -166,6 +169,24 @@ node main() {
166
169
 
167
170
  setAgentCwd(cwd())
168
171
 
172
+ // Interactive runs are saved per turn, and a resumed one restores its
173
+ // checkpoint here, after the setup above and before the session starts.
174
+ // One-shot runs are not saved, so a resume flag on one is a mistake
175
+ // rather than something to ignore.
176
+ if (isOneShot && (args.flags.continue || args.flags.resume != null)) {
177
+ print(color.red("--continue and --resume need an interactive session; one-shot runs are not saved."))
178
+ process.exit(1)
179
+ }
180
+ // Everything above is process-level: model resolution feeds the memory
181
+ // layer, and memory, MCP, and the settings reads behind them must run
182
+ // before the policy handler exists or they prompt. A restore keeps
183
+ // those TypeScript-side effects and replaces only the Agency state.
184
+ if (!isOneShot) {
185
+ installSessionHooks()
186
+ setSlashPalette(mergedPalette())
187
+ startSession(chooseSession(args.flags.continue, args.flags.resume ?? null), brain)
188
+ }
189
+
169
190
  if (isOneShot) {
170
191
  let prompt = positionalQuery
171
192
  if (!hasQuery) {
@@ -5,14 +5,17 @@ import { setLlmOptions } from "agency-lang/stdlib/llm.js";
5
5
  import { evalOutput, evalValue, setAgentName } from "agency-lang/stdlib/statelog.js";
6
6
  import { cwd, env, isTTY, readStdin, setTitle } from "agency-lang/stdlib/system.js";
7
7
  import { getCost } from "agency-lang/stdlib/thread.js";
8
+ import { setSlashPalette } from "agency-lang/stdlib/ui/cli.js";
8
9
  import { clearMessages, pushMessage, repl, clearScreen } from "agency-lang/stdlib/ui/cli.js";
9
10
  import { brainByName, allBrains, brainFlagHelp } from "./brains/registry.js";
10
11
  import { agentNameFor } from "./lib/agentName.js";
12
+ import { mergedPalette } from "./lib/commandPalette.js";
11
13
  import { parseAgentArgs } from "./lib/args.js";
12
14
  import { getHeader } from "./lib/header.js";
13
15
  import { maybeLoadMcp } from "./lib/mcp.js";
14
16
  import { printPolicyHelp } from "./lib/policy.js";
15
- import { startInteractive } from "./lib/repl.js";
17
+ import { chooseSession, startSession } from "./lib/resume.js";
18
+ import { installSessionHooks, startInteractive } from "./lib/repl.js";
16
19
  import { pickModelsForAgent, maybeEnableMemory } from "./lib/session.js";
17
20
  import { loadSettings } from "./lib/settings.js";
18
21
  import { setDebug, setVerbose, setInteractive } from "./lib/trace.js";
@@ -102,14 +105,15 @@ const __globalCtx = new RuntimeContext({
102
105
  liteLlm: __process.env["LITELLM_BASE_URL"] || "",
103
106
  openAiCompat: __process.env["OPENAI_COMPAT_BASE_URL"] || ""
104
107
  },
105
- model: "gpt-4o-mini",
108
+ model: "gpt-5-mini",
106
109
  logLevel: "warn",
107
110
  statelog: {
108
111
  host: "https://statelog.adit.io",
109
112
  projectId: "smoltalk",
110
113
  apiKey: __process.env["STATELOG_SMOLTALK_API_KEY"] || "",
111
114
  traceId: nanoid()
112
- }
115
+ },
116
+ provider: "openai-responses"
113
117
  },
114
118
  dirname: __dirname,
115
119
  logLevel: "info",
@@ -217,6 +221,7 @@ __registerTool(isTTY);
217
221
  __registerTool(readStdin);
218
222
  __registerTool(setTitle);
219
223
  __registerTool(getCost);
224
+ __registerTool(setSlashPalette);
220
225
  __registerTool(clearMessages);
221
226
  __registerTool(pushMessage);
222
227
  __registerTool(repl);
@@ -225,10 +230,14 @@ __registerTool(brainByName);
225
230
  __registerTool(allBrains);
226
231
  __registerTool(brainFlagHelp);
227
232
  __registerTool(agentNameFor);
233
+ __registerTool(mergedPalette);
228
234
  __registerTool(parseAgentArgs);
229
235
  __registerTool(getHeader);
230
236
  __registerTool(maybeLoadMcp);
231
237
  __registerTool(printPolicyHelp);
238
+ __registerTool(chooseSession);
239
+ __registerTool(startSession);
240
+ __registerTool(installSessionHooks);
232
241
  __registerTool(startInteractive);
233
242
  __registerTool(pickModelsForAgent);
234
243
  __registerTool(maybeEnableMemory);
@@ -881,6 +890,30 @@ graph.node("main", async (__state) => {
881
890
  }
882
891
  });
883
892
  await runner.step(14, async (runner2) => {
893
+ __stack.locals.positionalQuery = await __callMethod(__stack.locals.args.positionals, "join", {
894
+ type: "positional",
895
+ args: [` `]
896
+ });
897
+ });
898
+ await runner.step(15, async (runner2) => {
899
+ __stack.locals.hasQuery = !__eq(__stack.locals.positionalQuery, ``);
900
+ });
901
+ await runner.step(16, async (runner2) => {
902
+ __stack.locals.wantInteractive = __stack.locals.args.flags.interactive;
903
+ });
904
+ await runner.step(17, async (runner2) => {
905
+ __stack.locals.seededInteractive = __stack.locals.wantInteractive && __stack.locals.hasQuery && await __call(isTTY, {
906
+ type: "positional",
907
+ args: []
908
+ }) && !__stack.locals.args.flags.print;
909
+ });
910
+ await runner.step(18, async (runner2) => {
911
+ __stack.locals.isOneShot = !__stack.locals.seededInteractive && (__stack.locals.args.flags.print || __stack.locals.hasQuery || !await __call(isTTY, {
912
+ type: "positional",
913
+ args: []
914
+ }));
915
+ });
916
+ await runner.step(19, async (runner2) => {
884
917
  __stack.locals.__hoist_5 = await __call(agentNameFor, {
885
918
  type: "positional",
886
919
  args: [__stack.locals.brain]
@@ -897,7 +930,7 @@ graph.node("main", async (__state) => {
897
930
  throw __stack.locals.__hoist_5.toError();
898
931
  }
899
932
  });
900
- await runner.step(15, async (runner2) => {
933
+ await runner.step(20, async (runner2) => {
901
934
  const __funcResult = await __call(setAgentName, {
902
935
  type: "positional",
903
936
  args: [__stack.locals.__hoist_5]
@@ -914,10 +947,10 @@ graph.node("main", async (__state) => {
914
947
  throw __funcResult.toError();
915
948
  }
916
949
  });
917
- await runner.step(16, async (runner2) => {
950
+ await runner.step(21, async (runner2) => {
918
951
  __stack.locals.requestedStartTarget = __stack.locals.args.flags.agent ?? ``;
919
952
  });
920
- await runner.step(17, async (runner2) => {
953
+ await runner.step(22, async (runner2) => {
921
954
  __stack.locals.resolvedStartTarget = await __call(resolveStartTarget, {
922
955
  type: "positional",
923
956
  args: [__stack.locals.brain, __stack.locals.requestedStartTarget]
@@ -934,10 +967,10 @@ graph.node("main", async (__state) => {
934
967
  throw __stack.locals.resolvedStartTarget.toError();
935
968
  }
936
969
  });
937
- await runner.step(18, async (runner2) => {
970
+ await runner.step(23, async (runner2) => {
938
971
  __stack.locals.startAgent = ``;
939
972
  });
940
- await runner.ifElse(19, [
973
+ await runner.ifElse(24, [
941
974
  {
942
975
  condition: async () => __eq(__stack.locals.resolvedStartTarget, null),
943
976
  body: async (runner2) => {
@@ -990,7 +1023,7 @@ graph.node("main", async (__state) => {
990
1023
  __stack.locals.startAgent = __stack.locals.resolvedStartTarget;
991
1024
  });
992
1025
  });
993
- await runner.step(20, async (runner2) => {
1026
+ await runner.step(25, async (runner2) => {
994
1027
  const __funcResult = await __call(pickModelsForAgent, {
995
1028
  type: "positional",
996
1029
  args: [__stack.locals.args]
@@ -1007,7 +1040,7 @@ graph.node("main", async (__state) => {
1007
1040
  throw __funcResult.toError();
1008
1041
  }
1009
1042
  });
1010
- await runner.step(21, async (runner2) => {
1043
+ await runner.step(26, async (runner2) => {
1011
1044
  const __funcResult = await __call(maybeEnableMemory, {
1012
1045
  type: "positional",
1013
1046
  args: []
@@ -1024,7 +1057,7 @@ graph.node("main", async (__state) => {
1024
1057
  throw __funcResult.toError();
1025
1058
  }
1026
1059
  });
1027
- await runner.step(22, async (runner2) => {
1060
+ await runner.step(27, async (runner2) => {
1028
1061
  __stack.locals.__hoist_7 = await __call(loadSettings, {
1029
1062
  type: "positional",
1030
1063
  args: []
@@ -1041,7 +1074,7 @@ graph.node("main", async (__state) => {
1041
1074
  throw __stack.locals.__hoist_7.toError();
1042
1075
  }
1043
1076
  });
1044
- await runner.step(23, async (runner2) => {
1077
+ await runner.step(28, async (runner2) => {
1045
1078
  const __funcResult = await __call(maybeLoadMcp, {
1046
1079
  type: "positional",
1047
1080
  args: [__stack.locals.__hoist_7]
@@ -1058,30 +1091,6 @@ graph.node("main", async (__state) => {
1058
1091
  throw __funcResult.toError();
1059
1092
  }
1060
1093
  });
1061
- await runner.step(24, async (runner2) => {
1062
- __stack.locals.positionalQuery = await __callMethod(__stack.locals.args.positionals, "join", {
1063
- type: "positional",
1064
- args: [` `]
1065
- });
1066
- });
1067
- await runner.step(25, async (runner2) => {
1068
- __stack.locals.hasQuery = !__eq(__stack.locals.positionalQuery, ``);
1069
- });
1070
- await runner.step(26, async (runner2) => {
1071
- __stack.locals.wantInteractive = __stack.locals.args.flags.interactive;
1072
- });
1073
- await runner.step(27, async (runner2) => {
1074
- __stack.locals.seededInteractive = __stack.locals.wantInteractive && __stack.locals.hasQuery && await __call(isTTY, {
1075
- type: "positional",
1076
- args: []
1077
- }) && !__stack.locals.args.flags.print;
1078
- });
1079
- await runner.step(28, async (runner2) => {
1080
- __stack.locals.isOneShot = !__stack.locals.seededInteractive && (__stack.locals.args.flags.print || __stack.locals.hasQuery || !await __call(isTTY, {
1081
- type: "positional",
1082
- args: []
1083
- }));
1084
- });
1085
1094
  await runner.step(29, async (runner2) => {
1086
1095
  __stack.locals.maxRounds = await __call(resolveMaxToolCallRounds, {
1087
1096
  type: "positional",
@@ -1235,6 +1244,136 @@ graph.node("main", async (__state) => {
1235
1244
  }
1236
1245
  });
1237
1246
  await runner.ifElse(38, [
1247
+ {
1248
+ condition: async () => __stack.locals.isOneShot && (__stack.locals.args.flags.continue || !__eq(__stack.locals.args.flags.resume, null)),
1249
+ body: async (runner2) => {
1250
+ await runner2.step(0, async (runner3) => {
1251
+ __stack.locals.__hoist_10 = await __callMethod(color, "red", {
1252
+ type: "positional",
1253
+ args: [`--continue and --resume need an interactive session; one-shot runs are not saved.`]
1254
+ });
1255
+ });
1256
+ await runner2.step(1, async (runner3) => {
1257
+ const __funcResult = await __call(print, {
1258
+ type: "positional",
1259
+ args: [__stack.locals.__hoist_10]
1260
+ });
1261
+ if (hasInterrupts(__funcResult)) {
1262
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1263
+ runner3.halt({
1264
+ ...__state,
1265
+ data: __funcResult
1266
+ });
1267
+ return;
1268
+ }
1269
+ if (isAborted(__funcResult)) {
1270
+ throw __funcResult.toError();
1271
+ }
1272
+ });
1273
+ await runner2.step(2, async (runner3) => {
1274
+ await __callMethod(process, "exit", {
1275
+ type: "positional",
1276
+ args: [1]
1277
+ });
1278
+ });
1279
+ }
1280
+ }
1281
+ ]);
1282
+ await runner.step(39, async (runner2) => {
1283
+ });
1284
+ await runner.ifElse(40, [
1285
+ {
1286
+ condition: async () => !__stack.locals.isOneShot,
1287
+ body: async (runner2) => {
1288
+ await runner2.step(0, async (runner3) => {
1289
+ const __funcResult = await __call(installSessionHooks, {
1290
+ type: "positional",
1291
+ args: []
1292
+ });
1293
+ if (hasInterrupts(__funcResult)) {
1294
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1295
+ runner3.halt({
1296
+ ...__state,
1297
+ data: __funcResult
1298
+ });
1299
+ return;
1300
+ }
1301
+ if (isAborted(__funcResult)) {
1302
+ throw __funcResult.toError();
1303
+ }
1304
+ });
1305
+ await runner2.step(1, async (runner3) => {
1306
+ __stack.locals.__hoist_11 = await __call(mergedPalette, {
1307
+ type: "positional",
1308
+ args: []
1309
+ });
1310
+ if (hasInterrupts(__stack.locals.__hoist_11)) {
1311
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1312
+ runner3.halt({
1313
+ ...__state,
1314
+ data: __stack.locals.__hoist_11
1315
+ });
1316
+ return;
1317
+ }
1318
+ if (isAborted(__stack.locals.__hoist_11)) {
1319
+ throw __stack.locals.__hoist_11.toError();
1320
+ }
1321
+ });
1322
+ await runner2.step(2, async (runner3) => {
1323
+ const __funcResult = await __call(setSlashPalette, {
1324
+ type: "positional",
1325
+ args: [__stack.locals.__hoist_11]
1326
+ });
1327
+ if (hasInterrupts(__funcResult)) {
1328
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1329
+ runner3.halt({
1330
+ ...__state,
1331
+ data: __funcResult
1332
+ });
1333
+ return;
1334
+ }
1335
+ if (isAborted(__funcResult)) {
1336
+ throw __funcResult.toError();
1337
+ }
1338
+ });
1339
+ await runner2.step(3, async (runner3) => {
1340
+ __stack.locals.__hoist_12 = await __call(chooseSession, {
1341
+ type: "positional",
1342
+ args: [__stack.locals.args.flags.continue, __stack.locals.args.flags.resume ?? null]
1343
+ });
1344
+ if (hasInterrupts(__stack.locals.__hoist_12)) {
1345
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1346
+ runner3.halt({
1347
+ ...__state,
1348
+ data: __stack.locals.__hoist_12
1349
+ });
1350
+ return;
1351
+ }
1352
+ if (isAborted(__stack.locals.__hoist_12)) {
1353
+ throw __stack.locals.__hoist_12.toError();
1354
+ }
1355
+ });
1356
+ await runner2.step(4, async (runner3) => {
1357
+ const __funcResult = await __call(startSession, {
1358
+ type: "positional",
1359
+ args: [__stack.locals.__hoist_12, __stack.locals.brain]
1360
+ });
1361
+ if (hasInterrupts(__funcResult)) {
1362
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1363
+ runner3.halt({
1364
+ ...__state,
1365
+ data: __funcResult
1366
+ });
1367
+ return;
1368
+ }
1369
+ if (isAborted(__funcResult)) {
1370
+ throw __funcResult.toError();
1371
+ }
1372
+ });
1373
+ }
1374
+ }
1375
+ ]);
1376
+ await runner.ifElse(41, [
1238
1377
  {
1239
1378
  condition: async () => __stack.locals.isOneShot,
1240
1379
  body: async (runner2) => {
@@ -1282,26 +1421,26 @@ graph.node("main", async (__state) => {
1282
1421
  }
1283
1422
  ]);
1284
1423
  await runner2.step(2, async (runner3) => {
1285
- __stack.locals.__hoist_10 = await __call(oneShotAgent, {
1424
+ __stack.locals.__hoist_13 = await __call(oneShotAgent, {
1286
1425
  type: "positional",
1287
1426
  args: [__stack.locals.startAgent, __stack.locals.prompt]
1288
1427
  });
1289
- if (hasInterrupts(__stack.locals.__hoist_10)) {
1428
+ if (hasInterrupts(__stack.locals.__hoist_13)) {
1290
1429
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1291
1430
  runner3.halt({
1292
1431
  ...__state,
1293
- data: __stack.locals.__hoist_10
1432
+ data: __stack.locals.__hoist_13
1294
1433
  });
1295
1434
  return;
1296
1435
  }
1297
- if (isAborted(__stack.locals.__hoist_10)) {
1298
- throw __stack.locals.__hoist_10.toError();
1436
+ if (isAborted(__stack.locals.__hoist_13)) {
1437
+ throw __stack.locals.__hoist_13.toError();
1299
1438
  }
1300
1439
  });
1301
1440
  await runner2.step(3, async (runner3) => {
1302
1441
  const __funcResult = await __call(print, {
1303
1442
  type: "positional",
1304
- args: [__stack.locals.__hoist_10]
1443
+ args: [__stack.locals.__hoist_13]
1305
1444
  });
1306
1445
  if (hasInterrupts(__funcResult)) {
1307
1446
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1316,33 +1455,33 @@ graph.node("main", async (__state) => {
1316
1455
  }
1317
1456
  });
1318
1457
  await runner2.step(4, async (runner3) => {
1319
- __stack.locals.__hoist_11 = await __call(getCost, {
1458
+ __stack.locals.__hoist_14 = await __call(getCost, {
1320
1459
  type: "positional",
1321
1460
  args: []
1322
1461
  });
1323
- if (hasInterrupts(__stack.locals.__hoist_11)) {
1462
+ if (hasInterrupts(__stack.locals.__hoist_14)) {
1324
1463
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1325
1464
  runner3.halt({
1326
1465
  ...__state,
1327
- data: __stack.locals.__hoist_11
1466
+ data: __stack.locals.__hoist_14
1328
1467
  });
1329
1468
  return;
1330
1469
  }
1331
- if (isAborted(__stack.locals.__hoist_11)) {
1332
- throw __stack.locals.__hoist_11.toError();
1470
+ if (isAborted(__stack.locals.__hoist_14)) {
1471
+ throw __stack.locals.__hoist_14.toError();
1333
1472
  }
1334
1473
  });
1335
1474
  await runner2.step(5, async (runner3) => {
1336
- __stack.locals.__hoist_12 = await __callMethod(__stack.locals.__hoist_11, "toFixed", {
1475
+ __stack.locals.__hoist_15 = await __callMethod(__stack.locals.__hoist_14, "toFixed", {
1337
1476
  type: "positional",
1338
1477
  args: [4]
1339
1478
  });
1340
1479
  });
1341
1480
  await runner2.step(6, async (runner3) => {
1342
- __stack.locals.roundedCost = `$${__stack.locals.__hoist_12}`;
1481
+ __stack.locals.roundedCost = `$${__stack.locals.__hoist_15}`;
1343
1482
  });
1344
1483
  await runner2.step(7, async (runner3) => {
1345
- __stack.locals.__hoist_13 = await __callMethod(color, "dim", {
1484
+ __stack.locals.__hoist_16 = await __callMethod(color, "dim", {
1346
1485
  type: "positional",
1347
1486
  args: [`
1348
1487
  Session cost: ${__stack.locals.roundedCost}`]
@@ -1351,7 +1490,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1351
1490
  await runner2.step(8, async (runner3) => {
1352
1491
  const __funcResult = await __call(print, {
1353
1492
  type: "positional",
1354
- args: [__stack.locals.__hoist_13]
1493
+ args: [__stack.locals.__hoist_16]
1355
1494
  });
1356
1495
  if (hasInterrupts(__funcResult)) {
1357
1496
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1403,26 +1542,26 @@ Session cost: ${__stack.locals.roundedCost}`]
1403
1542
  }
1404
1543
  });
1405
1544
  await runner2.step(11, async (runner3) => {
1406
- __stack.locals.__hoist_14 = await __call(getHeader, {
1545
+ __stack.locals.__hoist_17 = await __call(getHeader, {
1407
1546
  type: "positional",
1408
1547
  args: [__stack.locals.brain.name]
1409
1548
  });
1410
- if (hasInterrupts(__stack.locals.__hoist_14)) {
1549
+ if (hasInterrupts(__stack.locals.__hoist_17)) {
1411
1550
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1412
1551
  runner3.halt({
1413
1552
  ...__state,
1414
- data: __stack.locals.__hoist_14
1553
+ data: __stack.locals.__hoist_17
1415
1554
  });
1416
1555
  return;
1417
1556
  }
1418
- if (isAborted(__stack.locals.__hoist_14)) {
1419
- throw __stack.locals.__hoist_14.toError();
1557
+ if (isAborted(__stack.locals.__hoist_17)) {
1558
+ throw __stack.locals.__hoist_17.toError();
1420
1559
  }
1421
1560
  });
1422
1561
  await runner2.step(12, async (runner3) => {
1423
1562
  const __funcResult = await __call(print, {
1424
1563
  type: "positional",
1425
- args: [__stack.locals.__hoist_14]
1564
+ args: [__stack.locals.__hoist_17]
1426
1565
  });
1427
1566
  if (hasInterrupts(__funcResult)) {
1428
1567
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1490,7 +1629,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1490
1629
  });
1491
1630
  });
1492
1631
  if (runner.halted) return runner.haltResult;
1493
- await runner.hook(39, async () => {
1632
+ await runner.hook(42, async () => {
1494
1633
  await callHook({
1495
1634
  name: "onNodeEnd",
1496
1635
  data: {
@@ -1560,7 +1699,7 @@ Agent crashed: ${__error.message}`);
1560
1699
  }
1561
1700
  }
1562
1701
  var stdin_default = graph;
1563
- const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 44, "col": 2 }, "2": { "line": 48, "col": 2 }, "3": { "line": 49, "col": 2 }, "4": { "line": 50, "col": 2 }, "5": { "line": 60, "col": 2 }, "6": { "line": 61, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 51, "col": 4 }, "4.1": { "line": 54, "col": 18 }, "4.2.0": { "line": 54, "col": 4 }, "4.2.1": { "line": 55, "col": 6 }, "4.2.2": { "line": 56, "col": 25 }, "4.2.3.0": { "line": 56, "col": 11 }, "4.2.3.1": { "line": 57, "col": 6 }, "4.2.3": { "line": 56, "col": 11 }, "4.2": { "line": 54, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 71, "col": 30 }, "3": { "line": 71, "col": 2 }, "4": { "line": 79, "col": 2 }, "5": { "line": 82, "col": 2 }, "7": { "line": 89, "col": 2 }, "8": { "line": 93, "col": 2 }, "9": { "line": 95, "col": 63 }, "10": { "line": 95, "col": 2 }, "11": { "line": 96, "col": 2 }, "12": { "line": 97, "col": 2 }, "13": { "line": 103, "col": 2 }, "14": { "line": 105, "col": 15 }, "15": { "line": 105, "col": 2 }, "16": { "line": 108, "col": 2 }, "17": { "line": 109, "col": 2 }, "18": { "line": 110, "col": 2 }, "19": { "line": 111, "col": 2 }, "20": { "line": 120, "col": 2 }, "21": { "line": 124, "col": 2 }, "22": { "line": 128, "col": 15 }, "23": { "line": 128, "col": 2 }, "24": { "line": 133, "col": 2 }, "25": { "line": 134, "col": 2 }, "26": { "line": 136, "col": 2 }, "27": { "line": 140, "col": 2 }, "28": { "line": 141, "col": 2 }, "29": { "line": 143, "col": 2 }, "30": { "line": 147, "col": 2 }, "31": { "line": 152, "col": 2 }, "32": { "line": 153, "col": 2 }, "34": { "line": 159, "col": 2 }, "35": { "line": 160, "col": 2 }, "36": { "line": 166, "col": 14 }, "37": { "line": 166, "col": 2 }, "38": { "line": 168, "col": 2 }, "4.0": { "line": 80, "col": 4 }, "5.0": { "line": 83, "col": 4 }, "7.0": { "line": 90, "col": 4 }, "7.1": { "line": 91, "col": 4 }, "12.0": { "line": 98, "col": 22 }, "12.2": { "line": 98, "col": 4 }, "12.3": { "line": 99, "col": 10 }, "12.4": { "line": 99, "col": 4 }, "12.5": { "line": 100, "col": 4 }, "12.6": { "line": 101, "col": 4 }, "19.0": { "line": 112, "col": 4 }, "19.1": { "line": 113, "col": 10 }, "19.2": { "line": 113, "col": 4 }, "19.3": { "line": 114, "col": 4 }, "19.4": { "line": 115, "col": 4 }, "19.5": { "line": 117, "col": 4 }, "30.0": { "line": 148, "col": 4 }, "32.0": { "line": 154, "col": 4 }, "35.0": { "line": 161, "col": 4 }, "38.0": { "line": 169, "col": 4 }, "38.1.0": { "line": 171, "col": 6 }, "38.1.1.0": { "line": 173, "col": 8 }, "38.1.1": { "line": 172, "col": 6 }, "38.1.2": { "line": 175, "col": 6 }, "38.1": { "line": 170, "col": 4 }, "38.2": { "line": 177, "col": 10 }, "38.3": { "line": 177, "col": 4 }, "38.5": { "line": 178, "col": 28 }, "38.6": { "line": 178, "col": 4 }, "38.7": { "line": 179, "col": 10 }, "38.8": { "line": 179, "col": 4 }, "38.9": { "line": 181, "col": 4 }, "38.10": { "line": 182, "col": 4 }, "38.11": { "line": 183, "col": 10 }, "38.12": { "line": 183, "col": 4 }, "38.13": { "line": 184, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "38.13.0": { "line": 185, "col": 6 } } };
1702
+ const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 47, "col": 2 }, "2": { "line": 51, "col": 2 }, "3": { "line": 52, "col": 2 }, "4": { "line": 53, "col": 2 }, "5": { "line": 63, "col": 2 }, "6": { "line": 64, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 54, "col": 4 }, "4.1": { "line": 57, "col": 18 }, "4.2.0": { "line": 57, "col": 4 }, "4.2.1": { "line": 58, "col": 6 }, "4.2.2": { "line": 59, "col": 25 }, "4.2.3.0": { "line": 59, "col": 11 }, "4.2.3.1": { "line": 60, "col": 6 }, "4.2.3": { "line": 59, "col": 11 }, "4.2": { "line": 57, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 74, "col": 30 }, "3": { "line": 74, "col": 2 }, "4": { "line": 82, "col": 2 }, "5": { "line": 85, "col": 2 }, "7": { "line": 92, "col": 2 }, "8": { "line": 96, "col": 2 }, "9": { "line": 98, "col": 63 }, "10": { "line": 98, "col": 2 }, "11": { "line": 99, "col": 2 }, "12": { "line": 100, "col": 2 }, "13": { "line": 106, "col": 2 }, "14": { "line": 111, "col": 2 }, "15": { "line": 112, "col": 2 }, "16": { "line": 113, "col": 2 }, "17": { "line": 117, "col": 2 }, "18": { "line": 118, "col": 2 }, "19": { "line": 121, "col": 15 }, "20": { "line": 121, "col": 2 }, "21": { "line": 124, "col": 2 }, "22": { "line": 125, "col": 2 }, "23": { "line": 126, "col": 2 }, "24": { "line": 127, "col": 2 }, "25": { "line": 136, "col": 2 }, "26": { "line": 140, "col": 2 }, "27": { "line": 144, "col": 15 }, "28": { "line": 144, "col": 2 }, "29": { "line": 146, "col": 2 }, "30": { "line": 150, "col": 2 }, "31": { "line": 155, "col": 2 }, "32": { "line": 156, "col": 2 }, "34": { "line": 162, "col": 2 }, "35": { "line": 163, "col": 2 }, "36": { "line": 169, "col": 14 }, "37": { "line": 169, "col": 2 }, "38": { "line": 175, "col": 2 }, "40": { "line": 183, "col": 2 }, "41": { "line": 189, "col": 2 }, "4.0": { "line": 83, "col": 4 }, "5.0": { "line": 86, "col": 4 }, "7.0": { "line": 93, "col": 4 }, "7.1": { "line": 94, "col": 4 }, "12.0": { "line": 101, "col": 22 }, "12.2": { "line": 101, "col": 4 }, "12.3": { "line": 102, "col": 10 }, "12.4": { "line": 102, "col": 4 }, "12.5": { "line": 103, "col": 4 }, "12.6": { "line": 104, "col": 4 }, "24.0": { "line": 128, "col": 4 }, "24.1": { "line": 129, "col": 10 }, "24.2": { "line": 129, "col": 4 }, "24.3": { "line": 130, "col": 4 }, "24.4": { "line": 131, "col": 4 }, "24.5": { "line": 133, "col": 4 }, "30.0": { "line": 151, "col": 4 }, "32.0": { "line": 157, "col": 4 }, "35.0": { "line": 164, "col": 4 }, "38.0": { "line": 176, "col": 10 }, "38.1": { "line": 176, "col": 4 }, "38.2": { "line": 177, "col": 4 }, "40.0": { "line": 184, "col": 4 }, "40.1": { "line": 185, "col": 20 }, "40.2": { "line": 185, "col": 4 }, "40.3": { "line": 186, "col": 17 }, "40.4": { "line": 186, "col": 4 }, "41.0": { "line": 190, "col": 4 }, "41.1.0": { "line": 192, "col": 6 }, "41.1.1.0": { "line": 194, "col": 8 }, "41.1.1": { "line": 193, "col": 6 }, "41.1.2": { "line": 196, "col": 6 }, "41.1": { "line": 191, "col": 4 }, "41.2": { "line": 198, "col": 10 }, "41.3": { "line": 198, "col": 4 }, "41.5": { "line": 199, "col": 28 }, "41.6": { "line": 199, "col": 4 }, "41.7": { "line": 200, "col": 10 }, "41.8": { "line": 200, "col": 4 }, "41.9": { "line": 202, "col": 4 }, "41.10": { "line": 203, "col": 4 }, "41.11": { "line": 204, "col": 10 }, "41.12": { "line": 204, "col": 4 }, "41.13": { "line": 205, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "41.13.0": { "line": 206, "col": 6 } } };
1564
1703
  export {
1565
1704
  __getCheckpoints,
1566
1705
  __invokeFunction,
@@ -1,6 +1,6 @@
1
1
  /** @module
2
2
  @summary The brain record: what the harness needs from the thing that
3
- answers a turn. See docs/dev/agent-brains.md.
3
+ answers a turn. See docs/dev/agents/agent-brains.md.
4
4
  */
5
5
  import { Attachment } from "std::thread"
6
6
 
@@ -17,6 +17,9 @@ export type AgentBrain = {
17
17
  name: string;
18
18
  // One line, shown by --help next to the name.
19
19
  description: string;
20
+ // The `thread(session: ...)` name of the conversation with the user. The
21
+ // saved-session title and the transcript printed on resume read it.
22
+ session: string;
20
23
  // Valid --agent values. "" (the main entry) is always valid and not listed.
21
24
  startTargets: string[];
22
25
  // Called once, inside the policy handler, before any turn. Validate the
@@ -55,14 +55,15 @@ const __globalCtx = new RuntimeContext({
55
55
  liteLlm: __process.env["LITELLM_BASE_URL"] || "",
56
56
  openAiCompat: __process.env["OPENAI_COMPAT_BASE_URL"] || ""
57
57
  },
58
- model: "gpt-4o-mini",
58
+ model: "gpt-5-mini",
59
59
  logLevel: "warn",
60
60
  statelog: {
61
61
  host: "https://statelog.adit.io",
62
62
  projectId: "smoltalk",
63
63
  apiKey: __process.env["STATELOG_SMOLTALK_API_KEY"] || "",
64
64
  traceId: nanoid()
65
- }
65
+ },
66
+ provider: "openai-responses"
66
67
  },
67
68
  dirname: __dirname,
68
69
  logLevel: "info",
@@ -171,7 +172,7 @@ async function __registerTopLevelCallbacks(__ctx) {
171
172
  __registerCallbacksInit("dist/lib/agents/agency-agent/brains/brain.agency", __registerTopLevelCallbacks);
172
173
  __functionRefReviver.registry = __toolRegistry;
173
174
  const BrainContext = z.object({ "interactive": z.boolean(), "grounding": z.string() });
174
- const AgentBrain = z.object({ "name": z.string(), "description": z.string(), "startTargets": z.array(z.string()), "init": z.string(), "runTurn": z.string() });
175
+ const AgentBrain = z.object({ "name": z.string(), "description": z.string(), "session": z.string(), "startTargets": z.array(z.string()), "init": z.string(), "runTurn": z.string() });
175
176
  var stdin_default = graph;
176
177
  const __sourceMap = {};
177
178
  export {
@@ -4,7 +4,7 @@ This directory is one *brain* of the Agency agent: the part that answers a
4
4
  turn. The harness around it (`agent.agency` and `lib/`) owns the command
5
5
  line, the REPL, the approval policy handler, the per-turn budget guard,
6
6
  slash-command expansion, and attachment detection. None of that lives here.
7
- `docs/dev/agent-brains.md` explains the split; this file explains how this
7
+ `docs/dev/agents/agent-brains.md` explains the split; this file explains how this
8
8
  particular brain is put together.
9
9
 
10
10
  Run it with `agency agent` (it is the default) or `agency agent --brain coordinator`.
@@ -32,7 +32,7 @@ tests/ Agency execution tests for this brain
32
32
  `coordinatorBrain()` returns the record the registry hands to the harness:
33
33
 
34
34
  - `name: "coordinator"`, the `--brain` value.
35
- - `startTargets`: `code`, `research`, `oracle`, `explorer`, `review`. These
35
+ - `startTargets`: `code`, `research`, `oracle`, `explorer`, `review`, `writing`. These
36
36
  are the names `--agent <name>` may route the starting prompt to directly.
37
37
  `--agent main` (or no flag) goes through the coordinator.
38
38
  - `init(context)`: runs once per session, inside the harness policy handler.
@@ -68,6 +68,8 @@ and an inner `with approve` cannot get past an outer policy.
68
68
  | `oracleAgent` | Deep-reasoning consult on the slow model slot; repeated consults share a session. | `std::agents/oracle` |
69
69
  | `explorerAgent` | Surveys a codebase or topic on the slow model slot; shared session. | `std::agents/explorer` |
70
70
  | `reviewAgent` | Reviews Agency code: snippets from a message, or the files the code agent just wrote. | `std::agents/agency/review` |
71
+ | `writingAgent` | Reviews prose for readability; reports findings, or applies them when asked. | `std::agents/writing/review` |
72
+ | `rewriteAgent` | Rewrites prose from the reviewer's findings and returns the new text. | `std::agents/writing/rewrite` |
71
73
 
72
74
  Most specialists are thin wrappers that add what is the agent's business
73
75
  (the user's chosen model slots, a shared session) to an agent that ships in
@@ -97,4 +99,4 @@ not compile correctly today.
97
99
  A new specialist is a function in `subagents/`, added to `mainAgentTools`
98
100
  and, if it should be a `--agent` target, to `startTargets` and the `match`
99
101
  in `coordinatorRunTurn`. A new brain is a different thing: see
100
- `docs/dev/agent-brains.md` and `brains/simple/README.md`.
102
+ `docs/dev/agents/agent-brains.md` and `brains/simple/README.md`.