orkeon-code 0.0.0-stage → 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 -0
- package/LICENSE.md +21 -0
- package/NOTICE.md +17 -0
- package/README.fr.md +163 -0
- package/README.md +156 -2
- package/config/appsettings.anthropic.example.json +77 -0
- package/config/appsettings.example.json +71 -0
- package/config/appsettings.jev.example.json +131 -0
- package/config/appsettings.kev.example.json +133 -0
- package/config/appsettings.liquid.example.json +132 -0
- package/config/appsettings.ollama-whisper.example.json +93 -0
- package/config/appsettings.ollama.example.json +70 -0
- package/config/appsettings.whisper.example.json +32 -0
- package/mcp/whisper/README.md +294 -0
- package/mcp/whisper/pyproject.toml +32 -0
- package/mcp/whisper/uv.lock +1641 -0
- package/mcp/whisper/whisper_mcp.py +1053 -0
- package/orkeon-code +1092 -0
- package/orkeon-code.mjs +71 -0
- package/orkeon-code.ps1 +939 -0
- package/package.json +58 -4
- package/scripts/install.ps1 +156 -0
- package/scripts/install.sh +148 -0
- package/scripts/session-start.ork.ts +90 -0
- package/scripts/session-start.sh +74 -0
- package/scripts/setup-fixture.sh +88 -0
- package/src/commands/.orkeon/orkeon-cli.d.ts +559 -0
- package/src/commands/_lib/args.ts +194 -0
- package/src/commands/_lib/dev/dev-batches.ts +366 -0
- package/src/commands/_lib/dev/dev-implement.ts +185 -0
- package/src/commands/_lib/dev/dev-source.ts +61 -0
- package/src/commands/_lib/dev/dev.ts +341 -0
- 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 +145 -0
- package/src/commands/_lib/dispatch.ts +254 -0
- package/src/commands/_lib/effort.ts +15 -0
- package/src/commands/_lib/git/branch.ts +94 -0
- package/src/commands/_lib/git/commit.ts +90 -0
- package/src/commands/_lib/git/diff.ts +107 -0
- package/src/commands/_lib/git/messages.ts +54 -0
- package/src/commands/_lib/git/review.ts +108 -0
- package/src/commands/_lib/memory/memory-admit.ts +148 -0
- package/src/commands/_lib/memory/memory.ts +52 -0
- package/src/commands/_lib/memory/messages.ts +32 -0
- package/src/commands/_lib/messages.ts +48 -0
- package/src/commands/_lib/pr-context.ts +32 -0
- package/src/commands/_lib/project/analyze.ts +24 -0
- package/src/commands/_lib/project/messages.ts +8 -0
- package/src/commands/_lib/session/export.ts +105 -0
- 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 +151 -0
- package/src/commands/_lib/session/tasks.ts +181 -0
- package/src/commands/_lib/settings/advisor.ts +75 -0
- package/src/commands/_lib/settings/agents.ts +137 -0
- package/src/commands/_lib/settings/choices.ts +8 -0
- package/src/commands/_lib/settings/config.ts +141 -0
- package/src/commands/_lib/settings/effort.ts +147 -0
- package/src/commands/_lib/settings/hooks.ts +50 -0
- package/src/commands/_lib/settings/messages.ts +408 -0
- package/src/commands/_lib/settings/mode.ts +100 -0
- package/src/commands/_lib/settings/model.ts +181 -0
- package/src/commands/_lib/settings/output-style.ts +39 -0
- package/src/commands/_lib/settings/permissions.ts +287 -0
- package/src/commands/_lib/settings/route.ts +63 -0
- package/src/commands/_lib/settings/session-config.ts +49 -0
- package/src/commands/_lib/settings/skills.ts +93 -0
- 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 +95 -0
- package/src/commands/_lib/speech/transcribe.ts +121 -0
- package/src/commands/_lib/speech/voice.ts +142 -0
- package/src/commands/_lib/status/cache.ts +31 -0
- package/src/commands/_lib/status/context.ts +57 -0
- package/src/commands/_lib/status/doctor.ts +205 -0
- package/src/commands/_lib/status/messages.ts +100 -0
- package/src/commands/_lib/status/meta.ts +24 -0
- package/src/commands/_lib/status/status.ts +128 -0
- package/src/commands/_lib/status/usage-tools.ts +48 -0
- package/src/commands/_lib/status/usage.ts +128 -0
- package/src/commands/_lib/view.ts +34 -0
- package/src/commands/dev/dev-batches.cmd.ts +109 -0
- package/src/commands/dev/dev-learn.cmd.ts +29 -0
- package/src/commands/dev/dev-plan.cmd.ts +51 -0
- package/src/commands/dev/dev-spec.cmd.ts +54 -0
- package/src/commands/dev/dev-status.cmd.ts +16 -0
- package/src/commands/git/branch.cmd.ts +27 -0
- package/src/commands/git/commit.cmd.ts +48 -0
- package/src/commands/git/diff.cmd.ts +26 -0
- package/src/commands/git/review.cmd.ts +36 -0
- package/src/commands/memory/memory.cmd.ts +48 -0
- package/src/commands/project/analyze.cmd.ts +32 -0
- package/src/commands/project/debug-tool-call.cmd.ts +62 -0
- package/src/commands/project/files.cmd.ts +22 -0
- package/src/commands/project/init-verifiers.cmd.ts +14 -0
- package/src/commands/project/init.cmd.ts +14 -0
- package/src/commands/project/verify.cmd.ts +27 -0
- package/src/commands/session/assistant.cmd.ts +40 -0
- package/src/commands/session/btw.cmd.ts +18 -0
- package/src/commands/session/clear.cmd.ts +19 -0
- package/src/commands/session/compact.cmd.ts +16 -0
- package/src/commands/session/copy.cmd.ts +45 -0
- package/src/commands/session/exit.cmd.ts +9 -0
- package/src/commands/session/export.cmd.ts +28 -0
- package/src/commands/session/rename.cmd.ts +18 -0
- package/src/commands/session/resume.cmd.ts +19 -0
- package/src/commands/session/rewind.cmd.ts +25 -0
- package/src/commands/session/summary.cmd.ts +27 -0
- package/src/commands/session/tasks.cmd.ts +46 -0
- package/src/commands/settings/advisor.cmd.ts +38 -0
- package/src/commands/settings/agents.cmd.ts +19 -0
- package/src/commands/settings/config.cmd.ts +19 -0
- package/src/commands/settings/effort.cmd.ts +19 -0
- package/src/commands/settings/fast.cmd.ts +18 -0
- package/src/commands/settings/hooks.cmd.ts +17 -0
- package/src/commands/settings/mode.cmd.ts +20 -0
- package/src/commands/settings/model.cmd.ts +21 -0
- package/src/commands/settings/output-style.cmd.ts +19 -0
- package/src/commands/settings/permissions.cmd.ts +25 -0
- package/src/commands/settings/proactive.cmd.ts +16 -0
- package/src/commands/settings/route.cmd.ts +16 -0
- package/src/commands/settings/skills.cmd.ts +17 -0
- package/src/commands/settings/theme.cmd.ts +14 -0
- package/src/commands/speech/say.cmd.ts +24 -0
- package/src/commands/speech/transcribe.cmd.ts +29 -0
- package/src/commands/speech/voice.cmd.ts +30 -0
- package/src/commands/status/context.cmd.ts +18 -0
- package/src/commands/status/doctor.cmd.ts +27 -0
- package/src/commands/status/release-notes.cmd.ts +9 -0
- package/src/commands/status/status.cmd.ts +25 -0
- package/src/commands/status/usage.cmd.ts +21 -0
- package/src/crews/.orkeon/orkeon.d.ts +4391 -0
- package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
- package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +188 -0
- package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
- package/src/crews/_probe-shared-memory/probe.ork.ts +100 -0
- 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 +41 -0
- package/src/crews/advisor/crew.ork.ts +44 -0
- package/src/crews/advisor/domain/advice.ts +119 -0
- 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 +43 -0
- package/src/crews/agent-run/crew.ork.ts +67 -0
- 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 +120 -0
- package/src/crews/analyze/crew.ork.ts +41 -0
- package/src/crews/analyze/domain/harvest.ts +269 -0
- 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 +126 -0
- package/src/crews/code-review/application/review.ts +74 -0
- package/src/crews/code-review/application/run-code-review.ts +121 -0
- package/src/crews/code-review/crew.ork.ts +52 -0
- package/src/crews/code-review/domain/lenses.ts +154 -0
- 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 +58 -0
- package/src/crews/code-review/domain/scope.ts +106 -0
- package/src/crews/dev-batches/application/messages.ts +127 -0
- package/src/crews/dev-batches/application/plan-close.ts +181 -0
- package/src/crews/dev-batches/application/prompts.ts +10 -0
- package/src/crews/dev-batches/application/run-dev-batches.ts +676 -0
- package/src/crews/dev-batches/application/run-wave.ts +452 -0
- package/src/crews/dev-batches/application/seed-harvest.ts +163 -0
- package/src/crews/dev-batches/crew.ork.ts +146 -0
- package/src/crews/dev-batches/domain/batch-waves.ts +70 -0
- package/src/crews/dev-batches/domain/batches-budget.ts +52 -0
- package/src/crews/dev-batches/domain/batches-log.ts +52 -0
- 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 +44 -0
- package/src/crews/dev-change/application/change-material.ts +44 -0
- package/src/crews/dev-change/application/evidence.ts +172 -0
- package/src/crews/dev-change/application/messages.ts +81 -0
- package/src/crews/dev-change/application/prompts.ts +101 -0
- package/src/crews/dev-change/application/run-dev-change.ts +324 -0
- package/src/crews/dev-change/crew.ork.ts +114 -0
- package/src/crews/dev-change/domain/change-answer.ts +163 -0
- package/src/crews/dev-change/domain/change-render.ts +77 -0
- 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 +186 -0
- package/src/crews/dev-implement/application/count-open-steps.ts +24 -0
- package/src/crews/dev-implement/application/locate-sheet.ts +82 -0
- package/src/crews/dev-implement/application/messages.ts +161 -0
- package/src/crews/dev-implement/application/observe.ts +52 -0
- package/src/crews/dev-implement/application/prompts.ts +9 -0
- package/src/crews/dev-implement/application/report-writes.ts +46 -0
- package/src/crews/dev-implement/application/run-dev-implement.ts +822 -0
- package/src/crews/dev-implement/application/run-role.ts +27 -0
- package/src/crews/dev-implement/application/suite-job.ts +122 -0
- package/src/crews/dev-implement/application/touched.ts +74 -0
- package/src/crews/dev-implement/crew.ork.ts +69 -0
- package/src/crews/dev-implement/domain/contracts.ts +255 -0
- package/src/crews/dev-implement/domain/correction.ts +103 -0
- package/src/crews/dev-implement/domain/cycles.ts +36 -0
- package/src/crews/dev-implement/domain/implement-budget.ts +29 -0
- 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 +49 -0
- package/src/crews/dev-implement/domain/sheet-edits.ts +76 -0
- package/src/crews/dev-implement/domain/sheet-ticks.ts +23 -0
- package/src/crews/dev-implement/domain/step-checks.ts +137 -0
- package/src/crews/dev-implement/domain/step-section.ts +129 -0
- package/src/crews/dev-learn/application/learn-backlog.ts +58 -0
- 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/prompts.ts +99 -0
- package/src/crews/dev-learn/application/run-dev-learn.ts +558 -0
- package/src/crews/dev-learn/crew.ork.ts +53 -0
- package/src/crews/dev-learn/domain/learn-answer.ts +233 -0
- package/src/crews/dev-learn/domain/messages.ts +65 -0
- package/src/crews/dev-learn/domain/owner-lines.ts +89 -0
- package/src/crews/dev-learn/domain/proposals-render.ts +95 -0
- package/src/crews/dev-plan/application/anchor-paths.ts +113 -0
- package/src/crews/dev-plan/application/inventory.ts +174 -0
- 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/prompts.ts +141 -0
- package/src/crews/dev-plan/application/run-dev-plan.ts +483 -0
- package/src/crews/dev-plan/crew.ork.ts +112 -0
- package/src/crews/dev-plan/domain/inventory-model.ts +95 -0
- 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 +753 -0
- package/src/crews/dev-plan/domain/plan-render.ts +306 -0
- 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/prompts.ts +93 -0
- package/src/crews/dev-spec/application/run-dev-spec.ts +237 -0
- package/src/crews/dev-spec/application/spec-material.ts +42 -0
- package/src/crews/dev-spec/crew.ork.ts +110 -0
- 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 +252 -0
- package/src/crews/dev-spec/domain/spec-render.ts +76 -0
- package/src/crews/dev-verify/application/audit-brief.ts +187 -0
- package/src/crews/dev-verify/application/audit.ts +267 -0
- package/src/crews/dev-verify/application/capture.ts +311 -0
- 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 +423 -0
- package/src/crews/dev-verify/application/run-gate.ts +204 -0
- package/src/crews/dev-verify/crew.ork.ts +103 -0
- package/src/crews/dev-verify/domain/audit-answer.ts +154 -0
- package/src/crews/dev-verify/domain/auditor-charter.ts +21 -0
- package/src/crews/dev-verify/domain/capture-sections.ts +138 -0
- package/src/crews/dev-verify/domain/commands.ts +103 -0
- package/src/crews/dev-verify/domain/gate.ts +131 -0
- package/src/crews/dev-verify/domain/markers.ts +16 -0
- package/src/crews/dev-verify/domain/mechanical-table.ts +156 -0
- package/src/crews/dev-verify/domain/messages.ts +92 -0
- package/src/crews/dev-verify/domain/runtime-cut.ts +13 -0
- package/src/crews/dev-verify/domain/sheet-facts.ts +4 -0
- package/src/crews/dev-verify/domain/text.ts +20 -0
- package/src/crews/dev-verify/domain/verdict.ts +127 -0
- package/src/crews/git-commit/application/draft.ts +133 -0
- 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 +117 -0
- package/src/crews/git-commit/crew.ork.ts +53 -0
- package/src/crews/git-commit/domain/commit.ts +200 -0
- 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 +90 -0
- package/src/crews/init-verifiers/application/messages.ts +13 -0
- package/src/crews/init-verifiers/application/prompts.ts +107 -0
- package/src/crews/init-verifiers/application/run-init-verifiers.ts +26 -0
- package/src/crews/init-verifiers/crew.ork.ts +35 -0
- package/src/crews/init-verifiers/domain/commands-section.ts +36 -0
- package/src/crews/init-verifiers/domain/readiness.ts +23 -0
- package/src/crews/main-loop/application/auto-compact.ts +78 -0
- package/src/crews/main-loop/application/context-gather.ts +133 -0
- 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 +383 -0
- package/src/crews/main-loop/application/turn-context.ts +111 -0
- package/src/crews/main-loop/crew.ork.ts +124 -0
- package/src/crews/main-loop/domain/autocompact.ts +27 -0
- package/src/crews/main-loop/domain/prompt-assembly.ts +338 -0
- package/src/crews/main-loop/domain/prompts.ts +336 -0
- package/src/crews/main-loop/domain/turn-chains.ts +130 -0
- package/src/crews/project-init/application/detect.ts +123 -0
- package/src/crews/project-init/application/messages.ts +15 -0
- package/src/crews/project-init/application/prompts.ts +105 -0
- package/src/crews/project-init/application/run-project-init.ts +31 -0
- package/src/crews/project-init/crew.ork.ts +36 -0
- package/src/crews/project-init/domain/conventions.ts +36 -0
- package/src/crews/project-init/domain/existing-files.ts +65 -0
- package/src/crews/project-init/domain/messages.ts +13 -0
- package/src/crews/project-init/domain/package-map.ts +73 -0
- 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 +56 -0
- package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
- package/src/crews/shared-memory-admit/crew.ork.ts +49 -0
- 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 +26 -0
- package/src/crews/speech/crew.ork.ts +38 -0
- package/src/shared/application/agents/child-agent.ts +259 -0
- 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 +119 -0
- package/src/shared/application/answer-language.ts +14 -0
- package/src/shared/application/attached-skills.ts +36 -0
- package/src/shared/application/compaction/compact-session.ts +242 -0
- package/src/shared/application/compaction/extract-memories.ts +38 -0
- 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/compaction/restore-context.ts +78 -0
- package/src/shared/application/config-store.ts +123 -0
- package/src/shared/application/dev/brief-inventory.ts +115 -0
- package/src/shared/application/dev/close-batch.ts +85 -0
- package/src/shared/application/dev/find-repo-pack.ts +78 -0
- package/src/shared/application/dev/learn-decision.ts +254 -0
- package/src/shared/application/dev/load-dev-context.ts +265 -0
- package/src/shared/application/dev/measure-access-cost.ts +69 -0
- 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 +116 -0
- package/src/shared/application/dev/preflight.ts +71 -0
- package/src/shared/application/dev/project-files.ts +17 -0
- package/src/shared/application/dev/prompts.ts +34 -0
- package/src/shared/application/dev/question-round.ts +60 -0
- package/src/shared/application/dev/resolve-work-folder.ts +134 -0
- package/src/shared/application/dev/script-tool-slot.ts +27 -0
- package/src/shared/application/dev/settle-questions.ts +57 -0
- package/src/shared/application/dev/source-review.ts +67 -0
- package/src/shared/application/dev/source-step.ts +152 -0
- package/src/shared/application/dev/spend.ts +55 -0
- package/src/shared/application/dev/step-precedents.ts +90 -0
- package/src/shared/application/dev/tool-call-policy.ts +87 -0
- package/src/shared/application/dev/tool-callbacks.ts +262 -0
- package/src/shared/application/dev/tool-trace-recorder.ts +46 -0
- package/src/shared/application/dev/verdict-sources.ts +50 -0
- package/src/shared/application/dev/wrapped-tools.ts +147 -0
- package/src/shared/application/extra-tools.ts +71 -0
- package/src/shared/application/git/batch-worktree.ts +102 -0
- package/src/shared/application/git/commit-files.ts +191 -0
- package/src/shared/application/git/merge-batch.ts +67 -0
- package/src/shared/application/git/messages.ts +75 -0
- package/src/shared/application/git/open-pull-request.ts +52 -0
- package/src/shared/application/host-context.ts +59 -0
- package/src/shared/application/host-layout-store.ts +45 -0
- package/src/shared/application/instructions-file.ts +19 -0
- package/src/shared/application/json-file.ts +34 -0
- package/src/shared/application/llm-profile.ts +36 -0
- package/src/shared/application/messages.ts +14 -0
- package/src/shared/application/permission-rules.ts +169 -0
- package/src/shared/application/ports/approvals.ts +20 -0
- package/src/shared/application/ports/clock.ts +5 -0
- package/src/shared/application/ports/code-index.ts +93 -0
- package/src/shared/application/ports/crew.ts +60 -0
- package/src/shared/application/ports/decision.ts +14 -0
- package/src/shared/application/ports/files.ts +21 -0
- package/src/shared/application/ports/human.ts +38 -0
- package/src/shared/application/ports/llm.ts +83 -0
- package/src/shared/application/ports/memory.ts +30 -0
- package/src/shared/application/ports/progress.ts +23 -0
- package/src/shared/application/ports/runtime.ts +15 -0
- package/src/shared/application/ports/session.ts +74 -0
- package/src/shared/application/ports/shared-memory.ts +26 -0
- package/src/shared/application/ports/shell.ts +40 -0
- package/src/shared/application/ports/telemetry.ts +45 -0
- package/src/shared/application/ports/theme.ts +11 -0
- package/src/shared/application/ports/tools.ts +46 -0
- package/src/shared/application/ports/usage.ts +45 -0
- package/src/shared/application/ports.ts +29 -0
- package/src/shared/application/project-manifests.ts +106 -0
- package/src/shared/application/session-io.ts +85 -0
- package/src/shared/application/session-state.ts +36 -0
- package/src/shared/application/shared-memory/admit-entries.ts +179 -0
- package/src/shared/application/shared-memory/harvest-after-gaps.ts +69 -0
- package/src/shared/application/shared-memory/harvest-mistakes.ts +45 -0
- package/src/shared/application/shared-memory/import-agent-memory.ts +119 -0
- package/src/shared/application/shared-memory/memory-files.ts +111 -0
- package/src/shared/application/shared-memory/memory-settings.ts +94 -0
- package/src/shared/application/shared-memory/messages.ts +63 -0
- package/src/shared/application/shared-memory/push-candidate.ts +149 -0
- package/src/shared/application/shared-memory/recall-precedents.ts +70 -0
- package/src/shared/application/skills/messages.ts +4 -0
- package/src/shared/application/skills/suggest-skills.ts +102 -0
- package/src/shared/application/state-snapshot.ts +38 -0
- package/src/shared/application/workflow/messages.ts +8 -0
- package/src/shared/application/workflow/workflow-state.ts +136 -0
- package/src/shared/domain/agent-policy/behavior-flags.ts +162 -0
- package/src/shared/domain/agent-policy/extra-tools.ts +67 -0
- package/src/shared/domain/agent-policy/memory-categories.ts +6 -0
- package/src/shared/domain/agent-policy/messages.ts +66 -0
- package/src/shared/domain/agent-policy/mode-policy.ts +51 -0
- package/src/shared/domain/agent-policy/output-styles.ts +11 -0
- package/src/shared/domain/agent-policy/path-rules.ts +299 -0
- package/src/shared/domain/agent-policy/permission.ts +625 -0
- 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 +416 -0
- package/src/shared/domain/agent-policy/tool-access.ts +91 -0
- package/src/shared/domain/agent-registry.ts +143 -0
- package/src/shared/domain/agents/built-in-charters.ts +43 -0
- package/src/shared/domain/agents/chain.ts +30 -0
- package/src/shared/domain/agents/charter.ts +64 -0
- package/src/shared/domain/agents/exclusive.ts +25 -0
- package/src/shared/domain/agents/instances.ts +252 -0
- 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 +357 -0
- package/src/shared/domain/code-intel-routing.ts +60 -0
- package/src/shared/domain/compact-outcome.ts +46 -0
- package/src/shared/domain/compaction-thresholds.ts +162 -0
- package/src/shared/domain/compaction.ts +288 -0
- package/src/shared/domain/config-schema.ts +434 -0
- 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 +230 -0
- package/src/shared/domain/dev/artefacts.ts +50 -0
- package/src/shared/domain/dev/batches-concurrency.ts +35 -0
- package/src/shared/domain/dev/batches-state.ts +49 -0
- package/src/shared/domain/dev/build-commands.ts +45 -0
- package/src/shared/domain/dev/call-guard.ts +342 -0
- package/src/shared/domain/dev/carried-text.ts +47 -0
- package/src/shared/domain/dev/design-rules.ts +100 -0
- package/src/shared/domain/dev/learn-proposals.ts +176 -0
- package/src/shared/domain/dev/learn-state.ts +94 -0
- package/src/shared/domain/dev/markers.ts +107 -0
- package/src/shared/domain/dev/messages.ts +259 -0
- package/src/shared/domain/dev/path-args.ts +42 -0
- package/src/shared/domain/dev/path-rebase.ts +93 -0
- package/src/shared/domain/dev/phase-timing.ts +50 -0
- package/src/shared/domain/dev/plan-checks.ts +191 -0
- package/src/shared/domain/dev/plan-format.ts +170 -0
- package/src/shared/domain/dev/project-files.ts +29 -0
- package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
- package/src/shared/domain/dev/prompts.ts +251 -0
- package/src/shared/domain/dev/questions.ts +267 -0
- package/src/shared/domain/dev/reading-rule.ts +41 -0
- package/src/shared/domain/dev/repo-pack.ts +240 -0
- package/src/shared/domain/dev/review-answer.ts +173 -0
- package/src/shared/domain/dev/review-brief.ts +54 -0
- package/src/shared/domain/dev/reviewer-charter.ts +35 -0
- package/src/shared/domain/dev/sheet-facts.ts +81 -0
- package/src/shared/domain/dev/spec-format.ts +182 -0
- package/src/shared/domain/dev/step-budget.ts +74 -0
- package/src/shared/domain/dev/step-rules.ts +109 -0
- package/src/shared/domain/dev/test-commands.ts +94 -0
- package/src/shared/domain/dev/test-output.ts +33 -0
- package/src/shared/domain/dev/test-paths.ts +40 -0
- package/src/shared/domain/dev/tool-guards.ts +65 -0
- package/src/shared/domain/dev/trait-pattern.ts +87 -0
- package/src/shared/domain/dev/verdict-format.ts +162 -0
- package/src/shared/domain/dev/whitespace.ts +35 -0
- package/src/shared/domain/dev/work-folder.ts +68 -0
- package/src/shared/domain/dev/yaml-subset.ts +385 -0
- package/src/shared/domain/error-text.ts +13 -0
- package/src/shared/domain/git/close.ts +274 -0
- package/src/shared/domain/git/messages.ts +20 -0
- package/src/shared/domain/git/pull-request.ts +96 -0
- package/src/shared/domain/git/worktree.ts +46 -0
- package/src/shared/domain/host-layout.ts +147 -0
- package/src/shared/domain/host-paths.ts +399 -0
- package/src/shared/domain/index-languages.ts +16 -0
- package/src/shared/domain/instructions-file.ts +18 -0
- package/src/shared/domain/iso-day.ts +4 -0
- package/src/shared/domain/llm-failure.ts +134 -0
- package/src/shared/domain/llm-profile.ts +44 -0
- package/src/shared/domain/marked-message.ts +29 -0
- package/src/shared/domain/markers.ts +30 -0
- package/src/shared/domain/messages.ts +291 -0
- package/src/shared/domain/model-catalog.ts +79 -0
- package/src/shared/domain/permission-modes.ts +99 -0
- package/src/shared/domain/prelude.ts +92 -0
- package/src/shared/domain/project-manifests.ts +84 -0
- package/src/shared/domain/prompts.ts +233 -0
- package/src/shared/domain/search-routing.ts +77 -0
- package/src/shared/domain/secret-patterns.ts +46 -0
- package/src/shared/domain/session-keys.ts +92 -0
- package/src/shared/domain/session-start.ts +61 -0
- package/src/shared/domain/severity.ts +72 -0
- package/src/shared/domain/sha1.ts +61 -0
- package/src/shared/domain/shared-memory/agent-memory-import.ts +145 -0
- package/src/shared/domain/shared-memory/candidates.ts +40 -0
- package/src/shared/domain/shared-memory/entry.ts +151 -0
- package/src/shared/domain/shared-memory/front-matter.ts +187 -0
- package/src/shared/domain/shared-memory/gate.ts +45 -0
- package/src/shared/domain/shared-memory/harvest.ts +64 -0
- package/src/shared/domain/shared-memory/layout.ts +190 -0
- 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 +82 -0
- package/src/shared/domain/shared-memory/prompts.ts +28 -0
- package/src/shared/domain/shared-memory/refused.ts +84 -0
- package/src/shared/domain/shared-memory/verdict-rows.ts +134 -0
- 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 +33 -0
- package/src/shared/domain/speech.ts +21 -0
- package/src/shared/domain/strip.ts +88 -0
- package/src/shared/domain/tool-trace.ts +120 -0
- package/src/shared/domain/types.ts +67 -0
- package/src/shared/domain/verifiers.ts +33 -0
- package/src/shared/domain/vfs.ts +16 -0
- package/src/shared/domain/workflow/prompts.ts +15 -0
- package/src/shared/domain/workflow/state-file.ts +142 -0
- package/src/shared/infrastructure/globals.ts +57 -0
- package/src/shared/infrastructure/orkeon/approvals.ts +24 -0
- package/src/shared/infrastructure/orkeon/child-agents.ts +122 -0
- package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
- package/src/shared/infrastructure/orkeon/code-index.ts +120 -0
- package/src/shared/infrastructure/orkeon/crew-host.ts +27 -0
- package/src/shared/infrastructure/orkeon/crew-memory.ts +12 -0
- package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
- package/src/shared/infrastructure/orkeon/dev-deps.ts +179 -0
- package/src/shared/infrastructure/orkeon/files.ts +58 -0
- package/src/shared/infrastructure/orkeon/github-pull-requests.ts +30 -0
- package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
- package/src/shared/infrastructure/orkeon/host-provider.ts +22 -0
- package/src/shared/infrastructure/orkeon/human-input.ts +55 -0
- package/src/shared/infrastructure/orkeon/llm-profile.ts +58 -0
- package/src/shared/infrastructure/orkeon/llm.ts +164 -0
- package/src/shared/infrastructure/orkeon/markers.ts +6 -0
- package/src/shared/infrastructure/orkeon/memory-store.ts +41 -0
- package/src/shared/infrastructure/orkeon/memory-tools.ts +129 -0
- package/src/shared/infrastructure/orkeon/messages.ts +15 -0
- package/src/shared/infrastructure/orkeon/permission-rules.ts +42 -0
- package/src/shared/infrastructure/orkeon/progress.ts +24 -0
- package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
- package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
- package/src/shared/infrastructure/orkeon/run-state.ts +17 -0
- package/src/shared/infrastructure/orkeon/runtime-info.ts +30 -0
- package/src/shared/infrastructure/orkeon/runtime-tools.ts +60 -0
- package/src/shared/infrastructure/orkeon/script-tools.ts +129 -0
- package/src/shared/infrastructure/orkeon/session-store.ts +94 -0
- package/src/shared/infrastructure/orkeon/session-switch.ts +23 -0
- package/src/shared/infrastructure/orkeon/shared-memory.ts +61 -0
- package/src/shared/infrastructure/orkeon/shell-jobs.ts +81 -0
- package/src/shared/infrastructure/orkeon/shell.ts +39 -0
- package/src/shared/infrastructure/orkeon/telemetry.ts +63 -0
- package/src/shared/infrastructure/orkeon/tool-catalogue.ts +76 -0
- package/src/shared/infrastructure/orkeon/tool-results.ts +120 -0
- package/src/shared/infrastructure/orkeon/usage.ts +74 -0
- package/src/shared/infrastructure/orkeon/wiring.ts +174 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// The human-input port: a question to the person at the terminal.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** A question to the person at the terminal (`human_input`). Each call says whether a person answered: an
|
|
5
|
+
* unattended host answers on nobody's behalf, and that answer is never taken (`answered: false`). */
|
|
6
|
+
export interface HumanInput {
|
|
7
|
+
/** One of `options`, the first one recommended; `value` is the option picked. */
|
|
8
|
+
choice(prompt: string, options: readonly string[]): Promise<{ answered: true; value: string } | { answered: false }>;
|
|
9
|
+
/** Free text; an empty answer is no answer. */
|
|
10
|
+
text(prompt: string): Promise<{ answered: true; value: string } | { answered: false }>;
|
|
11
|
+
/** Several of `options`, none recommended: the options picked, in the order given. */
|
|
12
|
+
multi(prompt: string, options: readonly string[]): Promise<{ answered: true; values: string[] } | { answered: false }>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** One option of a `Chooser` question. */
|
|
16
|
+
export interface ChoiceOption {
|
|
17
|
+
value: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Aligned in a column after the label. */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** The value in force, marked in the list and selected on opening. */
|
|
22
|
+
current?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ChoiceQuestion {
|
|
26
|
+
message: string;
|
|
27
|
+
options: readonly ChoiceOption[];
|
|
28
|
+
/** A second value, adjusted with the side arrows while an option is selected. */
|
|
29
|
+
control?: { label: string; values: readonly string[]; value: string };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A choice made in the console's own panel, for a command typed at the prompt. Unlike `HumanInput`, which a crew's
|
|
33
|
+
* tool call goes through, it can be left: `null` is the person leaving, and nothing is to change. */
|
|
34
|
+
export interface Chooser {
|
|
35
|
+
/** False on a replay or a plain console: the command keeps its behaviour without a panel. */
|
|
36
|
+
readonly interactive: boolean;
|
|
37
|
+
choose(question: ChoiceQuestion): Promise<{ value: string; control: string | null } | null>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// The model port: the agentic call, the completion and the extraction, with their per-call settings.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
import type { EffortLevel } from "../../domain/agent-policy/behavior-flags.ts";
|
|
4
|
+
import type { EffortReport, ReasoningCapabilities, ReasoningTarget } from "../../domain/agent-policy/reasoning.ts";
|
|
5
|
+
import type { ContextPressure, PressureSettings, PruneVerdict } from "../../domain/context-prune.ts";
|
|
6
|
+
|
|
7
|
+
/** What one model call may change, for that call only. */
|
|
8
|
+
export interface ModelOverride {
|
|
9
|
+
/** The model to answer with; the host's provider keeps its credentials and
|
|
10
|
+
* endpoint. Empty or absent: the model the host booted with. */
|
|
11
|
+
model?: string;
|
|
12
|
+
/** The host profile (`Llm:Profiles:<name>`, or a decision profile) this one call runs on, `model` then choosing
|
|
13
|
+
* the model within it. Empty or absent: the agent's own profile. A name the host does not declare throws. */
|
|
14
|
+
profile?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The settings of one completion. */
|
|
18
|
+
export interface CompleteRequest extends ModelOverride {
|
|
19
|
+
/** The system message the completion starts with, the prompt then being the user
|
|
20
|
+
* message: a crew's instructions at system authority, its material (a diff, a
|
|
21
|
+
* transcript, an answer under review) as the user's. Absent: the prompt alone. */
|
|
22
|
+
system?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The settings of one agentic call. */
|
|
26
|
+
export interface ActRequest extends ModelOverride {
|
|
27
|
+
/** The system message the conversation starts with. */
|
|
28
|
+
system?: string;
|
|
29
|
+
/** The context of the call (memory, repository state, earlier turns): a user message of its own, after `system`
|
|
30
|
+
* and before the prompt, so the prompt stays the last user message, the request a decision profile judges
|
|
31
|
+
* (Orkeon #276). Absent or blank: no message. */
|
|
32
|
+
context?: string;
|
|
33
|
+
/** Tool-call iterations granted; the runtime's default when absent. */
|
|
34
|
+
maxIterations?: number;
|
|
35
|
+
/** The mode the host's permission gate applies to each tool call. */
|
|
36
|
+
permissionMode?: string;
|
|
37
|
+
/** The provider's thinking at this level (`act({effort})`); none when absent. A level the provider or the model
|
|
38
|
+
* does not take is sent as another one (the highest it takes below, else the lowest it takes) or dropped by the
|
|
39
|
+
* runtime, with a warning in its log: `Llm.effortSent` says which. */
|
|
40
|
+
effort?: EffortLevel;
|
|
41
|
+
/** The agent's tools offered for this call (a role's subset); all of them when absent. */
|
|
42
|
+
tools?: readonly string[];
|
|
43
|
+
/** Asked by the runtime before a model turn once the loop's messages pass `contextPressure.thresholdTokens`
|
|
44
|
+
* (Orkeon #327): the older results of the read tools that ran, answered by call id. A call left out keeps its
|
|
45
|
+
* result; a callback that throws prunes nothing. Absent: nothing is pruned. */
|
|
46
|
+
onContextPressure?: (pressure: ContextPressure) => Promise<Record<string, PruneVerdict> | void>;
|
|
47
|
+
/** When `onContextPressure` runs and what a `head` verdict keeps; the runtime's defaults when absent. */
|
|
48
|
+
contextPressure?: PressureSettings;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The model, as the crews call it. Every call throws when the host's provider
|
|
52
|
+
* fails; a failed `act` or `complete` throws an LlmFailure (shared/domain/llm-failure.ts), and a call a
|
|
53
|
+
* decision stage of the host blocked rejects with the runtime's DecisionBlockedError (decisionBlockOf). */
|
|
54
|
+
export interface Llm {
|
|
55
|
+
/** The model ⇄ tool-call loop over the running agent's tools, under the crew's
|
|
56
|
+
* budget; resolves to the final answer's text. A token budget that ran out
|
|
57
|
+
* rejects with a BudgetExhaustedAnswer (shared/domain/llm-failure.ts) carrying
|
|
58
|
+
* the wrap-up the model made without tools: never resolved as an answer. */
|
|
59
|
+
act(prompt: string, request: ActRequest): Promise<string>;
|
|
60
|
+
/** One completion, without tools; with `request.system`, a system message first. */
|
|
61
|
+
complete(prompt: string, request?: CompleteRequest): Promise<string>;
|
|
62
|
+
/** A JSON answer shaped by `schema`; throws when the reply does not parse. */
|
|
63
|
+
extract(prompt: string, schema: object): Promise<unknown>;
|
|
64
|
+
/** Whether the host's permission gate checks the tool calls of `act`: false, the mode and the
|
|
65
|
+
* session's rules check nothing; undefined when the facade does not say (a test's). */
|
|
66
|
+
permissionGateEnabled(): boolean | undefined;
|
|
67
|
+
/** What an act with this request sends for its effort (Orkeon #360), judged on the running agent's provider and
|
|
68
|
+
* model, the request's profile and model over them; places no call. A request and a crew that ask for no effort
|
|
69
|
+
* give what the host's own configuration sends. Null when nothing asks for an effort, or the host cannot tell.
|
|
70
|
+
* Null too for a request naming a profile the host does not declare: its act is the one that fails. */
|
|
71
|
+
effortSent(request: Pick<ActRequest, "effort" | "model" | "profile">): EffortReport | null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** What the host's models take for reasoning, read by a command before any call (Orkeon #359, #360): the runtime's
|
|
75
|
+
* own judgement, the host's `Llm:ModelCapabilities` included. Both answer null when the host cannot tell (no `llm`
|
|
76
|
+
* namespace, no provider), and for a target on a profile the host does not declare (Orkeon #364). */
|
|
77
|
+
export interface ReasoningReader {
|
|
78
|
+
/** What the model of `target` takes. */
|
|
79
|
+
capabilities(target: ReasoningTarget): ReasoningCapabilities | null;
|
|
80
|
+
/** What a call on `target` asking for `level` sends; with no level, what the host's own configuration sends
|
|
81
|
+
* (`Llm:Thinking:Effort`), null when it asks for none. */
|
|
82
|
+
effort(target: ReasoningTarget, level: EffortLevel | null): EffortReport | null;
|
|
83
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// The typed-memory port: the entries that outlive compaction, and the session when the runtime persists them.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** A typed-memory entry as listed. */
|
|
5
|
+
export interface MemoryEntry {
|
|
6
|
+
/** The id /memory get and delete take; undefined when the host reports none. */
|
|
7
|
+
id?: number;
|
|
8
|
+
/** Undefined when the host reports none. */
|
|
9
|
+
category?: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Typed memory (user, project, feedback, reference), which outlives compaction, and the session when the runtime
|
|
14
|
+
* keeps it per project (`Orkeon:Cli:Memory:Persist`, Orkeon #286). Every call throws when the store cannot answer. */
|
|
15
|
+
export interface MemoryStore {
|
|
16
|
+
/** The entries of one category, or of every category when none is named, in stored order, or the newest first
|
|
17
|
+
* when `newestFirst` is set (Orkeon #286). */
|
|
18
|
+
list(category?: string, options?: { newestFirst?: boolean }): Promise<MemoryEntry[]>;
|
|
19
|
+
/** Store an entry; resolves to its id as the host reports it, as text (`null` or
|
|
20
|
+
* `undefined` when it reports none): /memory add prints it as is. */
|
|
21
|
+
add(category: string, content: string): Promise<string>;
|
|
22
|
+
/** The entry `id` as the host reports it, its own field casing included (/memory get
|
|
23
|
+
* prints it verbatim), else the host's error; undefined when it reports neither. */
|
|
24
|
+
get(id: number): Promise<unknown>;
|
|
25
|
+
/** Delete the entry `id`; false when the host does not report a success. */
|
|
26
|
+
remove(id: number): Promise<boolean>;
|
|
27
|
+
/** Put `content` in place of the entry `id`'s, which keeps its id and category (Orkeon #286); false when the host
|
|
28
|
+
* does not report a success. */
|
|
29
|
+
replace(id: number, content: string): Promise<boolean>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// The progress port: the host's progress line, best effort.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
export interface ProgressSpec {
|
|
5
|
+
/** Headline of the operation, e.g. "Compacting conversation". */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Current step (1-based) for step-wise operations. */
|
|
8
|
+
step?: number;
|
|
9
|
+
/** Total step count, when known. */
|
|
10
|
+
total?: number;
|
|
11
|
+
/** Completion ratio in [0, 100]. */
|
|
12
|
+
percent?: number;
|
|
13
|
+
/** Current-phase line, e.g. "extracting memories". */
|
|
14
|
+
message?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The host's progress line. Best effort by contract: progress is decoration, so
|
|
18
|
+
* neither call ever throws, and a host without a progress channel ignores both. */
|
|
19
|
+
export interface Progress {
|
|
20
|
+
report(spec: ProgressSpec): Promise<void>;
|
|
21
|
+
/** Release the progress slot of `label`. */
|
|
22
|
+
done(label: string): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The runtime port: the Orkeon that runs the command, as the host names itself (Orkeon #225).
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** The runtime that runs the command: its release, the commit its build metadata carries (null when none)
|
|
5
|
+
* and the channel it was installed through (`deb`, `tarball`, `source`, `dotnet-tool`, `unknown`). */
|
|
6
|
+
export interface RuntimeInfo {
|
|
7
|
+
version: string;
|
|
8
|
+
commit: string | null;
|
|
9
|
+
channel: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The reader of the running runtime; undefined when the host names none, or the read fails. */
|
|
13
|
+
export interface RuntimeInfoReader {
|
|
14
|
+
read(): RuntimeInfo | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The session port: the conversation buffer, the state bag and the context window's budget.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
import type { SessionMsg } from "../../domain/types.ts";
|
|
5
|
+
|
|
6
|
+
/** A conversation-buffer entry as the session holds it. Its field casing is the
|
|
7
|
+
* runtime's, so it is read through `SessionMessages.messages`; written back as
|
|
8
|
+
* read, it stays untouched. */
|
|
9
|
+
export type StoredMessage = unknown;
|
|
10
|
+
|
|
11
|
+
/** The conversation buffer, read once. */
|
|
12
|
+
export interface SessionMessages {
|
|
13
|
+
/** Each entry as stored, in order. */
|
|
14
|
+
stored: StoredMessage[];
|
|
15
|
+
/** The same entries, as role and content. */
|
|
16
|
+
messages: SessionMsg[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The tokens of the context window by kind of entry (Orkeon #226). */
|
|
20
|
+
export interface TokenKinds {
|
|
21
|
+
system: number;
|
|
22
|
+
user: number;
|
|
23
|
+
assistant: number;
|
|
24
|
+
tool: number;
|
|
25
|
+
other: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Tokens used in the context window, and the window's size; by kind when the host reports it. */
|
|
29
|
+
export interface TokenBudget {
|
|
30
|
+
used: number;
|
|
31
|
+
window: number;
|
|
32
|
+
byKind?: TokenKinds;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** What a snip of the conversation buffer removed and kept, in entries. */
|
|
36
|
+
export interface SnipResult {
|
|
37
|
+
removed: number;
|
|
38
|
+
retained: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The session saved now, and a saved one loaded in place (Orkeon #227): served while the host persists the
|
|
42
|
+
* session per project (`Orkeon:Cli:Session:Persist`), at virtual paths the file system mounts. */
|
|
43
|
+
export interface SessionSwitch {
|
|
44
|
+
/** Write the session now: to its own file, resolving to that virtual path, or to `path` in the same shape. */
|
|
45
|
+
save(path?: string): Promise<string>;
|
|
46
|
+
/** Swap the buffer, the state bag, the id and the title for those of the file at `path`; resolves to the number
|
|
47
|
+
* of messages loaded. A missing, unreadable or ill-shaped file rejects and the session stays as it was. */
|
|
48
|
+
load(path: string): Promise<number>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The session: its conversation buffer, its state bag (string values that survive
|
|
52
|
+
* crew runs and are cleared by /clear), the context window's budget and
|
|
53
|
+
* the session's title. */
|
|
54
|
+
export interface SessionStore {
|
|
55
|
+
readMessages(): Promise<SessionMessages>;
|
|
56
|
+
/** Replace the conversation buffer. */
|
|
57
|
+
writeMessages(messages: readonly StoredMessage[]): Promise<void>;
|
|
58
|
+
/** Add one entry at the end of the buffer, which is neither read nor rewritten (Orkeon #263). */
|
|
59
|
+
appendMessage(role: string, content: string): Promise<void>;
|
|
60
|
+
/** Empty the conversation buffer; resolves to how many entries it removed. */
|
|
61
|
+
reset(): Promise<number>;
|
|
62
|
+
/** Cut the buffer down to its head and its last `turns` turns as the runtime counts them (Orkeon #287): a turn opens
|
|
63
|
+
* at each user message, the stored [turn-context] included, and is never split. Fewer turns than asked, or none
|
|
64
|
+
* after the head, leave the buffer untouched (0 removed). */
|
|
65
|
+
snip(turns: number): Promise<SnipResult>;
|
|
66
|
+
setTitle(title: string): Promise<void>;
|
|
67
|
+
/** A state value; null when unset. */
|
|
68
|
+
readState(key: string): Promise<string | null>;
|
|
69
|
+
/** Several state values in one read (Orkeon #263): every key asked, null when unset. */
|
|
70
|
+
readStates(keys: readonly string[]): Promise<Record<string, string | null>>;
|
|
71
|
+
/** Set a state value; null removes the key. */
|
|
72
|
+
writeState(key: string, value: string | null): Promise<void>;
|
|
73
|
+
readBudget(): Promise<TokenBudget>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// The shared-memory port: the RAG index of the project's shared memory.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** A passage of the shared memory's index: the file it comes from (virtual path) and its score. */
|
|
5
|
+
export interface SharedHit {
|
|
6
|
+
sourceId: string;
|
|
7
|
+
score: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** What an ingestion of the shared memory's index did, by source. */
|
|
11
|
+
export interface SharedIngest {
|
|
12
|
+
added: number;
|
|
13
|
+
reingested: number;
|
|
14
|
+
unchanged: number;
|
|
15
|
+
pruned: number;
|
|
16
|
+
errors: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The RAG index of the shared memory (one collection per project, `memory-<project>`); its files are read and
|
|
20
|
+
* written through Files. Each call throws when the host cannot answer it (no RAG subsystem). */
|
|
21
|
+
export interface SharedMemory {
|
|
22
|
+
/** The best passages for `query`, one per source file, best first. */
|
|
23
|
+
search(collection: string, query: string, topN: number): Promise<SharedHit[]>;
|
|
24
|
+
/** Index `sources` (virtual paths or globs); `prune` drops the sources of the collection absent from them. */
|
|
25
|
+
ingest(collection: string, sources: readonly string[], options: { prune: boolean }): Promise<SharedIngest>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The shell ports: one command run to its end, and the commands run detached as jobs.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** The outcome of one shell command. */
|
|
5
|
+
export interface ShellResult {
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
/** -1 when the runtime reported none. */
|
|
9
|
+
exitCode: number;
|
|
10
|
+
/** True when the runtime stopped the command at its timeout; absent otherwise. */
|
|
11
|
+
timedOut?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** How one command runs. */
|
|
15
|
+
export interface ShellOptions {
|
|
16
|
+
/** Whole seconds before the runtime stops the command; the runtime's default when absent. */
|
|
17
|
+
timeoutSeconds?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Runs shell commands in the project's working directory, /workspace. A command
|
|
21
|
+
* the runtime refuses or cannot run throws; a failing one returns its exit code. */
|
|
22
|
+
export interface Shell {
|
|
23
|
+
run(command: string, options?: ShellOptions): Promise<ShellResult>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Where a detached job stands: running, or exited with its code (-1 when it ended without one). */
|
|
27
|
+
export interface ShellJobStatus { running: boolean; exitCode: number }
|
|
28
|
+
|
|
29
|
+
/** Commands run detached (the runtime's shell jobs): a long suite outlives no shell timeout, its whole
|
|
30
|
+
* output goes to a log file, and the caller reads its tail. A job belongs to the running crew and is
|
|
31
|
+
* stopped when the crew's run ends. A call the runtime refuses throws. */
|
|
32
|
+
export interface ShellJobs {
|
|
33
|
+
/** Starts `command` in /workspace; its id and the virtual path of its log. */
|
|
34
|
+
start(command: string): Promise<{ id: string; log: string }>;
|
|
35
|
+
status(id: string): Promise<ShellJobStatus>;
|
|
36
|
+
/** The last `lines` lines of the job's log (500 at most). */
|
|
37
|
+
tail(id: string, lines: number): Promise<string>;
|
|
38
|
+
/** Waits about `seconds` (code has no timer of its own); false when it cannot wait here. */
|
|
39
|
+
wait(seconds: number): Promise<boolean>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The telemetry port: what the host reports about the session and its LLM usage.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** What the host reports about the session. A field it did not report is undefined. */
|
|
5
|
+
export interface SessionMetadata {
|
|
6
|
+
title?: string;
|
|
7
|
+
/** The model the host booted with. */
|
|
8
|
+
model?: string;
|
|
9
|
+
messageCount?: number;
|
|
10
|
+
estimatedTokens?: number;
|
|
11
|
+
/** The models the host declares (`Llm:AvailableModels`), trimmed and deduplicated. */
|
|
12
|
+
availableModels?: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The session's cumulative LLM usage. */
|
|
16
|
+
export interface SessionCost {
|
|
17
|
+
costUsd?: number;
|
|
18
|
+
totalTokens?: number;
|
|
19
|
+
totalCalls?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The session's telemetry: its LLM usage plus the buffer's counters. */
|
|
23
|
+
export interface SessionStats extends SessionCost {
|
|
24
|
+
messageCount?: number;
|
|
25
|
+
estimatedTokens?: number;
|
|
26
|
+
/** Prompt tokens sent, over every model, as the providers counted them, when the host reports them. */
|
|
27
|
+
promptTokens?: number;
|
|
28
|
+
/** Completion tokens received, over every model, as the providers counted them, when the host reports them. */
|
|
29
|
+
completionTokens?: number;
|
|
30
|
+
/** Prompt tokens read from the provider's cache (the hits), summed over the models that report them; undefined
|
|
31
|
+
* when none does (Orkeon #254: not measured, never 0). */
|
|
32
|
+
cacheHitTokens?: number;
|
|
33
|
+
/** Prompt tokens written to the provider's cache, summed over the models that report them; undefined when none does. */
|
|
34
|
+
cacheWriteTokens?: number;
|
|
35
|
+
/** Completion tokens spent reasoning, summed over the models that report them; undefined when none does. */
|
|
36
|
+
reasoningTokens?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The host's account of the session. Each read throws when the host cannot
|
|
40
|
+
* answer it; callers that only display a value catch and show what they have. */
|
|
41
|
+
export interface Telemetry {
|
|
42
|
+
readMetadata(): Promise<SessionMetadata>;
|
|
43
|
+
readCost(): Promise<SessionCost>;
|
|
44
|
+
readStats(): Promise<SessionStats>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The palette port: the console's palette for this session. Types only, re-exported by ../ports.ts.
|
|
2
|
+
|
|
3
|
+
export type ThemeName = "dark" | "light" | "none";
|
|
4
|
+
|
|
5
|
+
/** The part of the command context the palette goes through; the context itself is the adapter. */
|
|
6
|
+
export interface ThemeConsole {
|
|
7
|
+
/** Null on a console without palettes (a plain console). */
|
|
8
|
+
readonly theme: ThemeName | null;
|
|
9
|
+
/** False on a console without palettes, which stays as it is. */
|
|
10
|
+
setTheme(name: ThemeName): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// The tool ports: the host's registered tools, a tool call read as text, and the permission gate's session rules.
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
import type { PermissionRule } from "../../domain/agent-policy/permission.ts";
|
|
5
|
+
|
|
6
|
+
/** One tool call read as text: the tool's text, or its own failure message, the
|
|
7
|
+
* runtime's wrapping gone. */
|
|
8
|
+
export type ToolOutcome = { ok: true; text: string } | { ok: false; failure: string };
|
|
9
|
+
|
|
10
|
+
/** The tools the host registers, by the names it registers them under (`file_read`,
|
|
11
|
+
* an MCP server's `get-file-contents` or `listIssues`): a diagnostic view and the
|
|
12
|
+
* check of the extra tools, apart from the catalogue a mode hands the model
|
|
13
|
+
* (shared/domain/agent-policy). Orkeon matches a tool name case-insensitively (an
|
|
14
|
+
* agent's `.tools([...])`, the gate's rules), and so does `find`. */
|
|
15
|
+
export interface ToolCatalogue {
|
|
16
|
+
/** Every registered name, as registered, sorted. */
|
|
17
|
+
names(): string[];
|
|
18
|
+
/** The registered name `name` designates, compared case-insensitively; undefined
|
|
19
|
+
* when the host registers no such tool. */
|
|
20
|
+
find(name: string): string | undefined;
|
|
21
|
+
/** Call the tool `name` designates with `args` as given; resolves to its raw
|
|
22
|
+
* result, throws its failure, or that no registered tool answers to `name`. */
|
|
23
|
+
call(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
24
|
+
/** The same call, decoded: the result as text, or the tool's own failure message
|
|
25
|
+
* (that no registered tool answers to `name` included). Never throws. */
|
|
26
|
+
callText(name: string, args: Record<string, unknown>): Promise<ToolOutcome>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The session rules of the host's permission gate, which it reads at every tool
|
|
30
|
+
* call before the mode: a deny refuses a matching call in every mode, an allow
|
|
31
|
+
* lets it run without asking in every mode but `plan`. The host keeps them until
|
|
32
|
+
* it exits, and removes them only all at once. */
|
|
33
|
+
export interface PermissionRules {
|
|
34
|
+
/** Whether the host keeps session rules (orkeon-repl does). When it does not,
|
|
35
|
+
* the gate decides from the mode alone and every other call throws. */
|
|
36
|
+
available(): boolean;
|
|
37
|
+
/** Whether the host's gate is on (`Orkeon:Security:PermissionGate:Enabled`): false, no rule
|
|
38
|
+
* and no mode is enforced; undefined when the host keeps no session rules. */
|
|
39
|
+
enabled(): boolean | undefined;
|
|
40
|
+
/** Put a rule in force; a rule already in force is kept once. */
|
|
41
|
+
add(rule: PermissionRule): void;
|
|
42
|
+
/** Remove every rule. */
|
|
43
|
+
clear(): void;
|
|
44
|
+
/** The rules in force, one line each: `allow shell_command command=npm test*`. */
|
|
45
|
+
list(): string[];
|
|
46
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The usage port: the session's LLM usage by category, as the host accounts it (Orkeon #226).
|
|
2
|
+
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
|
|
4
|
+
/** The tokens of a set of calls: the cache counts are a part of the prompt, the reasoning a part of the completion.
|
|
5
|
+
* A cache or reasoning count is null when no call of the set reported it (Orkeon #254): not measured, never 0. */
|
|
6
|
+
export interface UsageTokens {
|
|
7
|
+
promptTokens: number;
|
|
8
|
+
completionTokens: number;
|
|
9
|
+
cacheHitTokens: number | null;
|
|
10
|
+
cacheWriteTokens: number | null;
|
|
11
|
+
reasoningTokens: number | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** What a set of calls spent: `cost` is null when no call of the set was priced; `unpricedCalls` counts the calls
|
|
15
|
+
* nobody priced, which `cost` counts as 0 (while it is not 0, the cost is a lower bound). */
|
|
16
|
+
export interface UsageSpent extends UsageTokens {
|
|
17
|
+
calls: number;
|
|
18
|
+
unpricedCalls: number;
|
|
19
|
+
cost: number | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** One model the provider named in its answers. */
|
|
23
|
+
export interface ModelUsage extends UsageSpent {
|
|
24
|
+
model: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** One command instance the session keeps, the newest first. */
|
|
28
|
+
export interface CommandUsage extends UsageSpent {
|
|
29
|
+
ticket: string;
|
|
30
|
+
name: string;
|
|
31
|
+
state: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The session's usage of the moment: the totals over every recorded call (a call whose provider named no model is
|
|
35
|
+
* in the totals and in no model row), then by model and by command. */
|
|
36
|
+
export interface UsageReport extends UsageSpent {
|
|
37
|
+
totalTokens: number;
|
|
38
|
+
byModel: ModelUsage[];
|
|
39
|
+
byCommand: CommandUsage[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The reader of the session's usage; undefined when the host keeps no account, or the read fails. */
|
|
43
|
+
export interface UsageReader {
|
|
44
|
+
report(): UsageReport | undefined;
|
|
45
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The ports: what the application layer needs from outside, named after that need
|
|
2
|
+
// rather than after the runtime that provides it. One file per concern under ports/,
|
|
3
|
+
// re-exported here so that every importer names this module; types only, so it is
|
|
4
|
+
// erased from every bundle. A new port goes in ports/<concern>.ts, plus its line below.
|
|
5
|
+
// The Orkeon adapters live in shared/infrastructure/orkeon/ (and are wired by entry
|
|
6
|
+
// points), the test doubles in tests/support/doubles/.
|
|
7
|
+
|
|
8
|
+
export type { Clock } from "./ports/clock.ts";
|
|
9
|
+
export type { ShellResult, ShellOptions, Shell, ShellJobStatus, ShellJobs } from "./ports/shell.ts";
|
|
10
|
+
export type { Mount, Files } from "./ports/files.ts";
|
|
11
|
+
export type { ProgressSpec, Progress } from "./ports/progress.ts";
|
|
12
|
+
export type {
|
|
13
|
+
StoredMessage, SessionMessages, TokenKinds, TokenBudget, SnipResult, SessionStore, SessionSwitch,
|
|
14
|
+
} from "./ports/session.ts";
|
|
15
|
+
export type { SessionMetadata, SessionCost, SessionStats, Telemetry } from "./ports/telemetry.ts";
|
|
16
|
+
export type { RuntimeInfo, RuntimeInfoReader } from "./ports/runtime.ts";
|
|
17
|
+
export type { UsageTokens, UsageSpent, ModelUsage, CommandUsage, UsageReport, UsageReader } from "./ports/usage.ts";
|
|
18
|
+
export type { MemoryEntry, MemoryStore } from "./ports/memory.ts";
|
|
19
|
+
export type { ToolOutcome, ToolCatalogue, PermissionRules } from "./ports/tools.ts";
|
|
20
|
+
export type { CrewHost, CrewLaunchOptions, ChildRuntime, Logger, RunState, CrewMemory } from "./ports/crew.ts";
|
|
21
|
+
export type { ModelOverride, CompleteRequest, ActRequest, Llm, ReasoningReader } from "./ports/llm.ts";
|
|
22
|
+
export type { ChoiceOption, ChoiceQuestion, Chooser, HumanInput } from "./ports/human.ts";
|
|
23
|
+
export type { ThemeConsole, ThemeName } from "./ports/theme.ts";
|
|
24
|
+
export type { PendingApproval, PendingApprovals } from "./ports/approvals.ts";
|
|
25
|
+
export type {
|
|
26
|
+
MapLevel, CodeMap, CodeSearchHit, SymbolLocation, CodeIndex, AnchorClosure, AnchorIndex, CostIndex, AffectedTests,
|
|
27
|
+
} from "./ports/code-index.ts";
|
|
28
|
+
export type { SharedHit, SharedIngest, SharedMemory } from "./ports/shared-memory.ts";
|
|
29
|
+
export type { DecisionModel } from "./ports/decision.ts";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Reading the project manifests and the CI workflows, shared by /init (project-init) and
|
|
2
|
+
// /init-verifiers: the files that exist, each cut at MAX_CONFIG_FILE_CHARS, in the order of the domain
|
|
3
|
+
// module (commands first, rules after), and their rendering as material, bounded as a whole.
|
|
4
|
+
|
|
5
|
+
import type { Files } from "./ports.ts";
|
|
6
|
+
import {
|
|
7
|
+
CI_WORKFLOWS_DIR, COMMAND_MANIFESTS, CONFIG_CANDIDATES, MAX_CONFIG_FILE_CHARS, MAX_MANIFESTS_MATERIAL_CHARS,
|
|
8
|
+
RULE_CONFIGS, cutLine, expandCandidates, isSuffixCandidate, leftOutLine,
|
|
9
|
+
} from "../domain/project-manifests.ts";
|
|
10
|
+
import { WORKSPACE } from "../domain/vfs.ts";
|
|
11
|
+
|
|
12
|
+
/** Entries of the workspace root listed to match the suffix candidates (`*.csproj`). */
|
|
13
|
+
const MAX_TOP_LEVEL_ENTRIES = 200;
|
|
14
|
+
/** Workflow files listed under CI_WORKFLOWS_DIR. */
|
|
15
|
+
const MAX_WORKFLOWS = 20;
|
|
16
|
+
|
|
17
|
+
/** A manifest as read: its path relative to the workspace root, its content cut at MAX_CONFIG_FILE_CHARS;
|
|
18
|
+
* `cut`, when set, the characters left out of its end. */
|
|
19
|
+
export interface ManifestText { path: string; content: string; cut?: number }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The manifests of `candidates` that exist and are not empty, in candidate order. A suffix candidate
|
|
23
|
+
* (`*.csproj`) is matched against one listing of the workspace root, made only when `files` can list
|
|
24
|
+
* and a suffix candidate is asked; without `list` it is skipped. An absent or unreadable file is skipped.
|
|
25
|
+
*/
|
|
26
|
+
export async function readManifests(
|
|
27
|
+
files: Pick<Files, "read"> & Partial<Pick<Files, "list">>,
|
|
28
|
+
candidates: readonly string[] = CONFIG_CANDIDATES,
|
|
29
|
+
): Promise<ManifestText[]> {
|
|
30
|
+
let topLevel: string[] = [];
|
|
31
|
+
if (files.list && candidates.some(isSuffixCandidate)) {
|
|
32
|
+
try {
|
|
33
|
+
topLevel = await files.list(WORKSPACE, MAX_TOP_LEVEL_ENTRIES);
|
|
34
|
+
} catch { /* unlistable — the suffix candidates match nothing */ }
|
|
35
|
+
}
|
|
36
|
+
const found: ManifestText[] = [];
|
|
37
|
+
for (const path of expandCandidates(candidates, topLevel)) {
|
|
38
|
+
try {
|
|
39
|
+
const content = await files.read(`${WORKSPACE}/${path}`);
|
|
40
|
+
if (content.length === 0) continue;
|
|
41
|
+
const cut = content.length - MAX_CONFIG_FILE_CHARS;
|
|
42
|
+
found.push(cut > 0 ? { path, content: content.slice(0, MAX_CONFIG_FILE_CHARS), cut } : { path, content });
|
|
43
|
+
} catch { /* absent or unreadable — skip */ }
|
|
44
|
+
}
|
|
45
|
+
return found;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The file names under CI_WORKFLOWS_DIR; none when the folder is absent. */
|
|
49
|
+
export async function listCiWorkflows(files: Pick<Files, "list">): Promise<string[]> {
|
|
50
|
+
try {
|
|
51
|
+
return await files.list(`${WORKSPACE}/${CI_WORKFLOWS_DIR}`, MAX_WORKFLOWS);
|
|
52
|
+
} catch {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The CI workflows under CI_WORKFLOWS_DIR as manifests (path `.github/workflows/<name>`), in listing
|
|
59
|
+
* order, each cut at MAX_CONFIG_FILE_CHARS: often the only place the project's real check sequence is
|
|
60
|
+
* written. None when the folder is absent; an empty or unreadable file is skipped.
|
|
61
|
+
*/
|
|
62
|
+
export async function readCiWorkflows(files: Pick<Files, "list" | "read">): Promise<ManifestText[]> {
|
|
63
|
+
const paths = (await listCiWorkflows(files)).map((name) => `${CI_WORKFLOWS_DIR}/${name}`);
|
|
64
|
+
return await readManifests(files, paths);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Every configuration both crews read, in the domain's order rule: the manifests that state commands, then
|
|
69
|
+
* the CI workflows, then the configurations that state rules, `CONTRIBUTING.md` last.
|
|
70
|
+
*/
|
|
71
|
+
export async function readConfigFiles(files: Pick<Files, "list" | "read">): Promise<ManifestText[]> {
|
|
72
|
+
return [
|
|
73
|
+
...await readManifests(files, COMMAND_MANIFESTS),
|
|
74
|
+
...await readCiWorkflows(files),
|
|
75
|
+
...await readManifests(files, RULE_CONFIGS),
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** One `<file path="…">` block, its cut line closing it when the manifest was cut. */
|
|
80
|
+
function fileBlock(m: ManifestText): string {
|
|
81
|
+
const cut = (m.cut ?? 0) > 0 ? `\n${cutLine(m.cut ?? 0)}` : "";
|
|
82
|
+
return `<file path="${m.path}">\n${m.content}${cut}\n</file>`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The manifests as material: one `<file path="…">` block each, in order, whole files kept while the total
|
|
87
|
+
* stays within `max` characters (a block that does not fit is left out, a later smaller one may still fit),
|
|
88
|
+
* then a line naming the files left out when there are any.
|
|
89
|
+
*/
|
|
90
|
+
export function manifestsAsMaterial(manifests: readonly ManifestText[], max = MAX_MANIFESTS_MATERIAL_CHARS): string {
|
|
91
|
+
const kept: string[] = [];
|
|
92
|
+
const leftOut: string[] = [];
|
|
93
|
+
let size = 0;
|
|
94
|
+
for (const m of manifests) {
|
|
95
|
+
const block = fileBlock(m);
|
|
96
|
+
const added = block.length + (kept.length > 0 ? 1 : 0);
|
|
97
|
+
if (size + added > max) {
|
|
98
|
+
leftOut.push(m.path);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
kept.push(block);
|
|
102
|
+
size += added;
|
|
103
|
+
}
|
|
104
|
+
if (leftOut.length > 0) kept.push(leftOutLine(leftOut, max));
|
|
105
|
+
return kept.join("\n");
|
|
106
|
+
}
|