@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,9 @@
|
|
|
1
|
+
// What a task card says when its work lives only on another machine, shared by boot (which prints a note under the task) and the clone guard (which denies a clone or fetch of that repo).
|
|
2
|
+
// A next step or blocker that says the thing lives only on another machine: the agent must ask, never clone or fetch to look for it (boot acceptance round Q:
|
|
3
|
+
// an agent cloned a fork into the desk folder to find a branch the card says is only on the other laptop).
|
|
4
|
+
const MACHINE = String.raw`(?:laptop|machine|mac|computer|desktop|pc)(?![\w'-])(?!\s+(?:vision|learning|readable)\b)`
|
|
5
|
+
const ELSEWHERE = new RegExp(String.raw`\b(?:my|the|our) (?:other|another|old|work|home|personal) ${MACHINE}|\bon (?:my|the other) (?:laptop|desktop|mac)(?![\w'-])|\bonly on (?:the|my) ${MACHINE}|\bnot on this (?:machine|laptop|computer|mac)(?![\w'-])`, "i")
|
|
6
|
+
export const ELSEWHERE_NOTE = "not here: do not clone or fetch to look for it; ask the operator to push it from that machine or say where it is; unless the operator's own message already says it is pushed, in which case record that with task_update and retry"
|
|
7
|
+
|
|
8
|
+
/** Whether the task's next step or blocker says its work is on another machine. */
|
|
9
|
+
export const saysElsewhere = (task) => ELSEWHERE.test(`${task.next_step ?? ""} ${task.blocker ?? ""}`)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The evidence a bug report about a Desk failure carries, gathered for `friction_add` with an `error_code`:
|
|
2
|
+
// the failure's code, message and stack, the Desk version, the host, the desk path and the recent sync status.
|
|
3
|
+
// Credentials are redacted; Desk's own paths stay, because the entry is written to the desk and the public card holds structured fields only.
|
|
4
|
+
import { deskVersion } from "../package-metadata.js"
|
|
5
|
+
import { redactCredentialLikeText } from "../util/redact.js"
|
|
6
|
+
import { recentFailure } from "./desk-failure.js"
|
|
7
|
+
import { hostFromEnv, readSyncStatus } from "./sync-worker.js"
|
|
8
|
+
|
|
9
|
+
export function failureEvidence({ code, deskRoot, env }) {
|
|
10
|
+
const failure = recentFailure(code)
|
|
11
|
+
const sync = readSyncStatus({ root: deskRoot, env })
|
|
12
|
+
const lines = [
|
|
13
|
+
`Desk error \`${code}\`${failure === null ? ": this process holds no record of it (it came from another Desk process, such as session start), so the message and stack are missing" : ` at ${failure.at}`}`,
|
|
14
|
+
...(failure === null ? [] : [`Message: ${failure.message}`, `Stack:\n${failure.stack}`]),
|
|
15
|
+
`Desk version: ${deskVersion(env) ?? "unknown"}`,
|
|
16
|
+
`Host: ${hostFromEnv(env)}`,
|
|
17
|
+
`Desk path: ${deskRoot}`,
|
|
18
|
+
`Recent sync status: ${sync === null ? "none recorded" : JSON.stringify(sync)}`,
|
|
19
|
+
]
|
|
20
|
+
return redactCredentialLikeText(lines.join("\n"))
|
|
21
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Reads a checkout's branch, upstream and the commits both point at straight from `.git`, without starting Git. Each Git
|
|
2
|
+
// process costs tens of milliseconds on a quiet machine and seconds when the machine is loaded, so the pull path asks Git
|
|
3
|
+
// only what it cannot read from a file. Anything unusual (a detached HEAD, a branch with no upstream, an unreadable file)
|
|
4
|
+
// answers null and the caller asks Git instead.
|
|
5
|
+
|
|
6
|
+
import { readFileSync, statSync } from "node:fs"
|
|
7
|
+
import * as os from "node:os"
|
|
8
|
+
import * as path from "node:path"
|
|
9
|
+
|
|
10
|
+
const SHA = /^[0-9a-f]{40,64}$/u
|
|
11
|
+
|
|
12
|
+
function readText(file) {
|
|
13
|
+
try {
|
|
14
|
+
return readFileSync(file, "utf8")
|
|
15
|
+
} catch {
|
|
16
|
+
return ""
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// The directory holding this checkout's HEAD, and the one holding refs and config (the same unless this is a linked worktree).
|
|
21
|
+
function gitDirs(root) {
|
|
22
|
+
const dot = path.join(root, ".git")
|
|
23
|
+
const stats = statSync(dot, { throwIfNoEntry: false })
|
|
24
|
+
if (stats === undefined) return null
|
|
25
|
+
if (stats.isDirectory()) return { gitDir: dot, commonDir: dot }
|
|
26
|
+
const pointer = /^gitdir:\s*(.+?)\s*$/mu.exec(readText(dot))
|
|
27
|
+
if (pointer === null) return null
|
|
28
|
+
const gitDir = path.resolve(root, pointer[1])
|
|
29
|
+
const common = readText(path.join(gitDir, "commondir")).trim()
|
|
30
|
+
return { gitDir, commonDir: common ? path.resolve(gitDir, common) : gitDir }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function branchSettings(config, branch) {
|
|
34
|
+
const header = `[branch "${branch}"]`
|
|
35
|
+
const settings = {}
|
|
36
|
+
let inside = false
|
|
37
|
+
for (const raw of config.split(/\r?\n/u)) {
|
|
38
|
+
const line = raw.trim()
|
|
39
|
+
if (line.startsWith("[")) inside = line.toLowerCase() === header.toLowerCase()
|
|
40
|
+
else if (inside) {
|
|
41
|
+
const match = /^(remote|merge)\s*=\s*(.+)$/iu.exec(line)
|
|
42
|
+
if (match !== null) settings[match[1].toLowerCase()] = match[2].trim()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return settings
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function refValue(commonDir, ref) {
|
|
49
|
+
const loose = readText(path.join(commonDir, ref)).trim()
|
|
50
|
+
if (SHA.test(loose)) return loose
|
|
51
|
+
for (const line of (readText(path.join(commonDir, "packed-refs"))).split(/\r?\n/u)) {
|
|
52
|
+
const [sha, name] = line.split(" ")
|
|
53
|
+
if (name === ref && SHA.test(sha)) return sha
|
|
54
|
+
}
|
|
55
|
+
return null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* `{ branch, remote, merge, tracking, head, target }` for the checked-out branch and the remote-tracking ref it follows, or
|
|
60
|
+
* null when this is not a plain branch with a plain upstream Git can be left out of.
|
|
61
|
+
*/
|
|
62
|
+
export function readUpstreamRefs(root) {
|
|
63
|
+
const dirs = gitDirs(root)
|
|
64
|
+
if (dirs === null) return null
|
|
65
|
+
const branch = /^ref: refs\/heads\/(.+?)\s*$/u.exec(readText(path.join(dirs.gitDir, "HEAD")))?.[1]
|
|
66
|
+
const config = readText(path.join(dirs.commonDir, "config"))
|
|
67
|
+
if (branch === undefined || config === "") return null
|
|
68
|
+
const { remote, merge } = branchSettings(config, branch)
|
|
69
|
+
if (remote === undefined || remote === "." || merge === undefined || !merge.startsWith("refs/heads/")) return null
|
|
70
|
+
const tracking = `refs/remotes/${remote}/${merge.slice("refs/heads/".length)}`
|
|
71
|
+
const head = refValue(dirs.commonDir, `refs/heads/${branch}`)
|
|
72
|
+
const target = refValue(dirs.commonDir, tracking)
|
|
73
|
+
return head === null || target === null ? null : { branch, remote, merge, tracking, head, target }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// A checkout Git can be left out of: a plain `.git` folder in `root` (so `root` is the top of the work tree), the files
|
|
77
|
+
// backend for refs, and no environment variable that points Git somewhere else.
|
|
78
|
+
function plainCheckout(root) {
|
|
79
|
+
if (process.env.GIT_DIR || process.env.GIT_COMMON_DIR || process.env.GIT_WORK_TREE) return null
|
|
80
|
+
const dirs = gitDirs(root)
|
|
81
|
+
if (dirs === null) return null
|
|
82
|
+
if (statSync(path.join(dirs.commonDir, "reftable"), { throwIfNoEntry: false }) !== undefined) return null
|
|
83
|
+
return dirs
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const answer = (stdout) => ({ status: 0, signal: null, error: undefined, stdout: `${stdout}\n`, stderr: "" })
|
|
87
|
+
const same = (args, ...wanted) => args.length === wanted.length && args.every((arg, i) => arg === wanted[i])
|
|
88
|
+
|
|
89
|
+
// A git-path that always lives in the shared git folder or in the checkout's own one, as Git itself decides.
|
|
90
|
+
const SHARED_PATHS = /^(?:config|packed-refs|objects|refs|hooks|info|lfs|modules)(?:\/|$)/u
|
|
91
|
+
|
|
92
|
+
function gitPath(dirs, name) {
|
|
93
|
+
return path.join(SHARED_PATHS.test(name) ? dirs.commonDir : dirs.gitDir, name)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function sectionValue(config, header, name) {
|
|
97
|
+
let inside = false
|
|
98
|
+
let value
|
|
99
|
+
for (const raw of config.split(/\r?\n/u)) {
|
|
100
|
+
const line = raw.trim()
|
|
101
|
+
if (line.startsWith("[")) inside = line === header
|
|
102
|
+
else if (inside) {
|
|
103
|
+
const match = /^([A-Za-z]+)\s*=\s*(.*)$/u.exec(line)
|
|
104
|
+
if (match !== null && match[1].toLowerCase() === name) value = match[2].trim()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return value === "" ? undefined : value
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* What `git -C root <args>` would print, for the few read-only questions the save and pull paths ask over and over, read
|
|
112
|
+
* from `.git` files instead of a process. A `spawnSync`-shaped answer, or null when Git must be asked (any other command, a
|
|
113
|
+
* detached HEAD, a ref or setting the files do not plainly hold, a folder below the top of its work tree).
|
|
114
|
+
*/
|
|
115
|
+
// A config file's text with every file it includes (whatever the include's condition) appended; null past a few levels.
|
|
116
|
+
function withIncludes(file, depth = 0) {
|
|
117
|
+
const text = readText(file)
|
|
118
|
+
if (!/^\s*\[\s*include/imu.test(text)) return text
|
|
119
|
+
if (depth > 3) return null
|
|
120
|
+
const home = process.env.HOME || os.homedir()
|
|
121
|
+
const parts = [text]
|
|
122
|
+
for (const [, target] of text.matchAll(/^\s*path\s*=\s*(.+?)\s*$/gimu)) {
|
|
123
|
+
const inner = withIncludes(path.resolve(path.dirname(file), target.replace(/^~(?=\/)/u, home)), depth + 1)
|
|
124
|
+
if (inner === null) return null
|
|
125
|
+
parts.push(inner)
|
|
126
|
+
}
|
|
127
|
+
return parts.join("\n")
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Every config file and environment setting Git reads outside the repository, as one text; null when it cannot all be read.
|
|
131
|
+
function outerConfig() {
|
|
132
|
+
const home = process.env.HOME || os.homedir()
|
|
133
|
+
const files = [process.env.GIT_CONFIG_GLOBAL, home && path.join(home, ".gitconfig"), process.env.XDG_CONFIG_HOME ? path.join(process.env.XDG_CONFIG_HOME, "git", "config") : home && path.join(home, ".config", "git", "config"), process.env.GIT_CONFIG_SYSTEM ?? "/etc/gitconfig"]
|
|
134
|
+
const env = Object.entries(process.env).filter(([key]) => key.startsWith("GIT_CONFIG_") && !["GIT_CONFIG_GLOBAL", "GIT_CONFIG_SYSTEM", "GIT_CONFIG_NOSYSTEM", "GIT_CONFIG_COUNT"].includes(key)).map(([, value]) => value)
|
|
135
|
+
const texts = files.filter(Boolean).map((file) => withIncludes(file))
|
|
136
|
+
return texts.includes(null) ? null : [...texts, ...env].join("\n")
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** True when no configuration anywhere (this repository's, the user's, the machine's, the environment's) mentions `key`. */
|
|
140
|
+
function configSilentOn(dirs, key) {
|
|
141
|
+
const outer = outerConfig()
|
|
142
|
+
const local = withIncludes(path.join(dirs.commonDir, "config"))
|
|
143
|
+
if (outer === null || local === null) return false
|
|
144
|
+
return !new RegExp(key, "iu").test(`${outer}\n${local}\n${readText(path.join(dirs.gitDir, "config.worktree"))}`)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** What `git stripspace` writes for `text`: trailing blanks cut, runs of empty lines made one, the edges trimmed. */
|
|
148
|
+
export function stripspace(text) {
|
|
149
|
+
const out = []
|
|
150
|
+
for (const raw of text.split("\n")) {
|
|
151
|
+
const line = raw.replace(/[ \t\r\f\v]+$/u, "")
|
|
152
|
+
if (line === "" && (out.length === 0 || out[out.length - 1] === "")) continue
|
|
153
|
+
out.push(line)
|
|
154
|
+
}
|
|
155
|
+
while (out.length > 0 && out[out.length - 1] === "") out.pop()
|
|
156
|
+
return out.length === 0 ? "" : `${out.join("\n")}\n`
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function fastGitAnswer(root, args, input) {
|
|
160
|
+
try {
|
|
161
|
+
const dirs = plainCheckout(root)
|
|
162
|
+
if (dirs === null) return null
|
|
163
|
+
const head = readText(path.join(dirs.gitDir, "HEAD"))
|
|
164
|
+
const branch = /^ref: refs\/heads\/(.+?)\s*$/u.exec(head)?.[1]
|
|
165
|
+
if (same(args, "symbolic-ref", "--short", "-q", "HEAD") || same(args, "symbolic-ref", "--quiet", "--short", "HEAD")) return branch === undefined ? null : answer(branch)
|
|
166
|
+
if (same(args, "rev-parse", "--verify", "-q", "HEAD") || same(args, "rev-parse", "HEAD")) {
|
|
167
|
+
const sha = branch === undefined ? null : refValue(dirs.commonDir, `refs/heads/${branch}`)
|
|
168
|
+
return sha === null ? null : answer(sha)
|
|
169
|
+
}
|
|
170
|
+
if (same(args, "rev-parse", "--verify", "HEAD^{commit}")) {
|
|
171
|
+
const sha = branch === undefined ? null : refValue(dirs.commonDir, `refs/heads/${branch}`)
|
|
172
|
+
return sha === null ? null : answer(sha)
|
|
173
|
+
}
|
|
174
|
+
if (args.length === 4 && args[0] === "rev-parse" && args[1] === "--verify" && args[2] === "-q" && /^refs\/heads\/[A-Za-z0-9._\/-]+$/u.test(args[3]) && !args[3].includes("..")) {
|
|
175
|
+
const sha = refValue(dirs.commonDir, args[3])
|
|
176
|
+
return sha === null ? null : answer(sha)
|
|
177
|
+
}
|
|
178
|
+
if (same(args, "stripspace") && typeof input === "string") return { ...answer(""), stdout: stripspace(input) }
|
|
179
|
+
if (same(args, "symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD")) {
|
|
180
|
+
const target = /^ref: refs\/remotes\/(origin\/.+?)\s*$/u.exec(readText(path.join(dirs.commonDir, "refs/remotes/origin/HEAD")))?.[1]
|
|
181
|
+
return target === undefined ? null : answer(target)
|
|
182
|
+
}
|
|
183
|
+
if (same(args, "config", "--type=bool", "--get", "commit.gpgSign")) return configSilentOn(dirs, "gpgsign") ? { ...answer(""), status: 1, stdout: "" } : null
|
|
184
|
+
if (args[0] === "hook" && args[1] === "run" && args[2] === "--ignore-missing" && /^[a-z-]+$/u.test(args[3] ?? "")) {
|
|
185
|
+
const present = statSync(path.join(dirs.commonDir, "hooks", args[3]), { throwIfNoEntry: false }) !== undefined
|
|
186
|
+
return present || !configSilentOn(dirs, "hookspath") ? null : { ...answer(""), stdout: "", skipped: true }
|
|
187
|
+
}
|
|
188
|
+
if (same(args, "rev-parse", "--is-inside-work-tree")) return answer("true")
|
|
189
|
+
if (same(args, "rev-parse", "--show-toplevel")) return answer(root.replaceAll("\\", "/"))
|
|
190
|
+
if (same(args, "rev-parse", "--show-prefix")) return { ...answer(""), stdout: "\n" }
|
|
191
|
+
if (args[0] === "rev-parse" && args[1] === "--git-path" && args.length === 3) return answer(gitPath(dirs, args[2]))
|
|
192
|
+
if (args[0] === "rev-parse" && args[1] === "--path-format=absolute" && args.length > 2 && args.slice(2).every((arg, i) => i % 2 === 0 ? arg === "--git-path" : !arg.startsWith("-")))
|
|
193
|
+
return answer(args.slice(2).filter((_, i) => i % 2 === 1).map((name) => gitPath(dirs, name)).join("\n"))
|
|
194
|
+
if (same(args, "symbolic-ref", "refs/remotes/origin/HEAD")) {
|
|
195
|
+
const target = /^ref: (refs\/remotes\/origin\/.+?)\s*$/u.exec(readText(path.join(dirs.commonDir, "refs/remotes/origin/HEAD")))?.[1]
|
|
196
|
+
return target === undefined ? null : answer(target)
|
|
197
|
+
}
|
|
198
|
+
const key = args.length === 3 && args[0] === "config" && args[1] === "--get" ? /^(remote|branch)\.([A-Za-z0-9_-]+)\.(url|pushurl|remote|merge)$/u.exec(args[2]) : null
|
|
199
|
+
if (key !== null) {
|
|
200
|
+
const config = readText(path.join(dirs.commonDir, "config"))
|
|
201
|
+
if (/^\s*\[\s*(?:include|url)/imu.test(config)) return null
|
|
202
|
+
const value = sectionValue(config, `[${key[1]} "${key[2]}"]`, key[3])
|
|
203
|
+
return value === undefined || value.includes('"') || value.includes("\\") ? null : answer(value)
|
|
204
|
+
}
|
|
205
|
+
} catch {
|
|
206
|
+
// Anything unexpected is Git's to answer.
|
|
207
|
+
}
|
|
208
|
+
return null
|
|
209
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// A local, per-machine throttle on spawning the detached failure-contract
|
|
2
|
+
// filer (spec.md §1, Part 5 fix round). Before this, a mechanism that keeps
|
|
3
|
+
// failing the same way -- a boot check on every session start
|
|
4
|
+
// that hits it -- spawned a fresh `file-desk-problem.js` process every single
|
|
5
|
+
// time, each one doing an account lookup and `gh` calls. The outbox's own
|
|
6
|
+
// fingerprint and named lock already stop a duplicate *issue*; this throttle
|
|
7
|
+
// stops the local *spawning* storm before it ever reaches that point.
|
|
8
|
+
//
|
|
9
|
+
// `shouldLaunchFiler` fails toward launching: any problem reading or writing
|
|
10
|
+
// its own stamp file just means the next qualifying event spawns again --
|
|
11
|
+
// never that a genuine failure goes unfiled. The stamp lives under Desk's own
|
|
12
|
+
// state directory (`resolveDeskStateDir`), keyed by a hash of the mechanism
|
|
13
|
+
// and the caller's own signature, never inside a desk.
|
|
14
|
+
|
|
15
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs"
|
|
16
|
+
import * as path from "node:path"
|
|
17
|
+
import { launchStampKey } from "../factory/filer-launch.js"
|
|
18
|
+
import { resolveDeskStateDir } from "./last-start.js"
|
|
19
|
+
import { assertNotRealStateUnderTest } from "./test-state-guard.js"
|
|
20
|
+
import { renameWithRetry } from "../util/rename-retry.js"
|
|
21
|
+
|
|
22
|
+
const THROTTLE_STATE_DIR = "filer-throttle"
|
|
23
|
+
export const DEFAULT_FILER_COOLDOWN_MS = 60 * 60 * 1000
|
|
24
|
+
|
|
25
|
+
// `signature` always arrives as a string: `shouldLaunchFiler`'s own default
|
|
26
|
+
// (`signature = ""` below) is this function's only caller's only source.
|
|
27
|
+
const stampKey = launchStampKey
|
|
28
|
+
|
|
29
|
+
function stampPath({ env, mechanism, signature }) {
|
|
30
|
+
return path.join(resolveDeskStateDir({ env }), THROTTLE_STATE_DIR, `${stampKey(mechanism, signature)}.json`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* `shouldLaunchFiler({ env, mechanism, signature, cooldownMs, now }) ->
|
|
35
|
+
* boolean`: true the first time a given `mechanism`+`signature` pair is seen,
|
|
36
|
+
* or once `cooldownMs` (default one hour) has passed since the last time this
|
|
37
|
+
* returned true for that pair; false otherwise. The caller still builds and
|
|
38
|
+
* shows its `Desk problem:` block every time -- only the actual filer spawn
|
|
39
|
+
* is gated -- and reports the block's own `file:` field as "filing in
|
|
40
|
+
* background" on `true` or "filing already queued (within the last hour)" on
|
|
41
|
+
* `false`.
|
|
42
|
+
*/
|
|
43
|
+
export function shouldLaunchFiler({
|
|
44
|
+
env = process.env, mechanism, signature = "", cooldownMs = DEFAULT_FILER_COOLDOWN_MS, now = () => Date.now(),
|
|
45
|
+
} = {}) {
|
|
46
|
+
const file = stampPath({ env, mechanism, signature })
|
|
47
|
+
try {
|
|
48
|
+
const previous = JSON.parse(readFileSync(file, "utf8"))
|
|
49
|
+
if (typeof previous.at === "number" && now() - previous.at < cooldownMs) return false
|
|
50
|
+
} catch {
|
|
51
|
+
// No previous stamp, or an unreadable one: this counts as the first launch.
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const directory = path.dirname(file)
|
|
55
|
+
assertNotRealStateUnderTest(directory, { env })
|
|
56
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 })
|
|
57
|
+
const temporary = `${file}.${process.pid}.tmp`
|
|
58
|
+
// `pending` until the filer records an outcome (`factory/filer-launch.js` `endLaunch`): a filer that never starts leaves it set, and
|
|
59
|
+
// the verify step reads it as a drop rather than a measured "no hit".
|
|
60
|
+
writeFileSync(temporary, `${JSON.stringify({ at: now(), pending: true })}\n`, { mode: 0o600 })
|
|
61
|
+
renameWithRetry(temporary, file)
|
|
62
|
+
} catch {
|
|
63
|
+
// Not persisted: the next qualifying event just launches again.
|
|
64
|
+
}
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// The focused task card of a stalled session: where its card is, whether the card says the session may rest, and the nudge text.
|
|
2
|
+
// This file imports only `node:` built-ins and Desk's lifecycle list: the poller runs from a bare checkout with no installed
|
|
3
|
+
// dependencies, so it cannot use the card parser (gray-matter) or the blocker reader in desk/active-tasks.js, and reads the three
|
|
4
|
+
// frontmatter keys and the blocker it needs itself.
|
|
5
|
+
// Shared by the poller (`stalled.js`, run by an always-on agent runtime) and by Desk's own fallback in a session (`desk_status`
|
|
6
|
+
// and the first reply, see docs/stalled-nudges.md). Nothing here writes.
|
|
7
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs"
|
|
8
|
+
import * as path from "node:path"
|
|
9
|
+
import { TERMINAL_STATES } from "../desk/lifecycle.js"
|
|
10
|
+
|
|
11
|
+
/** The nudge's opening words; a runner that supports `replaces` takes an older copy of it back from a session's queue. */
|
|
12
|
+
export const NUDGE_PREFIX = "Your focused card isn't done and nothing is running:"
|
|
13
|
+
const NUDGE_BODY = "walk its definition of done; continue, or write the final report (Asked / Delivered / Accept or send back?)."
|
|
14
|
+
|
|
15
|
+
/** What a wake says. `idle` is a number of minutes. */
|
|
16
|
+
export function nudgeText({ track, slug, status, idle }) {
|
|
17
|
+
return `${NUDGE_PREFIX} ${NUDGE_BODY} Card: ${track}/${slug} (${status}), idle ${idle}m. If you are waiting on a person, write the blocker and its date on the card; to stop these nudges set \`nudge: false\` in its frontmatter.`
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** What a session sees when it is still running but its card has not moved (the fallback inside a session, where "nothing is running" is not knowable). */
|
|
21
|
+
function staleCardText({ track, slug, status, quiet }) {
|
|
22
|
+
return `Your focused card ${track}/${slug} (${status}) isn't done and hasn't moved in ${quiet}m: walk its definition of done; continue, or write the final report (Asked / Delivered / Accept or send back?). If you are waiting on a person, write the blocker and its date on the card; to stop these nudges set \`nudge: false\` in its frontmatter.`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// A desk workspace has `_meta/` plus either `_archive/` (a solo desk) or `desks/` (a Crew workspace), as util/paths.js decides.
|
|
26
|
+
function isDeskWorkspace(dir) {
|
|
27
|
+
return isDir(path.join(dir, "_meta")) && (isDir(path.join(dir, "_archive")) || isDir(path.join(dir, "desks")))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isDir = (dir) => {
|
|
31
|
+
try {
|
|
32
|
+
return readdirSync(dir) !== null
|
|
33
|
+
} catch {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Every folder that can hold `<track>/<slug>/task.md` for a session: desk roots (its working folder, its Git root, `extra`, then the desks in the home folder) and, in a Crew workspace, each member's desk. The session's own folders come first. */
|
|
39
|
+
export function cardBases({ cwd, gitRoot, extra, homeDir }) {
|
|
40
|
+
const roots = []
|
|
41
|
+
const add = (dir) => {
|
|
42
|
+
if (typeof dir === "string" && dir !== "" && !roots.includes(dir) && isDeskWorkspace(dir)) roots.push(dir)
|
|
43
|
+
}
|
|
44
|
+
for (const dir of [cwd, gitRoot, ...extra]) add(dir)
|
|
45
|
+
for (const entry of readdirSync(homeDir, { withFileTypes: true })) if (entry.isDirectory()) add(path.join(homeDir, entry.name))
|
|
46
|
+
const bases = []
|
|
47
|
+
for (const root of roots) {
|
|
48
|
+
bases.push(root)
|
|
49
|
+
const desks = path.join(root, "desks")
|
|
50
|
+
if (!isDir(desks)) continue
|
|
51
|
+
for (const entry of readdirSync(desks, { withFileTypes: true })) if (entry.isDirectory()) bases.push(path.join(desks, entry.name))
|
|
52
|
+
}
|
|
53
|
+
return bases
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const LAYOUTS = (track, slug) => [[track, slug], [track, "_archive", slug], ["_archive", track, slug], ["_archive", track, "_archive", slug]]
|
|
57
|
+
|
|
58
|
+
/** The focused card: `{ file, archived, data, content }` from the first base that holds it, or null. */
|
|
59
|
+
export function findFocusedCard(bases, { track, slug }) {
|
|
60
|
+
for (const base of bases) {
|
|
61
|
+
for (const segments of LAYOUTS(track, slug)) {
|
|
62
|
+
const file = path.join(base, ...segments, "task.md")
|
|
63
|
+
if (existsSync(file)) return { file, archived: segments.includes("_archive"), ...parseCard(readFileSync(file, "utf8")) }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** `{ data: { status, nudge, updated }, content }` from a card's text: the top-level frontmatter keys Desk reads here, and the body. */
|
|
70
|
+
function parseCard(raw) {
|
|
71
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n([\s\S]*))?$/u.exec(raw)
|
|
72
|
+
const data = {}
|
|
73
|
+
for (const line of (match?.[1] ?? "").split(/\r?\n/u)) {
|
|
74
|
+
const pair = /^(status|nudge|updated):[ \t]*(.*?)[ \t]*$/u.exec(line)
|
|
75
|
+
if (pair === null) continue
|
|
76
|
+
const value = pair[2].replace(/^(['"])(.*)\1$/u, "$2")
|
|
77
|
+
data[pair[1]] = value
|
|
78
|
+
}
|
|
79
|
+
return { data, content: match?.[2] ?? "" }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const BLOCKER_HEADING = /^#{1,6}[ \t]+(?:blockers?|waiting on|blocked on|blocked by)[ \t]*:?[ \t]*$/iu
|
|
83
|
+
const BLOCKER_LINE = /^(?:[-*+][ \t]+)?(?:>[ \t]*)?(?:\*\*(?:blockers?|waiting on|blocked on|blocked by):?\*\*:?|(?:blockers?|waiting on|blocked on|blocked by):)[ \t]*(.*)$/iu
|
|
84
|
+
const NO_BLOCKER = /^(?:none|n\/a|na|nil|no blockers?|nothing|-|—)\.?$/iu
|
|
85
|
+
|
|
86
|
+
/** The card's recorded blocker as one line (a `## Blocker`, `## Blockers` or `## Waiting on` section, or a `Blocker:` line), or null. */
|
|
87
|
+
function blockerOf(content) {
|
|
88
|
+
const lines = content.split(/\r?\n/u)
|
|
89
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
90
|
+
let text = null
|
|
91
|
+
if (BLOCKER_HEADING.test(lines[index].trim())) {
|
|
92
|
+
let end = index + 1
|
|
93
|
+
while (end < lines.length && !/^#{1,6}\s/u.test(lines[end])) end += 1
|
|
94
|
+
text = lines.slice(index + 1, end).join(" ")
|
|
95
|
+
} else {
|
|
96
|
+
text = BLOCKER_LINE.exec(lines[index].trim())?.[1] ?? null
|
|
97
|
+
}
|
|
98
|
+
const clean = text === null ? "" : text.replace(/\s+/gu, " ").trim()
|
|
99
|
+
if (clean !== "" && !NO_BLOCKER.test(clean)) return clean
|
|
100
|
+
}
|
|
101
|
+
return null
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const GATE_WORD = /\b(?:approv\w*|sign-?off|review\w*|decision|decide|operator|requester|human|owner|go-ahead|answer|repl(?:y|ies)|response)\b|^waiting on\b/iu
|
|
105
|
+
const ISO_DATE = /\b(\d{4}-\d{2}-\d{2})\b/u
|
|
106
|
+
const OTHER_DATE = /\b(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.? \d{1,2}\b|\b\d{1,2} (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\b|\b(?:mon|tues?|wed(?:nes)?|thu(?:rs)?|fri|sat(?:ur)?|sun)(?:day)?\b/iu
|
|
107
|
+
|
|
108
|
+
/** Whether a blocker names a person's decision and a date, so the session is waiting rather than stalled. An ISO date already past means the wait is overdue, which is not a reason to rest. */
|
|
109
|
+
export function namesHumanGate(blocker, now) {
|
|
110
|
+
if (blocker === null || !GATE_WORD.test(blocker)) return false
|
|
111
|
+
const iso = ISO_DATE.exec(blocker)?.[1]
|
|
112
|
+
if (iso !== undefined) return Date.parse(`${iso}T23:59:59Z`) >= now
|
|
113
|
+
return OTHER_DATE.test(blocker)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Why a card lets its session rest, or null when the card is unfinished and nothing excuses it: a finished or archived card, a card
|
|
118
|
+
* that opted out (`nudge: false`), a task waiting for a person's approval (`collaborating`), or a blocker that names a person's
|
|
119
|
+
* decision and a date.
|
|
120
|
+
*/
|
|
121
|
+
export function cardRestReason(card, now) {
|
|
122
|
+
const status = cardStatus(card)
|
|
123
|
+
if (card.archived || TERMINAL_STATES.includes(status)) return `the card is ${card.archived ? "archived" : status}`
|
|
124
|
+
if (String(card.data.nudge).toLowerCase() === "false") return "the card says nudge: false"
|
|
125
|
+
if (status === "collaborating") return "the card is collaborating: it waits for a person's approval"
|
|
126
|
+
const blocker = blockerOf(card.content)
|
|
127
|
+
if (namesHumanGate(blocker, now)) return `the card's blocker names a person's decision and a date: ${blocker.slice(0, 120)}`
|
|
128
|
+
return null
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const cardStatus = (card) => card.data.status ?? "unknown"
|
|
132
|
+
|
|
133
|
+
/** Minutes since the card's `updated` stamp, or null when it has none. */
|
|
134
|
+
function minutesSinceUpdated(card, now) {
|
|
135
|
+
const at = Date.parse(String(card.data.updated))
|
|
136
|
+
return Number.isFinite(at) ? Math.max(0, Math.round((now - at) / 60_000)) : null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const STALE_MINUTES = 15
|
|
140
|
+
|
|
141
|
+
/** The fallback's lead line for a session that is still running: its focused card is unfinished, nothing excuses it, and it has not been updated for 15 minutes. Null otherwise. */
|
|
142
|
+
export function staleCardLead({ bases, focus, now }) {
|
|
143
|
+
const card = findFocusedCard(bases, focus)
|
|
144
|
+
if (card === null || cardRestReason(card, now) !== null) return null
|
|
145
|
+
const quiet = minutesSinceUpdated(card, now)
|
|
146
|
+
return quiet === null || quiet < STALE_MINUTES ? null : staleCardText({ track: focus.track, slug: focus.slug, status: cardStatus(card), quiet })
|
|
147
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// The front door: a dependency-free MCP server on stdio that Desk starts before anything that can fail or take time.
|
|
2
|
+
//
|
|
3
|
+
// It answers initialize, ping and tools/list at once, always with the full tool set, so the handshake never waits for the runtime pack, the desk root, authority or the search engine, and a host that caches the first tools/list never loses a tool once Desk recovers. Every tools/call goes to the `callTool` it is given, which gates tools by admission state.
|
|
4
|
+
//
|
|
5
|
+
// It imports only the tool names and their dependency-free input schemas, so it runs before the runtime pack (and its native modules) is restored.
|
|
6
|
+
|
|
7
|
+
import { TOOL_DESCRIPTIONS, TOOL_NAMES } from "../tool-names.js"
|
|
8
|
+
import { DOCTOR_REPAIRS, TOOL_INPUT_SCHEMAS } from "../tool-schemas.js"
|
|
9
|
+
import { TOOL_ANNOTATIONS } from "./hosted.js"
|
|
10
|
+
|
|
11
|
+
export { DOCTOR_REPAIRS }
|
|
12
|
+
|
|
13
|
+
// One tool list for every mode, in the canonical order, each with its declared input schema.
|
|
14
|
+
export const FRONT_DOOR_TOOLS = Object.freeze(TOOL_NAMES.map((name) => Object.freeze({
|
|
15
|
+
name,
|
|
16
|
+
description: TOOL_DESCRIPTIONS[name],
|
|
17
|
+
inputSchema: TOOL_INPUT_SCHEMAS[name],
|
|
18
|
+
annotations: TOOL_ANNOTATIONS[name],
|
|
19
|
+
})))
|
|
20
|
+
|
|
21
|
+
// Own data properties only; never runs a getter.
|
|
22
|
+
const dataValue = (object, key) => {
|
|
23
|
+
const descriptor = Object.getOwnPropertyDescriptor(object, key)
|
|
24
|
+
return descriptor !== undefined && Object.hasOwn(descriptor, "value") ? descriptor.value : undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Opt-in CI diagnostics only: the JSON-RPC id travels as an opaque safe integer so a tool's own trace frame can be matched to its request.
|
|
28
|
+
// With any control absent the call keeps exactly its default shape.
|
|
29
|
+
function opaqueRequestId(id, env) {
|
|
30
|
+
if (!Number.isSafeInteger(id) || id < 0 || env === null || typeof env !== "object") return {}
|
|
31
|
+
const on = dataValue(env, "CI") === "true" && dataValue(env, "GITHUB_ACTIONS") === "true" && dataValue(env, "DESK_BLACKBOX_NATIVE_RECEIPT_TRACE") === "1"
|
|
32
|
+
return on ? { requestId: id } : {}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Serve MCP on `input`/`output`. `callTool({ name, input, signal })` returns an MCP tool result (or a promise of one).
|
|
37
|
+
* `onHandshake` fires once, after the first tools/list reply is written: hosts send tools/list after notifications/initialized, often as a separate write, and admission must not start before that list is answered.
|
|
38
|
+
* `instructions`, when a non-empty string, goes in the initialize result as the server's MCP instructions.
|
|
39
|
+
* `serverIcons`, when supplied, is advertised to protocols that support MCP icons (2025-11-25 onward).
|
|
40
|
+
* Returns `{ closed, notifyToolsChanged }`: `closed` resolves when input ends and every call in flight has answered.
|
|
41
|
+
*/
|
|
42
|
+
export function startFrontDoor({
|
|
43
|
+
callTool,
|
|
44
|
+
input,
|
|
45
|
+
output,
|
|
46
|
+
serverName = "desk-mcp",
|
|
47
|
+
serverVersion = "0.0.0",
|
|
48
|
+
serverIcons,
|
|
49
|
+
onHandshake = () => {},
|
|
50
|
+
instructions,
|
|
51
|
+
env = process.env,
|
|
52
|
+
}) {
|
|
53
|
+
const inFlight = new Map()
|
|
54
|
+
const pending = new Set()
|
|
55
|
+
let buffered = ""
|
|
56
|
+
let handshook = false
|
|
57
|
+
let initialized = false
|
|
58
|
+
|
|
59
|
+
const signalHandshake = () => {
|
|
60
|
+
if (handshook) return
|
|
61
|
+
handshook = true
|
|
62
|
+
onHandshake()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const write = (message) => {
|
|
66
|
+
if (output.destroyed || output.writableEnded) return
|
|
67
|
+
output.write(`${JSON.stringify(message)}\n`)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const answerCall = (id, result) => write({ jsonrpc: "2.0", id, result })
|
|
71
|
+
// The last resort for a tool that throws: a structured degraded result, never a failed call or a dead process.
|
|
72
|
+
const failCall = (id, name, error) => {
|
|
73
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
74
|
+
return answerCall(id, {
|
|
75
|
+
content: [{
|
|
76
|
+
type: "text",
|
|
77
|
+
text: JSON.stringify({
|
|
78
|
+
status: "degraded",
|
|
79
|
+
code: "tool_exception",
|
|
80
|
+
tool: name ?? null,
|
|
81
|
+
message,
|
|
82
|
+
fix: "The tool failed unexpectedly and Desk is still serving. Retry the call; if it fails the same way, call desk_doctor and report the message.",
|
|
83
|
+
}),
|
|
84
|
+
}],
|
|
85
|
+
isError: true,
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const handleCall = (request) => {
|
|
90
|
+
const { id } = request
|
|
91
|
+
const name = request.params?.name
|
|
92
|
+
const abort = new AbortController()
|
|
93
|
+
let result
|
|
94
|
+
try {
|
|
95
|
+
result = callTool({ name, input: request.params?.arguments ?? {}, signal: abort.signal, ...opaqueRequestId(id, env) })
|
|
96
|
+
} catch (error) {
|
|
97
|
+
failCall(id, name, error)
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
if (typeof result?.then !== "function") {
|
|
101
|
+
answerCall(id, result)
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
inFlight.set(id, abort)
|
|
105
|
+
const settled = result
|
|
106
|
+
.then((value) => answerCall(id, value), (error) => failCall(id, name, error))
|
|
107
|
+
.finally(() => {
|
|
108
|
+
inFlight.delete(id)
|
|
109
|
+
pending.delete(settled)
|
|
110
|
+
})
|
|
111
|
+
pending.add(settled)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const handleLine = (line) => {
|
|
115
|
+
let request
|
|
116
|
+
try {
|
|
117
|
+
request = JSON.parse(line)
|
|
118
|
+
} catch {
|
|
119
|
+
write({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } })
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
if (request.method === "notifications/initialized") {
|
|
123
|
+
initialized = true
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
if (request.method === "notifications/cancelled") {
|
|
127
|
+
inFlight.get(request.params?.requestId)?.abort(new Error(request.params?.reason ?? "cancelled by the client"))
|
|
128
|
+
return
|
|
129
|
+
}
|
|
130
|
+
if (request.id === undefined) return
|
|
131
|
+
if (request.method === "initialize") {
|
|
132
|
+
const protocolVersion = request.params?.protocolVersion ?? "2025-06-18"
|
|
133
|
+
write({
|
|
134
|
+
jsonrpc: "2.0",
|
|
135
|
+
id: request.id,
|
|
136
|
+
result: {
|
|
137
|
+
protocolVersion,
|
|
138
|
+
capabilities: { tools: { listChanged: true } },
|
|
139
|
+
serverInfo: {
|
|
140
|
+
name: serverName,
|
|
141
|
+
version: serverVersion,
|
|
142
|
+
...(serverIcons?.length && protocolVersion >= "2025-11-25" ? { icons: serverIcons } : {}),
|
|
143
|
+
},
|
|
144
|
+
...(typeof instructions === "string" && instructions.length > 0 ? { instructions } : {}),
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
if (request.method === "ping") {
|
|
150
|
+
write({ jsonrpc: "2.0", id: request.id, result: {} })
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
if (request.method === "tools/list") {
|
|
154
|
+
write({ jsonrpc: "2.0", id: request.id, result: { tools: FRONT_DOOR_TOOLS } })
|
|
155
|
+
signalHandshake()
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
if (request.method === "tools/call") {
|
|
159
|
+
handleCall(request)
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
write({ jsonrpc: "2.0", id: request.id, error: { code: -32601, message: `Method not found: ${request.method}` } })
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const closed = new Promise((resolve, reject) => {
|
|
166
|
+
const onData = (chunk) => {
|
|
167
|
+
buffered += chunk.toString("utf8")
|
|
168
|
+
let newline
|
|
169
|
+
while ((newline = buffered.indexOf("\n")) !== -1) {
|
|
170
|
+
const line = buffered.slice(0, newline).trim()
|
|
171
|
+
buffered = buffered.slice(newline + 1)
|
|
172
|
+
if (line.length > 0) handleLine(line)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const onEnd = () => {
|
|
176
|
+
const line = buffered.trim()
|
|
177
|
+
buffered = ""
|
|
178
|
+
if (line.length > 0) handleLine(line)
|
|
179
|
+
cleanup()
|
|
180
|
+
Promise.allSettled([...pending]).then(() => resolve())
|
|
181
|
+
}
|
|
182
|
+
const onError = (error) => {
|
|
183
|
+
cleanup()
|
|
184
|
+
reject(error)
|
|
185
|
+
}
|
|
186
|
+
const cleanup = () => {
|
|
187
|
+
input.off("data", onData)
|
|
188
|
+
input.off("end", onEnd)
|
|
189
|
+
input.off("error", onError)
|
|
190
|
+
}
|
|
191
|
+
input.on("data", onData)
|
|
192
|
+
input.on("end", onEnd)
|
|
193
|
+
input.on("error", onError)
|
|
194
|
+
input.resume?.()
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
closed,
|
|
199
|
+
/** Tell a host that honours it to list tools again. The list itself never changes; this only prompts hosts that cached a failure. */
|
|
200
|
+
notifyToolsChanged() {
|
|
201
|
+
if (initialized) write({ jsonrpc: "2.0", method: "notifications/tools/list_changed" })
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
}
|