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

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 (440) hide show
  1. package/.orkeon-runtime +10 -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 +206 -11
  13. package/orkeon-code.ps1 +109 -7
  14. package/package.json +2 -1
  15. package/src/commands/.orkeon/orkeon-cli.d.ts +1 -4
  16. package/src/commands/_lib/args.ts +5 -4
  17. package/src/commands/_lib/dev/dev-batches.ts +34 -36
  18. package/src/commands/_lib/dev/dev-implement.ts +11 -14
  19. package/src/commands/_lib/dev/dev-source.ts +7 -11
  20. package/src/commands/_lib/dev/dev.ts +34 -37
  21. package/src/commands/_lib/dev/markers.ts +7 -0
  22. package/src/commands/_lib/dev/messages.ts +112 -0
  23. package/src/commands/_lib/dev-step.ts +16 -13
  24. package/src/commands/_lib/dispatch.ts +62 -39
  25. package/src/commands/_lib/git/branch.ts +9 -10
  26. package/src/commands/_lib/git/commit.ts +9 -13
  27. package/src/commands/_lib/git/diff.ts +22 -12
  28. package/src/commands/_lib/git/messages.ts +54 -0
  29. package/src/commands/_lib/git/review.ts +9 -10
  30. package/src/commands/_lib/memory/memory-admit.ts +19 -21
  31. package/src/commands/_lib/memory/memory.ts +3 -2
  32. package/src/commands/_lib/memory/messages.ts +32 -0
  33. package/src/commands/_lib/messages.ts +48 -0
  34. package/src/commands/_lib/project/messages.ts +8 -0
  35. package/src/commands/_lib/session/export.ts +3 -2
  36. package/src/commands/_lib/session/messages.ts +87 -0
  37. package/src/commands/_lib/session/prompts.ts +4 -0
  38. package/src/commands/_lib/session/resume.ts +15 -24
  39. package/src/commands/_lib/session/tasks.ts +20 -23
  40. package/src/commands/_lib/settings/advisor.ts +11 -16
  41. package/src/commands/_lib/settings/agents.ts +18 -28
  42. package/src/commands/_lib/settings/choices.ts +8 -0
  43. package/src/commands/_lib/settings/config.ts +43 -43
  44. package/src/commands/_lib/settings/effort.ts +147 -0
  45. package/src/commands/_lib/settings/hooks.ts +12 -20
  46. package/src/commands/_lib/settings/messages.ts +408 -0
  47. package/src/commands/_lib/settings/mode.ts +33 -24
  48. package/src/commands/_lib/settings/model.ts +71 -36
  49. package/src/commands/_lib/settings/output-style.ts +39 -0
  50. package/src/commands/_lib/settings/permissions.ts +71 -93
  51. package/src/commands/_lib/settings/route.ts +63 -0
  52. package/src/commands/_lib/settings/skills.ts +53 -11
  53. package/src/commands/_lib/settings/theme.ts +42 -0
  54. package/src/commands/_lib/speech/messages.ts +58 -0
  55. package/src/commands/_lib/speech/prompts.ts +4 -0
  56. package/src/commands/_lib/speech/say.ts +9 -10
  57. package/src/commands/_lib/speech/transcribe.ts +14 -23
  58. package/src/commands/_lib/speech/voice.ts +14 -18
  59. package/src/commands/_lib/status/doctor.ts +47 -28
  60. package/src/commands/_lib/status/messages.ts +100 -0
  61. package/src/commands/_lib/status/meta.ts +3 -24
  62. package/src/commands/_lib/status/status.ts +10 -11
  63. package/src/commands/_lib/status/usage-tools.ts +2 -3
  64. package/src/commands/_lib/status/usage.ts +7 -18
  65. package/src/commands/_lib/view.ts +6 -1
  66. package/src/commands/dev/dev-batches.cmd.ts +4 -3
  67. package/src/commands/dev/dev-learn.cmd.ts +3 -3
  68. package/src/commands/dev/dev-plan.cmd.ts +6 -7
  69. package/src/commands/dev/dev-spec.cmd.ts +6 -7
  70. package/src/commands/git/commit.cmd.ts +3 -3
  71. package/src/commands/git/review.cmd.ts +3 -3
  72. package/src/commands/memory/memory.cmd.ts +2 -2
  73. package/src/commands/project/analyze.cmd.ts +3 -3
  74. package/src/commands/project/debug-tool-call.cmd.ts +4 -9
  75. package/src/commands/project/init-verifiers.cmd.ts +3 -3
  76. package/src/commands/project/init.cmd.ts +3 -3
  77. package/src/commands/project/verify.cmd.ts +2 -2
  78. package/src/commands/session/assistant.cmd.ts +2 -2
  79. package/src/commands/session/compact.cmd.ts +1 -1
  80. package/src/commands/session/copy.cmd.ts +8 -7
  81. package/src/commands/session/rename.cmd.ts +3 -2
  82. package/src/commands/session/rewind.cmd.ts +3 -4
  83. package/src/commands/session/summary.cmd.ts +3 -3
  84. package/src/commands/session/tasks.cmd.ts +4 -2
  85. package/src/commands/settings/config.cmd.ts +4 -2
  86. package/src/commands/settings/effort.cmd.ts +10 -31
  87. package/src/commands/settings/fast.cmd.ts +2 -1
  88. package/src/commands/settings/mode.cmd.ts +3 -3
  89. package/src/commands/settings/model.cmd.ts +3 -2
  90. package/src/commands/settings/output-style.cmd.ts +9 -38
  91. package/src/commands/settings/permissions.cmd.ts +2 -2
  92. package/src/commands/settings/proactive.cmd.ts +2 -1
  93. package/src/commands/settings/route.cmd.ts +16 -0
  94. package/src/commands/settings/skills.cmd.ts +3 -3
  95. package/src/commands/settings/theme.cmd.ts +14 -0
  96. package/src/commands/speech/say.cmd.ts +2 -2
  97. package/src/commands/speech/transcribe.cmd.ts +2 -2
  98. package/src/commands/status/release-notes.cmd.ts +1 -1
  99. package/src/crews/.orkeon/orkeon.d.ts +538 -93
  100. package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
  101. package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +17 -12
  102. package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
  103. package/src/crews/_probe-shared-memory/probe.ork.ts +5 -3
  104. package/src/crews/advisor/application/messages.ts +4 -0
  105. package/src/crews/advisor/application/prompts.ts +4 -0
  106. package/src/crews/advisor/application/run-advisor.ts +2 -1
  107. package/src/crews/advisor/crew.ork.ts +5 -4
  108. package/src/crews/advisor/domain/advice.ts +7 -23
  109. package/src/crews/advisor/domain/messages.ts +8 -0
  110. package/src/crews/advisor/domain/prompts.ts +26 -0
  111. package/src/crews/agent-run/application/messages.ts +18 -0
  112. package/src/crews/agent-run/application/run-agent-run.ts +5 -4
  113. package/src/crews/agent-run/crew.ork.ts +3 -3
  114. package/src/crews/analyze/application/messages.ts +27 -0
  115. package/src/crews/analyze/application/prompts.ts +4 -0
  116. package/src/crews/analyze/application/run-analyze.ts +16 -14
  117. package/src/crews/analyze/crew.ork.ts +5 -4
  118. package/src/crews/analyze/domain/harvest.ts +33 -65
  119. package/src/crews/analyze/domain/prompts.ts +86 -0
  120. package/src/crews/code-review/application/lens-material.ts +24 -0
  121. package/src/crews/code-review/application/messages.ts +17 -0
  122. package/src/crews/code-review/application/prompts.ts +10 -17
  123. package/src/crews/code-review/application/review.ts +4 -1
  124. package/src/crews/code-review/application/run-code-review.ts +13 -15
  125. package/src/crews/code-review/crew.ork.ts +5 -4
  126. package/src/crews/code-review/domain/lenses.ts +6 -45
  127. package/src/crews/code-review/domain/messages.ts +25 -0
  128. package/src/crews/code-review/domain/prompts.ts +58 -0
  129. package/src/crews/code-review/domain/report.ts +5 -6
  130. package/src/crews/code-review/domain/scope.ts +6 -12
  131. package/src/crews/dev-batches/application/messages.ts +127 -0
  132. package/src/crews/dev-batches/application/plan-close.ts +12 -12
  133. package/src/crews/dev-batches/application/prompts.ts +10 -0
  134. package/src/crews/dev-batches/application/run-dev-batches.ts +57 -50
  135. package/src/crews/dev-batches/application/run-wave.ts +24 -22
  136. package/src/crews/dev-batches/application/seed-harvest.ts +8 -7
  137. package/src/crews/dev-batches/crew.ork.ts +12 -9
  138. package/src/crews/dev-batches/domain/batches-log.ts +1 -3
  139. package/src/crews/dev-batches/domain/markers.ts +5 -0
  140. package/src/crews/dev-batches/domain/messages.ts +6 -0
  141. package/src/crews/dev-batches/domain/wave-order.ts +3 -2
  142. package/src/crews/dev-change/application/change-material.ts +44 -0
  143. package/src/crews/dev-change/application/evidence.ts +25 -22
  144. package/src/crews/dev-change/application/messages.ts +81 -0
  145. package/src/crews/dev-change/application/{change-prompt.ts → prompts.ts} +40 -43
  146. package/src/crews/dev-change/application/run-dev-change.ts +43 -34
  147. package/src/crews/dev-change/crew.ork.ts +11 -9
  148. package/src/crews/dev-change/domain/change-answer.ts +24 -20
  149. package/src/crews/dev-change/domain/change-render.ts +13 -15
  150. package/src/crews/dev-change/domain/markers.ts +28 -0
  151. package/src/crews/dev-change/domain/messages.ts +16 -0
  152. package/src/crews/dev-implement/application/close.ts +21 -18
  153. package/src/crews/dev-implement/application/locate-sheet.ts +7 -5
  154. package/src/crews/dev-implement/application/messages.ts +161 -0
  155. package/src/crews/dev-implement/application/observe.ts +4 -2
  156. package/src/crews/dev-implement/application/prompts.ts +9 -0
  157. package/src/crews/dev-implement/application/report-writes.ts +14 -9
  158. package/src/crews/dev-implement/application/run-dev-implement.ts +84 -73
  159. package/src/crews/dev-implement/application/suite-job.ts +15 -11
  160. package/src/crews/dev-implement/crew.ork.ts +2 -1
  161. package/src/crews/dev-implement/domain/contracts.ts +59 -60
  162. package/src/crews/dev-implement/domain/correction.ts +16 -15
  163. package/src/crews/dev-implement/domain/cycles.ts +2 -1
  164. package/src/crews/dev-implement/domain/markers.ts +23 -0
  165. package/src/crews/dev-implement/domain/messages.ts +58 -0
  166. package/src/crews/dev-implement/domain/prompts.ts +93 -0
  167. package/src/crews/dev-implement/domain/roles.ts +3 -7
  168. package/src/crews/dev-implement/domain/sheet-edits.ts +6 -5
  169. package/src/crews/dev-implement/domain/sheet-ticks.ts +5 -4
  170. package/src/crews/dev-implement/domain/step-checks.ts +17 -16
  171. package/src/crews/dev-implement/domain/step-section.ts +6 -4
  172. package/src/crews/dev-learn/application/learn-prompt-fit.ts +63 -0
  173. package/src/crews/dev-learn/application/messages.ts +51 -0
  174. package/src/crews/dev-learn/application/{learn-prompt.ts → prompts.ts} +24 -65
  175. package/src/crews/dev-learn/application/run-dev-learn.ts +37 -32
  176. package/src/crews/dev-learn/crew.ork.ts +4 -3
  177. package/src/crews/dev-learn/domain/learn-answer.ts +25 -27
  178. package/src/crews/dev-learn/domain/messages.ts +65 -0
  179. package/src/crews/dev-learn/domain/owner-lines.ts +12 -9
  180. package/src/crews/dev-learn/domain/proposals-render.ts +8 -9
  181. package/src/crews/dev-plan/application/anchor-paths.ts +57 -20
  182. package/src/crews/dev-plan/application/inventory.ts +17 -13
  183. package/src/crews/dev-plan/application/messages.ts +88 -0
  184. package/src/crews/dev-plan/application/plan-prompt-fit.ts +44 -0
  185. package/src/crews/dev-plan/application/{plan-prompt.ts → prompts.ts} +37 -55
  186. package/src/crews/dev-plan/application/run-dev-plan.ts +103 -75
  187. package/src/crews/dev-plan/crew.ork.ts +11 -8
  188. package/src/crews/dev-plan/domain/inventory-model.ts +3 -3
  189. package/src/crews/dev-plan/domain/markers.ts +18 -0
  190. package/src/crews/dev-plan/domain/messages.ts +118 -0
  191. package/src/crews/dev-plan/domain/plan-answer.ts +118 -103
  192. package/src/crews/dev-plan/domain/plan-render.ts +30 -31
  193. package/src/crews/dev-plan/domain/prompts.ts +44 -0
  194. package/src/crews/dev-spec/application/messages.ts +30 -0
  195. package/src/crews/dev-spec/application/{spec-prompt.ts → prompts.ts} +42 -47
  196. package/src/crews/dev-spec/application/run-dev-spec.ts +67 -36
  197. package/src/crews/dev-spec/application/spec-material.ts +42 -0
  198. package/src/crews/dev-spec/crew.ork.ts +11 -9
  199. package/src/crews/dev-spec/domain/markers.ts +30 -0
  200. package/src/crews/dev-spec/domain/messages.ts +39 -0
  201. package/src/crews/dev-spec/domain/spec-answer.ts +46 -47
  202. package/src/crews/dev-spec/domain/spec-render.ts +18 -18
  203. package/src/crews/dev-verify/application/audit-brief.ts +187 -0
  204. package/src/crews/dev-verify/application/audit.ts +38 -30
  205. package/src/crews/dev-verify/application/capture.ts +34 -26
  206. package/src/crews/dev-verify/application/messages.ts +119 -0
  207. package/src/crews/dev-verify/application/prompts.ts +209 -0
  208. package/src/crews/dev-verify/application/run-dev-verify.ts +60 -46
  209. package/src/crews/dev-verify/application/run-gate.ts +11 -9
  210. package/src/crews/dev-verify/crew.ork.ts +6 -6
  211. package/src/crews/dev-verify/domain/audit-answer.ts +16 -12
  212. package/src/crews/dev-verify/domain/capture-sections.ts +5 -4
  213. package/src/crews/dev-verify/domain/commands.ts +3 -3
  214. package/src/crews/dev-verify/domain/gate.ts +21 -16
  215. package/src/crews/dev-verify/domain/markers.ts +16 -0
  216. package/src/crews/dev-verify/domain/mechanical-table.ts +37 -44
  217. package/src/crews/dev-verify/domain/messages.ts +92 -0
  218. package/src/crews/dev-verify/domain/verdict.ts +4 -4
  219. package/src/crews/git-commit/application/draft.ts +16 -37
  220. package/src/crews/git-commit/application/messages.ts +15 -0
  221. package/src/crews/git-commit/application/prompts.ts +47 -0
  222. package/src/crews/git-commit/application/run-git-commit.ts +13 -12
  223. package/src/crews/git-commit/crew.ork.ts +5 -4
  224. package/src/crews/git-commit/domain/commit.ts +15 -35
  225. package/src/crews/git-commit/domain/markers.ts +4 -0
  226. package/src/crews/git-commit/domain/messages.ts +48 -0
  227. package/src/crews/init-verifiers/application/authoring.ts +2 -1
  228. package/src/crews/init-verifiers/application/messages.ts +13 -0
  229. package/src/crews/init-verifiers/application/prompts.ts +5 -1
  230. package/src/crews/init-verifiers/application/run-init-verifiers.ts +3 -2
  231. package/src/crews/init-verifiers/crew.ork.ts +5 -4
  232. package/src/crews/main-loop/application/auto-compact.ts +2 -1
  233. package/src/crews/main-loop/application/messages.ts +81 -0
  234. package/src/crews/main-loop/application/prompts.ts +12 -0
  235. package/src/crews/main-loop/application/run-main-loop.ts +63 -30
  236. package/src/crews/main-loop/application/{turn-prompt.ts → turn-context.ts} +7 -8
  237. package/src/crews/main-loop/crew.ork.ts +12 -7
  238. package/src/crews/main-loop/domain/prompt-assembly.ts +45 -228
  239. package/src/crews/main-loop/domain/prompts.ts +336 -0
  240. package/src/crews/main-loop/domain/turn-chains.ts +10 -9
  241. package/src/crews/project-init/application/detect.ts +5 -4
  242. package/src/crews/project-init/application/messages.ts +15 -0
  243. package/src/crews/project-init/application/prompts.ts +11 -7
  244. package/src/crews/project-init/crew.ork.ts +5 -4
  245. package/src/crews/project-init/domain/existing-files.ts +6 -4
  246. package/src/crews/project-init/domain/messages.ts +13 -0
  247. package/src/crews/project-init/domain/package-map.ts +3 -3
  248. package/src/crews/project-init/domain/prompts.ts +10 -0
  249. package/src/crews/session-compact/application/prompts.ts +5 -0
  250. package/src/crews/session-compact/crew.ork.ts +5 -4
  251. package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
  252. package/src/crews/shared-memory-admit/crew.ork.ts +3 -2
  253. package/src/crews/speech/application/messages.ts +3 -0
  254. package/src/crews/speech/application/prompts.ts +3 -0
  255. package/src/crews/speech/application/run-speech.ts +2 -1
  256. package/src/crews/speech/crew.ork.ts +2 -1
  257. package/src/shared/application/agents/child-agent.ts +11 -7
  258. package/src/shared/application/agents/messages.ts +35 -0
  259. package/src/shared/application/agents/route-agent.ts +115 -0
  260. package/src/shared/application/agents/run-sub-agent.ts +31 -8
  261. package/src/shared/application/compaction/compact-session.ts +19 -14
  262. package/src/shared/application/compaction/messages.ts +20 -0
  263. package/src/shared/application/compaction/prune-context.ts +94 -0
  264. package/src/shared/application/compaction/pruned-llm.ts +35 -0
  265. package/src/shared/application/dev/brief-inventory.ts +6 -4
  266. package/src/shared/application/dev/close-batch.ts +9 -7
  267. package/src/shared/application/dev/find-repo-pack.ts +4 -3
  268. package/src/shared/application/dev/learn-decision.ts +20 -18
  269. package/src/shared/application/dev/load-dev-context.ts +7 -8
  270. package/src/shared/application/dev/measure-access-cost.ts +5 -4
  271. package/src/shared/application/dev/messages.ts +132 -0
  272. package/src/shared/application/dev/phase-timer.ts +54 -0
  273. package/src/shared/application/dev/plan-source.ts +12 -8
  274. package/src/shared/application/dev/preflight.ts +8 -8
  275. package/src/shared/application/dev/prompts.ts +34 -0
  276. package/src/shared/application/dev/question-round.ts +25 -17
  277. package/src/shared/application/dev/resolve-work-folder.ts +4 -3
  278. package/src/shared/application/dev/settle-questions.ts +4 -2
  279. package/src/shared/application/dev/source-review.ts +12 -8
  280. package/src/shared/application/dev/source-step.ts +12 -10
  281. package/src/shared/application/dev/spend.ts +17 -4
  282. package/src/shared/application/dev/step-precedents.ts +2 -1
  283. package/src/shared/application/dev/tool-call-policy.ts +9 -11
  284. package/src/shared/application/dev/tool-callbacks.ts +52 -5
  285. package/src/shared/application/dev/tool-trace-recorder.ts +2 -1
  286. package/src/shared/application/dev/verdict-sources.ts +5 -3
  287. package/src/shared/application/dev/wrapped-tools.ts +4 -2
  288. package/src/shared/application/extra-tools.ts +2 -1
  289. package/src/shared/application/git/batch-worktree.ts +22 -17
  290. package/src/shared/application/git/commit-files.ts +24 -19
  291. package/src/shared/application/git/merge-batch.ts +11 -7
  292. package/src/shared/application/git/messages.ts +75 -0
  293. package/src/shared/application/git/open-pull-request.ts +4 -3
  294. package/src/shared/application/host-context.ts +59 -0
  295. package/src/shared/application/host-layout-store.ts +45 -0
  296. package/src/shared/application/llm-profile.ts +4 -3
  297. package/src/shared/application/messages.ts +14 -0
  298. package/src/shared/application/permission-rules.ts +10 -0
  299. package/src/shared/application/ports/decision.ts +14 -0
  300. package/src/shared/application/ports/human.ts +25 -0
  301. package/src/shared/application/ports/llm.ts +32 -3
  302. package/src/shared/application/ports/memory.ts +1 -1
  303. package/src/shared/application/ports/theme.ts +11 -0
  304. package/src/shared/application/ports.ts +4 -2
  305. package/src/shared/application/session-io.ts +2 -1
  306. package/src/shared/application/shared-memory/admit-entries.ts +16 -14
  307. package/src/shared/application/shared-memory/harvest-after-gaps.ts +5 -8
  308. package/src/shared/application/shared-memory/harvest-mistakes.ts +3 -2
  309. package/src/shared/application/shared-memory/import-agent-memory.ts +9 -7
  310. package/src/shared/application/shared-memory/memory-files.ts +2 -1
  311. package/src/shared/application/shared-memory/memory-settings.ts +2 -1
  312. package/src/shared/application/shared-memory/messages.ts +63 -0
  313. package/src/shared/application/shared-memory/push-candidate.ts +14 -11
  314. package/src/shared/application/shared-memory/recall-precedents.ts +2 -1
  315. package/src/shared/application/skills/messages.ts +4 -0
  316. package/src/shared/application/skills/suggest-skills.ts +102 -0
  317. package/src/shared/application/workflow/messages.ts +8 -0
  318. package/src/shared/application/workflow/workflow-state.ts +7 -6
  319. package/src/shared/domain/agent-policy/behavior-flags.ts +4 -10
  320. package/src/shared/domain/agent-policy/extra-tools.ts +2 -4
  321. package/src/shared/domain/agent-policy/messages.ts +66 -0
  322. package/src/shared/domain/agent-policy/path-rules.ts +299 -0
  323. package/src/shared/domain/agent-policy/permission.ts +20 -18
  324. package/src/shared/domain/agent-policy/prompts.ts +17 -0
  325. package/src/shared/domain/agent-policy/reasoning.ts +59 -0
  326. package/src/shared/domain/agent-policy/rule-sets.ts +18 -14
  327. package/src/shared/domain/agent-policy/tool-access.ts +17 -3
  328. package/src/shared/domain/agent-registry.ts +6 -5
  329. package/src/shared/domain/agents/chain.ts +2 -2
  330. package/src/shared/domain/agents/charter.ts +8 -5
  331. package/src/shared/domain/agents/exclusive.ts +2 -1
  332. package/src/shared/domain/agents/instances.ts +18 -15
  333. package/src/shared/domain/agents/messages.ts +39 -0
  334. package/src/shared/domain/agents/model-route.ts +199 -0
  335. package/src/shared/domain/agents/prompts.ts +20 -0
  336. package/src/shared/domain/code-intel-contract.ts +5 -4
  337. package/src/shared/domain/code-intel-routing.ts +8 -61
  338. package/src/shared/domain/compact-outcome.ts +5 -3
  339. package/src/shared/domain/compaction-thresholds.ts +2 -1
  340. package/src/shared/domain/compaction.ts +22 -113
  341. package/src/shared/domain/config-schema.ts +94 -81
  342. package/src/shared/domain/context-prune.ts +176 -0
  343. package/src/shared/domain/decision/questions.ts +102 -0
  344. package/src/shared/domain/dev/access-cost.ts +19 -15
  345. package/src/shared/domain/dev/batches-concurrency.ts +5 -6
  346. package/src/shared/domain/dev/build-commands.ts +5 -4
  347. package/src/shared/domain/dev/call-guard.ts +29 -28
  348. package/src/shared/domain/dev/carried-text.ts +3 -5
  349. package/src/shared/domain/dev/learn-proposals.ts +5 -4
  350. package/src/shared/domain/dev/learn-state.ts +3 -2
  351. package/src/shared/domain/dev/markers.ts +107 -0
  352. package/src/shared/domain/dev/messages.ts +259 -0
  353. package/src/shared/domain/dev/phase-timing.ts +50 -0
  354. package/src/shared/domain/dev/plan-checks.ts +24 -23
  355. package/src/shared/domain/dev/plan-format.ts +14 -24
  356. package/src/shared/domain/dev/project-files.ts +1 -15
  357. package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
  358. package/src/shared/domain/dev/{review-prompt.ts → prompts.ts} +91 -61
  359. package/src/shared/domain/dev/questions.ts +33 -15
  360. package/src/shared/domain/dev/repo-pack.ts +12 -9
  361. package/src/shared/domain/dev/review-answer.ts +40 -17
  362. package/src/shared/domain/dev/review-brief.ts +54 -0
  363. package/src/shared/domain/dev/reviewer-charter.ts +4 -0
  364. package/src/shared/domain/dev/sheet-facts.ts +2 -4
  365. package/src/shared/domain/dev/spec-format.ts +13 -14
  366. package/src/shared/domain/dev/step-budget.ts +4 -2
  367. package/src/shared/domain/dev/step-rules.ts +3 -4
  368. package/src/shared/domain/dev/test-commands.ts +14 -10
  369. package/src/shared/domain/dev/tool-guards.ts +4 -3
  370. package/src/shared/domain/dev/trait-pattern.ts +14 -10
  371. package/src/shared/domain/dev/verdict-format.ts +14 -21
  372. package/src/shared/domain/dev/whitespace.ts +3 -2
  373. package/src/shared/domain/dev/work-folder.ts +4 -3
  374. package/src/shared/domain/dev/yaml-subset.ts +8 -26
  375. package/src/shared/domain/error-text.ts +13 -0
  376. package/src/shared/domain/git/close.ts +5 -4
  377. package/src/shared/domain/git/messages.ts +20 -0
  378. package/src/shared/domain/git/pull-request.ts +5 -5
  379. package/src/shared/domain/host-layout.ts +147 -0
  380. package/src/shared/domain/host-paths.ts +399 -0
  381. package/src/shared/domain/llm-failure.ts +35 -7
  382. package/src/shared/domain/llm-profile.ts +22 -3
  383. package/src/shared/domain/marked-message.ts +1 -5
  384. package/src/shared/domain/markers.ts +30 -0
  385. package/src/shared/domain/messages.ts +291 -0
  386. package/src/shared/domain/model-catalog.ts +2 -9
  387. package/src/shared/domain/permission-modes.ts +4 -8
  388. package/src/shared/domain/prelude.ts +2 -2
  389. package/src/shared/domain/project-manifests.ts +3 -2
  390. package/src/shared/domain/prompts.ts +233 -0
  391. package/src/shared/domain/search-routing.ts +3 -11
  392. package/src/shared/domain/secret-patterns.ts +3 -2
  393. package/src/shared/domain/session-keys.ts +7 -0
  394. package/src/shared/domain/session-start.ts +3 -2
  395. package/src/shared/domain/shared-memory/agent-memory-import.ts +4 -2
  396. package/src/shared/domain/shared-memory/candidates.ts +3 -4
  397. package/src/shared/domain/shared-memory/entry.ts +26 -20
  398. package/src/shared/domain/shared-memory/front-matter.ts +17 -13
  399. package/src/shared/domain/shared-memory/gate.ts +4 -3
  400. package/src/shared/domain/shared-memory/harvest.ts +9 -6
  401. package/src/shared/domain/shared-memory/layout.ts +11 -8
  402. package/src/shared/domain/shared-memory/markers.ts +9 -0
  403. package/src/shared/domain/shared-memory/messages.ts +66 -0
  404. package/src/shared/domain/shared-memory/precedents-block.ts +4 -15
  405. package/src/shared/domain/shared-memory/prompts.ts +28 -0
  406. package/src/shared/domain/shared-memory/refused.ts +3 -3
  407. package/src/shared/domain/skills/prompts.ts +4 -0
  408. package/src/shared/domain/skills/shortlist.ts +149 -0
  409. package/src/shared/domain/snip-turns.ts +2 -14
  410. package/src/shared/domain/speech.ts +2 -1
  411. package/src/shared/domain/tool-trace.ts +5 -7
  412. package/src/shared/domain/verifiers.ts +7 -11
  413. package/src/shared/domain/vfs.ts +8 -1
  414. package/src/shared/domain/workflow/prompts.ts +15 -0
  415. package/src/shared/domain/workflow/state-file.ts +14 -12
  416. package/src/shared/infrastructure/globals.ts +7 -2
  417. package/src/shared/infrastructure/orkeon/child-agents.ts +11 -16
  418. package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
  419. package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
  420. package/src/shared/infrastructure/orkeon/dev-deps.ts +21 -14
  421. package/src/shared/infrastructure/orkeon/files.ts +24 -6
  422. package/src/shared/infrastructure/orkeon/github-pull-requests.ts +3 -2
  423. package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
  424. package/src/shared/infrastructure/orkeon/human-input.ts +1 -5
  425. package/src/shared/infrastructure/orkeon/llm-profile.ts +36 -16
  426. package/src/shared/infrastructure/orkeon/llm.ts +85 -30
  427. package/src/shared/infrastructure/orkeon/markers.ts +6 -0
  428. package/src/shared/infrastructure/orkeon/memory-store.ts +1 -1
  429. package/src/shared/infrastructure/orkeon/memory-tools.ts +18 -20
  430. package/src/shared/infrastructure/orkeon/messages.ts +15 -0
  431. package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
  432. package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
  433. package/src/shared/infrastructure/orkeon/script-tools.ts +14 -19
  434. package/src/shared/infrastructure/orkeon/session-store.ts +7 -51
  435. package/src/shared/infrastructure/orkeon/shell-jobs.ts +13 -7
  436. package/src/shared/infrastructure/orkeon/shell.ts +13 -5
  437. package/src/shared/infrastructure/orkeon/tool-catalogue.ts +3 -2
  438. package/src/shared/infrastructure/orkeon/wiring.ts +68 -12
  439. package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
  440. package/src/shared/domain/session-summary.ts +0 -13
