orkeon-code 1.0.0-rc.1 → 1.0.0-rc.3

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 (443) hide show
  1. package/.orkeon-runtime +11 -0
  2. package/.orkeon-version +1 -1
  3. package/NOTICE.md +1 -1
  4. package/README.fr.md +16 -22
  5. package/README.md +16 -22
  6. package/config/appsettings.jev.example.json +4 -1
  7. package/config/appsettings.kev.example.json +4 -1
  8. package/config/appsettings.liquid.example.json +4 -1
  9. package/config/appsettings.ollama-whisper.example.json +1 -0
  10. package/config/appsettings.whisper.example.json +1 -0
  11. package/mcp/whisper/README.md +2 -1
  12. package/orkeon-code +508 -80
  13. package/orkeon-code.ps1 +129 -11
  14. package/package.json +3 -1
  15. package/scripts/dev-run.sh +139 -0
  16. package/src/commands/.orkeon/orkeon-cli.d.ts +1 -4
  17. package/src/commands/_lib/args.ts +5 -4
  18. package/src/commands/_lib/dev/dev-batches.ts +34 -36
  19. package/src/commands/_lib/dev/dev-implement.ts +11 -14
  20. package/src/commands/_lib/dev/dev-source.ts +7 -11
  21. package/src/commands/_lib/dev/dev.ts +34 -37
  22. package/src/commands/_lib/dev/markers.ts +7 -0
  23. package/src/commands/_lib/dev/messages.ts +112 -0
  24. package/src/commands/_lib/dev-step.ts +16 -13
  25. package/src/commands/_lib/dispatch.ts +62 -39
  26. package/src/commands/_lib/git/branch.ts +9 -10
  27. package/src/commands/_lib/git/commit.ts +9 -13
  28. package/src/commands/_lib/git/diff.ts +22 -12
  29. package/src/commands/_lib/git/messages.ts +54 -0
  30. package/src/commands/_lib/git/review.ts +9 -10
  31. package/src/commands/_lib/memory/memory-admit.ts +19 -21
  32. package/src/commands/_lib/memory/memory.ts +3 -2
  33. package/src/commands/_lib/memory/messages.ts +32 -0
  34. package/src/commands/_lib/messages.ts +48 -0
  35. package/src/commands/_lib/project/messages.ts +8 -0
  36. package/src/commands/_lib/session/export.ts +3 -2
  37. package/src/commands/_lib/session/messages.ts +87 -0
  38. package/src/commands/_lib/session/prompts.ts +4 -0
  39. package/src/commands/_lib/session/resume.ts +15 -24
  40. package/src/commands/_lib/session/tasks.ts +20 -23
  41. package/src/commands/_lib/settings/advisor.ts +11 -16
  42. package/src/commands/_lib/settings/agents.ts +18 -28
  43. package/src/commands/_lib/settings/choices.ts +8 -0
  44. package/src/commands/_lib/settings/config.ts +43 -43
  45. package/src/commands/_lib/settings/effort.ts +147 -0
  46. package/src/commands/_lib/settings/hooks.ts +12 -20
  47. package/src/commands/_lib/settings/messages.ts +408 -0
  48. package/src/commands/_lib/settings/mode.ts +33 -24
  49. package/src/commands/_lib/settings/model.ts +71 -36
  50. package/src/commands/_lib/settings/output-style.ts +39 -0
  51. package/src/commands/_lib/settings/permissions.ts +71 -93
  52. package/src/commands/_lib/settings/route.ts +63 -0
  53. package/src/commands/_lib/settings/skills.ts +53 -11
  54. package/src/commands/_lib/settings/theme.ts +42 -0
  55. package/src/commands/_lib/speech/messages.ts +58 -0
  56. package/src/commands/_lib/speech/prompts.ts +4 -0
  57. package/src/commands/_lib/speech/say.ts +9 -10
  58. package/src/commands/_lib/speech/transcribe.ts +14 -23
  59. package/src/commands/_lib/speech/voice.ts +14 -18
  60. package/src/commands/_lib/status/doctor.ts +47 -28
  61. package/src/commands/_lib/status/messages.ts +101 -0
  62. package/src/commands/_lib/status/meta.ts +5 -25
  63. package/src/commands/_lib/status/status.ts +10 -11
  64. package/src/commands/_lib/status/usage-tools.ts +2 -3
  65. package/src/commands/_lib/status/usage.ts +7 -18
  66. package/src/commands/_lib/view.ts +6 -1
  67. package/src/commands/dev/dev-batches.cmd.ts +4 -3
  68. package/src/commands/dev/dev-learn.cmd.ts +3 -3
  69. package/src/commands/dev/dev-plan.cmd.ts +6 -7
  70. package/src/commands/dev/dev-spec.cmd.ts +6 -7
  71. package/src/commands/git/commit.cmd.ts +3 -3
  72. package/src/commands/git/review.cmd.ts +3 -3
  73. package/src/commands/memory/memory.cmd.ts +2 -2
  74. package/src/commands/project/analyze.cmd.ts +3 -3
  75. package/src/commands/project/debug-tool-call.cmd.ts +4 -9
  76. package/src/commands/project/init-verifiers.cmd.ts +3 -3
  77. package/src/commands/project/init.cmd.ts +3 -3
  78. package/src/commands/project/verify.cmd.ts +2 -2
  79. package/src/commands/session/assistant.cmd.ts +2 -2
  80. package/src/commands/session/compact.cmd.ts +1 -1
  81. package/src/commands/session/copy.cmd.ts +8 -7
  82. package/src/commands/session/rename.cmd.ts +3 -2
  83. package/src/commands/session/rewind.cmd.ts +3 -4
  84. package/src/commands/session/summary.cmd.ts +3 -3
  85. package/src/commands/session/tasks.cmd.ts +4 -2
  86. package/src/commands/settings/config.cmd.ts +4 -2
  87. package/src/commands/settings/effort.cmd.ts +10 -31
  88. package/src/commands/settings/fast.cmd.ts +2 -1
  89. package/src/commands/settings/mode.cmd.ts +3 -3
  90. package/src/commands/settings/model.cmd.ts +3 -2
  91. package/src/commands/settings/output-style.cmd.ts +9 -38
  92. package/src/commands/settings/permissions.cmd.ts +2 -2
  93. package/src/commands/settings/proactive.cmd.ts +2 -1
  94. package/src/commands/settings/route.cmd.ts +16 -0
  95. package/src/commands/settings/skills.cmd.ts +3 -3
  96. package/src/commands/settings/theme.cmd.ts +14 -0
  97. package/src/commands/speech/say.cmd.ts +2 -2
  98. package/src/commands/speech/transcribe.cmd.ts +2 -2
  99. package/src/commands/status/release-notes.cmd.ts +1 -1
  100. package/src/crews/.orkeon/orkeon.d.ts +539 -94
  101. package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
  102. package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +17 -12
  103. package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
  104. package/src/crews/_probe-shared-memory/probe.ork.ts +8 -6
  105. package/src/crews/advisor/application/messages.ts +4 -0
  106. package/src/crews/advisor/application/prompts.ts +4 -0
  107. package/src/crews/advisor/application/run-advisor.ts +2 -1
  108. package/src/crews/advisor/crew.ork.ts +6 -5
  109. package/src/crews/advisor/domain/advice.ts +7 -23
  110. package/src/crews/advisor/domain/messages.ts +8 -0
  111. package/src/crews/advisor/domain/prompts.ts +26 -0
  112. package/src/crews/agent-run/application/messages.ts +18 -0
  113. package/src/crews/agent-run/application/run-agent-run.ts +5 -4
  114. package/src/crews/agent-run/crew.ork.ts +4 -4
  115. package/src/crews/analyze/application/messages.ts +27 -0
  116. package/src/crews/analyze/application/prompts.ts +4 -0
  117. package/src/crews/analyze/application/run-analyze.ts +16 -14
  118. package/src/crews/analyze/crew.ork.ts +5 -4
  119. package/src/crews/analyze/domain/harvest.ts +33 -65
  120. package/src/crews/analyze/domain/prompts.ts +86 -0
  121. package/src/crews/code-review/application/lens-material.ts +24 -0
  122. package/src/crews/code-review/application/messages.ts +17 -0
  123. package/src/crews/code-review/application/prompts.ts +10 -17
  124. package/src/crews/code-review/application/review.ts +4 -1
  125. package/src/crews/code-review/application/run-code-review.ts +13 -15
  126. package/src/crews/code-review/crew.ork.ts +6 -5
  127. package/src/crews/code-review/domain/lenses.ts +6 -45
  128. package/src/crews/code-review/domain/messages.ts +25 -0
  129. package/src/crews/code-review/domain/prompts.ts +58 -0
  130. package/src/crews/code-review/domain/report.ts +5 -6
  131. package/src/crews/code-review/domain/scope.ts +6 -12
  132. package/src/crews/dev-batches/application/messages.ts +127 -0
  133. package/src/crews/dev-batches/application/plan-close.ts +12 -12
  134. package/src/crews/dev-batches/application/prompts.ts +10 -0
  135. package/src/crews/dev-batches/application/run-dev-batches.ts +57 -50
  136. package/src/crews/dev-batches/application/run-wave.ts +24 -22
  137. package/src/crews/dev-batches/application/seed-harvest.ts +8 -7
  138. package/src/crews/dev-batches/crew.ork.ts +13 -10
  139. package/src/crews/dev-batches/domain/batches-log.ts +1 -3
  140. package/src/crews/dev-batches/domain/markers.ts +5 -0
  141. package/src/crews/dev-batches/domain/messages.ts +6 -0
  142. package/src/crews/dev-batches/domain/wave-order.ts +3 -2
  143. package/src/crews/dev-change/application/change-material.ts +44 -0
  144. package/src/crews/dev-change/application/evidence.ts +25 -22
  145. package/src/crews/dev-change/application/messages.ts +81 -0
  146. package/src/crews/dev-change/application/{change-prompt.ts → prompts.ts} +40 -43
  147. package/src/crews/dev-change/application/run-dev-change.ts +43 -34
  148. package/src/crews/dev-change/crew.ork.ts +11 -9
  149. package/src/crews/dev-change/domain/change-answer.ts +24 -20
  150. package/src/crews/dev-change/domain/change-render.ts +14 -16
  151. package/src/crews/dev-change/domain/markers.ts +28 -0
  152. package/src/crews/dev-change/domain/messages.ts +16 -0
  153. package/src/crews/dev-implement/application/close.ts +21 -18
  154. package/src/crews/dev-implement/application/locate-sheet.ts +7 -5
  155. package/src/crews/dev-implement/application/messages.ts +161 -0
  156. package/src/crews/dev-implement/application/observe.ts +4 -2
  157. package/src/crews/dev-implement/application/prompts.ts +9 -0
  158. package/src/crews/dev-implement/application/report-writes.ts +14 -9
  159. package/src/crews/dev-implement/application/run-dev-implement.ts +84 -73
  160. package/src/crews/dev-implement/application/suite-job.ts +15 -11
  161. package/src/crews/dev-implement/crew.ork.ts +2 -1
  162. package/src/crews/dev-implement/domain/contracts.ts +59 -60
  163. package/src/crews/dev-implement/domain/correction.ts +16 -15
  164. package/src/crews/dev-implement/domain/cycles.ts +2 -1
  165. package/src/crews/dev-implement/domain/markers.ts +23 -0
  166. package/src/crews/dev-implement/domain/messages.ts +58 -0
  167. package/src/crews/dev-implement/domain/prompts.ts +93 -0
  168. package/src/crews/dev-implement/domain/roles.ts +3 -7
  169. package/src/crews/dev-implement/domain/sheet-edits.ts +6 -5
  170. package/src/crews/dev-implement/domain/sheet-ticks.ts +5 -4
  171. package/src/crews/dev-implement/domain/step-checks.ts +17 -16
  172. package/src/crews/dev-implement/domain/step-section.ts +6 -4
  173. package/src/crews/dev-learn/application/learn-prompt-fit.ts +63 -0
  174. package/src/crews/dev-learn/application/messages.ts +56 -0
  175. package/src/crews/dev-learn/application/prompts.ts +96 -0
  176. package/src/crews/dev-learn/application/run-dev-learn.ts +51 -43
  177. package/src/crews/dev-learn/crew.ork.ts +5 -4
  178. package/src/crews/dev-learn/domain/learn-answer.ts +60 -37
  179. package/src/crews/dev-learn/domain/markers.ts +10 -0
  180. package/src/crews/dev-learn/domain/messages.ts +74 -0
  181. package/src/crews/dev-learn/domain/owner-lines.ts +12 -9
  182. package/src/crews/dev-learn/domain/proposals-render.ts +8 -9
  183. package/src/crews/dev-plan/application/anchor-paths.ts +57 -20
  184. package/src/crews/dev-plan/application/inventory.ts +17 -13
  185. package/src/crews/dev-plan/application/messages.ts +88 -0
  186. package/src/crews/dev-plan/application/plan-prompt-fit.ts +44 -0
  187. package/src/crews/dev-plan/application/{plan-prompt.ts → prompts.ts} +37 -55
  188. package/src/crews/dev-plan/application/run-dev-plan.ts +103 -75
  189. package/src/crews/dev-plan/crew.ork.ts +12 -9
  190. package/src/crews/dev-plan/domain/inventory-model.ts +3 -3
  191. package/src/crews/dev-plan/domain/markers.ts +18 -0
  192. package/src/crews/dev-plan/domain/messages.ts +118 -0
  193. package/src/crews/dev-plan/domain/plan-answer.ts +118 -103
  194. package/src/crews/dev-plan/domain/plan-render.ts +33 -34
  195. package/src/crews/dev-plan/domain/prompts.ts +44 -0
  196. package/src/crews/dev-spec/application/messages.ts +30 -0
  197. package/src/crews/dev-spec/application/{spec-prompt.ts → prompts.ts} +42 -47
  198. package/src/crews/dev-spec/application/run-dev-spec.ts +67 -36
  199. package/src/crews/dev-spec/application/spec-material.ts +42 -0
  200. package/src/crews/dev-spec/crew.ork.ts +11 -9
  201. package/src/crews/dev-spec/domain/markers.ts +30 -0
  202. package/src/crews/dev-spec/domain/messages.ts +39 -0
  203. package/src/crews/dev-spec/domain/spec-answer.ts +46 -47
  204. package/src/crews/dev-spec/domain/spec-render.ts +21 -21
  205. package/src/crews/dev-verify/application/audit-brief.ts +187 -0
  206. package/src/crews/dev-verify/application/audit.ts +38 -30
  207. package/src/crews/dev-verify/application/capture.ts +34 -26
  208. package/src/crews/dev-verify/application/messages.ts +119 -0
  209. package/src/crews/dev-verify/application/prompts.ts +209 -0
  210. package/src/crews/dev-verify/application/run-dev-verify.ts +60 -46
  211. package/src/crews/dev-verify/application/run-gate.ts +11 -9
  212. package/src/crews/dev-verify/crew.ork.ts +7 -7
  213. package/src/crews/dev-verify/domain/audit-answer.ts +16 -12
  214. package/src/crews/dev-verify/domain/capture-sections.ts +5 -4
  215. package/src/crews/dev-verify/domain/commands.ts +3 -3
  216. package/src/crews/dev-verify/domain/gate.ts +21 -16
  217. package/src/crews/dev-verify/domain/markers.ts +16 -0
  218. package/src/crews/dev-verify/domain/mechanical-table.ts +37 -44
  219. package/src/crews/dev-verify/domain/messages.ts +92 -0
  220. package/src/crews/dev-verify/domain/verdict.ts +4 -4
  221. package/src/crews/git-commit/application/draft.ts +38 -55
  222. package/src/crews/git-commit/application/messages.ts +17 -0
  223. package/src/crews/git-commit/application/prompts.ts +47 -0
  224. package/src/crews/git-commit/application/run-git-commit.ts +16 -13
  225. package/src/crews/git-commit/crew.ork.ts +6 -5
  226. package/src/crews/git-commit/domain/commit.ts +15 -35
  227. package/src/crews/git-commit/domain/markers.ts +4 -0
  228. package/src/crews/git-commit/domain/messages.ts +48 -0
  229. package/src/crews/init-verifiers/application/authoring.ts +2 -1
  230. package/src/crews/init-verifiers/application/messages.ts +13 -0
  231. package/src/crews/init-verifiers/application/prompts.ts +5 -1
  232. package/src/crews/init-verifiers/application/run-init-verifiers.ts +3 -2
  233. package/src/crews/init-verifiers/crew.ork.ts +6 -5
  234. package/src/crews/main-loop/application/auto-compact.ts +2 -1
  235. package/src/crews/main-loop/application/messages.ts +81 -0
  236. package/src/crews/main-loop/application/prompts.ts +12 -0
  237. package/src/crews/main-loop/application/run-main-loop.ts +64 -31
  238. package/src/crews/main-loop/application/{turn-prompt.ts → turn-context.ts} +7 -8
  239. package/src/crews/main-loop/crew.ork.ts +12 -7
  240. package/src/crews/main-loop/domain/prompt-assembly.ts +45 -228
  241. package/src/crews/main-loop/domain/prompts.ts +336 -0
  242. package/src/crews/main-loop/domain/turn-chains.ts +10 -9
  243. package/src/crews/project-init/application/detect.ts +5 -4
  244. package/src/crews/project-init/application/messages.ts +15 -0
  245. package/src/crews/project-init/application/prompts.ts +11 -7
  246. package/src/crews/project-init/crew.ork.ts +6 -5
  247. package/src/crews/project-init/domain/existing-files.ts +6 -4
  248. package/src/crews/project-init/domain/messages.ts +13 -0
  249. package/src/crews/project-init/domain/package-map.ts +3 -3
  250. package/src/crews/project-init/domain/prompts.ts +10 -0
  251. package/src/crews/session-compact/application/prompts.ts +5 -0
  252. package/src/crews/session-compact/crew.ork.ts +6 -5
  253. package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
  254. package/src/crews/shared-memory-admit/crew.ork.ts +4 -3
  255. package/src/crews/speech/application/messages.ts +3 -0
  256. package/src/crews/speech/application/prompts.ts +3 -0
  257. package/src/crews/speech/application/run-speech.ts +2 -1
  258. package/src/crews/speech/crew.ork.ts +2 -1
  259. package/src/shared/application/agents/child-agent.ts +11 -7
  260. package/src/shared/application/agents/messages.ts +35 -0
  261. package/src/shared/application/agents/route-agent.ts +115 -0
  262. package/src/shared/application/agents/run-sub-agent.ts +31 -8
  263. package/src/shared/application/compaction/compact-session.ts +19 -14
  264. package/src/shared/application/compaction/messages.ts +20 -0
  265. package/src/shared/application/compaction/prune-context.ts +94 -0
  266. package/src/shared/application/compaction/pruned-llm.ts +35 -0
  267. package/src/shared/application/dev/brief-inventory.ts +6 -4
  268. package/src/shared/application/dev/close-batch.ts +9 -7
  269. package/src/shared/application/dev/find-repo-pack.ts +4 -3
  270. package/src/shared/application/dev/learn-decision.ts +20 -18
  271. package/src/shared/application/dev/load-dev-context.ts +7 -8
  272. package/src/shared/application/dev/measure-access-cost.ts +5 -4
  273. package/src/shared/application/dev/messages.ts +135 -0
  274. package/src/shared/application/dev/phase-timer.ts +54 -0
  275. package/src/shared/application/dev/plan-source.ts +12 -8
  276. package/src/shared/application/dev/preflight.ts +16 -11
  277. package/src/shared/application/dev/prompts.ts +34 -0
  278. package/src/shared/application/dev/question-round.ts +25 -17
  279. package/src/shared/application/dev/resolve-work-folder.ts +4 -3
  280. package/src/shared/application/dev/settle-questions.ts +4 -2
  281. package/src/shared/application/dev/source-review.ts +12 -8
  282. package/src/shared/application/dev/source-step.ts +12 -10
  283. package/src/shared/application/dev/spend.ts +17 -4
  284. package/src/shared/application/dev/step-precedents.ts +2 -1
  285. package/src/shared/application/dev/tool-call-policy.ts +9 -11
  286. package/src/shared/application/dev/tool-callbacks.ts +52 -5
  287. package/src/shared/application/dev/tool-trace-recorder.ts +2 -1
  288. package/src/shared/application/dev/verdict-sources.ts +5 -3
  289. package/src/shared/application/dev/wrapped-tools.ts +4 -2
  290. package/src/shared/application/extra-tools.ts +2 -1
  291. package/src/shared/application/git/batch-worktree.ts +22 -17
  292. package/src/shared/application/git/commit-files.ts +24 -19
  293. package/src/shared/application/git/merge-batch.ts +11 -7
  294. package/src/shared/application/git/messages.ts +75 -0
  295. package/src/shared/application/git/open-pull-request.ts +4 -3
  296. package/src/shared/application/host-context.ts +59 -0
  297. package/src/shared/application/host-layout-store.ts +45 -0
  298. package/src/shared/application/llm-profile.ts +4 -3
  299. package/src/shared/application/messages.ts +14 -0
  300. package/src/shared/application/permission-rules.ts +10 -0
  301. package/src/shared/application/ports/decision.ts +14 -0
  302. package/src/shared/application/ports/human.ts +25 -0
  303. package/src/shared/application/ports/llm.ts +32 -3
  304. package/src/shared/application/ports/memory.ts +1 -1
  305. package/src/shared/application/ports/theme.ts +11 -0
  306. package/src/shared/application/ports.ts +4 -2
  307. package/src/shared/application/session-io.ts +2 -1
  308. package/src/shared/application/shared-memory/admit-entries.ts +16 -14
  309. package/src/shared/application/shared-memory/harvest-after-gaps.ts +5 -8
  310. package/src/shared/application/shared-memory/harvest-mistakes.ts +3 -2
  311. package/src/shared/application/shared-memory/import-agent-memory.ts +9 -7
  312. package/src/shared/application/shared-memory/memory-files.ts +2 -1
  313. package/src/shared/application/shared-memory/memory-settings.ts +2 -1
  314. package/src/shared/application/shared-memory/messages.ts +63 -0
  315. package/src/shared/application/shared-memory/push-candidate.ts +14 -11
  316. package/src/shared/application/shared-memory/recall-precedents.ts +2 -1
  317. package/src/shared/application/skills/messages.ts +4 -0
  318. package/src/shared/application/skills/suggest-skills.ts +102 -0
  319. package/src/shared/application/workflow/messages.ts +8 -0
  320. package/src/shared/application/workflow/workflow-state.ts +7 -6
  321. package/src/shared/domain/agent-policy/behavior-flags.ts +4 -10
  322. package/src/shared/domain/agent-policy/extra-tools.ts +2 -4
  323. package/src/shared/domain/agent-policy/messages.ts +66 -0
  324. package/src/shared/domain/agent-policy/path-rules.ts +299 -0
  325. package/src/shared/domain/agent-policy/permission.ts +20 -18
  326. package/src/shared/domain/agent-policy/prompts.ts +17 -0
  327. package/src/shared/domain/agent-policy/reasoning.ts +59 -0
  328. package/src/shared/domain/agent-policy/rule-sets.ts +18 -14
  329. package/src/shared/domain/agent-policy/tool-access.ts +17 -3
  330. package/src/shared/domain/agent-registry.ts +6 -5
  331. package/src/shared/domain/agents/chain.ts +2 -2
  332. package/src/shared/domain/agents/charter.ts +8 -5
  333. package/src/shared/domain/agents/exclusive.ts +2 -1
  334. package/src/shared/domain/agents/instances.ts +18 -15
  335. package/src/shared/domain/agents/messages.ts +39 -0
  336. package/src/shared/domain/agents/model-route.ts +199 -0
  337. package/src/shared/domain/agents/prompts.ts +20 -0
  338. package/src/shared/domain/code-intel-contract.ts +5 -4
  339. package/src/shared/domain/code-intel-routing.ts +8 -61
  340. package/src/shared/domain/compact-outcome.ts +5 -3
  341. package/src/shared/domain/compaction-thresholds.ts +2 -1
  342. package/src/shared/domain/compaction.ts +22 -113
  343. package/src/shared/domain/config-schema.ts +94 -81
  344. package/src/shared/domain/context-prune.ts +176 -0
  345. package/src/shared/domain/decision/questions.ts +102 -0
  346. package/src/shared/domain/dev/access-cost.ts +19 -15
  347. package/src/shared/domain/dev/batches-concurrency.ts +5 -6
  348. package/src/shared/domain/dev/build-commands.ts +5 -4
  349. package/src/shared/domain/dev/call-guard.ts +29 -28
  350. package/src/shared/domain/dev/carried-text.ts +3 -5
  351. package/src/shared/domain/dev/learn-proposals.ts +51 -12
  352. package/src/shared/domain/dev/learn-state.ts +3 -2
  353. package/src/shared/domain/dev/markers.ts +127 -0
  354. package/src/shared/domain/dev/messages.ts +271 -0
  355. package/src/shared/domain/dev/phase-timing.ts +50 -0
  356. package/src/shared/domain/dev/plan-checks.ts +24 -23
  357. package/src/shared/domain/dev/plan-format.ts +15 -25
  358. package/src/shared/domain/dev/project-files.ts +1 -15
  359. package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
  360. package/src/shared/domain/dev/{review-prompt.ts → prompts.ts} +91 -61
  361. package/src/shared/domain/dev/questions.ts +33 -15
  362. package/src/shared/domain/dev/repo-pack.ts +12 -9
  363. package/src/shared/domain/dev/review-answer.ts +40 -17
  364. package/src/shared/domain/dev/review-brief.ts +54 -0
  365. package/src/shared/domain/dev/reviewer-charter.ts +4 -0
  366. package/src/shared/domain/dev/sheet-facts.ts +2 -4
  367. package/src/shared/domain/dev/spec-format.ts +13 -14
  368. package/src/shared/domain/dev/step-budget.ts +4 -2
  369. package/src/shared/domain/dev/step-rules.ts +3 -4
  370. package/src/shared/domain/dev/test-commands.ts +14 -10
  371. package/src/shared/domain/dev/tool-guards.ts +4 -3
  372. package/src/shared/domain/dev/trait-pattern.ts +14 -10
  373. package/src/shared/domain/dev/verdict-format.ts +14 -21
  374. package/src/shared/domain/dev/whitespace.ts +3 -2
  375. package/src/shared/domain/dev/work-folder.ts +6 -4
  376. package/src/shared/domain/dev/yaml-subset.ts +8 -26
  377. package/src/shared/domain/error-text.ts +13 -0
  378. package/src/shared/domain/git/close.ts +14 -11
  379. package/src/shared/domain/git/messages.ts +41 -0
  380. package/src/shared/domain/git/pull-request.ts +5 -5
  381. package/src/shared/domain/host-layout.ts +147 -0
  382. package/src/shared/domain/host-paths.ts +399 -0
  383. package/src/shared/domain/llm-failure.ts +35 -7
  384. package/src/shared/domain/llm-profile.ts +22 -3
  385. package/src/shared/domain/marked-message.ts +1 -5
  386. package/src/shared/domain/markers.ts +30 -0
  387. package/src/shared/domain/messages.ts +291 -0
  388. package/src/shared/domain/model-catalog.ts +2 -9
  389. package/src/shared/domain/permission-modes.ts +4 -8
  390. package/src/shared/domain/prelude.ts +2 -2
  391. package/src/shared/domain/project-manifests.ts +3 -2
  392. package/src/shared/domain/prompts.ts +233 -0
  393. package/src/shared/domain/search-routing.ts +3 -11
  394. package/src/shared/domain/secret-patterns.ts +3 -2
  395. package/src/shared/domain/session-keys.ts +7 -0
  396. package/src/shared/domain/session-start.ts +3 -2
  397. package/src/shared/domain/shared-memory/agent-memory-import.ts +4 -2
  398. package/src/shared/domain/shared-memory/candidates.ts +3 -4
  399. package/src/shared/domain/shared-memory/entry.ts +26 -20
  400. package/src/shared/domain/shared-memory/front-matter.ts +17 -13
  401. package/src/shared/domain/shared-memory/gate.ts +4 -3
  402. package/src/shared/domain/shared-memory/harvest.ts +9 -6
  403. package/src/shared/domain/shared-memory/layout.ts +11 -8
  404. package/src/shared/domain/shared-memory/markers.ts +9 -0
  405. package/src/shared/domain/shared-memory/messages.ts +66 -0
  406. package/src/shared/domain/shared-memory/precedents-block.ts +4 -15
  407. package/src/shared/domain/shared-memory/prompts.ts +28 -0
  408. package/src/shared/domain/shared-memory/refused.ts +3 -3
  409. package/src/shared/domain/skills/prompts.ts +4 -0
  410. package/src/shared/domain/skills/shortlist.ts +149 -0
  411. package/src/shared/domain/snip-turns.ts +2 -14
  412. package/src/shared/domain/speech.ts +2 -1
  413. package/src/shared/domain/tool-trace.ts +5 -7
  414. package/src/shared/domain/verifiers.ts +7 -11
  415. package/src/shared/domain/vfs.ts +8 -1
  416. package/src/shared/domain/workflow/prompts.ts +15 -0
  417. package/src/shared/domain/workflow/state-file.ts +14 -12
  418. package/src/shared/infrastructure/globals.ts +7 -2
  419. package/src/shared/infrastructure/orkeon/child-agents.ts +11 -16
  420. package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
  421. package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
  422. package/src/shared/infrastructure/orkeon/dev-deps.ts +21 -14
  423. package/src/shared/infrastructure/orkeon/files.ts +24 -6
  424. package/src/shared/infrastructure/orkeon/github-pull-requests.ts +3 -2
  425. package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
  426. package/src/shared/infrastructure/orkeon/human-input.ts +1 -5
  427. package/src/shared/infrastructure/orkeon/llm-profile.ts +36 -16
  428. package/src/shared/infrastructure/orkeon/llm.ts +85 -30
  429. package/src/shared/infrastructure/orkeon/markers.ts +6 -0
  430. package/src/shared/infrastructure/orkeon/memory-store.ts +1 -1
  431. package/src/shared/infrastructure/orkeon/memory-tools.ts +18 -20
  432. package/src/shared/infrastructure/orkeon/messages.ts +15 -0
  433. package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
  434. package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
  435. package/src/shared/infrastructure/orkeon/script-tools.ts +14 -19
  436. package/src/shared/infrastructure/orkeon/session-store.ts +7 -51
  437. package/src/shared/infrastructure/orkeon/shell-jobs.ts +13 -7
  438. package/src/shared/infrastructure/orkeon/shell.ts +13 -5
  439. package/src/shared/infrastructure/orkeon/tool-catalogue.ts +3 -2
  440. package/src/shared/infrastructure/orkeon/wiring.ts +68 -12
  441. package/src/crews/dev-learn/application/learn-prompt.ts +0 -140
  442. package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
  443. package/src/shared/domain/session-summary.ts +0 -13
