@ouro.bot/cli 0.1.0-alpha.1469 → 0.1.0-alpha.1470
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/README.md +1 -1
- package/changelog.json +6 -2
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/desk.lock.json +8 -0
- package/dist/heart/identity.js +27 -1
- package/dist/mind/desk-section.js +33 -43
- package/dist/repertoire/desk-mcp.js +140 -0
- package/dist/repertoire/mcp-manager.js +22 -0
- package/dist/repertoire/mcp-tools.js +11 -7
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -1
- package/vendor/desk/.claude-plugin/plugin.json +35 -0
- package/vendor/desk/.mcp.claude-codex.json +28 -0
- package/vendor/desk/.mcp.copilot.json +16 -0
- package/vendor/desk/.ouro-desk.json +6 -0
- package/vendor/desk/CHANGELOG.md +7004 -0
- package/vendor/desk/README.md +195 -0
- package/vendor/desk/activation/README.md +98 -0
- package/vendor/desk/activation/copilot-root.flattened-bundle.json +38 -0
- package/vendor/desk/activation/desk.activation.json +251 -0
- package/vendor/desk/activation/host-capability-evidence.md +46 -0
- package/vendor/desk/activation/support-matrix.json +84 -0
- package/vendor/desk/agency.json +20 -0
- package/vendor/desk/agents/observer.agent.md +26 -0
- package/vendor/desk/agents/observer.md +29 -0
- package/vendor/desk/agents/worker.agent.md +32 -0
- package/vendor/desk/agents/worker.md +40 -0
- package/vendor/desk/artifacts/tombstones/tombstone.schema.json +53 -0
- package/vendor/desk/artifacts/tombstones/tombstones.jsonl +1 -0
- package/vendor/desk/changelog.d/README.md +12 -0
- package/vendor/desk/docs/agent-files.md +104 -0
- package/vendor/desk/docs/agentic-engineering-v2-rfc.md +206 -0
- package/vendor/desk/docs/agentic-engineering-v3-rfc.md +109 -0
- package/vendor/desk/docs/browser-remote-desktops.md +69 -0
- package/vendor/desk/docs/dependency-activation-stories-and-criteria.md +500 -0
- package/vendor/desk/docs/evaluation-packet.md +363 -0
- package/vendor/desk/docs/factory-local-capture.md +651 -0
- package/vendor/desk/docs/factory-store-playbook.md +927 -0
- package/vendor/desk/docs/images/factory-site.png +0 -0
- package/vendor/desk/docs/issue-drains.md +79 -0
- package/vendor/desk/docs/lfs-inspection.md +55 -0
- package/vendor/desk/docs/preview-diagnostics.md +11 -0
- package/vendor/desk/docs/relays.md +88 -0
- package/vendor/desk/docs/schedules.md +69 -0
- package/vendor/desk/docs/search-recovery.md +22 -0
- package/vendor/desk/docs/session-labels.md +157 -0
- package/vendor/desk/docs/session-retention.md +125 -0
- package/vendor/desk/docs/sessions.md +17 -0
- package/vendor/desk/docs/stalled-nudges.md +54 -0
- package/vendor/desk/docs/webhooks.md +80 -0
- package/vendor/desk/docs/workspace-tidy.md +74 -0
- package/vendor/desk/hooks/boot-checks.cjs +7 -0
- package/vendor/desk/hooks/claude-session-start.cjs +123 -0
- package/vendor/desk/hooks/compatible-node.cjs +97 -0
- package/vendor/desk/hooks/copilot-boot-prompt.cjs +69 -0
- package/vendor/desk/hooks/copilot-durable-files.cjs +8 -0
- package/vendor/desk/hooks/copilot-hooks.json +61 -0
- package/vendor/desk/hooks/copilot-intake-context.cjs +5 -0
- package/vendor/desk/hooks/copilot-lane-model.cjs +8 -0
- package/vendor/desk/hooks/copilot-session-start.cjs +264 -0
- package/vendor/desk/hooks/copilot-skill-current.cjs +28 -0
- package/vendor/desk/hooks/factory-end.cjs +5 -0
- package/vendor/desk/hooks/factory-start.cjs +27 -0
- package/vendor/desk/hooks/hooks.json +40 -0
- package/vendor/desk/hooks/lib/boot-checks.cjs +643 -0
- package/vendor/desk/hooks/lib/child-agent.cjs +14 -0
- package/vendor/desk/hooks/lib/copilot-intake-context.cjs +73 -0
- package/vendor/desk/hooks/lib/current-release.cjs +162 -0
- package/vendor/desk/hooks/lib/delivery-stop.cjs +326 -0
- package/vendor/desk/hooks/lib/detach-worker.cjs +43 -0
- package/vendor/desk/hooks/lib/durable-files.cjs +102 -0
- package/vendor/desk/hooks/lib/factory-end.cjs +327 -0
- package/vendor/desk/hooks/lib/lane-model.cjs +82 -0
- package/vendor/desk/hooks/lib/node-required.cjs +56 -0
- package/vendor/desk/hooks/lib/orca-session-title.cjs +60 -0
- package/vendor/desk/hooks/lib/session-end.cjs +30 -0
- package/vendor/desk/hooks/lib/sync-end.cjs +89 -0
- package/vendor/desk/hooks/loop-start.cjs +105 -0
- package/vendor/desk/hooks/node-missing.sh +78 -0
- package/vendor/desk/hooks/orca-session-title.cjs +8 -0
- package/vendor/desk/hooks/session-end.cjs +8 -0
- package/vendor/desk/mcp/README.md +269 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/support-matrix.json +72 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/README.md +25 -0
- package/vendor/desk/mcp/bootstrap.cjs +761 -0
- package/vendor/desk/mcp/docs/private-feedback.md +13 -0
- package/vendor/desk/mcp/idle-proxy.cjs +423 -0
- package/vendor/desk/mcp/index.js +813 -0
- package/vendor/desk/mcp/package-lock.json +3717 -0
- package/vendor/desk/mcp/package.json +44 -0
- package/vendor/desk/mcp/scripts/agency-desk-channel.js +7 -0
- package/vendor/desk/mcp/scripts/build-runtime-deps-pack.js +5 -0
- package/vendor/desk/mcp/scripts/crew.js +89 -0
- package/vendor/desk/mcp/scripts/drains-launcher.mjs +329 -0
- package/vendor/desk/mcp/scripts/drains.js +5 -0
- package/vendor/desk/mcp/scripts/factory.js +657 -0
- package/vendor/desk/mcp/scripts/file-desk-problem.js +9 -0
- package/vendor/desk/mcp/scripts/finish-commit.js +7 -0
- package/vendor/desk/mcp/scripts/lfs.js +37 -0
- package/vendor/desk/mcp/scripts/local-recovery.js +363 -0
- package/vendor/desk/mcp/scripts/migrations.js +11 -0
- package/vendor/desk/mcp/scripts/private-view.js +177 -0
- package/vendor/desk/mcp/scripts/resolve-desk-root.js +106 -0
- package/vendor/desk/mcp/scripts/session-boot.js +22 -0
- package/vendor/desk/mcp/scripts/session-retention.js +5 -0
- package/vendor/desk/mcp/scripts/session-sync.js +10 -0
- package/vendor/desk/mcp/scripts/sessions.js +5 -0
- package/vendor/desk/mcp/scripts/sync-push.js +13 -0
- package/vendor/desk/mcp/scripts/tidy-status.js +8 -0
- package/vendor/desk/mcp/scripts/verify-runtime-deps-pack.js +5 -0
- package/vendor/desk/mcp/src/actions/desk-read.actions.mts +73 -0
- package/vendor/desk/mcp/src/actions/desk-session.actions.mts +42 -0
- package/vendor/desk/mcp/src/actions/desk-web.actions.mts +52 -0
- package/vendor/desk/mcp/src/actions/desk.actions.mts +5 -0
- package/vendor/desk/mcp/src/actions/generated/desk/OuroActions.swift +649 -0
- package/vendor/desk/mcp/src/actions/generated/desk/OuroActionsReins.swift +61 -0
- package/vendor/desk/mcp/src/actions/generated/desk/actions.json +280 -0
- package/vendor/desk/mcp/src/actions/generated/desk/commands.json +145 -0
- package/vendor/desk/mcp/src/actions/generated/desk/mcp.json +256 -0
- package/vendor/desk/mcp/src/actions/generated/desk/web.ts +59 -0
- package/vendor/desk/mcp/src/actions/generated/desk/webmcp.json +250 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActions.swift +241 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActionsReins.swift +25 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/actions.json +73 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/commands.json +53 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/mcp.json +83 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/web.ts +47 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/webmcp.json +81 -0
- package/vendor/desk/mcp/src/actions/served.js +5 -0
- package/vendor/desk/mcp/src/activation/admit.js +77 -0
- package/vendor/desk/mcp/src/activation/failures.js +65 -0
- package/vendor/desk/mcp/src/activation/readiness-policy.js +102 -0
- package/vendor/desk/mcp/src/activation/schema.js +17 -0
- package/vendor/desk/mcp/src/activation/superpowers-context.js +265 -0
- package/vendor/desk/mcp/src/activation/validate.js +540 -0
- package/vendor/desk/mcp/src/artifacts/tombstones.js +61 -0
- package/vendor/desk/mcp/src/crew/initiative.js +287 -0
- package/vendor/desk/mcp/src/crew/workspace.js +1259 -0
- package/vendor/desk/mcp/src/db/init.js +75 -0
- package/vendor/desk/mcp/src/db/schema.sql +83 -0
- package/vendor/desk/mcp/src/desk/active-tasks.js +408 -0
- package/vendor/desk/mcp/src/desk/card-commit-guard.js +281 -0
- package/vendor/desk/mcp/src/desk/cleanup-index.js +53 -0
- package/vendor/desk/mcp/src/desk/content-home.js +246 -0
- package/vendor/desk/mcp/src/desk/crew-config.js +102 -0
- package/vendor/desk/mcp/src/desk/crew-member.js +196 -0
- package/vendor/desk/mcp/src/desk/crew-roster.js +151 -0
- package/vendor/desk/mcp/src/desk/frontmatter-lite.js +228 -0
- package/vendor/desk/mcp/src/desk/gh-logins.js +109 -0
- package/vendor/desk/mcp/src/desk/handles.js +123 -0
- package/vendor/desk/mcp/src/desk/handoff-reference.js +35 -0
- package/vendor/desk/mcp/src/desk/improvement-authority.js +3 -0
- package/vendor/desk/mcp/src/desk/improvement-cards.js +704 -0
- package/vendor/desk/mcp/src/desk/improvement-person.js +51 -0
- package/vendor/desk/mcp/src/desk/lifecycle.js +16 -0
- package/vendor/desk/mcp/src/desk/machine-desks.js +119 -0
- package/vendor/desk/mcp/src/desk/naming.js +333 -0
- package/vendor/desk/mcp/src/desk/organization.js +592 -0
- package/vendor/desk/mcp/src/desk/resources.js +274 -0
- package/vendor/desk/mcp/src/desk/runtime-resolver.js +30 -0
- package/vendor/desk/mcp/src/desk/scratch-paths.js +44 -0
- package/vendor/desk/mcp/src/desk/step-delivery.js +140 -0
- package/vendor/desk/mcp/src/desk/steps.js +263 -0
- package/vendor/desk/mcp/src/desk/tidy.js +930 -0
- package/vendor/desk/mcp/src/desk/unsigned-deliveries.js +359 -0
- package/vendor/desk/mcp/src/factory/agent-types.js +45 -0
- package/vendor/desk/mcp/src/factory/andon-watch.js +109 -0
- package/vendor/desk/mcp/src/factory/binding.js +612 -0
- package/vendor/desk/mcp/src/factory/boot-check.js +645 -0
- package/vendor/desk/mcp/src/factory/capture-classify.js +158 -0
- package/vendor/desk/mcp/src/factory/capture-count.js +183 -0
- package/vendor/desk/mcp/src/factory/capture-flush.js +268 -0
- package/vendor/desk/mcp/src/factory/capture-publish.js +141 -0
- package/vendor/desk/mcp/src/factory/capture-schema.js +193 -0
- package/vendor/desk/mcp/src/factory/capture-sweep.js +239 -0
- package/vendor/desk/mcp/src/factory/catch-point.js +60 -0
- package/vendor/desk/mcp/src/factory/commit-resolve.js +94 -0
- package/vendor/desk/mcp/src/factory/consent-answer.js +37 -0
- package/vendor/desk/mcp/src/factory/context-capability.js +15 -0
- package/vendor/desk/mcp/src/factory/context-outbox.js +885 -0
- package/vendor/desk/mcp/src/factory/context-run.js +386 -0
- package/vendor/desk/mcp/src/factory/context-schema.js +249 -0
- package/vendor/desk/mcp/src/factory/copilot-turn-index.js +93 -0
- package/vendor/desk/mcp/src/factory/copilot-usage.js +148 -0
- package/vendor/desk/mcp/src/factory/credential.js +45 -0
- package/vendor/desk/mcp/src/factory/derive-claude.js +960 -0
- package/vendor/desk/mcp/src/factory/derive-codex.js +734 -0
- package/vendor/desk/mcp/src/factory/derive-common.js +279 -0
- package/vendor/desk/mcp/src/factory/derive-copilot.js +1057 -0
- package/vendor/desk/mcp/src/factory/derive-run.js +807 -0
- package/vendor/desk/mcp/src/factory/desk-problem-file.js +310 -0
- package/vendor/desk/mcp/src/factory/desk-problem-fingerprint.js +70 -0
- package/vendor/desk/mcp/src/factory/desk-problem-known.js +246 -0
- package/vendor/desk/mcp/src/factory/desk-problem-template.js +107 -0
- package/vendor/desk/mcp/src/factory/desk-repo.js +1223 -0
- package/vendor/desk/mcp/src/factory/desk-task-line.js +28 -0
- package/vendor/desk/mcp/src/factory/desk-visibility.js +48 -0
- package/vendor/desk/mcp/src/factory/end-hook.js +14 -0
- package/vendor/desk/mcp/src/factory/evaluate-kick.js +164 -0
- package/vendor/desk/mcp/src/factory/evaluate-run.js +678 -0
- package/vendor/desk/mcp/src/factory/evaluator-step.js +484 -0
- package/vendor/desk/mcp/src/factory/filer-launch.js +79 -0
- package/vendor/desk/mcp/src/factory/flush-health.js +26 -0
- package/vendor/desk/mcp/src/factory/flush.js +1758 -0
- package/vendor/desk/mcp/src/factory/focus.js +326 -0
- package/vendor/desk/mcp/src/factory/headless-flag.cjs +32 -0
- package/vendor/desk/mcp/src/factory/headless-flag.js +25 -0
- package/vendor/desk/mcp/src/factory/headless-ledger.js +743 -0
- package/vendor/desk/mcp/src/factory/headless.js +567 -0
- package/vendor/desk/mcp/src/factory/held-route.js +93 -0
- package/vendor/desk/mcp/src/factory/host-flags.js +36 -0
- package/vendor/desk/mcp/src/factory/improvement-verify.js +429 -0
- package/vendor/desk/mcp/src/factory/kaizen-file.js +231 -0
- package/vendor/desk/mcp/src/factory/label-binding.js +90 -0
- package/vendor/desk/mcp/src/factory/label-schema.js +426 -0
- package/vendor/desk/mcp/src/factory/local-status.js +368 -0
- package/vendor/desk/mcp/src/factory/loop-conditions.js +121 -0
- package/vendor/desk/mcp/src/factory/loop-health.js +500 -0
- package/vendor/desk/mcp/src/factory/loop-slot.js +90 -0
- package/vendor/desk/mcp/src/factory/loop-status.js +100 -0
- package/vendor/desk/mcp/src/factory/loop-switch.cjs +14 -0
- package/vendor/desk/mcp/src/factory/loop-worker-state.js +96 -0
- package/vendor/desk/mcp/src/factory/loop-worker.js +290 -0
- package/vendor/desk/mcp/src/factory/marker.js +61 -0
- package/vendor/desk/mcp/src/factory/mirror-step.js +145 -0
- package/vendor/desk/mcp/src/factory/os-protect.js +243 -0
- package/vendor/desk/mcp/src/factory/outbox.js +2231 -0
- package/vendor/desk/mcp/src/factory/outcome.js +431 -0
- package/vendor/desk/mcp/src/factory/pipeline/andon.js +319 -0
- package/vendor/desk/mcp/src/factory/pipeline/attention-rollup.js +158 -0
- package/vendor/desk/mcp/src/factory/pipeline/attention.js +146 -0
- package/vendor/desk/mcp/src/factory/pipeline/build.js +299 -0
- package/vendor/desk/mcp/src/factory/pipeline/compare.js +148 -0
- package/vendor/desk/mcp/src/factory/pipeline/formulas.js +652 -0
- package/vendor/desk/mcp/src/factory/pipeline/kaizen.js +387 -0
- package/vendor/desk/mcp/src/factory/pipeline/lifecycle-clocks.js +345 -0
- package/vendor/desk/mcp/src/factory/pipeline/normalize.js +73 -0
- package/vendor/desk/mcp/src/factory/pipeline/number-states.js +154 -0
- package/vendor/desk/mcp/src/factory/pipeline/outcomes.js +268 -0
- package/vendor/desk/mcp/src/factory/pipeline/report.js +737 -0
- package/vendor/desk/mcp/src/factory/pipeline/rollups.js +883 -0
- package/vendor/desk/mcp/src/factory/pipeline/stretches.js +523 -0
- package/vendor/desk/mcp/src/factory/pipeline/timeline.js +199 -0
- package/vendor/desk/mcp/src/factory/pipeline/validate-pr.js +238 -0
- package/vendor/desk/mcp/src/factory/pipeline/versions.js +42 -0
- package/vendor/desk/mcp/src/factory/pipeline/walk.js +1177 -0
- package/vendor/desk/mcp/src/factory/plugin-registry.js +72 -0
- package/vendor/desk/mcp/src/factory/plugin-sources.cjs +249 -0
- package/vendor/desk/mcp/src/factory/pr-green.js +77 -0
- package/vendor/desk/mcp/src/factory/process-lock.js +142 -0
- package/vendor/desk/mcp/src/factory/proof-session.js +75 -0
- package/vendor/desk/mcp/src/factory/publish.js +637 -0
- package/vendor/desk/mcp/src/factory/published-schema.js +648 -0
- package/vendor/desk/mcp/src/factory/reconcile-reasons.js +22 -0
- package/vendor/desk/mcp/src/factory/reconcile-step.js +251 -0
- package/vendor/desk/mcp/src/factory/reconcile.js +808 -0
- package/vendor/desk/mcp/src/factory/release-version.js +134 -0
- package/vendor/desk/mcp/src/factory/repo-name.js +13 -0
- package/vendor/desk/mcp/src/factory/retention.js +60 -0
- package/vendor/desk/mcp/src/factory/route-desk.js +40 -0
- package/vendor/desk/mcp/src/factory/route-issues.js +251 -0
- package/vendor/desk/mcp/src/factory/route-local.js +264 -0
- package/vendor/desk/mcp/src/factory/schema.js +957 -0
- package/vendor/desk/mcp/src/factory/session-kind.js +16 -0
- package/vendor/desk/mcp/src/factory/session-lifetime.js +56 -0
- package/vendor/desk/mcp/src/factory/session-route.js +183 -0
- package/vendor/desk/mcp/src/factory/shell-git.js +500 -0
- package/vendor/desk/mcp/src/factory/store-issues.js +143 -0
- package/vendor/desk/mcp/src/factory/store-route.js +208 -0
- package/vendor/desk/mcp/src/factory/test-state-guard.js +103 -0
- package/vendor/desk/mcp/src/factory/time.js +36 -0
- package/vendor/desk/mcp/src/factory/tool-issue-file.js +84 -0
- package/vendor/desk/mcp/src/factory/tool-kinds.js +87 -0
- package/vendor/desk/mcp/src/factory/triage-schema.js +233 -0
- package/vendor/desk/mcp/src/factory/windows-acl.js +679 -0
- package/vendor/desk/mcp/src/indexer/chunk.js +232 -0
- package/vendor/desk/mcp/src/indexer/discover.js +434 -0
- package/vendor/desk/mcp/src/indexer/exclusions.js +247 -0
- package/vendor/desk/mcp/src/indexer/index.js +167 -0
- package/vendor/desk/mcp/src/indexer/refs.js +0 -0
- package/vendor/desk/mcp/src/indexer/text-hash.js +18 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/actions.claims.json +75 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/dist-manifest.json +70 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/ouro-actions.mts +1416 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/LICENSE +21 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-claims.ts +190 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-command.ts +1020 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/checks.ts +343 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/cli.ts +240 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/component.ts +430 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/dev-commands.ts +204 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/doctor.ts +126 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/effects.ts +68 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/exit-codes.ts +75 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/help.ts +220 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/mcp.ts +268 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/outcome.ts +265 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/output.ts +67 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/precise-copy.ts +235 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/problem.ts +124 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.kit.mts +8 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.ts +568 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/terminal.ts +245 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/voice.ts +136 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/wait.ts +226 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/work-event.ts +181 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.kit.mts +18 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.ts +2072 -0
- package/vendor/desk/mcp/src/package-metadata.js +20 -0
- package/vendor/desk/mcp/src/protected/legacy-ledger.js +55 -0
- package/vendor/desk/mcp/src/readiness/leftovers.js +75 -0
- package/vendor/desk/mcp/src/readiness/process-start.js +149 -0
- package/vendor/desk/mcp/src/runtime/admission-worker.js +194 -0
- package/vendor/desk/mcp/src/runtime/admission.js +177 -0
- package/vendor/desk/mcp/src/runtime/agency-desk-channel.js +342 -0
- package/vendor/desk/mcp/src/runtime/agents-md.js +62 -0
- package/vendor/desk/mcp/src/runtime/append-lane.js +68 -0
- package/vendor/desk/mcp/src/runtime/argv-safe-reason.js +55 -0
- package/vendor/desk/mcp/src/runtime/boot-dependencies.js +75 -0
- package/vendor/desk/mcp/src/runtime/boot-text.js +504 -0
- package/vendor/desk/mcp/src/runtime/boot.js +1677 -0
- package/vendor/desk/mcp/src/runtime/bootstrap.js +1455 -0
- package/vendor/desk/mcp/src/runtime/chunked-import.js +102 -0
- package/vendor/desk/mcp/src/runtime/copilot-commit-trailer.js +133 -0
- package/vendor/desk/mcp/src/runtime/copilot-session.js +155 -0
- package/vendor/desk/mcp/src/runtime/deliver.js +469 -0
- package/vendor/desk/mcp/src/runtime/desk-channel.js +86 -0
- package/vendor/desk/mcp/src/runtime/desk-failure.js +26 -0
- package/vendor/desk/mcp/src/runtime/desk-health.js +168 -0
- package/vendor/desk/mcp/src/runtime/desk-session.js +1451 -0
- package/vendor/desk/mcp/src/runtime/diagnostic-server.js +72 -0
- package/vendor/desk/mcp/src/runtime/diagnostics.js +241 -0
- package/vendor/desk/mcp/src/runtime/drains-cli.js +187 -0
- package/vendor/desk/mcp/src/runtime/drains.js +781 -0
- package/vendor/desk/mcp/src/runtime/elsewhere-note.js +9 -0
- package/vendor/desk/mcp/src/runtime/failure-evidence.js +21 -0
- package/vendor/desk/mcp/src/runtime/fast-refs.js +209 -0
- package/vendor/desk/mcp/src/runtime/filer-throttle.js +66 -0
- package/vendor/desk/mcp/src/runtime/focused-card.js +147 -0
- package/vendor/desk/mcp/src/runtime/front-door.js +204 -0
- package/vendor/desk/mcp/src/runtime/gate-wait.js +2 -0
- package/vendor/desk/mcp/src/runtime/git-inspection.js +201 -0
- package/vendor/desk/mcp/src/runtime/git-read-worker.js +157 -0
- package/vendor/desk/mcp/src/runtime/health.js +50 -0
- package/vendor/desk/mcp/src/runtime/hooks.js +353 -0
- package/vendor/desk/mcp/src/runtime/hosted.js +163 -0
- package/vendor/desk/mcp/src/runtime/inbox.js +102 -0
- package/vendor/desk/mcp/src/runtime/index-drift.js +118 -0
- package/vendor/desk/mcp/src/runtime/last-start.js +133 -0
- package/vendor/desk/mcp/src/runtime/lesson-section.js +92 -0
- package/vendor/desk/mcp/src/runtime/lessons-shelf.js +100 -0
- package/vendor/desk/mcp/src/runtime/lfs.js +319 -0
- package/vendor/desk/mcp/src/runtime/native-path.js +12 -0
- package/vendor/desk/mcp/src/runtime/newest-release.js +197 -0
- package/vendor/desk/mcp/src/runtime/node-selection.js +233 -0
- package/vendor/desk/mcp/src/runtime/orca-session-title.js +225 -0
- package/vendor/desk/mcp/src/runtime/other-sessions.js +183 -0
- package/vendor/desk/mcp/src/runtime/pending-migrations.js +653 -0
- package/vendor/desk/mcp/src/runtime/plugin-update.js +215 -0
- package/vendor/desk/mcp/src/runtime/pluginless-runtimes.js +34 -0
- package/vendor/desk/mcp/src/runtime/pr-publication.js +226 -0
- package/vendor/desk/mcp/src/runtime/preview-snapshot.js +23 -0
- package/vendor/desk/mcp/src/runtime/publication-mode.js +19 -0
- package/vendor/desk/mcp/src/runtime/relays.js +974 -0
- package/vendor/desk/mcp/src/runtime/release-alert.js +148 -0
- package/vendor/desk/mcp/src/runtime/remote-identity.js +140 -0
- package/vendor/desk/mcp/src/runtime/resolve-here.js +4 -0
- package/vendor/desk/mcp/src/runtime/runtime-deps-cli.js +65 -0
- package/vendor/desk/mcp/src/runtime/runtime-deps.js +1109 -0
- package/vendor/desk/mcp/src/runtime/runtime-identity.js +22 -0
- package/vendor/desk/mcp/src/runtime/runtime-swap.js +101 -0
- package/vendor/desk/mcp/src/runtime/schedules.js +235 -0
- package/vendor/desk/mcp/src/runtime/session-activity.js +190 -0
- package/vendor/desk/mcp/src/runtime/session-label.js +30 -0
- package/vendor/desk/mcp/src/runtime/session-retention.js +662 -0
- package/vendor/desk/mcp/src/runtime/session-sync.js +333 -0
- package/vendor/desk/mcp/src/runtime/session-trailer.js +126 -0
- package/vendor/desk/mcp/src/runtime/sessions-cli.js +301 -0
- package/vendor/desk/mcp/src/runtime/signoff-listed.js +81 -0
- package/vendor/desk/mcp/src/runtime/skills.js +76 -0
- package/vendor/desk/mcp/src/runtime/stale-card-lead.js +52 -0
- package/vendor/desk/mcp/src/runtime/stale-desk-refresh.js +198 -0
- package/vendor/desk/mcp/src/runtime/stale-desk.js +219 -0
- package/vendor/desk/mcp/src/runtime/stalled.js +255 -0
- package/vendor/desk/mcp/src/runtime/standing-authority.js +79 -0
- package/vendor/desk/mcp/src/runtime/startup-boot.js +341 -0
- package/vendor/desk/mcp/src/runtime/startup-resolve.js +140 -0
- package/vendor/desk/mcp/src/runtime/state-branch.js +203 -0
- package/vendor/desk/mcp/src/runtime/status-compact.js +165 -0
- package/vendor/desk/mcp/src/runtime/status-inspection-child.js +26 -0
- package/vendor/desk/mcp/src/runtime/status-inspection.js +147 -0
- package/vendor/desk/mcp/src/runtime/status-root.js +39 -0
- package/vendor/desk/mcp/src/runtime/sync-worker.js +911 -0
- package/vendor/desk/mcp/src/runtime/test-state-guard.js +107 -0
- package/vendor/desk/mcp/src/runtime/unmerged-saves.js +247 -0
- package/vendor/desk/mcp/src/runtime/workspace-claim.js +53 -0
- package/vendor/desk/mcp/src/runtime/workspace-evidence.js +96 -0
- package/vendor/desk/mcp/src/runtime/workspace-tidy.js +509 -0
- package/vendor/desk/mcp/src/search/direct-lexical.js +54 -0
- package/vendor/desk/mcp/src/search/embedder.js +108 -0
- package/vendor/desk/mcp/src/search/engine.js +406 -0
- package/vendor/desk/mcp/src/search/files-router.js +22 -0
- package/vendor/desk/mcp/src/search/old-index.js +46 -0
- package/vendor/desk/mcp/src/search/vectors.js +60 -0
- package/vendor/desk/mcp/src/server.js +389 -0
- package/vendor/desk/mcp/src/tool-names.js +73 -0
- package/vendor/desk/mcp/src/tool-refusal.cjs +35 -0
- package/vendor/desk/mcp/src/tool-schema-parts.js +12 -0
- package/vendor/desk/mcp/src/tool-schemas.js +325 -0
- package/vendor/desk/mcp/src/tools/_card-commit.js +148 -0
- package/vendor/desk/mcp/src/tools/archive-links.js +185 -0
- package/vendor/desk/mcp/src/tools/archive-move.js +18 -0
- package/vendor/desk/mcp/src/tools/archive-native-session.js +728 -0
- package/vendor/desk/mcp/src/tools/archive-state.js +513 -0
- package/vendor/desk/mcp/src/tools/delivery-gate.js +251 -0
- package/vendor/desk/mcp/src/tools/desk-save.js +444 -0
- package/vendor/desk/mcp/src/tools/doctor.js +122 -0
- package/vendor/desk/mcp/src/tools/done-evidence.js +260 -0
- package/vendor/desk/mcp/src/tools/factory-context.js +204 -0
- package/vendor/desk/mcp/src/tools/friction.js +332 -0
- package/vendor/desk/mcp/src/tools/improvement.js +156 -0
- package/vendor/desk/mcp/src/tools/lesson-lines.js +22 -0
- package/vendor/desk/mcp/src/tools/lesson-owners.js +137 -0
- package/vendor/desk/mcp/src/tools/lesson-team.js +169 -0
- package/vendor/desk/mcp/src/tools/lesson.js +254 -0
- package/vendor/desk/mcp/src/tools/local-only.js +151 -0
- package/vendor/desk/mcp/src/tools/move.js +794 -0
- package/vendor/desk/mcp/src/tools/native-stage-context.js +32 -0
- package/vendor/desk/mcp/src/tools/note.js +267 -0
- package/vendor/desk/mcp/src/tools/search.js +634 -0
- package/vendor/desk/mcp/src/tools/shared-write.js +196 -0
- package/vendor/desk/mcp/src/tools/sibling-desk.js +37 -0
- package/vendor/desk/mcp/src/tools/status.js +233 -0
- package/vendor/desk/mcp/src/tools/task-archive-due.js +9 -0
- package/vendor/desk/mcp/src/tools/task-archived-resource.js +53 -0
- package/vendor/desk/mcp/src/tools/task-body.js +141 -0
- package/vendor/desk/mcp/src/tools/task-focus.js +164 -0
- package/vendor/desk/mcp/src/tools/task-log.js +76 -0
- package/vendor/desk/mcp/src/tools/task-signoff.js +155 -0
- package/vendor/desk/mcp/src/tools/task.js +1768 -0
- package/vendor/desk/mcp/src/tools/track-row.js +89 -0
- package/vendor/desk/mcp/src/tools/track.js +240 -0
- package/vendor/desk/mcp/src/util/agency-session.cjs +29 -0
- package/vendor/desk/mcp/src/util/archive-links.js +105 -0
- package/vendor/desk/mcp/src/util/bash.js +36 -0
- package/vendor/desk/mcp/src/util/capture-record.js +73 -0
- package/vendor/desk/mcp/src/util/cas-commit.js +252 -0
- package/vendor/desk/mcp/src/util/created-dirs.js +71 -0
- package/vendor/desk/mcp/src/util/deferred-tools.js +51 -0
- package/vendor/desk/mcp/src/util/desk-owner.js +99 -0
- package/vendor/desk/mcp/src/util/env-value.js +13 -0
- package/vendor/desk/mcp/src/util/file-identity.js +40 -0
- package/vendor/desk/mcp/src/util/finish-commit.js +145 -0
- package/vendor/desk/mcp/src/util/fm.js +410 -0
- package/vendor/desk/mcp/src/util/git-config-file.js +85 -0
- package/vendor/desk/mcp/src/util/git-stage.js +440 -0
- package/vendor/desk/mcp/src/util/main-publish.js +240 -0
- package/vendor/desk/mcp/src/util/markdown-links.cjs +555 -0
- package/vendor/desk/mcp/src/util/object-input.js +59 -0
- package/vendor/desk/mcp/src/util/paths.js +647 -0
- package/vendor/desk/mcp/src/util/rank.js +189 -0
- package/vendor/desk/mcp/src/util/redact.js +92 -0
- package/vendor/desk/mcp/src/util/remove-retry.js +35 -0
- package/vendor/desk/mcp/src/util/rename-retry.js +73 -0
- package/vendor/desk/mcp/src/util/route-around.js +265 -0
- package/vendor/desk/mcp/src/util/shell-quote.js +18 -0
- package/vendor/desk/mcp/src/util/startup-direction.js +124 -0
- package/vendor/desk/mcp/src/util/state-ignore.js +33 -0
- package/vendor/desk/mcp/src/util/tool-commits.js +64 -0
- package/vendor/desk/mcp/src/util/unicode-16/LICENSE-MIT.txt +7 -0
- package/vendor/desk/mcp/src/util/unicode-16/README.md +9 -0
- package/vendor/desk/mcp/src/util/unicode-16/letter.cjs +1 -0
- package/vendor/desk/mcp/src/util/unicode-16/mark.cjs +1 -0
- package/vendor/desk/mcp/src/util/unicode-16/number.cjs +1 -0
- package/vendor/desk/mcp/web-auth.cjs +1897 -0
- package/vendor/desk/mcp/web-browser-discovery.cjs +53 -0
- package/vendor/desk/mcp/web-catalog.json +34 -0
- package/vendor/desk/mcp/web-launch.cjs +101 -0
- package/vendor/desk/mcp/web.cjs +1239 -0
- package/vendor/desk/migrations/01-move-to-ourostack-desk.md +188 -0
- package/vendor/desk/migrations/02-tidy-desk.md +87 -0
- package/vendor/desk/migrations/03-desk-release-channel.md +38 -0
- package/vendor/desk/optional/session-label/consumer.mjs +237 -0
- package/vendor/desk/optional/session-label/extension.mjs +32 -0
- package/vendor/desk/plugin.json +54 -0
- package/vendor/desk/settings.json +3 -0
- package/vendor/desk/skills/add-workspace-mcp/SKILL.md +180 -0
- package/vendor/desk/skills/adopt-inflight-work/SKILL.md +212 -0
- package/vendor/desk/skills/archive-workflow/SKILL.md +132 -0
- package/vendor/desk/skills/content-routing/SKILL.md +95 -0
- package/vendor/desk/skills/core-meeting-capture/SKILL.md +47 -0
- package/vendor/desk/skills/core-meeting-capture/references/capture-contract.md +175 -0
- package/vendor/desk/skills/curator/SKILL.md +103 -0
- package/vendor/desk/skills/delightful-decks/SKILL.md +67 -0
- package/vendor/desk/skills/desk-problem/SKILL.md +87 -0
- package/vendor/desk/skills/directory-structure/SKILL.md +169 -0
- package/vendor/desk/skills/doc-review-rigor/SKILL.md +63 -0
- package/vendor/desk/skills/draining-issues/SKILL.md +62 -0
- package/vendor/desk/skills/evaluate-release/SKILL.md +96 -0
- package/vendor/desk/skills/evidence-discipline/SKILL.md +150 -0
- package/vendor/desk/skills/factory-evaluator/SKILL.md +122 -0
- package/vendor/desk/skills/factory-task-context/SKILL.md +116 -0
- package/vendor/desk/skills/factory-work/SKILL.md +16 -0
- package/vendor/desk/skills/fast-honest-ci/SKILL.md +70 -0
- package/vendor/desk/skills/fast-honest-ci/examples.md +49 -0
- package/vendor/desk/skills/first-run-bootstrap/SKILL.md +95 -0
- package/vendor/desk/skills/friction-management/SKILL.md +98 -0
- package/vendor/desk/skills/git-hygiene/SKILL.md +253 -0
- package/vendor/desk/skills/independent-review/SKILL.md +34 -0
- package/vendor/desk/skills/interaction-style/SKILL.md +239 -0
- package/vendor/desk/skills/lesson-capture/SKILL.md +85 -0
- package/vendor/desk/skills/lesson-capture/agents-md-budget.mjs +61 -0
- package/vendor/desk/skills/online-evaluation/SKILL.md +81 -0
- package/vendor/desk/skills/operator-voice-comments/LICENSE-humanize +21 -0
- package/vendor/desk/skills/operator-voice-comments/SKILL.md +90 -0
- package/vendor/desk/skills/operator-voice-comments/human-voice.md +43 -0
- package/vendor/desk/skills/peer-pr-review/SKILL.md +104 -0
- package/vendor/desk/skills/pr-feedback-on-own-pr/SKILL.md +145 -0
- package/vendor/desk/skills/pr-review-interrogation/SKILL.md +121 -0
- package/vendor/desk/skills/pr-reviewer-audit/SKILL.md +68 -0
- package/vendor/desk/skills/pr-reviewer-audit/helpers/audit.py +335 -0
- package/vendor/desk/skills/pr-reviewer-audit/helpers/test_audit.py +486 -0
- package/vendor/desk/skills/pr-self-review/SKILL.md +86 -0
- package/vendor/desk/skills/pr-surface-hygiene/SKILL.md +105 -0
- package/vendor/desk/skills/pr-surface-hygiene/check-visual-proof.cjs +99 -0
- package/vendor/desk/skills/pr-surface-hygiene/repository-setup.md +19 -0
- package/vendor/desk/skills/pr-surface-hygiene/resources/pr-visual-proof.yml +29 -0
- package/vendor/desk/skills/pr-surface-hygiene/resources/pull-request-template.md +5 -0
- package/vendor/desk/skills/preflight-actions/SKILL.md +60 -0
- package/vendor/desk/skills/preview-feedback/SKILL.md +70 -0
- package/vendor/desk/skills/repo-handling/SKILL.md +67 -0
- package/vendor/desk/skills/rnd-lab/SKILL.md +52 -0
- package/vendor/desk/skills/runtime-symptom-investigation/SKILL.md +106 -0
- package/vendor/desk/skills/session-resumption/SKILL.md +126 -0
- package/vendor/desk/skills/session-start/SKILL.md +54 -0
- package/vendor/desk/skills/session-start/details.md +150 -0
- package/vendor/desk/skills/session-start-migrations/README.md +71 -0
- package/vendor/desk/skills/session-start-migrations/SKILL.md +108 -0
- package/vendor/desk/skills/start-task/SKILL.md +88 -0
- package/vendor/desk/skills/task-card-format/SKILL.md +198 -0
- package/vendor/desk/skills/task-lifecycle/SKILL.md +217 -0
- package/vendor/desk/skills/track-card-format/SKILL.md +90 -0
- package/vendor/desk/skills/using-desk/SKILL.md +58 -0
- package/vendor/desk/skills/using-superpowers-with-desk/SKILL.md +156 -0
- package/vendor/desk/skills/work-orchestration/SKILL.md +162 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { diagnosticFormat, previewRuntimeSnapshot } from "./preview-snapshot.js"
|
|
2
|
+
import { startFrontDoor } from "./front-door.js"
|
|
3
|
+
|
|
4
|
+
// Tools that answer in diagnostic mode; every other tool is listed but gated.
|
|
5
|
+
const diagnosticToolNames = ["desk_status", "desk_doctor"]
|
|
6
|
+
|
|
7
|
+
// Diagnostic mode serves a fixed diagnostic: the paths that end here run before the handshake and cannot admit Desk in this process (no compatible Node, a failed re-exec, a startup exception, an overlay that owns onboarding).
|
|
8
|
+
export function startDiagnosticServer({
|
|
9
|
+
diagnostic,
|
|
10
|
+
input = process.stdin,
|
|
11
|
+
output = process.stdout,
|
|
12
|
+
serverVersion = "0.0.0",
|
|
13
|
+
} = {}) {
|
|
14
|
+
return startFrontDoor({
|
|
15
|
+
input,
|
|
16
|
+
output,
|
|
17
|
+
serverName: "desk-mcp-diagnostic",
|
|
18
|
+
serverVersion,
|
|
19
|
+
callTool: ({ name, input: toolInput }) => diagnosticToolResult({ diagnostic, toolName: name, input: toolInput }),
|
|
20
|
+
}).closed
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The tool result a fixed diagnostic gives: desk_status and desk_doctor answer with it, every other tool is refused with its code and fix. */
|
|
24
|
+
function diagnosticToolResult({ diagnostic, toolName, input }) {
|
|
25
|
+
if (toolName === "desk_doctor") {
|
|
26
|
+
let format
|
|
27
|
+
try {
|
|
28
|
+
format = diagnosticFormat(input)
|
|
29
|
+
} catch (error) {
|
|
30
|
+
// Only the validator's own input error is an input error; anything else is a real failure for the front door to report.
|
|
31
|
+
if (!(error instanceof TypeError)) throw error
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: error.message }],
|
|
34
|
+
isError: true,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (format === "preview") {
|
|
38
|
+
return {
|
|
39
|
+
content: [{ type: "text", text: JSON.stringify(previewRuntimeSnapshot("diagnostic")) }],
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (diagnosticToolNames.includes(toolName)) {
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: JSON.stringify(diagnostic, null, 2),
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const rejected = {
|
|
54
|
+
...diagnostic,
|
|
55
|
+
status: "degraded",
|
|
56
|
+
code: diagnostic.code ?? diagnostic.reason,
|
|
57
|
+
fix: diagnostic.fix
|
|
58
|
+
?? diagnostic.remediation?.[0]?.message
|
|
59
|
+
?? "Call desk_doctor for the startup failure and its remediation.",
|
|
60
|
+
tool: toolName ?? null,
|
|
61
|
+
summary: `${toolName ?? "This tool"} is unavailable while Desk is in diagnostic mode.`,
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: JSON.stringify(rejected, null, 2),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
isError: true,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { terminalFailure } from "../activation/failures.js"
|
|
2
|
+
|
|
3
|
+
const reasonDetails = {
|
|
4
|
+
unsupported_target: {
|
|
5
|
+
summary: "Desk does not ship an offline runtime dependency pack for the current platform, architecture, and Node ABI.",
|
|
6
|
+
code: "runtime_unsupported",
|
|
7
|
+
},
|
|
8
|
+
missing_pack: {
|
|
9
|
+
summary: "Desk's offline runtime dependency pack is missing for the current Node runtime.",
|
|
10
|
+
code: "artifact_integrity_invalid",
|
|
11
|
+
},
|
|
12
|
+
corrupt_pack: {
|
|
13
|
+
summary: "Desk found an offline runtime dependency pack, but its checksum, manifest, or archive is invalid.",
|
|
14
|
+
code: "artifact_integrity_invalid",
|
|
15
|
+
},
|
|
16
|
+
runtime_restore_failed: {
|
|
17
|
+
summary: "Desk validated its offline runtime pack but could not restore a usable runtime cache.",
|
|
18
|
+
code: "artifact_integrity_invalid",
|
|
19
|
+
},
|
|
20
|
+
runtime_inspection_failed: {
|
|
21
|
+
summary: "Desk could not inspect its committed offline runtime metadata safely.",
|
|
22
|
+
code: "artifact_integrity_invalid",
|
|
23
|
+
},
|
|
24
|
+
node_selection_failed: {
|
|
25
|
+
summary: "Desk could not complete bounded discovery of a compatible local Node runtime.",
|
|
26
|
+
code: "runtime_unsupported",
|
|
27
|
+
},
|
|
28
|
+
no_compatible_node: {
|
|
29
|
+
summary: "Desk could not find a local Node runtime matching a shipped offline dependency pack.",
|
|
30
|
+
code: "runtime_unsupported",
|
|
31
|
+
},
|
|
32
|
+
guarded_reexec_failure: {
|
|
33
|
+
summary: "Desk's one-time compatible-Node handoff did not produce a healthy runtime.",
|
|
34
|
+
code: "runtime_unsupported",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Node major for each module ABI Desk has shipped or may ship a runtime pack for.
|
|
39
|
+
const nodeMajorByAbi = { 115: 20, 127: 22, 137: 24, 147: 26 }
|
|
40
|
+
|
|
41
|
+
function nodeMajor(abi) {
|
|
42
|
+
return nodeMajorByAbi[String(abi)]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function shippedNodeName(abi) {
|
|
46
|
+
const major = nodeMajor(abi)
|
|
47
|
+
return major === undefined ? `Node with module ABI ${abi}` : `Node ${major}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function currentNodeName(abi) {
|
|
51
|
+
const major = nodeMajor(abi)
|
|
52
|
+
return major === undefined
|
|
53
|
+
? `Node with module ABI ${abi}`
|
|
54
|
+
: `Node ${major} (module ABI ${abi})`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function joinWords(words) {
|
|
58
|
+
if (words.length === 1) {
|
|
59
|
+
return words[0]
|
|
60
|
+
}
|
|
61
|
+
return `${words.slice(0, -1).join(", ")} and ${words[words.length - 1]}`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function useShippedNodeMessage({ currentTarget, shippedTargets }) {
|
|
65
|
+
if (shippedTargets.length === 0) {
|
|
66
|
+
return "Check Desk's runtime support matrix and install a supported local Node runtime, then reconnect the Desk MCP server (in Claude Code run /mcp and reconnect desk): Desk's launcher picks that Node itself."
|
|
67
|
+
}
|
|
68
|
+
const platform = currentTarget?.platform
|
|
69
|
+
const arch = currentTarget?.arch
|
|
70
|
+
const scoped = typeof platform === "string" && typeof arch === "string"
|
|
71
|
+
const machineTargets = scoped
|
|
72
|
+
? shippedTargets.filter((target) => target.platform === platform && target.arch === arch)
|
|
73
|
+
: shippedTargets
|
|
74
|
+
if (machineTargets.length === 0) {
|
|
75
|
+
const platforms = [...new Set(shippedTargets.map((target) => `${target.platform}-${target.arch}`))].sort()
|
|
76
|
+
return `Desk ships no runtime pack for this platform and architecture (${platform}-${arch}) yet. Desk ships packs for ${joinWords(platforms)}, so use one of those platforms until a pack ships for this one.`
|
|
77
|
+
}
|
|
78
|
+
const abis = [...new Set(machineTargets.map((target) => target.node_abi).filter(Boolean).map(String))]
|
|
79
|
+
.sort((a, b) => Number(a) - Number(b))
|
|
80
|
+
const where = scoped ? ` on ${platform}-${arch}` : ""
|
|
81
|
+
const names = joinWords(abis.map(shippedNodeName))
|
|
82
|
+
const currentAbi = currentTarget?.node_abi
|
|
83
|
+
const opening = currentAbi === undefined || currentAbi === null
|
|
84
|
+
? `Desk ships runtime packs for ${names}${where}.`
|
|
85
|
+
: `This machine runs ${currentNodeName(currentAbi)}, and Desk ships runtime packs for ${names}${where}.`
|
|
86
|
+
const newest = abis[abis.length - 1]
|
|
87
|
+
return `${opening} Install ${shippedNodeName(newest)} for your user: a per-user install is enough and needs no administrator rights (for example with fnm or nvm; on Windows, fnm with FNM_DIR under %LOCALAPPDATA% works). Then reconnect the Desk MCP server (in Claude Code run /mcp and reconnect desk): Desk's launcher finds that Node by itself.`
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function createRuntimeDiagnostic({
|
|
91
|
+
reason,
|
|
92
|
+
failureKind,
|
|
93
|
+
currentTarget,
|
|
94
|
+
shippedTargets = [],
|
|
95
|
+
pathsChecked = [],
|
|
96
|
+
runtimeCachePath = null,
|
|
97
|
+
supportMatrixPath = null,
|
|
98
|
+
} = {}) {
|
|
99
|
+
const details = reasonDetails[reason] ?? {
|
|
100
|
+
summary: "Desk could not prepare its local runtime.",
|
|
101
|
+
code: "artifact_integrity_invalid",
|
|
102
|
+
}
|
|
103
|
+
const diagnostic = terminalFailure({
|
|
104
|
+
phase: "VERIFYING",
|
|
105
|
+
code: details.code,
|
|
106
|
+
expected: {
|
|
107
|
+
runtime: "verified supported artifact",
|
|
108
|
+
},
|
|
109
|
+
observed: {
|
|
110
|
+
reason,
|
|
111
|
+
failure_kind: failureKind,
|
|
112
|
+
},
|
|
113
|
+
automaticActions: [],
|
|
114
|
+
summary: details.summary,
|
|
115
|
+
})
|
|
116
|
+
const remediation = [{
|
|
117
|
+
action: "refresh_plugin",
|
|
118
|
+
message: "Refresh or reinstall Desk from its trusted source to restore the committed runtime support matrix and verified dependency packs, then call desk_status: Desk rechecks its runtime pack in place (and on its own after 1, 2, 5, 10 and 30 s, then every 60 s). A refresh that installs Desk into a new folder takes effect when the host reconnects the Desk MCP server.",
|
|
119
|
+
}]
|
|
120
|
+
if (details.code === "runtime_unsupported") {
|
|
121
|
+
remediation.unshift({
|
|
122
|
+
action: "use_shipped_node",
|
|
123
|
+
message: useShippedNodeMessage({ currentTarget, shippedTargets }),
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
if (reason === "runtime_restore_failed") {
|
|
127
|
+
remediation.unshift({
|
|
128
|
+
action: "check_runtime_cache",
|
|
129
|
+
message: `Check write permissions and free disk space for ${runtimeCachePath ?? "Desk's runtime cache"}, then call desk_status: Desk retries the verified offline restoration in place.`,
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
Object.assign(diagnostic, {
|
|
133
|
+
activation_status: diagnostic.status,
|
|
134
|
+
status: "degraded",
|
|
135
|
+
state: `degraded:${details.code}`,
|
|
136
|
+
mode: "diagnostic",
|
|
137
|
+
reason,
|
|
138
|
+
fix: remediation[0].message,
|
|
139
|
+
lexical: {
|
|
140
|
+
generation: null, event_cursor: null, pending_changes: null,
|
|
141
|
+
certain: false, current_automatic_action: null, serving_path: "blocked",
|
|
142
|
+
},
|
|
143
|
+
remediation,
|
|
144
|
+
runtime: {
|
|
145
|
+
current_target: currentTarget,
|
|
146
|
+
shipped_targets: shippedTargets,
|
|
147
|
+
paths_checked: pathsChecked,
|
|
148
|
+
runtime_cache_path: runtimeCachePath,
|
|
149
|
+
support_matrix_path: supportMatrixPath,
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
if (failureKind !== undefined) {
|
|
153
|
+
diagnostic.failure_kind = failureKind
|
|
154
|
+
}
|
|
155
|
+
return diagnostic
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// The last-resort catch in index.js: anything that throws before the server starts becomes this diagnostic, so the handshake still completes and desk_status names the cause and the fix instead of the process exiting.
|
|
159
|
+
export function createStartupExceptionDiagnostic({ error } = {}) {
|
|
160
|
+
const observed = {
|
|
161
|
+
name: error instanceof Error ? error.name : "unknown",
|
|
162
|
+
message: error instanceof Error ? error.message : String(error),
|
|
163
|
+
}
|
|
164
|
+
if (typeof error?.code === "string") {
|
|
165
|
+
observed.failure_code = error.code
|
|
166
|
+
}
|
|
167
|
+
const fix = "Read observed.message and fix the cause it names (for example a --root path that does not exist, or a malformed activation config), then reconnect the Desk MCP server (in Claude Code run /mcp and reconnect desk; otherwise start a new session)."
|
|
168
|
+
return {
|
|
169
|
+
status: "degraded",
|
|
170
|
+
activation_status: "terminal",
|
|
171
|
+
state: "degraded:startup_exception",
|
|
172
|
+
mode: "diagnostic",
|
|
173
|
+
reason: "startup_exception",
|
|
174
|
+
code: "startup_exception",
|
|
175
|
+
phase: typeof error?.phase === "string" ? error.phase : "STARTING",
|
|
176
|
+
summary: "Desk hit an error before it finished starting, so it is serving diagnostic mode: desk_status and desk_doctor answer, and every other tool is unavailable until the cause is fixed.",
|
|
177
|
+
observed,
|
|
178
|
+
fix,
|
|
179
|
+
lexical: {
|
|
180
|
+
generation: null, event_cursor: null, pending_changes: null,
|
|
181
|
+
certain: false, current_automatic_action: null, serving_path: "blocked",
|
|
182
|
+
},
|
|
183
|
+
remediation: [{ action: "fix_startup_cause", message: fix }],
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// No desk is bound yet. This is the normal first-run state, so Desk keeps
|
|
188
|
+
// answering desk_status/desk_doctor and points at setup instead of exiting.
|
|
189
|
+
// Overlays that own onboarding (a crew workspace, for example) name their own
|
|
190
|
+
// skill; they also own the binding, so only the default path names the file.
|
|
191
|
+
const DEFAULT_ONBOARDING_SKILL = "desk:first-run-bootstrap"
|
|
192
|
+
|
|
193
|
+
export function createSetupDiagnostic({
|
|
194
|
+
pathsTried = [],
|
|
195
|
+
bindingPath = null,
|
|
196
|
+
onboardingSkill = DEFAULT_ONBOARDING_SKILL,
|
|
197
|
+
reasonDetail = null,
|
|
198
|
+
} = {}) {
|
|
199
|
+
const overlay = onboardingSkill !== DEFAULT_ONBOARDING_SKILL
|
|
200
|
+
const bindStep = bindingPath === null
|
|
201
|
+
? "Bind the chosen desk by exporting DESK=<path> for the host, or by writing an activation config with {\"schema_version\":1,\"desk\":{\"root\":\"<path>\"}}."
|
|
202
|
+
: `Bind the chosen desk by writing {"schema_version":1,"desk":{"root":"<absolute path>"}} to ${bindingPath}. The binding survives plugin updates.`
|
|
203
|
+
const remediation = overlay
|
|
204
|
+
? [{
|
|
205
|
+
action: "run_onboarding",
|
|
206
|
+
message: `Run ${onboardingSkill} now: the active overlay owns onboarding and binding for this workspace. Do not offer to continue without Desk.`,
|
|
207
|
+
}]
|
|
208
|
+
: [
|
|
209
|
+
{
|
|
210
|
+
action: "run_first_run_bootstrap",
|
|
211
|
+
message: "Run desk:first-run-bootstrap now. It looks for an existing local desk, then for the operator's desk repository on GitHub, and otherwise offers to create a fresh desk. Do not offer to continue without Desk.",
|
|
212
|
+
},
|
|
213
|
+
{ action: "bind_desk", message: bindStep },
|
|
214
|
+
]
|
|
215
|
+
remediation.push(overlay
|
|
216
|
+
? {
|
|
217
|
+
action: "restart_session",
|
|
218
|
+
message: "Start a new session once onboarding completes so Desk loads the workspace.",
|
|
219
|
+
}
|
|
220
|
+
: {
|
|
221
|
+
action: "check_binding",
|
|
222
|
+
message: "Then call desk_status: Desk rechecks the binding in place and loads the bound desk in this session. Opening the desk folder itself as the project also binds it.",
|
|
223
|
+
})
|
|
224
|
+
return {
|
|
225
|
+
status: "setup_required",
|
|
226
|
+
mode: "setup",
|
|
227
|
+
reason: "no_desk_root",
|
|
228
|
+
summary: overlay
|
|
229
|
+
? `No desk is bound yet. Desk is running in setup mode: run ${onboardingSkill}, then start a new session.`
|
|
230
|
+
: `No desk is bound yet. Desk is running in setup mode: run ${onboardingSkill}, then call desk_status to load the bound desk in this session.`,
|
|
231
|
+
onboarding_skill: onboardingSkill,
|
|
232
|
+
reason_detail: reasonDetail ?? null,
|
|
233
|
+
paths_tried: pathsTried,
|
|
234
|
+
binding_path: bindingPath,
|
|
235
|
+
lexical: {
|
|
236
|
+
generation: null, event_cursor: null, pending_changes: null,
|
|
237
|
+
certain: false, current_automatic_action: null, serving_path: "blocked",
|
|
238
|
+
},
|
|
239
|
+
remediation,
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// The `drains` command line: `poll`, `ack`, `status`, `why`, `schedule`, `stalled`, `relays`, `hooks` and `runtimes`, defined once with Ouro AX, which
|
|
2
|
+
// parses the arguments, writes the help and prints a usage error as one line on stderr with its fix (exit 2). Output is one JSON value
|
|
3
|
+
// on stdout; a failure is the Desk failure line its code built on stderr (exit 1).
|
|
4
|
+
import { spawnSync } from "node:child_process"
|
|
5
|
+
import * as os from "node:os"
|
|
6
|
+
import * as path from "node:path"
|
|
7
|
+
import { AxError } from "../lib/ouro-ui/registry/ouro/ax/problem.ts"
|
|
8
|
+
import { defineCli, defineCommand } from "../lib/ouro-ui/registry/ouro/ax/ax-command.ts"
|
|
9
|
+
import { runCli } from "../lib/ouro-ui/registry/ouro/ax/cli.ts"
|
|
10
|
+
import { allStuckSaves, stuckLine } from "./unmerged-saves.js"
|
|
11
|
+
import { pollRelays, readRelayConfig, readRelayStates, relayPaths, relayStatusLines, relaysOfPull, whyRelay } from "./relays.js"
|
|
12
|
+
import { findPluginlessRuntimes, listProcesses as psList, pluginlessRuntimeLines } from "./pluginless-runtimes.js"
|
|
13
|
+
import { ackStalled, pollStalled, stalledPaths, stalledStatus } from "./stalled.js"
|
|
14
|
+
import { ackHooks, createHook, deleteHook, ghToken, hookPaths, hookStatus, listHooks, pollHooks } from "./hooks.js"
|
|
15
|
+
import { ackSchedule, pollSchedules, readScheduleConfig, readScheduleStates, scheduleStatusLines, schedulePaths } from "./schedules.js"
|
|
16
|
+
import { signedInAccounts } from "../factory/flush.js"
|
|
17
|
+
import { ackWake, connectGithub, recoverDrainTarget, drainPaths, deskInUse, drainStatusLines, installLauncher, pollDrains, readDrainConfig, readDrainStates, whyOf, withDrainLock } from "./drains.js"
|
|
18
|
+
|
|
19
|
+
/** The Desk a poll ran from, for the history: its version, and the release commit when the launcher's own copy ran. */
|
|
20
|
+
const deskLabel = ({ version, release }) => (release ? `${version} ${release.slice(0, 8)}` : version)
|
|
21
|
+
|
|
22
|
+
/** The relays' status lines; a relays.json that cannot be read is one line saying so, never a reason to hide the drains. */
|
|
23
|
+
function relayLines(env, at) {
|
|
24
|
+
const files = relayPaths({ env })
|
|
25
|
+
try {
|
|
26
|
+
return relayStatusLines(readRelayConfig(files.config), readRelayStates(files.state), at)
|
|
27
|
+
} catch (error) {
|
|
28
|
+
return [`relays: ${error.message}`]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// A launcher that cannot be refreshed (a read-only state folder) never stops a poll; the output says so.
|
|
33
|
+
function refreshLauncher(env) {
|
|
34
|
+
try {
|
|
35
|
+
const { path: installed, sha256 } = installLauncher({ env })
|
|
36
|
+
return { path: installed, sha256 }
|
|
37
|
+
} catch (error) {
|
|
38
|
+
return { error: String(error.code) }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const CONFIG = { type: "string", description: "The config file to read instead of the default." }
|
|
43
|
+
const STATE = { type: "string", description: "The state file to keep instead of the default." }
|
|
44
|
+
const WAKE = { type: "string", required: true, description: "The id of the wake that was delivered, as poll printed it." }
|
|
45
|
+
const ERROR = { type: "string", description: "Why delivery failed; leave it out when the wake was delivered." }
|
|
46
|
+
const READ = { effect: "private", readOnly: true }
|
|
47
|
+
const ACK = (kind, flags) => ({ effect: "private", summary: `Record that a ${kind} wake was delivered (or failed, with --error).`, flags: { ...flags, wake: WAKE, error: ERROR, state: STATE } })
|
|
48
|
+
const text = (result) => JSON.stringify(result, null, 1)
|
|
49
|
+
|
|
50
|
+
const WHY_TARGET = /^([^#\s/]+\/[^#\s/]+)#(\d+)$/u
|
|
51
|
+
const WHY_NEEDS = "why needs an issue such as owner/name#123 or --relay <relay name>"
|
|
52
|
+
const usageError = (code, problem, fix) => new AxError({ code, exit: 2, thing: "why", problem, fix })
|
|
53
|
+
|
|
54
|
+
/** The paths for a command's files, with `--config` and `--state` taking the place of the defaults. */
|
|
55
|
+
const pathsOf = (defaults, flags) => ({
|
|
56
|
+
...defaults,
|
|
57
|
+
...(flags.config ? { config: path.resolve(flags.config) } : {}),
|
|
58
|
+
...(flags.state ? { state: path.resolve(flags.state), lock: `${path.resolve(flags.state)}.lock` } : {}),
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
/** A poll or status result with the Desk it ran from, its status line first and the refreshed launcher. */
|
|
62
|
+
function withDesk(result, { script, env }) {
|
|
63
|
+
const { line, ...desk } = deskInUse({ script, env })
|
|
64
|
+
return { ...result, desk, status: [line, ...result.status], launcher: refreshLauncher(env) }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The github.com logins signed in to the GitHub CLI, active first; empty when it cannot be asked. */
|
|
68
|
+
function ghSignedIn() {
|
|
69
|
+
const cleaned = { ...process.env, PATH: ["/opt/homebrew/bin", "/usr/local/bin", process.env.PATH].filter(Boolean).join(":") }
|
|
70
|
+
for (const name of ["GH_TOKEN", "GITHUB_TOKEN", "GH_ENTERPRISE_TOKEN", "GH_HOST"]) delete cleaned[name]
|
|
71
|
+
const result = spawnSync("gh", ["auth", "status", "--hostname", "github.com"], { encoding: "utf8", timeout: 10_000, env: cleaned, windowsHide: true })
|
|
72
|
+
return signedInAccounts(`${result.stdout}\n${result.stderr}`)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const HOOK_PRESETS = ["standard", "svix", "resend", "clerk", "stripe", "github", "sentry", "linear", "none"]
|
|
76
|
+
const ACCOUNT = { type: "string", placeholder: "<login>", description: "The GitHub login whose token signs in; defaults to the one account hooks.json names, else the GitHub CLI's active account." }
|
|
77
|
+
const SERVER = { type: "string", placeholder: "<https origin>", description: "The hooks receiver, when hooks.json has no \"server\" yet." }
|
|
78
|
+
|
|
79
|
+
function drainsCli({ script, env, now, connect, listProcesses, signedIn, fetchHooks, hookToken }) {
|
|
80
|
+
const ackFlags = (flags, paths) => (flags.state ? ["--state", paths.state] : [])
|
|
81
|
+
const ackCommand = [process.execPath, path.resolve(script)]
|
|
82
|
+
const command = (name, def, run) => defineCommand({ name, output: "one JSON value", text, ...def, run })
|
|
83
|
+
return defineCli({
|
|
84
|
+
name: "drains",
|
|
85
|
+
about: [
|
|
86
|
+
"poll lists each configured repository's open issues, records what changed and prints the wakes to deliver.",
|
|
87
|
+
"A runner delivers each wake's message to its session, then runs the wake's `done` command, adding --error <text> when delivery failed.",
|
|
88
|
+
],
|
|
89
|
+
groups: {
|
|
90
|
+
schedule: "The prompts due to a session (schedules.json), at most one per schedule however many intervals were missed; see docs/schedules.md.",
|
|
91
|
+
stalled: "The nudges due to sessions that went idle with their focused task card unfinished and nothing running, once per idle stretch; see docs/stalled-nudges.md.",
|
|
92
|
+
relays: "The dispatch and merge-when-green relays in relays.json: poll acts on what it finds and prints no wakes; see docs/relays.md.",
|
|
93
|
+
hooks: "Webhooks: events any service posts to the hooks receiver become wakes for the session hooks.json names; see docs/webhooks.md.",
|
|
94
|
+
runtimes: "Copilot server runtimes started without Desk's plugin, whose sessions have no desk-* tools, and how to recover; see docs/schedules.md.",
|
|
95
|
+
},
|
|
96
|
+
commands: [
|
|
97
|
+
command("poll", { effect: "private", summary: "List each configured repository's open issues, record what changed and print the wakes to deliver.", flags: { config: CONFIG, state: STATE }, examples: ["poll"] }, async (input) => {
|
|
98
|
+
const paths = pathsOf(drainPaths({ env }), input)
|
|
99
|
+
return withDesk(await withDrainLock(paths.lock, () => pollDrains({ paths, connect, now: now(), ackCommand, ackFlags: ackFlags(input, paths), desk: deskLabel(deskInUse({ script, env })) })), { script, env })
|
|
100
|
+
}),
|
|
101
|
+
command("ack", ACK("repository", { repo: { type: "string", required: true, placeholder: "<owner/name>", description: "The repository the wake was for." } }), (input) => {
|
|
102
|
+
const paths = pathsOf(drainPaths({ env }), input)
|
|
103
|
+
return withDrainLock(paths.lock, () => {
|
|
104
|
+
const acked = ackWake({ paths, repo: input.repo, wake: input.wake, error: input.error, now: now() })
|
|
105
|
+
return input.error ? { ...acked, recovery: recoverDrainTarget({ paths, repo: input.repo, now: now() }) } : acked
|
|
106
|
+
})
|
|
107
|
+
}),
|
|
108
|
+
command("status", { effect: "private", summary: "List each drain's state, the relays and any unmerged save; refresh the local launcher without updating drain state.", flags: { config: CONFIG, state: STATE } }, (input) => {
|
|
109
|
+
const paths = pathsOf(drainPaths({ env }), input)
|
|
110
|
+
const status = [...drainStatusLines(readDrainConfig(paths.config), readDrainStates(paths.state), now()), ...relayLines(env, now()), ...allStuckSaves({ env, now }).map((save) => `unmerged save: ${stuckLine(save)}`)]
|
|
111
|
+
return withDesk({ status }, { script, env })
|
|
112
|
+
}),
|
|
113
|
+
command("why", { ...READ, summary: "Print the recorded reason for each wake made for one issue, newest first, and what a merge relay decided about it; with --relay, that relay's recent fires, merges and what it waits on instead.", args: [{ name: "target", description: "The issue, as owner/name#123.", unless: "relay", missing: "needs an issue such as owner/name#123 or --relay <relay name>" }], flags: { state: STATE, relay: { type: "string", placeholder: "<relay name>", description: "A relay's name, instead of an issue." } }, examples: ["why owner/name#123", "why --relay <relay name>"] }, (input) => {
|
|
114
|
+
const files = relayPaths({ env })
|
|
115
|
+
const relays = readRelayConfig(files.config)
|
|
116
|
+
const relayStates = readRelayStates(files.state)
|
|
117
|
+
if (input.relay) return whyRelay(relays, relayStates, input.relay)
|
|
118
|
+
const target = WHY_TARGET.exec(input.target)
|
|
119
|
+
if (!target) throw usageError("why-target", `${WHY_NEEDS}, not ${JSON.stringify(input.target)}`, "run drains why owner/name#123 or drains why --relay <relay name>")
|
|
120
|
+
const paths = pathsOf(drainPaths({ env }), input)
|
|
121
|
+
return { ...whyOf(readDrainStates(paths.state), target[1], Number(target[2])), relays: relaysOfPull(relays, relayStates, target[1], Number(target[2])) }
|
|
122
|
+
}),
|
|
123
|
+
command("schedule poll", { effect: "private", summary: "Record and print the prompts due to a session, at most one per schedule.", flags: { config: CONFIG, state: STATE } }, async (input) => {
|
|
124
|
+
const paths = pathsOf(schedulePaths({ env }), input)
|
|
125
|
+
return withDesk(await withDrainLock(paths.lock, async () => pollSchedules({ paths, now: now(), ackCommand, ackFlags: ackFlags(input, paths) })), { script, env })
|
|
126
|
+
}),
|
|
127
|
+
command("schedule ack", ACK("schedule", { name: { type: "string", required: true, placeholder: "<schedule>", description: "The schedule the wake was for." } }), (input) => {
|
|
128
|
+
const paths = pathsOf(schedulePaths({ env }), input)
|
|
129
|
+
return withDrainLock(paths.lock, async () => ackSchedule({ paths, name: input.name, wake: input.wake, error: input.error, now: now() }))
|
|
130
|
+
}),
|
|
131
|
+
command("schedule status", { effect: "private", summary: "List the schedules and refresh the local launcher without updating schedule state.", flags: { config: CONFIG, state: STATE } }, (input) => {
|
|
132
|
+
const paths = pathsOf(schedulePaths({ env }), input)
|
|
133
|
+
return withDesk({ status: scheduleStatusLines(readScheduleConfig(paths.config), readScheduleStates(paths.state), now()) }, { script, env })
|
|
134
|
+
}),
|
|
135
|
+
command("stalled poll", { effect: "private", summary: "Record and print the nudges due, once per idle stretch.", flags: { config: CONFIG, state: STATE } }, async (input) => {
|
|
136
|
+
const paths = pathsOf(stalledPaths({ env }), input)
|
|
137
|
+
return withDesk(await withDrainLock(paths.lock, () => pollStalled({ paths, now: now(), ackCommand, ackFlags: ackFlags(input, paths), env, homeDir: os.homedir() })), { script, env })
|
|
138
|
+
}),
|
|
139
|
+
command("stalled ack", ACK("stalled-session", { session: { type: "string", required: true, placeholder: "<id>", description: "The session the nudge was for." } }), (input) => {
|
|
140
|
+
const paths = pathsOf(stalledPaths({ env }), input)
|
|
141
|
+
return withDrainLock(paths.lock, async () => ackStalled({ paths, session: input.session, wake: input.wake, error: input.error, now: now() }))
|
|
142
|
+
}),
|
|
143
|
+
command("stalled status", { effect: "private", summary: "List the nudges due and refresh the local launcher without updating nudge state.", flags: { config: CONFIG, state: STATE } }, async (input) => {
|
|
144
|
+
const paths = pathsOf(stalledPaths({ env }), input)
|
|
145
|
+
return withDesk(await stalledStatus({ paths, now: now(), env, homeDir: os.homedir() }), { script, env })
|
|
146
|
+
}),
|
|
147
|
+
command("relays poll", { effect: "private", summary: "Poll the relays in relays.json, act on what is found and print no wakes.", flags: { config: CONFIG, state: STATE } }, async (input) => {
|
|
148
|
+
const paths = pathsOf(relayPaths({ env }), input)
|
|
149
|
+
return withDesk(await withDrainLock(paths.lock, () => pollRelays({ paths, drainFiles: drainPaths({ env }), connect, now: now(), signedIn })), { script, env })
|
|
150
|
+
}),
|
|
151
|
+
command("relays status", { effect: "private", summary: "List the relays and refresh the local launcher without acting on relays.", flags: { config: CONFIG, state: STATE } }, (input) => {
|
|
152
|
+
const paths = pathsOf(relayPaths({ env }), input)
|
|
153
|
+
return withDesk({ status: relayStatusLines(readRelayConfig(paths.config), readRelayStates(paths.state), now()) }, { script, env })
|
|
154
|
+
}),
|
|
155
|
+
command("hooks poll", { effect: "private", summary: "Save each configured hook's pending events and print one wake per hook that has any.", flags: { config: CONFIG, state: STATE } }, async (input) => {
|
|
156
|
+
const paths = pathsOf(hookPaths({ env }), input)
|
|
157
|
+
return withDesk(await withDrainLock(paths.lock, () => pollHooks({ paths, now: now(), ackCommand, ackFlags: [...(input.config ? ["--config", paths.config] : []), ...ackFlags(input, paths)], fetchImpl: fetchHooks, token: hookToken, env })), { script, env })
|
|
158
|
+
}),
|
|
159
|
+
command("hooks ack", { effect: "private", summary: "Acknowledge the events a delivered wake listed (or keep them all, with --error).", flags: { name: { type: "string", required: true, placeholder: "<hook>", description: "The hook the wake was for." }, events: { type: "string", required: true, placeholder: "<id,id>", description: "The event ids the wake listed, comma-separated." }, error: ERROR, config: CONFIG, state: STATE } }, (input) => {
|
|
160
|
+
const paths = pathsOf(hookPaths({ env }), input)
|
|
161
|
+
return withDrainLock(paths.lock, () => ackHooks({ paths, name: input.name, events: input.events, error: input.error, now: now(), fetchImpl: fetchHooks, token: hookToken, env }))
|
|
162
|
+
}),
|
|
163
|
+
command("hooks create", { effect: "private", summary: "Make a hook and print its address and, when the receiver makes it, its signing secret, once.", args: [{ name: "name", required: true, description: "The hook's name: lower-case letters, digits and hyphens." }], flags: { verify: { type: "enum", values: HOOK_PRESETS, default: "standard", description: "How the sender signs its events." }, "secret-stdin": { type: "boolean", description: "Read the sender's signing secret from stdin (stripe, sentry, linear, svix, resend, clerk)." }, account: ACCOUNT, server: SERVER, config: CONFIG }, examples: ["hooks create spoonjoy-sentry --verify sentry --secret-stdin"] }, async (input, ctx) => {
|
|
164
|
+
const paths = pathsOf(hookPaths({ env }), input)
|
|
165
|
+
const secret = input["secret-stdin"] ? await ctx.stdin() : undefined
|
|
166
|
+
return createHook({ name: input.name, verify: input.verify, secret, paths, account: input.account, server: input.server, env, fetchImpl: fetchHooks, token: hookToken })
|
|
167
|
+
}),
|
|
168
|
+
command("hooks list", { ...READ, summary: "List your hooks on the receiver: scheme, last event, pending count and last refusal.", flags: { account: ACCOUNT, server: SERVER, config: CONFIG } }, (input) => {
|
|
169
|
+
const paths = pathsOf(hookPaths({ env }), input)
|
|
170
|
+
return listHooks({ paths, account: input.account, server: input.server, env, fetchImpl: fetchHooks, token: hookToken })
|
|
171
|
+
}),
|
|
172
|
+
command("hooks delete", { effect: "private", summary: "Delete a hook and its pending events from the receiver.", args: [{ name: "name", required: true, description: "The hook to delete." }], flags: { account: ACCOUNT, server: SERVER, config: CONFIG } }, (input) => {
|
|
173
|
+
const paths = pathsOf(hookPaths({ env }), input)
|
|
174
|
+
return deleteHook({ name: input.name, paths, account: input.account, server: input.server, env, fetchImpl: fetchHooks, token: hookToken })
|
|
175
|
+
}),
|
|
176
|
+
command("hooks status", { effect: "private", summary: "List each hook's route, pending count and last error, and any hook nobody routes; refresh the local launcher without saving or acknowledging events.", flags: { config: CONFIG, state: STATE } }, async (input) => {
|
|
177
|
+
const paths = pathsOf(hookPaths({ env }), input)
|
|
178
|
+
return withDesk({ status: await hookStatus({ paths, now: now(), fetchImpl: fetchHooks, token: hookToken, env }) }, { script, env })
|
|
179
|
+
}),
|
|
180
|
+
command("runtimes status", { ...READ, summary: "Name the Copilot server runtimes started without Desk's plugin, and how to recover." }, () => ({ status: pluginlessRuntimeLines(findPluginlessRuntimes(listProcesses())) })),
|
|
181
|
+
],
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export async function runDrainsCli({ argv, script, env = process.env, io = process, now = Date.now, connect = connectGithub, listProcesses = psList, signedIn = ghSignedIn, fetchHooks = fetch, hookToken = ghToken }) {
|
|
186
|
+
return runCli(drainsCli({ script, env, now, connect, listProcesses, signedIn, fetchHooks, hookToken }), argv, { stdout: io.stdout, stderr: io.stderr, stdin: io.stdin })
|
|
187
|
+
}
|