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
|
@@ -57,6 +57,18 @@ import type { PrContext } from "./touched.ts";
|
|
|
57
57
|
import { closeDevBatch } from "./close.ts";
|
|
58
58
|
import { BATCHES_ACTIVE_RECORD, batchesRunCode } from "../../../shared/domain/dev/batches-state.ts";
|
|
59
59
|
import { WORKSPACE, workspaceRelative } from "../../../shared/domain/vfs.ts";
|
|
60
|
+
import { askCostLine } from "./prompts.ts";
|
|
61
|
+
import {
|
|
62
|
+
BUILD_LINE_NOT_RUN, FAILURE_NOT_CHECKED, NO_PRODUCTION_CHANGED, NO_REPOSITORY_PACK, NO_TEST_LAYOUT, SHEET_PUT_BACK, TEST_NOT_RUN,
|
|
63
|
+
WHOLE_SUITE_EVERY_TEST, WHOLE_SUITE_NO_TEST_PROJECT, affectedDone, affectedExited, affectedRefused, affectedStillRunning, firstAndMore,
|
|
64
|
+
assumptionsNotWritten, assumptionsWritten, batchGreen, batchIsFn, blockedLine, buildDone, buildExited, buildRefused,
|
|
65
|
+
buildStillRunning, cannotBeReadColonReason, correctionAppended, correctionProblem, correctionStillOpen, costDone, costFlagged, costMeasured,
|
|
66
|
+
measuredNotComputed, gapsRoundsWarned, graphAdded, graphNotRead, graphProjectsLeftOut, greenDone, indexNotIndexed, indexNotRefreshed,
|
|
67
|
+
indexRefreshed, indexReindexFailed, notPushedInRun, notRun, readOnlyMode, readOnlyModeAtClose, redDone, restoreCouldNotRun,
|
|
68
|
+
restored, restoreExited, restoreNoVerdict, restoreRefused, restoreStillRunning, roleChangedPlanFolder, runTitle, sheetMalformed,
|
|
69
|
+
sheetNotPutBack, sheetNotWritten, shownLog, stepActProblem, testDone, testExited, testRefused, testStillRunning, whitespaceFixed,
|
|
70
|
+
whitespaceNotWritten, wholeSuiteUnplaced, workFolderOutsideMounts,
|
|
71
|
+
} from "./messages.ts";
|
|
60
72
|
|
|
61
73
|
export interface DevImplementInputs {
|
|
62
74
|
batch?: unknown; plan?: unknown; close?: unknown; pr?: unknown; push?: unknown;
|
|
@@ -118,7 +130,7 @@ const GAPS_ROUNDS_WARNED = 2;
|
|
|
118
130
|
|
|
119
131
|
const answer = (lines: string[], next?: ImplementAnswer["next"]): string =>
|
|
120
132
|
JSON.stringify(next === undefined ? { lines } : { lines, next });
|
|
121
|
-
const blocked = (lines: string[], line: string): string => answer([...lines,
|
|
133
|
+
const blocked = (lines: string[], line: string): string => answer([...lines, blockedLine(line)]);
|
|
122
134
|
const reasonOf = (e: unknown): string => String((e as Error)?.message ?? e).split("\n")[0];
|
|
123
135
|
|
|
124
136
|
interface Run {
|
|
@@ -174,7 +186,7 @@ async function writeSheet(run: Run, text: string): Promise<string | null> {
|
|
|
174
186
|
try {
|
|
175
187
|
await run.deps.files.write(run.sheetPath, text);
|
|
176
188
|
} catch (e) {
|
|
177
|
-
return
|
|
189
|
+
return sheetNotWritten(reasonOf(e));
|
|
178
190
|
}
|
|
179
191
|
run.sheetText = text;
|
|
180
192
|
return null;
|
|
@@ -201,8 +213,8 @@ async function keepAssumptions(run: Run, text: string): Promise<void> {
|
|
|
201
213
|
if (added.length === 0) return;
|
|
202
214
|
const failed = await writeSheet(run, next);
|
|
203
215
|
run.lines.push(failed === null
|
|
204
|
-
?
|
|
205
|
-
:
|
|
216
|
+
? assumptionsWritten(added)
|
|
217
|
+
: assumptionsNotWritten(failed, added));
|
|
206
218
|
}
|
|
207
219
|
|
|
208
220
|
/** A path a write tool named, relative to /workspace. */
|
|
@@ -221,9 +233,9 @@ async function sheetPutBack(run: Run): Promise<string | null> {
|
|
|
221
233
|
if (now === run.sheetText) return null;
|
|
222
234
|
try {
|
|
223
235
|
await run.deps.files.write(run.sheetPath, run.sheetText);
|
|
224
|
-
return
|
|
236
|
+
return SHEET_PUT_BACK;
|
|
225
237
|
} catch (e) {
|
|
226
|
-
return
|
|
238
|
+
return sheetNotPutBack(reasonOf(e));
|
|
227
239
|
}
|
|
228
240
|
}
|
|
229
241
|
|
|
@@ -244,7 +256,7 @@ async function act(
|
|
|
244
256
|
.filter((p) => under(p, run.planFolder) && !under(p, run.planLogs)).sort();
|
|
245
257
|
const putBack = await sheetPutBack(run);
|
|
246
258
|
if (planChanges.length > 0 || putBack !== null) {
|
|
247
|
-
return
|
|
259
|
+
return roleChangedPlanFolder(role, planChanges.join(", ") || run.located.name, putBack);
|
|
248
260
|
}
|
|
249
261
|
if (!said.ok) return said.reason;
|
|
250
262
|
if (!after.ok) return after.problem;
|
|
@@ -272,9 +284,9 @@ async function tidyChanged(run: Run, changed: readonly string[]): Promise<void>
|
|
|
272
284
|
if (tidy.fixed.length === 0) continue;
|
|
273
285
|
try {
|
|
274
286
|
await run.deps.files.write(`${WORKSPACE}/${path}`, tidy.text);
|
|
275
|
-
run.lines.push(
|
|
287
|
+
run.lines.push(whitespaceFixed(path, tidy.fixed));
|
|
276
288
|
} catch (error) {
|
|
277
|
-
run.lines.push(
|
|
289
|
+
run.lines.push(whitespaceNotWritten(path, tidy.fixed, error instanceof Error ? error.message.split("\n")[0] : String(error)));
|
|
278
290
|
}
|
|
279
291
|
}
|
|
280
292
|
}
|
|
@@ -322,13 +334,13 @@ async function costFiles(run: Run, paths: readonly string[]): Promise<CostFile[]
|
|
|
322
334
|
/** The measured cost of the cycle's production changes, after its stated Cost line passed: a problem when the
|
|
323
335
|
* measure flags a port call or a memory filter on an added line; else the line it adds to the run's. */
|
|
324
336
|
async function measuredCost(run: Run, production: readonly string[]): Promise<{ problem: string } | { line: string }> {
|
|
325
|
-
if (production.length === 0) return { line:
|
|
337
|
+
if (production.length === 0) return { line: NO_PRODUCTION_CHANGED };
|
|
326
338
|
const cost = await measureAccessCost(run.deps.costIndex, run.pack, [], await costFiles(run, production), run.isTest);
|
|
327
|
-
if (cost.state === "not-computed") return { line:
|
|
339
|
+
if (cost.state === "not-computed") return { line: measuredNotComputed(cost.reason) };
|
|
328
340
|
if (cost.exit === 2) {
|
|
329
|
-
return { problem:
|
|
341
|
+
return { problem: costFlagged(cost.costLine, cost.flagged) };
|
|
330
342
|
}
|
|
331
|
-
return { line:
|
|
343
|
+
return { line: costMeasured(cost.costLine) };
|
|
332
344
|
}
|
|
333
345
|
|
|
334
346
|
/** The step's `to create` production paths that are still to create: neither written in this run nor present in the
|
|
@@ -401,31 +413,31 @@ async function runCycle(run: Run, cycle: Cycle): Promise<string | null> {
|
|
|
401
413
|
const t3 = await recallForRed(run, step);
|
|
402
414
|
const carried = await carriedFor(run, [testFileOf(step)]);
|
|
403
415
|
const done = await act(run, "test-author", withPrecedents(redContract({ ...contractInput(run, step, command.command, carried), stubs }), [t3, run.correction, run.stale]), stubs);
|
|
404
|
-
if (typeof done === "string") return
|
|
416
|
+
if (typeof done === "string") return stepActProblem(step.number, "RED", done);
|
|
405
417
|
run.ran.push(step);
|
|
406
418
|
const earlier = before;
|
|
407
419
|
red = await run.tools.runTests({ command: command.command });
|
|
408
420
|
const problem = redProblem(done.changed, run.isTest, observedRun(red), stubs);
|
|
409
|
-
if (problem !== null) return
|
|
421
|
+
if (problem !== null) return stepActProblem(step.number, "RED", `${problem}${logOf(red)}`);
|
|
410
422
|
// A later step of the cycle: its file failed already, so its own tests must add a failure.
|
|
411
423
|
const added = earlier !== null && red.ok ? addedFailure(earlier, red.tail) : "ok";
|
|
412
|
-
if (typeof added === "object") return
|
|
424
|
+
if (typeof added === "object") return stepActProblem(step.number, "RED", `${added.problem}${logOf(red)}`);
|
|
413
425
|
done.changed.forEach((p) => { run.touched.add(p); if (!run.isTest(p)) production.add(p); });
|
|
414
426
|
const failed = await tick(run, step, "RED");
|
|
415
|
-
if (failed !== null) return
|
|
427
|
+
if (failed !== null) return stepActProblem(step.number, "RED", failed);
|
|
416
428
|
before = red.ok ? red.tail : null;
|
|
417
429
|
await recordRedCount(run, step, red.ok ? failureCount(red.tail) : null);
|
|
418
430
|
const wroteStubs = done.changed.filter((p) => !run.isTest(p));
|
|
419
431
|
wroteStubs.forEach((p) => stubbed.add(p));
|
|
420
|
-
const unchecked = added === "unknown" ?
|
|
421
|
-
run.lines.push(
|
|
432
|
+
const unchecked = added === "unknown" ? FAILURE_NOT_CHECKED : "";
|
|
433
|
+
run.lines.push(redDone(step.number, done.changed.filter(run.isTest).join(", "), wroteStubs, unchecked));
|
|
422
434
|
}
|
|
423
435
|
|
|
424
436
|
let costText: string | null = null;
|
|
425
437
|
const green = steps.filter((s) => !s.tdd?.green);
|
|
426
438
|
if (green.length > 0) {
|
|
427
439
|
red ??= await run.tools.runTests({ command: command.command });
|
|
428
|
-
const redTail = red.ok ? { tail: red.tail, log: red.log } : { tail:
|
|
440
|
+
const redTail = red.ok ? { tail: red.tail, log: red.log } : { tail: notRun(red.refused), log: null };
|
|
429
441
|
const greenLabel = stepsLabel(green);
|
|
430
442
|
// The production files too: a stub RED wrote, an existing module, so that GREEN opens none of them.
|
|
431
443
|
const productionFiles = green.flatMap((s) => (s.anchor?.production ?? []).filter((r) => r.state !== "member").map((r) => r.path));
|
|
@@ -439,7 +451,7 @@ async function runCycle(run: Run, cycle: Cycle): Promise<string | null> {
|
|
|
439
451
|
done.changed.forEach((p) => { run.touched.add(p); production.add(p); });
|
|
440
452
|
const failed = await tickAll(run, green, "GREEN");
|
|
441
453
|
if (failed !== null) return `${greenLabel} GREEN: ${failed}`;
|
|
442
|
-
run.lines.push(
|
|
454
|
+
run.lines.push(greenDone(greenLabel, done.changed.join(", ")));
|
|
443
455
|
costText = done.text;
|
|
444
456
|
}
|
|
445
457
|
|
|
@@ -449,8 +461,7 @@ async function runCycle(run: Run, cycle: Cycle): Promise<string | null> {
|
|
|
449
461
|
let cost = readCost(costText ?? "");
|
|
450
462
|
if (!cost.ok && cost.line === undefined) {
|
|
451
463
|
const asked = await askLine(run.deps.roleLlm("implementer", run.pack.layout, run.wrote, []), IMPLEMENTER,
|
|
452
|
-
`${label[0].toUpperCase()}${label.slice(1)}
|
|
453
|
-
"`Cost: <reads> reads, <writes> writes; <where a port call sits in a loop, a lambda or a memory filter, or none>`.");
|
|
464
|
+
askCostLine(`${label[0].toUpperCase()}${label.slice(1)}`, run.located.code, run.sheet.batch));
|
|
454
465
|
if (!asked.ok) return `${costLabel} COST: ${asked.reason}`;
|
|
455
466
|
cost = readCost(asked.text);
|
|
456
467
|
}
|
|
@@ -459,16 +470,16 @@ async function runCycle(run: Run, cycle: Cycle): Promise<string | null> {
|
|
|
459
470
|
if ("problem" in measured) return `${costLabel} COST: ${measured.problem}`;
|
|
460
471
|
const failed = await tickAll(run, costed, "COST");
|
|
461
472
|
if (failed !== null) return `${costLabel} COST: ${failed}`;
|
|
462
|
-
run.lines.push(
|
|
473
|
+
run.lines.push(costDone(costLabel, cost.line, measured.line));
|
|
463
474
|
}
|
|
464
475
|
return null;
|
|
465
476
|
}
|
|
466
477
|
|
|
467
478
|
function logOf(run: WrappedRun): string {
|
|
468
|
-
return run.ok && run.log !== null ?
|
|
479
|
+
return run.ok && run.log !== null ? shownLog(run.log.replace(`${WORKSPACE}/`, "")) : "";
|
|
469
480
|
}
|
|
470
481
|
|
|
471
|
-
const shownPath = (path: string | null): string => (path === null ? "" :
|
|
482
|
+
const shownPath = (path: string | null): string => (path === null ? "" : shownLog(path.replace(`${WORKSPACE}/`, "")));
|
|
472
483
|
|
|
473
484
|
/** The pack's restore, once, before any act: true when it ran green, null when the pack has none. */
|
|
474
485
|
async function restore(
|
|
@@ -477,23 +488,23 @@ async function restore(
|
|
|
477
488
|
const command = run.pack.commands.restore?.trim();
|
|
478
489
|
if (!command) return { restored: false };
|
|
479
490
|
const refusal = shellRuleGuard(stepRules("dev-implement"))(command);
|
|
480
|
-
if (refusal !== null) return { problem:
|
|
491
|
+
if (refusal !== null) return { problem: restoreRefused(refusal) };
|
|
481
492
|
let r;
|
|
482
493
|
try {
|
|
483
494
|
r = await run.deps.shell.run(command, { timeoutSeconds: RESTORE_TIMEOUT_SECONDS });
|
|
484
495
|
} catch (e) {
|
|
485
|
-
return { problem:
|
|
496
|
+
return { problem: restoreCouldNotRun(command, reasonOf(e)) };
|
|
486
497
|
}
|
|
487
498
|
const log = `${run.logFolder}/${batch}-restore.txt`;
|
|
488
499
|
const output = [r.stdout.trimEnd(), r.stderr.trimEnd()].filter((t) => t !== "").join("\n");
|
|
489
500
|
try {
|
|
490
|
-
await run.deps.files.write(log, logText(command, r.timedOut === true ? [
|
|
501
|
+
await run.deps.files.write(log, logText(command, r.timedOut === true ? [restoreNoVerdict(RESTORE_TIMEOUT_SECONDS)] : [], output, r.timedOut === true ? NO_VERDICT_EXIT : r.exitCode));
|
|
491
502
|
} catch {
|
|
492
503
|
// the log is a help, never a verdict
|
|
493
504
|
}
|
|
494
|
-
if (r.timedOut === true) return { problem:
|
|
495
|
-
if (r.exitCode !== 0) return { problem:
|
|
496
|
-
run.lines.push(
|
|
505
|
+
if (r.timedOut === true) return { problem: restoreStillRunning(command, RESTORE_TIMEOUT_SECONDS) };
|
|
506
|
+
if (r.exitCode !== 0) return { problem: restoreExited(command, r.exitCode, shownPath(log)) };
|
|
507
|
+
run.lines.push(restored(command));
|
|
497
508
|
return { restored: true };
|
|
498
509
|
}
|
|
499
510
|
|
|
@@ -542,19 +553,19 @@ async function refreshIndex(run: Run): Promise<boolean> {
|
|
|
542
553
|
try {
|
|
543
554
|
const roots = (await index.roots()).map((r) => (r.length > 1 ? r.replace(/\/+$/, "") : r));
|
|
544
555
|
if (!roots.includes(WORKSPACE)) {
|
|
545
|
-
run.lines.push(
|
|
556
|
+
run.lines.push(indexNotIndexed(WORKSPACE));
|
|
546
557
|
return false;
|
|
547
558
|
}
|
|
548
559
|
const errors = await index.refresh(WORKSPACE, files);
|
|
549
560
|
if (errors.length > 0) {
|
|
550
|
-
run.lines.push(
|
|
561
|
+
run.lines.push(indexReindexFailed(reasonOf(errors[0])));
|
|
551
562
|
return false;
|
|
552
563
|
}
|
|
553
564
|
} catch (e) {
|
|
554
|
-
run.lines.push(
|
|
565
|
+
run.lines.push(indexNotRefreshed(reasonOf(e)));
|
|
555
566
|
return false;
|
|
556
567
|
}
|
|
557
|
-
run.lines.push(
|
|
568
|
+
run.lines.push(indexRefreshed(files.length, run.sheet.batch));
|
|
558
569
|
return true;
|
|
559
570
|
}
|
|
560
571
|
|
|
@@ -567,7 +578,7 @@ async function graphAffected(run: Run): Promise<AffectedTests | null> {
|
|
|
567
578
|
// Relative to the indexed root: affected_tests looks each file up as `<root>/<file>`, an absolute path never resolves.
|
|
568
579
|
return await index.affected([...run.touched].sort());
|
|
569
580
|
} catch (e) {
|
|
570
|
-
run.lines.push(
|
|
581
|
+
run.lines.push(graphNotRead(reasonOf(e)));
|
|
571
582
|
return null;
|
|
572
583
|
}
|
|
573
584
|
}
|
|
@@ -581,74 +592,74 @@ async function suites(run: Run, suiteGreen: boolean): Promise<SuiteResult> {
|
|
|
581
592
|
// The tree changed whatever the build says: the index is refreshed first, so a red build leaves no stale graph.
|
|
582
593
|
const indexed = await refreshIndex(run);
|
|
583
594
|
const build = run.pack.commands.build?.trim();
|
|
584
|
-
if (!build) run.lines.push(
|
|
595
|
+
if (!build) run.lines.push(BUILD_LINE_NOT_RUN);
|
|
585
596
|
else {
|
|
586
597
|
const refusal = guard(build);
|
|
587
|
-
if (refusal !== null) return { problem:
|
|
598
|
+
if (refusal !== null) return { problem: buildRefused(refusal) };
|
|
588
599
|
const outcome = await oneSuite(run, "build", build, `${run.logFolder}/${batch}-build.txt`);
|
|
589
600
|
if (outcome.status === "not-run") return { problem: outcome.reason };
|
|
590
|
-
if (outcome.status === "running") return { problem:
|
|
591
|
-
if (outcome.status === "failed") return { problem:
|
|
592
|
-
run.lines.push(
|
|
601
|
+
if (outcome.status === "running") return { problem: buildStillRunning(outcome.seconds, shownPath(outcome.log)) };
|
|
602
|
+
if (outcome.status === "failed") return { problem: buildExited(build, outcome.exit, shownPath(outcome.log), outcome.tail) };
|
|
603
|
+
run.lines.push(buildDone(build, outcome.how === "blocking", shownPath(outcome.log)));
|
|
593
604
|
}
|
|
594
605
|
|
|
595
606
|
const graph = suiteGreen && indexed ? await graphAffected(run) : null;
|
|
596
607
|
const affected = suiteGreen && graph?.all !== true ? affectedCommands(run, graph?.projects ?? []) : null;
|
|
597
608
|
if (affected !== null && affected.leftOut.length > 0) {
|
|
598
|
-
run.lines.push(
|
|
609
|
+
run.lines.push(graphProjectsLeftOut(affected.leftOut));
|
|
599
610
|
}
|
|
600
611
|
if (affected !== null) {
|
|
601
612
|
const texts: string[] = [];
|
|
602
613
|
let exit = 0;
|
|
603
614
|
for (const command of affected.commands) {
|
|
604
615
|
const refusal = guard(command);
|
|
605
|
-
if (refusal !== null) return { problem:
|
|
616
|
+
if (refusal !== null) return { problem: affectedRefused(refusal) };
|
|
606
617
|
const outcome = await oneSuite(run, "affected tests", command, null);
|
|
607
618
|
if (outcome.status === "not-run") return { problem: outcome.reason };
|
|
608
619
|
texts.push(outcome.text.trimEnd());
|
|
609
620
|
if (outcome.status === "running") {
|
|
610
621
|
await writeLogQuietly(run, affectedLog, `${texts.join("\n")}\n`);
|
|
611
|
-
return { problem:
|
|
622
|
+
return { problem: affectedStillRunning(outcome.seconds, shownPath(affectedLog)) };
|
|
612
623
|
}
|
|
613
624
|
if (outcome.status === "failed") {
|
|
614
625
|
if (exit === 0) exit = outcome.exit;
|
|
615
626
|
await writeLogQuietly(run, affectedLog, `${texts.join("\n")}\nexit=${exit}\n`);
|
|
616
|
-
return { problem:
|
|
627
|
+
return { problem: affectedExited(command, outcome.exit, shownPath(affectedLog), outcome.tail) };
|
|
617
628
|
}
|
|
618
629
|
}
|
|
619
630
|
await writeLogQuietly(run, affectedLog, `${texts.join("\n")}\nexit=${exit}\n`);
|
|
620
631
|
const byGraph = graph === null ? ""
|
|
621
|
-
:
|
|
622
|
-
run.lines.push(
|
|
632
|
+
: graphAdded(affected.fromGraph, graph.classes.length);
|
|
633
|
+
run.lines.push(affectedDone(affected.commands, batch, byGraph, shownPath(affectedLog)));
|
|
623
634
|
return { ok: true, whole: false };
|
|
624
635
|
}
|
|
625
636
|
|
|
626
637
|
const test = run.pack.commands.test?.trim();
|
|
627
638
|
if (!test) {
|
|
628
|
-
run.lines.push(
|
|
639
|
+
run.lines.push(TEST_NOT_RUN);
|
|
629
640
|
return { ok: true, whole: false };
|
|
630
641
|
}
|
|
631
642
|
const refusal = guard(test);
|
|
632
|
-
if (refusal !== null) return { problem:
|
|
643
|
+
if (refusal !== null) return { problem: testRefused(refusal) };
|
|
633
644
|
// A whole-suite run empties the affected log: the audit then reads this one.
|
|
634
645
|
await writeLogQuietly(run, affectedLog, "");
|
|
635
646
|
const outcome = await oneSuite(run, "test", test, `${run.logFolder}/${batch}-test.txt`);
|
|
636
647
|
if (outcome.status === "not-run") return { problem: outcome.reason };
|
|
637
|
-
if (outcome.status === "running") return { problem:
|
|
638
|
-
if (outcome.status === "failed") return { problem:
|
|
648
|
+
if (outcome.status === "running") return { problem: testStillRunning(outcome.seconds, shownPath(outcome.log)) };
|
|
649
|
+
if (outcome.status === "failed") return { problem: testExited(test, outcome.exit, shownPath(outcome.log), outcome.tail) };
|
|
639
650
|
const again = !suiteGreen ? ""
|
|
640
651
|
: graph?.all === true && graph.unresolved.length > 0
|
|
641
|
-
?
|
|
642
|
-
: graph?.all === true ?
|
|
643
|
-
:
|
|
644
|
-
run.lines.push(
|
|
652
|
+
? wholeSuiteUnplaced(cutList(graph.unresolved))
|
|
653
|
+
: graph?.all === true ? WHOLE_SUITE_EVERY_TEST
|
|
654
|
+
: WHOLE_SUITE_NO_TEST_PROJECT;
|
|
655
|
+
run.lines.push(testDone(test, outcome.how === "blocking", again, shownPath(outcome.log)));
|
|
645
656
|
return { ok: true, whole: true };
|
|
646
657
|
}
|
|
647
658
|
|
|
648
659
|
/** At most three paths, then how many more. */
|
|
649
660
|
function cutList(paths: readonly string[]): string {
|
|
650
661
|
const shown = paths.slice(0, 3).join(", ");
|
|
651
|
-
return paths.length > 3 ?
|
|
662
|
+
return paths.length > 3 ? firstAndMore(shown, paths.length - 3) : shown;
|
|
652
663
|
}
|
|
653
664
|
|
|
654
665
|
async function writeLogQuietly(run: Run, path: string, text: string): Promise<void> {
|
|
@@ -673,18 +684,18 @@ async function verdictState(files: Pick<Files, "read">, path: string): Promise<{
|
|
|
673
684
|
|
|
674
685
|
export async function runDevImplement(input: DevImplementInputs, deps: DevImplementDeps): Promise<string> {
|
|
675
686
|
const batch = String(input.batch ?? "").trim();
|
|
676
|
-
if (!BATCH.test(batch)) return blocked([],
|
|
687
|
+
if (!BATCH.test(batch)) return blocked([], batchIsFn(batch));
|
|
677
688
|
const plan = typeof input.plan === "string" && input.plan.trim() !== "" ? input.plan.trim() : null;
|
|
678
689
|
const inputContext = prContextOf(input);
|
|
679
690
|
const mode = typeof input.permissionMode === "string" ? input.permissionMode.trim() : "";
|
|
680
691
|
if (mode !== "" && policyFor(mode).readOnly) {
|
|
681
|
-
return blocked([],
|
|
692
|
+
return blocked([], readOnlyMode(mode));
|
|
682
693
|
}
|
|
683
694
|
|
|
684
695
|
const context = await loadDevContext({ files: deps.files, shell: deps.shell, config: deps.config });
|
|
685
696
|
const lines = context.warnings.slice(0, 5).map((w) => `⚠ ${w}`);
|
|
686
|
-
if (context.pack === null) return blocked(lines,
|
|
687
|
-
if (context.work.vfsPath === null) return blocked(lines,
|
|
697
|
+
if (context.pack === null) return blocked(lines, NO_REPOSITORY_PACK);
|
|
698
|
+
if (context.work.vfsPath === null) return blocked(lines, workFolderOutsideMounts(context.work.folder));
|
|
688
699
|
const pack = context.pack.pack;
|
|
689
700
|
|
|
690
701
|
const located = await locateSheet(deps.files, context.work.folder, batch, plan);
|
|
@@ -698,13 +709,13 @@ export async function runDevImplement(input: DevImplementInputs, deps: DevImplem
|
|
|
698
709
|
const pr = inputContext ?? record.pr;
|
|
699
710
|
const closeMode = pr?.permissionMode.trim() ?? "";
|
|
700
711
|
if (closeMode !== "" && policyFor(closeMode).readOnly) {
|
|
701
|
-
return blocked(lines,
|
|
712
|
+
return blocked(lines, readOnlyModeAtClose(closeMode, closeCommand(located.code, batch)));
|
|
702
713
|
}
|
|
703
714
|
const opener = pr !== null && pr.githubTool ? deps.openerFor?.(pr) : undefined;
|
|
704
715
|
// A batch of a /dev-batches run in progress is committed, never pushed, even when its close is typed (after a
|
|
705
716
|
// GAPS stop, a refused hop): the run's own close pushes the plan's branch once.
|
|
706
717
|
const inRun = input.push !== false && batchesRunCode(await deps.files.read(BATCHES_ACTIVE_RECORD).catch(() => "")) === located.code;
|
|
707
|
-
if (inRun) lines.push(
|
|
718
|
+
if (inRun) lines.push(notPushedInRun(located.code));
|
|
708
719
|
return answer([...lines, ...await closeDevBatch({ ...deps, opener }, {
|
|
709
720
|
pack, work: context.work, located, batch, touched: record.touched, verdictMark: record.verdictMark,
|
|
710
721
|
openPr: input.pr === true, push: input.push !== false && !inRun, today: isoDay(deps.clock()),
|
|
@@ -713,13 +724,13 @@ export async function runDevImplement(input: DevImplementInputs, deps: DevImplem
|
|
|
713
724
|
}
|
|
714
725
|
|
|
715
726
|
if (!hasTestLayout(pack.layout)) {
|
|
716
|
-
return blocked(lines,
|
|
727
|
+
return blocked(lines, NO_TEST_LAYOUT);
|
|
717
728
|
}
|
|
718
729
|
let sheetText: string;
|
|
719
730
|
try {
|
|
720
731
|
sheetText = await deps.files.read(sheetPath);
|
|
721
732
|
} catch (e) {
|
|
722
|
-
return blocked(lines, `${located.dir}/${located.name}
|
|
733
|
+
return blocked(lines, cannotBeReadColonReason(`${located.dir}/${located.name}`, reasonOf(e)));
|
|
723
734
|
}
|
|
724
735
|
const verdictPath = `${WORKSPACE}/${located.dir}/${located.prefix}-VERIFY-${batch}.md`;
|
|
725
736
|
const verdicts = await verdictState(deps.files, verdictPath);
|
|
@@ -727,30 +738,30 @@ export async function runDevImplement(input: DevImplementInputs, deps: DevImplem
|
|
|
727
738
|
const finding = typeof input.correction === "string" ? input.correction.trim() : "";
|
|
728
739
|
if (finding !== "") {
|
|
729
740
|
const edit = addCorrection(sheetText, finding);
|
|
730
|
-
if (!edit.ok) return blocked(lines,
|
|
741
|
+
if (!edit.ok) return blocked(lines, correctionProblem(edit.reason));
|
|
731
742
|
if (edit.appended) {
|
|
732
743
|
try {
|
|
733
744
|
await deps.files.write(sheetPath, edit.text);
|
|
734
745
|
} catch (e) {
|
|
735
|
-
return blocked(lines,
|
|
746
|
+
return blocked(lines, correctionProblem(sheetNotWritten(reasonOf(e))));
|
|
736
747
|
}
|
|
737
|
-
lines.push(
|
|
748
|
+
lines.push(correctionAppended(located.name, edit.step, edit.title));
|
|
738
749
|
} else {
|
|
739
|
-
lines.push(
|
|
750
|
+
lines.push(correctionStillOpen(edit.step, edit.title));
|
|
740
751
|
}
|
|
741
752
|
sheetText = edit.text;
|
|
742
753
|
if (verdicts.gapsRounds >= GAPS_ROUNDS_WARNED) {
|
|
743
|
-
lines.push(
|
|
754
|
+
lines.push(gapsRoundsWarned(verdicts.gapsRounds));
|
|
744
755
|
}
|
|
745
756
|
}
|
|
746
757
|
const sheet = parseImplementSheet(sheetText);
|
|
747
|
-
if (sheet.problems.length > 0) return blocked(lines,
|
|
758
|
+
if (sheet.problems.length > 0) return blocked(lines, sheetMalformed(sheet.problems));
|
|
748
759
|
|
|
749
760
|
const logFolder = `${context.work.vfsPath}/${located.code}/logs`;
|
|
750
761
|
const written = new Set<string>();
|
|
751
762
|
const wrote = (path: string): void => { if (path.trim() !== "") written.add(workspacePath(path)); };
|
|
752
763
|
const pr = inputContext ?? record.pr;
|
|
753
|
-
const runLines = [...lines,
|
|
764
|
+
const runLines = [...lines, runTitle(batch, located.code, `${located.dir}/${located.name}`)];
|
|
754
765
|
const open = openSteps(sheet);
|
|
755
766
|
let restored = false;
|
|
756
767
|
if (open.length > 0) {
|
|
@@ -799,7 +810,7 @@ export async function runDevImplement(input: DevImplementInputs, deps: DevImplem
|
|
|
799
810
|
if (recalledLine !== "") run.lines.push(recalledLine);
|
|
800
811
|
const planArg = plan ?? located.code;
|
|
801
812
|
const auditMode = verdicts.last === "GAPS" ? "resume" : "fast";
|
|
802
|
-
run.lines.push(
|
|
813
|
+
run.lines.push(batchGreen(batch, auditCommand(planArg, batch, auditMode)));
|
|
803
814
|
return answer(run.lines, {
|
|
804
815
|
crew: "dev-verify",
|
|
805
816
|
input: {
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
// The log is what dev-verify's capture reads (`<work>/<code>/logs/F<n>-build.txt`, `F<n>-test.txt`,
|
|
9
9
|
// `F<n>-test-affected.txt`): a `#` header, the output, then a last line `exit=<n>`, the harness's shape.
|
|
10
10
|
import type { Files, Shell, ShellJobs } from "../../../shared/application/ports.ts";
|
|
11
|
+
import {
|
|
12
|
+
CODE_CANNOT_WAIT, jobCannotBeRead, jobCouldNotBeRead, jobDidNotStart, jobLogHeader, jobStillRunning, lostWaitOnJob, noVerdict,
|
|
13
|
+
runBlocking, stillRunningNoVerdict, tailNotRead,
|
|
14
|
+
} from "./messages.ts";
|
|
11
15
|
|
|
12
16
|
export const TAIL_LINES = 500;
|
|
13
17
|
export const SHOWN_LINES = 15;
|
|
@@ -51,7 +55,7 @@ async function writeLog(files: Pick<Files, "write">, path: string | null, text:
|
|
|
51
55
|
|
|
52
56
|
/** A job lost after it started: no verdict, and a log saying so, so that an earlier log is never read for this run. */
|
|
53
57
|
async function lost(deps: { files: Pick<Files, "write"> }, req: SuiteRequest, why: string): Promise<SuiteOutcome> {
|
|
54
|
-
await writeLog(deps.files, req.log, logText(req.command, [
|
|
58
|
+
await writeLog(deps.files, req.log, logText(req.command, [noVerdict(why, NO_VERDICT_EXIT)], "", NO_VERDICT_EXIT));
|
|
55
59
|
return { status: "not-run", reason: `${req.label}: ${why}` };
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -63,9 +67,9 @@ async function blocking(deps: { shell: Pick<Shell, "run">; files: Pick<Files, "w
|
|
|
63
67
|
return { status: "not-run", reason: `${req.label}: ${reasonOf(e)}` };
|
|
64
68
|
}
|
|
65
69
|
const output = [r.stdout.trimEnd(), r.stderr.trimEnd()].filter((t) => t !== "").join("\n");
|
|
66
|
-
const header = [
|
|
70
|
+
const header = [runBlocking(why)];
|
|
67
71
|
if (r.timedOut === true) {
|
|
68
|
-
const text = logText(req.command, [...header,
|
|
72
|
+
const text = logText(req.command, [...header, stillRunningNoVerdict(req.limitSeconds, NO_VERDICT_EXIT)], output, NO_VERDICT_EXIT);
|
|
69
73
|
return { status: "running", seconds: req.limitSeconds, log: await writeLog(deps.files, req.log, text), text };
|
|
70
74
|
}
|
|
71
75
|
const text = logText(req.command, header, output, r.exitCode);
|
|
@@ -76,12 +80,12 @@ async function blocking(deps: { shell: Pick<Shell, "run">; files: Pick<Files, "w
|
|
|
76
80
|
export async function runSuite(
|
|
77
81
|
deps: { jobs: ShellJobs; shell: Pick<Shell, "run">; files: Pick<Files, "write"> }, req: SuiteRequest,
|
|
78
82
|
): Promise<SuiteOutcome> {
|
|
79
|
-
if (!(await deps.jobs.wait(1))) return blocking(deps, req,
|
|
83
|
+
if (!(await deps.jobs.wait(1))) return blocking(deps, req, CODE_CANNOT_WAIT);
|
|
80
84
|
let job;
|
|
81
85
|
try {
|
|
82
86
|
job = await deps.jobs.start(req.command);
|
|
83
87
|
} catch (e) {
|
|
84
|
-
return blocking(deps, req,
|
|
88
|
+
return blocking(deps, req, jobDidNotStart(reasonOf(e)));
|
|
85
89
|
}
|
|
86
90
|
let seconds = 0;
|
|
87
91
|
for (let looks = 0; ; looks++) {
|
|
@@ -91,27 +95,27 @@ export async function runSuite(
|
|
|
91
95
|
} catch (e) {
|
|
92
96
|
// A job never seen running may not run at all: once, the suite runs blocking (the job, if it runs, dies
|
|
93
97
|
// with the run). A job seen before and lost now gives no verdict.
|
|
94
|
-
if (looks === 0) return blocking(deps, req,
|
|
95
|
-
return lost(deps, req,
|
|
98
|
+
if (looks === 0) return blocking(deps, req, jobCouldNotBeRead(job.id, reasonOf(e)));
|
|
99
|
+
return lost(deps, req, jobCannotBeRead(job.id, reasonOf(e)));
|
|
96
100
|
}
|
|
97
101
|
if (!status.running) {
|
|
98
102
|
let tail = "";
|
|
99
103
|
try {
|
|
100
104
|
tail = await deps.jobs.tail(job.id, TAIL_LINES);
|
|
101
105
|
} catch (e) {
|
|
102
|
-
tail =
|
|
106
|
+
tail = tailNotRead(reasonOf(e));
|
|
103
107
|
}
|
|
104
|
-
const text = logText(req.command, [
|
|
108
|
+
const text = logText(req.command, [jobLogHeader(job.id, job.log, TAIL_LINES)], tail, status.exitCode);
|
|
105
109
|
const log = await writeLog(deps.files, req.log, text);
|
|
106
110
|
return { status: status.exitCode === 0 ? "passed" : "failed", exit: status.exitCode, tail: lastLines(tail, SHOWN_LINES), log, how: "job", text };
|
|
107
111
|
}
|
|
108
112
|
if (seconds >= req.limitSeconds) {
|
|
109
|
-
const text = logText(req.command, [
|
|
113
|
+
const text = logText(req.command, [jobStillRunning(job.id, seconds, NO_VERDICT_EXIT, job.log)], "", NO_VERDICT_EXIT);
|
|
110
114
|
return { status: "running", seconds, log: await writeLog(deps.files, req.log, text), text };
|
|
111
115
|
}
|
|
112
116
|
const slice = Math.min(req.sliceSeconds, 2 ** looks, req.limitSeconds - seconds);
|
|
113
117
|
if (!(await deps.jobs.wait(slice))) {
|
|
114
|
-
return lost(deps, req,
|
|
118
|
+
return lost(deps, req, lostWaitOnJob(job.id));
|
|
115
119
|
}
|
|
116
120
|
seconds += slice;
|
|
117
121
|
}
|
|
@@ -29,6 +29,7 @@ import { providerEffort } from "../../shared/domain/agent-policy/behavior-flags.
|
|
|
29
29
|
import { implementBudget } from "./domain/implement-budget.ts";
|
|
30
30
|
import { CREW_TOOLS } from "./domain/roles.ts";
|
|
31
31
|
import { implementInputs, runDevImplement } from "./application/run-dev-implement.ts";
|
|
32
|
+
import { DEV_IMPLEMENT_GOAL } from "./application/prompts.ts";
|
|
32
33
|
|
|
33
34
|
// run_tests and run_build: built here, bound by the body to the run's wrapped tools (its pack, its rules, its logs).
|
|
34
35
|
const toolSlot = scriptToolSlot<WrappedTools>();
|
|
@@ -42,7 +43,7 @@ const memoryOn = memoryRecallOn(inputs());
|
|
|
42
43
|
const builder = orkeonAgent()
|
|
43
44
|
.name("dev-implement")
|
|
44
45
|
.role("Batch implementer")
|
|
45
|
-
.goal(
|
|
46
|
+
.goal(DEV_IMPLEMENT_GOAL)
|
|
46
47
|
.tools([...CREW_TOOLS])
|
|
47
48
|
.withAutonomousTool(runTestsTool(ToolBuilder, toolSlot))
|
|
48
49
|
.withAutonomousTool(runBuildTool(ToolBuilder, toolSlot))
|