orkeon-code 1.0.0-rc.1 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.orkeon-runtime +11 -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 +508 -80
- package/orkeon-code.ps1 +129 -11
- package/package.json +3 -1
- package/scripts/dev-run.sh +139 -0
- 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 +101 -0
- package/src/commands/_lib/status/meta.ts +5 -25
- 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 +539 -94
- 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 +8 -6
- 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 +6 -5
- 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 +4 -4
- 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 +6 -5
- 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 +13 -10
- 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 +14 -16
- 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 +56 -0
- package/src/crews/dev-learn/application/prompts.ts +96 -0
- package/src/crews/dev-learn/application/run-dev-learn.ts +51 -43
- package/src/crews/dev-learn/crew.ork.ts +5 -4
- package/src/crews/dev-learn/domain/learn-answer.ts +60 -37
- package/src/crews/dev-learn/domain/markers.ts +10 -0
- package/src/crews/dev-learn/domain/messages.ts +74 -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 +12 -9
- 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 +33 -34
- 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 +21 -21
- 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 +7 -7
- 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 +38 -55
- package/src/crews/git-commit/application/messages.ts +17 -0
- package/src/crews/git-commit/application/prompts.ts +47 -0
- package/src/crews/git-commit/application/run-git-commit.ts +16 -13
- package/src/crews/git-commit/crew.ork.ts +6 -5
- 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 +6 -5
- 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 +64 -31
- 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 +6 -5
- 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 +6 -5
- package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
- package/src/crews/shared-memory-admit/crew.ork.ts +4 -3
- 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 +135 -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 +16 -11
- 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 +51 -12
- package/src/shared/domain/dev/learn-state.ts +3 -2
- package/src/shared/domain/dev/markers.ts +127 -0
- package/src/shared/domain/dev/messages.ts +271 -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 +15 -25
- 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 +6 -4
- 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 +14 -11
- package/src/shared/domain/git/messages.ts +41 -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-learn/application/learn-prompt.ts +0 -140
- package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
- package/src/shared/domain/session-summary.ts +0 -13
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The text the memory commands show the user (ADR 0026): /memory, /feedback and /memory-admit.
|
|
2
|
+
|
|
3
|
+
// /memory and /feedback
|
|
4
|
+
|
|
5
|
+
export const FEEDBACK_USAGE = "usage: /feedback <what should change or keep happening>";
|
|
6
|
+
export const FEEDBACK_RECORDED = "feedback recorded — the agent replays feedback memories on every /assistant turn.";
|
|
7
|
+
|
|
8
|
+
// /memory-admit
|
|
9
|
+
|
|
10
|
+
export const LIST_TAKES_NOTHING = "memory-admit: --list takes nothing else";
|
|
11
|
+
export const IMPORT_TAKES_NOTHING = "memory-admit: --import takes nothing else";
|
|
12
|
+
export const REFUSE_USAGE = "memory-admit: --refuse <id> [<motif>]: the id of a pending candidate";
|
|
13
|
+
export const motifTooLong = (max: number): string => `memory-admit: a motif of at most ${max} characters`;
|
|
14
|
+
export const unknownAdmitOption = (option: string): string =>
|
|
15
|
+
`memory-admit: unknown option '${option}' (--list, --refuse, --import)`;
|
|
16
|
+
export const notACandidateId = (token: string): string => `memory-admit: '${token}' is not a candidate id`;
|
|
17
|
+
|
|
18
|
+
export const HEADLESS =
|
|
19
|
+
"refused: /memory-admit asks before admitting and this session cannot prompt: no asked candidate was admitted. " +
|
|
20
|
+
"Run it in an interactive session (an audited candidate admits unasked when memory.autoAdmitAudited is true).";
|
|
21
|
+
|
|
22
|
+
/** A question cancelled after another was answered: the session can prompt, the person stopped. */
|
|
23
|
+
export const stoppedAt = (id: string): string =>
|
|
24
|
+
`refused: the question about ${id} got no answer: it and the candidates after it stay candidates. Run /memory-admit again for them.`;
|
|
25
|
+
|
|
26
|
+
export const noPendingCandidate = (dir: string): string => `No pending candidate in ${dir}.`;
|
|
27
|
+
export const NO_INGESTION_ON_REFUSAL = "no ingestion on a refusal";
|
|
28
|
+
export const notPending = (id: string): string => `${id}: not a pending candidate (/memory-admit --list)`;
|
|
29
|
+
export const NOTHING_ADMITTED = "Nothing admitted.";
|
|
30
|
+
export const ADMITTED_UNASKED = " admitted without a question (audited, memory.autoAdmitAudited is true)";
|
|
31
|
+
export const admitQuestion = (id: string): string => `Admit ${id} into the shared memory?`;
|
|
32
|
+
export const LEFT_AS_CANDIDATE = " left as a candidate";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The text the shared helpers of commands/_lib/ show the user (ADR 0026): the warnings of a launch, the refusals of a
|
|
2
|
+
// dev step. Read by dispatch.ts, dev-step.ts and args.ts.
|
|
3
|
+
|
|
4
|
+
// dispatch.ts: the main loop's launch
|
|
5
|
+
export const extraToolMissing = (name: string) =>
|
|
6
|
+
`extra tool '${name}' is not registered by the host and is left out ` +
|
|
7
|
+
"(its MCP server did not connect, its plugin did not load, or the name is mistyped)";
|
|
8
|
+
export const extraToolIgnored = (key: string, entry: string, rule: string) => `${key}: '${entry}' is ignored (${rule})`;
|
|
9
|
+
export const extraToolsUnreadable = (key: string, reason: string) =>
|
|
10
|
+
`${key} could not be read (${reason}): no extra tool this turn`;
|
|
11
|
+
export const ruleOverridden = (rule: string) =>
|
|
12
|
+
`permission rule '${rule}' is left out of the gate: a built-in rule denies the same calls (the shared memory's candidates and entries, the user configuration, paths.deny)`;
|
|
13
|
+
export const ruleDormant = (rule: string, key: string) =>
|
|
14
|
+
`permission rule '${rule}' is dormant: ${key} does not list its tool, the gate does not get it`;
|
|
15
|
+
export const invalidPermissionEntries = (count: number) =>
|
|
16
|
+
`${count} stored permission entr(ies) are not rules and were ignored`;
|
|
17
|
+
export const NO_SESSION_RULES = "the host keeps no session rules: the gate decides each call from the mode alone";
|
|
18
|
+
export const voiceReplyUnreadable = (key: string, reason: string) =>
|
|
19
|
+
`${key} could not be read (${reason}): the answer is not read aloud this turn`;
|
|
20
|
+
export const voiceReplyNoSpeakTool = (key: string, tool: string) =>
|
|
21
|
+
`${key} is on but the host registers no '${tool}': the answer is not read aloud ` +
|
|
22
|
+
"(start orkeon-code with ORKEON_CODE_AUDIO_DIR and ORKEON_CODE_VOICE=1)";
|
|
23
|
+
|
|
24
|
+
// dev-step.ts: the start of a dev step
|
|
25
|
+
export const stepRulesNotInGate = (command: string) =>
|
|
26
|
+
`warning: the host keeps no session rules: /${command}'s rule sets are not in the host's gate, the crew's callback alone checks them.`;
|
|
27
|
+
export const sessionRuleLeftOut = (rule: string, command: string) =>
|
|
28
|
+
`warning: the session's rule '${rule}' is left out of the gate during /${command}: the step denies the same calls.`;
|
|
29
|
+
export const modeUnreadableRefusal = (command: string, writes: string) =>
|
|
30
|
+
`✗ refused: the session mode could not be read, and /${command} ${writes}: run it again`;
|
|
31
|
+
export const modeUnknownRefusal = (mode: string, command: string, writes: string) =>
|
|
32
|
+
`✗ refused: the session mode ${mode} is not one Orkeon Code knows, and /${command} ${writes}: /mode default, then run it again`;
|
|
33
|
+
export const modeReadOnlyRefusal = (mode: string, command: string, writes: string) =>
|
|
34
|
+
`✗ refused: the session mode ${mode} is read-only, and /${command} ${writes}: /mode default, then run it again`;
|
|
35
|
+
export const batchNotRecorded = (reason: string) =>
|
|
36
|
+
`warning: the batch in progress could not be recorded (${reason}): a compaction will write no state file for it.`;
|
|
37
|
+
|
|
38
|
+
// args.ts: /debug-tool-call
|
|
39
|
+
export const DEBUG_TOOL_CALL_USAGE = "usage: /debug-tool-call <tool_name> [{\"arg\": \"value\"}]";
|
|
40
|
+
export const notAToolName = (tool: string) => `'${tool}' is not a tool name (expected snake_case, e.g. file_read)`;
|
|
41
|
+
export const argumentsNotJson = (reason: string, payload: string) =>
|
|
42
|
+
`arguments are not valid JSON (${reason}): ${payload}`;
|
|
43
|
+
export const argumentsNotObject = (got: string) => `arguments must be a JSON OBJECT, got ${got}`;
|
|
44
|
+
|
|
45
|
+
// Shared by several command groups
|
|
46
|
+
export const failedLine = (reason: string) => `✗ ${reason}`;
|
|
47
|
+
export const unknownOption = (word: string) => `unknown option ${word}`;
|
|
48
|
+
export const markedDefault = (value: number | string) => `${value} (default)`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The text the project commands show the user (ADR 0026): /debug-tool-call.
|
|
2
|
+
|
|
3
|
+
export const toolCatalogue = (names: readonly string[]): string =>
|
|
4
|
+
`${names.length} registered tools:\n${names.join(", ")}\n` +
|
|
5
|
+
"usage: /debug-tool-call <tool_name> [{\"arg\": \"value\"}]\n" +
|
|
6
|
+
"(argument schemas are not exposed to script-land — # TBD_tool_schema)";
|
|
7
|
+
export const noRegisteredToolSeeList = (tool: string): string =>
|
|
8
|
+
`no registered tool '${tool}'. /debug-tool-call list shows what this host has.`;
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
} from "../../../shared/application/ports.ts";
|
|
9
9
|
import { MEMORY_CATEGORIES } from "../../../shared/domain/agent-policy/memory-categories.ts";
|
|
10
10
|
import type { CommandView } from "../view.ts";
|
|
11
|
+
import { EMPTY_SESSION_BUFFER, exported } from "./messages.ts";
|
|
11
12
|
|
|
12
13
|
export interface ExportInputs {
|
|
13
14
|
messages: ReadonlyArray<{ role?: unknown; content?: unknown }>;
|
|
@@ -54,7 +55,7 @@ export function renderSessionExport(i: ExportInputs): string {
|
|
|
54
55
|
|
|
55
56
|
out.push("## Conversation", "");
|
|
56
57
|
if (i.messages.length === 0) {
|
|
57
|
-
out.push(
|
|
58
|
+
out.push(EMPTY_SESSION_BUFFER, "");
|
|
58
59
|
} else {
|
|
59
60
|
for (const m of i.messages) {
|
|
60
61
|
out.push(`**${String(m.role ?? "?")}:** ${String(m.content ?? "")}`, "");
|
|
@@ -100,5 +101,5 @@ export async function runExport(tokens: readonly string[], deps: ExportDeps): Pr
|
|
|
100
101
|
|
|
101
102
|
await deps.files.write(path, md);
|
|
102
103
|
const memoryCount = Object.values(memory).reduce((n, v) => n + v.length, 0);
|
|
103
|
-
return { text:
|
|
104
|
+
return { text: exported(path, messages.length, memoryCount) };
|
|
104
105
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// The text the session commands show the user (ADR 0026): /resume, /tasks, /export, /copy, /rename and /rewind.
|
|
2
|
+
|
|
3
|
+
// /resume
|
|
4
|
+
|
|
5
|
+
/** What the listing says under the table. */
|
|
6
|
+
export const HOW_TO_RESUME =
|
|
7
|
+
"`/resume <number or id>` brings one back in place of this session, which is archived; " +
|
|
8
|
+
"`orkeon-code --resume <id>` does the same at start, `orkeon-code --continue` brings back the session you quit.";
|
|
9
|
+
|
|
10
|
+
/** What a host that does not persist the session leaves `/resume <n|id>` with. */
|
|
11
|
+
export const NO_SWITCH =
|
|
12
|
+
"cannot switch in place: the REPL runs without a persisted session (Orkeon:Cli:Session:Persist off); " +
|
|
13
|
+
"quit (/exit), then start `orkeon-code --resume <id>`.";
|
|
14
|
+
|
|
15
|
+
export const ambiguousSession = (choice: string): string =>
|
|
16
|
+
`more than one saved session starts with '${choice}': give more of its id.`;
|
|
17
|
+
export const noSavedSession = (choice: string): string => `no saved session '${choice}' (/resume lists them).`;
|
|
18
|
+
export const sessionLoaded = (id: string, count: number, archive: string): string =>
|
|
19
|
+
`loaded ${id} (${count} message(s)): the next turn continues it. ` +
|
|
20
|
+
`The session you left is archived at ${archive}; the next start of orkeon-code moves it to the history.`;
|
|
21
|
+
export const loadFailed = (id: string, reason: string, archive: string): string =>
|
|
22
|
+
`could not load ${id}: ${reason}. This session is unchanged${archive ? `; its archive ${archive} stays` : ""}.`;
|
|
23
|
+
export const historyNotMountedToLoad = (root: string): string =>
|
|
24
|
+
`no saved session to load: ${root} is not mounted (start the REPL with orkeon-code).`;
|
|
25
|
+
export const NOTHING_TO_LOAD = "no saved session to load: this project has none yet.";
|
|
26
|
+
export const historyNotMountedToList = (root: string): string =>
|
|
27
|
+
`no saved sessions to list: ${root} is not mounted (start the REPL with orkeon-code).`;
|
|
28
|
+
export const NO_SAVED_SESSIONS = "no saved session for this project yet: the next start of orkeon-code keeps this one.";
|
|
29
|
+
export const savedSessionsHeader = (count: number, more: number): string =>
|
|
30
|
+
`${count} saved session(s) of this project, newest first${more > 0 ? ` (${more} more: orkeon-code --resume lists them all)` : ""}.`;
|
|
31
|
+
export const EMPTY_BUFFER = "this session's buffer is empty.";
|
|
32
|
+
export const bufferTail = (count: number, tail: readonly string[]): string =>
|
|
33
|
+
`this session: ${count} message(s) in the buffer. Last turns:\n${tail.join("\n")}`;
|
|
34
|
+
|
|
35
|
+
// /tasks
|
|
36
|
+
|
|
37
|
+
export const TASKS_USAGE =
|
|
38
|
+
"usage: /tasks [list | add <subject> | done <n> | clear | show <id> | stop <id> | send <id> <message> | repair <id> [note]]";
|
|
39
|
+
|
|
40
|
+
/** What to do with an approval listed: the answers the main prompt takes. */
|
|
41
|
+
export const ANSWER_TEXT = "answer it from the main prompt: [y] once / [s] session / [n] no";
|
|
42
|
+
|
|
43
|
+
export const waitsForApproval = (task: string, tool: string, input: string): string =>
|
|
44
|
+
`${task}: waits for approval of ${tool} · ${input}`;
|
|
45
|
+
export const NO_TASKS = "no tasks and no agent instances. usage: /tasks add <subject>";
|
|
46
|
+
export const WAITING_FOR_APPROVAL = "waiting for approval:";
|
|
47
|
+
export const INSTANCE_VERBS = "/tasks show <id> · stop <id> · send <id> <message> · repair <id> [note]";
|
|
48
|
+
export const requestAlreadyWaiting = (ref: string, id: string): string =>
|
|
49
|
+
`${ref}: a request the crew has not read yet is already waiting; /tasks show ${id} once it has`;
|
|
50
|
+
export const repairByNewRun = (ref: string, charter: string): string =>
|
|
51
|
+
`${ref} has ended: a new run of ${charter} answers, with the previous report in its brief (not its live context).`;
|
|
52
|
+
export const TASKS_ADD_USAGE = "usage: /tasks add <subject>";
|
|
53
|
+
export const taskAdded = (n: number, subject: string): string => `task #${n} added: ${subject}`;
|
|
54
|
+
export const tasksDoneUsage = (max: number): string => `usage: /tasks done <1-${max}>`;
|
|
55
|
+
export const taskDone = (n: number, subject: string): string => `task #${n} done: ${subject}`;
|
|
56
|
+
export const tasksCleared = (count: number): string => `task list cleared (${count} removed).`;
|
|
57
|
+
export const stopAsked = (ref: string): string =>
|
|
58
|
+
`stop asked for ${ref}: the crew ends it at its next look (about a second); /tasks shows it`;
|
|
59
|
+
export const TASKS_SEND_USAGE = "usage: /tasks send <id> <message>";
|
|
60
|
+
export const repairWhileRunning = (ref: string, id: string): string =>
|
|
61
|
+
`${ref} is running: a repair is for an ended instance (/tasks stop ${id} first)`;
|
|
62
|
+
|
|
63
|
+
// /export
|
|
64
|
+
|
|
65
|
+
export const EMPTY_SESSION_BUFFER = "_(the session buffer is empty)_";
|
|
66
|
+
export const exported = (path: string, messages: number, memory: number): string =>
|
|
67
|
+
`exported → ${path} (${messages} message(s), ${memory} memory entr(y/ies), cost included)`;
|
|
68
|
+
|
|
69
|
+
// /copy
|
|
70
|
+
|
|
71
|
+
export const LAST_OUTPUT_HEADER = "── last assistant output (full) ──";
|
|
72
|
+
export const alsoInFile = (path: string): string => ` It is also in ${path} (mounted volume).`;
|
|
73
|
+
export const copyNotWritten = (path: string, reason: string): string => `/copy could not write ${path}: ${reason}`;
|
|
74
|
+
export const selectToCopy = (written: string): string =>
|
|
75
|
+
`(select in your terminal to copy — headless REPL has no OS clipboard)${written}`;
|
|
76
|
+
export const NO_ASSISTANT_OUTPUT = "no assistant output in the buffer yet.";
|
|
77
|
+
|
|
78
|
+
// /rename
|
|
79
|
+
|
|
80
|
+
export const RENAME_USAGE = "usage: /rename <title>";
|
|
81
|
+
export const renamed = (title: string): string => "renamed session to: " + title;
|
|
82
|
+
|
|
83
|
+
// /rewind
|
|
84
|
+
|
|
85
|
+
export const NOTHING_TO_REWIND = "nothing to rewind — no user turn in the buffer.";
|
|
86
|
+
export const rewound = (dropped: number, kept: number): string =>
|
|
87
|
+
`rewound 1 exchange (${dropped} message(s) dropped, ${kept} kept).`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// The text /tasks hands the model (ADR 0026): the note a repair's brief carries.
|
|
2
|
+
|
|
3
|
+
/** The note a repair carries when the operator gives none. */
|
|
4
|
+
export const DEFAULT_REPAIR_NOTE = "Check your previous report against the brief again and correct what is wrong or missing.";
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
import type { Clock, Files, SessionMessages, SessionStore, SessionSwitch } from "../../../shared/application/ports.ts";
|
|
12
12
|
import { LOADED_SESSION_STATE_KEY } from "../../../shared/domain/session-keys.ts";
|
|
13
13
|
import type { CommandView } from "../view.ts";
|
|
14
|
+
import {
|
|
15
|
+
EMPTY_BUFFER, HOW_TO_RESUME, NOTHING_TO_LOAD, NO_SAVED_SESSIONS, NO_SWITCH, ambiguousSession, bufferTail,
|
|
16
|
+
historyNotMountedToList, historyNotMountedToLoad, loadFailed, noSavedSession, savedSessionsHeader, sessionLoaded,
|
|
17
|
+
} from "./messages.ts";
|
|
14
18
|
|
|
15
19
|
/** Where the launcher mounts the project's saved sessions. */
|
|
16
20
|
export const HISTORY_ROOT = "/session-history";
|
|
@@ -33,16 +37,6 @@ export type SessionRow = { id: string; saved: string; title: string; messages: s
|
|
|
33
37
|
/** `<yyyymmddTHHMMSSZ>-<id>.json`, as the launcher names a saved session. */
|
|
34
38
|
const SAVED_NAME = /^(\d{8}T\d{6}Z)-(.+)\.json$/;
|
|
35
39
|
|
|
36
|
-
/** What the listing says under the table. */
|
|
37
|
-
export const HOW_TO_RESUME =
|
|
38
|
-
"`/resume <number or id>` brings one back in place of this session, which is archived; " +
|
|
39
|
-
"`orkeon-code --resume <id>` does the same at start, `orkeon-code --continue` brings back the session you quit.";
|
|
40
|
-
|
|
41
|
-
/** What a host that does not persist the session leaves `/resume <n|id>` with. */
|
|
42
|
-
export const NO_SWITCH =
|
|
43
|
-
"cannot switch in place: the REPL runs without a persisted session (Orkeon:Cli:Session:Persist off); " +
|
|
44
|
-
"quit (/exit), then start `orkeon-code --resume <id>`.";
|
|
45
|
-
|
|
46
40
|
/** `20261024T101500Z` as `2026-10-24 10:15 UTC`. */
|
|
47
41
|
function savedAt(stamp: string): string {
|
|
48
42
|
return `${stamp.slice(0, 4)}-${stamp.slice(4, 6)}-${stamp.slice(6, 8)} ${stamp.slice(9, 11)}:${stamp.slice(11, 13)} UTC`;
|
|
@@ -92,8 +86,8 @@ export function chooseSaved(names: readonly string[], choice: string): { name: s
|
|
|
92
86
|
}
|
|
93
87
|
const matches = names.filter((name) => idOf(name).startsWith(choice));
|
|
94
88
|
if (matches.length === 1) return { name: matches[0] };
|
|
95
|
-
if (matches.length > 1) return { refused:
|
|
96
|
-
return { refused:
|
|
89
|
+
if (matches.length > 1) return { refused: ambiguousSession(choice) };
|
|
90
|
+
return { refused: noSavedSession(choice) };
|
|
97
91
|
}
|
|
98
92
|
|
|
99
93
|
/** Load `name` in place: the session of now archived beside its own file first, then the swap. */
|
|
@@ -107,13 +101,10 @@ async function loadSaved(deps: ResumeDeps, name: string): Promise<CommandView> {
|
|
|
107
101
|
await deps.switch.save(archive);
|
|
108
102
|
const count = await deps.switch.load(`${HISTORY_ROOT}/${name}`);
|
|
109
103
|
await deps.session.writeState(LOADED_SESSION_STATE_KEY, name).catch(() => undefined);
|
|
110
|
-
return {
|
|
111
|
-
text: `loaded ${id} (${count} message(s)): the next turn continues it. ` +
|
|
112
|
-
`The session you left is archived at ${archive}; the next start of orkeon-code moves it to the history.`,
|
|
113
|
-
};
|
|
104
|
+
return { text: sessionLoaded(id, count, archive) };
|
|
114
105
|
} catch (e: any) {
|
|
115
106
|
const reason = String(e?.message ?? e).split("\n")[0];
|
|
116
|
-
return { text:
|
|
107
|
+
return { text: loadFailed(id, reason, archive) };
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
110
|
|
|
@@ -123,8 +114,8 @@ export async function runResume(deps: ResumeDeps, choice?: string): Promise<Comm
|
|
|
123
114
|
const wanted = choice?.trim() ?? "";
|
|
124
115
|
|
|
125
116
|
if (wanted.length > 0) {
|
|
126
|
-
if (names === null) return { text:
|
|
127
|
-
if (names.length === 0) return { text:
|
|
117
|
+
if (names === null) return { text: historyNotMountedToLoad(HISTORY_ROOT) };
|
|
118
|
+
if (names.length === 0) return { text: NOTHING_TO_LOAD };
|
|
128
119
|
const chosen = chooseSaved(names, wanted);
|
|
129
120
|
return "refused" in chosen ? { text: chosen.refused } : loadSaved(deps, chosen.name);
|
|
130
121
|
}
|
|
@@ -132,9 +123,9 @@ export async function runResume(deps: ResumeDeps, choice?: string): Promise<Comm
|
|
|
132
123
|
const lines: string[] = [];
|
|
133
124
|
let table: SessionRow[] | undefined;
|
|
134
125
|
if (names === null) {
|
|
135
|
-
lines.push(
|
|
126
|
+
lines.push(historyNotMountedToList(HISTORY_ROOT));
|
|
136
127
|
} else if (names.length === 0) {
|
|
137
|
-
lines.push(
|
|
128
|
+
lines.push(NO_SAVED_SESSIONS);
|
|
138
129
|
} else {
|
|
139
130
|
const loadedFrom = await deps.session.readState(LOADED_SESSION_STATE_KEY).catch(() => null);
|
|
140
131
|
table = [];
|
|
@@ -144,7 +135,7 @@ export async function runResume(deps: ResumeDeps, choice?: string): Promise<Comm
|
|
|
144
135
|
}
|
|
145
136
|
const more = names.length - table.length;
|
|
146
137
|
lines.push(
|
|
147
|
-
|
|
138
|
+
savedSessionsHeader(names.length, more),
|
|
148
139
|
HOW_TO_RESUME,
|
|
149
140
|
);
|
|
150
141
|
}
|
|
@@ -154,7 +145,7 @@ export async function runResume(deps: ResumeDeps, choice?: string): Promise<Comm
|
|
|
154
145
|
const tail = messages.slice(-TAIL_TURNS)
|
|
155
146
|
.map((m) => ` ${m.role}: ${m.content.slice(0, 200)}${m.content.length > 200 ? "…" : ""}`);
|
|
156
147
|
const text = messages.length === 0
|
|
157
|
-
?
|
|
158
|
-
:
|
|
148
|
+
? EMPTY_BUFFER
|
|
149
|
+
: bufferTail(messages.length, tail);
|
|
159
150
|
return { lines, table, text };
|
|
160
151
|
}
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
import type { InstanceRequest, Located, RunSnapshot } from "../../../shared/domain/agents/instances.ts";
|
|
19
19
|
import { storedEffort } from "../effort.ts";
|
|
20
20
|
import type { CommandView } from "../view.ts";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
import {
|
|
22
|
+
INSTANCE_VERBS, NO_TASKS, TASKS_ADD_USAGE, TASKS_SEND_USAGE, TASKS_USAGE, WAITING_FOR_APPROVAL, ANSWER_TEXT,
|
|
23
|
+
repairByNewRun, repairWhileRunning, requestAlreadyWaiting, stopAsked, taskAdded, taskDone, tasksCleared,
|
|
24
|
+
tasksDoneUsage, waitsForApproval,
|
|
25
|
+
} from "./messages.ts";
|
|
26
|
+
import { DEFAULT_REPAIR_NOTE } from "./prompts.ts";
|
|
27
27
|
|
|
28
28
|
/** The crew that repairs an instance by a new run. */
|
|
29
29
|
export const REPAIR_CREW = "agent-run";
|
|
@@ -35,9 +35,6 @@ export interface TasksDeps {
|
|
|
35
35
|
approvals: PendingApprovals;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/** What to do with an approval listed: the answers the main prompt takes. */
|
|
39
|
-
export const ANSWER_TEXT = "answer it from the main prompt: [y] once / [s] session / [n] no";
|
|
40
|
-
|
|
41
38
|
/** What the entry point shows, and the crew it launches for a repair. */
|
|
42
39
|
export interface TasksOutcome {
|
|
43
40
|
view: CommandView;
|
|
@@ -60,7 +57,7 @@ async function readSnapshots({ session, clock }: TasksDeps): Promise<RunSnapshot
|
|
|
60
57
|
|
|
61
58
|
/** One approval as the list shows it: the task's ticket and command (the status line's words), the tool, the input. */
|
|
62
59
|
const approvalLine = (a: PendingApproval): string =>
|
|
63
|
-
|
|
60
|
+
waitsForApproval(a.taskId === null ? "no task" : `${a.taskId} ${a.command ?? "?"}`, a.tool, a.input);
|
|
64
61
|
|
|
65
62
|
/** The approvals waiting, as lines; a host whose read fails shows none. */
|
|
66
63
|
function approvalLines({ approvals }: TasksDeps): string[] {
|
|
@@ -76,17 +73,17 @@ async function list(tasks: Task[], deps: TasksDeps): Promise<TasksOutcome> {
|
|
|
76
73
|
const waiting = approvalLines(deps);
|
|
77
74
|
const taskLines = tasks.map((t, i) => `#${i + 1} [${t.done ? "done" : "open"}] ${t.subject}`);
|
|
78
75
|
if (rows.length === 0 && waiting.length === 0) {
|
|
79
|
-
if (tasks.length === 0) return { view: { text:
|
|
76
|
+
if (tasks.length === 0) return { view: { text: NO_TASKS } };
|
|
80
77
|
return { view: { table: tasks.map((t, i) => ({ n: i + 1, status: t.done ? "done" : "open", subject: t.subject })) } };
|
|
81
78
|
}
|
|
82
79
|
const lines = [tasks.length === 0 ? "tasks: none" : "tasks:", ...taskLines];
|
|
83
|
-
if (waiting.length > 0) lines.push(
|
|
80
|
+
if (waiting.length > 0) lines.push(WAITING_FOR_APPROVAL, ...waiting);
|
|
84
81
|
if (rows.length === 0) return { view: { lines, text: ANSWER_TEXT } };
|
|
85
82
|
return {
|
|
86
83
|
view: {
|
|
87
84
|
lines: [...lines, "agent instances:"],
|
|
88
85
|
table: rows,
|
|
89
|
-
text:
|
|
86
|
+
text: INSTANCE_VERBS,
|
|
90
87
|
},
|
|
91
88
|
};
|
|
92
89
|
}
|
|
@@ -103,7 +100,7 @@ async function locate(deps: TasksDeps, id: string | undefined): Promise<{ ok: tr
|
|
|
103
100
|
async function leaveRequest(deps: TasksDeps, l: Located, request: InstanceRequest): Promise<string | null> {
|
|
104
101
|
const key = requestKey(l.snapshot.crew, l.record.id);
|
|
105
102
|
if (parseRequest(await deps.session.readState(key).catch(() => null))?.run === request.run) {
|
|
106
|
-
return
|
|
103
|
+
return requestAlreadyWaiting(ref(l), l.record.id);
|
|
107
104
|
}
|
|
108
105
|
await deps.session.writeState(key, JSON.stringify(request));
|
|
109
106
|
return null;
|
|
@@ -112,7 +109,7 @@ async function leaveRequest(deps: TasksDeps, l: Located, request: InstanceReques
|
|
|
112
109
|
async function repair(deps: TasksDeps, l: Located, message: string): Promise<TasksOutcome> {
|
|
113
110
|
return {
|
|
114
111
|
view: {
|
|
115
|
-
lines: [
|
|
112
|
+
lines: [repairByNewRun(ref(l), l.record.charter)],
|
|
116
113
|
},
|
|
117
114
|
launch: {
|
|
118
115
|
crew: REPAIR_CREW,
|
|
@@ -134,21 +131,21 @@ export async function runTasks(tokens: readonly string[], deps: TasksDeps): Prom
|
|
|
134
131
|
return list(tasks, deps);
|
|
135
132
|
case "add": {
|
|
136
133
|
const subject = rest.join(" ");
|
|
137
|
-
if (!subject) return { view: { text:
|
|
134
|
+
if (!subject) return { view: { text: TASKS_ADD_USAGE } };
|
|
138
135
|
tasks.push({ subject, done: false });
|
|
139
136
|
await writeJson(deps.session, TASKS_STATE_KEY, tasks);
|
|
140
|
-
return { view: { text:
|
|
137
|
+
return { view: { text: taskAdded(tasks.length, subject) } };
|
|
141
138
|
}
|
|
142
139
|
case "done": {
|
|
143
140
|
const n = Number(rest[0]);
|
|
144
|
-
if (!Number.isInteger(n) || n < 1 || n > tasks.length) return { view: { text:
|
|
141
|
+
if (!Number.isInteger(n) || n < 1 || n > tasks.length) return { view: { text: tasksDoneUsage(tasks.length || 1) } };
|
|
145
142
|
tasks[n - 1].done = true;
|
|
146
143
|
await writeJson(deps.session, TASKS_STATE_KEY, tasks);
|
|
147
|
-
return { view: { text:
|
|
144
|
+
return { view: { text: taskDone(n, tasks[n - 1].subject) } };
|
|
148
145
|
}
|
|
149
146
|
case "clear":
|
|
150
147
|
await writeJson(deps.session, TASKS_STATE_KEY, []);
|
|
151
|
-
return { view: { text:
|
|
148
|
+
return { view: { text: tasksCleared(tasks.length) } };
|
|
152
149
|
case "show": {
|
|
153
150
|
const l = await locate(deps, rest[0]);
|
|
154
151
|
return l.ok ? { view: { lines: describeInstance(l.found) } } : { view: l.view };
|
|
@@ -159,13 +156,13 @@ export async function runTasks(tokens: readonly string[], deps: TasksDeps): Prom
|
|
|
159
156
|
const verdict = stopVerdict(l.found);
|
|
160
157
|
if (!verdict.ok) return { view: { text: verdict.text } };
|
|
161
158
|
const waiting = await leaveRequest(deps, l.found, { action: "stop", run: l.found.snapshot.startedAt, at: deps.clock().toISOString() });
|
|
162
|
-
return { view: { text: waiting ??
|
|
159
|
+
return { view: { text: waiting ?? stopAsked(ref(l.found)) } };
|
|
163
160
|
}
|
|
164
161
|
case "send": {
|
|
165
162
|
const l = await locate(deps, rest[0]);
|
|
166
163
|
if (!l.ok) return { view: l.view };
|
|
167
164
|
const message = rest.slice(1).join(" ").trim();
|
|
168
|
-
if (!message) return { view: { text:
|
|
165
|
+
if (!message) return { view: { text: TASKS_SEND_USAGE } };
|
|
169
166
|
const verdict = sendVerdict(l.found);
|
|
170
167
|
if (verdict.kind === "refused") return { view: { text: verdict.text } };
|
|
171
168
|
return repair(deps, l.found, message);
|
|
@@ -174,7 +171,7 @@ export async function runTasks(tokens: readonly string[], deps: TasksDeps): Prom
|
|
|
174
171
|
const l = await locate(deps, rest[0]);
|
|
175
172
|
if (!l.ok) return { view: l.view };
|
|
176
173
|
if (l.found.record.state === "running") {
|
|
177
|
-
return { view: { text:
|
|
174
|
+
return { view: { text: repairWhileRunning(ref(l.found), l.found.record.id) } };
|
|
178
175
|
}
|
|
179
176
|
return repair(deps, l.found, rest.slice(1).join(" ").trim() || DEFAULT_REPAIR_NOTE);
|
|
180
177
|
}
|
|
@@ -8,6 +8,10 @@ import { CONFIG_FILE_PATH } from "../../../shared/application/config-store.ts";
|
|
|
8
8
|
import type { ConfigStore } from "../../../shared/application/config-store.ts";
|
|
9
9
|
import type { Logger, SessionMetadata, Telemetry } from "../../../shared/application/ports.ts";
|
|
10
10
|
import { judgeModelChoice } from "../../../shared/domain/model-catalog.ts";
|
|
11
|
+
import {
|
|
12
|
+
ADVISOR_DISABLED, ADVISOR_UNSET, ADVISOR_USAGE, advisorModelLine, advisorSet, declaredModelsLine, refusingToOverwrite,
|
|
13
|
+
refusingUnparsed,
|
|
14
|
+
} from "./messages.ts";
|
|
11
15
|
|
|
12
16
|
const ADVISOR_KEY = "advisor.model";
|
|
13
17
|
|
|
@@ -37,22 +41,19 @@ export async function runAdvisorCommand(tokens: readonly string[], deps: Advisor
|
|
|
37
41
|
const entry = await config.readValue(ADVISOR_KEY);
|
|
38
42
|
const models = await declaredModels(telemetry);
|
|
39
43
|
const lines = [
|
|
40
|
-
entry.value
|
|
41
|
-
? `advisor model: ${entry.value} [${entry.source}]`
|
|
42
|
-
: "advisor model: (unset) — /advisor review would ask the SESSION's own model, " +
|
|
43
|
-
"which makes it a self-review and worth much less.",
|
|
44
|
+
entry.value ? advisorModelLine(entry.value, entry.source) : ADVISOR_UNSET,
|
|
44
45
|
];
|
|
45
|
-
if (models.length > 0) lines.push(
|
|
46
|
-
lines.push(
|
|
46
|
+
if (models.length > 0) lines.push(declaredModelsLine(models));
|
|
47
|
+
lines.push(ADVISOR_USAGE);
|
|
47
48
|
return { lines };
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
if (first === "off" || first === "disable" || first === "none") {
|
|
51
52
|
const { map, malformed } = await config.readFile();
|
|
52
|
-
if (malformed) return { lines: [
|
|
53
|
+
if (malformed) return { lines: [refusingUnparsed(CONFIG_FILE_PATH)] };
|
|
53
54
|
delete map[ADVISOR_KEY];
|
|
54
55
|
await config.writeFile(map);
|
|
55
|
-
return { lines: [
|
|
56
|
+
return { lines: [ADVISOR_DISABLED] };
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
// Anything else is the model name.
|
|
@@ -63,18 +64,12 @@ export async function runAdvisorCommand(tokens: readonly string[], deps: Advisor
|
|
|
63
64
|
const { map, malformed } = await config.readFile();
|
|
64
65
|
if (malformed) {
|
|
65
66
|
return {
|
|
66
|
-
lines: [
|
|
67
|
-
`refusing to write: ${CONFIG_FILE_PATH} exists but could not be parsed, and overwriting ` +
|
|
68
|
-
"it would discard whatever it holds. Fix or delete it, then retry.",
|
|
69
|
-
],
|
|
67
|
+
lines: [refusingToOverwrite(CONFIG_FILE_PATH)],
|
|
70
68
|
};
|
|
71
69
|
}
|
|
72
70
|
map[ADVISOR_KEY] = requested;
|
|
73
71
|
await config.writeFile(map);
|
|
74
72
|
return {
|
|
75
|
-
lines: [
|
|
76
|
-
`advisor model set to '${requested}' — persisted in ${CONFIG_FILE_PATH}.` +
|
|
77
|
-
(verdict.warning ? "\n⚠ NOT among the models this host declares; see the log." : ""),
|
|
78
|
-
],
|
|
73
|
+
lines: [advisorSet(requested, CONFIG_FILE_PATH, Boolean(verdict.warning))],
|
|
79
74
|
};
|
|
80
75
|
}
|
|
@@ -27,16 +27,14 @@ import type { SavedAgent } from "../../../shared/domain/agent-registry.ts";
|
|
|
27
27
|
import { builtInCharterRows } from "../../../shared/domain/agents/built-in-charters.ts";
|
|
28
28
|
import type { CommandView } from "../view.ts";
|
|
29
29
|
import { WORKSPACE } from "../../../shared/domain/vfs.ts";
|
|
30
|
+
import {
|
|
31
|
+
AGENTS_USAGE, SAVED_AGENTS_NOTE, agentRemoved, agentSaved, agentsFileLine, builtInCrewNotRemovable,
|
|
32
|
+
builtInCrewNotSaved, droppedAgents, fileLeftUntouched, noSavedAgent, noSavedAgentListHint, refusingToOverwrite,
|
|
33
|
+
refusingUnparsed, savedAgentShown, withAgentsUsage,
|
|
34
|
+
} from "./messages.ts";
|
|
30
35
|
|
|
31
36
|
export const AGENTS_FILE_PATH = `${WORKSPACE}/.orkeon/agents.json`;
|
|
32
37
|
|
|
33
|
-
export const AGENTS_USAGE =
|
|
34
|
-
"usage: /agents [list] | add <name> <role> | <goal> | remove <name> | show <name>";
|
|
35
|
-
|
|
36
|
-
/** What the listing says of the saved agents, and of what runs instead. */
|
|
37
|
-
export const SAVED_AGENTS_NOTE =
|
|
38
|
-
"saved agents are storage only — no command runs one; the built-in charters run as children of /dev-spec, /dev-plan and /dev-batches (/tasks).";
|
|
39
|
-
|
|
40
38
|
export interface AgentsDeps {
|
|
41
39
|
files: Pick<Files, "read" | "write">;
|
|
42
40
|
crews: Pick<CrewHost, "listCrews">;
|
|
@@ -71,11 +69,9 @@ export async function runAgents(tokens: string[], deps: AgentsDeps): Promise<Com
|
|
|
71
69
|
switch (sub) {
|
|
72
70
|
case "list": {
|
|
73
71
|
const { agents, dropped, malformed } = await readRegistry(files);
|
|
74
|
-
const notes = [
|
|
75
|
-
if (dropped.length > 0)
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
if (malformed) notes.push(`⚠ ${AGENTS_FILE_PATH} could not be parsed; it is left untouched.`);
|
|
72
|
+
const notes = [agentsFileLine(AGENTS_FILE_PATH)];
|
|
73
|
+
if (dropped.length > 0) notes.push(droppedAgents(dropped));
|
|
74
|
+
if (malformed) notes.push(fileLeftUntouched(AGENTS_FILE_PATH));
|
|
79
75
|
notes.push(SAVED_AGENTS_NOTE);
|
|
80
76
|
return { table: [...describeAgentRows(crews, agents), ...builtInCharterRows()], text: notes.join("\n") };
|
|
81
77
|
}
|
|
@@ -85,15 +81,12 @@ export async function runAgents(tokens: string[], deps: AgentsDeps): Promise<Com
|
|
|
85
81
|
const { agents } = await readRegistry(files);
|
|
86
82
|
const found = agents.find((a) => a.name === name);
|
|
87
83
|
if (found) {
|
|
88
|
-
return {
|
|
89
|
-
text: `${found.name}\n role : ${found.role}\n goal : ${found.goal}\n` +
|
|
90
|
-
` tools: ${found.tools.length > 0 ? found.tools.join(", ") : "(inherited from the crew)"}`,
|
|
91
|
-
};
|
|
84
|
+
return { text: savedAgentShown(found.name, found.role, found.goal, found.tools) };
|
|
92
85
|
}
|
|
93
86
|
if (crews.some((c) => c.toLowerCase() === name)) {
|
|
94
|
-
return { text:
|
|
87
|
+
return { text: builtInCrewNotSaved(name) };
|
|
95
88
|
}
|
|
96
|
-
return { text:
|
|
89
|
+
return { text: noSavedAgentListHint(name) };
|
|
97
90
|
}
|
|
98
91
|
|
|
99
92
|
case "add":
|
|
@@ -109,18 +102,15 @@ export async function runAgents(tokens: string[], deps: AgentsDeps): Promise<Com
|
|
|
109
102
|
role: headTokens.join(" "),
|
|
110
103
|
goal: goalParts.join("|").trim(),
|
|
111
104
|
});
|
|
112
|
-
if (!verdict.ok) return { text:
|
|
105
|
+
if (!verdict.ok) return { text: withAgentsUsage(verdict.reason) };
|
|
113
106
|
|
|
114
107
|
const { agents, malformed } = await readRegistry(files);
|
|
115
108
|
if (malformed) {
|
|
116
|
-
return {
|
|
117
|
-
text: `refusing to write: ${AGENTS_FILE_PATH} exists but could not be parsed, and overwriting ` +
|
|
118
|
-
"it would discard whatever it holds. Fix or delete it, then retry.",
|
|
119
|
-
};
|
|
109
|
+
return { text: refusingToOverwrite(AGENTS_FILE_PATH) };
|
|
120
110
|
}
|
|
121
111
|
const { agents: next, replaced } = upsertAgent(agents, verdict.agent);
|
|
122
112
|
await writeRegistry(files, next);
|
|
123
|
-
return { text:
|
|
113
|
+
return { text: agentSaved(verdict.agent.name, replaced, AGENTS_FILE_PATH) };
|
|
124
114
|
}
|
|
125
115
|
|
|
126
116
|
case "remove":
|
|
@@ -128,17 +118,17 @@ export async function runAgents(tokens: string[], deps: AgentsDeps): Promise<Com
|
|
|
128
118
|
const name = String(tokens[1] ?? "").trim();
|
|
129
119
|
if (name.length === 0) return { text: AGENTS_USAGE };
|
|
130
120
|
const { agents, malformed } = await readRegistry(files);
|
|
131
|
-
if (malformed) return { text:
|
|
121
|
+
if (malformed) return { text: refusingUnparsed(AGENTS_FILE_PATH) };
|
|
132
122
|
const { agents: next, removed } = removeAgent(agents, name);
|
|
133
123
|
if (!removed) {
|
|
134
124
|
return {
|
|
135
125
|
text: crews.some((c) => c.toLowerCase() === name.toLowerCase())
|
|
136
|
-
?
|
|
137
|
-
:
|
|
126
|
+
? builtInCrewNotRemovable(name)
|
|
127
|
+
: noSavedAgent(name),
|
|
138
128
|
};
|
|
139
129
|
}
|
|
140
130
|
await writeRegistry(files, next);
|
|
141
|
-
return { text:
|
|
131
|
+
return { text: agentRemoved(name, AGENTS_FILE_PATH) };
|
|
142
132
|
}
|
|
143
133
|
|
|
144
134
|
default:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The options of a panel from plain values.
|
|
2
|
+
import type { ChoiceOption } from "../../../shared/application/ports.ts";
|
|
3
|
+
|
|
4
|
+
/** One option per value, the one in force marked: a model's name matches whatever its case. */
|
|
5
|
+
export function optionsOf(values: readonly string[], current: string): ChoiceOption[] {
|
|
6
|
+
const active = current.toLowerCase();
|
|
7
|
+
return values.map((value) => (value.toLowerCase() === active ? { value, current: true } : { value }));
|
|
8
|
+
}
|