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
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
import type { ActRequest, ChildRuntime, Llm, Logger } from "../../application/ports.ts";
|
|
11
11
|
import { createChildBoard, instanceKey, parseChildInput, runChildAct } from "../../application/agents/child-agent.ts";
|
|
12
12
|
import type { BoardDeps, ChildBoard } from "../../application/agents/child-agent.ts";
|
|
13
|
-
import {
|
|
13
|
+
import { agentLlm } from "./llm.ts";
|
|
14
14
|
import type { ToolCallbacks } from "../../application/dev/tool-callbacks.ts";
|
|
15
|
+
import { CHILD_INPUT_NOT_A_CALL } from "./messages.ts";
|
|
15
16
|
|
|
16
17
|
type ChildContext = Pick<AgentContext, "spawnBackground" | "memory" | "receive">;
|
|
17
18
|
type ChildCrew = Pick<Crew, "instances" | "stop">;
|
|
@@ -24,9 +25,8 @@ function isTimeout(error: unknown): boolean {
|
|
|
24
25
|
return /timeout/i.test(`${e?.name ?? ""} ${e?.code ?? ""} ${e?.message ?? error}`);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
/** The runtime's children for this run
|
|
28
|
-
export function createChildRuntime(ctx: ChildContext, crew: ChildCrew): ChildRuntime
|
|
29
|
-
if (typeof ctx.spawnBackground !== "function" || typeof crew?.instances !== "function") return null;
|
|
28
|
+
/** The runtime's children for this run. */
|
|
29
|
+
export function createChildRuntime(ctx: ChildContext, crew: ChildCrew): ChildRuntime {
|
|
30
30
|
return {
|
|
31
31
|
spawn(agent, input) {
|
|
32
32
|
ctx.spawnBackground(agent, input);
|
|
@@ -47,18 +47,20 @@ export function createChildRuntime(ctx: ChildContext, crew: ChildCrew): ChildRun
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* The body of a child agent: it acts on the call its input carries, under the callbacks of its
|
|
50
|
-
* step, and leaves the outcome in the crew's memory for the parent before it returns.
|
|
50
|
+
* step, and leaves the outcome in the crew's memory for the parent before it returns. `wrap` dresses the Llm
|
|
51
|
+
* the child acts on: what a request cannot carry from the parent, a callback (the pruning of the act's tool loop).
|
|
51
52
|
*/
|
|
52
53
|
export function childAgentBody(
|
|
53
54
|
callbacksFor: (ctx: AgentContext) => ToolCallbacks | undefined,
|
|
55
|
+
wrap: (llm: Llm, ctx: AgentContext) => Llm = (llm) => llm,
|
|
54
56
|
): (input: unknown, ctx: AgentContext) => Promise<string> {
|
|
55
57
|
return async (input, ctx) => {
|
|
56
58
|
const call = parseChildInput(input);
|
|
57
|
-
if (call === null) throw new Error(
|
|
59
|
+
if (call === null) throw new Error(CHILD_INPUT_NOT_A_CALL);
|
|
58
60
|
// The parent cannot match the runtime's rows by agent name (they hold the agent's id): say which instance this is.
|
|
59
61
|
if (typeof ctx.instanceId === "string") await ctx.memory.crew.store(instanceKey(call.key), ctx.instanceId).catch(() => undefined);
|
|
60
62
|
try {
|
|
61
|
-
const reply = await
|
|
63
|
+
const reply = await wrap(agentLlm(ctx, callbacksFor(ctx)), ctx).act(call.prompt, call.request);
|
|
62
64
|
await ctx.memory.crew.store(call.key, { ok: true, reply });
|
|
63
65
|
return reply;
|
|
64
66
|
} catch (error) {
|
|
@@ -76,10 +78,7 @@ export interface ChildActSpec {
|
|
|
76
78
|
builder: () => AgentBuilder;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
/**
|
|
80
|
-
* `base` with its act run by a background child (approach A2), or `base` itself, the act inline in
|
|
81
|
-
* the same body (approach A1), when the host has no background children.
|
|
82
|
-
*/
|
|
81
|
+
/** `base` with its act run by a background child (approach A2). */
|
|
83
82
|
export function withChildAct(
|
|
84
83
|
base: Llm,
|
|
85
84
|
ctx: ChildContext & Pick<AgentContext, "crew" | "spawn">,
|
|
@@ -88,10 +87,6 @@ export function withChildAct(
|
|
|
88
87
|
spec: ChildActSpec,
|
|
89
88
|
): Llm {
|
|
90
89
|
const runtime = createChildRuntime(ctx, crew);
|
|
91
|
-
if (runtime === null) {
|
|
92
|
-
deps.log.warn(`${spec.agent}: this host runs no background child; the act runs inline in the step's own agent`);
|
|
93
|
-
return base;
|
|
94
|
-
}
|
|
95
90
|
return {
|
|
96
91
|
...base,
|
|
97
92
|
act(prompt: string, request: ActRequest) {
|
|
@@ -100,7 +95,7 @@ export function withChildAct(
|
|
|
100
95
|
{ runtime, board: deps.board, clock: deps.clock, log: deps.log },
|
|
101
96
|
{
|
|
102
97
|
agent: spec.agent, charter: spec.charter, task: spec.task, prompt,
|
|
103
|
-
// The crew's effort when the request names none, as
|
|
98
|
+
// The crew's effort when the request names none, as the Llm adapter fills it for an inline act.
|
|
104
99
|
request: request.effort === undefined && deps.effort !== undefined ? { ...request, effort: deps.effort } : request,
|
|
105
100
|
},
|
|
106
101
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The Chooser port over the command context's `prompt`: a `select` panel, answered in detail.
|
|
2
|
+
import type { Chooser } from "../../application/ports.ts";
|
|
3
|
+
|
|
4
|
+
/** The part of the command context a choice goes through. */
|
|
5
|
+
export interface PromptConsole {
|
|
6
|
+
readonly interactive: boolean;
|
|
7
|
+
prompt(spec: {
|
|
8
|
+
type: "select";
|
|
9
|
+
message: string;
|
|
10
|
+
choices: readonly { value: string; label?: string; description?: string; current?: boolean }[];
|
|
11
|
+
control?: { label: string; values: readonly string[]; value?: string };
|
|
12
|
+
detailed: true;
|
|
13
|
+
}): Promise<{ readonly value: string; readonly control: string | null } | null>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createChooser(console: PromptConsole): Chooser {
|
|
17
|
+
return {
|
|
18
|
+
get interactive() {
|
|
19
|
+
return console.interactive;
|
|
20
|
+
},
|
|
21
|
+
choose: async ({ message, options, control }) => {
|
|
22
|
+
const answer = await console.prompt({
|
|
23
|
+
type: "select",
|
|
24
|
+
message,
|
|
25
|
+
choices: options,
|
|
26
|
+
...(control ? { control } : {}),
|
|
27
|
+
detailed: true,
|
|
28
|
+
});
|
|
29
|
+
return answer ? { value: answer.value, control: answer.control ?? null } : null;
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// DecisionModel adapter over the host's `system_one_decide` tool, which the host registers when its settings
|
|
2
|
+
// configure a decision provider (`Orkeon:Decision:Provider`, or a provider section alone), whichever it is. The
|
|
3
|
+
// tool is in no built-in list, so its member of the `tools` namespace is looked up by name: absent, there is no
|
|
4
|
+
// decision model. It answers `{ success, answers, model, error }`; a refusal of the model makes the call throw (the
|
|
5
|
+
// `tools` namespace throws on a failed tool), and both that and a `success: false` read as no answer.
|
|
6
|
+
|
|
7
|
+
import type { DecisionModel } from "../../application/ports.ts";
|
|
8
|
+
import { parseDecisionAnswers } from "../../domain/decision/questions.ts";
|
|
9
|
+
import { toolMemberName } from "./tool-catalogue.ts";
|
|
10
|
+
import { pick } from "./tool-results.ts";
|
|
11
|
+
|
|
12
|
+
/** The tool the host's decision model is asked through. */
|
|
13
|
+
export const DECIDE_TOOL = "system_one_decide";
|
|
14
|
+
|
|
15
|
+
export function createDecisionModel(tools: object): DecisionModel {
|
|
16
|
+
const member = (): unknown => (tools as Record<string, unknown> | undefined)?.[toolMemberName(DECIDE_TOOL)];
|
|
17
|
+
return {
|
|
18
|
+
available: () => typeof member() === "function",
|
|
19
|
+
ask: async (state, questions) => {
|
|
20
|
+
const decide = member();
|
|
21
|
+
if (typeof decide !== "function") return null;
|
|
22
|
+
try {
|
|
23
|
+
const reply = await (decide as (input: Record<string, unknown>) => unknown)({ state, questions });
|
|
24
|
+
if (pick(reply, "success", "Success") !== true) return null;
|
|
25
|
+
return parseDecisionAnswers(questions, pick(reply, "answers", "Answers"));
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -14,13 +14,15 @@ import { stepPrecedents } from "../../application/dev/step-precedents.ts";
|
|
|
14
14
|
import { harvestAfterGaps } from "../../application/shared-memory/harvest-after-gaps.ts";
|
|
15
15
|
import { memoryDirOf } from "../../application/shared-memory/memory-settings.ts";
|
|
16
16
|
import { briefToRoot, mapStrings } from "../../domain/dev/path-rebase.ts";
|
|
17
|
+
import { toVirtual } from "../../domain/host-paths.ts";
|
|
18
|
+
import type { HostSource } from "../../application/host-context.ts";
|
|
17
19
|
import { parseSessionRules } from "../../domain/git/pull-request.ts";
|
|
18
20
|
import type { DevImplementDeps } from "../../../crews/dev-implement/application/run-dev-implement.ts";
|
|
19
21
|
import type { DevVerifyDeps } from "../../../crews/dev-verify/application/run-dev-verify.ts";
|
|
20
22
|
import { reportingWrites } from "../../../crews/dev-implement/application/report-writes.ts";
|
|
21
23
|
import { AUDITOR_CHARTER } from "../../../crews/dev-verify/domain/auditor-charter.ts";
|
|
22
24
|
import { charterCatalogue } from "../../domain/agents/charter.ts";
|
|
23
|
-
import {
|
|
25
|
+
import { agentLlm } from "./llm.ts";
|
|
24
26
|
import { memoryReadTools, memoryRecallTools } from "./memory-tools.ts";
|
|
25
27
|
import type { MemoryToolPorts } from "./memory-tools.ts";
|
|
26
28
|
import { RUN_VALIDATION, runBuildTool, runTestsTool, runValidationTool, scriptToolSlot } from "./script-tools.ts";
|
|
@@ -32,14 +34,15 @@ import type { ToolCallbacks } from "../../application/dev/tool-callbacks.ts";
|
|
|
32
34
|
import { createSpend, spendGuard } from "../../application/dev/spend.ts";
|
|
33
35
|
import type { Spend } from "../../application/dev/spend.ts";
|
|
34
36
|
import {
|
|
35
|
-
orkeonClock, orkeonConfigStore, orkeonCostIndex, orkeonFiles,
|
|
36
|
-
orkeonSharedMemory, orkeonShell, orkeonShellJobs,
|
|
37
|
+
orkeonClock, orkeonConfigStore, orkeonCostIndex, orkeonFiles, orkeonHostContext, orkeonMemoryToolPorts,
|
|
38
|
+
orkeonPrunedLlm, orkeonPullRequestOpener, orkeonSharedMemory, orkeonShell, orkeonShellJobs,
|
|
37
39
|
} from "./wiring.ts";
|
|
38
40
|
|
|
39
|
-
/** What an agent body hands its deps: its own tools, model and log. */
|
|
41
|
+
/** What an agent body hands its deps: its own tools, model, file-system section and log. */
|
|
40
42
|
export interface BodyContext {
|
|
41
43
|
tools: OrkeonTools;
|
|
42
44
|
llm: Pick<LlmFacade, "act" | "complete" | "extract" | "chat"> & Partial<Pick<LlmFacade, "permissionGate">>;
|
|
45
|
+
fileSystem: Pick<AgentFileSystem, "prompt">;
|
|
43
46
|
log: Logger;
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -89,10 +92,13 @@ export function batchAgentParts(builder: ToolBuilderFactory, opts: { root: strin
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
/** git's top as an agent under `root` sees it: the raw output, never mapped back to `/workspace`, so that a
|
|
92
|
-
* top other than the root shows (a parallel /dev-batches' probe, L8P-D11)
|
|
93
|
-
|
|
95
|
+
* top other than the root shows (a parallel /dev-batches' probe, L8P-D11); a top git spells as the disk does (git
|
|
96
|
+
* for Windows prints `C:/...`, which the runtime's own rewrite misses) comes back to the VFS. A refused call throws. */
|
|
97
|
+
export async function gitTopUnder(
|
|
98
|
+
tools: Pick<OrkeonTools, "shellCommand">, root: string, host: HostSource = orkeonHostContext,
|
|
99
|
+
): Promise<{ exitCode: number; top: string }> {
|
|
94
100
|
const r = await tools.shellCommand({ command: "git rev-parse --show-toplevel", working_directory: root });
|
|
95
|
-
return { exitCode: shCode(r), top: shOut(r).trim() };
|
|
101
|
+
return { exitCode: shCode(r), top: toVirtual(shOut(r).trim(), (await host()).layout) };
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
interface DevOptions {
|
|
@@ -106,7 +112,7 @@ interface DevOptions {
|
|
|
106
112
|
spend?: Spend;
|
|
107
113
|
}
|
|
108
114
|
|
|
109
|
-
function portsOf(ctx: BodyContext, root: string | undefined) {
|
|
115
|
+
function portsOf(ctx: Pick<BodyContext, "tools">, root: string | undefined) {
|
|
110
116
|
return {
|
|
111
117
|
shell: orkeonShell(ctx.tools, root), files: orkeonFiles(ctx.tools, root), config: orkeonConfigStore(ctx.tools, root),
|
|
112
118
|
};
|
|
@@ -126,19 +132,20 @@ export function implementDeps(
|
|
|
126
132
|
precedents: stepPrecedents({ ...ports, memory: orkeonSharedMemory(ctx.tools), log: ctx.log }, { on: opts.memoryOn }),
|
|
127
133
|
// The close's opener, for the context read at the launch (the chained close reads it from the batch record).
|
|
128
134
|
openerFor: (pr) => orkeonPullRequestOpener({ mode: pr.permissionMode, rules: parseSessionRules(pr.permissionRules), asked: false }, ctx.tools),
|
|
129
|
-
// Each role's act runs under its own callbacks
|
|
130
|
-
// roots and the /hooks the command passed. `wrote` hears each write
|
|
135
|
+
// Each role's act runs under its own callbacks, then the host's gate: the step's rule sets, the role's
|
|
136
|
+
// roots and the /hooks the command passed. `wrote` hears each write that ran, from its result; `writable`:
|
|
131
137
|
// the test author's stubs, which its own root denies leave open; `files`: the rewrite rule reads a write's path.
|
|
132
|
-
|
|
138
|
+
// Under the rebase of the paths, the pruning of the act's tool loop (compaction.prune): nothing added when off.
|
|
139
|
+
roleLlm: (role, layout, wrote, writable) => rootedLlm(orkeonPrunedLlm(agentLlm(ctx, callbacks(
|
|
133
140
|
{ step: "dev-implement", role, layout, writable, hooks: opts.hooks, readTools: memoryReadTools(opts.memoryOn) }, wrote,
|
|
134
|
-
), { effort: opts.effort }), opts.root),
|
|
141
|
+
), { effort: opts.effort }), ctx.log, ctx.tools, opts.root), opts.root),
|
|
135
142
|
};
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
/** dev-verify's callbacks over the body's context: the step's rule sets again and the /hooks the command passed;
|
|
139
146
|
* run_validation and memory_recall, declared `read`, let through on a host without a gate. */
|
|
140
147
|
export function verifyCallbacks(ctx: Pick<BodyContext, "tools" | "log">, opts: DevOptions): ToolCallbacks {
|
|
141
|
-
const ports = portsOf(
|
|
148
|
+
const ports = portsOf(ctx, opts.root);
|
|
142
149
|
return spendGuard(rootedCallbacks(devToolCallbacks(
|
|
143
150
|
{ step: "dev-verify", hooks: opts.hooks, readTools: [RUN_VALIDATION.name, ...memoryReadTools(opts.memoryOn)] },
|
|
144
151
|
{ shell: ports.shell, log: ctx.log, memoryDir: memoryDirOf(ports.config) },
|
|
@@ -156,7 +163,7 @@ export function verifyDeps(
|
|
|
156
163
|
// The audit's act is offered the auditor's tools alone: a batch agent also holds the implementer's, which an act
|
|
157
164
|
// without a subset would offer too - write tools to a read-only auditor, their schemas resent at every turn.
|
|
158
165
|
const auditorTools = [...charterCatalogue(AUDITOR_CHARTER), RUN_VALIDATION.name, ...memoryReadTools(opts.memoryOn)];
|
|
159
|
-
const rooted = rootedLlm(
|
|
166
|
+
const rooted = rootedLlm(orkeonPrunedLlm(agentLlm(ctx, verifyCallbacks(ctx, opts), { effort: opts.effort }), ctx.log, ctx.tools, opts.root), opts.root);
|
|
160
167
|
const plain: Llm = { ...rooted, act: (prompt, request = {}) => rooted.act(prompt, request.tools === undefined ? { ...request, tools: auditorTools } : request) };
|
|
161
168
|
return {
|
|
162
169
|
...ports, log: ctx.log, clock, llm: opts.wrapLlm === undefined ? plain : opts.wrapLlm(plain),
|
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
// Files adapter over file_read, file_write, directory_read and list_mounts. A
|
|
2
2
|
// failed read is rethrown with the tool's own message, the runtime's wrapping gone
|
|
3
3
|
// (withToolMessage): callers tell an absent file from an unreadable one by it. Given a batch's working root, each
|
|
4
|
-
// `/workspace` path is read and written under it (shared/domain/dev/path-rebase.ts).
|
|
4
|
+
// `/workspace` path is read and written under it (shared/domain/dev/path-rebase.ts). Given the host's context, a path
|
|
5
|
+
// spelled as the disk does comes back to the VFS first, and a failure's message comes back with the VFS spellings
|
|
6
|
+
// (shared/domain/host-paths.ts).
|
|
5
7
|
|
|
6
8
|
import type { Files } from "../../application/ports.ts";
|
|
9
|
+
import type { HostSource } from "../../application/host-context.ts";
|
|
7
10
|
import { toRoot } from "../../domain/dev/path-rebase.ts";
|
|
11
|
+
import { textToVirtual, toVirtual } from "../../domain/host-paths.ts";
|
|
12
|
+
import type { HostLayout } from "../../domain/host-layout.ts";
|
|
13
|
+
import { layoutOf } from "./host-context.ts";
|
|
8
14
|
import { entryNames, fileContent, pick, withToolMessage } from "./tool-results.ts";
|
|
9
15
|
|
|
16
|
+
/** The tool's own message (withToolMessage), its disk spellings brought back to the VFS. */
|
|
17
|
+
async function withHostMessage<T>(layout: HostLayout, call: () => Promise<T>): Promise<T> {
|
|
18
|
+
try {
|
|
19
|
+
return await withToolMessage(call);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
throw new Error(textToVirtual(error instanceof Error ? error.message : String(error), layout));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
10
25
|
export function createFiles(
|
|
11
26
|
tools: Pick<OrkeonTools, "fileRead" | "fileWrite" | "directoryRead" | "listMounts">,
|
|
12
27
|
root?: string,
|
|
28
|
+
host?: HostSource,
|
|
13
29
|
): Files {
|
|
30
|
+
const pathOf = async (logical: string) => toRoot(toVirtual(logical, await layoutOf(host)), root);
|
|
14
31
|
return {
|
|
15
32
|
async read(logical, maxLength) {
|
|
16
|
-
const
|
|
33
|
+
const layout = await layoutOf(host);
|
|
34
|
+
const path = toRoot(toVirtual(logical, layout), root);
|
|
17
35
|
const input = maxLength === undefined ? { path } : { path, max_length: maxLength };
|
|
18
|
-
return fileContent(await
|
|
36
|
+
return fileContent(await withHostMessage(layout, () => tools.fileRead(input)));
|
|
19
37
|
},
|
|
20
|
-
async write(
|
|
21
|
-
await tools.fileWrite({ path:
|
|
38
|
+
async write(logical, content) {
|
|
39
|
+
await tools.fileWrite({ path: await pathOf(logical), content });
|
|
22
40
|
},
|
|
23
41
|
async list(logical, maxEntries) {
|
|
24
|
-
const path =
|
|
42
|
+
const path = await pathOf(logical);
|
|
25
43
|
// DirectoryReadRequest.MaxResults, bound through the tools' snake_case naming
|
|
26
44
|
// (as file_read's MaxLength is `max_length`); an unknown field is ignored.
|
|
27
45
|
return entryNames(await tools.directoryRead({ path, max_results: maxEntries }));
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { GitHubPullRequests } from "../../application/git/open-pull-request.ts";
|
|
8
8
|
import { asArray, pick } from "./tool-results.ts";
|
|
9
|
+
import { GITHUB_FAILED_WITHOUT_REASON, GITHUB_SUCCESS_WITHOUT_PULL_REQUEST } from "./messages.ts";
|
|
9
10
|
|
|
10
11
|
function firstLine(text: unknown): string {
|
|
11
12
|
return String(text ?? "").split("\n").map((l) => l.trim()).find((l) => l.length > 0) ?? "";
|
|
@@ -16,13 +17,13 @@ export function createGitHubPullRequests(tools: Pick<OrkeonTools, "github">): Gi
|
|
|
16
17
|
async create(args) {
|
|
17
18
|
const r = await tools.github(args);
|
|
18
19
|
if (pick(r, "success", "Success") !== true) {
|
|
19
|
-
throw new Error(firstLine(pick(r, "error", "Error")) ||
|
|
20
|
+
throw new Error(firstLine(pick(r, "error", "Error")) || GITHUB_FAILED_WITHOUT_REASON);
|
|
20
21
|
}
|
|
21
22
|
const item = asArray(pick(r, "items", "Items"))[0];
|
|
22
23
|
const url = String(pick(item, "url", "Url") ?? "").trim();
|
|
23
24
|
if (url.length > 0) return { url };
|
|
24
25
|
const number = pick(item, "number", "Number");
|
|
25
|
-
if (number == null) throw new Error(
|
|
26
|
+
if (number == null) throw new Error(GITHUB_SUCCESS_WITHOUT_PULL_REQUEST);
|
|
26
27
|
return { url: `#${number}` };
|
|
27
28
|
},
|
|
28
29
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The host context of this run (shared/application/host-context.ts: the layout of launch.json and the path lists of
|
|
2
|
+
// the settings), read once and shared by every act (llm.ts) and every operation of the file, shell and job adapters.
|
|
3
|
+
// wiring.ts, the module every entry point loads, binds the reader over the global tools; an adapter or the Llm
|
|
4
|
+
// adapter loaded alone, in a test, finds nothing bound and reads the identity: the spellings pass as they are. The
|
|
5
|
+
// read runs at the first call, never at load, and a read that fails (the runtime refusing a call from code while
|
|
6
|
+
// agents under other roots run) leaves the identity as well.
|
|
7
|
+
|
|
8
|
+
import { IDENTITY_CONTEXT } from "../../application/host-context.ts";
|
|
9
|
+
import type { HostContext, HostSource } from "../../application/host-context.ts";
|
|
10
|
+
import { IDENTITY_HOST } from "../../domain/host-layout.ts";
|
|
11
|
+
import type { HostLayout } from "../../domain/host-layout.ts";
|
|
12
|
+
|
|
13
|
+
/** The host's layout, the identity for an adapter given no context. */
|
|
14
|
+
export async function layoutOf(host: HostSource | undefined): Promise<HostLayout> {
|
|
15
|
+
return host === undefined ? IDENTITY_HOST : (await host()).layout;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let reader: HostSource | undefined;
|
|
19
|
+
let memo: Promise<HostContext> | undefined;
|
|
20
|
+
|
|
21
|
+
/** Binds the reader of this run's context, or none: the next call reads it again. */
|
|
22
|
+
export function bindHostContext(read: HostSource | undefined): void {
|
|
23
|
+
reader = read;
|
|
24
|
+
memo = undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** This run's context: the bound reader's, read once; the identity unbound or when the read fails. */
|
|
28
|
+
export const orkeonHostContext: HostSource = () => {
|
|
29
|
+
if (memo === undefined) {
|
|
30
|
+
const read = reader;
|
|
31
|
+
memo = read === undefined
|
|
32
|
+
? Promise.resolve(IDENTITY_CONTEXT)
|
|
33
|
+
: Promise.resolve().then(() => read()).catch(() => IDENTITY_CONTEXT);
|
|
34
|
+
}
|
|
35
|
+
return memo;
|
|
36
|
+
};
|
|
@@ -7,11 +7,7 @@
|
|
|
7
7
|
// Enter); an empty `text` is no answer.
|
|
8
8
|
import type { HumanInput } from "../../application/ports.ts";
|
|
9
9
|
import { pick } from "./tool-results.ts";
|
|
10
|
-
|
|
11
|
-
/** The default value no option holds: an answer equal to it came from no person. */
|
|
12
|
-
export const NO_ANSWER = "(no answer)";
|
|
13
|
-
/** The first option of a `multi`: picked by the auto-approver, it decides nothing. */
|
|
14
|
-
export const DECIDE_LATER = "Decide later";
|
|
10
|
+
import { DECIDE_LATER, NO_ANSWER } from "./markers.ts";
|
|
15
11
|
|
|
16
12
|
type HumanInputTools = Partial<Pick<OrkeonTools, "humanInput">>;
|
|
17
13
|
const NOBODY = { answered: false } as const;
|
|
@@ -6,33 +6,53 @@
|
|
|
6
6
|
// the crew's load, as `llm.profile` does, listing the profiles the host knows. Every agent asks the provider to cache
|
|
7
7
|
// its system prompt and its tool definitions (Orkeon #254): the prompts are assembled so that this prefix stays
|
|
8
8
|
// byte-identical turn after turn. Only a provider whose cache is explicit (Anthropic) needs the request; the others
|
|
9
|
-
// cache by their own rules. A
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
9
|
+
// cache by their own rules. A sub-agent's act routed to a rung the host does not declare stays on the crew's profile
|
|
10
|
+
// (declaredRoute), as a crew launched on one does: the runtime throws on an unknown profile name an
|
|
11
|
+
// `InvalidScriptError` (Orkeon #364, #366), which `refusal` recognises. Any other failure of `llm.profile` is no
|
|
12
|
+
// undeclared name: it is thrown as it came.
|
|
13
13
|
|
|
14
|
-
import { llmProfileOf } from "../../domain/llm-profile.ts";
|
|
14
|
+
import { llmProfileFallbackOf, llmProfileOf } from "../../domain/llm-profile.ts";
|
|
15
|
+
import { noLlmNamespace } from "./messages.ts";
|
|
16
|
+
import type { ActRoute } from "../../application/agents/route-agent.ts";
|
|
15
17
|
|
|
16
|
-
/** What building a profiled agent needs of the runtime: the agent builder
|
|
18
|
+
/** What building a profiled agent needs of the runtime: the agent builder, `llm.profile`, absent where the host
|
|
19
|
+
* declares no `llm`, and `refusal`, whether an error is the runtime refusing what the script asked. */
|
|
17
20
|
export interface AgentFactories {
|
|
18
21
|
agent: () => any;
|
|
19
22
|
profile: ((name: string) => LlmConfig) | undefined;
|
|
23
|
+
refusal: (error: unknown) => boolean;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/** The prompt cache every agent requests: the system prompt and the tools, for the vendor's default lifetime. */
|
|
23
27
|
export const PROMPT_CACHE: LlmCacheOptions = { systemPrompt: true, tools: true };
|
|
24
28
|
|
|
25
|
-
/** Whether the runtime's act() reads `context`: the builder has `.cache`, which the rc.6 release (before #256, so before
|
|
26
|
-
* #277) lacks. A source checkout between #256 and #277 answers true; the launcher moves such a checkout to the pin. */
|
|
27
|
-
export function runtimeTakesActContext(factories: Pick<AgentFactories, "agent">): boolean {
|
|
28
|
-
return typeof factories.agent().cache === "function";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
29
|
export function profiledAgent(input: Readonly<Record<string, unknown>>, factories: AgentFactories): any {
|
|
32
|
-
const
|
|
33
|
-
const builder = typeof plain.cache === "function" ? plain.cache(PROMPT_CACHE) : plain;
|
|
30
|
+
const builder = factories.agent().cache(PROMPT_CACHE);
|
|
34
31
|
const name = llmProfileOf(input);
|
|
35
32
|
if (name === null) return builder;
|
|
36
|
-
if (factories.profile === undefined) throw new Error(
|
|
37
|
-
|
|
33
|
+
if (factories.profile === undefined) throw new Error(noLlmNamespace(name));
|
|
34
|
+
const fallback = llmProfileFallbackOf(input);
|
|
35
|
+
if (fallback === undefined) return builder.llm(factories.profile(name));
|
|
36
|
+
// A routed name the host does not declare: the crew runs as it would have without the routing.
|
|
37
|
+
try {
|
|
38
|
+
return builder.llm(factories.profile(name));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (!factories.refusal(error)) throw error;
|
|
41
|
+
return fallback === null ? builder : builder.llm(factories.profile(fallback));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** `route`, answering null for a profile the host does not declare (or on a host without `llm`). */
|
|
46
|
+
export function declaredRoute(route: ActRoute, { profile, refusal }: Pick<AgentFactories, "profile" | "refusal">): ActRoute {
|
|
47
|
+
return async (task) => {
|
|
48
|
+
const name = await route(task);
|
|
49
|
+
if (name === null || profile === undefined) return null;
|
|
50
|
+
try {
|
|
51
|
+
profile(name);
|
|
52
|
+
return name;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (!refusal(error)) throw error;
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
38
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="../../../crews/.orkeon/orkeon.d.ts" />
|
|
2
2
|
// Llm adapter over the running agent's `ctx.llm` facade. The facade belongs to
|
|
3
3
|
// the context the runtime hands each agent body, not to a global, so the entry
|
|
4
|
-
// point passes
|
|
4
|
+
// point passes its context in (`agentLlm(ctx)`) rather than wiring.ts binding it.
|
|
5
5
|
// This is the one place that turns the port's settings into the runtime's call
|
|
6
6
|
// options, and the one place that reads an act() result. A call the provider
|
|
7
7
|
// failed comes back as the host's failure marker: it is thrown as an LlmFailure,
|
|
@@ -11,46 +11,67 @@
|
|
|
11
11
|
// port's `act` keeps resolving to a finished answer alone, every caller that reads a
|
|
12
12
|
// spent budget off a rejection (runSubAgent, the dev roles, the auditor) keeps doing
|
|
13
13
|
// so under the `tokens` dimension, and the one caller that shows the wrap-up (the
|
|
14
|
-
// main loop) reads it off the error.
|
|
14
|
+
// main loop) reads it off the error. An act stopped at its `maxIterations` resolves with
|
|
15
|
+
// `exhausted: true` and the runtime's notice as output: it is thrown as an IterationsExhausted,
|
|
16
|
+
// so a reviewer or an auditor that never concluded is a failure of its act, never an answer to
|
|
17
|
+
// parse; the main loop shows the notice. A crew that guards its tool calls hands its callbacks
|
|
15
18
|
// (shared/application/dev/tool-callbacks.ts) as the second argument: each act then carries the
|
|
16
19
|
// onToolCall/onToolResult built for its own mode. The request's `effort` is the runtime's
|
|
17
20
|
// `act({effort})` as it is; the crew's own level, when it has one, fills a request that names none.
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
+
// `effortSent` asks the facade what such an act sends for its effort (`ctx.llm.reasoning`, Orkeon #360), without a call.
|
|
22
|
+
// The request's `context` is the runtime's `act({context})` (Orkeon #276), a blank one left out.
|
|
23
|
+
// Every act's callbacks, the crew's or none, sit inside the host's (hostCallbacks): under a host whose paths have
|
|
24
|
+
// another spelling, or with path lists, a call's paths come back to the VFS and are judged before the crew's
|
|
25
|
+
// callbacks see them, and every result's disk spellings come back before the model reads them. The host's context
|
|
26
|
+
// is this run's (orkeon/host-context.ts), read at the first act; a test hands its own in the defaults.
|
|
27
|
+
// An act that carries a system prompt ends it with the runtime's `## File system` section (`ctx.fileSystem.prompt`,
|
|
28
|
+
// Orkeon #378): the paths this agent may touch, their rights and where relative paths resolve, read at each act and
|
|
29
|
+
// left out when the runtime gives none. The entry points build the adapter from the agent's context (`agentLlm(ctx)`).
|
|
21
30
|
|
|
22
31
|
import type { ActRequest, CompleteRequest, Llm, ModelOverride } from "../../application/ports.ts";
|
|
23
32
|
import type { PermissionMode } from "../../domain/permission-modes.ts";
|
|
24
|
-
import { budgetExhaustedAnswer, llmFailureOf } from "../../domain/llm-failure.ts";
|
|
25
|
-
import
|
|
33
|
+
import { budgetExhaustedAnswer, iterationsExhausted, llmFailureOf } from "../../domain/llm-failure.ts";
|
|
34
|
+
import { effortReportOf } from "../../domain/agent-policy/reasoning.ts";
|
|
35
|
+
import { hostCallbacks } from "../../application/dev/tool-callbacks.ts";
|
|
36
|
+
import type { ActCallbacks, ToolCallbacks } from "../../application/dev/tool-callbacks.ts";
|
|
37
|
+
import type { HostSource } from "../../application/host-context.ts";
|
|
38
|
+
import { orkeonHostContext } from "./host-context.ts";
|
|
26
39
|
|
|
27
40
|
/** The request as the callers fill it: its mode is one of PERMISSION_MODES, the
|
|
28
|
-
* five modes ActOptions names
|
|
41
|
+
* five modes ActOptions names. */
|
|
29
42
|
type ModeActRequest = Omit<ActRequest, "permissionMode"> & { permissionMode?: PermissionMode };
|
|
30
43
|
|
|
44
|
+
/** The runtime's `llm` patch of one call: its profile and its model, each when set; none when neither is. */
|
|
45
|
+
function llmPatch(profile: string | undefined, model: string | undefined): { profile?: string; model?: string } | undefined {
|
|
46
|
+
if (!profile && !model) return undefined;
|
|
47
|
+
return { ...(profile ? { profile } : {}), ...(model ? { model } : {}) };
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
/** The runtime's per-call options for a model override; none without one. */
|
|
32
51
|
function callOptions(override: ModelOverride | undefined): LlmCallOptions | undefined {
|
|
33
|
-
|
|
52
|
+
const llm = llmPatch(override?.profile, override?.model);
|
|
53
|
+
return llm === undefined ? undefined : { llm };
|
|
34
54
|
}
|
|
35
55
|
|
|
36
|
-
/** The runtime's act() options: the request as given (its `tools` subset copied), its model as the `llm`
|
|
37
|
-
* the act's
|
|
38
|
-
function actOptions(request: ActRequest, callbacks:
|
|
39
|
-
const { model, tools, ...given } = request as ModeActRequest;
|
|
56
|
+
/** The runtime's act() options: the request as given (its `tools` subset copied), its profile and model as the `llm`
|
|
57
|
+
* patch, and the act's callbacks, when it has any. */
|
|
58
|
+
function actOptions(request: ActRequest, callbacks: ActCallbacks | undefined): ActOptions {
|
|
59
|
+
const { model, profile, tools, ...given } = request as ModeActRequest;
|
|
40
60
|
const rest = tools === undefined ? given : { ...given, tools: [...tools] };
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
: { ...options, ...callbacks.forAct(request.permissionMode ?? "default", gateEnabled) };
|
|
61
|
+
const llm = llmPatch(profile, model);
|
|
62
|
+
const options: ActOptions = llm === undefined ? rest : { ...rest, llm };
|
|
63
|
+
return callbacks === undefined ? options : { ...options, ...callbacks };
|
|
45
64
|
}
|
|
46
65
|
|
|
47
66
|
/** The answer text of an act() result: its `output`; the result itself when it
|
|
48
67
|
* carries none (a host resolving to a bare string); empty when nothing came back.
|
|
49
|
-
* A result flagged `budgetExhausted` is thrown with its output as a BudgetExhaustedAnswer
|
|
68
|
+
* A result flagged `budgetExhausted` is thrown with its output as a BudgetExhaustedAnswer, one flagged `exhausted`
|
|
69
|
+
* (the iteration cap reached, its output the runtime's notice) as an IterationsExhausted. */
|
|
50
70
|
function answerOf(result: unknown): string {
|
|
51
|
-
const r = result as { output?: unknown; budgetExhausted?: unknown } | null | undefined;
|
|
71
|
+
const r = result as { output?: unknown; budgetExhausted?: unknown; exhausted?: unknown; iterations?: unknown } | null | undefined;
|
|
52
72
|
const text = String(r?.output ?? r ?? "");
|
|
53
73
|
if (r?.budgetExhausted === true) throw budgetExhaustedAnswer(text);
|
|
74
|
+
if (r?.exhausted === true) throw iterationsExhausted(r.iterations, text);
|
|
54
75
|
return text;
|
|
55
76
|
}
|
|
56
77
|
|
|
@@ -61,21 +82,29 @@ function answerOrThrow(text: string): string {
|
|
|
61
82
|
return text;
|
|
62
83
|
}
|
|
63
84
|
|
|
64
|
-
/** What the adapter adds to every act: the crew's effort,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
/** What the adapter adds to every act: the crew's effort, the host's context (this run's when none is given), and
|
|
86
|
+
* the agent's file-system section, read from the runtime at each act. */
|
|
87
|
+
export type LlmDefaults = Pick<ActRequest, "effort"> & { host?: HostSource; fileSystem?: Pick<AgentFileSystem, "prompt"> };
|
|
88
|
+
|
|
89
|
+
/** The request with the runtime's file-system section closing its system prompt; as given without a system prompt
|
|
90
|
+
* or when the runtime gives no section (no path visible, no file-system tool, `announceMounts(false)`). */
|
|
91
|
+
function withFileSystem(request: ActRequest, fileSystem: Pick<AgentFileSystem, "prompt"> | undefined): ActRequest {
|
|
92
|
+
if (request.system === undefined || fileSystem === undefined) return request;
|
|
93
|
+
const section = fileSystem.prompt.trim();
|
|
94
|
+
return section.length === 0 ? request : { ...request, system: `${request.system.trimEnd()}\n\n${section}` };
|
|
68
95
|
}
|
|
69
96
|
|
|
70
|
-
/** The
|
|
71
|
-
function withContext(
|
|
97
|
+
/** The request the runtime receives: as given, a blank context left out. */
|
|
98
|
+
function withContext(request: ActRequest): ActRequest {
|
|
72
99
|
const { context, ...rest } = request;
|
|
73
|
-
|
|
74
|
-
return contextApart ? { prompt, request } : { prompt: context + "\n\n" + prompt, request: rest };
|
|
100
|
+
return context === undefined || context.trim().length === 0 ? rest : request;
|
|
75
101
|
}
|
|
76
102
|
|
|
103
|
+
/** The part of the runtime's `ctx.llm` the adapter reads; a test's facade may lack the gate and the reasoning. */
|
|
104
|
+
type Facade = Pick<LlmFacade, "act" | "complete" | "extract" | "chat"> & Partial<Pick<LlmFacade, "permissionGate" | "reasoning">>;
|
|
105
|
+
|
|
77
106
|
export function createLlm(
|
|
78
|
-
llm:
|
|
107
|
+
llm: Facade,
|
|
79
108
|
callbacks?: Pick<ToolCallbacks, "forAct">,
|
|
80
109
|
defaults: LlmDefaults = {},
|
|
81
110
|
): Llm {
|
|
@@ -84,14 +113,30 @@ export function createLlm(
|
|
|
84
113
|
const on = llm.permissionGate?.enabled;
|
|
85
114
|
return on === true || on === false ? on : undefined;
|
|
86
115
|
};
|
|
116
|
+
const host = defaults.host ?? orkeonHostContext;
|
|
87
117
|
return {
|
|
88
118
|
permissionGateEnabled,
|
|
119
|
+
effortSent(request) {
|
|
120
|
+
const effort = request.effort ?? defaults.effort;
|
|
121
|
+
// A facade without it (a test's, a runtime before #360) cannot say. With no effort asked, the runtime reports
|
|
122
|
+
// what the host's own configuration sends, or nothing.
|
|
123
|
+
if (llm.reasoning === undefined) return null;
|
|
124
|
+
try {
|
|
125
|
+
return effortReportOf(llm.reasoning({ ...(effort === undefined ? {} : { effort }), ...callOptions(request) }));
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
89
130
|
async act(prompt, request) {
|
|
90
131
|
// The crew's effort (/effort, handed as an input) when the request names none.
|
|
91
132
|
const effort = request.effort ?? defaults.effort;
|
|
92
133
|
const withEffort = effort === undefined ? request : { ...request, effort };
|
|
93
|
-
|
|
94
|
-
|
|
134
|
+
// The crew's callbacks for the act's mode (`default` when the request names none, as the runtime reads it),
|
|
135
|
+
// inside the host's.
|
|
136
|
+
const own = callbacks?.forAct(request.permissionMode ?? "default", permissionGateEnabled());
|
|
137
|
+
const acts = hostCallbacks(own, await host());
|
|
138
|
+
const sent = withFileSystem(withContext(withEffort), defaults.fileSystem);
|
|
139
|
+
return answerOrThrow(answerOf(await llm.act(prompt, actOptions(sent, acts))));
|
|
95
140
|
},
|
|
96
141
|
async complete(prompt, request?: CompleteRequest) {
|
|
97
142
|
// A system message needs the message-array call: `complete` takes a prompt only.
|
|
@@ -107,3 +152,13 @@ export function createLlm(
|
|
|
107
152
|
extract: (prompt, schema) => llm.extract<unknown>(prompt, schema as JsonSchema),
|
|
108
153
|
};
|
|
109
154
|
}
|
|
155
|
+
|
|
156
|
+
/** The Llm of a running agent, from the context the runtime hands its body: its `llm` facade, and its file-system
|
|
157
|
+
* section for every act's system prompt. */
|
|
158
|
+
export function agentLlm(
|
|
159
|
+
ctx: { llm: Facade; fileSystem: Pick<AgentFileSystem, "prompt"> },
|
|
160
|
+
callbacks?: Pick<ToolCallbacks, "forAct">,
|
|
161
|
+
defaults: Omit<LlmDefaults, "fileSystem"> = {},
|
|
162
|
+
): Llm {
|
|
163
|
+
return createLlm(ctx.llm, callbacks, { ...defaults, fileSystem: ctx.fileSystem });
|
|
164
|
+
}
|