@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,196 @@
|
|
|
1
|
+
// Crew's shared-write protocol, done by a tool itself: a change to a repository the team shares lands through a pull
|
|
2
|
+
// request the tool opens and merges at once. lesson_add's team write (lesson-team.js) and the note tool (note.js) use it.
|
|
3
|
+
//
|
|
4
|
+
// The write never touches the clone's checkout or uses its remotes: it fetches the default branch from
|
|
5
|
+
// https://github.com/<owner>/<repo>.git with the chosen account (pinned past the clone's redirect rules and extra headers,
|
|
6
|
+
// and given the token only for that), builds the change in a temporary sparse worktree that checks out only the paths
|
|
7
|
+
// the caller names, pushes a branch there, opens a pull request and merges it at once. When the origin is a fork, the
|
|
8
|
+
// change goes to the repository it was forked from. When the merge meets a conflict (someone else changed the same files
|
|
9
|
+
// first) it rebuilds the change on the new default branch and tries again. It counts the change merged only when GitHub
|
|
10
|
+
// says the pull request is merged: a merge queue or auto-merge that only queued it leaves it open, branch and all. The
|
|
11
|
+
// repository's own commit hooks and signing run as for any commit, and their refusal is reported, never skipped,
|
|
12
|
+
// because the shared-write protocol is an ordinary pull request.
|
|
13
|
+
|
|
14
|
+
import { promises as fs, existsSync } from "node:fs"
|
|
15
|
+
import * as path from "node:path"
|
|
16
|
+
import { normalizeRemote } from "../factory/binding.js"
|
|
17
|
+
import { pullRequestRoute } from "../util/route-around.js"
|
|
18
|
+
|
|
19
|
+
const GIT_TIMEOUT_MS = 60_000
|
|
20
|
+
const MERGE_TRIES = 3
|
|
21
|
+
// After a merge command that succeeded, how many times GitHub is asked whether the pull request merged, 2 s apart.
|
|
22
|
+
const MERGE_POLLS = 5
|
|
23
|
+
// The settings for the tool's own fetch and push to `remote`. Only the chosen account's token, through gh, signs in: no
|
|
24
|
+
// other credential helper, no extra header a CI checkout left for github.com, no SSH. The exact address is rewritten to
|
|
25
|
+
// itself, which outranks any shorter redirect rule (`insteadOf`, `pushInsteadOf`) the clone or the machine carries.
|
|
26
|
+
const route = (remote) => [
|
|
27
|
+
"credential.helper=", "credential.helper=!gh auth git-credential", "protocol.ssh.allow=never",
|
|
28
|
+
"http.extraheader=", "http.https://github.com/.extraheader=",
|
|
29
|
+
`url.${remote}.insteadOf=${remote}`, `url.${remote}.pushInsteadOf=${remote}`,
|
|
30
|
+
].flatMap((setting) => ["-c", setting])
|
|
31
|
+
// The temporary worktree checks out only what the write reads, and never downloads large files.
|
|
32
|
+
const SPARSE = ["-c", "core.sparseCheckout=true", "-c", "core.sparseCheckoutCone=false"]
|
|
33
|
+
|
|
34
|
+
export function runGit(args, { cwd, spawnGit, token, config = [] }) {
|
|
35
|
+
const env = { ...process.env, GIT_TERMINAL_PROMPT: "0", GH_PROMPT_DISABLED: "1", GIT_LFS_SKIP_SMUDGE: "1" }
|
|
36
|
+
// Only the network calls get the chosen account's token; hooks and every other Git call never see it.
|
|
37
|
+
if (token !== undefined) env.GH_TOKEN = token
|
|
38
|
+
const result = spawnGit("git", [...config, "-C", cwd, ...args], { windowsHide: true, encoding: "utf8", timeout: GIT_TIMEOUT_MS, env })
|
|
39
|
+
return { ok: result.status === 0, stdout: String(result.stdout ?? "").trim(), stderr: String(result.stderr ?? "").trim() }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A failure once the remote work started, at `stage`: the caller reports it rather than throwing it. */
|
|
43
|
+
export class Failed extends Error {
|
|
44
|
+
constructor(stage, reason) {
|
|
45
|
+
super(reason)
|
|
46
|
+
this.stage = stage
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function must(result, stage, why = "") {
|
|
51
|
+
if (!result.ok) throw new Failed(stage, `${why}${result.stderr.split("\n")[0] || `${stage} failed`}`)
|
|
52
|
+
return result.stdout
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
56
|
+
|
|
57
|
+
const ghText = (answer) => String(answer.stdout ?? "").trim()
|
|
58
|
+
const ghJson = (answer) => {
|
|
59
|
+
try {
|
|
60
|
+
return JSON.parse(ghText(answer))
|
|
61
|
+
} catch {
|
|
62
|
+
return {}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const prState = async (gh, url, token) => ghJson(await gh(["pr", "view", url, "--json", "state,mergeable,mergeStateStatus,mergeCommit"], { token }))
|
|
67
|
+
|
|
68
|
+
/** The `owner/repo` of the clone's origin when it is on GitHub, else null. */
|
|
69
|
+
export function githubStore(top, spawnGit) {
|
|
70
|
+
const url = runGit(["config", "--get", "remote.origin.url"], { cwd: top, spawnGit })
|
|
71
|
+
const match = url.ok && url.stdout !== "" ? /^https:\/\/github\.com\/([^/]+\/[^/]+)$/u.exec(normalizeRemote(url.stdout)) : null
|
|
72
|
+
return match === null ? null : match[1]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* `sharedWrite({ top, origin, sparse, add, branch, title, prBody, commitMessage, closeComment, write, result, tmpPrefix,
|
|
77
|
+
* spawnGit, gh, chooseAccount, tmpRoot, wait })`: lands one change on the default branch of `origin` (the GitHub
|
|
78
|
+
* repository of the clone at `top`) through a pull request it merges.
|
|
79
|
+
*
|
|
80
|
+
* `sparse` lists the paths the temporary worktree checks out (sparse-checkout patterns) and `add` the paths the commit
|
|
81
|
+
* stages. `write(tree, rebuilt)` runs on a fresh checkout of the default branch: it writes the change and returns a
|
|
82
|
+
* truthy value, or returns null when the default branch already holds it. It may throw `Failed` to stop. It runs again,
|
|
83
|
+
* with `rebuilt` true, when someone else's change landed first. `prBody()` gives the pull request's text after the first build.
|
|
84
|
+
*
|
|
85
|
+
* Returns `{ status: "unchanged" }` (nothing to add, any pull request it opened closed with `closeComment`),
|
|
86
|
+
* `{ status: "pr_open", reason, route_around }` (opened, not merged; its branch kept, and the route merges it by hand) or `{ status: "merged", commit }`. A failure
|
|
87
|
+
* once the remote work started throws `Failed`, and `result` gains `repo`, `account`, `pr` and `branch` as they become
|
|
88
|
+
* known, so the caller can say what is left open. The temporary worktree is always removed.
|
|
89
|
+
*/
|
|
90
|
+
export async function sharedWrite({ top, origin, sparse, add, branch, title, prBody, commitMessage, closeComment, write, result, tmpPrefix, spawnGit, gh, chooseAccount, tmpRoot, wait }) {
|
|
91
|
+
const tmp = await fs.mkdtemp(path.join(tmpRoot, tmpPrefix))
|
|
92
|
+
const tree = path.join(tmp, "tree")
|
|
93
|
+
// A signed-in account that can push to `store`, and its token.
|
|
94
|
+
const access = async (store) => {
|
|
95
|
+
const chosen = await chooseAccount({ store, runner: gh })
|
|
96
|
+
if (chosen.result !== "account_found" || chosen.route !== "direct") throw new Failed("account", `no signed-in GitHub account can push to ${store} (${chosen.result === "account_found" ? "only through a fork" : chosen.result})`)
|
|
97
|
+
const answer = await gh(["auth", "token", "--user", chosen.account])
|
|
98
|
+
const token = ghText(answer)
|
|
99
|
+
if (answer.code !== 0 || token === "") throw new Failed("account", `gh has no token for ${chosen.account}`)
|
|
100
|
+
return { account: chosen.account, token }
|
|
101
|
+
}
|
|
102
|
+
const about = async (store, token) => {
|
|
103
|
+
const info = ghJson(await gh(["api", `repos/${store}`, "--jq", "{base: .default_branch, parent: .parent.full_name}"], { token }))
|
|
104
|
+
if (typeof info.base !== "string" || info.base === "") throw new Failed("default_branch", `could not read the default branch of ${store}`)
|
|
105
|
+
return info
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
let store = origin
|
|
109
|
+
let { account, token } = await access(store)
|
|
110
|
+
let info = await about(store, token)
|
|
111
|
+
// A fork's change belongs in the repository the team works in, the one it was forked from.
|
|
112
|
+
if (typeof info.parent === "string" && info.parent !== "") {
|
|
113
|
+
store = info.parent
|
|
114
|
+
;({ account, token } = await access(store))
|
|
115
|
+
info = await about(store, token)
|
|
116
|
+
}
|
|
117
|
+
result.repo = store
|
|
118
|
+
result.account = account
|
|
119
|
+
const remote = `https://github.com/${store}.git`
|
|
120
|
+
const network = (args, cwd, stage, why) => must(runGit(args, { cwd, token, spawnGit, config: route(remote) }), stage, why)
|
|
121
|
+
const git = (args, stage, why) => must(runGit(args, { cwd: tree, spawnGit, config: SPARSE }), stage, why)
|
|
122
|
+
const unpush = (name) => runGit(["push", "--quiet", remote, "--delete", name], { cwd: top, token, spawnGit, config: route(remote) })
|
|
123
|
+
network(["fetch", "--quiet", remote, info.base], top, "fetch")
|
|
124
|
+
must(runGit(["worktree", "add", "--quiet", "--no-checkout", "--detach", tree, "FETCH_HEAD"], { cwd: top, spawnGit }), "worktree")
|
|
125
|
+
// The worktree's own sparse-checkout file, so the clone's configuration is left as it was.
|
|
126
|
+
const sparseFile = path.resolve(tree, git(["rev-parse", "--git-path", "info/sparse-checkout"], "worktree"))
|
|
127
|
+
await fs.mkdir(path.dirname(sparseFile), { recursive: true })
|
|
128
|
+
await fs.writeFile(sparseFile, sparse.map((pattern) => `${pattern}\n`).join(""), "utf8")
|
|
129
|
+
git(["reset", "--quiet", "--hard", "HEAD"], "worktree")
|
|
130
|
+
// Commit and push one build; the repository's hooks and signing apply, and their refusal is reported.
|
|
131
|
+
const publish = () => {
|
|
132
|
+
git(["add", "--", ...add], "commit")
|
|
133
|
+
git(["commit", "--quiet", "-m", commitMessage], "commit", "the commit was refused (this repository's commit hooks or signing): ")
|
|
134
|
+
network(["push", "--quiet", "--force", remote, `HEAD:refs/heads/${branch}`], tree, "push", "the push was refused: ")
|
|
135
|
+
}
|
|
136
|
+
if ((await write(tree, false)) === null) return { status: "unchanged" }
|
|
137
|
+
publish()
|
|
138
|
+
const created = await gh(["pr", "create", "--repo", store, "--base", info.base, "--head", branch, "--title", title, "--body", prBody()], { token })
|
|
139
|
+
const url = ghText(created).split("\n").pop()
|
|
140
|
+
if (created.code !== 0 || !/^https:\/\/github\.com\//u.test(url)) {
|
|
141
|
+
// Nothing should point at a branch no pull request uses.
|
|
142
|
+
unpush(branch)
|
|
143
|
+
throw new Failed("pull_request", `could not open the pull request: ${String(created.stderr ?? "").trim().split("\n")[0]}`)
|
|
144
|
+
}
|
|
145
|
+
result.pr = url
|
|
146
|
+
result.branch = branch
|
|
147
|
+
let state = {}
|
|
148
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
149
|
+
const answer = await gh(["pr", "merge", url, "--squash"], { token })
|
|
150
|
+
state = await prState(gh, url, token)
|
|
151
|
+
// A merge command that succeeded may only have queued the pull request (a merge queue, auto-merge): only GitHub's
|
|
152
|
+
// own state says it merged.
|
|
153
|
+
for (let poll = 0; answer.code === 0 && state.state !== "MERGED" && poll < MERGE_POLLS; poll += 1) {
|
|
154
|
+
await wait(2000)
|
|
155
|
+
state = await prState(gh, url, token)
|
|
156
|
+
}
|
|
157
|
+
if (state.state === "MERGED" || answer.code === 0 || attempt === MERGE_TRIES) {
|
|
158
|
+
if (state.state !== "MERGED" && answer.code === 0) state = { ...state, mergeStateStatus: "QUEUED" }
|
|
159
|
+
break
|
|
160
|
+
}
|
|
161
|
+
// Someone changed the default branch first: build the change again on top of theirs. GitHub not having worked out
|
|
162
|
+
// mergeability yet is a wait, not a failure.
|
|
163
|
+
if (state.mergeable === "CONFLICTING") {
|
|
164
|
+
// FETCH_HEAD belongs to the worktree that fetched, so the rebuild fetches in its own.
|
|
165
|
+
network(["fetch", "--quiet", remote, info.base], tree, "fetch")
|
|
166
|
+
git(["reset", "--quiet", "--hard", "FETCH_HEAD"], "reset")
|
|
167
|
+
if ((await write(tree, true)) === null) {
|
|
168
|
+
// Someone else merged this exact change first: this pull request has nothing left to add.
|
|
169
|
+
await gh(["pr", "close", url, "--comment", closeComment], { token })
|
|
170
|
+
unpush(branch)
|
|
171
|
+
delete result.pr
|
|
172
|
+
delete result.branch
|
|
173
|
+
return { status: "unchanged" }
|
|
174
|
+
}
|
|
175
|
+
publish()
|
|
176
|
+
} else if (state.mergeable === "UNKNOWN") await wait(2000)
|
|
177
|
+
else break
|
|
178
|
+
}
|
|
179
|
+
if (state.state !== "MERGED") return { status: "pr_open", reason: state.mergeStateStatus ?? "unknown", route_around: pullRequestRoute(url) }
|
|
180
|
+
unpush(branch)
|
|
181
|
+
delete result.branch
|
|
182
|
+
return { status: "merged", commit: state.mergeCommit?.oid ?? null }
|
|
183
|
+
} finally {
|
|
184
|
+
// Clean-up never replaces the result: a folder Windows still holds open is left for the system's temp clean-up.
|
|
185
|
+
const quietly = async (step) => {
|
|
186
|
+
try {
|
|
187
|
+
await step()
|
|
188
|
+
} catch {
|
|
189
|
+
// Left behind; nothing depends on it.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
await quietly(() => existsSync(tree) && runGit(["worktree", "remove", "--force", tree], { cwd: top, spawnGit }))
|
|
193
|
+
await quietly(() => fs.rm(tmp, { recursive: true, force: true }))
|
|
194
|
+
await quietly(() => runGit(["worktree", "prune"], { cwd: top, spawnGit }))
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The `desk` field on the card tools: write a card in another desk registered on this machine.
|
|
2
|
+
// Only a desk in the operator's registry (desk/machine-desks.js) is reachable; a path or name that is not registered is refused, so the field never widens where a session can write.
|
|
3
|
+
|
|
4
|
+
import { realpathSync } from "node:fs"
|
|
5
|
+
import * as path from "node:path"
|
|
6
|
+
import { readMachineDesks, resolveMachineDesk } from "../desk/machine-desks.js"
|
|
7
|
+
|
|
8
|
+
export const SIBLING_DESK_TOOLS = Object.freeze(["task_create", "task_update", "task_archive", "task_signoff"])
|
|
9
|
+
|
|
10
|
+
const real = (p) => {
|
|
11
|
+
try {
|
|
12
|
+
return realpathSync(p)
|
|
13
|
+
} catch {
|
|
14
|
+
return path.resolve(p)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function refusal(tool, problem) {
|
|
19
|
+
return Object.assign(new Error(`${tool}: Pass a registered desk, or leave \`desk\` out: ${problem} Nothing was changed.`), { code: "card_tool_desk_not_registered" })
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the card tools' `desk` field to `{ deskRoot }` of a desk registered on this machine, or throws a refusal that says what to do.
|
|
24
|
+
* A name, repo or owner resolves as in desk_status; an absolute path must be a registered desk's folder.
|
|
25
|
+
*/
|
|
26
|
+
// Only the operator-controlled registry counts (`DESK_REGISTRY` or the recorded registry path): the bound desk's own `_meta/desks.md` is writable by this session, so it cannot widen where the session writes.
|
|
27
|
+
export function resolveSiblingDesk({ tool, desk, boundRoot, person, env }) {
|
|
28
|
+
if (typeof desk !== "string" || desk.trim() === "") throw refusal(tool, "`desk` must be a non-empty string.")
|
|
29
|
+
if (person) throw refusal(tool, "this session writes as a person-scoped member, and another desk's card is written under that desk's own authority: open a session in that desk.")
|
|
30
|
+
const machine = readMachineDesks({ homeDir: env.HOME, root: null, env })
|
|
31
|
+
const wanted = desk.trim()
|
|
32
|
+
const byPath = path.isAbsolute(wanted) ? machine.filter((candidate) => real(candidate.path) === real(wanted)) : []
|
|
33
|
+
const found = byPath.length === 1 ? (byPath[0].present ? { desk: byPath[0] } : { problem: `The ${byPath[0].name} desk is registered at ${byPath[0].path} but is not on this machine.` }) : resolveMachineDesk(wanted, machine)
|
|
34
|
+
if (found.desk === undefined) throw refusal(tool, `${found.problem}`)
|
|
35
|
+
if (found.desk.kind === "crew") throw refusal(tool, `${found.desk.name} is a Crew desk, where cards are written under a member's authority: open a session in that desk.`)
|
|
36
|
+
return { deskRoot: real(found.desk.path) }
|
|
37
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import * as path from "node:path"
|
|
2
|
+
import { personPrefix } from "../util/paths.js"
|
|
3
|
+
import { memberMessage } from "../desk/crew-member.js"
|
|
4
|
+
import { deskVersion } from "../package-metadata.js"
|
|
5
|
+
import { activeTasks } from "../desk/active-tasks.js"
|
|
6
|
+
import { factoryStatusAsync } from "./factory-context.js"
|
|
7
|
+
import { pullStillFailing } from "../runtime/health.js"
|
|
8
|
+
import { aheadBehindCountsAsync, hasRemoteConfiguredAsync, readFetchOkAt, readSyncStatus, waitForStatusGitReads, warmStatusGitReads } from "../runtime/sync-worker.js"
|
|
9
|
+
import { createStatusInspection, waitForStatusInspection as waitForInspectionChild } from "../runtime/status-inspection.js"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
// desk_status's inputs are read elsewhere: `detail` where the answer is shaped for the caller (runtime/desk-session.js, which
|
|
13
|
+
// compacts the payload built here unless `detail: true`), and `has_instructions` by a hosted Desk's startup wrapper
|
|
14
|
+
// (runtime/hosted.js); this function always builds the full payload. Listed here so
|
|
15
|
+
// __tests__/tool_schema_parity.test.js checks the schema against it like every other tool.
|
|
16
|
+
export const DESK_STATUS_FIELDS = ["detail", "desk", "has_instructions"]
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `desk_status`'s own read of sync state (spec §2's "desk_status surfaces
|
|
20
|
+
* sync state"; controller ruling 5) -- local-only, no network call: a plain
|
|
21
|
+
* desk with no remote (or no git repo at all -- the same `git remote`
|
|
22
|
+
* failure either way) reports the literal string `"no remote configured"`;
|
|
23
|
+
* otherwise `{ ahead, behind }` come from one local `git rev-list` against
|
|
24
|
+
* the already-known upstream (whatever the last `fetch` saw -- this never
|
|
25
|
+
* fetches itself), `null` counts (no upstream yet) reported as `0`/`0`, and
|
|
26
|
+
* `last_push_at`/a blocked reason come from the push worker's own status
|
|
27
|
+
* file (`readSyncStatus`) -- never recomputed here, since only the worker
|
|
28
|
+
* itself (`runtime/sync-worker.js`) and the SessionEnd safety net
|
|
29
|
+
* (`finalUnpushedCheck`) ever decide what "blocked" means.
|
|
30
|
+
*/
|
|
31
|
+
async function syncStatus({ deskRoot, env, signal }) {
|
|
32
|
+
if (!await hasRemoteConfiguredAsync(deskRoot, { signal })) return "no remote configured"
|
|
33
|
+
const recorded = readSyncStatus({ root: deskRoot, env })
|
|
34
|
+
// How the last pull ended, when it failed: ahead/behind alone read "in sync" after an unreachable remote.
|
|
35
|
+
const lastPull = pullStillFailing({ lastPull: recorded?.last_pull, lastPushAt: recorded?.last_push_at ?? null, fetchedAt: readFetchOkAt({ root: deskRoot, env }) })
|
|
36
|
+
? { last_pull: recorded.last_pull }
|
|
37
|
+
: {}
|
|
38
|
+
if (recorded?.blocked) {
|
|
39
|
+
return { blocked: true, reason: recorded.reason ?? null, paths: recorded.paths ?? [], unpushed: recorded.unpushed ?? null,
|
|
40
|
+
...(recorded.reason === "publication_blocked" ? { error: recorded.error ?? null, publication: recorded.publication ?? null } : {}), ...lastPull }
|
|
41
|
+
}
|
|
42
|
+
const counts = await aheadBehindCountsAsync({ root: deskRoot, signal })
|
|
43
|
+
return {
|
|
44
|
+
blocked: false,
|
|
45
|
+
ahead: counts?.ahead ?? 0,
|
|
46
|
+
behind: counts?.behind ?? 0,
|
|
47
|
+
last_push_at: recorded?.last_push_at ?? null,
|
|
48
|
+
...(recorded?.publication ? { publication: recorded.publication } : {}),
|
|
49
|
+
...lastPull,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// The desk_status calls still running, by the signal that owns them: their card reads hold files in the desk folder open.
|
|
54
|
+
const statusCalls = new WeakMap()
|
|
55
|
+
|
|
56
|
+
// How long a session waits for an aborted desk_status call to settle. Once aborted, the call's own waits end at once
|
|
57
|
+
// (its scan, its Git reads, the controller check); what remains is at most one batch of card reads and the
|
|
58
|
+
// active-task listing, which takes no signal. A read that never returns must not hold every later status run and
|
|
59
|
+
// the session's close forever, so the wait ends in an error instead and the run stays retained. It is shorter than
|
|
60
|
+
// the server's 3 s shutdown limit (`SHUTDOWN_TIMEOUT_MS` in index.js), so a close reports this error, not a timeout.
|
|
61
|
+
const STATUS_CALL_SETTLE_MS = 1500
|
|
62
|
+
|
|
63
|
+
function callsSettled(calls, ms) {
|
|
64
|
+
if (calls === undefined || calls.size === 0) return Promise.resolve()
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
const timer = setTimeout(() => reject(Object.assign(
|
|
67
|
+
Object.assign(new Error(`Call desk_status again: desk_status call did not settle within ${ms} ms of its status run ending`), { code: "status_call_desk_status_again_desk" }),
|
|
68
|
+
{ code: "status_call_not_settled" },
|
|
69
|
+
)), ms)
|
|
70
|
+
Promise.allSettled(calls).then(() => {
|
|
71
|
+
clearTimeout(timer)
|
|
72
|
+
resolve()
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Resolves when the status run that owns `signal` has nothing left: neither its inspection child, nor a Git read, nor the
|
|
79
|
+
* call itself with its file reads. A session aborts the run and awaits this before it reports itself closed, so nothing
|
|
80
|
+
* of the run still holds the desk folder. Rejects as the inspection child's wait does, and with `status_call_not_settled`
|
|
81
|
+
* when the call has not settled within `callSettleMs`; a later wait for the same signal tries again.
|
|
82
|
+
*/
|
|
83
|
+
export async function waitForStatusInspection(signal, { callSettleMs = STATUS_CALL_SETTLE_MS } = {}) {
|
|
84
|
+
await Promise.all([waitForInspectionChild(signal), waitForStatusGitReads(signal), callsSettled(statusCalls.get(signal), callSettleMs)])
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function desk_status(request) {
|
|
88
|
+
const call = statusCall(request)
|
|
89
|
+
const { signal } = request
|
|
90
|
+
if (signal !== undefined) {
|
|
91
|
+
const calls = statusCalls.get(signal) ?? new Set()
|
|
92
|
+
statusCalls.set(signal, calls)
|
|
93
|
+
calls.add(call)
|
|
94
|
+
call.then(() => calls.delete(call), () => calls.delete(call))
|
|
95
|
+
}
|
|
96
|
+
return call
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function statusCall({ deskRoot, person, statusContext = {}, signal, env = process.env }) {
|
|
100
|
+
const writeScope = writeScopeOf(deskRoot, person, statusContext.member ?? null)
|
|
101
|
+
const reader = createStatusInspection(deskRoot, { signal })
|
|
102
|
+
try {
|
|
103
|
+
const root = await reader.inspect("root", statusContext.root)
|
|
104
|
+
// The sync section comes last; its worker thread starts while the inspections run.
|
|
105
|
+
if (root.valid) warmStatusGitReads()
|
|
106
|
+
const runtime = runtimeStatus(statusContext.runtime ?? {}, env)
|
|
107
|
+
const activation = activationStatus(statusContext.activation)
|
|
108
|
+
const search = await searchStatus(statusContext.search)
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
status: root.valid ? "ok" : "error",
|
|
112
|
+
root,
|
|
113
|
+
activation,
|
|
114
|
+
runtime,
|
|
115
|
+
search,
|
|
116
|
+
write_scope: writeScope,
|
|
117
|
+
// The redacted active-task listing session start and status render (./desk/active-tasks.js).
|
|
118
|
+
active_tasks: root.valid ? await activeTasks(root.path) : null,
|
|
119
|
+
factory: await factoryStatusAsync({ env, deskRoot: root.valid ? root.path : null, signal }),
|
|
120
|
+
sync: root.valid ? await syncStatus({ deskRoot: root.path, env, signal }) : null,
|
|
121
|
+
summary: summaryFor({ root, activation, search }),
|
|
122
|
+
}
|
|
123
|
+
} finally {
|
|
124
|
+
await reader.close()
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Where this session writes, and who it writes as: `source` says where the person came from (crew-member.js), so a check
|
|
129
|
+
// of "am I set up?" reads the same person and source the boot line printed. A Crew workspace with no person is read-only.
|
|
130
|
+
function writeScopeOf(deskRoot, person, member) {
|
|
131
|
+
const effectiveRoot = personPrefix(deskRoot, person)
|
|
132
|
+
if (effectiveRoot === deskRoot) {
|
|
133
|
+
if (member?.crew === true && member.person === null) {
|
|
134
|
+
return { mode: "read_only", person: null, relative_path: null, source: null, problem: memberMessage(member) }
|
|
135
|
+
}
|
|
136
|
+
return { mode: "workspace", person: null, relative_path: "." }
|
|
137
|
+
}
|
|
138
|
+
const alias = path.basename(effectiveRoot)
|
|
139
|
+
const scope = { mode: "person", person: alias, relative_path: path.posix.join("desks", alias) }
|
|
140
|
+
return member?.person === alias ? { ...scope, source: member.source, identity: member.identity } : scope
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const SEARCH_STARTING = Object.freeze({ state: "starting", message: "Desk search is starting." })
|
|
144
|
+
|
|
145
|
+
// Search in plain words, from the session's search engine (src/search/engine.js) once admission has started it.
|
|
146
|
+
function searchStatus(engine) {
|
|
147
|
+
return typeof engine?.searchStatus === "function" ? engine.searchStatus() : SEARCH_STARTING
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function compactObject(value) {
|
|
151
|
+
return Object.fromEntries(
|
|
152
|
+
Object.entries(value).filter(([, entry]) => entry !== undefined),
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
function runtimeStatus(runtime, env) {
|
|
158
|
+
const sourceMirrorPath = runtime.source_mirror_path ?? runtime.sourceMirrorPath ?? null
|
|
159
|
+
return {
|
|
160
|
+
plugin: {
|
|
161
|
+
name: "desk",
|
|
162
|
+
version: deskVersion(env),
|
|
163
|
+
},
|
|
164
|
+
node: {
|
|
165
|
+
platform: process.platform,
|
|
166
|
+
arch: process.arch,
|
|
167
|
+
abi: process.versions.modules,
|
|
168
|
+
},
|
|
169
|
+
target: runtime.target ?? defaultTarget(),
|
|
170
|
+
runtime_cache_dir: runtime.runtime_cache_dir ?? runtime.runtimeCacheDir ?? null,
|
|
171
|
+
source_mirror_path: sourceMirrorPath,
|
|
172
|
+
loaded_from_source_mirror: typeof sourceMirrorPath === "string" && sourceMirrorPath.length > 0,
|
|
173
|
+
...(runtime.newest_release === undefined ? {} : { newest_release: runtime.newest_release }),
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function activationStatus(activation) {
|
|
178
|
+
if (activation === null || typeof activation !== "object") {
|
|
179
|
+
return {
|
|
180
|
+
selected_id: null,
|
|
181
|
+
chain: [],
|
|
182
|
+
mode: null,
|
|
183
|
+
source: "not_provided",
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const chain = normalizeActivationChain(activation.chain)
|
|
187
|
+
const selectedId = textOrNull(
|
|
188
|
+
activation.selected_id ??
|
|
189
|
+
activation.selectedId ??
|
|
190
|
+
activation.id ??
|
|
191
|
+
activation.selectedActivationId,
|
|
192
|
+
)
|
|
193
|
+
return compactObject({
|
|
194
|
+
selected_id: selectedId,
|
|
195
|
+
chain,
|
|
196
|
+
mode: textOrNull(activation.mode),
|
|
197
|
+
source: textOrNull(activation.source) ?? "unknown",
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function normalizeActivationChain(chain) {
|
|
202
|
+
if (!Array.isArray(chain)) return []
|
|
203
|
+
return chain
|
|
204
|
+
.map((entry) => {
|
|
205
|
+
if (typeof entry === "string" && entry.trim().length > 0) return entry
|
|
206
|
+
if (entry !== null && typeof entry === "object" && typeof entry.id === "string") {
|
|
207
|
+
return entry.id
|
|
208
|
+
}
|
|
209
|
+
return null
|
|
210
|
+
})
|
|
211
|
+
.filter(Boolean)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function textOrNull(value) {
|
|
215
|
+
return typeof value === "string" && value.trim().length > 0 ? value : null
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
function defaultTarget() {
|
|
220
|
+
return `${process.platform}-${process.arch}-node-${process.versions.modules}`
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
function summaryFor({ root, activation, search }) {
|
|
226
|
+
return [
|
|
227
|
+
`Desk root ${root.path} resolved from ${root.source}.`,
|
|
228
|
+
activation.selected_id ? `Active activation: ${activation.selected_id}.` : null,
|
|
229
|
+
root.valid ? null : `Root diagnostic: ${root.diagnostic}.`,
|
|
230
|
+
search.message,
|
|
231
|
+
search.old_index_removed ?? null,
|
|
232
|
+
].filter(Boolean).join(" ")
|
|
233
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TERMINAL_STATES } from "../desk/lifecycle.js"
|
|
2
|
+
|
|
3
|
+
export function archiveDueAnswer({ track, slug, status, archived = false }) {
|
|
4
|
+
if (archived || !TERMINAL_STATES.includes(status)) return {}
|
|
5
|
+
return {
|
|
6
|
+
archive_due: { track, slug },
|
|
7
|
+
archive_next_action: "If you are the owning main agent, call task_archive with archive_due before final delivery and inspect its actual result. This advice does not archive the task or grant ownership. Preserve the existing unsigned signoff packet; archive_pending or failure remains unresolved, not completed archival.",
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// A disposition recorded on an archived card. A finished card's cleanup reminder has to be closable, but the card is history, so this is the only change Desk makes to it:
|
|
2
|
+
// one existing `## Resources` row gets its terminal cell filled. Nothing else is touched: the frontmatter stays byte for byte (no `updated`, no record, no date reformat),
|
|
3
|
+
// the factory report is not asked for again and no sync or evaluation is requested.
|
|
4
|
+
|
|
5
|
+
import { promises as fs } from "node:fs"
|
|
6
|
+
import * as path from "node:path"
|
|
7
|
+
import { writeFileAtomic } from "../util/fm.js"
|
|
8
|
+
import { applyResource, canonicalIdentity, openResources, readResources } from "../desk/resources.js"
|
|
9
|
+
import { recordCleanupCard } from "../desk/cleanup-index.js"
|
|
10
|
+
|
|
11
|
+
const ALLOWED = ["identity", "disposition", "details"]
|
|
12
|
+
// The card's frontmatter fence and everything up to it; the rest is the body.
|
|
13
|
+
const FRONT = /^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/u
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Fills the terminal cell of the archived card's existing row, and returns `{ status: "updated" | "commit_failed" | "commit_unknown", path, resource }`; refuses, changing nothing, for any other call.
|
|
17
|
+
* `helpers` are task.js's own `{ relPath, stagingAllowed, stageAndCommitCard, schedulePush }`.
|
|
18
|
+
*/
|
|
19
|
+
export async function recordArchivedDisposition({ deskRoot, file, track, slug, values, resources, search, env, spawnGit, helpers }) {
|
|
20
|
+
const refuse = (why, { code }) => { throw Object.assign(new Error(`task_update: Pass only \`resource: {identity, disposition, details}\` for an archived card: ${track}/${slug} is archived, so a call can only record a disposition on one of its existing resource rows (\`resource: {identity, disposition, details}\` and nothing else); ${why}; nothing was changed.`), { code }) }
|
|
21
|
+
const extra = Object.keys(values).filter((key) => !["track", "slug", "resource", "resources"].includes(key))
|
|
22
|
+
if (extra.length > 0) refuse(`Pass only \`resource: {identity, disposition, details}\`: this call also has ${extra.map((key) => `\`${key}\``).join(", ")}`, { code: "task_update_archived_extra_fields" })
|
|
23
|
+
const raw = await fs.readFile(file, "utf8")
|
|
24
|
+
const front = FRONT.exec(raw)?.[0] ?? ""
|
|
25
|
+
const known = readResources(raw.slice(front.length)).rows ?? []
|
|
26
|
+
for (const resource of resources) {
|
|
27
|
+
const other = Object.keys(resource).filter((key) => !ALLOWED.includes(key))
|
|
28
|
+
if (other.length > 0) refuse(`Pass only \`resource: {identity, disposition, details}\`: the resource has ${other.map((key) => `\`${key}\``).join(", ")}`, { code: "task_update_archived_resource_fields" })
|
|
29
|
+
if (resource.disposition === undefined) refuse("Pass `disposition` with `details`: the resource has no `disposition`", { code: "task_update_archived_no_disposition" })
|
|
30
|
+
const identity = canonicalIdentity(resource.identity)
|
|
31
|
+
if (!known.some((row) => canonicalIdentity(row.identity) === identity)) refuse(`Pass an identity that is a row of the Resources table: ${JSON.stringify(resource.identity)} is not a row of its Resources table`, { code: "task_update_archived_unknown_identity" })
|
|
32
|
+
}
|
|
33
|
+
let body = raw.slice(front.length)
|
|
34
|
+
const rows = []
|
|
35
|
+
for (const resource of resources) {
|
|
36
|
+
const written = applyResource(body, resource, "task_update", `${track}/${slug}`)
|
|
37
|
+
body = written.body
|
|
38
|
+
rows.push(written.row)
|
|
39
|
+
}
|
|
40
|
+
// Judged before the write, so a card another session left changed is never adopted.
|
|
41
|
+
const stage = helpers.stagingAllowed(file, spawnGit)
|
|
42
|
+
// Written through a temporary file and a rename, so a reader never sees the card half written; nothing else about the card changes.
|
|
43
|
+
await writeFileAtomic(file, front + body)
|
|
44
|
+
const commit = stage ? helpers.stageAndCommitCard(file, `task_update: ${track}/${slug}`, spawnGit, [], null, deskRoot) : undefined
|
|
45
|
+
if (stage && !commit) helpers.schedulePush({ root: deskRoot })
|
|
46
|
+
search?.noteChange(helpers.relPath(deskRoot, file))
|
|
47
|
+
try {
|
|
48
|
+
recordCleanupCard(deskRoot, helpers.relPath(deskRoot, path.dirname(file)), openResources(body).length > 0, env)
|
|
49
|
+
} catch {
|
|
50
|
+
// A state folder that cannot be written never fails the card write.
|
|
51
|
+
}
|
|
52
|
+
return { status: commit ? commit.status === "unknown" ? "commit_unknown" : "commit_failed" : "updated", path: helpers.relPath(deskRoot, file), resource: rows[0], ...(rows.length > 1 ? { resources: rows } : {}), ...(commit ? { commit } : {}) }
|
|
53
|
+
}
|