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.
- package/.orkeon-runtime +10 -0
- package/.orkeon-version +1 -1
- package/NOTICE.md +1 -1
- package/README.fr.md +16 -22
- package/README.md +16 -22
- package/config/appsettings.jev.example.json +4 -1
- package/config/appsettings.kev.example.json +4 -1
- package/config/appsettings.liquid.example.json +4 -1
- package/config/appsettings.ollama-whisper.example.json +1 -0
- package/config/appsettings.whisper.example.json +1 -0
- package/mcp/whisper/README.md +2 -1
- package/orkeon-code +206 -11
- package/orkeon-code.ps1 +109 -7
- package/package.json +2 -1
- package/src/commands/.orkeon/orkeon-cli.d.ts +1 -4
- package/src/commands/_lib/args.ts +5 -4
- package/src/commands/_lib/dev/dev-batches.ts +34 -36
- package/src/commands/_lib/dev/dev-implement.ts +11 -14
- package/src/commands/_lib/dev/dev-source.ts +7 -11
- package/src/commands/_lib/dev/dev.ts +34 -37
- package/src/commands/_lib/dev/markers.ts +7 -0
- package/src/commands/_lib/dev/messages.ts +112 -0
- package/src/commands/_lib/dev-step.ts +16 -13
- package/src/commands/_lib/dispatch.ts +62 -39
- package/src/commands/_lib/git/branch.ts +9 -10
- package/src/commands/_lib/git/commit.ts +9 -13
- package/src/commands/_lib/git/diff.ts +22 -12
- package/src/commands/_lib/git/messages.ts +54 -0
- package/src/commands/_lib/git/review.ts +9 -10
- package/src/commands/_lib/memory/memory-admit.ts +19 -21
- package/src/commands/_lib/memory/memory.ts +3 -2
- package/src/commands/_lib/memory/messages.ts +32 -0
- package/src/commands/_lib/messages.ts +48 -0
- package/src/commands/_lib/project/messages.ts +8 -0
- package/src/commands/_lib/session/export.ts +3 -2
- package/src/commands/_lib/session/messages.ts +87 -0
- package/src/commands/_lib/session/prompts.ts +4 -0
- package/src/commands/_lib/session/resume.ts +15 -24
- package/src/commands/_lib/session/tasks.ts +20 -23
- package/src/commands/_lib/settings/advisor.ts +11 -16
- package/src/commands/_lib/settings/agents.ts +18 -28
- package/src/commands/_lib/settings/choices.ts +8 -0
- package/src/commands/_lib/settings/config.ts +43 -43
- package/src/commands/_lib/settings/effort.ts +147 -0
- package/src/commands/_lib/settings/hooks.ts +12 -20
- package/src/commands/_lib/settings/messages.ts +408 -0
- package/src/commands/_lib/settings/mode.ts +33 -24
- package/src/commands/_lib/settings/model.ts +71 -36
- package/src/commands/_lib/settings/output-style.ts +39 -0
- package/src/commands/_lib/settings/permissions.ts +71 -93
- package/src/commands/_lib/settings/route.ts +63 -0
- package/src/commands/_lib/settings/skills.ts +53 -11
- package/src/commands/_lib/settings/theme.ts +42 -0
- package/src/commands/_lib/speech/messages.ts +58 -0
- package/src/commands/_lib/speech/prompts.ts +4 -0
- package/src/commands/_lib/speech/say.ts +9 -10
- package/src/commands/_lib/speech/transcribe.ts +14 -23
- package/src/commands/_lib/speech/voice.ts +14 -18
- package/src/commands/_lib/status/doctor.ts +47 -28
- package/src/commands/_lib/status/messages.ts +100 -0
- package/src/commands/_lib/status/meta.ts +3 -24
- package/src/commands/_lib/status/status.ts +10 -11
- package/src/commands/_lib/status/usage-tools.ts +2 -3
- package/src/commands/_lib/status/usage.ts +7 -18
- package/src/commands/_lib/view.ts +6 -1
- package/src/commands/dev/dev-batches.cmd.ts +4 -3
- package/src/commands/dev/dev-learn.cmd.ts +3 -3
- package/src/commands/dev/dev-plan.cmd.ts +6 -7
- package/src/commands/dev/dev-spec.cmd.ts +6 -7
- package/src/commands/git/commit.cmd.ts +3 -3
- package/src/commands/git/review.cmd.ts +3 -3
- package/src/commands/memory/memory.cmd.ts +2 -2
- package/src/commands/project/analyze.cmd.ts +3 -3
- package/src/commands/project/debug-tool-call.cmd.ts +4 -9
- package/src/commands/project/init-verifiers.cmd.ts +3 -3
- package/src/commands/project/init.cmd.ts +3 -3
- package/src/commands/project/verify.cmd.ts +2 -2
- package/src/commands/session/assistant.cmd.ts +2 -2
- package/src/commands/session/compact.cmd.ts +1 -1
- package/src/commands/session/copy.cmd.ts +8 -7
- package/src/commands/session/rename.cmd.ts +3 -2
- package/src/commands/session/rewind.cmd.ts +3 -4
- package/src/commands/session/summary.cmd.ts +3 -3
- package/src/commands/session/tasks.cmd.ts +4 -2
- package/src/commands/settings/config.cmd.ts +4 -2
- package/src/commands/settings/effort.cmd.ts +10 -31
- package/src/commands/settings/fast.cmd.ts +2 -1
- package/src/commands/settings/mode.cmd.ts +3 -3
- package/src/commands/settings/model.cmd.ts +3 -2
- package/src/commands/settings/output-style.cmd.ts +9 -38
- package/src/commands/settings/permissions.cmd.ts +2 -2
- package/src/commands/settings/proactive.cmd.ts +2 -1
- package/src/commands/settings/route.cmd.ts +16 -0
- package/src/commands/settings/skills.cmd.ts +3 -3
- package/src/commands/settings/theme.cmd.ts +14 -0
- package/src/commands/speech/say.cmd.ts +2 -2
- package/src/commands/speech/transcribe.cmd.ts +2 -2
- package/src/commands/status/release-notes.cmd.ts +1 -1
- package/src/crews/.orkeon/orkeon.d.ts +538 -93
- package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
- package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +17 -12
- package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
- package/src/crews/_probe-shared-memory/probe.ork.ts +5 -3
- package/src/crews/advisor/application/messages.ts +4 -0
- package/src/crews/advisor/application/prompts.ts +4 -0
- package/src/crews/advisor/application/run-advisor.ts +2 -1
- package/src/crews/advisor/crew.ork.ts +5 -4
- package/src/crews/advisor/domain/advice.ts +7 -23
- package/src/crews/advisor/domain/messages.ts +8 -0
- package/src/crews/advisor/domain/prompts.ts +26 -0
- package/src/crews/agent-run/application/messages.ts +18 -0
- package/src/crews/agent-run/application/run-agent-run.ts +5 -4
- package/src/crews/agent-run/crew.ork.ts +3 -3
- package/src/crews/analyze/application/messages.ts +27 -0
- package/src/crews/analyze/application/prompts.ts +4 -0
- package/src/crews/analyze/application/run-analyze.ts +16 -14
- package/src/crews/analyze/crew.ork.ts +5 -4
- package/src/crews/analyze/domain/harvest.ts +33 -65
- package/src/crews/analyze/domain/prompts.ts +86 -0
- package/src/crews/code-review/application/lens-material.ts +24 -0
- package/src/crews/code-review/application/messages.ts +17 -0
- package/src/crews/code-review/application/prompts.ts +10 -17
- package/src/crews/code-review/application/review.ts +4 -1
- package/src/crews/code-review/application/run-code-review.ts +13 -15
- package/src/crews/code-review/crew.ork.ts +5 -4
- package/src/crews/code-review/domain/lenses.ts +6 -45
- package/src/crews/code-review/domain/messages.ts +25 -0
- package/src/crews/code-review/domain/prompts.ts +58 -0
- package/src/crews/code-review/domain/report.ts +5 -6
- package/src/crews/code-review/domain/scope.ts +6 -12
- package/src/crews/dev-batches/application/messages.ts +127 -0
- package/src/crews/dev-batches/application/plan-close.ts +12 -12
- package/src/crews/dev-batches/application/prompts.ts +10 -0
- package/src/crews/dev-batches/application/run-dev-batches.ts +57 -50
- package/src/crews/dev-batches/application/run-wave.ts +24 -22
- package/src/crews/dev-batches/application/seed-harvest.ts +8 -7
- package/src/crews/dev-batches/crew.ork.ts +12 -9
- package/src/crews/dev-batches/domain/batches-log.ts +1 -3
- package/src/crews/dev-batches/domain/markers.ts +5 -0
- package/src/crews/dev-batches/domain/messages.ts +6 -0
- package/src/crews/dev-batches/domain/wave-order.ts +3 -2
- package/src/crews/dev-change/application/change-material.ts +44 -0
- package/src/crews/dev-change/application/evidence.ts +25 -22
- package/src/crews/dev-change/application/messages.ts +81 -0
- package/src/crews/dev-change/application/{change-prompt.ts → prompts.ts} +40 -43
- package/src/crews/dev-change/application/run-dev-change.ts +43 -34
- package/src/crews/dev-change/crew.ork.ts +11 -9
- package/src/crews/dev-change/domain/change-answer.ts +24 -20
- package/src/crews/dev-change/domain/change-render.ts +13 -15
- package/src/crews/dev-change/domain/markers.ts +28 -0
- package/src/crews/dev-change/domain/messages.ts +16 -0
- package/src/crews/dev-implement/application/close.ts +21 -18
- package/src/crews/dev-implement/application/locate-sheet.ts +7 -5
- package/src/crews/dev-implement/application/messages.ts +161 -0
- package/src/crews/dev-implement/application/observe.ts +4 -2
- package/src/crews/dev-implement/application/prompts.ts +9 -0
- package/src/crews/dev-implement/application/report-writes.ts +14 -9
- package/src/crews/dev-implement/application/run-dev-implement.ts +84 -73
- package/src/crews/dev-implement/application/suite-job.ts +15 -11
- package/src/crews/dev-implement/crew.ork.ts +2 -1
- package/src/crews/dev-implement/domain/contracts.ts +59 -60
- package/src/crews/dev-implement/domain/correction.ts +16 -15
- package/src/crews/dev-implement/domain/cycles.ts +2 -1
- package/src/crews/dev-implement/domain/markers.ts +23 -0
- package/src/crews/dev-implement/domain/messages.ts +58 -0
- package/src/crews/dev-implement/domain/prompts.ts +93 -0
- package/src/crews/dev-implement/domain/roles.ts +3 -7
- package/src/crews/dev-implement/domain/sheet-edits.ts +6 -5
- package/src/crews/dev-implement/domain/sheet-ticks.ts +5 -4
- package/src/crews/dev-implement/domain/step-checks.ts +17 -16
- package/src/crews/dev-implement/domain/step-section.ts +6 -4
- package/src/crews/dev-learn/application/learn-prompt-fit.ts +63 -0
- package/src/crews/dev-learn/application/messages.ts +51 -0
- package/src/crews/dev-learn/application/{learn-prompt.ts → prompts.ts} +24 -65
- package/src/crews/dev-learn/application/run-dev-learn.ts +37 -32
- package/src/crews/dev-learn/crew.ork.ts +4 -3
- package/src/crews/dev-learn/domain/learn-answer.ts +25 -27
- package/src/crews/dev-learn/domain/messages.ts +65 -0
- package/src/crews/dev-learn/domain/owner-lines.ts +12 -9
- package/src/crews/dev-learn/domain/proposals-render.ts +8 -9
- package/src/crews/dev-plan/application/anchor-paths.ts +57 -20
- package/src/crews/dev-plan/application/inventory.ts +17 -13
- package/src/crews/dev-plan/application/messages.ts +88 -0
- package/src/crews/dev-plan/application/plan-prompt-fit.ts +44 -0
- package/src/crews/dev-plan/application/{plan-prompt.ts → prompts.ts} +37 -55
- package/src/crews/dev-plan/application/run-dev-plan.ts +103 -75
- package/src/crews/dev-plan/crew.ork.ts +11 -8
- package/src/crews/dev-plan/domain/inventory-model.ts +3 -3
- package/src/crews/dev-plan/domain/markers.ts +18 -0
- package/src/crews/dev-plan/domain/messages.ts +118 -0
- package/src/crews/dev-plan/domain/plan-answer.ts +118 -103
- package/src/crews/dev-plan/domain/plan-render.ts +30 -31
- package/src/crews/dev-plan/domain/prompts.ts +44 -0
- package/src/crews/dev-spec/application/messages.ts +30 -0
- package/src/crews/dev-spec/application/{spec-prompt.ts → prompts.ts} +42 -47
- package/src/crews/dev-spec/application/run-dev-spec.ts +67 -36
- package/src/crews/dev-spec/application/spec-material.ts +42 -0
- package/src/crews/dev-spec/crew.ork.ts +11 -9
- package/src/crews/dev-spec/domain/markers.ts +30 -0
- package/src/crews/dev-spec/domain/messages.ts +39 -0
- package/src/crews/dev-spec/domain/spec-answer.ts +46 -47
- package/src/crews/dev-spec/domain/spec-render.ts +18 -18
- package/src/crews/dev-verify/application/audit-brief.ts +187 -0
- package/src/crews/dev-verify/application/audit.ts +38 -30
- package/src/crews/dev-verify/application/capture.ts +34 -26
- package/src/crews/dev-verify/application/messages.ts +119 -0
- package/src/crews/dev-verify/application/prompts.ts +209 -0
- package/src/crews/dev-verify/application/run-dev-verify.ts +60 -46
- package/src/crews/dev-verify/application/run-gate.ts +11 -9
- package/src/crews/dev-verify/crew.ork.ts +6 -6
- package/src/crews/dev-verify/domain/audit-answer.ts +16 -12
- package/src/crews/dev-verify/domain/capture-sections.ts +5 -4
- package/src/crews/dev-verify/domain/commands.ts +3 -3
- package/src/crews/dev-verify/domain/gate.ts +21 -16
- package/src/crews/dev-verify/domain/markers.ts +16 -0
- package/src/crews/dev-verify/domain/mechanical-table.ts +37 -44
- package/src/crews/dev-verify/domain/messages.ts +92 -0
- package/src/crews/dev-verify/domain/verdict.ts +4 -4
- package/src/crews/git-commit/application/draft.ts +16 -37
- package/src/crews/git-commit/application/messages.ts +15 -0
- package/src/crews/git-commit/application/prompts.ts +47 -0
- package/src/crews/git-commit/application/run-git-commit.ts +13 -12
- package/src/crews/git-commit/crew.ork.ts +5 -4
- package/src/crews/git-commit/domain/commit.ts +15 -35
- package/src/crews/git-commit/domain/markers.ts +4 -0
- package/src/crews/git-commit/domain/messages.ts +48 -0
- package/src/crews/init-verifiers/application/authoring.ts +2 -1
- package/src/crews/init-verifiers/application/messages.ts +13 -0
- package/src/crews/init-verifiers/application/prompts.ts +5 -1
- package/src/crews/init-verifiers/application/run-init-verifiers.ts +3 -2
- package/src/crews/init-verifiers/crew.ork.ts +5 -4
- package/src/crews/main-loop/application/auto-compact.ts +2 -1
- package/src/crews/main-loop/application/messages.ts +81 -0
- package/src/crews/main-loop/application/prompts.ts +12 -0
- package/src/crews/main-loop/application/run-main-loop.ts +63 -30
- package/src/crews/main-loop/application/{turn-prompt.ts → turn-context.ts} +7 -8
- package/src/crews/main-loop/crew.ork.ts +12 -7
- package/src/crews/main-loop/domain/prompt-assembly.ts +45 -228
- package/src/crews/main-loop/domain/prompts.ts +336 -0
- package/src/crews/main-loop/domain/turn-chains.ts +10 -9
- package/src/crews/project-init/application/detect.ts +5 -4
- package/src/crews/project-init/application/messages.ts +15 -0
- package/src/crews/project-init/application/prompts.ts +11 -7
- package/src/crews/project-init/crew.ork.ts +5 -4
- package/src/crews/project-init/domain/existing-files.ts +6 -4
- package/src/crews/project-init/domain/messages.ts +13 -0
- package/src/crews/project-init/domain/package-map.ts +3 -3
- package/src/crews/project-init/domain/prompts.ts +10 -0
- package/src/crews/session-compact/application/prompts.ts +5 -0
- package/src/crews/session-compact/crew.ork.ts +5 -4
- package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
- package/src/crews/shared-memory-admit/crew.ork.ts +3 -2
- package/src/crews/speech/application/messages.ts +3 -0
- package/src/crews/speech/application/prompts.ts +3 -0
- package/src/crews/speech/application/run-speech.ts +2 -1
- package/src/crews/speech/crew.ork.ts +2 -1
- package/src/shared/application/agents/child-agent.ts +11 -7
- package/src/shared/application/agents/messages.ts +35 -0
- package/src/shared/application/agents/route-agent.ts +115 -0
- package/src/shared/application/agents/run-sub-agent.ts +31 -8
- package/src/shared/application/compaction/compact-session.ts +19 -14
- package/src/shared/application/compaction/messages.ts +20 -0
- package/src/shared/application/compaction/prune-context.ts +94 -0
- package/src/shared/application/compaction/pruned-llm.ts +35 -0
- package/src/shared/application/dev/brief-inventory.ts +6 -4
- package/src/shared/application/dev/close-batch.ts +9 -7
- package/src/shared/application/dev/find-repo-pack.ts +4 -3
- package/src/shared/application/dev/learn-decision.ts +20 -18
- package/src/shared/application/dev/load-dev-context.ts +7 -8
- package/src/shared/application/dev/measure-access-cost.ts +5 -4
- package/src/shared/application/dev/messages.ts +132 -0
- package/src/shared/application/dev/phase-timer.ts +54 -0
- package/src/shared/application/dev/plan-source.ts +12 -8
- package/src/shared/application/dev/preflight.ts +8 -8
- package/src/shared/application/dev/prompts.ts +34 -0
- package/src/shared/application/dev/question-round.ts +25 -17
- package/src/shared/application/dev/resolve-work-folder.ts +4 -3
- package/src/shared/application/dev/settle-questions.ts +4 -2
- package/src/shared/application/dev/source-review.ts +12 -8
- package/src/shared/application/dev/source-step.ts +12 -10
- package/src/shared/application/dev/spend.ts +17 -4
- package/src/shared/application/dev/step-precedents.ts +2 -1
- package/src/shared/application/dev/tool-call-policy.ts +9 -11
- package/src/shared/application/dev/tool-callbacks.ts +52 -5
- package/src/shared/application/dev/tool-trace-recorder.ts +2 -1
- package/src/shared/application/dev/verdict-sources.ts +5 -3
- package/src/shared/application/dev/wrapped-tools.ts +4 -2
- package/src/shared/application/extra-tools.ts +2 -1
- package/src/shared/application/git/batch-worktree.ts +22 -17
- package/src/shared/application/git/commit-files.ts +24 -19
- package/src/shared/application/git/merge-batch.ts +11 -7
- package/src/shared/application/git/messages.ts +75 -0
- package/src/shared/application/git/open-pull-request.ts +4 -3
- package/src/shared/application/host-context.ts +59 -0
- package/src/shared/application/host-layout-store.ts +45 -0
- package/src/shared/application/llm-profile.ts +4 -3
- package/src/shared/application/messages.ts +14 -0
- package/src/shared/application/permission-rules.ts +10 -0
- package/src/shared/application/ports/decision.ts +14 -0
- package/src/shared/application/ports/human.ts +25 -0
- package/src/shared/application/ports/llm.ts +32 -3
- package/src/shared/application/ports/memory.ts +1 -1
- package/src/shared/application/ports/theme.ts +11 -0
- package/src/shared/application/ports.ts +4 -2
- package/src/shared/application/session-io.ts +2 -1
- package/src/shared/application/shared-memory/admit-entries.ts +16 -14
- package/src/shared/application/shared-memory/harvest-after-gaps.ts +5 -8
- package/src/shared/application/shared-memory/harvest-mistakes.ts +3 -2
- package/src/shared/application/shared-memory/import-agent-memory.ts +9 -7
- package/src/shared/application/shared-memory/memory-files.ts +2 -1
- package/src/shared/application/shared-memory/memory-settings.ts +2 -1
- package/src/shared/application/shared-memory/messages.ts +63 -0
- package/src/shared/application/shared-memory/push-candidate.ts +14 -11
- package/src/shared/application/shared-memory/recall-precedents.ts +2 -1
- package/src/shared/application/skills/messages.ts +4 -0
- package/src/shared/application/skills/suggest-skills.ts +102 -0
- package/src/shared/application/workflow/messages.ts +8 -0
- package/src/shared/application/workflow/workflow-state.ts +7 -6
- package/src/shared/domain/agent-policy/behavior-flags.ts +4 -10
- package/src/shared/domain/agent-policy/extra-tools.ts +2 -4
- package/src/shared/domain/agent-policy/messages.ts +66 -0
- package/src/shared/domain/agent-policy/path-rules.ts +299 -0
- package/src/shared/domain/agent-policy/permission.ts +20 -18
- package/src/shared/domain/agent-policy/prompts.ts +17 -0
- package/src/shared/domain/agent-policy/reasoning.ts +59 -0
- package/src/shared/domain/agent-policy/rule-sets.ts +18 -14
- package/src/shared/domain/agent-policy/tool-access.ts +17 -3
- package/src/shared/domain/agent-registry.ts +6 -5
- package/src/shared/domain/agents/chain.ts +2 -2
- package/src/shared/domain/agents/charter.ts +8 -5
- package/src/shared/domain/agents/exclusive.ts +2 -1
- package/src/shared/domain/agents/instances.ts +18 -15
- package/src/shared/domain/agents/messages.ts +39 -0
- package/src/shared/domain/agents/model-route.ts +199 -0
- package/src/shared/domain/agents/prompts.ts +20 -0
- package/src/shared/domain/code-intel-contract.ts +5 -4
- package/src/shared/domain/code-intel-routing.ts +8 -61
- package/src/shared/domain/compact-outcome.ts +5 -3
- package/src/shared/domain/compaction-thresholds.ts +2 -1
- package/src/shared/domain/compaction.ts +22 -113
- package/src/shared/domain/config-schema.ts +94 -81
- package/src/shared/domain/context-prune.ts +176 -0
- package/src/shared/domain/decision/questions.ts +102 -0
- package/src/shared/domain/dev/access-cost.ts +19 -15
- package/src/shared/domain/dev/batches-concurrency.ts +5 -6
- package/src/shared/domain/dev/build-commands.ts +5 -4
- package/src/shared/domain/dev/call-guard.ts +29 -28
- package/src/shared/domain/dev/carried-text.ts +3 -5
- package/src/shared/domain/dev/learn-proposals.ts +5 -4
- package/src/shared/domain/dev/learn-state.ts +3 -2
- package/src/shared/domain/dev/markers.ts +107 -0
- package/src/shared/domain/dev/messages.ts +259 -0
- package/src/shared/domain/dev/phase-timing.ts +50 -0
- package/src/shared/domain/dev/plan-checks.ts +24 -23
- package/src/shared/domain/dev/plan-format.ts +14 -24
- package/src/shared/domain/dev/project-files.ts +1 -15
- package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
- package/src/shared/domain/dev/{review-prompt.ts → prompts.ts} +91 -61
- package/src/shared/domain/dev/questions.ts +33 -15
- package/src/shared/domain/dev/repo-pack.ts +12 -9
- package/src/shared/domain/dev/review-answer.ts +40 -17
- package/src/shared/domain/dev/review-brief.ts +54 -0
- package/src/shared/domain/dev/reviewer-charter.ts +4 -0
- package/src/shared/domain/dev/sheet-facts.ts +2 -4
- package/src/shared/domain/dev/spec-format.ts +13 -14
- package/src/shared/domain/dev/step-budget.ts +4 -2
- package/src/shared/domain/dev/step-rules.ts +3 -4
- package/src/shared/domain/dev/test-commands.ts +14 -10
- package/src/shared/domain/dev/tool-guards.ts +4 -3
- package/src/shared/domain/dev/trait-pattern.ts +14 -10
- package/src/shared/domain/dev/verdict-format.ts +14 -21
- package/src/shared/domain/dev/whitespace.ts +3 -2
- package/src/shared/domain/dev/work-folder.ts +4 -3
- package/src/shared/domain/dev/yaml-subset.ts +8 -26
- package/src/shared/domain/error-text.ts +13 -0
- package/src/shared/domain/git/close.ts +5 -4
- package/src/shared/domain/git/messages.ts +20 -0
- package/src/shared/domain/git/pull-request.ts +5 -5
- package/src/shared/domain/host-layout.ts +147 -0
- package/src/shared/domain/host-paths.ts +399 -0
- package/src/shared/domain/llm-failure.ts +35 -7
- package/src/shared/domain/llm-profile.ts +22 -3
- package/src/shared/domain/marked-message.ts +1 -5
- package/src/shared/domain/markers.ts +30 -0
- package/src/shared/domain/messages.ts +291 -0
- package/src/shared/domain/model-catalog.ts +2 -9
- package/src/shared/domain/permission-modes.ts +4 -8
- package/src/shared/domain/prelude.ts +2 -2
- package/src/shared/domain/project-manifests.ts +3 -2
- package/src/shared/domain/prompts.ts +233 -0
- package/src/shared/domain/search-routing.ts +3 -11
- package/src/shared/domain/secret-patterns.ts +3 -2
- package/src/shared/domain/session-keys.ts +7 -0
- package/src/shared/domain/session-start.ts +3 -2
- package/src/shared/domain/shared-memory/agent-memory-import.ts +4 -2
- package/src/shared/domain/shared-memory/candidates.ts +3 -4
- package/src/shared/domain/shared-memory/entry.ts +26 -20
- package/src/shared/domain/shared-memory/front-matter.ts +17 -13
- package/src/shared/domain/shared-memory/gate.ts +4 -3
- package/src/shared/domain/shared-memory/harvest.ts +9 -6
- package/src/shared/domain/shared-memory/layout.ts +11 -8
- package/src/shared/domain/shared-memory/markers.ts +9 -0
- package/src/shared/domain/shared-memory/messages.ts +66 -0
- package/src/shared/domain/shared-memory/precedents-block.ts +4 -15
- package/src/shared/domain/shared-memory/prompts.ts +28 -0
- package/src/shared/domain/shared-memory/refused.ts +3 -3
- package/src/shared/domain/skills/prompts.ts +4 -0
- package/src/shared/domain/skills/shortlist.ts +149 -0
- package/src/shared/domain/snip-turns.ts +2 -14
- package/src/shared/domain/speech.ts +2 -1
- package/src/shared/domain/tool-trace.ts +5 -7
- package/src/shared/domain/verifiers.ts +7 -11
- package/src/shared/domain/vfs.ts +8 -1
- package/src/shared/domain/workflow/prompts.ts +15 -0
- package/src/shared/domain/workflow/state-file.ts +14 -12
- package/src/shared/infrastructure/globals.ts +7 -2
- package/src/shared/infrastructure/orkeon/child-agents.ts +11 -16
- package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
- package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
- package/src/shared/infrastructure/orkeon/dev-deps.ts +21 -14
- package/src/shared/infrastructure/orkeon/files.ts +24 -6
- package/src/shared/infrastructure/orkeon/github-pull-requests.ts +3 -2
- package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
- package/src/shared/infrastructure/orkeon/human-input.ts +1 -5
- package/src/shared/infrastructure/orkeon/llm-profile.ts +36 -16
- package/src/shared/infrastructure/orkeon/llm.ts +85 -30
- package/src/shared/infrastructure/orkeon/markers.ts +6 -0
- package/src/shared/infrastructure/orkeon/memory-store.ts +1 -1
- package/src/shared/infrastructure/orkeon/memory-tools.ts +18 -20
- package/src/shared/infrastructure/orkeon/messages.ts +15 -0
- package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
- package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
- package/src/shared/infrastructure/orkeon/script-tools.ts +14 -19
- package/src/shared/infrastructure/orkeon/session-store.ts +7 -51
- package/src/shared/infrastructure/orkeon/shell-jobs.ts +13 -7
- package/src/shared/infrastructure/orkeon/shell.ts +13 -5
- package/src/shared/infrastructure/orkeon/tool-catalogue.ts +3 -2
- package/src/shared/infrastructure/orkeon/wiring.ts +68 -12
- package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
- package/src/shared/domain/session-summary.ts +0 -13
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// dev-implement's: this crew writes only the log, the run record and the pull request's body - and, in a parallel
|
|
13
13
|
// run, the files it seeds and harvests and the merges of the VALID batches.
|
|
14
14
|
import type { Files, Llm, Logger, Shell } from "../../../shared/application/ports.ts";
|
|
15
|
+
import type { ActRoute } from "../../../shared/application/agents/route-agent.ts";
|
|
15
16
|
import type { ConfigStore } from "../../../shared/application/config-store.ts";
|
|
16
17
|
import type { PullRequestOpener } from "../../../shared/application/git/commit-files.ts";
|
|
17
18
|
import { defaultBranch, runGit } from "../../../shared/application/git/commit-files.ts";
|
|
@@ -27,7 +28,7 @@ import { batchWaves, sheetAnchorPaths } from "../domain/batch-waves.ts";
|
|
|
27
28
|
import { runWave } from "./run-wave.ts";
|
|
28
29
|
import { batchWorktreeName, worktreePlace } from "../../../shared/domain/git/worktree.ts";
|
|
29
30
|
import type { BatchOutcome, BatchRun } from "./run-wave.ts";
|
|
30
|
-
import { parseBatchesState } from "../../../shared/domain/dev/batches-state.ts";
|
|
31
|
+
import { BATCHES_ACTIVE_RECORD, parseBatchesState } from "../../../shared/domain/dev/batches-state.ts";
|
|
31
32
|
import type { BatchesLogEntry } from "../../../shared/domain/dev/batches-state.ts";
|
|
32
33
|
import {
|
|
33
34
|
GAPS_ROUNDS_MAX, closeCommand, correctionCommand, gapsFinding, gapsRoundsOf, isUnfinishedSection, lastVerdict,
|
|
@@ -35,17 +36,22 @@ import {
|
|
|
35
36
|
import { NEXT_BATCH_REVIEWER_CHARTER } from "../../../shared/domain/dev/reviewer-charter.ts";
|
|
36
37
|
import { charterCatalogue } from "../../../shared/domain/agents/charter.ts";
|
|
37
38
|
import type { CarriedText } from "../../../shared/domain/dev/carried-text.ts";
|
|
38
|
-
import { REVIEW_ANSWER_SCHEMA,
|
|
39
|
-
import {
|
|
39
|
+
import { REVIEW_ANSWER_SCHEMA, reviewChecks } from "../../../shared/domain/dev/review-answer.ts";
|
|
40
|
+
import { reviewSystem } from "../../../shared/domain/dev/prompts.ts";
|
|
41
|
+
import { buildReviewAnswerPrompt, buildReviewBrief } from "../../../shared/domain/dev/review-brief.ts";
|
|
40
42
|
import { parseSessionRules } from "../../../shared/domain/git/pull-request.ts";
|
|
41
43
|
import { GIT_CURRENT_BRANCH_COMMAND, GIT_HEAD_COMMAND, shellQuote, workBranchFromPattern } from "../../../shared/domain/git/close.ts";
|
|
42
44
|
import { policyFor } from "../../../shared/domain/agent-policy/mode-policy.ts";
|
|
43
45
|
import { nextBatch, waveOrder } from "../domain/wave-order.ts";
|
|
44
46
|
import type { BatchNode } from "../domain/wave-order.ts";
|
|
45
|
-
import { appendToLog, batchesLogPath, closedLine, eventLine, lastEntryOf,
|
|
47
|
+
import { appendToLog, batchesLogPath, closedLine, eventLine, lastEntryOf, reviewPending } from "../domain/batches-log.ts";
|
|
48
|
+
import { REVIEW_NOT_RUN } from "../domain/markers.ts";
|
|
49
|
+
import { CLOSE_STOP } from "../../dev-implement/domain/markers.ts";
|
|
50
|
+
import { changedTitle } from "./prompts.ts";
|
|
51
|
+
import { CHAIN_ANSWERED_NOTHING, FILES_NOT_READ, HASH_NOT_READ, NO_REVIEWER, NO_RUN_TO_GO_ON, backOnBranch, closeStop, concurrencyRefused, detachedHead, doneAndCommitted, everyBatchDone, everyBatchDoneArrow, humanDecidesAgain, humanDecidesClose, humanDecidesCorrection, humanDecidesStops, keptByParallelRun, launchLine, logNotWritten, logUnwritableThen, nextWaveFollows, noBranchFromPattern, noPlanUnder, notAWorkCodeBlocked, notMarkedDone, preflightBlocked, blockedReadOnlyMode, recordNotWritten, relaunchedRound, resumeAudit, reviewGaps, batchReviewNotRun, runGoesOn, runInProgress, settleBlocking, validNotCommitted, waitForChain, wavesUnreadable, workOutsideMounts } from "./messages.ts";
|
|
52
|
+
import { branchCreated as workBranchCreated } from "../../../shared/application/git/messages.ts";
|
|
46
53
|
import type { BatchEvent } from "../domain/batches-log.ts";
|
|
47
54
|
import { closePlan } from "./plan-close.ts";
|
|
48
|
-
import { BATCHES_ACTIVE_RECORD } from "../../../shared/domain/dev/batches-state.ts";
|
|
49
55
|
import type { MergedBatch } from "./plan-close.ts";
|
|
50
56
|
import { WORKSPACE, workspaceRelative } from "../../../shared/domain/vfs.ts";
|
|
51
57
|
import { listProjectFiles } from "../../../shared/application/dev/project-files.ts";
|
|
@@ -79,6 +85,9 @@ export interface DevBatchesDeps {
|
|
|
79
85
|
clock: () => Date;
|
|
80
86
|
/** The reviewer of the next batch (read tools only), under the run's hooks and effort; none: not run, and said. */
|
|
81
87
|
reviewerFor?(context: BatchesContext): Pick<Llm, "act" | "extract">;
|
|
88
|
+
/** The route of the next batch's reviewer's act to a cheaper or stronger profile (shared/application/agents/route-agent.ts actRoute);
|
|
89
|
+
* absent, the act runs on the crew's profile. */
|
|
90
|
+
route?: ActRoute;
|
|
82
91
|
/** The pull-request opener for the context read at the dispatch; none: the command is handed over. */
|
|
83
92
|
openerFor?(context: BatchesContext): PullRequestOpener | undefined;
|
|
84
93
|
/** A parallel run's batch, run by a batch agent under its worktree; none: a parallel run is refused. */
|
|
@@ -153,7 +162,7 @@ class LogBook {
|
|
|
153
162
|
await files.write(this.path, appendToLog(this.text, this.code, this.added));
|
|
154
163
|
return null;
|
|
155
164
|
} catch (e) {
|
|
156
|
-
return
|
|
165
|
+
return logNotWritten(workspaceRelative(this.path), reasonOf(e));
|
|
157
166
|
}
|
|
158
167
|
}
|
|
159
168
|
}
|
|
@@ -190,10 +199,10 @@ function stopOf(dev: DevCode, batch: string, after: readonly string[], launched:
|
|
|
190
199
|
if (verdict?.verdict === "GAPS") return { event: "returned", detail: "GAPS" };
|
|
191
200
|
if (verdict?.verdict === "VALID") {
|
|
192
201
|
const failed = after.map((l) => l.trim()).find((l) => l.startsWith("✗"));
|
|
193
|
-
return { event: "stopped", detail:
|
|
202
|
+
return { event: "stopped", detail: closeStop(failed?.replace(/^✗\s*/, "")) };
|
|
194
203
|
}
|
|
195
204
|
const first = after.map((l) => l.trim()).find((l) => l !== "");
|
|
196
|
-
return { event: "stopped", detail: `BLOCKED — ${first ??
|
|
205
|
+
return { event: "stopped", detail: `BLOCKED — ${first ?? CHAIN_ANSWERED_NOTHING}` };
|
|
197
206
|
}
|
|
198
207
|
|
|
199
208
|
/** The verdict of the batch's latest audit section; null while that audit has written none (it may still run). */
|
|
@@ -249,13 +258,13 @@ async function ensureWorkBranch(
|
|
|
249
258
|
const base = await defaultBranch(shell);
|
|
250
259
|
if (branch === "" || base === null || branch !== base) return { ok: true, line: null };
|
|
251
260
|
const name = batchesBranchName(wanted, code);
|
|
252
|
-
if (name === null) return { ok: false, line:
|
|
261
|
+
if (name === null) return { ok: false, line: noBranchFromPattern(wanted) };
|
|
253
262
|
const exists = await runGit(shell, `git rev-parse --verify --quiet ${shellQuote(`refs/heads/${name}`)}`);
|
|
254
263
|
const made = await runGit(shell, exists.exitCode === 0 ? `git switch ${shellQuote(name)}` : `git switch -c ${shellQuote(name)}`);
|
|
255
264
|
if (made.exitCode !== 0) {
|
|
256
265
|
return { ok: false, line: `git switch ${exists.exitCode === 0 ? "" : "-c "}${name} failed (${(made.stderr || made.stdout).trim().split("\n")[0] || `exit ${made.exitCode}`})` };
|
|
257
266
|
}
|
|
258
|
-
return { ok: true, line: exists.exitCode === 0 ?
|
|
267
|
+
return { ok: true, line: exists.exitCode === 0 ? backOnBranch(name) : workBranchCreated(name, branch, wanted) };
|
|
259
268
|
}
|
|
260
269
|
|
|
261
270
|
/** The closed batches a review is told about: each one's commit and its files. */
|
|
@@ -265,7 +274,7 @@ async function closedInventory(shell: Pick<Shell, "run">, merged: readonly Merge
|
|
|
265
274
|
if (!/^[0-9a-f]{4,40}$/i.test(m.hash)) continue;
|
|
266
275
|
const r = await runGit(shell, `git show --name-only --format= ${shellQuote(m.hash)}`);
|
|
267
276
|
const files = r.exitCode === 0 ? r.stdout.split("\n").map((l) => l.trim()).filter((l) => l !== "") : [];
|
|
268
|
-
out.push(`${m.batch} ${m.hash}: ${files.slice(0, 20).join(", ") ||
|
|
277
|
+
out.push(`${m.batch} ${m.hash}: ${files.slice(0, 20).join(", ") || FILES_NOT_READ}${files.length > 20 ? `, and ${files.length - 20} more` : ""}`);
|
|
269
278
|
}
|
|
270
279
|
return out.join("\n");
|
|
271
280
|
}
|
|
@@ -291,7 +300,7 @@ async function reviewMaterial(
|
|
|
291
300
|
for (const m of merged.filter((x) => dependsOn.includes(x.batch))) {
|
|
292
301
|
if (!/^[0-9a-f]{4,40}$/i.test(m.hash)) continue;
|
|
293
302
|
const r = await runGit(deps.shell, `git show --format= ${shellQuote(m.hash)}`);
|
|
294
|
-
if (r.exitCode === 0 && r.stdout.trim() !== "") out.push({ title:
|
|
303
|
+
if (r.exitCode === 0 && r.stdout.trim() !== "") out.push({ title: changedTitle(m.batch, m.hash.slice(0, 7)), text: r.stdout });
|
|
295
304
|
}
|
|
296
305
|
await planFile(planName);
|
|
297
306
|
return out;
|
|
@@ -353,13 +362,12 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
353
362
|
let prior: ActiveRecord | null = null;
|
|
354
363
|
if (typeof input.code === "string" && input.code.trim() !== "") {
|
|
355
364
|
code = input.code.trim();
|
|
356
|
-
if (!isCode(code)) return answer([
|
|
365
|
+
if (!isCode(code)) return answer([notAWorkCodeBlocked(code)]);
|
|
357
366
|
// Another plan's run in progress keeps its record: overwritten, a typed close of one of its batches would push.
|
|
358
367
|
const active = await readRecord(deps.files);
|
|
359
368
|
if (active !== null && active.code !== null && active.code !== code && !await runClosed(deps.files, active.code)) {
|
|
360
369
|
return answer([
|
|
361
|
-
|
|
362
|
-
`take it to its close (/dev-batches ${active.code}), or delete that file to drop it, then /dev-batches ${code}`,
|
|
370
|
+
runInProgress(active.code, workspaceRelative(ACTIVE_RECORD), code),
|
|
363
371
|
]);
|
|
364
372
|
}
|
|
365
373
|
pr = flag(input.pr);
|
|
@@ -368,7 +376,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
368
376
|
} else {
|
|
369
377
|
record = await readRecord(deps.files);
|
|
370
378
|
if (record === null || record.code === null) {
|
|
371
|
-
return answer([
|
|
379
|
+
return answer([NO_RUN_TO_GO_ON]);
|
|
372
380
|
}
|
|
373
381
|
code = record.code;
|
|
374
382
|
pr = record.pr || flag(input.pr);
|
|
@@ -382,7 +390,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
382
390
|
}
|
|
383
391
|
const mode = context.permissionMode.trim();
|
|
384
392
|
if (mode !== "" && policyFor(mode).readOnly) {
|
|
385
|
-
return answer([...lines,
|
|
393
|
+
return answer([...lines, blockedReadOnlyMode(mode, code)]);
|
|
386
394
|
}
|
|
387
395
|
// The value the run names (a typed --concurrency 1 included: back to one at a time); none, the value of the plan's
|
|
388
396
|
// run in progress, typed or chained (a refused hop typed again goes on as it was); else one.
|
|
@@ -392,7 +400,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
392
400
|
// Checked again here: a chained run's mode is the one the record kept (L8P-D14).
|
|
393
401
|
const modeRefused = concurrencyModeRefusal(parallel, mode);
|
|
394
402
|
if (modeRefused !== null) return answer([...lines, `BLOCKED — ${modeRefused}`]);
|
|
395
|
-
if (deps.runBatch === undefined) return answer([...lines,
|
|
403
|
+
if (deps.runBatch === undefined) return answer([...lines, concurrencyRefused(parallel)]);
|
|
396
404
|
} else if (context.concurrency !== undefined) {
|
|
397
405
|
const { concurrency: _, ...one } = context;
|
|
398
406
|
context = one;
|
|
@@ -401,18 +409,18 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
401
409
|
// 2. The plan and what was done of it.
|
|
402
410
|
const ctx = await loadDevContext({ files: deps.files, shell: deps.shell, config: deps.config });
|
|
403
411
|
lines.push(...ctx.warnings.slice(0, 5).map((w) => `⚠ ${w}`));
|
|
404
|
-
if (ctx.work.vfsPath === null) return answer([...lines,
|
|
412
|
+
if (ctx.work.vfsPath === null) return answer([...lines, workOutsideMounts(ctx.work.folder)]);
|
|
405
413
|
const lookup = await loadDevCode({ files: deps.files }, ctx.work, code);
|
|
406
414
|
if (lookup.found === null) {
|
|
407
415
|
const known = lookup.codes.length > 0 ? ` (codes: ${lookup.codes.slice(0, 10).join(", ")})` : "";
|
|
408
|
-
return answer([...lines,
|
|
416
|
+
return answer([...lines, noPlanUnder(ctx.work.folder, code, known)]);
|
|
409
417
|
}
|
|
410
418
|
const dev = lookup.found;
|
|
411
419
|
const writeRecord = async (value: object): Promise<void> => {
|
|
412
420
|
try {
|
|
413
421
|
await deps.files.write(ACTIVE_RECORD, `${JSON.stringify(value, null, 2)}\n`);
|
|
414
422
|
} catch (e) {
|
|
415
|
-
lines.push(
|
|
423
|
+
lines.push(recordNotWritten(reasonOf(e), code));
|
|
416
424
|
}
|
|
417
425
|
};
|
|
418
426
|
if (record === null || fresh || flag(input.pr) !== record.pr || record.context.concurrency !== context.concurrency) {
|
|
@@ -421,7 +429,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
421
429
|
// The crew's budget is sized when it is built, from the concurrency its input names (batches-budget.ts): a run
|
|
422
430
|
// that follows its record's hands itself on, the concurrency named, before any batch.
|
|
423
431
|
if (parallel > 1 && input.concurrency === undefined) {
|
|
424
|
-
return answer([...lines,
|
|
432
|
+
return answer([...lines, runGoesOn(code, parallel)], { crew: "dev-batches", input: { concurrency: parallel } });
|
|
425
433
|
}
|
|
426
434
|
const nodes = batchNodes(dev);
|
|
427
435
|
const order = waveOrder(nodes);
|
|
@@ -441,7 +449,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
441
449
|
const failed = await book.save(deps.files);
|
|
442
450
|
if (failed === null) return answer(out, next);
|
|
443
451
|
// Without its log the run cannot tell a batch it launched: nothing is launched.
|
|
444
|
-
return answer(next === undefined ? [...out, failed] : [...out, failed,
|
|
452
|
+
return answer(next === undefined ? [...out, failed] : [...out, failed, logUnwritableThen(code)]);
|
|
445
453
|
};
|
|
446
454
|
|
|
447
455
|
// What the chain's dev-implement is handed for a batch: the run's context, its open steps, and what is `extra`.
|
|
@@ -469,10 +477,10 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
469
477
|
// The close's own line names the batch's commit; a batch closed by hand is read at HEAD.
|
|
470
478
|
const said = after.map((l) => /^✓ committed ([0-9a-f]{4,40}) on /i.exec(l.trim())?.[1]).find((h) => h !== undefined);
|
|
471
479
|
const head = said === undefined ? await runGit(deps.shell, GIT_HEAD_COMMAND) : null;
|
|
472
|
-
const hash = said ?? (head !== null && head.exitCode === 0 ? head.stdout.trim() :
|
|
480
|
+
const hash = said ?? (head !== null && head.exitCode === 0 ? head.stdout.trim() : HASH_NOT_READ);
|
|
473
481
|
book.add(eventLine(now(), node.id, "returned", "VALID"));
|
|
474
482
|
book.add(eventLine(now(), node.id, "merged", hash));
|
|
475
|
-
lines.push(
|
|
483
|
+
lines.push(doneAndCommitted(node.id));
|
|
476
484
|
continue;
|
|
477
485
|
}
|
|
478
486
|
// Typed, not back from the chain: a hop refused at the chain's depth (or a killed run) lost the batch's answer.
|
|
@@ -484,7 +492,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
484
492
|
book.add(eventLine(now(), node.id, "returned", "VALID"));
|
|
485
493
|
book.add(eventLine(now(), node.id, "merged", committed));
|
|
486
494
|
node.done = true;
|
|
487
|
-
lines.push(`✓ ${node.id} committed (${committed})`,
|
|
495
|
+
lines.push(`✓ ${node.id} committed (${committed})`, notMarkedDone(node.id));
|
|
488
496
|
continue;
|
|
489
497
|
}
|
|
490
498
|
const stop = stopOf(dev, node.id, after, auditsAtLaunch(last.detail));
|
|
@@ -495,8 +503,8 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
495
503
|
if (input.after === undefined && latestVerdict(dev, node.id) === "VALID") {
|
|
496
504
|
return finish([
|
|
497
505
|
...lines,
|
|
498
|
-
|
|
499
|
-
|
|
506
|
+
validNotCommitted(node.id),
|
|
507
|
+
waitForChain(closeCommand(code, node.id), code),
|
|
500
508
|
]);
|
|
501
509
|
}
|
|
502
510
|
book.add(eventLine(now(), node.id, stop.event, stop.detail));
|
|
@@ -512,8 +520,8 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
512
520
|
return finish(
|
|
513
521
|
[
|
|
514
522
|
...lines, `${node.id} returned GAPS`,
|
|
515
|
-
|
|
516
|
-
(finding === undefined ?
|
|
523
|
+
relaunchedRound(node.id, rounds + 1, GAPS_ROUNDS_MAX) +
|
|
524
|
+
(finding === undefined ? resumeAudit(code, node.id) : correctionCommand(code, node.id, finding)),
|
|
517
525
|
],
|
|
518
526
|
{ crew: "dev-implement", input: launchInput(node.id, finding === undefined ? {} : { correction: finding }, finding === undefined ? 0 : 1) },
|
|
519
527
|
);
|
|
@@ -524,11 +532,11 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
524
532
|
stop.detail === "GAPS"
|
|
525
533
|
// The audit's own `/dev-batches <code> <batch> — correction: …` line fixes the batch; its close commits without a
|
|
526
534
|
// push while this run is in progress (run-dev-implement.ts).
|
|
527
|
-
?
|
|
528
|
-
: stop.detail.startsWith(
|
|
535
|
+
? humanDecidesCorrection(rounds, correctionCommand(code, node.id, "<finding>"), code)
|
|
536
|
+
: stop.detail.startsWith(CLOSE_STOP)
|
|
529
537
|
// The audit said VALID: what is left is the close, not a new run of the batch.
|
|
530
|
-
?
|
|
531
|
-
:
|
|
538
|
+
? humanDecidesClose(closeCommand(code, node.id), code)
|
|
539
|
+
: humanDecidesAgain(code, node.id),
|
|
532
540
|
]);
|
|
533
541
|
}
|
|
534
542
|
|
|
@@ -537,7 +545,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
537
545
|
if (order.ok && next === null) {
|
|
538
546
|
if (book.closed()) {
|
|
539
547
|
await writeRecord({ code: null });
|
|
540
|
-
return finish([...lines,
|
|
548
|
+
return finish([...lines, everyBatchDone(code, logShown)]);
|
|
541
549
|
}
|
|
542
550
|
const opener = context.githubTool ? deps.openerFor?.(context) : undefined;
|
|
543
551
|
const close = await closePlan(
|
|
@@ -548,7 +556,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
548
556
|
if (close.closed) {
|
|
549
557
|
book.add(closedLine(now()));
|
|
550
558
|
await writeRecord({ code: null });
|
|
551
|
-
lines.push(
|
|
559
|
+
lines.push(everyBatchDoneArrow(code, logShown));
|
|
552
560
|
}
|
|
553
561
|
return finish(lines);
|
|
554
562
|
}
|
|
@@ -566,13 +574,13 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
566
574
|
});
|
|
567
575
|
lines.push(...pre.lines);
|
|
568
576
|
if (!pre.ok || next === null || plan === null) {
|
|
569
|
-
return finish([...lines,
|
|
577
|
+
return finish([...lines, preflightBlocked(code)]);
|
|
570
578
|
}
|
|
571
579
|
|
|
572
580
|
// 6. The review of a batch whose dependencies just closed, before its first launch: the next batch, or each of
|
|
573
581
|
// the wave a parallel run launches.
|
|
574
582
|
const wave = parallel > 1 ? await nextWave(deps.files, dev, nodes, ctx.work.vfsPath, parallel) : [next];
|
|
575
|
-
if (wave.length === 0) return finish([...lines,
|
|
583
|
+
if (wave.length === 0) return finish([...lines, wavesUnreadable(code)]);
|
|
576
584
|
// The Major rows of each review, handed to that batch's first launch as `stale:` lines.
|
|
577
585
|
const stale: Record<string, string[]> = {};
|
|
578
586
|
for (const id of wave) {
|
|
@@ -582,10 +590,10 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
582
590
|
// A review that cannot run closes the gate: the batch is not launched, and the next run reviews it again.
|
|
583
591
|
const notRun = (reason: string): Promise<string> => {
|
|
584
592
|
book.add(eventLine(now(), id, "stopped", `${REVIEW_NOT_RUN} (${reason})`));
|
|
585
|
-
return finish([...lines,
|
|
593
|
+
return finish([...lines, batchReviewNotRun(id, reason, code)]);
|
|
586
594
|
};
|
|
587
595
|
const reviewer = deps.reviewerFor?.(context);
|
|
588
|
-
if (reviewer === undefined) return notRun(
|
|
596
|
+
if (reviewer === undefined) return notRun(NO_REVIEWER);
|
|
589
597
|
const merged = mergedOf(book.entries());
|
|
590
598
|
const outcome = await runSubAgent(reviewer, {
|
|
591
599
|
charter: NEXT_BATCH_REVIEWER_CHARTER,
|
|
@@ -599,14 +607,14 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
599
607
|
}),
|
|
600
608
|
schema: REVIEW_ANSWER_SCHEMA,
|
|
601
609
|
answerPrompt: (reply, problems) => buildReviewAnswerPrompt(reply, problems, [id]),
|
|
602
|
-
|
|
603
|
-
});
|
|
610
|
+
...reviewChecks([id]),
|
|
611
|
+
}, deps.route);
|
|
604
612
|
if (!outcome.ok) return notRun(`${outcome.reason}: ${outcome.problems[0] ?? "no detail"}`);
|
|
605
613
|
const rows = outcome.value.rows;
|
|
606
614
|
const blocking = rows.filter((r) => r.severity === "Blocking");
|
|
607
615
|
lines.push(rows.length === 0
|
|
608
616
|
? `review of ${id}: CLEAR`
|
|
609
|
-
:
|
|
617
|
+
: reviewGaps(id, blocking.length, rows.length - blocking.length));
|
|
610
618
|
lines.push(...rows.map((r) => ` ${r.severity} — ${r.question} (${r.evidence})`));
|
|
611
619
|
const majors = rows.filter((r) => r.severity === "Major").map((r) => `stale: ${r.question} — ${r.evidence}`);
|
|
612
620
|
if (majors.length > 0) stale[id] = majors;
|
|
@@ -614,7 +622,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
614
622
|
book.add(eventLine(now(), id, "stopped", `BLOCKED — review: ${blocking.length} Blocking`));
|
|
615
623
|
return finish([
|
|
616
624
|
...lines,
|
|
617
|
-
|
|
625
|
+
settleBlocking(id, `${dev.shown}/${sheet.name}`, code),
|
|
618
626
|
]);
|
|
619
627
|
}
|
|
620
628
|
}
|
|
@@ -626,7 +634,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
626
634
|
if (parallel > 1) {
|
|
627
635
|
const current = await runGit(deps.shell, GIT_CURRENT_BRANCH_COMMAND);
|
|
628
636
|
const workBranch = current.exitCode === 0 ? current.stdout.trim() : "";
|
|
629
|
-
if (workBranch === "") return finish([...lines,
|
|
637
|
+
if (workBranch === "") return finish([...lines, detachedHead(code)]);
|
|
630
638
|
const memory = await readMemoryDir(deps.config);
|
|
631
639
|
const steps = (id: string): number | undefined => {
|
|
632
640
|
const open = sheetOf(id)?.sheet.steps.filter((s) => s.tdd !== null && !(s.tdd.red && s.tdd.green && s.tdd.cost)).length ?? 0;
|
|
@@ -646,16 +654,15 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
646
654
|
});
|
|
647
655
|
lines.push(...ran.lines);
|
|
648
656
|
if (ran.refused) return finish(lines);
|
|
649
|
-
if (ran.stopped) return finish([...lines,
|
|
650
|
-
return finish([...lines,
|
|
657
|
+
if (ran.stopped) return finish([...lines, humanDecidesStops(code, parallel)]);
|
|
658
|
+
return finish([...lines, nextWaveFollows(code, parallel)], { crew: "dev-batches", input: { concurrency: parallel } });
|
|
651
659
|
}
|
|
652
660
|
// A batch a parallel run stopped keeps its code, sheet and verdict in its worktree: run here, it would start over.
|
|
653
661
|
const kept = worktreePlace(batchWorktreeName(code, next));
|
|
654
662
|
if (kept !== null && (await listOrNone(deps.files, `${WORKSPACE}/.orkeon/worktrees`)).includes(kept.name)) {
|
|
655
663
|
return finish([
|
|
656
664
|
...lines,
|
|
657
|
-
|
|
658
|
-
`or remove it (git worktree remove --force ${kept.path}, then git branch -D batches/${code}/${next}) to run it here`,
|
|
665
|
+
keptByParallelRun(next, kept.path, code),
|
|
659
666
|
]);
|
|
660
667
|
}
|
|
661
668
|
const entry = lastEntryOf(book.entries(), next);
|
|
@@ -663,7 +670,7 @@ export async function runDevBatches(input: DevBatchesInputs, deps: DevBatchesDep
|
|
|
663
670
|
book.add(eventLine(now(), next, relaunch ? "relaunched" : "launched", `${AUDITS_DETAIL} ${auditsOf(dev, next)}`));
|
|
664
671
|
const position = order.ok ? order.order.indexOf(next) + 1 : 0;
|
|
665
672
|
return finish(
|
|
666
|
-
[...lines,
|
|
673
|
+
[...lines, launchLine(next, relaunch ? "relaunched" : "launched", position, nodes.length, code)],
|
|
667
674
|
{ crew: "dev-implement", input: launchInput(next, (stale[next] ?? []).length > 0 ? { stale: stale[next] } : {}) },
|
|
668
675
|
);
|
|
669
676
|
}
|
|
@@ -17,6 +17,7 @@ import { createBatchWorktree, mergeValidBatch, removeBatchWorktree } from "../..
|
|
|
17
17
|
import { concurrencyGitRefusal } from "../../../shared/domain/dev/batches-concurrency.ts";
|
|
18
18
|
import type { BatchesLogEntry } from "../../../shared/domain/dev/batches-state.ts";
|
|
19
19
|
import { parseBatchSheet } from "../../../shared/domain/dev/plan-format.ts";
|
|
20
|
+
import { batchValidLine } from "../../../shared/domain/dev/markers.ts";
|
|
20
21
|
import { batchBranch, batchWorktreeName, gitBranchExists, gitCommitsNotIn, gitIsIgnored, gitIsMergedInto, gitWorktreeHead, worktreePlace } from "../../../shared/domain/git/worktree.ts";
|
|
21
22
|
import type { WorktreePlace } from "../../../shared/domain/git/worktree.ts";
|
|
22
23
|
import { shellQuote } from "../../../shared/domain/git/close.ts";
|
|
@@ -25,6 +26,8 @@ import { eventLine, lastEntryOf } from "../domain/batches-log.ts";
|
|
|
25
26
|
import { harvestBatch, seedWorktree } from "./seed-harvest.ts";
|
|
26
27
|
import type { SeedSnapshot, SeedTarget } from "./seed-harvest.ts";
|
|
27
28
|
import { WORKSPACE } from "../../../shared/domain/vfs.ts";
|
|
29
|
+
import { BATCH_ANSWERED_NOTHING, HASH_NOT_READ, IT_ANSWERED_NOTHING, LOG_UNWRITABLE, NO_CORRECTION_RESUMES, batchAgentAnswered, branchNotOnWorktree, budgetStop, closeStop, doneBeforeStop, gapsRoundsHuman, logUnwritableNotRelaunched, stoppedNoVerdict, notAWorktreeName, planNotMarked, relaunchedAfterGaps, stateNotIgnored, stayInWorktree, worktreeKept } from "./messages.ts";
|
|
30
|
+
import { worktreeCreated as worktreeMade } from "../../../shared/application/git/messages.ts";
|
|
28
31
|
import {
|
|
29
32
|
GAPS_ROUNDS_MAX, gapsFinding, gapsRoundsOf, isNextStepLine, parseCorrectionLine, parseVerdictFile,
|
|
30
33
|
} from "../../../shared/domain/dev/verdict-format.ts";
|
|
@@ -69,7 +72,7 @@ export function outcomeOf(batch: string, answered: unknown): BatchOutcome {
|
|
|
69
72
|
} catch {
|
|
70
73
|
// Not the chain's JSON.
|
|
71
74
|
}
|
|
72
|
-
return { batch, verdict: "BLOCKED", lines: [
|
|
75
|
+
return { batch, verdict: "BLOCKED", lines: [batchAgentAnswered(text.split("\n")[0])], spent: 0 };
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
export interface WaveDeps {
|
|
@@ -131,13 +134,12 @@ const stop = (lines: string[], line: string): WaveResult => ({ lines: [...lines,
|
|
|
131
134
|
|
|
132
135
|
/** The line naming a kept worktree: a suite run on the main checkout may glob into it. */
|
|
133
136
|
export function keptLine(place: WorktreePlace): string {
|
|
134
|
-
return
|
|
137
|
+
return worktreeKept(place.path);
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
/** The line saying where a stopped batch is and the exact command that relaunches it there. */
|
|
138
141
|
export function resumeLine(req: Pick<WaveRequest, "code" | "concurrency">, batch: string, place: WorktreePlace, correction?: string): string {
|
|
139
|
-
return
|
|
140
|
-
(correction === undefined ? "" : `, its correction first (${correction})`);
|
|
142
|
+
return stayInWorktree(batch, place.path, req.code, req.concurrency, correction);
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
const CORRECTION = /— correction: (.+)$/;
|
|
@@ -150,7 +152,7 @@ async function placeOf(shell: Pick<Shell, "run">, req: WaveRequest, batch: strin
|
|
|
150
152
|
const name = batchWorktreeName(req.code, batch);
|
|
151
153
|
const branch = batchBranch(req.code, batch);
|
|
152
154
|
const place = worktreePlace(name);
|
|
153
|
-
if (place === null) return { ok: false, line:
|
|
155
|
+
if (place === null) return { ok: false, line: notAWorktreeName(name) };
|
|
154
156
|
const entries = req.book.entries();
|
|
155
157
|
const last = lastEntryOf(entries, batch);
|
|
156
158
|
const reopened = last !== undefined;
|
|
@@ -166,7 +168,7 @@ async function placeOf(shell: Pick<Shell, "run">, req: WaveRequest, batch: strin
|
|
|
166
168
|
}
|
|
167
169
|
const head = await runGit(shell, gitWorktreeHead(place.path));
|
|
168
170
|
if (head.exitCode !== 0 || head.stdout.trim() !== `refs/heads/${branch}`) {
|
|
169
|
-
return { ok: false, line:
|
|
171
|
+
return { ok: false, line: branchNotOnWorktree(branch, place.path, head.exitCode === 0 ? head.stdout.trim() : gitReason(head)) };
|
|
170
172
|
}
|
|
171
173
|
return { ok: true, slot: { batch, place, branch, made: false, reopened: true, done: false, ...extra } };
|
|
172
174
|
}
|
|
@@ -186,7 +188,7 @@ async function markPlanDone(files: Pick<Files, "read" | "write">, req: WaveReque
|
|
|
186
188
|
if (marked !== plan) await files.write(path, marked);
|
|
187
189
|
return [];
|
|
188
190
|
} catch (e) {
|
|
189
|
-
return [
|
|
191
|
+
return [planNotMarked(name, batch, reasonOf(e))];
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
|
|
@@ -232,7 +234,7 @@ function blockedDetail(outcome: BatchOutcome): string {
|
|
|
232
234
|
const said = outcome.lines.map((l) => l.trim()).find((l) => /^(stopped )?BLOCKED\b/.test(l));
|
|
233
235
|
if (said !== undefined) return `BLOCKED — ${said.replace(/^(stopped )?BLOCKED\s*—?\s*/, "")}`;
|
|
234
236
|
const first = outcome.lines.map((l) => l.trim()).find((l) => l !== "");
|
|
235
|
-
return `BLOCKED — ${first ??
|
|
237
|
+
return `BLOCKED — ${first ?? BATCH_ANSWERED_NOTHING}`;
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
export async function runWave(req: WaveRequest, deps: WaveDeps): Promise<WaveResult> {
|
|
@@ -244,7 +246,7 @@ export async function runWave(req: WaveRequest, deps: WaveDeps): Promise<WaveRes
|
|
|
244
246
|
// 0. The dev state a worktree is seeded with must be ignored by git, or no worktree could be removed clean.
|
|
245
247
|
const state = `.orkeon/dev/${req.code}`;
|
|
246
248
|
if (req.wave.length > 0 && (await runGit(deps.shell, gitIsIgnored(state))).exitCode !== 0) {
|
|
247
|
-
return stop(lines,
|
|
249
|
+
return stop(lines, stateNotIgnored(state));
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
// 1. The worktrees, made or reused; the probe under the first one.
|
|
@@ -252,7 +254,7 @@ export async function runWave(req: WaveRequest, deps: WaveDeps): Promise<WaveRes
|
|
|
252
254
|
const placed = await placeOf(deps.shell, req, batch);
|
|
253
255
|
if (!placed.ok) return stop(lines, `BLOCKED — worktree: ${placed.line}`);
|
|
254
256
|
slots.push(placed.slot);
|
|
255
|
-
if (placed.slot.made) lines.push(
|
|
257
|
+
if (placed.slot.made) lines.push(worktreeMade(placed.slot.place.path, placed.slot.branch, req.workBranch));
|
|
256
258
|
}
|
|
257
259
|
const refused = slots.length === 0 ? null : await probeRefusal(deps, req, slots[0].place);
|
|
258
260
|
if (refused !== null) {
|
|
@@ -277,9 +279,9 @@ export async function runWave(req: WaveRequest, deps: WaveDeps): Promise<WaveRes
|
|
|
277
279
|
req.book.add(eventLine(req.clock(), slot.batch, event, `${slot.place.name} audits ${req.audits(slot.batch)}`));
|
|
278
280
|
lines.push(`→ ${slot.batch} ${event} in ${slot.place.path}`);
|
|
279
281
|
}
|
|
280
|
-
for (const slot of slots.filter((s) => s.done)) lines.push(
|
|
282
|
+
for (const slot of slots.filter((s) => s.done)) lines.push(doneBeforeStop(slot.batch, slot.place.path));
|
|
281
283
|
const unsaved = running.length === 0 ? null : await req.book.save();
|
|
282
|
-
if (unsaved !== null) return stop([...lines, unsaved],
|
|
284
|
+
if (unsaved !== null) return stop([...lines, unsaved], LOG_UNWRITABLE);
|
|
283
285
|
|
|
284
286
|
// 3. Every batch at once; a rejected run is a stop of its batch alone. A GAPS verdict whose audit rounds in GAPS
|
|
285
287
|
// are fewer than GAPS_ROUNDS_MAX runs the batch again at once in its worktree, the verdict's rows as the correction
|
|
@@ -302,19 +304,19 @@ export async function runWave(req: WaveRequest, deps: WaveDeps): Promise<WaveRes
|
|
|
302
304
|
if (text === null || parseVerdictFile(text).sections.at(-1)?.verdict !== "GAPS") return outcome;
|
|
303
305
|
const rounds = gapsRoundsOf(text);
|
|
304
306
|
if (rounds >= GAPS_ROUNDS_MAX || round >= GAPS_ROUNDS_MAX) {
|
|
305
|
-
slot.said.push(
|
|
307
|
+
slot.said.push(gapsRoundsHuman(slot.batch, rounds));
|
|
306
308
|
return outcome;
|
|
307
309
|
}
|
|
308
310
|
const finding = gapsFinding(text);
|
|
309
311
|
const fix = finding === undefined ? "" : ` — correction: ${finding}`;
|
|
310
312
|
req.book.add(eventLine(req.clock(), slot.batch, "returned", `GAPS${fix}`));
|
|
311
313
|
req.book.add(eventLine(req.clock(), slot.batch, "relaunched", `${slot.place.name} audits ${parseVerdictFile(text).sections.length}, round ${rounds + 1}${fix}`));
|
|
312
|
-
slot.said.push(
|
|
313
|
-
(finding === undefined ?
|
|
314
|
+
slot.said.push(relaunchedAfterGaps(slot.batch, slot.place.path, rounds + 1, GAPS_ROUNDS_MAX) +
|
|
315
|
+
(finding === undefined ? NO_CORRECTION_RESUMES : fix));
|
|
314
316
|
if (deps.afterGaps !== undefined) slot.said.push(...await deps.afterGaps(`${slot.place.root}/${req.work}`));
|
|
315
317
|
const unsaved = await req.book.save();
|
|
316
318
|
if (unsaved !== null) {
|
|
317
|
-
slot.said.push(unsaved,
|
|
319
|
+
slot.said.push(unsaved, logUnwritableNotRelaunched(slot.batch));
|
|
318
320
|
return outcome;
|
|
319
321
|
}
|
|
320
322
|
correction = finding;
|
|
@@ -350,7 +352,7 @@ export async function runWave(req: WaveRequest, deps: WaveDeps): Promise<WaveRes
|
|
|
350
352
|
continue;
|
|
351
353
|
}
|
|
352
354
|
const tip = await runGit(deps.shell, `git rev-parse --verify ${shellQuote(`refs/heads/${slot.branch}`)}`);
|
|
353
|
-
const hash = tip.exitCode === 0 && tip.stdout.trim() !== "" ? tip.stdout.trim() : outcome.hash ??
|
|
355
|
+
const hash = tip.exitCode === 0 && tip.stdout.trim() !== "" ? tip.stdout.trim() : outcome.hash ?? HASH_NOT_READ;
|
|
354
356
|
req.book.add(eventLine(req.clock(), slot.batch, "returned", "VALID"));
|
|
355
357
|
req.book.add(eventLine(req.clock(), slot.batch, "merged", hash));
|
|
356
358
|
await harvest();
|
|
@@ -411,7 +413,7 @@ export async function runBatchChain(run: BatchRun, launch: Readonly<Record<strin
|
|
|
411
413
|
const answer = (verdict: BatchOutcome["verdict"], extra: string[] = [], hash?: string): BatchOutcome =>
|
|
412
414
|
({ batch: run.batch, verdict, ...(hash === undefined ? {} : { hash }), lines: [...lines, ...extra], spent: chain.spend.calls() });
|
|
413
415
|
const spent = (): BatchOutcome | null =>
|
|
414
|
-
chain.spend.exhausted() ? answer("BLOCKED", [
|
|
416
|
+
chain.spend.exhausted() ? answer("BLOCKED", [budgetStop(chain.spend.limit)]) : null;
|
|
415
417
|
|
|
416
418
|
const implemented = parsed(await chain.implement({
|
|
417
419
|
...launch, batch: run.batch, ...(run.steps !== undefined ? { steps: run.steps } : {}),
|
|
@@ -430,13 +432,13 @@ export async function runBatchChain(run: BatchRun, launch: Readonly<Record<strin
|
|
|
430
432
|
const written = WRITTEN.exec(verified);
|
|
431
433
|
if (written === null || written[1] !== run.batch) {
|
|
432
434
|
const trimmed = verified.split("\n").map((l) => l.trim()).filter((l) => l !== "");
|
|
433
|
-
const last = trimmed.at(-1) ??
|
|
435
|
+
const last = trimmed.at(-1) ?? IT_ANSWERED_NOTHING;
|
|
434
436
|
// The gate's RED names only its own line: the checks that failed say why.
|
|
435
437
|
const fails = trimmed.filter((l) => l.startsWith("FAIL ")).map((l) => l.slice(5));
|
|
436
|
-
return answer("BLOCKED", [
|
|
438
|
+
return answer("BLOCKED", [stoppedNoVerdict(last, fails)]);
|
|
437
439
|
}
|
|
438
440
|
const rest = verified.slice(written.index + written[0].length);
|
|
439
|
-
if (!
|
|
441
|
+
if (!batchValidLine(run.batch).test(rest)) {
|
|
440
442
|
const correction = parseCorrectionLine(rest)?.finding;
|
|
441
443
|
return { ...answer("GAPS"), ...(correction === undefined ? {} : { correction }) };
|
|
442
444
|
}
|
|
@@ -446,5 +448,5 @@ export async function runBatchChain(run: BatchRun, launch: Readonly<Record<strin
|
|
|
446
448
|
const hash = COMMITTED.exec(closed.lines.join("\n"))?.[1];
|
|
447
449
|
if (hash !== undefined) return answer("VALID", [], hash);
|
|
448
450
|
const failed = closed.lines.map((l) => l.trim()).find((l) => l.startsWith("✗"));
|
|
449
|
-
return spent() ?? answer("BLOCKED", [
|
|
451
|
+
return spent() ?? answer("BLOCKED", [closeStop(failed?.replace(/^✗\s*/, ""))]);
|
|
450
452
|
}
|
|
@@ -15,6 +15,7 @@ import type { Files } from "../../../shared/application/ports.ts";
|
|
|
15
15
|
import { isCode } from "../../../shared/domain/dev/artefacts.ts";
|
|
16
16
|
import type { WorktreePlace } from "../../../shared/domain/git/worktree.ts";
|
|
17
17
|
import { WORKSPACE } from "../../../shared/domain/vfs.ts";
|
|
18
|
+
import { changedSinceSeed, memoryDirOutside, notAWorkCode, notBroughtBack, tooManyToSeed, workFolderOutside } from "./messages.ts";
|
|
18
19
|
|
|
19
20
|
export interface SeedTarget {
|
|
20
21
|
place: WorktreePlace;
|
|
@@ -78,9 +79,9 @@ async function walk(files: Pick<Files, "read" | "list">, base: string, path: str
|
|
|
78
79
|
|
|
79
80
|
function unsafe(target: SeedTarget): string | null {
|
|
80
81
|
const relative = (p: string) => p !== "" && !p.startsWith("/") && !p.split("/").includes("..");
|
|
81
|
-
if (!relative(target.work)) return
|
|
82
|
-
if (!relative(target.memoryDir)) return
|
|
83
|
-
if (!isCode(target.code)) return
|
|
82
|
+
if (!relative(target.work)) return workFolderOutside(target.work);
|
|
83
|
+
if (!relative(target.memoryDir)) return memoryDirOutside(target.memoryDir);
|
|
84
|
+
if (!isCode(target.code)) return notAWorkCode(target.code);
|
|
84
85
|
return null;
|
|
85
86
|
}
|
|
86
87
|
|
|
@@ -104,7 +105,7 @@ export async function seedWorktree(
|
|
|
104
105
|
const found = new Map<string, string>();
|
|
105
106
|
for (const source of sources(target)) await walk(files, WORKSPACE, source, found);
|
|
106
107
|
if (found.size > SEED_MAX_FILES) {
|
|
107
|
-
return { ok: false, line:
|
|
108
|
+
return { ok: false, line: tooManyToSeed(target.place.path, SEED_MAX_FILES) };
|
|
108
109
|
}
|
|
109
110
|
const snapshot = new Map<string, string>();
|
|
110
111
|
try {
|
|
@@ -132,7 +133,7 @@ export async function harvestBatch(
|
|
|
132
133
|
): Promise<{ ok: true; brought: string[] } | { ok: false; brought: string[]; line: string }> {
|
|
133
134
|
const brought: string[] = [];
|
|
134
135
|
const refused = unsafe(target);
|
|
135
|
-
if (refused !== null) return { ok: false, brought, line:
|
|
136
|
+
if (refused !== null) return { ok: false, brought, line: notBroughtBack(target.batch, target.place.path, refused) };
|
|
136
137
|
const found = new Map<string, string>();
|
|
137
138
|
for (const source of [`${target.work}/${target.code}`, `.orkeon/dev/${target.code}`]) await walk(files, target.place.root, source, found);
|
|
138
139
|
const kept: string[] = [];
|
|
@@ -150,12 +151,12 @@ export async function harvestBatch(
|
|
|
150
151
|
brought.push(path);
|
|
151
152
|
}
|
|
152
153
|
} catch (e) {
|
|
153
|
-
return { ok: false, brought, line:
|
|
154
|
+
return { ok: false, brought, line: notBroughtBack(target.batch, target.place.path, reasonOf(e)) };
|
|
154
155
|
}
|
|
155
156
|
if (kept.length > 0) {
|
|
156
157
|
return {
|
|
157
158
|
ok: false, brought,
|
|
158
|
-
line:
|
|
159
|
+
line: changedSinceSeed(target.batch, kept.join(", "), target.place.path),
|
|
159
160
|
};
|
|
160
161
|
}
|
|
161
162
|
return { ok: true, brought };
|