@@ -14,6 +14,8 @@ import { buildCommandFor, coldTree, isRestore } from "../../domain/dev/build-com
14
14
  import { outputTail, runGuards, shellRuleGuard, stringArgument } from "../../domain/dev/tool-guards.ts";
15
15
  import { failedTests } from "../../domain/dev/test-output.ts";
16
16
  import type { Guard } from "../../domain/dev/tool-guards.ts";
17
+ import { noRoleRestores } from "./prompts.ts";
18
+ import { restoreNotRun } from "./messages.ts";
17
19
 
18
20
  export const RUN_TESTS_TIMEOUT_SECONDS = 600;
19
21
  export const RUN_BUILD_TIMEOUT_SECONDS = 900;
@@ -66,7 +68,7 @@ export function createWrappedTools(deps: { shell: Pick<Shell, "run">; files: Pic
66
68
  let runs = 0;
67
69
  let restoreTried = setup.restored === true; // the one restore of the step, whatever came of it
68
70
  const notRestore: Guard<string> = (command) =>
69
- isRestore(command, setup.commands) ? `'${command}' restores: no role restores, the step did it once` : null;
71
+ isRestore(command, setup.commands) ? noRoleRestores(command) : null;
70
72
  const shellGuards: ReadonlyArray<Guard<string>> = [notRestore, shellRuleGuard(setup.rules)];
71
73
 
72
74
  async function writeLog(tool: string, text: string): Promise<string | null> {
@@ -125,7 +127,7 @@ export function createWrappedTools(deps: { shell: Pick<Shell, "run">; files: Pic
125
127
  const denied = shellRuleGuard(setup.rules)(restore);
126
128
  const restoring = denied === null ? await run(restore, RUN_BUILD_TIMEOUT_SECONDS) : denied;
127
129
  if (typeof restoring === "string") {
128
- log.push(`restore not run: ${restoring}`);
130
+ log.push(restoreNotRun(restoring));
129
131
  } else {
130
132
  log.push(output(restore, restoring));
131
133
  if (restoring.exitCode === 0) {
@@ -12,6 +12,7 @@ import type { ConfigStore } from "./config-store.ts";
12
12
  import { EXTRA_TOOLS_CONFIG_KEY, parseExtraTools } from "../domain/agent-policy/extra-tools.ts";
13
13
  import type { ExtraToolsParse } from "../domain/agent-policy/extra-tools.ts";
14
14
  import type { ExtraTool } from "../domain/agent-policy/permission.ts";
15
+ import { couldNotBeReadOrParsed } from "./messages.ts";
15
16
 
16
17
  /** The setting as read: its entries, or why it could not be read. */
17
18
  export interface ExtraToolsRead extends ExtraToolsParse {
@@ -26,7 +27,7 @@ export async function readExtraTools(config: Pick<ConfigStore, "readValue" | "re
26
27
  try {
27
28
  const { value, source } = await config.readValue(EXTRA_TOOLS_CONFIG_KEY);
28
29
  if (source === "unset" && (await config.readFile()).malformed) {
29
- return { tools: [], invalid: [], unreadable: `${CONFIG_FILE_PATH} could not be read or parsed` };
30
+ return { tools: [], invalid: [], unreadable: couldNotBeReadOrParsed(CONFIG_FILE_PATH) };
30
31
  }
31
32
  return parseExtraTools(value);
32
33
  } catch (e: unknown) {
@@ -19,6 +19,11 @@ import type { WorktreePlace } from "../../domain/git/worktree.ts";
19
19
  import { gitReason, runGit } from "./commit-files.ts";
20
20
  import { mergeFastForward } from "./merge-batch.ts";
21
21
  import type { MergeOutcome } from "./merge-batch.ts";
22
+ import {
23
+ DETACHED_HEAD, branchExists, branchNotMerged, cannotGoThroughTheShell, mergedUnreadable, notAWorktreeNameExplained, orkeonNotIgnoredByGit,
24
+ notMergedNotAWorktreeName, notMergedVerdict, worktreeAndBranchRemoved, worktreeCreated, worktreeHoldsChanges, worktreeNotCreated,
25
+ worktreeNotOnBranch, worktreeNotRemoved, worktreeRemovedBranchKept, worktreeStateUnreadable,
26
+ } from "./messages.ts";
22
27
 
23
28
  export type WorktreeOutcome =
24
29
  | { ok: true; place: WorktreePlace; line: string }
@@ -29,7 +34,7 @@ const refused = (line: string): { ok: false; line: string } => ({ ok: false, lin
29
34
  // A leading `-` would be read by git as an option (`--detach` for a base).
30
35
  function unsafeOf(values: readonly string[]): string | null {
31
36
  const bad = values.filter((v) => shellUnsafe(v) || v.startsWith("-"));
32
- return bad.length === 0 ? null : `${bad.map((v) => `'${v}'`).join(", ")} cannot go through the shell`;
37
+ return bad.length === 0 ? null : cannotGoThroughTheShell(bad.map((v) => `'${v}'`).join(", "));
33
38
  }
34
39
 
35
40
  /** Creates worktree `name` on a new branch `branch` from `base`. */
@@ -37,19 +42,19 @@ export async function createBatchWorktree(
37
42
  shell: Pick<Shell, "run">, req: { name: string; branch: string; base: string },
38
43
  ): Promise<WorktreeOutcome> {
39
44
  const place = worktreePlace(req.name);
40
- if (place === null) return refused(`'${req.name}' is not a worktree name (one folder: letters, digits, . _ -)`);
45
+ if (place === null) return refused(notAWorktreeNameExplained(req.name));
41
46
  const unsafe = unsafeOf([req.branch, req.base]);
42
47
  if (unsafe !== null) return refused(unsafe);
43
48
  const exists = await runGit(shell, gitBranchExists(req.branch));
44
- if (exists.exitCode === 0) return refused(`branch ${req.branch} exists already: remove it or choose another name`);
49
+ if (exists.exitCode === 0) return refused(branchExists(req.branch));
45
50
  // Not ignored, the worktree would sit in the checkout's own status as an embedded repository.
46
51
  const ignored = await runGit(shell, gitIsIgnored(place.path));
47
52
  if (ignored.exitCode !== 0) {
48
- return refused(`${place.path} is not ignored by git: add \`.orkeon/\` to .gitignore or .git/info/exclude first`);
53
+ return refused(orkeonNotIgnoredByGit(place.path));
49
54
  }
50
55
  const add = await runGit(shell, gitWorktreeAdd(place.path, req.branch, req.base));
51
- if (add.exitCode !== 0) return { ok: false, line: `worktree ${place.path} not created: ${gitReason(add)}` };
52
- return { ok: true, place, line: `✓ worktree ${place.path} on ${req.branch}, from ${req.base}` };
56
+ if (add.exitCode !== 0) return { ok: false, line: worktreeNotCreated(place.path, gitReason(add)) };
57
+ return { ok: true, place, line: worktreeCreated(place.path, req.branch, req.base) };
53
58
  }
54
59
 
55
60
  /** Removes worktree `name` and its branch once nothing in it is lost: no change, every commit in `into`. */
@@ -57,31 +62,31 @@ export async function removeBatchWorktree(
57
62
  shell: Pick<Shell, "run">, req: { name: string; branch: string; into: string },
58
63
  ): Promise<WorktreeOutcome> {
59
64
  const place = worktreePlace(req.name);
60
- if (place === null) return refused(`'${req.name}' is not a worktree name (one folder: letters, digits, . _ -)`);
65
+ if (place === null) return refused(notAWorktreeNameExplained(req.name));
61
66
  const unsafe = unsafeOf([req.branch, req.into]);
62
67
  if (unsafe !== null) return refused(unsafe);
63
68
  const status = await runGit(shell, gitWorktreeStatus(place.path));
64
- if (status.exitCode !== 0) return refused(`the state of ${place.path} could not be read (${gitReason(status)})`);
69
+ if (status.exitCode !== 0) return refused(worktreeStateUnreadable(place.path, gitReason(status)));
65
70
  const changed = status.stdout.split("\n").filter((l) => l.trim() !== "").length;
66
- if (changed > 0) return refused(`${place.path} holds ${changed} uncommitted or untracked file(s): commit or discard them first`);
71
+ if (changed > 0) return refused(worktreeHoldsChanges(place.path, changed));
67
72
  // The worktree must stand on its branch: commits on another HEAD would go with it, the merge check not seeing them.
68
73
  const head = await runGit(shell, gitWorktreeHead(place.path));
69
74
  if (head.exitCode !== 0 || head.stdout.trim() !== `refs/heads/${req.branch}`) {
70
- return refused(`${place.path} is not on ${req.branch} (${head.exitCode === 0 ? head.stdout.trim() : "a detached HEAD"}): check it out there first`);
75
+ return refused(worktreeNotOnBranch(place.path, req.branch, head.exitCode === 0 ? head.stdout.trim() : DETACHED_HEAD));
71
76
  }
72
77
  const merged = await runGit(shell, gitIsMergedInto(req.branch, req.into));
73
78
  if (merged.exitCode === 1) {
74
79
  const count = await runGit(shell, gitCommitsNotIn(req.branch, req.into));
75
80
  const n = count.exitCode === 0 ? count.stdout.trim() : "?";
76
- return refused(`${req.branch} holds ${n} commit(s) not in ${req.into}: merge it first`);
81
+ return refused(branchNotMerged(req.branch, n, req.into));
77
82
  }
78
- if (merged.exitCode !== 0) return refused(`whether ${req.branch} is merged into ${req.into} could not be read (${gitReason(merged)})`);
83
+ if (merged.exitCode !== 0) return refused(mergedUnreadable(req.branch, req.into, gitReason(merged)));
79
84
  const remove = await runGit(shell, gitWorktreeRemove(place.path));
80
- if (remove.exitCode !== 0) return { ok: false, line: `worktree ${place.path} not removed: ${gitReason(remove)}` };
85
+ if (remove.exitCode !== 0) return { ok: false, line: worktreeNotRemoved(place.path, gitReason(remove)) };
81
86
  const branch = await runGit(shell, gitBranchDelete(req.branch));
82
87
  return branch.exitCode === 0
83
- ? { ok: true, place, line: `✓ worktree ${place.path} and branch ${req.branch} removed` }
84
- : { ok: true, place, line: `✓ worktree ${place.path} removed; branch ${req.branch} kept (${gitReason(branch)})` };
88
+ ? { ok: true, place, line: worktreeAndBranchRemoved(place.path, req.branch) }
89
+ : { ok: true, place, line: worktreeRemovedBranchKept(place.path, req.branch, gitReason(branch)) };
85
90
  }
86
91
 
87
92
  /** Merges a batch's branch into the work branch (`--ff-only`, rebased in its worktree when needed) on a VALID verdict only. */
@@ -89,9 +94,9 @@ export async function mergeValidBatch(
89
94
  shell: Pick<Shell, "run">, req: { batch: string; verdict: string | null; branch: string; workBranch: string; name: string },
90
95
  ): Promise<MergeOutcome> {
91
96
  if (req.verdict !== "VALID") {
92
- return { merged: false, line: `not merged: ${req.batch}'s audit is ${req.verdict ?? "missing"}, not VALID`, handOver: [] };
97
+ return { merged: false, line: notMergedVerdict(req.batch, req.verdict ?? "missing"), handOver: [] };
93
98
  }
94
99
  const place = worktreePlace(req.name);
95
- if (place === null) return { merged: false, line: `not merged: '${req.name}' is not a worktree name`, handOver: [] };
100
+ if (place === null) return { merged: false, line: notMergedNotAWorktreeName(req.name), handOver: [] };
96
101
  return mergeFastForward(shell, { ref: req.branch, workBranch: req.workBranch, worktree: place.path });
97
102
  }
@@ -12,6 +12,11 @@ import {
12
12
  parseGitIdent, prBodyPath, prSlug, renderPrBody, shellUnsafe,
13
13
  } from "../../domain/git/close.ts";
14
14
  import { WORKSPACE } from "../../domain/vfs.ts";
15
+ import {
16
+ MERGE_IN_PROGRESS, NOTHING_TO_COMMIT, NOT_PUSHED_DETACHED, NO_GITHUB_TOOL, TO_OPEN_IN_A_TERMINAL, bodyNotWritten, bodyOutsideMounts,
17
+ cannotGoThroughShell, commitMessageNotWritten, gitAddFailed, gitCommitFailed, noEmailInAnswer, notPushedUnsafeBranch,
18
+ pullRequestBody, pullRequestNotOpened, pullRequestOpened, pushRefused, refusedByRuntime, removeByHand,
19
+ } from "./messages.ts";
15
20
 
16
21
  export type Step = { ok: true } | { ok: false; line: string };
17
22
 
@@ -24,7 +29,7 @@ export async function runGit(shell: Pick<Shell, "run">, command: string): Promis
24
29
  try {
25
30
  return await shell.run(command);
26
31
  } catch (e) {
27
- return { stdout: "", stderr: `refused by the runtime: ${firstLine((e as Error)?.message ?? e)}`, exitCode: -1 };
32
+ return { stdout: "", stderr: refusedByRuntime(firstLine((e as Error)?.message ?? e)), exitCode: -1 };
28
33
  }
29
34
  }
30
35
 
@@ -42,7 +47,7 @@ export async function readIdentity(shell: Pick<Shell, "run">): Promise<IdentityC
42
47
  for (const command of [GIT_IDENT_COMMAND, GIT_COMMITTER_IDENT_COMMAND]) {
43
48
  const r = await runGit(shell, command);
44
49
  const ident = r.exitCode === 0 ? parseGitIdent(r.stdout) : null;
45
- if (ident === null) return { ok: false, detail: r.exitCode === 0 ? `${command}: no email in its answer` : gitReason(r) };
50
+ if (ident === null) return { ok: false, detail: r.exitCode === 0 ? noEmailInAnswer(command) : gitReason(r) };
46
51
  author ??= ident;
47
52
  }
48
53
  return { ok: true, ident: author! };
@@ -61,13 +66,13 @@ export async function commitFiles(
61
66
  deps: { shell: Pick<Shell, "run">; files: Pick<Files, "write"> },
62
67
  req: { files: readonly string[]; status: string; message: string },
63
68
  ): Promise<CommitOutcome> {
64
- if (req.files.length === 0) return { ok: false, line: "nothing to commit" };
69
+ if (req.files.length === 0) return { ok: false, line: NOTHING_TO_COMMIT };
65
70
  const unsafe = req.files.filter(shellUnsafe);
66
- if (unsafe.length > 0) return { ok: false, line: `cannot go through the shell: ${unsafe.join(", ")}` };
71
+ if (unsafe.length > 0) return { ok: false, line: cannotGoThroughShell(unsafe.join(", ")) };
67
72
  for (const probe of GIT_IN_PROGRESS_PROBES) {
68
73
  const r = await runGit(deps.shell, probe);
69
74
  if (r.exitCode === 0 && r.stdout.trim().length > 0) {
70
- return { ok: false, line: "a merge or a cherry-pick is in progress: conclude it with git commit in a terminal" };
75
+ return { ok: false, line: MERGE_IN_PROGRESS };
71
76
  }
72
77
  }
73
78
  // The message is written before anything is staged: a write that fails leaves the index as it was.
@@ -77,11 +82,11 @@ export async function commitFiles(
77
82
  const toAdd = req.files.filter((p) => !gone.includes(p));
78
83
  if (toAdd.length > 0) {
79
84
  const add = await runGit(deps.shell, gitAddCommand(toAdd));
80
- if (add.exitCode !== 0) return { ok: false, line: `git add failed: ${gitReason(add)}` };
85
+ if (add.exitCode !== 0) return { ok: false, line: gitAddFailed(gitReason(add)) };
81
86
  }
82
87
  const commit = await runGit(deps.shell, gitCommitCommand(req.files, messageFile.path));
83
88
  const note = messageFile.path === COMMIT_MESSAGE_FALLBACK ? await removeFallback(deps.shell) : null;
84
- if (commit.exitCode !== 0) return { ok: false, line: `git commit failed: ${gitReason(commit)}${note === null ? "" : `; ${note}`}` };
89
+ if (commit.exitCode !== 0) return { ok: false, line: gitCommitFailed(gitReason(commit), note) };
85
90
  const hash = (await runGit(deps.shell, GIT_HEAD_COMMAND)).stdout.trim();
86
91
  return note === null ? { ok: true, hash } : { ok: true, hash, note };
87
92
  }
@@ -89,7 +94,7 @@ export async function commitFiles(
89
94
  /** Removes the message written under `.orkeon/`; a removal that fails is said, never silent (the file holds the message). */
90
95
  async function removeFallback(shell: Pick<Shell, "run">): Promise<string | null> {
91
96
  const rm = await runGit(shell, `rm -f ${COMMIT_MESSAGE_FALLBACK}`);
92
- return rm.exitCode === 0 ? null : `${COMMIT_MESSAGE_FALLBACK} could not be removed (${gitReason(rm)}): remove it by hand`;
97
+ return rm.exitCode === 0 ? null : removeByHand(COMMIT_MESSAGE_FALLBACK, gitReason(rm));
93
98
  }
94
99
 
95
100
  /** The message under `.git/`, else - a linked worktree, whose `.git` is a file - under `.orkeon/`. */
@@ -103,15 +108,15 @@ async function writeMessage(files: Pick<Files, "write">, message: string): Promi
103
108
  reason = firstLine((e as Error)?.message ?? e);
104
109
  }
105
110
  }
106
- return { ok: false, line: `the commit message could not be written (${COMMIT_MESSAGE_FILE}, ${COMMIT_MESSAGE_FALLBACK}): ${reason}` };
111
+ return { ok: false, line: commitMessageNotWritten(COMMIT_MESSAGE_FILE, COMMIT_MESSAGE_FALLBACK, reason) };
107
112
  }
108
113
 
109
114
  /** `git push -u origin <branch>`; a refusal is said with git's line, nothing is forced. */
110
115
  export async function pushBranch(shell: Pick<Shell, "run">, branch: string): Promise<Step> {
111
- if (branch.trim().length === 0) return { ok: false, line: "not pushed: no branch is checked out (detached HEAD)" };
112
- if (shellUnsafe(branch)) return { ok: false, line: `not pushed: the branch name '${branch}' cannot go through the shell` };
116
+ if (branch.trim().length === 0) return { ok: false, line: NOT_PUSHED_DETACHED };
117
+ if (shellUnsafe(branch)) return { ok: false, line: notPushedUnsafeBranch(branch) };
113
118
  const r = await runGit(shell, gitPushCommand(branch));
114
- return r.exitCode === 0 ? { ok: true } : { ok: false, line: `push refused, the commit stays local: ${gitReason(r)}` };
119
+ return r.exitCode === 0 ? { ok: true } : { ok: false, line: pushRefused(gitReason(r)) };
115
120
  }
116
121
 
117
122
  /** The remote's default branch, null when origin/HEAD is unset: never guessed. */
@@ -158,29 +163,29 @@ export async function handOverPullRequest(
158
163
  const lines: string[] = [];
159
164
  const body = renderPrBody(req.summary);
160
165
  if (req.work.vfsPath === null) {
161
- lines.push(`the body could not be written (${req.work.folder} is outside the mounts): write ${bodyFile} first`);
166
+ lines.push(bodyOutsideMounts(req.work.folder, bodyFile));
162
167
  } else {
163
168
  // After the commit and the push: a body that cannot be written is said, never thrown.
164
169
  try {
165
170
  await deps.files.write(`${req.work.vfsPath.replace(/\/+$/, "")}/pr-${slug}/PR.md`, body);
166
- lines.push(`pull request body: ${bodyFile}`);
171
+ lines.push(pullRequestBody(bodyFile));
167
172
  } catch (e) {
168
- lines.push(`⚠ the body could not be written (${firstLine((e as Error)?.message ?? e)}): write ${bodyFile} first`);
173
+ lines.push(bodyNotWritten(firstLine((e as Error)?.message ?? e), bodyFile));
169
174
  }
170
175
  }
171
176
  const pr: PullRequest = { base: req.base, head: req.branch, title: req.title, bodyFile, body };
172
177
  if (req.open && req.pushed && deps.opener !== undefined) {
173
178
  try {
174
- return [...lines, `✓ pull request opened: ${(await deps.opener.open(pr)).url}`];
179
+ return [...lines, pullRequestOpened((await deps.opener.open(pr)).url)];
175
180
  } catch (e) {
176
- lines.push(`✗ the pull request was not opened: ${firstLine((e as Error)?.message ?? e)}`);
181
+ lines.push(pullRequestNotOpened(firstLine((e as Error)?.message ?? e)));
177
182
  }
178
183
  }
179
- lines.push("to open the pull request, in a terminal:");
184
+ lines.push(TO_OPEN_IN_A_TERMINAL);
180
185
  if (!req.pushed) lines.push(` ${gitPushCommand(req.branch)}`);
181
186
  lines.push(` ${ghPrCreateCommand(pr)}`);
182
187
  if (req.open && deps.opener === undefined) {
183
- lines.push("the pull request is opened here only through the github tool, which this host does not offer: run the command above");
188
+ lines.push(NO_GITHUB_TOOL);
184
189
  }
185
190
  return lines;
186
191
  }
@@ -11,6 +11,10 @@ import {
11
11
  GIT_CURRENT_BRANCH_COMMAND, gitMergeFfOnly, gitRebaseAbortIn, gitRebaseIn, isNotFastForward, shellUnsafe,
12
12
  } from "../../domain/git/close.ts";
13
13
  import { gitReason, runGit } from "./commit-files.ts";
14
+ import {
15
+ DETACHED_HEAD, mergedFastForward, notMergedAfterRebase, notMergedCheckoutElsewhere, notMergedUnsafe, rebaseAbortFailed, rebaseStopped,
16
+ rebasedAndMerged,
17
+ } from "./messages.ts";
14
18
 
15
19
  export type MergeOutcome =
16
20
  | { merged: true; rebased: boolean; line: string }
@@ -26,17 +30,17 @@ export async function mergeFastForward(
26
30
  const unsafe = [req.ref, req.workBranch, ...(req.worktree === undefined ? [] : [req.worktree])]
27
31
  .filter((v) => shellUnsafe(v) || v.startsWith("-"));
28
32
  if (unsafe.length > 0) {
29
- return { merged: false, line: `not merged: ${unsafe.join(", ")} cannot go through the shell`, handOver: [merge] };
33
+ return { merged: false, line: notMergedUnsafe(unsafe.join(", ")), handOver: [merge] };
30
34
  }
31
35
  const current = (await runGit(shell, GIT_CURRENT_BRANCH_COMMAND)).stdout.trim();
32
36
  if (current !== req.workBranch) {
33
37
  return {
34
- merged: false, line: `not merged: the checkout is on '${current || "a detached HEAD"}', not on ${req.workBranch}`,
38
+ merged: false, line: notMergedCheckoutElsewhere(current || DETACHED_HEAD, req.workBranch),
35
39
  handOver: [`git checkout ${req.workBranch}`, merge],
36
40
  };
37
41
  }
38
42
  const first = await runGit(shell, merge);
39
- if (first.exitCode === 0) return { merged: true, rebased: false, line: `${req.ref} merged into ${req.workBranch} (fast-forward)` };
43
+ if (first.exitCode === 0) return { merged: true, rebased: false, line: mergedFastForward(req.ref, req.workBranch) };
40
44
  // Only a refusal for not being a fast-forward is cured by a rebase: a dirty tree or an unknown ref is said as it is.
41
45
  if (!isNotFastForward(first.stderr + first.stdout)) {
42
46
  return { merged: false, line: `not merged: ${gitReason(first)}`, handOver: [merge] };
@@ -52,12 +56,12 @@ export async function mergeFastForward(
52
56
  const rebased = await runGit(shell, rebase);
53
57
  if (rebased.exitCode !== 0) {
54
58
  const abort = await runGit(shell, gitRebaseAbortIn(req.worktree));
55
- const aborted = abort.exitCode === 0 ? "rebase aborted" : `rebase --abort failed too: ${gitReason(abort)}`;
56
- return { merged: false, line: `not merged, the rebase stopped (${gitReason(rebased)}); ${aborted}`, handOver: [rebase, merge] };
59
+ const aborted = abort.exitCode === 0 ? "rebase aborted" : rebaseAbortFailed(gitReason(abort));
60
+ return { merged: false, line: rebaseStopped(gitReason(rebased), aborted), handOver: [rebase, merge] };
57
61
  }
58
62
  const second = await runGit(shell, merge);
59
63
  if (second.exitCode === 0) {
60
- return { merged: true, rebased: true, line: `${req.ref} rebased on ${req.workBranch} and merged (fast-forward)` };
64
+ return { merged: true, rebased: true, line: rebasedAndMerged(req.ref, req.workBranch) };
61
65
  }
62
- return { merged: false, line: `not merged after the rebase: ${gitReason(second)}`, handOver: [merge] };
66
+ return { merged: false, line: notMergedAfterRebase(gitReason(second)), handOver: [merge] };
63
67
  }
@@ -0,0 +1,75 @@
1
+ // The lines the git services report: a commit, a push, a pull request, a batch's worktree and its merge.
2
+
3
+ export const DETACHED_HEAD = "a detached HEAD";
4
+
5
+ // commit-files.ts
6
+ export const refusedByRuntime = (reason: string): string => `refused by the runtime: ${reason}`;
7
+ export const noEmailInAnswer = (command: string): string => `${command}: no email in its answer`;
8
+ export const NOTHING_TO_COMMIT = "nothing to commit";
9
+ export const cannotGoThroughShell = (paths: string): string => `cannot go through the shell: ${paths}`;
10
+ export const MERGE_IN_PROGRESS = "a merge or a cherry-pick is in progress: conclude it with git commit in a terminal";
11
+ export const gitAddFailed = (reason: string): string => `git add failed: ${reason}`;
12
+ export const gitCommitFailed = (reason: string, note: string | null): string =>
13
+ `git commit failed: ${reason}${note === null ? "" : `; ${note}`}`;
14
+ export const removeByHand = (path: string, reason: string): string => `${path} could not be removed (${reason}): remove it by hand`;
15
+ export const commitMessageNotWritten = (file: string, fallback: string, reason: string): string =>
16
+ `the commit message could not be written (${file}, ${fallback}): ${reason}`;
17
+ export const NOT_PUSHED_DETACHED = "not pushed: no branch is checked out (detached HEAD)";
18
+ export const notPushedUnsafeBranch = (branch: string): string => `not pushed: the branch name '${branch}' cannot go through the shell`;
19
+ export const pushRefused = (reason: string): string => `push refused, the commit stays local: ${reason}`;
20
+ export const bodyOutsideMounts = (folder: string, bodyFile: string): string =>
21
+ `the body could not be written (${folder} is outside the mounts): write ${bodyFile} first`;
22
+ export const pullRequestBody = (bodyFile: string): string => `pull request body: ${bodyFile}`;
23
+ export const bodyNotWritten = (reason: string, bodyFile: string): string =>
24
+ `⚠ the body could not be written (${reason}): write ${bodyFile} first`;
25
+ export const pullRequestOpened = (url: string): string => `✓ pull request opened: ${url}`;
26
+ export const pullRequestNotOpened = (reason: string): string => `✗ the pull request was not opened: ${reason}`;
27
+ export const TO_OPEN_IN_A_TERMINAL = "to open the pull request, in a terminal:";
28
+ export const NO_GITHUB_TOOL =
29
+ "the pull request is opened here only through the github tool, which this host does not offer: run the command above";
30
+
31
+ // open-pull-request.ts
32
+ export const BASE_BRANCH_UNKNOWN = "the base branch is unknown (origin/HEAD is unset): git remote set-head origin --auto sets it";
33
+ export const originUrlUnreadable = (reason: string): string => `origin's URL could not be read: ${reason}`;
34
+ export const notAGitHubRepository = (url: string): string => `origin is not a github.com repository (${url})`;
35
+
36
+ // merge-batch.ts
37
+ export const notMergedUnsafe = (values: string): string => `not merged: ${values} cannot go through the shell`;
38
+ export const notMergedCheckoutElsewhere = (current: string, workBranch: string): string =>
39
+ `not merged: the checkout is on '${current}', not on ${workBranch}`;
40
+ export const mergedFastForward = (ref: string, workBranch: string): string => `${ref} merged into ${workBranch} (fast-forward)`;
41
+ export const rebaseAbortFailed = (reason: string): string => `rebase --abort failed too: ${reason}`;
42
+ export const rebaseStopped = (reason: string, aborted: string): string => `not merged, the rebase stopped (${reason}); ${aborted}`;
43
+ export const rebasedAndMerged = (ref: string, workBranch: string): string =>
44
+ `${ref} rebased on ${workBranch} and merged (fast-forward)`;
45
+ export const notMergedAfterRebase = (reason: string): string => `not merged after the rebase: ${reason}`;
46
+
47
+ // batch-worktree.ts
48
+ export const cannotGoThroughTheShell = (values: string): string => `${values} cannot go through the shell`;
49
+ export const notAWorktreeNameExplained = (name: string): string => `'${name}' is not a worktree name (one folder: letters, digits, . _ -)`;
50
+ export const branchExists = (branch: string): string => `branch ${branch} exists already: remove it or choose another name`;
51
+ export const orkeonNotIgnoredByGit = (path: string): string =>
52
+ `${path} is not ignored by git: add \`.orkeon/\` to .gitignore or .git/info/exclude first`;
53
+ export const worktreeNotCreated = (path: string, reason: string): string => `worktree ${path} not created: ${reason}`;
54
+ export const worktreeCreated = (path: string, branch: string, base: string): string => `✓ worktree ${path} on ${branch}, from ${base}`;
55
+ export const worktreeStateUnreadable = (path: string, reason: string): string => `the state of ${path} could not be read (${reason})`;
56
+ export const worktreeHoldsChanges = (path: string, changed: number): string =>
57
+ `${path} holds ${changed} uncommitted or untracked file(s): commit or discard them first`;
58
+ export const worktreeNotOnBranch = (path: string, branch: string, head: string): string =>
59
+ `${path} is not on ${branch} (${head}): check it out there first`;
60
+ export const branchNotMerged = (branch: string, count: string, into: string): string =>
61
+ `${branch} holds ${count} commit(s) not in ${into}: merge it first`;
62
+ export const mergedUnreadable = (branch: string, into: string, reason: string): string =>
63
+ `whether ${branch} is merged into ${into} could not be read (${reason})`;
64
+ export const worktreeNotRemoved = (path: string, reason: string): string => `worktree ${path} not removed: ${reason}`;
65
+ export const worktreeAndBranchRemoved = (path: string, branch: string): string => `✓ worktree ${path} and branch ${branch} removed`;
66
+ export const worktreeRemovedBranchKept = (path: string, branch: string, reason: string): string =>
67
+ `✓ worktree ${path} removed; branch ${branch} kept (${reason})`;
68
+ export const notMergedVerdict = (batch: string, verdict: string): string => `not merged: ${batch}'s audit is ${verdict}, not VALID`;
69
+ export const notMergedNotAWorktreeName = (name: string): string => `not merged: '${name}' is not a worktree name`;
70
+
71
+ // Shared by the crews that branch and push
72
+ export const refusedLine = (reason: string) => `✗ refused: ${reason}`;
73
+ export const branchCreated = (branch: string, from: string, pattern: string): string =>
74
+ `✓ branch ${branch} created from ${from} (contrib.branch ${pattern})`;
75
+ export const pushedToOrigin = (branch: string): string => `✓ pushed ${branch} to origin`;
@@ -10,6 +10,7 @@ import type { CreatePrArgs } from "../../domain/git/pull-request.ts";
10
10
  import { GITHUB_CREATE_PR, GIT_REMOTE_URL_COMMAND, parseGitHubRemote, pullRequestPermission } from "../../domain/git/pull-request.ts";
11
11
  import type { PullRequest, PullRequestOpener } from "./commit-files.ts";
12
12
  import { gitReason, runGit } from "./commit-files.ts";
13
+ import { BASE_BRANCH_UNKNOWN, notAGitHubRepository, originUrlUnreadable } from "./messages.ts";
13
14
 
14
15
  /** The `create_pr` call of the github tool: the url of the pull request opened, or a throw with GitHub's reason. */
15
16
  export interface GitHubPullRequests {
@@ -34,12 +35,12 @@ export function createPullRequestOpener(
34
35
  ): PullRequestOpener {
35
36
  return {
36
37
  async open(pr: PullRequest): Promise<{ url: string }> {
37
- if (pr.base === null) throw new Error("the base branch is unknown (origin/HEAD is unset): git remote set-head origin --auto sets it");
38
+ if (pr.base === null) throw new Error(BASE_BRANCH_UNKNOWN);
38
39
  const remote = await runGit(deps.shell, GIT_REMOTE_URL_COMMAND);
39
- if (remote.exitCode !== 0) throw new Error(`origin's URL could not be read: ${gitReason(remote)}`);
40
+ if (remote.exitCode !== 0) throw new Error(originUrlUnreadable(gitReason(remote)));
40
41
  const repo = parseGitHubRemote(remote.stdout);
41
42
  // The URL is echoed without its user part: a token written there never reaches the terminal.
42
- if (repo === null) throw new Error(`origin is not a github.com repository (${withoutUserInfo(remote.stdout)})`);
43
+ if (repo === null) throw new Error(notAGitHubRepository(withoutUserInfo(remote.stdout)));
43
44
  const args: CreatePrArgs = {
44
45
  action: GITHUB_CREATE_PR, owner: repo.owner, repo: repo.repo, base: pr.base, head: pr.head, title: pr.title, body: pr.body,
45
46
  };
@@ -0,0 +1,59 @@
1
+ // What every act's callbacks know of the host: its layout (host-layout-store.ts) and the user's path lists
2
+ // (agent-policy/path-rules.ts), read together once a run. The identity context, a posix host without mounts and
3
+ // without a list, means the callbacks have nothing to do.
4
+ import type { Files } from "./ports.ts";
5
+ import type { ConfigStore } from "./config-store.ts";
6
+ import { readHostLayout } from "./host-layout-store.ts";
7
+ import { IDENTITY_HOST, isIdentityHost } from "../domain/host-layout.ts";
8
+ import type { HostLayout } from "../domain/host-layout.ts";
9
+ import {
10
+ EMPTY_PATH_LISTS, PATHS_ALLOW_CONFIG_KEY, PATHS_DENY_CONFIG_KEY, readPathLists,
11
+ } from "../domain/agent-policy/path-rules.ts";
12
+ import type { PathListValues, PathLists } from "../domain/agent-policy/path-rules.ts";
13
+
14
+ /** How an adapter reads this run's context: once asked, at the first operation that needs it. */
15
+ export type HostSource = () => Promise<HostContext>;
16
+
17
+ export interface HostContext {
18
+ layout: HostLayout;
19
+ lists: PathLists;
20
+ }
21
+
22
+ export const IDENTITY_CONTEXT: HostContext = Object.freeze({ layout: IDENTITY_HOST, lists: EMPTY_PATH_LISTS }) as HostContext;
23
+
24
+ /** True when the context gives the callbacks nothing to do: no host fact, no list. */
25
+ export function isIdentityContext(host: HostContext): boolean {
26
+ return isIdentityHost(host.layout) && host.lists.deny.length === 0 && host.lists.allow.length === 0;
27
+ }
28
+
29
+ /** The lists of a run's context, for a command's gate: none when no source is given. */
30
+ export async function listsOf(host: HostSource | undefined): Promise<PathLists> {
31
+ return host === undefined ? EMPTY_PATH_LISTS : (await host()).lists;
32
+ }
33
+
34
+ export interface HostContextRead extends HostContext {
35
+ /** The layout's problems, then the lists', each named for /doctor. */
36
+ problems: string[];
37
+ /** launch.json is not JSON. */
38
+ malformed: boolean;
39
+ }
40
+
41
+ /** The two keys of one settings map, string values only (another type is no value: the schema reports it). */
42
+ function pathListValues(map: Record<string, unknown>): PathListValues {
43
+ const text = (key: string): string | undefined => typeof map[key] === "string" ? map[key] as string : undefined;
44
+ return { deny: text(PATHS_DENY_CONFIG_KEY), allow: text(PATHS_ALLOW_CONFIG_KEY) };
45
+ }
46
+
47
+ /** The host context of a run: launch.json, then the lists of the user settings and of the project file over it. */
48
+ export async function readHostContext(
49
+ files: Pick<Files, "read">, config: Pick<ConfigStore, "readFile" | "readUserFile">,
50
+ ): Promise<HostContextRead> {
51
+ const [layout, user, project] = await Promise.all([readHostLayout(files), config.readUserFile(), config.readFile()]);
52
+ const lists = readPathLists(pathListValues(user.map), pathListValues(project.map), layout.layout);
53
+ return {
54
+ layout: layout.layout,
55
+ lists: { deny: lists.deny, allow: lists.allow },
56
+ problems: [...layout.problems, ...lists.problems],
57
+ malformed: layout.malformed,
58
+ };
59
+ }
@@ -0,0 +1,45 @@
1
+ // The host layout the launcher wrote: /user-config/launch.json, beside the user settings, read through the Files
2
+ // port and parsed by the domain (host-layout.ts). A file that is absent, empty or unreadable (no mount, an older
3
+ // launcher, docker mode's empty layout) is the identity: today's behaviour, a posix host whose paths need no
4
+ // spelling back. One that is not JSON is malformed, named for /doctor, and the identity too.
5
+ import type { Files } from "./ports.ts";
6
+ import { IDENTITY_HOST, parseHostLayout } from "../domain/host-layout.ts";
7
+ import type { HostLayout } from "../domain/host-layout.ts";
8
+ import { notJsonNoHostLayout } from "./messages.ts";
9
+
10
+ export const HOST_LAYOUT_FILE_PATH = "/user-config/launch.json";
11
+
12
+ export interface HostLayoutRead {
13
+ layout: HostLayout;
14
+ /** What the parse left out, each named (host-layout.ts), and the file itself when it is not JSON. */
15
+ problems: string[];
16
+ /** The file holds text that is not JSON: nothing of it applies. */
17
+ malformed: boolean;
18
+ }
19
+
20
+ const IDENTITY_READ: HostLayoutRead = { layout: IDENTITY_HOST, problems: [], malformed: false };
21
+
22
+ /** The layout of launch.json, the identity when the file is absent, empty, unreadable or malformed. */
23
+ export async function readHostLayout(files: Pick<Files, "read">): Promise<HostLayoutRead> {
24
+ let content: string;
25
+ try {
26
+ content = (await files.read(HOST_LAYOUT_FILE_PATH)).trim();
27
+ } catch {
28
+ return IDENTITY_READ;
29
+ }
30
+ if (content.length === 0) return IDENTITY_READ;
31
+ let raw: unknown;
32
+ try {
33
+ raw = JSON.parse(content);
34
+ } catch {
35
+ return { layout: IDENTITY_HOST, problems: [notJsonNoHostLayout(HOST_LAYOUT_FILE_PATH)], malformed: true };
36
+ }
37
+ const { layout, problems } = parseHostLayout(raw);
38
+ return { layout, problems, malformed: false };
39
+ }
40
+
41
+ /** A reader of the layout that reads once: every call of every act needs it, and the launcher writes it once a run. */
42
+ export function onceHostLayout(read: () => Promise<HostLayoutRead>): () => Promise<HostLayoutRead> {
43
+ let layout: Promise<HostLayoutRead> | null = null;
44
+ return () => (layout ??= read());
45
+ }
@@ -5,6 +5,7 @@
5
5
  import type { ConfigStore } from "./config-store.ts";
6
6
  import { CONFIG_FILE_PATH } from "./config-store.ts";
7
7
  import { LLM_PROFILE_CONFIG_KEY, llmProfileProblem } from "../domain/llm-profile.ts";
8
+ import { couldNotBeReadOrParsed, llmProfileRejected, llmProfileUnreadable } from "./messages.ts";
8
9
 
9
10
  export interface LlmProfileRead {
10
11
  /** The profile every agent of the crew runs on; null when the session names none. */
@@ -17,12 +18,12 @@ export async function readLlmProfile(config: Pick<ConfigStore, "readValue" | "re
17
18
  try {
18
19
  const { value, source } = await config.readValue(LLM_PROFILE_CONFIG_KEY);
19
20
  if (source === "unset" && (await config.readFile()).malformed) {
20
- return unreadable(`${CONFIG_FILE_PATH} could not be read or parsed`);
21
+ return unreadable(couldNotBeReadOrParsed(CONFIG_FILE_PATH));
21
22
  }
22
23
  if (typeof value !== "string") return { profile: null };
23
24
  const problem = llmProfileProblem(value);
24
25
  if (problem !== undefined) {
25
- return { profile: null, warning: `${LLM_PROFILE_CONFIG_KEY}: ${problem}; the host's default model this launch` };
26
+ return { profile: null, warning: llmProfileRejected(LLM_PROFILE_CONFIG_KEY, problem) };
26
27
  }
27
28
  return { profile: value.trim() };
28
29
  } catch (e: unknown) {
@@ -31,5 +32,5 @@ export async function readLlmProfile(config: Pick<ConfigStore, "readValue" | "re
31
32
  }
32
33
 
33
34
  function unreadable(why: string): LlmProfileRead {
34
- return { profile: null, warning: `${LLM_PROFILE_CONFIG_KEY} could not be read (${why}): the host's default model this launch` };
35
+ return { profile: null, warning: llmProfileUnreadable(LLM_PROFILE_CONFIG_KEY, why) };
35
36
  }
@@ -0,0 +1,14 @@
1
+ // The text the shared application services report to the user: unreadable settings, warnings, where a mode came from.
2
+
3
+ export const couldNotBeReadOrParsed = (path: string): string => `${path} could not be read or parsed`;
4
+ export const notJsonNoHostLayout = (path: string): string => `${path} is not JSON: no host layout applies`;
5
+ export const llmProfileRejected = (key: string, problem: string): string =>
6
+ `${key}: ${problem}; the host's default model this launch`;
7
+ export const llmProfileUnreadable = (key: string, why: string): string =>
8
+ `${key} could not be read (${why}): the host's default model this launch`;
9
+ export const SESSION_DEFAULT_VIA_MODE = "session default via /mode";
10
+
11
+ // Shared by several application folders
12
+ export const cannotBeRead = (path: string, reason: string): string => `${path} cannot be read (${reason})`;
13
+ export const prefixedCannotBeRead = (prefix: string, path: string, reason: string): string => `${prefix}: ${path} cannot be read (${reason})`;
14
+ export const couldNotRun = (command: string, reason: string): string => `${command} could not run: ${reason}`;
@@ -19,6 +19,9 @@ import { readJsonArray, writeJson } from "./session-state.ts";
19
19
  import { formatRule, parseStoredRule, readRule, sameCalls } from "../domain/agent-policy/permission.ts";
20
20
  import type { PermissionRule } from "../domain/agent-policy/permission.ts";
21
21
  import { PERMISSION_RULES_STATE_KEY } from "../domain/session-keys.ts";
22
+ import { memoryWriteRules } from "../domain/shared-memory/layout.ts";
23
+ import { pathListRules, userConfigRules } from "../domain/agent-policy/path-rules.ts";
24
+ import type { PathLists } from "../domain/agent-policy/path-rules.ts";
22
25
 
23
26
  /** The stored rules, sorted by what the session can do with them. */
24
27
  export interface StoredRules {
@@ -157,3 +160,10 @@ export async function syncStepRules(deps: {
157
160
  for (const rule of builtIn) deps.gate.add(rule);
158
161
  return { ...stored, applied: true, step: [...deps.rules], builtIn, overridden };
159
162
  }
163
+
164
+ /** The rules every sync puts in the gate after the session's: the shared memory's guard (no tool of the model writes
165
+ * its candidates or entries), the whole /user-config mount closed, and the user's paths.deny on the canonical
166
+ * spelling (agent-policy/path-rules.ts). */
167
+ export function builtInRules(memoryDir: string, lists: PathLists): PermissionRule[] {
168
+ return [...memoryWriteRules(memoryDir), ...userConfigRules(), ...pathListRules(lists)];
169
+ }
@@ -0,0 +1,14 @@
1
+ // The decision port: the host's decision model, asked typed questions about a state.
2
+ // Types only, re-exported by ../ports.ts.
3
+
4
+ import type { DecisionAnswers, DecisionQuestions } from "../../domain/decision/questions.ts";
5
+
6
+ /** The decision model the host's settings configure (`Orkeon:Decision`), whichever provider serves it. A use case
7
+ * that asks it keeps working without it: no model, a failed call and an unreadable answer are all `null`. */
8
+ export interface DecisionModel {
9
+ /** Whether the host has a decision model to ask. */
10
+ available(): boolean;
11
+ /** Ask `questions` about `state` (a text, or any JSON value) in one request; resolves to every answer by the
12
+ * name of its question, or to null. Never throws. */
13
+ ask(state: unknown, questions: DecisionQuestions): Promise<DecisionAnswers | null>;
14
+ }