@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,215 @@
|
|
|
1
|
+
// A plugin-update notice for boot and desk_status. The Copilot app keeps a skill's text in memory for the life of its
|
|
2
|
+
// process, so the skills of every plugin it loaded (Desk's own, MS Desk, cit, Crew, ...) stay as they were at the app's
|
|
3
|
+
// start. Desk's tools update in place (`./newest-release.js`); skills do not. Agency's cache already holds the newer
|
|
4
|
+
// release, and this process's sibling roots (`<agency data>/plugins/sessions/agency-plugin-<id>.p<pid>/root-N/<plugin>`)
|
|
5
|
+
// show what it loaded, so the comparison is a few local reads: no network, no budget, no failure that can reach boot.
|
|
6
|
+
//
|
|
7
|
+
// When a loaded plugin is older than the newest release Agency has fetched, and the newer release differs in something a
|
|
8
|
+
// process fixes at its start, the finding carries one plain line the agent can say once per session. A release that
|
|
9
|
+
// changes only Desk's runtime (`mcp/src`, which updates in place) is no reason to restart, so it is not announced. On a
|
|
10
|
+
// Mac where Housesitter's auto-restart job is installed (its launchd agent file exists), the line says the app will
|
|
11
|
+
// restart by itself instead.
|
|
12
|
+
|
|
13
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"
|
|
14
|
+
import * as path from "node:path"
|
|
15
|
+
import { agencyCache } from "./desk-channel.js"
|
|
16
|
+
import { compareVersions } from "./stale-desk.js"
|
|
17
|
+
import { looksLikeNodeTestRunner } from "./test-state-guard.js"
|
|
18
|
+
|
|
19
|
+
/** The launchd agent Housesitter's `restart-copilot --install-plugin-updates` writes. */
|
|
20
|
+
export const HOUSESITTER_AGENT_LABEL = "bot.ouro.housesitter.plugin-update-restart"
|
|
21
|
+
|
|
22
|
+
// <...>/agency-plugin-<id>[.p<pid>]/root-N/<plugin>: the layout of a session's plugin roots.
|
|
23
|
+
const SESSION_ROOT = /^(.*[\\/]agency-plugin-[^\\/]+)[\\/]root-\d+[\\/][^\\/]+$/u
|
|
24
|
+
const PINNED = /@[0-9a-f]{40}$/u
|
|
25
|
+
|
|
26
|
+
const list = (dir) => {
|
|
27
|
+
try {
|
|
28
|
+
return readdirSync(dir)
|
|
29
|
+
} catch {
|
|
30
|
+
return []
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function manifest(dir) {
|
|
35
|
+
for (const file of [path.join(dir, "plugin.json"), path.join(dir, ".claude-plugin", "plugin.json")]) {
|
|
36
|
+
try {
|
|
37
|
+
const { name, version } = JSON.parse(readFileSync(file, "utf8"))
|
|
38
|
+
// A version that is not semver (or not text) fails the comparison with itself.
|
|
39
|
+
if (typeof name === "string" && compareVersions(version, version) !== null) return { name, version }
|
|
40
|
+
} catch {
|
|
41
|
+
// not this one
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The plugins this process loaded: every plugin folder in the session folder's root-N siblings of Desk's own, as [{ name, version, dir }]. */
|
|
48
|
+
export function loadedPlugins(sessionDir) {
|
|
49
|
+
const out = []
|
|
50
|
+
for (const root of list(sessionDir).filter((entry) => /^root-\d+$/u.test(entry))) {
|
|
51
|
+
for (const plugin of list(path.join(sessionDir, root))) {
|
|
52
|
+
const dir = path.join(sessionDir, root, plugin)
|
|
53
|
+
const found = manifest(dir)
|
|
54
|
+
if (found !== null) out.push({ ...found, dir })
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The newest release Agency has fetched for each plugin: this engine's unpinned entries (a branch or tag), the most recently fetched per name. Map name -> { version, dir }. */
|
|
61
|
+
function newestReleases(cacheDir, engine) {
|
|
62
|
+
let entries
|
|
63
|
+
try {
|
|
64
|
+
entries = Object.values(JSON.parse(readFileSync(path.join(cacheDir, "cache_index.json"), "utf8")).entries)
|
|
65
|
+
} catch {
|
|
66
|
+
return new Map()
|
|
67
|
+
}
|
|
68
|
+
const newest = new Map()
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
if (typeof entry?.spec !== "string" || !entry.spec.startsWith(`${engine}:`) || PINNED.test(entry.spec) || typeof entry.dir_name !== "string") continue
|
|
71
|
+
const dir = path.join(cacheDir, "entries", entry.dir_name)
|
|
72
|
+
const found = manifest(dir)
|
|
73
|
+
const fetched = Number(entry.fetched_at)
|
|
74
|
+
if (found !== null && (!newest.has(found.name) || fetched > newest.get(found.name).fetched)) newest.set(found.name, { version: found.version, dir, fetched })
|
|
75
|
+
}
|
|
76
|
+
return newest
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Map name -> version of `newestReleases`. */
|
|
80
|
+
export const newestFetched = (cacheDir, engine) => new Map([...newestReleases(cacheDir, engine)].map(([name, { version }]) => [name, version]))
|
|
81
|
+
|
|
82
|
+
// What a process fixes at its start: its skills (text and descriptions), hooks, agents, manifests and MCP config, and for Desk
|
|
83
|
+
// its MCP session layer (the tool names, descriptions and schemas the host registered). Housesitter's plugin-update job applies
|
|
84
|
+
// the same rule when it decides to restart; keep the two lists in step.
|
|
85
|
+
const FIXED_PER_PROCESS = ["skills/", "agents/", "hooks/", "plugin.json", ".claude-plugin/plugin.json", ".mcp.json", ".mcp.copilot.json", ".mcp.claude-codex.json", "agency.json", "settings.json"]
|
|
86
|
+
const DESK_SESSION_LAYER = ["mcp/src/tool-names.js", "mcp/src/tool-schemas.js", "mcp/src/tool-schema-parts.js", "mcp/web-catalog.json"]
|
|
87
|
+
|
|
88
|
+
function collect(root, paths) {
|
|
89
|
+
const files = new Map()
|
|
90
|
+
const add = (rel) => {
|
|
91
|
+
const full = path.join(root, ...rel.split("/"))
|
|
92
|
+
let info
|
|
93
|
+
try {
|
|
94
|
+
info = statSync(full)
|
|
95
|
+
} catch {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
if (info.isFile()) files.set(rel, full)
|
|
99
|
+
else for (const entry of list(full)) add(`${rel}/${entry}`)
|
|
100
|
+
}
|
|
101
|
+
for (const rel of paths) add(rel.replace(/\/$/u, ""))
|
|
102
|
+
return files
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function contentOf(file, rel) {
|
|
106
|
+
try {
|
|
107
|
+
const buffer = readFileSync(file)
|
|
108
|
+
if (!rel.endsWith("plugin.json")) return buffer
|
|
109
|
+
const manifestJson = JSON.parse(buffer.toString("utf8"))
|
|
110
|
+
delete manifestJson.version
|
|
111
|
+
return Buffer.from(JSON.stringify(manifestJson))
|
|
112
|
+
} catch {
|
|
113
|
+
return null
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// What a skill's loaded entry is the host's own record of: its name and description, which end at the closing `---`.
|
|
118
|
+
function frontmatter(file) {
|
|
119
|
+
try {
|
|
120
|
+
return Buffer.from(/^---\r?\n[\s\S]*?\r?\n---/u.exec(readFileSync(file, "utf8"))?.[0] ?? "")
|
|
121
|
+
} catch {
|
|
122
|
+
return null
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function skillHeads(root) {
|
|
127
|
+
const heads = new Map()
|
|
128
|
+
for (const skill of list(path.join(root, "skills"))) {
|
|
129
|
+
const head = frontmatter(path.join(root, "skills", skill, "SKILL.md"))
|
|
130
|
+
if (head !== null) heads.set(`skills/${skill}`, head)
|
|
131
|
+
}
|
|
132
|
+
return heads
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const differs = (a, b) => a === undefined || b === undefined || a === null || b === null || !a.equals(b)
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Does the newer release differ, in a file a process fixes at its start, from the copy a session loaded? (A manifest is compared
|
|
139
|
+
* without its version.) `live` says what the loaded Desk already follows on its own: `skills` (the hook that hands the agent a skill's
|
|
140
|
+
* current text, so only the list of skills and their descriptions are fixed) and `hooks` (scripts run from the newest release, so only the
|
|
141
|
+
* hook registration is fixed).
|
|
142
|
+
*/
|
|
143
|
+
export function changesPerProcess(loadedDir, newDir, name, live = {}) {
|
|
144
|
+
const paths = (name === "desk" ? [...FIXED_PER_PROCESS, ...DESK_SESSION_LAYER] : FIXED_PER_PROCESS).flatMap((rel) => {
|
|
145
|
+
if (live.skills && rel === "skills/") return []
|
|
146
|
+
return live.hooks && name === "desk" && rel === "hooks/" ? ["hooks/copilot-hooks.json", "hooks/hooks.json"] : [rel]
|
|
147
|
+
})
|
|
148
|
+
const before = collect(loadedDir, paths)
|
|
149
|
+
const after = collect(newDir, paths)
|
|
150
|
+
for (const rel of new Set([...before.keys(), ...after.keys()])) {
|
|
151
|
+
if (differs(before.has(rel) ? contentOf(before.get(rel), rel) : null, after.has(rel) ? contentOf(after.get(rel), rel) : null)) return true
|
|
152
|
+
}
|
|
153
|
+
if (!live.skills) return false
|
|
154
|
+
const oldHeads = skillHeads(loadedDir)
|
|
155
|
+
const newHeads = skillHeads(newDir)
|
|
156
|
+
return [...new Set([...oldHeads.keys(), ...newHeads.keys()])].some((rel) => differs(oldHeads.get(rel), newHeads.get(rel)))
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Is Housesitter's auto-restart job installed on this Mac? (Its launchd agent file exists; no other OS has the folder.) */
|
|
160
|
+
export function housesitterRestartsApp(homeDir) {
|
|
161
|
+
return existsSync(path.join(homeDir, "Library", "LaunchAgents", `${HOUSESITTER_AGENT_LABEL}.plist`))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const named = (plugins) => plugins.map((p) => `${p.name} (${p.from} → ${p.to})`).join(", ")
|
|
165
|
+
|
|
166
|
+
/** The one line for the agent, in the words of the two cases. */
|
|
167
|
+
export function pluginUpdateLine(plugins, autoRestart) {
|
|
168
|
+
return autoRestart
|
|
169
|
+
? `There's an update to ${named(plugins)}; Housesitter on this Mac will restart the app to pick it up when nobody is using it, and each session is asked to reach a safe point first and is resumed after.`
|
|
170
|
+
: `There's an update to ${named(plugins)}; restart the Copilot app when it suits you to pick it up.`
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* `{ plugins: [{ name, from, to }], auto_restart, relay, line }` when a plugin this process loaded is older than the newest release Agency has
|
|
175
|
+
* fetched, else null. Never throws. `skip` names plugins another line already covers (Desk itself, when the stale-Desk line is printed).
|
|
176
|
+
*/
|
|
177
|
+
export function pluginUpdateFinding({ env, pluginRoot, agentHost, homeDir, skip }) {
|
|
178
|
+
try {
|
|
179
|
+
// The launcher's own root is the Agency session copy; boot may run from a newer release copy that is not in a session folder.
|
|
180
|
+
const root = [env.DESK_PLUGIN_ROOT, env.CLAUDE_PLUGIN_ROOT, pluginRoot]
|
|
181
|
+
.filter((value) => typeof value === "string" && value !== "")
|
|
182
|
+
.map((value) => path.resolve(value))
|
|
183
|
+
.find((value) => SESSION_ROOT.test(value))
|
|
184
|
+
if (root === undefined) return null
|
|
185
|
+
const cache = agencyCache({ env, agentHost, pluginRoot: root, homeDir })
|
|
186
|
+
if (cache === null) return null
|
|
187
|
+
const newest = newestReleases(cache.cacheDir, cache.engine)
|
|
188
|
+
const behind = new Map()
|
|
189
|
+
const here = loadedPlugins(SESSION_ROOT.exec(root)[1])
|
|
190
|
+
const desk = here.find((p) => p.name === "desk")
|
|
191
|
+
// A Desk that carries the hook helper follows skill text and hook scripts by itself (hooks/lib/current-release.cjs).
|
|
192
|
+
const follows = desk !== undefined && existsSync(path.join(desk.dir, "hooks", "lib", "current-release.cjs"))
|
|
193
|
+
const live = { skills: follows && existsSync(path.join(desk.dir, "hooks", "copilot-skill-current.cjs")), hooks: follows }
|
|
194
|
+
for (const loaded of here) {
|
|
195
|
+
const release = newest.get(loaded.name)
|
|
196
|
+
if (release === undefined || skip.includes(loaded.name) || compareVersions(loaded.version, release.version) >= 0) continue
|
|
197
|
+
if (!changesPerProcess(loaded.dir, release.dir, loaded.name, live)) continue
|
|
198
|
+
behind.set(loaded.name, { name: loaded.name, from: loaded.version, to: release.version })
|
|
199
|
+
}
|
|
200
|
+
if (behind.size === 0) return null
|
|
201
|
+
const plugins = [...behind.values()].sort((a, b) => a.name.localeCompare(b.name))
|
|
202
|
+
const autoRestart = housesitterRestartsApp(homeDir)
|
|
203
|
+
return { plugins, auto_restart: autoRestart, relay: "Tell the person once per session; skip it if you already have.", line: pluginUpdateLine(plugins, autoRestart) }
|
|
204
|
+
} catch {
|
|
205
|
+
return null
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** `pluginUpdateFinding` that stays off in a node:test run, so a developer's own Agency session never leaks into a test; tests hand their own function. */
|
|
210
|
+
export function checkPluginUpdate(options) {
|
|
211
|
+
// istanbul ignore else -- a node:test run always takes this branch; outside one the real check runs.
|
|
212
|
+
if (looksLikeNodeTestRunner(options.env)) return null
|
|
213
|
+
// istanbul ignore next
|
|
214
|
+
return pluginUpdateFinding(options)
|
|
215
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Finds Copilot runtimes started without Desk's plugin: the app starts runtimes with no plugins at all, and Agency skips a plugin with no cached copy whose GitHub lookup is rate limited (403), as happened to desk@release when many sessions resumed together after a reboot (boot's stale-Desk refresh had removed Desk's cached copy; it no longer does). A session served by one has no Desk tools or hooks, so nothing Desk-side can warn it from inside;
|
|
2
|
+
// `drains.js runtimes status` is the outside check, and its lines say how to recover.
|
|
3
|
+
import { execFileSync } from "node:child_process"
|
|
4
|
+
|
|
5
|
+
const RUNTIME = /^\S*\/copilot-runtime(?:\s|$)/u
|
|
6
|
+
const SERVER = /\s--server(?:\s|$)/u
|
|
7
|
+
const PLUGIN_DIR = /--plugin-dir\s+\S*\/desk(?:\s|$)/u
|
|
8
|
+
|
|
9
|
+
/** The `pid command` lines of `ps` that are Copilot server runtimes without a Desk plugin directory. */
|
|
10
|
+
export function findPluginlessRuntimes(psText) {
|
|
11
|
+
const found = []
|
|
12
|
+
for (const line of psText.split("\n")) {
|
|
13
|
+
const match = /^\s*(\d+)\s+(.*)$/u.exec(line)
|
|
14
|
+
if (!match) continue
|
|
15
|
+
const [, pid, command] = match
|
|
16
|
+
if (RUNTIME.test(command) && SERVER.test(command) && !PLUGIN_DIR.test(command)) found.push(Number(pid))
|
|
17
|
+
}
|
|
18
|
+
return found
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Windows has no `ps`; the check reports nothing there rather than failing. */
|
|
22
|
+
export function listProcesses(platform = process.platform) {
|
|
23
|
+
if (platform === "win32") return ""
|
|
24
|
+
return execFileSync("ps", ["-axo", "pid=,command="], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024, windowsHide: true })
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** One line per finding for `status`; a healthy host gets one line saying so. */
|
|
28
|
+
export function pluginlessRuntimeLines(pids) {
|
|
29
|
+
if (pids.length === 0) return ["runtimes: every Copilot server runtime has Desk's plugin"]
|
|
30
|
+
return [
|
|
31
|
+
`runtimes: ${pids.length} Copilot server runtime(s) run without Desk's plugin (pid ${pids.join(", ")}); sessions they serve have no desk-* tools, hooks or boot text`,
|
|
32
|
+
"runtimes: recover by resuming each affected session through Agency once the GitHub API quota has reset (check `gh api rate_limit`; the runtime it then starts carries --plugin-dir for Desk), or start a new session; never wait for the tools to appear or restart the Copilot app",
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url"
|
|
2
|
+
import { shellQuote } from "../util/shell-quote.js"
|
|
3
|
+
import { redactCredentialLikeText } from "../util/redact.js"
|
|
4
|
+
|
|
5
|
+
const OBJECT_ID = /^[0-9a-f]{40}(?:[0-9a-f]{24})?$/u
|
|
6
|
+
|
|
7
|
+
const POLICY = ".desk/publication.json"
|
|
8
|
+
const FIELDS = "number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,mergeCommit,mergeable"
|
|
9
|
+
// The label a merge-when-green relay (runtime/relays.js) polls for; a policy may name another with `merge_label`.
|
|
10
|
+
const MERGE_LABEL = "merge-when-green"
|
|
11
|
+
const WAIT_MS = 300_000
|
|
12
|
+
const CLOCK = {
|
|
13
|
+
now: Date.now,
|
|
14
|
+
sleep: (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function publicationPolicy(git, commit) {
|
|
18
|
+
const listed = git(["ls-tree", "--full-tree", "--name-only", commit, "--", POLICY])
|
|
19
|
+
if (listed.status !== 0) throw Object.assign(new Error(`Check the published publication policy, then try again: Could not read the published ${POLICY}`), { code: "pr_publication_check_the_published_publication_policy_2" })
|
|
20
|
+
if (listed.stdout.trim() === "") return null
|
|
21
|
+
const read = git(["show", `${commit}:${POLICY}`])
|
|
22
|
+
if (read.status !== 0) throw Object.assign(new Error(`Check the published publication policy, then try again: Could not read the published ${POLICY}`), { code: "pr_publication_check_the_published_publication_policy" })
|
|
23
|
+
let policy
|
|
24
|
+
try { policy = JSON.parse(read.stdout) } catch { throw Object.assign(new Error(`Fix the published policy's JSON: Published ${POLICY} is not valid JSON`), { code: "pr_publication_fix_the_published_policy_s" }) }
|
|
25
|
+
if (policy?.schema_version !== 1 || policy.mode !== "pull-request" ||
|
|
26
|
+
!Array.isArray(policy.required_checks) || policy.required_checks.length === 0 ||
|
|
27
|
+
policy.required_checks.some((name) => typeof name !== "string" || name.trim() === "")) {
|
|
28
|
+
throw Object.assign(new Error(`Set schema_version 1, mode pull-request and nonempty required_checks in the published policy: Published ${POLICY} must specify schema_version 1, mode pull-request, and nonempty required_checks`), { code: "pr_publication_set_schema_version_1_mode" })
|
|
29
|
+
}
|
|
30
|
+
return policy
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function repository(remote) {
|
|
34
|
+
const scp = /^git@([^:]+):(.+)$/u.exec(remote)
|
|
35
|
+
let host, name
|
|
36
|
+
if (scp !== null) [host, name] = scp.slice(1)
|
|
37
|
+
else {
|
|
38
|
+
const url = new URL(remote)
|
|
39
|
+
if (!["https:", "ssh:"].includes(url.protocol)) throw Object.assign(new Error("Give the repository a GitHub HTTPS or SSH remote: PR publication needs a GitHub HTTPS or SSH remote"), { code: "pr_publication_give_the_repository_a_github" })
|
|
40
|
+
host = url.hostname
|
|
41
|
+
name = url.pathname.replace(/^\//u, "")
|
|
42
|
+
}
|
|
43
|
+
name = name.replace(/\.git$/u, "")
|
|
44
|
+
if (!/^[\w.-]+$/u.test(host) || !/^[\w.-]+\/[\w.-]+$/u.test(name)) throw Object.assign(new Error("Keep one GitHub owner/repository remote: PR publication needs an unambiguous GitHub owner/repository remote"), { code: "pr_publication_keep_one_github_owner_repository" })
|
|
45
|
+
return { host, name, full: `${host}/${name}` }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// `required` is the published floor and must succeed; `ruled` comes from the base branch's rules and protection, which GitHub
|
|
49
|
+
// satisfies with any passing completion. Every other reported check must also finish passing, so a repository's own
|
|
50
|
+
// validation is never skipped because the policy did not name it.
|
|
51
|
+
function checkState(checks, required, observed, ruled) {
|
|
52
|
+
for (const check of checks) observed.set(check.id, check.name)
|
|
53
|
+
const bad = checks.find((check) => ["FAILURE", "ERROR", "CANCELLED", "TIMED_OUT", "ACTION_REQUIRED", "STARTUP_FAILURE", "STALE"].includes(check.state))
|
|
54
|
+
if (bad) throw Object.assign(new Error(`Fix the failing check, then try again: PR check ${bad.name} failed (${bad.state})`), { code: "pr_publication_fix_the_failing_check_then" })
|
|
55
|
+
const waiting = [...required.filter((name) => !checks.some((check) => check.name === name && check.state === "SUCCESS")),
|
|
56
|
+
...ruled.filter((name) => !checks.some((check) => check.name === name))]
|
|
57
|
+
const missing = [...observed].filter(([id]) => !checks.some((check) => check.id === id)).map(([, name]) => name)
|
|
58
|
+
return [...new Set([...waiting, ...missing, ...checks.filter((check) => !["SUCCESS", "NEUTRAL", "SKIPPED"].includes(check.state)).map((check) => check.name)])]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function commandArgument(value, platform = process.platform) {
|
|
62
|
+
return platform === "win32" ? `'${value.replaceAll("'", "''")}'` : shellQuote(value)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function publicationRecovery(root, platform = process.platform) {
|
|
66
|
+
const script = fileURLToPath(new URL("../../scripts/sync-push.js", import.meta.url))
|
|
67
|
+
return `node ${commandArgument(script, platform)} --root ${commandArgument(root, platform)}`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Publishes one immutable candidate. No upstream ref is pushed; only GitHub's exact-head merge endpoint can advance it. */
|
|
71
|
+
export function publishPullRequest({ git, spawnGit, root, upstream, head, onto, policy, clock = CLOCK, track }) {
|
|
72
|
+
// Both candidates must be object ids: a head or base that was never read would build a branch name, and a command, with nothing in them.
|
|
73
|
+
if (!OBJECT_ID.test(String(head)) || !OBJECT_ID.test(String(onto))) {
|
|
74
|
+
throw Object.assign(new Error("Run it again: Desk has no readable commit to publish, so nothing was pushed"), { code: "pr_publication_run_it_again_desk_has_no" })
|
|
75
|
+
}
|
|
76
|
+
// `get-url` names a configured remote's address; `ls-remote --get-url` also takes an address as the remote and reads rewrite rules, still without the network.
|
|
77
|
+
let remote = git(["remote", "get-url", upstream.remote])
|
|
78
|
+
if (remote.status !== 0 || remote.stdout.trim() === "") remote = git(["ls-remote", "--get-url", upstream.remote])
|
|
79
|
+
if (remote.status !== 0 || remote.stdout.trim() === "") throw Object.assign(new Error("Run it again: nothing was pushed because Git's read of the publication remote's address was cut off or the remote is not configured"), { code: "pr_publication_run_it_again_git_could_not" })
|
|
80
|
+
const repo = repository(remote.stdout.trim())
|
|
81
|
+
const base = upstream.merge.replace(/^refs\/heads\//u, "")
|
|
82
|
+
const branch = `desk/publish/${head}`
|
|
83
|
+
const gh = (args, json = true) => {
|
|
84
|
+
const result = spawnGit("gh", args, { cwd: root, encoding: "utf8", windowsHide: true, timeout: 60_000, env: process.env })
|
|
85
|
+
if (result.status !== 0) {
|
|
86
|
+
// Do not echo arbitrary subprocess output, which can contain credentials.
|
|
87
|
+
throw Object.assign(new Error(`Check gh auth status, then try again: GitHub CLI ${args[0]} ${args[1]} failed (exit ${result.status ?? "timeout"}); check gh auth status --hostname ${repo.host}`), { code: "pr_publication_check_gh_auth_status_then" })
|
|
88
|
+
}
|
|
89
|
+
if (!json) return result.stdout
|
|
90
|
+
try { return JSON.parse(result.stdout) } catch { throw Object.assign(new Error("Run it again: GitHub CLI returned invalid publication JSON"), { code: "pr_publication_run_it_again_github_cli" }) }
|
|
91
|
+
}
|
|
92
|
+
const list = () => {
|
|
93
|
+
const prs = gh(["pr", "list", "--repo", repo.full, "--head", branch, "--base", base, "--state", "all", "--json", FIELDS])
|
|
94
|
+
if (!Array.isArray(prs) || prs.length > 1) throw Object.assign(new Error("Run it again: GitHub did not return one unambiguous publication PR"), { code: "pr_publication_run_it_again_github_did_5" })
|
|
95
|
+
return prs[0]
|
|
96
|
+
}
|
|
97
|
+
const loadChecks = () => {
|
|
98
|
+
const paged = (endpoint, field) => {
|
|
99
|
+
const pages = gh(["api", "--hostname", repo.host, `repos/${repo.name}/commits/${head}/${endpoint}`, "--paginate", "--slurp"])
|
|
100
|
+
if (!Array.isArray(pages) || pages.length === 0 || pages.some((page) => !Array.isArray(page?.[field]))) {
|
|
101
|
+
throw Object.assign(new Error("Run it again: GitHub did not return complete PR check states"), { code: "pr_publication_run_it_again_github_did_4" })
|
|
102
|
+
}
|
|
103
|
+
return pages.flatMap((page) => page[field])
|
|
104
|
+
}
|
|
105
|
+
const statuses = paged("status?per_page=100", "statuses").map((status) => {
|
|
106
|
+
if (typeof status?.context !== "string" || status.context.trim() === "" || typeof status.state !== "string") {
|
|
107
|
+
throw Object.assign(new Error("Run it again: GitHub did not return valid status-context check states"), { code: "pr_publication_run_it_again_github_did_3" })
|
|
108
|
+
}
|
|
109
|
+
return { id: `context:${status.context}`, name: status.context, state: status.state.toUpperCase() }
|
|
110
|
+
})
|
|
111
|
+
const runs = paged("check-runs?filter=latest&per_page=100", "check_runs").map((run) => {
|
|
112
|
+
if (!Number.isSafeInteger(run?.id) || run.id <= 0 || typeof run.name !== "string" || run.name.trim() === "" || typeof run.status !== "string") {
|
|
113
|
+
throw Object.assign(new Error("Run it again: GitHub did not return stable check-run identities"), { code: "pr_publication_run_it_again_github_did_2" })
|
|
114
|
+
}
|
|
115
|
+
const state = run.status === "completed" ? run.conclusion : "pending"
|
|
116
|
+
if (typeof state !== "string") throw Object.assign(new Error("Run it again: GitHub did not return complete check-run conclusions"), { code: "pr_publication_run_it_again_github_did" })
|
|
117
|
+
return { id: `run:${run.id}`, name: run.name, state: state.toUpperCase() }
|
|
118
|
+
})
|
|
119
|
+
return [...statuses, ...runs]
|
|
120
|
+
}
|
|
121
|
+
// An admin token's API merge bypasses branch protection, so the base branch's required checks are read and enforced here.
|
|
122
|
+
const loadRuledChecks = () => {
|
|
123
|
+
const ref = encodeURIComponent(base)
|
|
124
|
+
const unreadable = (detail) => Object.assign(new Error(`Check access to the repository's required checks, then try again: Could not read the checks ${repo.full} requires on ${base} (${detail}); the publication PR will not be merged without them`), { code: "pr_publication_check_access_to_the_repository" })
|
|
125
|
+
let pages, branch
|
|
126
|
+
try {
|
|
127
|
+
pages = gh(["api", "--hostname", repo.host, `repos/${repo.name}/rules/branches/${ref}?per_page=100`, "--paginate", "--slurp"])
|
|
128
|
+
branch = gh(["api", "--hostname", repo.host, `repos/${repo.name}/branches/${ref}`])
|
|
129
|
+
} catch (error) { throw unreadable(error.message) }
|
|
130
|
+
if (!Array.isArray(pages) || pages.some((page) => !Array.isArray(page))) throw unreadable("branch rules were not a list")
|
|
131
|
+
const names = []
|
|
132
|
+
for (const rule of pages.flat()) {
|
|
133
|
+
if (typeof rule?.type !== "string") throw unreadable("a branch rule had no type")
|
|
134
|
+
if (rule.type !== "required_status_checks") continue
|
|
135
|
+
const listed = rule.parameters?.required_status_checks
|
|
136
|
+
if (!Array.isArray(listed) || listed.some((check) => typeof check?.context !== "string" || check.context.trim() === "")) throw unreadable("a required-checks rule had no check names")
|
|
137
|
+
names.push(...listed.map((check) => check.context))
|
|
138
|
+
}
|
|
139
|
+
if (typeof branch?.protected !== "boolean") throw unreadable("branch protection was not reported")
|
|
140
|
+
const contexts = branch.protection?.required_status_checks?.contexts
|
|
141
|
+
if (branch.protected) {
|
|
142
|
+
if (!Array.isArray(contexts) || contexts.some((name) => typeof name !== "string" || name.trim() === "")) throw unreadable("protected-branch checks were not a list of names")
|
|
143
|
+
names.push(...contexts)
|
|
144
|
+
}
|
|
145
|
+
return [...new Set(names)]
|
|
146
|
+
}
|
|
147
|
+
const pushArgs = ["push", "--quiet", upstream.remote, `${head}:refs/heads/${branch}`]
|
|
148
|
+
let pushed = git(pushArgs, 60_000)
|
|
149
|
+
// A push cut off or refused once may have met a slow hook or a remote mid-update; the same push is repeated once, it is idempotent for one commit and one branch.
|
|
150
|
+
if (pushed.status !== 0) pushed = git(pushArgs, 120_000)
|
|
151
|
+
if (pushed.status !== 0) {
|
|
152
|
+
const said = redactCredentialLikeText(String(pushed.stderr ?? "").split("\n").find((line) => line.trim() !== "") ?? "").slice(0, 200)
|
|
153
|
+
throw Object.assign(new Error(`Push ${commandArgument(`${head}:refs/heads/${branch}`)} to ${commandArgument(upstream.remote)} yourself to read its admission diagnostic: the contribution branch push was ${pushed.status === null ? "cut off" : "refused by its hook or remote"} twice${said === "" ? "" : ` (${said})`}, and the upstream branch was not pushed.`), { code: "pr_publication_push_the_branch_with_the" })
|
|
154
|
+
}
|
|
155
|
+
let pr = list()
|
|
156
|
+
if (pr === undefined) {
|
|
157
|
+
gh(["pr", "create", "--repo", repo.full, "--head", branch, "--base", base, "--title", "Publish workspace changes",
|
|
158
|
+
"--body", `Workspace publication of ${head}. The published ${POLICY} defines the checks required before merging.`], false)
|
|
159
|
+
pr = list()
|
|
160
|
+
}
|
|
161
|
+
if (pr === undefined) throw Object.assign(new Error("Run it again: The created publication PR could not be read back"), { code: "pr_publication_run_it_again_the_created" })
|
|
162
|
+
const receipt = { url: pr.url, head, branch, base }
|
|
163
|
+
// Each candidate has its own branch, so an earlier candidate's PR that never merged would stay open until someone closes it by hand. This one carries its work, so close the others; best effort.
|
|
164
|
+
if (pr.state === "OPEN") {
|
|
165
|
+
try {
|
|
166
|
+
const open = gh(["pr", "list", "--repo", repo.full, "--base", base, "--state", "open", "--json", "number,headRefName"])
|
|
167
|
+
for (const old of open) {
|
|
168
|
+
if (!String(old.headRefName).startsWith("desk/publish/") || old.headRefName === branch) continue
|
|
169
|
+
try { gh(["pr", "close", String(old.number), "--repo", repo.full, "--delete-branch", "--comment", `Superseded by ${pr.url}, which publishes a newer candidate that includes this one's work.`], false) } catch { /* the next publication tries again */ }
|
|
170
|
+
}
|
|
171
|
+
} catch { /* closing is housekeeping; it never blocks publishing */ }
|
|
172
|
+
}
|
|
173
|
+
// Merging must not depend on one repository setting: the relay's label goes on every publication PR, and auto-merge is asked for where the repository allows it. Both are best effort; the checks below still gate Desk's own merge.
|
|
174
|
+
if (pr.state !== "MERGED") {
|
|
175
|
+
const label = MERGE_LABEL
|
|
176
|
+
const attempt = (args) => { try { gh(args, false); return true } catch { return false } }
|
|
177
|
+
attempt(["label", "create", label, "--repo", repo.full, "--force", "--description", "Merge when the required checks are green"])
|
|
178
|
+
receipt.labelled = attempt(["pr", "edit", String(pr.number), "--repo", repo.full, "--add-label", label])
|
|
179
|
+
receipt.auto_merge = attempt(["pr", "merge", String(pr.number), "--repo", repo.full, "--auto", "--merge", "--match-head-commit", head]) ? "enabled" : "refused"
|
|
180
|
+
track?.record(receipt)
|
|
181
|
+
}
|
|
182
|
+
const view = () => gh(["pr", "view", String(pr.number), "--repo", repo.full, "--json", FIELDS])
|
|
183
|
+
const verify = (current) => {
|
|
184
|
+
if (current.headRefOid !== head || current.baseRefName !== base || current.isDraft || !["OPEN", "MERGED"].includes(current.state)) {
|
|
185
|
+
throw Object.assign(new Error("Review the pull request, then merge it yourself or run it again: The publication PR was changed, closed, or made draft; it will not be merged automatically"), { code: "pr_publication_review_the_pull_request_then" })
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
verify(pr)
|
|
190
|
+
const observed = new Map()
|
|
191
|
+
const ruled = pr.state === "MERGED" ? [] : loadRuledChecks()
|
|
192
|
+
if (pr.state !== "MERGED") for (const check of loadChecks()) observed.set(check.id, check.name)
|
|
193
|
+
const deadline = clock.now() + WAIT_MS
|
|
194
|
+
for (;;) {
|
|
195
|
+
pr = view()
|
|
196
|
+
verify(pr)
|
|
197
|
+
if (pr.state === "MERGED") break
|
|
198
|
+
if (pr.baseRefOid !== onto || pr.mergeable === "CONFLICTING") throw Object.assign(new Error(`Run it again: The publication conflicts with or is behind ${base}; retry to rebuild it on the newest ${base}`), { code: "pr_publication_run_it_again_the_publication", requalify: true })
|
|
199
|
+
const reported = loadChecks()
|
|
200
|
+
const waiting = checkState(reported, policy.required_checks, observed, ruled)
|
|
201
|
+
if (waiting.length === 0) {
|
|
202
|
+
const merged = gh(["api", "--hostname", repo.host, "--method", "PUT", `repos/${repo.name}/pulls/${pr.number}/merge`,
|
|
203
|
+
"-f", `sha=${head}`, "-f", "merge_method=merge"])
|
|
204
|
+
if (merged.merged !== true || typeof merged.sha !== "string") throw Object.assign(new Error("Check the pull request's merge requirements, then run it again: GitHub refused the exact-head merge"), { code: "pr_publication_check_the_pull_request_s" })
|
|
205
|
+
receipt.merge = merged.sha
|
|
206
|
+
break
|
|
207
|
+
}
|
|
208
|
+
if (clock.now() >= deadline) {
|
|
209
|
+
const unreported = policy.required_checks.filter((name) => !reported.some((check) => check.name === name))
|
|
210
|
+
throw Object.assign(new Error(`Wait for the checks to finish, then run it again: PR checks still missing or pending: ${waiting.join(", ")}${unreported.length === 0 ? "" : `. Never reported on ${head}: ${unreported.join(", ")}. GitHub Actions will not supply a check that is only posted by running it against this exact commit (for example CIT's cit-check, which runs on a writer's machine); run it on branch ${branch}`}`), { code: "pr_publication_wait_for_the_checks_to" })
|
|
211
|
+
}
|
|
212
|
+
clock.sleep(Math.min(5000, deadline - clock.now()))
|
|
213
|
+
}
|
|
214
|
+
const fetched = git(["fetch", "--quiet", "--no-tags", upstream.remote, `+${upstream.merge}:${upstream.tracking}`], 60_000)
|
|
215
|
+
if (fetched.status !== 0) throw Object.assign(new Error("Run it again: The PR merge could not be fetched for verification"), { code: "pr_publication_run_it_again_the_pr" })
|
|
216
|
+
const target = git(["rev-parse", upstream.tracking]).stdout.trim()
|
|
217
|
+
if (git(["merge-base", "--is-ancestor", head, target]).status !== 0) throw Object.assign(new Error("Run it again once the upstream has caught up: The candidate is not reachable from the actual remote upstream"), { code: "pr_publication_run_it_again_once_the" })
|
|
218
|
+
receipt.merge ??= pr.mergeCommit?.oid ?? target
|
|
219
|
+
track?.clear(receipt)
|
|
220
|
+
return { head: target, receipt }
|
|
221
|
+
} catch (error) {
|
|
222
|
+
error.publication = receipt
|
|
223
|
+
error.message += `. Fix: gh pr checks ${receipt.url}; after resolving it, run ${publicationRecovery(root)}`
|
|
224
|
+
throw error
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { deskVersion } from "../package-metadata.js"
|
|
2
|
+
|
|
3
|
+
export function diagnosticFormat(input) {
|
|
4
|
+
const format = input?.format
|
|
5
|
+
if (format !== undefined && format !== "full" && format !== "preview") {
|
|
6
|
+
throw Object.assign(new TypeError("Pass full or preview: unsupported diagnostic format; use full or preview"), { code: "preview_snapshot_pass_full_or_preview_unsupported" })
|
|
7
|
+
}
|
|
8
|
+
return format ?? "full"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function previewRuntimeSnapshot(runtimeState) {
|
|
12
|
+
return {
|
|
13
|
+
schema_version: 1,
|
|
14
|
+
purpose: "preview-runtime-diagnostics",
|
|
15
|
+
collection: "local-on-demand",
|
|
16
|
+
desk_version: deskVersion(),
|
|
17
|
+
runtime_state: runtimeState,
|
|
18
|
+
platform: process.platform,
|
|
19
|
+
architecture: process.arch,
|
|
20
|
+
node_major: Number(process.versions.node.split(".")[0]),
|
|
21
|
+
node_abi: process.versions.modules,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// A server launched with `--publication deferred` commits but never schedules a push: the caller that launched it
|
|
2
|
+
// publishes the commit through its own route (`local-recovery.js --publication deferred`). Every entry point that can
|
|
3
|
+
// schedule a push sets the mode from its own arguments, so a variable inherited from a shell can never silently stop an
|
|
4
|
+
// ordinary session's pushes; a deferred server hands the mode to the children it starts as an argument.
|
|
5
|
+
export const PUBLICATION_ENV = "DESK_PUBLICATION"
|
|
6
|
+
const PUBLICATION_DEFERRED = "deferred"
|
|
7
|
+
|
|
8
|
+
export function applyPublicationMode(args, env) {
|
|
9
|
+
if (args.publication === PUBLICATION_DEFERRED) env[PUBLICATION_ENV] = PUBLICATION_DEFERRED
|
|
10
|
+
else delete env[PUBLICATION_ENV]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function publicationDeferred(env) {
|
|
14
|
+
return env[PUBLICATION_ENV] === PUBLICATION_DEFERRED
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function publicationArgs(env) {
|
|
18
|
+
return publicationDeferred(env) ? ["--publication", PUBLICATION_DEFERRED] : []
|
|
19
|
+
}
|