package/orkeon-code.ps1 CHANGED
@@ -14,9 +14,9 @@
14
14
  .\orkeon-code.ps1 setup # write %USERPROFILE%\.orkeon-code\appsettings.json (never the key)
15
15
 
16
16
  .NOTES
17
- Modes: tool (orkeon-repl on PATH, from the full Orkeon release .zip (the .msi has no orkeon-repl), the
18
- Debian package or the dotnet tool, or $env:ORKEON_REPL) and docker
19
- (ghcr.io/orkeon/orkeon-runners:latest, the last release, not the pin). The source mode is only in the
17
+ Modes: tool (orkeon-repl on PATH, from the full Orkeon release .zip (the .msi has no orkeon-repl, the
18
+ dotnet tool installs orkeon alone) or the Debian package, or $env:ORKEON_REPL) and docker
19
+ (ghcr.io/orkeon/orkeon:latest, the last release, not the pin). The source mode is only in the
20
20
  bash launcher. Folder trust, per-project state, sessions, settings, API key, model and $env:ORKEON_CODE_AUDIO_DIR (speech-to-text,
21
21
  tool mode): see the header of ./orkeon-code.
22
22
  #>
@@ -35,6 +35,11 @@ param(
35
35
  $ErrorActionPreference = 'Stop'
36
36
 
37
37
  # A subcommand of ./orkeon-code (trust, setup) is the first argument, and takes the rest as its own.
38
+ # `run` (one crew, headless) and `runtime` (the downloaded runtime) are the bash launcher's alone for now.
39
+ if ($Extra.Count -gt 0 -and $Extra[0] -cin @('run', 'runtime')) {
40
+ [Console]::Error.WriteLine("orkeon-code: '$($Extra[0])' is not available in orkeon-code.ps1 yet: run the bash launcher (./orkeon-code $($Extra[0]) ...) from Git Bash or WSL (docs/headless.md, docs/getting-started.md).")
41
+ exit 1
42
+ }
38
43
  $Sub = $null
39
44
  $SubArgs = @()
40
45
  if ($Extra.Count -gt 0 -and $Extra[0] -cin @('trust', 'setup')) {
@@ -375,11 +380,11 @@ function Invoke-Setup([string] $target) {
375
380
  $savedEnv = @{}
376
381
  foreach ($name in @('ORKEON_Llm__Model', 'Orkeon__Security__PermissionGate__Enabled', 'Orkeon__Cli__Session__StartScript',
377
382
  'Orkeon__Cli__Session__Persist', 'ORKEON_Orkeon__Cli__Session__SessionsDirectory',
378
- 'ORKEON_Orkeon__Cli__Memory__RootDirectory',
383
+ 'ORKEON_Orkeon__Cli__Memory__RootDirectory', 'Orkeon__Embeddings__FingerprintPath',
379
384
  'ORKEON_ESBUILD_PATH',
380
385
  'ORKEON_ALLOW_EXTERNAL_MOUNTS', 'WHISPER_AUDIO_DIR', 'WHISPER_OUT_DIR',
381
386
  'ORKEON_MCP__Servers__whisper__Transport', 'ORKEON_MCP__Servers__whisper__Command',
382
- 'ORKEON_MCP__Servers__whisper__TrustAnnotations',
387
+ 'ORKEON_MCP__Servers__whisper__TrustAnnotations', 'ORKEON_MCP__Servers__whisper__CallTimeout',
383
388
  'ORKEON_MCP__Servers__whisper__Args__0', 'ORKEON_MCP__Servers__whisper__Args__1',
384
389
  'ORKEON_MCP__Servers__whisper__Args__2', 'ORKEON_MCP__Servers__whisper__Args__3',
385
390
  'ORKEON_MCP__Servers__whisper__Args__4', 'ORKEON_MCP__Servers__whisper__Args__5',
@@ -387,7 +392,8 @@ foreach ($name in @('ORKEON_Llm__Model', 'Orkeon__Security__PermissionGate__Enab
387
392
  'ORKEON_MCP__Servers__whisper__Args__8', 'ORKEON_MCP__Servers__whisper__Args__9',
388
393
  'ORKEON_MCP__Servers__whisper__Args__10', 'ORKEON_MCP__Servers__whisper__Args__11',
389
394
  'ORKEON_MCP__Servers__whisper__Args__12',
390
- 'WHISPER_MICROPHONE', 'WHISPER_SPEAKER', 'UV_PROJECT_ENVIRONMENT')) {
395
+ 'WHISPER_MICROPHONE', 'WHISPER_SPEAKER', 'UV_PROJECT_ENVIRONMENT',
396
+ 'GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL')) {
391
397
  $savedEnv[$name] = [Environment]::GetEnvironmentVariable($name)
392
398
  }
393
399
  try {
@@ -395,7 +401,7 @@ try {
395
401
  # The pin is a commit of Orkeon's main (.orkeon-version, ADR 0013): the tool and docker modes run a release.
396
402
  $OrkeonRef = (Get-Content (Join-Path $Root '.orkeon-version') -Raw).Trim()
397
403
  $OrkeonPin = $OrkeonRef.Substring(0, 7)
398
- $Image = if ($env:ORKEON_CODE_IMAGE) { $env:ORKEON_CODE_IMAGE } else { 'ghcr.io/orkeon/orkeon-runners:latest' }
404
+ $Image = if ($env:ORKEON_CODE_IMAGE) { $env:ORKEON_CODE_IMAGE } else { 'ghcr.io/orkeon/orkeon:latest' }
399
405
  $codeVersion = (Get-Content (Join-Path $Root 'package.json') -Raw | ConvertFrom-Json).version
400
406
  # A clone (a .git, or the tests of an unpacked source archive) or an install, whose folder is never written to:
401
407
  # an install's state goes under ORKEON_CODE_HOME (%USERPROFILE%\.orkeon-code).
@@ -647,6 +653,8 @@ try {
647
653
  if (-not $env:Orkeon__Cli__Session__Persist) { $env:Orkeon__Cli__Session__Persist = 'true' }
648
654
  $env:ORKEON_Orkeon__Cli__Session__SessionsDirectory = '/sessions'
649
655
  $env:ORKEON_Orkeon__Cli__Memory__RootDirectory = '/memory'
656
+ # The embedding model's fingerprint beside the RAG's manifests, in /output, not in the project (see ./orkeon-code).
657
+ if (-not $env:Orkeon__Embeddings__FingerprintPath) { $env:Orkeon__Embeddings__FingerprintPath = '/output/rag/embedding-fingerprint.json' }
650
658
 
651
659
  # Speech-to-text (optional): $env:ORKEON_CODE_AUDIO_DIR names the folder of audio and video files. The
652
660
  # Whisper MCP server (mcp/whisper), started by the REPL over stdio, reads it and writes into
@@ -678,6 +686,9 @@ try {
678
686
  $env:ORKEON_MCP__Servers__whisper__Command = $uv.Source
679
687
  # The gate reads the server's annotations (readOnlyHint) only when the server is trusted (Orkeon #223).
680
688
  $env:ORKEON_MCP__Servers__whisper__TrustAnnotations = 'true'
689
+ # The runtime ends a server call after CallTimeout, 60 s by default (Orkeon #299): a dictation records up to
690
+ # /voice --max (600 s) then transcribes.
691
+ $env:ORKEON_MCP__Servers__whisper__CallTimeout = '00:15:00'
681
692
  $whisperArgs = @('run', '--project', (Join-Path $Root 'mcp/whisper'))
682
693
  # An install's folder is never written to: uv keeps the server's environment under ORKEON_CODE_HOME and
683
694
  # reads uv.lock as shipped.
@@ -750,6 +761,89 @@ try {
750
761
  '--mount', "${projectState}/memory:/memory:rw")
751
762
  }
752
763
 
764
+ # The physical folders of tool mode's mounts, in Get-ReplArgs order from <workspace>.
765
+ $hostMounts = @($Workspace, (Join-Path $State 'output'), (Join-Path $State 'tmp'), $userConfigDir, $projectState)
766
+
767
+ # A mount's base as Windows spells it: absolute, backslashes, no trailing separator but a drive root's (C:\); a UNC
768
+ # path resolved by its provider.
769
+ function Get-WindowsBase([string] $path) {
770
+ if ($path.StartsWith('\\') -or $path.StartsWith('//')) {
771
+ $resolved = Resolve-Path -LiteralPath $path -ErrorAction SilentlyContinue
772
+ if ($resolved) { $path = $resolved.ProviderPath }
773
+ }
774
+ $full = [IO.Path]::GetFullPath(($path -replace '/', '\'))
775
+ if ($full -match '^[A-Za-z]:\\$') { $full } else { $full.TrimEnd('\', '/') }
776
+ }
777
+
778
+ # launch.json, beside config.json on /user-config, as ./orkeon-code writes it: the host the REPL runs on (windows
779
+ # here, posix or wsl under pwsh elsewhere) and the physical base of each mount, the very string given to --mount,
780
+ # with its Windows spelling. Docker mode hides the host on purpose: posix, no mount. Rewritten at every start. What
781
+ # it reads beyond the rest of the launcher: WSL_DISTRO_NAME, and ORKEON_CODE_PROC_VERSION (the tests' /proc/version).
782
+ function Write-LaunchFile {
783
+ $ErrorActionPreference = 'Continue'
784
+ $file = Join-Path $userConfigDir 'launch.json'
785
+ $procVersion = if ($env:ORKEON_CODE_PROC_VERSION) { $env:ORKEON_CODE_PROC_VERSION } else { '/proc/version' }
786
+ $flavour = if ($Mode -eq 'docker') { 'posix' }
787
+ elseif ($IsWindows -or $PSVersionTable.PSEdition -eq 'Desktop') { 'windows' }
788
+ elseif ($env:WSL_DISTRO_NAME -or ((Test-Path -LiteralPath $procVersion) -and
789
+ "$(Get-Content -LiteralPath $procVersion -Raw -ErrorAction SilentlyContinue)" -match 'microsoft')) { 'wsl' }
790
+ else { 'posix' }
791
+ $wslpath = $null
792
+ if ($flavour -eq 'wsl') {
793
+ $wslpath = Get-Command wslpath -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
794
+ if (-not $wslpath) { Write-Warning "wslpath is not on PATH: $file gives no Windows spelling of the mounts." }
795
+ }
796
+ $launch = [ordered]@{ version = 1; flavour = $flavour; mode = $Mode }
797
+ if ($flavour -eq 'wsl') {
798
+ # The distribution: WSL_DISTRO_NAME, else the share of `wslpath -w /` (\\wsl.localhost\<distro>\ or \\wsl$\<distro>\).
799
+ $distro = $env:WSL_DISTRO_NAME
800
+ if (-not $distro -and $wslpath -and "$(& $wslpath.Source -w / 2>$null)" -match '^\\\\wsl(\.localhost|\$)\\([^\\]+)') {
801
+ $distro = $Matches[2]
802
+ }
803
+ # Where the Windows drives are mounted: `wslpath -u 'C:\'` less its /c, else [automount] root= of /etc/wsl.conf,
804
+ # else /mnt.
805
+ $automount = $null
806
+ $drive = if ($wslpath) { "$(& $wslpath.Source -u 'C:\' 2>$null)" } else { '' }
807
+ if ($drive) { $automount = $drive.TrimEnd('/') -replace '/c$', ''; if (-not $automount) { $automount = '/' } }
808
+ else {
809
+ $section = ''
810
+ foreach ($line in @(Get-Content -LiteralPath '/etc/wsl.conf' -ErrorAction SilentlyContinue)) {
811
+ if ($line -match '^\s*\[([^\]]*)\]') { $section = $Matches[1].Trim().ToLowerInvariant() }
812
+ elseif ($section -eq 'automount' -and $line -match '^\s*root\s*=\s*"?([^"]*?)"?\s*$' -and $Matches[1]) {
813
+ $automount = $Matches[1].TrimEnd('/'); if (-not $automount) { $automount = '/' }
814
+ break
815
+ }
816
+ }
817
+ if (-not $automount) { $automount = '/mnt' }
818
+ }
819
+ $launch['wsl'] = [ordered]@{ distro = $(if ($distro) { $distro } else { $null }); automountRoot = $automount }
820
+ }
821
+ $mounts = [ordered]@{}
822
+ if ($Mode -ne 'docker') {
823
+ $pairs = @(Get-ReplArgs '' '' '' @hostMounts) + @($audioArgs)
824
+ for ($i = 1; $i -lt $pairs.Count; $i++) {
825
+ if ($pairs[$i - 1] -cne '--mount' -or $pairs[$i] -notmatch '^(.*):([^:]+):([^:]+)$') { continue }
826
+ $base = $Matches[1]; $root = $Matches[2]
827
+ $mount = [ordered]@{}
828
+ if ($flavour -eq 'windows') { $mount['windows'] = Get-WindowsBase $base }
829
+ else {
830
+ $mount['posix'] = $base
831
+ if ($flavour -eq 'wsl') {
832
+ $spelled = if ($wslpath) { "$(& $wslpath.Source -w $base 2>$null)" } else { '' }
833
+ $mount['windows'] = $(if ($spelled) { $spelled } else { $null })
834
+ }
835
+ }
836
+ $mounts[$root] = $mount
837
+ }
838
+ }
839
+ $launch['mounts'] = $mounts
840
+ try {
841
+ # UTF-8 without a BOM on Windows PowerShell 5.1 too (Set-Content would write a BOM, or UTF-16).
842
+ [System.IO.File]::WriteAllText($file, ($launch | ConvertTo-Json -Depth 5 -Compress) + "`n", (New-Object System.Text.UTF8Encoding $false))
843
+ } catch { Write-Warning "Could not write $file." }
844
+ }
845
+ Write-LaunchFile
846
+
753
847
  # The exchange log (--llm-log) would land in ./llm-logs, the project: a bare --llm-log among the REPL's arguments
754
848
  # is sent to <projectState>/llm-logs instead; an explicit --llm-log-path is passed as given.
755
849
  function Get-LlmLogArgs($projectState) {
@@ -758,18 +852,42 @@ try {
758
852
  foreach ($a in $Extra) { if ($a -ceq '--llm-log') { if (-not $named) { '--llm-log-path'; "$projectState/llm-logs" } } else { $a } }
759
853
  }
760
854
 
855
+ # Whether the Docker engine answers. Its own function, so the launcher's 'Stop' does not turn a warning on stderr
856
+ # into a failure.
857
+ function Test-DockerEngine {
858
+ $ErrorActionPreference = 'Continue'
859
+ & docker version --format '{{.Server.Version}}' 2>$null | Out-Null
860
+ $LASTEXITCODE -eq 0
861
+ }
862
+
761
863
  if ($Mode -eq 'docker') {
864
+ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { throw 'docker not found.' }
865
+ # `docker run` alone would answer with the pipe or the socket it could not open, and nothing about what to do.
866
+ if (-not (Test-DockerEngine)) {
867
+ throw 'The Docker engine does not answer: start Docker Desktop or the Docker service, then run orkeon-code again. Without Docker, install the orkeon-repl tool (docs/getting-started.md).'
868
+ }
762
869
  # Everything under the working directory /work. The image is multi-arch (linux/amd64, linux/arm64).
763
- $envArgs = @('-e', 'ORKEON_RUNNER=repl', '-e', 'HOME=/tmp', '-e', 'DOTNET_CLI_HOME=/tmp',
870
+ $envArgs = @('-e', 'ORKEON_ENTRYPOINT=repl', '-e', 'HOME=/tmp', '-e', 'DOTNET_CLI_HOME=/tmp',
764
871
  '-e', "Orkeon__Security__PermissionGate__Enabled=$env:Orkeon__Security__PermissionGate__Enabled",
765
872
  '-e', "Orkeon__Cli__Session__StartScript=$env:Orkeon__Cli__Session__StartScript",
766
873
  '-e', "Orkeon__Cli__Session__Persist=$env:Orkeon__Cli__Session__Persist",
767
874
  '-e', 'ORKEON_Orkeon__Cli__Session__SessionsDirectory=/sessions',
768
- '-e', 'ORKEON_Orkeon__Cli__Memory__RootDirectory=/memory')
875
+ '-e', 'ORKEON_Orkeon__Cli__Memory__RootDirectory=/memory',
876
+ '-e', "Orkeon__Embeddings__FingerprintPath=$env:Orkeon__Embeddings__FingerprintPath")
769
877
  # The github tool's token (Orkeon #222): GITHUB_TOKEN, GH_TOKEN, or the variable Orkeon__Tools__GitHub__TokenVariable
770
878
  # names, each handed over only when set, with the setting itself so the runtime reads the same variable.
771
879
  $tokenVar = [Environment]::GetEnvironmentVariable('Orkeon__Tools__GitHub__TokenVariable')
772
- foreach ($v in @('ORKEON_Llm__ApiKey', 'ORKEON_Llm__Model', $keyVar, 'GITHUB_TOKEN', 'GH_TOKEN', 'Orkeon__Tools__GitHub__TokenVariable', $tokenVar)) {
880
+ # The identity of a commit made in the container (the image sets none, Orkeon #404): each of the four variables
881
+ # already set is kept, one unset takes the user.name or user.email git gives on the host for the workspace.
882
+ if (Get-Command git -ErrorAction SilentlyContinue) {
883
+ $gitName = (& git -C $Workspace config --get user.name 2>$null)
884
+ $gitEmail = (& git -C $Workspace config --get user.email 2>$null)
885
+ foreach ($pair in @(@('GIT_AUTHOR_NAME', $gitName), @('GIT_COMMITTER_NAME', $gitName), @('GIT_AUTHOR_EMAIL', $gitEmail), @('GIT_COMMITTER_EMAIL', $gitEmail))) {
886
+ if (-not [Environment]::GetEnvironmentVariable($pair[0]) -and $pair[1]) { [Environment]::SetEnvironmentVariable($pair[0], [string]$pair[1]) }
887
+ }
888
+ }
889
+ foreach ($v in @('ORKEON_Llm__ApiKey', 'ORKEON_Llm__Model', $keyVar, 'GITHUB_TOKEN', 'GH_TOKEN', 'Orkeon__Tools__GitHub__TokenVariable', $tokenVar,
890
+ 'GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL')) {
773
891
  if ($v -and [Environment]::GetEnvironmentVariable($v)) { $envArgs += @('-e', $v) }
774
892
  }
775
893
  $inState = if ($projectRel) { "/work/state/$projectRel" } else { '/work/state' }
@@ -813,7 +931,7 @@ try {
813
931
  $env:ORKEON_ESBUILD_PATH = $found.FullName
814
932
  }
815
933
  $replArgs = Get-ReplArgs (Join-Path $Root 'src/commands') (Join-Path $Root 'src/crews') $(if ($runtimeOwn) { '' } else { $Settings }) `
816
- $Workspace (Join-Path $State 'output') (Join-Path $State 'tmp') $userConfigDir $projectState
934
+ @hostMounts
817
935
  $Extra = @(Get-LlmLogArgs $projectState)
818
936
  # The REPL runs from the project. It reads its --commands-dir and --crews-dir wherever they are, and
819
937
  # a --mount outside its working directory (/output, /tmp, /user-config, /sessions, /session-history and /memory, in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orkeon-code",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.3",
4
4
  "description": "Agentic coding assistant in TypeScript on the Orkeon runtime. Pair with it in the terminal under permission modes, run it fully autonomous in a pipeline, or call its crews from your own application. Every command, crew and prompt is a source file you can change or add to.",
5
5
  "license": "MIT",
6
6
  "author": "Orkeon Contributors",
@@ -23,6 +23,7 @@
23
23
  "src/",
24
24
  "config/*.example.json",
25
25
  "scripts/setup-fixture.sh",
26
+ "scripts/dev-run.sh",
26
27
  "scripts/session-start.sh",
27
28
  "scripts/session-start.ork.ts",
28
29
  "scripts/install.sh",
@@ -32,6 +33,7 @@
32
33
  "mcp/whisper/uv.lock",
33
34
  "mcp/whisper/README.md",
34
35
  ".orkeon-version",
36
+ ".orkeon-runtime",
35
37
  "NOTICE.md"
36
38
  ],
37
39
  "engines": {
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env bash
2
+ # Chain the steps of a dev crew headless, one fresh `orkeon run` process per step, until the
3
+ # work code's event log says the batches are closed, a human must decide, or nothing moved.
4
+ #
5
+ # bash scripts/dev-run.sh <crew> <code> --inputs '<json>' [--log <file>] [--max-steps N] [--wait S] [--retries N]
6
+ # ORKEON_CODE_WORKSPACE=~/src/app bash scripts/dev-run.sh dev-verify demo --inputs '{"batch":"F2","plan":"demo"}' \
7
+ # --log workbench/demo/DEMO-BATCHES-STATE.md
8
+ #
9
+ # Each step runs `orkeon-code run <crew> --workspace <project> --inputs <json>`;
10
+ # the inputs are the crew's own (its crew.ork.ts header names them), required. A crew run
11
+ # this way gets none of what its command does first: /dev-verify's check that the gate is
12
+ # on and its rule sets are not applied. The launcher passes the settings, the model and the
13
+ # mounts, as for the REPL (ORKEON_CODE_SETTINGS, ORKEON_CODE_MODEL; ORKEON_CODE_MODE=source with
14
+ # ORKEON_SOURCE runs the tool from an Orkeon checkout). DEV_RUN_RUNNER names another
15
+ # command, given the crew and --inputs alone (a fake in the tests): it passes its own `-s` and
16
+ # `-m`, or the crew runs on no settings and no mount. A step's output goes to <project>/.orkeon/dev/<code>/runs/<crew>-<n>.log, never
17
+ # whole to the terminal: its last line is shown. <project> is ORKEON_CODE_WORKSPACE, else
18
+ # the working directory. After each step:
19
+ # exit 130 (cancelled) or 1 (script error) -> stop with that code
20
+ # exit 75 (a question kept by checkpointing) -> exit 3 (a human answers it: orkeon run --resume)
21
+ # exit 2 with a rate limit in the log -> wait --wait seconds (default 60) and
22
+ # run it again, --retries times (default 2);
23
+ # then stop with 2
24
+ # exit 2 otherwise -> stop with 2
25
+ # exit 0 -> the last line of the event log, .orkeon/dev/<code>/batches-state.md, or the
26
+ # file --log names (relative to the project). /dev-batches writes Code's own log; a
27
+ # step that drives one batch alone (/dev-implement) does not: name a log it moves.
28
+ # `closed` (the line `- <date> <time> closed`, a trailing blank or CR aside) -> exit 0; an event whose
29
+ # detail starts with BLOCKED or GAPS -> exit 3 (a human decides);
30
+ # the same line as before the step -> exit 4 (no progress: never loop); else the next step.
31
+ # --max-steps (default 10) reached -> exit 5. Usage errors -> exit 64; the crew dev-batches is refused (64): a run
32
+ # of a whole plan without anyone at the keyboard stays the REPL's /dev-batches (docs/headless.md).
33
+ # Without DEV_RUN_RUNNER the project's trust is checked once, before the first step, where a terminal can answer:
34
+ # declined -> exit 0, nothing run; refused (no terminal) -> exit 2. Each step then runs with no stdin, so
35
+ # nothing it asks can hang the chain.
36
+ set -euo pipefail
37
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
38
+
39
+ usage() { echo "usage: scripts/dev-run.sh <crew> <code> --inputs '<json>' [--log <file>] [--max-steps N] [--wait S] [--retries N]" >&2; exit 64; }
40
+ [ $# -ge 2 ] || usage
41
+ crew="$1"; code="$2"; shift 2
42
+ case "$crew" in ''|*[!a-z0-9-]*) echo "dev-run: '$crew' is not a crew name" >&2; exit 64 ;; esac
43
+ case "$code" in ''|.*|*[!A-Za-z0-9._-]*) echo "dev-run: '$code' is not a work code" >&2; exit 64 ;; esac
44
+ if [ "$crew" = dev-batches ]; then
45
+ echo "dev-run: the crew dev-batches only names the next batch and logs it launched: a run of a whole plan without" \
46
+ "anyone at the keyboard stays the REPL's /dev-batches" >&2
47
+ exit 64
48
+ fi
49
+ inputs=""; log_file=""; max_steps=10; wait_s=60; retries=2
50
+ number() { case "$2" in ''|*[!0-9]*) echo "dev-run: $1 takes a whole number, not '$2'" >&2; exit 64 ;; esac; }
51
+ while [ $# -gt 0 ]; do
52
+ case "$1" in
53
+ --inputs) [ $# -ge 2 ] || usage; inputs="$2"; shift 2 ;;
54
+ --log) [ $# -ge 2 ] || usage; log_file="$2"; shift 2 ;;
55
+ --max-steps) [ $# -ge 2 ] || usage; number "$1" "$2"; max_steps="$2"; shift 2 ;;
56
+ --wait) [ $# -ge 2 ] || usage; number "$1" "$2"; wait_s="$2"; shift 2 ;;
57
+ --retries) [ $# -ge 2 ] || usage; number "$1" "$2"; retries="$2"; shift 2 ;;
58
+ *) usage ;;
59
+ esac
60
+ done
61
+ [ -n "$inputs" ] || { echo "dev-run: --inputs is required: the crew's own inputs (its crew.ork.ts header names them)" >&2; exit 64; }
62
+ [ "$max_steps" -ge 1 ] || { echo "dev-run: --max-steps must be 1 or more" >&2; exit 64; }
63
+
64
+ project="$(cd "${ORKEON_CODE_WORKSPACE:-.}" && pwd)"
65
+ export ORKEON_CODE_WORKSPACE="$project"
66
+ case "$log_file" in /*|*..*) echo "dev-run: --log is a path inside the project, not '$log_file'" >&2; exit 64 ;; esac
67
+ state="$project/${log_file:-.orkeon/dev/$code/batches-state.md}"
68
+ runs="$project/.orkeon/dev/$code/runs"
69
+ crew_file="$ROOT/src/crews/$crew/crew.ork.ts"
70
+ [ -f "$crew_file" ] || { echo "dev-run: no crew '$crew' ($crew_file)" >&2; exit 64; }
71
+
72
+ # The last line not blank, without its CR or trailing blanks (a log edited on Windows).
73
+ last_line() { [ -f "$state" ] && tr -d '\r' <"$state" | sed 's/[[:space:]]*$//' | grep -v '^$' | tail -n 1 || true; }
74
+ next_log() {
75
+ local n=1
76
+ while [ -e "$runs/$crew-$n.log" ]; do n=$((n + 1)); done
77
+ echo "$runs/$crew-$n.log"
78
+ }
79
+ run_once() {
80
+ local log="$1" rc=0
81
+ if [ -n "${DEV_RUN_RUNNER:-}" ]; then
82
+ $DEV_RUN_RUNNER "$crew_file" --inputs "$inputs" </dev/null >"$log" 2>&1 || rc=$?
83
+ else
84
+ bash "$ROOT/orkeon-code" run "$crew_file" --workspace "$project" --inputs "$inputs" </dev/null >"$log" 2>&1 || rc=$?
85
+ fi
86
+ return "$rc"
87
+ }
88
+
89
+ # The trust question asked here, once, with the terminal: in a step it would land in the step's log.
90
+ if [ -z "${DEV_RUN_RUNNER:-}" ]; then
91
+ rc=0; bash "$ROOT/orkeon-code" trust check "$project" || rc=$?
92
+ case "$rc" in
93
+ 0) ;;
94
+ 4) echo "dev-run: $project is not trusted: nothing run"; exit 0 ;;
95
+ *) echo "dev-run: trust $project first (orkeon-code trust add $project), then run this again" >&2; exit 2 ;;
96
+ esac
97
+ fi
98
+ # Nothing is created in the project before its trust is known.
99
+ mkdir -p "$runs"
100
+
101
+ step=0
102
+ while [ "$step" -lt "$max_steps" ]; do
103
+ step=$((step + 1))
104
+ before="$(last_line)"
105
+ attempt=0
106
+ while :; do
107
+ log="$(next_log)"
108
+ rc=0; run_once "$log" || rc=$?
109
+ echo "dev-run: step $step of $crew ($code): exit $rc, log ${log#"$project"/}"
110
+ tail -n 1 "$log" 2>/dev/null | sed 's/^/ last line: /' || true
111
+ # A 429 inside a run is first the runtime's: Llm:MaxRetries, then the profile's Fallback chain (Orkeon #299) when
112
+ # the settings name one. This loop is the whole-process retry, for a step the runtime gave up on.
113
+ if [ "$rc" = 2 ] && grep -qiE 'HTTP[ /0-9.]* 429|status( code)?[ :=]*429|too many requests|rate.?limit|LlmRateLimitException' "$log" && [ "$attempt" -lt "$retries" ]; then
114
+ attempt=$((attempt + 1))
115
+ echo "dev-run: rate limited; waiting ${wait_s}s before attempt $((attempt + 1))"
116
+ sleep "$wait_s"
117
+ continue
118
+ fi
119
+ break
120
+ done
121
+ case "$rc" in
122
+ 0) ;;
123
+ 130) echo "dev-run: cancelled"; exit 130 ;;
124
+ 1) echo "dev-run: the crew failed (script error): see the log"; exit 1 ;;
125
+ 75) echo "dev-run: the step stopped on a question kept by checkpointing (exit 75): a human answers it (orkeon run --resume), see the log"; exit 3 ;;
126
+ *) echo "dev-run: the run failed (exit $rc): see the log"; exit 2 ;;
127
+ esac
128
+ after="$(last_line)"
129
+ if printf '%s\n' "$after" | grep -qE '^- [0-9-]+ [0-9:]+ closed$'; then echo "dev-run: closed"; exit 0; fi
130
+ if printf '%s\n' "$after" | grep -qE '^- [0-9-]+ [0-9:]+ F[0-9]+ [a-z]+ (BLOCKED|GAPS)([^A-Za-z]|$)'; then
131
+ echo "dev-run: a human decides: $after"; exit 3
132
+ fi
133
+ if [ "$after" = "$before" ]; then
134
+ echo "dev-run: no progress (the last line of ${state#"$project"/} did not change): stopped"
135
+ exit 4
136
+ fi
137
+ done
138
+ echo "dev-run: $max_steps step(s) reached: stopped"
139
+ exit 5
@@ -212,9 +212,6 @@ export interface CommandRuntimeContext {
212
212
  * (CLR convention preserved through reflection):
213
213
  * if (ctx.signal.IsCancellationRequested) return ctx.continue("cancelled");
214
214
  * ctx.signal.ThrowIfCancellationRequested();
215
- *
216
- * The `aborted` / `throwIfAborted` aliases on `CommandSignal` are a TypeScript-only
217
- * documentation convenience; at runtime, use the PascalCase members.
218
215
  */
219
216
  readonly signal: CommandSignal;
220
217
 
@@ -448,7 +445,7 @@ export interface PendingApproval {
448
445
  * the channel are the ones `orkeon doctor` prints; `version + "+" + commit` is the full build version.
449
446
  */
450
447
  export interface RuntimeInfo {
451
- /** The release, build metadata removed (`1.0.0-rc.6`); `"unknown"` when the host carries none. */
448
+ /** The release, build metadata removed (`1.0.0`); `"unknown"` when the host carries none. */
452
449
  readonly version: string;
453
450
  /** The commit sha the build was made from (the metadata after `+`); null when the version carries none. */
454
451
  readonly commit: string | null;
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { MEMORY_CATEGORIES } from "../../shared/domain/agent-policy/memory-categories.ts";
6
6
  import { SNIP_COMMAND_TURNS } from "../../shared/domain/compaction-thresholds.ts";
7
+ import { argumentsNotJson, argumentsNotObject, DEBUG_TOOL_CALL_USAGE, notAToolName } from "./messages.ts";
7
8
 
8
9
  export type ParsedMemory =
9
10
  | { sub: "add"; category: string; content: string }
@@ -171,10 +172,10 @@ export type ParsedToolCall =
171
172
  export function parseToolCallArgs(tokens: string[]): ParsedToolCall {
172
173
  const tool = String(tokens?.[0] ?? "").trim();
173
174
  if (tool.length === 0) {
174
- return { ok: false, reason: "usage: /debug-tool-call <tool_name> [{\"arg\": \"value\"}]" };
175
+ return { ok: false, reason: DEBUG_TOOL_CALL_USAGE };
175
176
  }
176
177
  if (!/^[a-z][a-z0-9_]*$/i.test(tool)) {
177
- return { ok: false, reason: `'${tool}' is not a tool name (expected snake_case, e.g. file_read)` };
178
+ return { ok: false, reason: notAToolName(tool) };
178
179
  }
179
180
 
180
181
  const payload = tokens.slice(1).join(" ").trim();
@@ -184,10 +185,10 @@ export function parseToolCallArgs(tokens: string[]): ParsedToolCall {
184
185
  try {
185
186
  parsed = JSON.parse(payload);
186
187
  } catch (e: any) {
187
- return { ok: false, reason: `arguments are not valid JSON (${String(e?.message ?? e)}): ${payload}` };
188
+ return { ok: false, reason: argumentsNotJson(String(e?.message ?? e), payload) };
188
189
  }
189
190
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
190
- return { ok: false, reason: `arguments must be a JSON OBJECT, got ${Array.isArray(parsed) ? "an array" : typeof parsed}` };
191
+ return { ok: false, reason: argumentsNotObject(Array.isArray(parsed) ? "an array" : typeof parsed) };
191
192
  }
192
193
  return { ok: true, tool, args: parsed as Record<string, unknown> };
193
194
  }
@@ -28,15 +28,14 @@ import { workspaceRelative } from "../../../shared/domain/vfs.ts";
28
28
  import type { ConfigStore } from "../../../shared/application/config-store.ts";
29
29
  import { launchCrew, withLlmProfile } from "../dispatch.ts";
30
30
  import type { CommandLog, CrewCompletion, LaunchDeps } from "../dispatch.ts";
31
- import { chainStep, freshContext, launchChained, nextLaunch, withContext, CONTEXT_NOT_READ_LINE } from "./dev-implement.ts";
31
+ import { chainStep, freshContext, launchChained, nextLaunch, withContext } from "./dev-implement.ts";
32
32
  import type { ChainHopDeps, ChainLaunch, DevImplementArgs, DevImplementDispatchDeps } from "./dev-implement.ts";
33
33
  import { devVerifyStep, markActiveWorkflow, startDevStep, writeModeRefusal } from "../dev-step.ts";
34
34
  import { storedEffort } from "../effort.ts";
35
+ import { AUDIT_OR_CORRECTION, A_CREW, CHAIN_FAILED_THEN, CONCURRENCY_NEEDS_NUMBER, CONTEXT_NOT_READ_LINE, CORRECTION_OR_CLOSE, DEV_BATCHES_USAGE, WRITES_COMMITS_PUSHES, auditFailed, auditUnknownOption, batchUnknownOption, batchesChainFailed, batchesChainStopped, chainNotKept, concurrencyNotWithBatch, correctionNamesBatch, correctionNamesFinding, devBatchesRefusal, goesWithAudit, namesItsBatch, namesItsBatchFirst, notAWorkCodeExplained, oneAuditMode, oneBatchAtMost, oneCodeAtMost, onePlanAtMost, prGoesWithClose, runUnknownOption, thenType } from "./messages.ts";
36
+ import { neitherCodeNorPlan as notACodeNorPlan } from "../../../shared/application/dev/messages.ts";
37
+ import { failedLine } from "../messages.ts";
35
38
 
36
- export const DEV_BATCHES_USAGE =
37
- "usage: /dev-batches [<code>] [--pr] [--concurrency n] | <code> F<n> [--close [--pr]] [— correction: <finding>]" +
38
- " | <code> F<n> --audit [fast | full | resume] [--gate-only]" +
39
- " (no code: the run in progress goes on; n from 1 to 4, above 1 in bypassPermissions; with F<n>, <code> may be a <path>/<CODE>-PLAN.md)";
40
39
  /** `concurrency` only when the option is typed: without it the run goes on as the plan's run in progress was (one at a
41
40
  * time when none is); `--concurrency 1` goes back to one at a time. */
42
41
  export interface DevBatchesArgs { code: string | null; pr: boolean; concurrency?: number }
@@ -61,7 +60,7 @@ const CORRECTION_WORD = /^correction:?(.*)$/i;
61
60
  const BATCH_OPTIONS: readonly string[] = ["--close", "--audit", "--gate-only"];
62
61
  const isConcurrency = (tok: string): boolean => tok === "--concurrency" || tok.startsWith("--concurrency=");
63
62
  type Refusal = { ok: false; text: string };
64
- const refuse = (text: string): Refusal => ({ ok: false, text: `dev-batches: ${text}` });
63
+ const refuse = (text: string): Refusal => ({ ok: false, text: devBatchesRefusal(text) });
65
64
 
66
65
  /** Splits `… — correction: <finding>` off the tokens: the ones before, and the finding (null without one). */
67
66
  function splitCorrection(tokens: readonly string[]): { before: string[]; finding: string | null } {
@@ -97,17 +96,17 @@ function parseRun(tokens: readonly string[]): DevBatchesParse {
97
96
  const tok = tokens[i];
98
97
  if (isConcurrency(tok)) {
99
98
  const value = tok === "--concurrency" ? tokens[++i] : tok.slice("--concurrency=".length);
100
- if (value === undefined) return refuse("--concurrency needs a number");
99
+ if (value === undefined) return refuse(CONCURRENCY_NEEDS_NUMBER);
101
100
  const c = checkConcurrency(value);
102
101
  if (!c.ok) return refuse(c.line);
103
102
  concurrency = c.value;
104
103
  continue;
105
104
  }
106
105
  if (tok === "--pr") pr = true;
107
- else if (BATCH_OPTIONS.includes(tok)) return refuse(`${tok} names its batch: /dev-batches <code> F<n> ${tok}`);
108
- else if (tok.startsWith("-")) return refuse(`unknown option '${tok}' (--pr, --concurrency; with F<n>: --close, --audit)`);
109
- else if (!isCode(tok)) return refuse(`'${tok}' is not a work code (a folder name of the work folder)`);
110
- else if (code !== null) return refuse(`one code at most, not '${code}' and '${tok}'`);
106
+ else if (BATCH_OPTIONS.includes(tok)) return refuse(namesItsBatch(tok));
107
+ else if (tok.startsWith("-")) return refuse(runUnknownOption(tok));
108
+ else if (!isCode(tok)) return refuse(notAWorkCodeExplained(tok));
109
+ else if (code !== null) return refuse(oneCodeAtMost(code, tok));
111
110
  else code = tok;
112
111
  }
113
112
  const args = concurrency !== undefined ? { code, pr, concurrency } : { code, pr };
@@ -117,7 +116,7 @@ function parseRun(tokens: readonly string[]): DevBatchesParse {
117
116
  /** One batch: its plan, the close (`--pr` only with it), or a correction (never with the close). */
118
117
  function parseBatch(batch: string, rest: readonly string[], finding: string | null): DevBatchesParse {
119
118
  if (finding !== null && finding === "") {
120
- return refuse(`a correction names its finding: ${correctionCommand("<code>", batch, "<the audit's gap>")}`);
119
+ return refuse(correctionNamesFinding(correctionCommand("<code>", batch, "<the audit's gap>")));
121
120
  }
122
121
  let plan: string | null = null;
123
122
  let close = false;
@@ -125,15 +124,15 @@ function parseBatch(batch: string, rest: readonly string[], finding: string | nu
125
124
  for (const tok of rest) {
126
125
  if (tok === "--close") close = true;
127
126
  else if (tok === "--pr") pr = true;
128
- else if (AUDIT_MODES.includes(tok) || tok === "--gate-only") return refuse(`'${tok}' goes with --audit: /dev-batches <code> ${batch} --audit ${tok}`);
129
- else if (tok.startsWith("-")) return refuse(`unknown option '${tok}' with ${batch} (--close, --pr, --audit)`);
127
+ else if (AUDIT_MODES.includes(tok) || tok === "--gate-only") return refuse(goesWithAudit(tok, batch));
128
+ else if (tok.startsWith("-")) return refuse(batchUnknownOption(tok, batch));
130
129
  else if (isCode(tok) || isPlanPath(tok, false)) {
131
- if (plan !== null) return refuse(`one plan at most, not '${plan}' and '${tok}'`);
130
+ if (plan !== null) return refuse(onePlanAtMost(plan, tok));
132
131
  plan = tok;
133
- } else return refuse(`'${tok}' is neither a code nor a <CODE>-PLAN.md path`);
132
+ } else return refuse(notACodeNorPlan(tok));
134
133
  }
135
- if (pr && !close) return refuse(`with ${batch}, --pr goes with --close (the pull request is opened at the close)`);
136
- if (close && finding !== null) return refuse("a correction runs the batch, --close commits it: one at a time");
134
+ if (pr && !close) return refuse(prGoesWithClose(batch));
135
+ if (close && finding !== null) return refuse(CORRECTION_OR_CLOSE);
137
136
  return { ok: true, route: "batch", args: { batch, plan, close, pr, correction: finding } };
138
137
  }
139
138
 
@@ -145,17 +144,17 @@ function parseAudit(batch: string, rest: readonly string[]): DevBatchesParse {
145
144
  let gateOnly = false;
146
145
  for (const tok of rest) {
147
146
  if (AUDIT_MODES.includes(tok)) {
148
- if (mode !== null) return refuse(`one audit mode at most (fast, full or resume), not '${mode}' and '${tok}'`);
147
+ if (mode !== null) return refuse(oneAuditMode(mode, tok));
149
148
  mode = tok as DevVerifyMode;
150
149
  } else if (tok === "--gate-only") {
151
150
  gateOnly = true;
152
151
  } else if (tok.startsWith("-")) {
153
- return refuse(`unknown option '${tok}' with --audit (only --gate-only)`);
152
+ return refuse(auditUnknownOption(tok));
154
153
  } else if (isCode(tok) || isPlanPath(tok, true)) {
155
- if (plan !== null) return refuse(`one plan at most, not '${plan}' and '${tok}'`);
154
+ if (plan !== null) return refuse(onePlanAtMost(plan, tok));
156
155
  plan = tok;
157
156
  } else {
158
- return refuse(`'${tok}' is neither a code nor a <CODE>-PLAN.md path`);
157
+ return refuse(notACodeNorPlan(tok));
159
158
  }
160
159
  }
161
160
  return { ok: true, route: "audit", args: { batch, plan, mode: mode ?? "fast", gateOnly } };
@@ -172,18 +171,18 @@ export function parseDevBatchesArgs(tokens: readonly string[], typed = "dev-batc
172
171
  const audit = typed === DEV_VERIFY_ALIAS || before.includes("--audit");
173
172
  if (at < 0) {
174
173
  if (typed === DEV_IMPLEMENT_ALIAS || typed === DEV_VERIFY_ALIAS) {
175
- return tokens.length === 0 ? { ok: false, text: DEV_BATCHES_USAGE } : refuse(`/${typed} names its batch first: F<n>, e.g. F2`);
174
+ return tokens.length === 0 ? { ok: false, text: DEV_BATCHES_USAGE } : refuse(namesItsBatchFirst(typed));
176
175
  }
177
- if (finding !== null) return refuse(`a correction names its batch: ${correctionCommand("<code>", "F<n>", "<finding>")}`);
176
+ if (finding !== null) return refuse(correctionNamesBatch(correctionCommand("<code>", "F<n>", "<finding>")));
178
177
  return parseRun(before);
179
178
  }
180
179
  const batch = before[at];
181
180
  const rest = [...before.slice(0, at), ...before.slice(at + 1)];
182
181
  const other = rest.find((t) => BATCH.test(t));
183
- if (other !== undefined) return refuse(`one batch at most, not ${batch} and ${other}`);
184
- if (rest.some(isConcurrency)) return refuse(`--concurrency runs a plan's batches: it does not go with ${batch}`);
182
+ if (other !== undefined) return refuse(oneBatchAtMost(batch, other));
183
+ if (rest.some(isConcurrency)) return refuse(concurrencyNotWithBatch(batch));
185
184
  if (!audit) return parseBatch(batch, rest, finding);
186
- if (finding !== null) return refuse("--audit judges the batch, a correction runs it: one at a time");
185
+ if (finding !== null) return refuse(AUDIT_OR_CORRECTION);
187
186
  return parseAudit(batch, rest.filter((t) => t !== "--audit"));
188
187
  }
189
188
 
@@ -198,7 +197,7 @@ export function batchesLaunchInput(args: DevBatchesArgs, read: Record<string, un
198
197
  /** Above 1, the refusal of a session mode that asks before shell commands, before anything is launched. */
199
198
  export function batchesModeRefusal(args: DevBatchesArgs, mode: string): string | null {
200
199
  const line = concurrencyModeRefusal(args.concurrency ?? 1, mode);
201
- return line === null ? null : `dev-batches: ${line}`;
200
+ return line === null ? null : devBatchesRefusal(line);
202
201
  }
203
202
 
204
203
  /** The lines of an answer handed back to the dev-batches crew. */
@@ -247,8 +246,7 @@ export function batchesChainStep(intent: string, payload: string): BatchesChainS
247
246
  /** Every hop of the run keeps the depth of the instance whose `completed` launches it (Orkeon #221). */
248
247
  export const BATCHES_CHAIN: CrewLaunchOptions = { chain: "continue" };
249
248
 
250
- const BATCHES_WRITES = { step: "dev-batches", what: "writes files, commits and pushes" };
251
- const CHAIN_FAILED_THEN = "then type /dev-batches: the run goes on from the first batch not done";
249
+ const BATCHES_WRITES = { step: "dev-batches", what: WRITES_COMMITS_PUSHES };
252
250
 
253
251
  /**
254
252
  * What `completed` prints and launches for one answer of the run, the gate put back and, before a hop that writes
@@ -258,19 +256,19 @@ const CHAIN_FAILED_THEN = "then type /dev-batches: the run goes on from the firs
258
256
  */
259
257
  export async function batchesNextLaunch(result: CrewCompletion, deps: ChainHopDeps): Promise<BatchesChainStep> {
260
258
  if (!result.success) {
261
- return { lines: [`✗ the dev-batches chain failed (${result.intent || "a crew"}): ${result.error ?? "unknown"}`, CHAIN_FAILED_THEN] };
259
+ return { lines: [batchesChainFailed(result.intent || A_CREW, result.error ?? "unknown"), CHAIN_FAILED_THEN] };
262
260
  }
263
261
  const step = batchesChainStep(String(result.intent ?? ""), String(result.payload ?? ""));
264
262
  if (step.launch === undefined) return step;
265
263
  const refusal = deps.reapply(step.launch.crew === "dev-verify" ? "dev-verify" : "dev-implement");
266
- if (refusal !== null) return { lines: [...step.lines, `✗ ${refusal}`, `then type ${step.launch.instead}`] };
264
+ if (refusal !== null) return { lines: [...step.lines, failedLine(refusal), thenType(step.launch.instead)] };
267
265
  if (step.launch.crew === "dev-verify") return step;
268
266
  const context = await freshContext(deps.context);
269
267
  if (context === null) return { lines: [...step.lines, CONTEXT_NOT_READ_LINE], launch: step.launch };
270
268
  const concurrency = step.launch.crew === "dev-batches" && typeof step.launch.input.concurrency === "number" ? step.launch.input.concurrency : 1;
271
269
  const line = writeModeRefusal(context.permissionMode, BATCHES_WRITES.step, BATCHES_WRITES.what)
272
270
  ?? batchesModeRefusal({ code: null, pr: false, concurrency }, context.permissionMode);
273
- if (line !== null) return { lines: [...step.lines, line.startsWith("✗") ? line : `✗ ${line}`, `then type ${step.launch.instead}`] };
271
+ if (line !== null) return { lines: [...step.lines, line.startsWith("✗") ? line : failedLine(line), thenType(step.launch.instead)] };
274
272
  return { lines: step.lines, launch: { ...step.launch, input: withContext(step.launch.input, context) } };
275
273
  }
276
274
 
@@ -281,7 +279,7 @@ export function launchBatchesHop(launch: ChainLaunch, deps: LaunchDeps): string[
281
279
 
282
280
  /** The line `completed` prints when a hop's own reading fails (the context read threw past the handler). */
283
281
  export function batchesHopFailedLine(error: unknown): string {
284
- return `✗ the dev-batches chain stopped (${String((error as Error)?.message ?? error).split("\n")[0]}): ${CHAIN_FAILED_THEN}`;
282
+ return batchesChainStopped(String((error as Error)?.message ?? error).split("\n")[0]);
285
283
  }
286
284
 
287
285
  /** The chain a dispatch launched, kept in the session for `completed`: the run of a plan, one batch, one audit. */
@@ -299,7 +297,7 @@ export async function recordChain(session: Pick<SessionStore, "writeState">, cha
299
297
  } catch (error) {
300
298
  if (chain === "run") return null;
301
299
  const reason = String((error as Error)?.message ?? error).split("\n")[0];
302
- return `dev-batches: the session could not keep which chain runs (${reason}): nothing was launched`;
300
+ return chainNotKept(reason);
303
301
  }
304
302
  }
305
303
 
@@ -326,7 +324,7 @@ export async function devBatchesCompleted(result: CrewCompletion, deps: BatchesC
326
324
  const chain = await readChain(deps.session, String(result.intent ?? ""));
327
325
  if (chain === "audit") {
328
326
  if (result.success && result.streamed === true) return { chain, lines: [] };
329
- return { chain, lines: [result.success ? String(result.payload ?? "") : `✗ the audit failed: ${result.error ?? "unknown"}`] };
327
+ return { chain, lines: [result.success ? String(result.payload ?? "") : auditFailed(result.error ?? "unknown")] };
330
328
  }
331
329
  const step = chain === "batch" ? await nextLaunch(result, deps) : await batchesNextLaunch(result, deps);
332
330
  return { chain, ...step };