@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,260 @@
|
|
|
1
|
+
// What a move to `done` must prove when the task's card names code repos (`repos:`).
|
|
2
|
+
//
|
|
3
|
+
// The invented-completion finding (boot acceptance round 6): an agent that could not open its pull request wrote a
|
|
4
|
+
// plan, recorded `commit` evidence for a commit it made in the desk itself (it held only the card edit) and told the
|
|
5
|
+
// operator "Task complete". A card that names code repos is finished by code in those repos, so the evidence must
|
|
6
|
+
// come from them:
|
|
7
|
+
// - `pr`: a pull request URL whose repository is one of the task's repos (no network call: shape and repository only);
|
|
8
|
+
// - `commit`: a commit that resolves in one of the task's recorded local clones and is already contained in a
|
|
9
|
+
// remote-tracking branch of that clone (pushed), never a commit in the desk;
|
|
10
|
+
// - a commit in a clone that has no remote at all is finished work with nowhere to push it (round 9: a local-only repo
|
|
11
|
+
// otherwise left an agent inventing `non_code` evidence that pointed at the task card), so such a commit counts, but
|
|
12
|
+
// only under the rule that closed the five ways round 9's review found to fake that state (`local-only.js` holds the
|
|
13
|
+
// recording): the repo entry was already on the card before this call and carries `local_only: true`, which Desk
|
|
14
|
+
// itself recorded when `task_create` or boot first saw the clone with no remote and the entry had no `url`; the clone
|
|
15
|
+
// still has no remote and is not inside the desk or holding it; the commit is reachable from HEAD or a local branch;
|
|
16
|
+
// and its committer date is not before the card's `created`. A clone with any remote needs the commit pushed or a pull
|
|
17
|
+
// request. What remains possible: an agent can make a new commit in a repo that really is local-only, which is real
|
|
18
|
+
// work in the recorded repo and so acceptable;
|
|
19
|
+
// - `ci_run` and `non_code` are refused: a task with code repos is not a non-code task.
|
|
20
|
+
// A card with no repos is unaffected here (`task.js` keeps its own per-kind shape checks for it).
|
|
21
|
+
|
|
22
|
+
import { realpathSync } from "node:fs"
|
|
23
|
+
import * as os from "node:os"
|
|
24
|
+
import { deskFailure } from "../runtime/desk-failure.js"
|
|
25
|
+
import { spawnSync } from "node:child_process"
|
|
26
|
+
import { resolveLocalPath } from "../util/paths.js"
|
|
27
|
+
import { normalizeRemote } from "../factory/binding.js"
|
|
28
|
+
import { isLocalOnlyClone, repoKey } from "./local-only.js"
|
|
29
|
+
|
|
30
|
+
const GIT_TIMEOUT_MS = 5000
|
|
31
|
+
const SHA_PREFIX = /^[0-9a-f]{7,40}/iu
|
|
32
|
+
const SHA_IN_URL = /\/commit\/([0-9a-f]{7,40})(?![0-9a-f])/iu
|
|
33
|
+
// A URL's tail may carry a sub-page (`/files`), a query or a fragment, but nothing before the identifying segments.
|
|
34
|
+
const TAIL = String.raw`(?:[/?#].*)?$`
|
|
35
|
+
const GITHUB_URL = {
|
|
36
|
+
pr: new RegExp(String.raw`^https://(?:www\.)?github\.com/([^/\s?#]+)/([^/\s?#]+)/pull/\d+${TAIL}`, "iu"),
|
|
37
|
+
commit: new RegExp(String.raw`^https://(?:www\.)?github\.com/([^/\s?#]+)/([^/\s?#]+)/commit/[0-9a-f]{7,40}(?![0-9a-f])${TAIL}`, "iu"),
|
|
38
|
+
}
|
|
39
|
+
// Azure DevOps: `dev.azure.com/<org>/<project>/_git/<repo>/...` or `<org>.visualstudio.com/<project>/_git/<repo>/...` (the project may be omitted when it is named like the repo).
|
|
40
|
+
// `<org>.visualstudio.com` may carry the legacy `DefaultCollection` segment before the project.
|
|
41
|
+
const ADO_BASE = String.raw`(?:dev\.azure\.com/[^/\s?#]+|[^/\s?#.]+\.visualstudio\.com(?:/DefaultCollection)?)(?:/[^/\s?#]+)?`
|
|
42
|
+
const ADO_URL = {
|
|
43
|
+
pr: new RegExp(String.raw`^https://${ADO_BASE}/_git/([^/\s?#]+)/pullrequest/\d+${TAIL}`, "iu"),
|
|
44
|
+
commit: new RegExp(String.raw`^https://${ADO_BASE}/_git/([^/\s?#]+)/commit/[0-9a-f]{7,40}(?![0-9a-f])${TAIL}`, "iu"),
|
|
45
|
+
}
|
|
46
|
+
// Any other host (GitHub Enterprise and the like) is trusted only when a recorded clone has a remote on it.
|
|
47
|
+
const OTHER_URL = {
|
|
48
|
+
pr: new RegExp(String.raw`^https://([^/\s?#]+)/(?:[^/\s?#]+/)*?([^/\s?#]+)/(?:pull|pullrequest)/\d+${TAIL}`, "iu"),
|
|
49
|
+
commit: new RegExp(String.raw`^https://([^/\s?#]+)/(?:[^/\s?#]+/)*?([^/\s?#]+)/commit/[0-9a-f]{7,40}(?![0-9a-f])${TAIL}`, "iu"),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The card's recorded repos as `{ name, localPath, mode }`, or `[]` when it names none (not a list, or no usable entry).
|
|
54
|
+
* A bare string entry (`repos: [widgets]`) names a repo with no recorded clone, so it counts as a repo.
|
|
55
|
+
*/
|
|
56
|
+
export function recordedRepos(value) {
|
|
57
|
+
if (!Array.isArray(value)) return []
|
|
58
|
+
return value.flatMap((entry) => {
|
|
59
|
+
if (typeof entry === "string") return entry.trim() === "" ? [] : [{ name: entry.trim(), localPath: "", mode: undefined, url: false }]
|
|
60
|
+
if (entry === null || typeof entry !== "object" || typeof entry.name !== "string" || entry.name.trim() === "") return []
|
|
61
|
+
return [{ name: entry.name.trim(), localPath: typeof entry.local_path === "string" ? entry.local_path.trim() : "", mode: entry.mode, url: typeof entry.url === "string" && entry.url.trim() !== "" }]
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function describeRepos(repos) {
|
|
67
|
+
return repos.map((repo) => (repo.localPath === "" ? `${repo.name} (no local clone recorded)` : `${repo.name} (${repo.localPath})`)).join(", ")
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function git(spawnGit, dir, args) {
|
|
71
|
+
const result = spawnGit("git", ["-C", dir, ...args], { windowsHide: true, encoding: "utf8", timeout: GIT_TIMEOUT_MS })
|
|
72
|
+
return result?.status === 0 && typeof result.stdout === "string" ? result.stdout : null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function lastSegments(urlPath, count) {
|
|
76
|
+
return urlPath.split("/").filter((segment) => segment !== "").slice(-count).join("/").toLowerCase()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// A host without its login (`git@`) and port (`:22`, `:8443`): an ssh remote and an https URL name the same machine.
|
|
80
|
+
const bareHost = (host) => host.replace(/^.*@/u, "").replace(/:\d+$/u, "").toLowerCase()
|
|
81
|
+
const isGithub = (host) => /^(www\.)?github\.com$/iu.test(host)
|
|
82
|
+
|
|
83
|
+
// The repository a PR or commit URL points at, by the host's own shape: GitHub `owner/repo`, Azure DevOps and any other
|
|
84
|
+
// host by the bare repo name. A URL that does not have exactly that shape names no repo (`host: ""`).
|
|
85
|
+
function urlRepo(ref, kind) {
|
|
86
|
+
let match = GITHUB_URL[kind].exec(ref)
|
|
87
|
+
if (match !== null) return { type: "github", id: `${match[1]}/${match[2]}`.toLowerCase() }
|
|
88
|
+
match = ADO_URL[kind].exec(ref)
|
|
89
|
+
if (match !== null) return { type: "ado", id: match[1].toLowerCase() }
|
|
90
|
+
match = OTHER_URL[kind].exec(ref)
|
|
91
|
+
if (match !== null && !isGithub(bareHost(match[1]))) return { type: "other", host: bareHost(match[1]), id: match[2].toLowerCase() }
|
|
92
|
+
return { type: "none", id: "" }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Every name a repo can be recognised by: its recorded name, plus the remotes of its local clone (an `origin` that is a
|
|
96
|
+
// fork and an `upstream` are both in the clone's config, so a PR opened from the fork route against the upstream, or on
|
|
97
|
+
// the fork itself, both match).
|
|
98
|
+
function repoIdentities(repos, { spawnGit, homeDir, deskRoot }) {
|
|
99
|
+
const hosts = new Set()
|
|
100
|
+
const github = new Set()
|
|
101
|
+
const bare = new Set()
|
|
102
|
+
const plainNames = new Set()
|
|
103
|
+
for (const repo of repos) {
|
|
104
|
+
if (repo.name.includes("/")) github.add(repo.name.toLowerCase())
|
|
105
|
+
else plainNames.add(repo.name.toLowerCase())
|
|
106
|
+
bare.add(lastSegments(repo.name, 1))
|
|
107
|
+
if (repo.localPath === "") continue
|
|
108
|
+
const listed = git(spawnGit, resolveLocalPath(repo.localPath, { homeDir, deskRoot }), ["config", "--get-regexp", "^remote\\..*\\.url$"])
|
|
109
|
+
for (const line of (listed ?? "").split("\n")) {
|
|
110
|
+
const url = line.trim().split(/\s+/u)[1]
|
|
111
|
+
if (url === undefined) continue
|
|
112
|
+
const normalized = normalizeRemote(url)
|
|
113
|
+
const parsed = /^[a-z][a-z0-9+.-]*:\/\/([^/]+)(\/.*|)$/u.exec(normalized)
|
|
114
|
+
if (parsed === null) continue
|
|
115
|
+
const host = bareHost(parsed[1])
|
|
116
|
+
if (isGithub(host)) github.add(lastSegments(parsed[2], 2))
|
|
117
|
+
else {
|
|
118
|
+
bare.add(lastSegments(parsed[2], 1))
|
|
119
|
+
hosts.add(host)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { github, bare, plainNames, hosts }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function matchesRepos(target, identities) {
|
|
127
|
+
if (target.type === "github") return identities.github.has(target.id) || identities.plainNames.has(target.id.split("/").at(-1))
|
|
128
|
+
if (target.type === "ado") return identities.bare.has(target.id)
|
|
129
|
+
if (target.type === "other") return identities.hosts.has(target.host) && identities.bare.has(target.id)
|
|
130
|
+
return false
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Is a GitHub PR's `owner/name` in this one recorded repo? "match"; "mismatch"; or "unknown" when the repo has no GitHub identity Desk can match (a plain name that only labels it, no GitHub remote on its clone). */
|
|
134
|
+
export function prRepoVerdict(repo, prRepo, { spawnGit, homeDir, deskRoot }) {
|
|
135
|
+
const identities = repoIdentities([repo], { spawnGit, homeDir, deskRoot })
|
|
136
|
+
if (matchesRepos({ type: "github", id: prRepo.toLowerCase() }, identities)) return "match"
|
|
137
|
+
return identities.github.size === 0 ? "unknown" : "mismatch"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function repoRefusal(toolName, kind, ref, repos) {
|
|
141
|
+
return new Error(deskFailure({
|
|
142
|
+
code: "done_evidence_ref_not_in_repos",
|
|
143
|
+
thing: `${toolName}: evidence.ref`,
|
|
144
|
+
probably: `\`evidence.ref\` ${JSON.stringify(ref)} is not in this task's repos (${describeRepos(repos)}), probably because it names a fork or another repo`,
|
|
145
|
+
look: "read the task's `repos` with desk_status, or call desk_doctor",
|
|
146
|
+
keepWorking: "the task was not moved, so keep working and call this tool again with the corrected evidence",
|
|
147
|
+
fix: `supply ${kind === "pr" ? "a PR URL" : "a commit URL"} in one of those repos; a pull request from a fork is opened against the upstream repo, so use the upstream's URL`,
|
|
148
|
+
}))
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function codeRepoUsage(toolName, repos) {
|
|
152
|
+
return (
|
|
153
|
+
`This task's card names code repos (${describeRepos(repos)}), so it is finished by code in them. ` +
|
|
154
|
+
`Pass \`evidence: { kind: "pr", ref: "<the pull request's URL>" }\` for a pull request in one of those repos, or ` +
|
|
155
|
+
`\`evidence: { kind: "commit", ref: "<sha>" }\` for a commit that exists in a recorded clone and is already pushed (a remote-tracking branch contains it), ` +
|
|
156
|
+
`or, for a repo Desk recorded as local-only (\`local_only: true\` on its entry, set when the clone was first seen with no remote), a commit in that clone that is reachable from a branch and was made after the task was created. ` +
|
|
157
|
+
`A commit in the desk itself does not count, and neither does a plan or notes file. If the work cannot be delivered yet (no way to open the pull request, no push access), ` +
|
|
158
|
+
`do not mark the task done: leave it at \`validating\` and tell the operator the commit sha and what is missing (use \`blocked\` or \`collaborating\` only if the work itself is unfinished).`
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function sameDirectory(a, b) {
|
|
163
|
+
try {
|
|
164
|
+
return realpathSync(a) === realpathSync(b)
|
|
165
|
+
} catch {
|
|
166
|
+
return false
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// The recorded entries whose clone Desk marked local-only: only entries that were on the card before this call (a repo
|
|
171
|
+
// added in the done call earns nothing), with `local_only: true`, and no `url` anywhere (an entry that has a url never
|
|
172
|
+
// qualifies, whichever list it is in).
|
|
173
|
+
function exemptKeys(existingRepos, repos) {
|
|
174
|
+
const withUrl = new Set(repos.filter((repo) => repo.url).map((repo) => repoKey({ name: repo.name, local_path: repo.localPath })))
|
|
175
|
+
const keys = new Set()
|
|
176
|
+
for (const entry of Array.isArray(existingRepos) ? existingRepos : []) {
|
|
177
|
+
if (entry === null || typeof entry !== "object" || entry.local_only !== true) continue
|
|
178
|
+
const key = repoKey(entry)
|
|
179
|
+
if (!withUrl.has(key) && !(typeof entry.url === "string" && entry.url.trim() !== "")) keys.add(key)
|
|
180
|
+
}
|
|
181
|
+
return keys
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const toMs = (value) => (value instanceof Date ? value.getTime() : Date.parse(String(value)))
|
|
185
|
+
|
|
186
|
+
// Why a commit in a recorded local-only clone is still not accepted, or null when it is: the commit must be reachable
|
|
187
|
+
// from HEAD or a local branch (not a dangling object), and made at or after the card's `created`.
|
|
188
|
+
function localOnlyRefusal({ spawnGit, dir, sha, created }) {
|
|
189
|
+
const onBranch = git(spawnGit, dir, ["for-each-ref", "--contains", sha, "--count=1", "--format=%(refname)", "refs/heads"])
|
|
190
|
+
const onHead = git(spawnGit, dir, ["merge-base", "--is-ancestor", sha, "HEAD"])
|
|
191
|
+
if ((onBranch ?? "").trim() === "" && onHead === null) return `commit ${sha.slice(0, 7)} is not reachable from HEAD or any local branch`
|
|
192
|
+
const createdMs = toMs(created)
|
|
193
|
+
if (Number.isNaN(createdMs)) return "the card has no readable `created` time to compare the commit's date against"
|
|
194
|
+
const committed = Number.parseInt(git(spawnGit, dir, ["show", "-s", "--format=%ct", sha]) ?? "", 10) * 1000
|
|
195
|
+
if (!(committed >= Math.floor(createdMs / 1000) * 1000)) return `commit ${sha.slice(0, 7)} was made before the task was created, so it is not work done for this task`
|
|
196
|
+
return null
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function checkCommit({ toolName, evidence, repos, deskRoot, spawnGit, homeDir, existingRepos, created }) {
|
|
200
|
+
const exempt = exemptKeys(existingRepos, repos)
|
|
201
|
+
const ref = evidence.ref.trim()
|
|
202
|
+
const isUrl = ref.startsWith("https://")
|
|
203
|
+
if (isUrl && !matchesRepos(urlRepo(ref, "commit"), repoIdentities(repos, { spawnGit, homeDir, deskRoot }))) {
|
|
204
|
+
throw repoRefusal(toolName, "commit", evidence.ref, repos)
|
|
205
|
+
}
|
|
206
|
+
const sha = (isUrl ? SHA_IN_URL : SHA_PREFIX).exec(ref)[isUrl ? 1 : 0]
|
|
207
|
+
const clones = repos.filter((repo) => repo.localPath !== "").map((repo) => ({ repo, dir: resolveLocalPath(repo.localPath, { homeDir, deskRoot }) }))
|
|
208
|
+
if (clones.length === 0) {
|
|
209
|
+
throw Object.assign(new Error(
|
|
210
|
+
`${toolName}: commit evidence needs a local clone to check, and none of this task's repos (${describeRepos(repos)}) records one. ` +
|
|
211
|
+
"Supply a pull request URL instead (`evidence: { kind: \"pr\", ref: \"<URL>\" }`), or record the clone's `local_path` on the card first."), { code: "done_evidence_commit_evidence_needs_a_local" })
|
|
212
|
+
}
|
|
213
|
+
let unpushed = null
|
|
214
|
+
let localOnlyWhy = null
|
|
215
|
+
for (const { repo, dir } of clones) {
|
|
216
|
+
if (sameDirectory(dir, deskRoot)) continue
|
|
217
|
+
if (git(spawnGit, dir, ["cat-file", "-e", `${sha}^{commit}`]) === null) continue
|
|
218
|
+
// A clone Desk recorded as local-only has nowhere to push: a commit that is really its work is the delivered work.
|
|
219
|
+
if (exempt.has(repoKey({ name: repo.name, local_path: repo.localPath })) && isLocalOnlyClone(dir, { spawnGit, deskRoot })) {
|
|
220
|
+
const why = localOnlyRefusal({ spawnGit, dir, sha, created })
|
|
221
|
+
if (why === null) return
|
|
222
|
+
localOnlyWhy ??= `${repo.name} is recorded as local-only, but ${why}`
|
|
223
|
+
} else if (git(spawnGit, dir, ["remote"])?.trim() === "") {
|
|
224
|
+
localOnlyWhy ??= `${repo.name} has no remote, but it does not qualify as a local-only repo (Desk records that on the card when the task is created, or boot first sees the clone with no remote and the entry has no \`url\`, and the clone must be outside the desk)`
|
|
225
|
+
}
|
|
226
|
+
const pushed = git(spawnGit, dir, ["for-each-ref", "--contains", sha, "--count=1", "--format=%(refname)", "refs/remotes"])
|
|
227
|
+
if (pushed !== null && pushed.trim() !== "") return
|
|
228
|
+
unpushed ??= repo
|
|
229
|
+
}
|
|
230
|
+
if (unpushed !== null) {
|
|
231
|
+
throw Object.assign(new Error(
|
|
232
|
+
`${toolName}: commit ${sha} exists in ${unpushed.name} (${unpushed.localPath}) but no remote-tracking branch contains it, so it is not pushed. ` +
|
|
233
|
+
(localOnlyWhy === null ? "" : `${localOnlyWhy}. `) +
|
|
234
|
+
"If the commit was pushed or merged elsewhere (a squash-merged PR's commit reaches the default branch only after a fetch), fetch that clone and repeat this call. " +
|
|
235
|
+
"Otherwise push the branch (which also updates the remote-tracking branch), then repeat; or open a pull request and supply its URL (`evidence: { kind: \"pr\", ref: \"<URL>\" }`); " +
|
|
236
|
+
`or leave the task at \`validating\` and tell the operator the commit sha ${sha.slice(0, 7)}, which is waiting to be pushed.`), { code: "done_evidence_commit_exists_in_but_no" })
|
|
237
|
+
}
|
|
238
|
+
throw Object.assign(new Error(
|
|
239
|
+
`${toolName}: commit ${sha} does not resolve in any of this task's repo clones (${describeRepos(repos)}). ` +
|
|
240
|
+
"If the commit is on the remote (for example a squash-merged PR), fetch the recorded clone first and repeat this call. " +
|
|
241
|
+
"A commit made in the desk, or in a repo the card does not list, does not count. Supply a commit from one of those repos that is pushed, or the pull request URL."), { code: "done_evidence_commit_does_not_resolve_in" })
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Throws, naming exactly what to supply, unless `evidence` (already shape-checked by `task.js`) is acceptable for a
|
|
246
|
+
* card that records `repos`. Does nothing when the card records none. `existingRepos` is the card's raw `repos` list before
|
|
247
|
+
* this call and `created` its creation time (both only for the local-only rule). `spawnGit` and `homeDir` are test seams.
|
|
248
|
+
*/
|
|
249
|
+
export function assertCodeRepoEvidence({ toolName, evidence, repos, deskRoot, spawnGit = spawnSync, homeDir = os.homedir(), existingRepos = [], created }) {
|
|
250
|
+
if (repos.length === 0) return
|
|
251
|
+
if (evidence.kind === "non_code" || evidence.kind === "ci_run") {
|
|
252
|
+
throw Object.assign(new Error(`${toolName}: Use evidence that names a code repository: \`${evidence.kind}\` evidence cannot complete a task that names code repos. ${codeRepoUsage(toolName, repos)}`), { code: "done_evidence_use_evidence_that_names_a" })
|
|
253
|
+
}
|
|
254
|
+
if (evidence.kind === "pr") {
|
|
255
|
+
const identities = repoIdentities(repos, { spawnGit, homeDir, deskRoot })
|
|
256
|
+
if (!matchesRepos(urlRepo(evidence.ref.trim(), "pr"), identities)) throw repoRefusal(toolName, "pr", evidence.ref, repos)
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
checkCommit({ toolName, evidence, repos, deskRoot, spawnGit, homeDir, existingRepos, created })
|
|
260
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// The factory as the Desk MCP tools see it: the host's plugin set, read the
|
|
2
|
+
// way the end hook reads it, and the local status and report link built on
|
|
3
|
+
// it (`src/factory/local-status.js`).
|
|
4
|
+
//
|
|
5
|
+
// The host is the one that started this server. Claude Code sets
|
|
6
|
+
// `CLAUDE_PLUGIN_ROOT` for a plugin's MCP server and Copilot does not, so
|
|
7
|
+
// with it set the scan reads Claude's plugin registry, and without it the
|
|
8
|
+
// folders beside Desk's plugin root (`DESK_PLUGIN_ROOT`: Claude's launcher
|
|
9
|
+
// sets it, and on every other host the server's entrypoint, `mcp/index.js`,
|
|
10
|
+
// sets it to its own installed plugin folder; else this checkout's own). The scan is
|
|
11
|
+
// the end hook's own `metadata` (`plugin-sources.cjs`, which the hook imports
|
|
12
|
+
// too), so the tools,
|
|
13
|
+
// the hooks and the boot check route a desk to the same store. A scan that
|
|
14
|
+
// fails is incomplete, which holds routing unless the desk declares its own
|
|
15
|
+
// store.
|
|
16
|
+
|
|
17
|
+
import * as os from "node:os"
|
|
18
|
+
import * as path from "node:path"
|
|
19
|
+
|
|
20
|
+
import { withLoopSwitch } from "../factory/loop-health.js"
|
|
21
|
+
import { pluginRootFor } from "../factory/end-hook.js"
|
|
22
|
+
import { metadata } from "../factory/plugin-sources.cjs"
|
|
23
|
+
import { readSmallText } from "../factory/marker.js"
|
|
24
|
+
import { factoryStateDir } from "../factory/boot-check.js"
|
|
25
|
+
import { PATTERNS, isPlainObject } from "../factory/schema.js"
|
|
26
|
+
import { CAPTURE_CHECK_ADVICE, ORPHAN_FINDING_ADVICE, RETENTION_FINDING_ADVICE, UNASKED_ADVICE, factoryLocalStatus, factoryReportLink } from "../factory/local-status.js"
|
|
27
|
+
import { signoffStatus, unsignedDeliveries, unsignedDeliveriesAsync } from "../desk/unsigned-deliveries.js"
|
|
28
|
+
|
|
29
|
+
const text = (value) => (typeof value === "string" && value.trim() !== "" ? value : null)
|
|
30
|
+
|
|
31
|
+
/** `{ dirs, incomplete }`: the plugin folders installed beside Desk for this server's host; see the header. */
|
|
32
|
+
export function factoryPluginScan(env) {
|
|
33
|
+
const claudeRoot = text(env.CLAUDE_PLUGIN_ROOT)
|
|
34
|
+
const pluginRoot = pluginRootFor(env)
|
|
35
|
+
try {
|
|
36
|
+
const { dirs, incomplete, reason } = metadata({ host: claudeRoot === null ? "copilot" : "claude", pluginRoot, home: text(env.HOME) ?? os.homedir(), env, readSmallText, PATTERNS })
|
|
37
|
+
return { dirs, incomplete, reason }
|
|
38
|
+
} catch {
|
|
39
|
+
return { dirs: [], incomplete: true, reason: null }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The sign-off counts of the desk (never a task name). The scan reads every unreadable thing as absent, so it does not throw.
|
|
44
|
+
function signoffCounts(deskRoot) {
|
|
45
|
+
const now = Date.now()
|
|
46
|
+
return signoffStatus(unsignedDeliveries(deskRoot, { now }), now)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const LOOP_SCHEMA = "desk.factory.loop/1"
|
|
50
|
+
const QUIET_AFTER_HOURS = 72
|
|
51
|
+
const LOOP_STEPS = ["evaluate", "route", "mirror", "reconcile", "verify", "measure", "deliver"]
|
|
52
|
+
|
|
53
|
+
/** The loop's health record the measure step stored in `status.json` (`loop.health`), or `null` when there is none or it is not a loop record. Read only. */
|
|
54
|
+
function storedLoop(env) {
|
|
55
|
+
try {
|
|
56
|
+
const status = JSON.parse(readSmallText(path.join(factoryStateDir(env), "status.json"), 8 * 1024 * 1024))
|
|
57
|
+
const record = isPlainObject(status) && isPlainObject(status.loop) ? status.loop.health : undefined
|
|
58
|
+
return isPlainObject(record) && record.schema === LOOP_SCHEMA ? record : null
|
|
59
|
+
} catch {
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function statusWithoutSignoff({ env, deskRoot }) {
|
|
65
|
+
const { dirs, incomplete, reason } = factoryPluginScan(env)
|
|
66
|
+
return { ...factoryLocalStatus({ env, deskRoot, pluginDirs: dirs, pluginScanIncomplete: incomplete, pluginScanReason: reason }), loop: withLoopSwitch(storedLoop(env), env) }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* `factoryLocalStatus` for `deskRoot` (or no desk) with this host's plugin set, the sign-off counts, and `loop`: the stored loop record or `null`.
|
|
71
|
+
* `signoff: false` leaves the sign-off counts out, for boot, which scans the delivered tasks itself (`recordUnsigned`) and would otherwise scan every card twice.
|
|
72
|
+
*/
|
|
73
|
+
export function factoryStatus({ env, deskRoot, signoff = true }) {
|
|
74
|
+
const status = statusWithoutSignoff({ env, deskRoot })
|
|
75
|
+
return deskRoot === null || deskRoot === undefined || !signoff ? status : { ...status, signoff: signoffCounts(deskRoot) }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The same answer as `factoryStatus`, with the sign-off scan read without blocking the thread: for `desk_status`, which answers the host on a time budget.
|
|
80
|
+
* The scan reads nothing more once `signal` aborts, and rejects with its reason.
|
|
81
|
+
*/
|
|
82
|
+
export async function factoryStatusAsync({ env, deskRoot, signal }) {
|
|
83
|
+
const status = statusWithoutSignoff({ env, deskRoot })
|
|
84
|
+
if (deskRoot === null || deskRoot === undefined) return status
|
|
85
|
+
const now = Date.now()
|
|
86
|
+
return { ...status, signoff: signoffStatus(await unsignedDeliveriesAsync(deskRoot, { now, signal }), now) }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// A Count as a phrase: the number, or `unavailable (reason)`. Anything that is not a Count reads unavailable, never 0.
|
|
90
|
+
function countText(value) {
|
|
91
|
+
if (isPlainObject(value) && value.state === "measured" && Number.isSafeInteger(value.value)) return String(value.value)
|
|
92
|
+
const reason = isPlainObject(value) && value.state === "unavailable" && Array.isArray(value.reasons) && typeof value.reasons[0] === "string" && /^[a-z_]{1,40}$/u.test(value.reasons[0]) ? ` (${value.reasons[0].replaceAll("_", " ")})` : ""
|
|
93
|
+
return `unavailable${reason}`
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const ageText = (value) => (isPlainObject(value) && value.state === "measured" && Number.isSafeInteger(value.value) ? `${value.value} days` : countText(value))
|
|
97
|
+
|
|
98
|
+
const part = (record, name) => (isPlainObject(record?.[name]) ? record[name] : {})
|
|
99
|
+
|
|
100
|
+
/** The "Loop" block: counts and the stale step names from the stored record; with no record it says so and prints no number. */
|
|
101
|
+
function loopLines(loop, now) {
|
|
102
|
+
if (!isPlainObject(loop)) return ["Loop", " no loop record yet: the loop's measure step has not run on this machine"]
|
|
103
|
+
const improvement = part(loop, "improvement")
|
|
104
|
+
const alarms = part(loop, "alarms")
|
|
105
|
+
const evaluator = part(loop, "evaluator")
|
|
106
|
+
const headless = part(evaluator, "headless")
|
|
107
|
+
const steps = part(loop, "steps")
|
|
108
|
+
const stale = LOOP_STEPS.filter((name) => isPlainObject(steps[name]) && steps[name].stale === true)
|
|
109
|
+
const state = typeof headless.state === "string" && /^[a-z_]{1,40}$/u.test(headless.state) ? headless.state : "unavailable"
|
|
110
|
+
const written = typeof loop.written_at === "string" && PATTERNS.timestamp.test(loop.written_at) ? loop.written_at : null
|
|
111
|
+
const version = typeof loop.desk_version === "string" && /^[0-9A-Za-z.+-]{1,40}$/u.test(loop.desk_version) ? loop.desk_version : null
|
|
112
|
+
const lines = ["Loop"]
|
|
113
|
+
const quiet = written !== null && now - Date.parse(written) > QUIET_AFTER_HOURS * 3600 * 1000 ? " (older than 72 hours: this machine is quiet)" : ""
|
|
114
|
+
const by = version === null ? "" : ` by Desk ${version}`
|
|
115
|
+
if (written !== null) lines.push(` record written ${written}${by}${quiet}`)
|
|
116
|
+
lines.push(` improvement cards: ${countText(improvement.open)} open, ${countText(improvement.claimed)} claimed, ${countText(improvement.claim_expired)} claim expired, ${countText(improvement.shipped)} shipped, ${countText(improvement.verifying)} verifying`)
|
|
117
|
+
lines.push(` oldest open ${ageText(improvement.oldest_open_age_days)}; oldest in verification ${ageText(improvement.oldest_in_verification_age_days)}`)
|
|
118
|
+
lines.push(` alarms: andon ${countText(alarms.andon_open)}, store build failing ${countText(alarms.store_build_failing)}, desk problems ${countText(alarms.desk_problems_open)}, loop alarm cards ${countText(alarms.loop_alarms_open)}`)
|
|
119
|
+
lines.push(` headless evaluator ${state}, ${countText(evaluator.waiting)} waiting, ${countText(evaluator.gave_up)} gave up`)
|
|
120
|
+
lines.push(` stale steps: ${stale.length === 0 ? "none" : stale.join(", ")}`)
|
|
121
|
+
if (isPlainObject(loop.worker)) {
|
|
122
|
+
const result = typeof loop.worker.last_result === "string" && /^[a-z0-9_:-]{1,64}$/u.test(loop.worker.last_result) ? loop.worker.last_result : "unavailable"
|
|
123
|
+
lines.push(` loop worker: last result ${result}${result === "disabled" ? " (switched off on this machine)" : ""}`)
|
|
124
|
+
}
|
|
125
|
+
return lines
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** `factoryReportLink` with this host's plugin set: `{ link }`, `{ link: null, reason }`, or `{ link: null }` without consent. */
|
|
129
|
+
export function reportLink({ env, deskRoot, deskRemote, personPrefix, track, slug }) {
|
|
130
|
+
const { dirs, incomplete } = factoryPluginScan(env)
|
|
131
|
+
return factoryReportLink({ env, deskRoot, deskRemote, personPrefix, track, slug, pluginDirs: dirs, pluginScanIncomplete: incomplete })
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The factory findings that need someone to act, one plain sentence each, as both the doctor's summary and the plain-text boot print them: the
|
|
136
|
+
* orphan pass, local retention, each contributed store whose own capture check keeps failing, this desk's route held now, the ended sessions
|
|
137
|
+
* held because their route cannot be read, and held sessions pruned uncaptured (the boot prefixes each with `Factory: `). Store names, codes
|
|
138
|
+
* and counts only, except that a hold names the manifest or plugin folder to fix, with its remedy.
|
|
139
|
+
*/
|
|
140
|
+
export function factoryFindingLines(status) {
|
|
141
|
+
if (!isPlainObject(status)) return []
|
|
142
|
+
const lines = []
|
|
143
|
+
if (status.orphans !== undefined) lines.push(`orphan pass needs attention: ${status.orphans}${status.orphans_hung > 0 ? ` (${status.orphans_hung} orphans hung)` : ""}. ${ORPHAN_FINDING_ADVICE}`)
|
|
144
|
+
if (status.retention !== undefined) lines.push(`local retention needs attention: ${status.retention}. ${RETENTION_FINDING_ADVICE}`)
|
|
145
|
+
for (const { store, times } of status.capture_check_unavailable ?? []) lines.push(`${store}: capture record not landing, the store's own check could not read it ${times} times in a row. ${CAPTURE_CHECK_ADVICE(store)}`)
|
|
146
|
+
for (const { store, since } of status.capture_dropped ?? []) lines.push(`${store}: capture record dropped from a rebuilt intake branch and not delivered since ${since.slice(0, 16)}Z; it is due at every flush, so it is not landing (check the coverage pass and the store's capture.json).`)
|
|
147
|
+
if (status.coverage_kept !== undefined) lines.push(`the quarantine did not settle since ${status.coverage_kept.since.slice(0, 16)}Z, so the capture coverage was kept back for an hour and then recorded anyway; a host mostly in quarantine is kept locally as held and sent to the store as not counted until the quarantine is cleared; the loop raises the alarm facts_quarantine_not_settling.`)
|
|
148
|
+
for (const hold of status.held_by ?? []) lines.push(`this desk's route is held, so its sessions are never published: ${holdText(hold)}`)
|
|
149
|
+
if (status.route_holds !== undefined) {
|
|
150
|
+
lines.push(`${status.route_holds.count} ended ${status.route_holds.count === 1 ? "session is" : "sessions are"} held because the store they route to cannot be read; they are never published until it can.`)
|
|
151
|
+
for (const hold of status.route_holds.reasons) lines.push(` ${holdText(hold)} (${hold.sessions} ${hold.sessions === 1 ? "session" : "sessions"})`)
|
|
152
|
+
}
|
|
153
|
+
for (const { route, reason, sessions, oldest_at: oldest } of status.held_groups ?? []) lines.push(`${sessions} ended ${sessions === 1 ? "session is" : "sessions are"} held for the route ${route} (${reason}), the oldest since ${String(oldest).slice(0, 10)}; ${HELD_CAUSES[reason] ?? "see desk_doctor"}`)
|
|
154
|
+
if (status.held_pruned !== undefined) lines.push(`${status.held_pruned.count} held ${status.held_pruned.count === 1 ? "session was" : "sessions were"} pruned after 90 days without being captured, the last on ${status.held_pruned.last_at.slice(0, 10)}.`)
|
|
155
|
+
return lines
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const HELD_CAUSES = {
|
|
159
|
+
no_desk_root: "the session recorded no desk folder, so it never derives; a new session in the desk records one",
|
|
160
|
+
newer_desk_recorded: "the session ran a newer Desk than this one, so this one waits; update Desk (it derives on the next sweep)",
|
|
161
|
+
route_unreadable: "the route's declaration cannot be read; fix the desk's _meta/factory.json or the plugin manifest it names",
|
|
162
|
+
route_unverified: "a Codex session's default route is not proven yet",
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// One hold: its reason, the manifest or plugin folder to fix, and the remedy.
|
|
166
|
+
const holdText = ({ reason, path: file, remedy }) => `${reason}${file === null ? "" : ` at ${file}`}: ${remedy}`
|
|
167
|
+
|
|
168
|
+
/** The human-readable "Factory" section desk_doctor adds to its summary: store names, codes and counts only. */
|
|
169
|
+
export function factorySummary(status, { now = Date.now() } = {}) {
|
|
170
|
+
const lines = ["Factory"]
|
|
171
|
+
if (status.store === null) {
|
|
172
|
+
lines.push(` no store resolved (${status.source}); facts are held on this machine`)
|
|
173
|
+
} else if (status.consent === "undecided") {
|
|
174
|
+
lines.push(` this desk reports to ${status.store} (${status.source}); contribution not decided yet (nothing raises it: desk_doctor with factory_consent records the operator's answer, when they ask)`)
|
|
175
|
+
} else {
|
|
176
|
+
lines.push(` this desk reports to ${status.store} (${status.source}); contribution: ${status.consent}`)
|
|
177
|
+
}
|
|
178
|
+
for (const entry of status.stores) {
|
|
179
|
+
const waiting = entry.waiting_for_visibility > 0 ? `, ${entry.waiting_for_visibility} waiting for a visibility answer` : ""
|
|
180
|
+
const moved = entry.route_changed > 0 ? `, ${entry.route_changed} routed elsewhere` : ""
|
|
181
|
+
lines.push(` ${entry.store}: ${entry.consent}, ${entry.pending} pending${waiting}${moved}, ${entry.quarantined} quarantined, ${entry.last_flush === null ? "no flush yet" : `last flush ${entry.last_flush}`}`)
|
|
182
|
+
}
|
|
183
|
+
for (const { store, sessions, age } of status.visibility_unasked ?? []) lines.push(` ${store}: ${sessions} sessions wait because their desk's visibility could not be asked for ${age === "unknown" ? "an unknown time" : "over 7 days"}. ${UNASKED_ADVICE(store)}`)
|
|
184
|
+
lines.push(...factoryFindingLines(status).map((line) => ` ${line}`))
|
|
185
|
+
for (const entry of status.stores) {
|
|
186
|
+
if (entry.kept_frozen > 0) lines.push(` ${entry.store}: ${entry.kept_frozen} kept copies have no route back and are never published (oldest ${entry.kept_frozen_oldest_days === null ? "of unknown age" : `${entry.kept_frozen_oldest_days} days`}); this is the fail-closed cost of a session whose route can no longer be shown, not a fault.`)
|
|
187
|
+
}
|
|
188
|
+
if (status.signoff) lines.push(signoffLine(status.signoff))
|
|
189
|
+
lines.push(...loopLines(status.loop, now))
|
|
190
|
+
return lines.join("\n")
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// "sign-off: 3 delivered tasks await sign-off, oldest 9 days; 2 delivered before sign-off was recorded". A lower bound says "at least".
|
|
194
|
+
function signoffLine({ unsigned, oldest_unsigned_age_days: oldest, not_recorded: notRecorded }) {
|
|
195
|
+
if (unsigned.state === "unavailable") return ` sign-off: not checked (${unsigned.reason})`
|
|
196
|
+
const least = (figure) => (figure.state === "partial" ? "at least " : "")
|
|
197
|
+
const days = (n) => `${n} ${n === 1 ? "day" : "days"}`
|
|
198
|
+
const count = unsigned.value
|
|
199
|
+
const earlier = notRecorded.state === "unavailable" || notRecorded.value === 0 ? "" : `; ${least(notRecorded)}${notRecorded.value} delivered before sign-off was recorded`
|
|
200
|
+
if (count === 0) return unsigned.state === "partial" ? ` sign-off: no delivered task found awaiting sign-off, but not every card was read (${unsigned.reason})${earlier}` : ` sign-off: no delivered tasks await sign-off${earlier}`
|
|
201
|
+
const head = `${least(unsigned)}${count} delivered ${count === 1 ? "task awaits" : "tasks await"} sign-off`
|
|
202
|
+
const age = oldest.state === "unavailable" ? "age unknown" : `${least(oldest)}${days(oldest.value)}`
|
|
203
|
+
return ` sign-off: ${head}, oldest ${age}${earlier}`
|
|
204
|
+
}
|