@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,342 @@
|
|
|
1
|
+
// Moves an explicit Agency entry for Desk on `main` to Desk's release channel, without ever leaving a session two Desk roots.
|
|
2
|
+
//
|
|
3
|
+
// Desk ships to Agency on `github:ourostack/desk:plugins/desk@release`; an install from before that lists `...desk@main` in
|
|
4
|
+
// agency.toml. Agency loads two Desk roots when one plugin list selects Desk under two specs (it merges identical specs only),
|
|
5
|
+
// so the entry cannot simply be renamed while another plugin in the same list still declares Desk as a dependency. For each
|
|
6
|
+
// explicit `@main` entry, the engines (`claude`, `copilot`) on which another plugin in its list already brings Desk, directly
|
|
7
|
+
// or through its own dependencies (CIT declares MS Desk, which declares Desk), read from the cached `agency.json` files in
|
|
8
|
+
// Agency's own cache, are covered. A plugin whose entry has no engines line covers the engines its cached manifest supports,
|
|
9
|
+
// because Agency limits a plugin to those:
|
|
10
|
+
//
|
|
11
|
+
// - every engine covered: the entry is removed, because the plugin that declares Desk selects it there, on the spec it declares;
|
|
12
|
+
// - no engine covered: the entry moves to `@release`;
|
|
13
|
+
// - some covered: the entry moves to `@release` for the other engines only.
|
|
14
|
+
//
|
|
15
|
+
// A plugin in the same list whose dependency graph Agency has not fully cached holds the entry: it might bring Desk, and
|
|
16
|
+
// guessing could load a second root. The `03-desk-release-channel` migration runs this from the installed plugin, so it
|
|
17
|
+
// imports nothing outside Node's built-ins and Desk's own dependency-free modules, and keeps to what Node 16 has. agency.toml
|
|
18
|
+
// (the file a symlink points at, so the link stays a link) is replaced whole, under Desk's directory lock and only if nobody
|
|
19
|
+
// changed it meanwhile, after a one-time copy to `agency.toml.pre-desk-release` beside it.
|
|
20
|
+
|
|
21
|
+
import { promises as fs, readFileSync, realpathSync } from "node:fs"
|
|
22
|
+
import { randomBytes } from "node:crypto"
|
|
23
|
+
import * as os from "node:os"
|
|
24
|
+
import * as path from "node:path"
|
|
25
|
+
import { setTimeout as delay } from "node:timers/promises"
|
|
26
|
+
import { readFileWithRetryAsync, renameWithRetryAsync } from "../util/rename-retry.js"
|
|
27
|
+
|
|
28
|
+
export const MAIN_SPEC = "github:ourostack/desk:plugins/desk@main"
|
|
29
|
+
export const RELEASE_SPEC = "github:ourostack/desk:plugins/desk@release"
|
|
30
|
+
const ENGINES = ["claude", "copilot"]
|
|
31
|
+
export const BACKUP_SUFFIX = ".pre-desk-release"
|
|
32
|
+
const DESK_DEPENDENCY = /^github:ourostack\/desk:plugins\/desk@/u
|
|
33
|
+
// A cache entry's folder name: one path segment, never `.` or `..`.
|
|
34
|
+
const CACHE_DIR_NAME = /^(?!\.\.?$)[A-Za-z0-9._-]+$/u
|
|
35
|
+
|
|
36
|
+
const ARRAY_HEADER = /^\s*\[\[\s*([^\]]+?)\s*\]\]\s*(?:#.*)?$/u
|
|
37
|
+
const ANY_HEADER = /^\s*\[/u
|
|
38
|
+
const PLUGIN_LINE = /^(\s*plugin\s*=\s*)(?:"([^"\\]*)"|'([^']*)')(\s*(?:#.*)?)$/u
|
|
39
|
+
const ENGINES_LINE = /^\s*engines\s*=/u
|
|
40
|
+
const ENGINES_VALUE = /^\s*engines\s*=\s*\[([^\]]*)\]\s*(?:#.*)?$/u
|
|
41
|
+
|
|
42
|
+
/** The array-table blocks of an agency.toml: `{ table, start, end, plugin, pluginLine, engines, enginesLine, badEngines }`. */
|
|
43
|
+
export function readBlocks(lines) {
|
|
44
|
+
const blocks = []
|
|
45
|
+
let current = null
|
|
46
|
+
lines.forEach((line, index) => {
|
|
47
|
+
if (ANY_HEADER.test(line)) {
|
|
48
|
+
if (current !== null) current.end = index
|
|
49
|
+
const header = ARRAY_HEADER.exec(line)
|
|
50
|
+
current = header === null ? null : { table: header[1], start: index, end: lines.length, plugin: null, pluginLine: -1, engines: null, enginesLine: -1, badEngines: false }
|
|
51
|
+
if (current !== null) blocks.push(current)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
if (current === null) return
|
|
55
|
+
const plugin = PLUGIN_LINE.exec(line)
|
|
56
|
+
if (plugin !== null) {
|
|
57
|
+
current.plugin = plugin[2] ?? plugin[3]
|
|
58
|
+
current.pluginLine = index
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
if (ENGINES_LINE.test(line)) {
|
|
62
|
+
current.enginesLine = index
|
|
63
|
+
const value = ENGINES_VALUE.exec(line)
|
|
64
|
+
const names = value === null ? null : [...value[1].matchAll(/"([^"]*)"|'([^']*)'/gu)].map((match) => match[1] ?? match[2])
|
|
65
|
+
if (names === null || names.some((name) => !ENGINES.includes(name))) current.badEngines = true
|
|
66
|
+
else current.engines = names
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
return blocks
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// The folder of each cached copy of `spec`, one per engine that has one, in ENGINES order.
|
|
73
|
+
function* cachedRoots(cacheDir, spec, readFile) {
|
|
74
|
+
let entries
|
|
75
|
+
try {
|
|
76
|
+
entries = JSON.parse(readFile(path.join(cacheDir, "cache_index.json"))).entries ?? {}
|
|
77
|
+
} catch {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
for (const engine of ENGINES) {
|
|
81
|
+
const dir = entries[`${engine}:${spec}`]?.dir_name
|
|
82
|
+
if (typeof dir === "string" && CACHE_DIR_NAME.test(dir)) yield path.join(cacheDir, "entries", dir)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The dependencies a cached plugin declares, from Agency's cache: `string[]` (empty when its copy has no agency.json), or null
|
|
88
|
+
* when Agency has no readable cached copy of `spec` for any engine.
|
|
89
|
+
*/
|
|
90
|
+
export function cachedDependencies(cacheDir, spec, readFile = (file) => readFileSync(file, "utf8")) {
|
|
91
|
+
for (const root of cachedRoots(cacheDir, spec, readFile)) {
|
|
92
|
+
let manifest
|
|
93
|
+
try {
|
|
94
|
+
manifest = readFile(path.join(root, "agency.json"))
|
|
95
|
+
} catch {
|
|
96
|
+
// A cached copy without agency.json declares nothing, but only if the copy itself is there.
|
|
97
|
+
try {
|
|
98
|
+
readFile(path.join(root, "plugin.json"))
|
|
99
|
+
return []
|
|
100
|
+
} catch {
|
|
101
|
+
continue
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const dependencies = JSON.parse(manifest).dependencies
|
|
106
|
+
return Array.isArray(dependencies) ? dependencies.filter((item) => typeof item === "string") : []
|
|
107
|
+
} catch {
|
|
108
|
+
continue
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return null
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const readOrNull = (readFile, file) => {
|
|
115
|
+
try {
|
|
116
|
+
return readFile(file)
|
|
117
|
+
} catch {
|
|
118
|
+
return null
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The engines a cached plugin supports, from its first usable cached copy: the members of its agency.json `engines` array that
|
|
124
|
+
* are in ENGINES. Without an `engines` field, the engines whose manifest the copy holds (`.claude-plugin/plugin.json` for claude,
|
|
125
|
+
* `plugin.json` for copilot). Null when no copy is usable, or when its `engines` value is not an array of strings.
|
|
126
|
+
*/
|
|
127
|
+
export function cachedEngines(cacheDir, spec, readFile = (file) => readFileSync(file, "utf8")) {
|
|
128
|
+
for (const root of cachedRoots(cacheDir, spec, readFile)) {
|
|
129
|
+
const manifest = readOrNull(readFile, path.join(root, "agency.json"))
|
|
130
|
+
const claude = readOrNull(readFile, path.join(root, ".claude-plugin", "plugin.json")) !== null
|
|
131
|
+
const copilot = readOrNull(readFile, path.join(root, "plugin.json")) !== null
|
|
132
|
+
const derived = ENGINES.filter((engine) => (engine === "claude" ? claude : copilot))
|
|
133
|
+
let engines
|
|
134
|
+
if (manifest !== null) {
|
|
135
|
+
try {
|
|
136
|
+
engines = JSON.parse(manifest).engines
|
|
137
|
+
} catch {
|
|
138
|
+
return null
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (engines === undefined) {
|
|
142
|
+
if (derived.length > 0) return derived
|
|
143
|
+
continue
|
|
144
|
+
}
|
|
145
|
+
if (!Array.isArray(engines) || engines.some((engine) => typeof engine !== "string")) return null
|
|
146
|
+
return ENGINES.filter((engine) => engines.includes(engine))
|
|
147
|
+
}
|
|
148
|
+
return null
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const enginesOf = (block) => (block.engines === null ? [...ENGINES] : block.engines)
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Whether selecting `spec` brings Desk, following dependencies through Agency's cache as far as they go (CIT declares MS Desk,
|
|
155
|
+
* which declares Desk): `{ desk, missing }`, where `missing` lists every reachable spec whose manifest is not cached. Each spec
|
|
156
|
+
* is visited once, so a dependency cycle ends.
|
|
157
|
+
*/
|
|
158
|
+
export function reachesDesk(spec, dependenciesOf) {
|
|
159
|
+
const seen = new Set()
|
|
160
|
+
const queue = [spec]
|
|
161
|
+
const missing = []
|
|
162
|
+
let desk = false
|
|
163
|
+
while (queue.length > 0) {
|
|
164
|
+
const next = queue.shift()
|
|
165
|
+
if (seen.has(next)) continue
|
|
166
|
+
seen.add(next)
|
|
167
|
+
if (DESK_DEPENDENCY.test(next)) {
|
|
168
|
+
desk = true
|
|
169
|
+
continue
|
|
170
|
+
}
|
|
171
|
+
const dependencies = dependenciesOf(next)
|
|
172
|
+
if (dependencies === null) missing.push(next)
|
|
173
|
+
else queue.push(...dependencies)
|
|
174
|
+
}
|
|
175
|
+
return { desk, missing }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* plan({ text, cacheDir, readFile }) -> { actions: [{ block, action: "remove" | "release", engines }], held: [reason] }
|
|
180
|
+
*
|
|
181
|
+
* What would change in this agency.toml text; changes nothing.
|
|
182
|
+
*/
|
|
183
|
+
export function plan({ text, cacheDir, readFile }) {
|
|
184
|
+
const lines = text.split("\n")
|
|
185
|
+
const blocks = readBlocks(lines)
|
|
186
|
+
const manifests = new Map()
|
|
187
|
+
const dependenciesOf = (spec) => {
|
|
188
|
+
if (!manifests.has(spec)) manifests.set(spec, cachedDependencies(cacheDir, spec, readFile))
|
|
189
|
+
return manifests.get(spec)
|
|
190
|
+
}
|
|
191
|
+
const engineSupport = new Map()
|
|
192
|
+
const cachedEnginesOf = (spec) => {
|
|
193
|
+
if (!engineSupport.has(spec)) engineSupport.set(spec, cachedEngines(cacheDir, spec, readFile))
|
|
194
|
+
return engineSupport.get(spec)
|
|
195
|
+
}
|
|
196
|
+
// The engines another block brings Desk on: its engines line, else the engines its plugin supports (a Desk spec itself
|
|
197
|
+
// supports every engine). Null when the cached manifest does not say.
|
|
198
|
+
const bringsOn = (block) => {
|
|
199
|
+
if (block.badEngines) return [...ENGINES]
|
|
200
|
+
if (block.engines !== null) return block.engines
|
|
201
|
+
if (DESK_DEPENDENCY.test(block.plugin)) return [...ENGINES]
|
|
202
|
+
return cachedEnginesOf(block.plugin)
|
|
203
|
+
}
|
|
204
|
+
const actions = []
|
|
205
|
+
const held = []
|
|
206
|
+
for (const target of blocks.filter((block) => block.plugin === MAIN_SPEC)) {
|
|
207
|
+
if (target.badEngines) {
|
|
208
|
+
held.push(`the ${target.table} entry for ${MAIN_SPEC} has an engines value this migration cannot read`)
|
|
209
|
+
continue
|
|
210
|
+
}
|
|
211
|
+
const wanted = enginesOf(target)
|
|
212
|
+
const covered = new Set()
|
|
213
|
+
const unknown = []
|
|
214
|
+
for (const other of blocks) {
|
|
215
|
+
if (other === target || other.table !== target.table || other.plugin === null || other.plugin === MAIN_SPEC) continue
|
|
216
|
+
const engines = bringsOn(other)
|
|
217
|
+
if (engines !== null && !engines.some((engine) => wanted.includes(engine))) continue
|
|
218
|
+
const reach = reachesDesk(other.plugin, dependenciesOf)
|
|
219
|
+
// A plugin that brings Desk on engines this cannot read might cover any of them, and one whose graph is not all cached
|
|
220
|
+
// might bring Desk: either holds the entry, because guessing could select Desk twice.
|
|
221
|
+
if (engines !== null && reach.desk && !other.badEngines) for (const engine of engines) covered.add(engine)
|
|
222
|
+
else if (reach.desk || reach.missing.length > 0) unknown.push(reach.missing.some((spec) => spec !== other.plugin) ? `${other.plugin} (not cached: ${reach.missing.join(", ")})` : other.plugin)
|
|
223
|
+
}
|
|
224
|
+
if (unknown.length > 0) {
|
|
225
|
+
held.push(`in ${target.table}, Desk cannot yet tell on which engines ${unknown.join(", ")} brings Desk (Agency has not cached every manifest it depends on, or its engines value, in agency.toml or its cached manifest, is not one this reads), so ${MAIN_SPEC} stays until it can`)
|
|
226
|
+
continue
|
|
227
|
+
}
|
|
228
|
+
const rest = wanted.filter((engine) => !covered.has(engine))
|
|
229
|
+
actions.push({ block: target, action: rest.length === 0 ? "remove" : "release", engines: rest.length === wanted.length ? null : rest })
|
|
230
|
+
}
|
|
231
|
+
return { actions, held, lines }
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Applies `actions` to `lines` and returns the new text. Later blocks are changed first, so earlier line numbers hold. */
|
|
235
|
+
export function apply(lines, actions) {
|
|
236
|
+
const out = [...lines]
|
|
237
|
+
for (const { block, action, engines } of [...actions].sort((a, b) => b.block.start - a.block.start)) {
|
|
238
|
+
if (action === "remove") {
|
|
239
|
+
out.splice(block.start, block.end - block.start)
|
|
240
|
+
continue
|
|
241
|
+
}
|
|
242
|
+
if (engines !== null) {
|
|
243
|
+
const line = `engines = [${engines.map((engine) => `"${engine}"`).join(", ")}]`
|
|
244
|
+
if (block.enginesLine >= 0) out[block.enginesLine] = line
|
|
245
|
+
else out.splice(block.pluginLine + 1, 0, line)
|
|
246
|
+
}
|
|
247
|
+
out[block.pluginLine] = out[block.pluginLine].replace(PLUGIN_LINE, (_all, lead, _double, _single, tail) => `${lead}"${RELEASE_SPEC}"${tail}`)
|
|
248
|
+
}
|
|
249
|
+
return out.join("\n")
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function describe({ block, action, engines }) {
|
|
253
|
+
if (action === "remove") return `removed the ${block.table} entry for ${MAIN_SPEC}: another plugin there brings Desk on every engine the entry named`
|
|
254
|
+
if (engines === null) return `${block.table} now selects ${RELEASE_SPEC}`
|
|
255
|
+
return `${block.table} now selects ${RELEASE_SPEC} for ${engines.join(", ")}; another plugin there brings Desk on the other engines`
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export const LOCK_SUFFIX = ".desk-migration.lock"
|
|
259
|
+
// Thrown inside replaceIfUnchanged when agency.toml changed while its rename was being retried.
|
|
260
|
+
const CHANGED = Symbol("agency.toml changed before the swap")
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Writes `next` over the agency.toml at `target` (the resolved file, so a symlink to it stays a symlink) only if it still
|
|
264
|
+
* holds `seen`: under Desk's directory lock beside it, through a temporary file in the same folder renamed into place, so
|
|
265
|
+
* no reader ever sees half a file. Returns "written", "changed" (someone else changed it; nothing written) or "busy".
|
|
266
|
+
* Without Agency taking this lock, a write that lands between the final read and a single successful rename (two system calls) can't be detected by Desk.
|
|
267
|
+
*/
|
|
268
|
+
export async function replaceIfUnchanged({ target, seen, next, backup, lockWaitMs = 500, fsp = fs, rename = (from, to) => fsp.rename(from, to), sleep = delay, platform = process.platform, holdLock }) {
|
|
269
|
+
const outcome = await holdLock(`${target}${LOCK_SUFFIX}`, { lockWaitMs }, async () => {
|
|
270
|
+
if ((await fsp.readFile(target, "utf8")) !== seen) return "changed"
|
|
271
|
+
const mode = (await fsp.stat(target)).mode & 0o777
|
|
272
|
+
const temp = `${target}.desk-${process.pid}-${randomBytes(4).toString("hex")}.tmp`
|
|
273
|
+
// Windows can refuse the rename while Agency has the file open, and each retry is a new window: before every retry the
|
|
274
|
+
// target must still hold `seen`. A busy read is retried like the rename; a read that stays busy, or fails otherwise, counts as
|
|
275
|
+
// a change, because Desk cannot verify the file.
|
|
276
|
+
const beforeRetry = async () => {
|
|
277
|
+
let now
|
|
278
|
+
try {
|
|
279
|
+
now = await readFileWithRetryAsync(target, "utf8", { readFile: (file, encoding) => fsp.readFile(file, encoding), sleep, platform })
|
|
280
|
+
} catch {
|
|
281
|
+
throw CHANGED
|
|
282
|
+
}
|
|
283
|
+
if (now !== seen) throw CHANGED
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
await fsp.writeFile(temp, next, { flag: "wx", mode })
|
|
287
|
+
// The backup is the file as it was before the first move, and is never overwritten.
|
|
288
|
+
await fsp.writeFile(backup, seen, { flag: "wx", mode }).catch((error) => {
|
|
289
|
+
if (error.code !== "EEXIST") throw error
|
|
290
|
+
})
|
|
291
|
+
// Read again right before the swap: a write that landed while the new file was being prepared is never lost.
|
|
292
|
+
if ((await fsp.readFile(target, "utf8")) !== seen) return "changed"
|
|
293
|
+
try {
|
|
294
|
+
await renameWithRetryAsync(temp, target, { rename, sleep, platform, beforeRetry })
|
|
295
|
+
} catch (error) {
|
|
296
|
+
if (error === CHANGED) return "changed"
|
|
297
|
+
throw error
|
|
298
|
+
}
|
|
299
|
+
return "written"
|
|
300
|
+
} finally {
|
|
301
|
+
await fsp.rm(temp, { force: true })
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
return outcome?.result === "lock_busy" ? "busy" : outcome
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** `--detect`: exit 0 when there is something to move, else 1 (printing `held: <reason>` when an entry waits). `--migrate`: move it. */
|
|
308
|
+
export async function runAgencyDeskChannelCli({ argv, env, io, readFile = (file) => readFileSync(file, "utf8"), homeDir = os.homedir(), replace = replaceIfUnchanged, loadLock = async () => (await import("../desk/improvement-cards.js")).holdLock }) {
|
|
309
|
+
const mode = argv[0]
|
|
310
|
+
if (mode !== "--detect" && mode !== "--migrate") {
|
|
311
|
+
io.stderr.write("usage: Run it with --detect or --migrate: agency-desk-channel.js --detect | --migrate\n")
|
|
312
|
+
return 2
|
|
313
|
+
}
|
|
314
|
+
const toml = typeof env.AGENCY_TOML === "string" && env.AGENCY_TOML !== "" ? env.AGENCY_TOML : path.join(homeDir, ".local", "agency", "agency.toml")
|
|
315
|
+
let target
|
|
316
|
+
let text
|
|
317
|
+
try {
|
|
318
|
+
target = realpathSync(toml)
|
|
319
|
+
text = readFile(target)
|
|
320
|
+
} catch {
|
|
321
|
+
return mode === "--detect" ? 1 : 0
|
|
322
|
+
}
|
|
323
|
+
const result = plan({ text, cacheDir: path.join(path.dirname(toml), "plugins", "cache"), readFile })
|
|
324
|
+
if (mode === "--detect") {
|
|
325
|
+
if (result.actions.length > 0) return 0
|
|
326
|
+
if (result.held.length > 0) io.stdout.write(`held: ${result.held[0]}\n`)
|
|
327
|
+
return 1
|
|
328
|
+
}
|
|
329
|
+
if (result.actions.length > 0) {
|
|
330
|
+
const backup = `${target}${BACKUP_SUFFIX}`
|
|
331
|
+
const outcome = await replace({ target, seen: text, next: apply(result.lines, result.actions), backup, holdLock: await loadLock() })
|
|
332
|
+
if (outcome !== "written") {
|
|
333
|
+
io.stdout.write(outcome === "busy"
|
|
334
|
+
? `Agency: ${toml} was not changed: another Desk session is moving it now; the next session start checks again.\n`
|
|
335
|
+
: `Agency: ${toml} was not changed: it changed while this ran; the next session start checks again.\n`)
|
|
336
|
+
return 1
|
|
337
|
+
}
|
|
338
|
+
io.stdout.write(`Agency: ${toml}: ${result.actions.map(describe).join("; ")}. The original file is kept as ${backup}.\n`)
|
|
339
|
+
}
|
|
340
|
+
for (const reason of result.held) io.stdout.write(`Agency: left as it is: ${reason}.\n`)
|
|
341
|
+
return 0
|
|
342
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// The desk's AGENTS.md, size-capped, as boot prints it and as a hosted Desk sends it in its MCP instructions.
|
|
2
|
+
//
|
|
3
|
+
// The hosted front door imports this before the runtime pack is restored, so it imports only `node:` modules.
|
|
4
|
+
|
|
5
|
+
import { closeSync, fstatSync, openSync, readSync } from "node:fs"
|
|
6
|
+
import * as path from "node:path"
|
|
7
|
+
|
|
8
|
+
/** How much of the desk's AGENTS.md boot prints; the rest stays in the file, named by its path. */
|
|
9
|
+
export const AGENTS_MD_CAP_BYTES = 16 * 1024
|
|
10
|
+
|
|
11
|
+
// Where a file longer than `cap` bytes is cut: at its last line break inside the cap, or, with none, at a character boundary.
|
|
12
|
+
function cutEnd(buffer, cap) {
|
|
13
|
+
let end = buffer.subarray(0, cap).lastIndexOf(0x0a)
|
|
14
|
+
if (end === -1) {
|
|
15
|
+
end = cap
|
|
16
|
+
while (end > 0 && (buffer[end] & 0xc0) === 0x80) end -= 1
|
|
17
|
+
}
|
|
18
|
+
return end
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The part of `text` session start prints under `cap` bytes, cut exactly as `readAgentsMd` cuts a file. */
|
|
22
|
+
export function printedPart(text, cap = AGENTS_MD_CAP_BYTES) {
|
|
23
|
+
const buffer = Buffer.from(text, "utf8")
|
|
24
|
+
return buffer.length <= cap ? text : buffer.toString("utf8", 0, cutEnd(buffer, cap))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The desk's AGENTS.md as `{ path, text, truncated, bytes, shownBytes }`, or null when the desk has none or it cannot
|
|
29
|
+
* be read. A file over `cap` bytes is cut at its last line break inside the cap (or, with none, at a character
|
|
30
|
+
* boundary), so a rule is never shown half-written.
|
|
31
|
+
*/
|
|
32
|
+
export function readAgentsMd(root, { cap = AGENTS_MD_CAP_BYTES } = {}) {
|
|
33
|
+
const file = path.join(root, "AGENTS.md")
|
|
34
|
+
let fd
|
|
35
|
+
try {
|
|
36
|
+
fd = openSync(file, "r")
|
|
37
|
+
} catch {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
// One byte past the cap tells a file of exactly `cap` bytes from a longer one.
|
|
42
|
+
const buffer = Buffer.alloc(cap + 1)
|
|
43
|
+
const bytesRead = readSync(fd, buffer, 0, cap + 1, 0)
|
|
44
|
+
if (bytesRead <= cap) return { path: file, text: buffer.toString("utf8", 0, bytesRead), truncated: false, bytes: bytesRead, shownBytes: bytesRead }
|
|
45
|
+
const end = cutEnd(buffer, cap)
|
|
46
|
+
return { path: file, text: buffer.toString("utf8", 0, end), truncated: true, bytes: fstatSync(fd).size, shownBytes: end }
|
|
47
|
+
} finally {
|
|
48
|
+
closeSync(fd)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The part of the budget a person's own AGENTS.md always gets, however much of it the desk's file fills. */
|
|
53
|
+
export const PERSON_AGENTS_MIN_BYTES = 8 * 1024
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* How much of the person's AGENTS.md session start prints after the desk's (`desk` as `readAgentsMd` returned it): what
|
|
57
|
+
* the desk's file leaves of the budget, and never less than `PERSON_AGENTS_MIN_BYTES`, so a large team file cannot hide
|
|
58
|
+
* the person's own rules.
|
|
59
|
+
*/
|
|
60
|
+
export function personAgentsCap(desk) {
|
|
61
|
+
return Math.max(AGENTS_MD_CAP_BYTES - (desk?.shownBytes ?? 0), PERSON_AGENTS_MIN_BYTES)
|
|
62
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// The commit for the cheap append path: a task's `log.md` entry is in the file when `task_update` returns, and the detached
|
|
2
|
+
// push worker (`runtime/sync-worker.js`) commits it, so the entry never depends on the server living through a quiet moment.
|
|
3
|
+
//
|
|
4
|
+
// A waiting log is a task's `log.md` (a `log.md` beside a `task.md`) that Git holds as changed or untracked. The worker
|
|
5
|
+
// waits until no waiting log has changed for `quietMs`, and never more than `maxWaitMs`, then commits every waiting log in
|
|
6
|
+
// one commit and pushes once, so rapid appends become one commit and one push. Session start commits any a server left
|
|
7
|
+
// behind (`runtime/session-sync.js`). A commit Git refuses leaves the logs written and waiting for the next worker or start.
|
|
8
|
+
|
|
9
|
+
import { spawnSync } from "node:child_process"
|
|
10
|
+
import { existsSync, statSync } from "node:fs"
|
|
11
|
+
import * as path from "node:path"
|
|
12
|
+
import { commitPaths, hasUnstagedWork, stagePaths, stagedChanges } from "../util/git-stage.js"
|
|
13
|
+
|
|
14
|
+
const APPEND_QUIET_MS = 5000
|
|
15
|
+
const APPEND_MAX_WAIT_MS = 30_000
|
|
16
|
+
|
|
17
|
+
/** The task logs under `root` that differ from HEAD or are untracked, relative to `root` and with `/`. Empty when Git cannot say. */
|
|
18
|
+
export function waitingLogs(root, spawnGit = spawnSync) {
|
|
19
|
+
const git = (args) => spawnGit("git", ["-C", root, ...args], { windowsHide: true, encoding: "utf8", timeout: 10_000 })
|
|
20
|
+
const glob = [":(glob)**/log.md"]
|
|
21
|
+
let found
|
|
22
|
+
if (existsSync(path.join(root, ".git"))) {
|
|
23
|
+
// One status call (what differs from HEAD, and what is untracked) in place of a diff and an ls-files; it takes no lock. Its paths are
|
|
24
|
+
// relative to the top of the repository, which `root` is here.
|
|
25
|
+
const status = git(["--no-optional-locks", "status", "--porcelain=v1", "-z", "--no-renames", "--untracked-files=all", "--", ...glob])
|
|
26
|
+
if (status.status !== 0) return []
|
|
27
|
+
found = String(status.stdout).split("\0").filter((entry) => entry.length > 3).map((entry) => entry.slice(3))
|
|
28
|
+
} else {
|
|
29
|
+
const changed = git(["diff", "--name-only", "-z", "--relative", "HEAD", "--", ...glob])
|
|
30
|
+
const untracked = git(["ls-files", "-z", "--others", "--exclude-standard", "--", ...glob])
|
|
31
|
+
if (changed.status !== 0 || untracked.status !== 0) return []
|
|
32
|
+
found = `${changed.stdout}${untracked.stdout}`.split("\0")
|
|
33
|
+
}
|
|
34
|
+
// A removed log is not an append. A conflicted one never commits: Git refuses a commit of named paths mid-merge, and Desk refuses one on a detached HEAD.
|
|
35
|
+
return found.filter((rel) => rel !== "" && existsSync(path.join(root, rel)) && existsSync(path.join(root, path.dirname(rel), "task.md")))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Waits until no waiting log has changed for `quietMs`, at most `maxWaitMs`. `sleep` is the caller's clock. */
|
|
39
|
+
export async function settleLogs(root, { sleep, spawnGit = spawnSync, quietMs = APPEND_QUIET_MS, maxWaitMs = APPEND_MAX_WAIT_MS, now = Date.now }) {
|
|
40
|
+
const until = now() + maxWaitMs
|
|
41
|
+
for (;;) {
|
|
42
|
+
// A log removed since Git listed it has no time to wait for.
|
|
43
|
+
const times = waitingLogs(root, spawnGit).map((rel) => statSync(path.join(root, rel), { throwIfNoEntry: false })).filter(Boolean).map((stats) => stats.mtimeMs)
|
|
44
|
+
const newest = Math.max(0, ...times)
|
|
45
|
+
const wait = Math.min(newest + quietMs, until) - now()
|
|
46
|
+
if (wait <= 0) return
|
|
47
|
+
await sleep(wait)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function commitMessage(rels) {
|
|
52
|
+
return rels.length === 1 ? `task_update: log ${path.posix.dirname(rels[0]).split("/").slice(-2).join("/")}` : `task_update: log ${rels.length} cards`
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Commits every waiting log under `root` in one commit. Returns "committed", "empty", "stage_failed" or "commit_failed". Never throws. */
|
|
56
|
+
export function commitWaitingLogs(root, spawnGit = spawnSync) {
|
|
57
|
+
try {
|
|
58
|
+
const rels = waitingLogs(root, spawnGit)
|
|
59
|
+
if (rels.length === 0) return "empty"
|
|
60
|
+
if (!stagePaths(root, rels, spawnGit).ok) return "stage_failed"
|
|
61
|
+
const committed = commitPaths(root, rels, commitMessage(rels), spawnGit)
|
|
62
|
+
// A commit reported as failed or unknown may have landed (a timeout on a slow machine): when nothing at these paths is left to commit, it did.
|
|
63
|
+
if (!committed.ok && (hasUnstagedWork(root, rels, spawnGit) || stagedChanges(root, rels, spawnGit)?.length !== 0)) return "commit_failed"
|
|
64
|
+
return "committed"
|
|
65
|
+
} catch {
|
|
66
|
+
return "commit_failed"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// The one shared narrowing every failure-contract caller runs a failure's
|
|
2
|
+
// raw text through before it becomes an argument on the detached filer's own
|
|
3
|
+
// command line (spec.md §1, Part 5 fix round). A spawned process's argv is
|
|
4
|
+
// visible to every account on the machine via `ps`, a materially wider
|
|
5
|
+
// audience than the operator's own session -- so this is stricter than
|
|
6
|
+
// `util/redact.js`'s own `redactCredentialLikeText` alone: it also collapses
|
|
7
|
+
// any desk-relative path to a count (`redactDeskRelativePaths`), replaces an
|
|
8
|
+
// absolute machine or home-directory path with a fixed marker, flattens the
|
|
9
|
+
// result onto one line, and caps its length. The block Desk shows the
|
|
10
|
+
// operator (the `broke`/`means`/`tell` fields) is never passed through this
|
|
11
|
+
// -- only the text that becomes argv.
|
|
12
|
+
//
|
|
13
|
+
// This lives here, not in `util/redact.js` itself: `redact.js` is loaded on
|
|
14
|
+
// the session-start path from a minimal, hand-copied subset of this plugin
|
|
15
|
+
// (some hosts copy only `util/paths.js`, `util/startup-direction.js`,
|
|
16
|
+
// `util/redact.js` and `factory/credential.js` for one session -- see
|
|
17
|
+
// `tests/desk/mcp/__tests__/runtime/startup_direction.test.js`'s Agency-
|
|
18
|
+
// session test) that does not include the rest of `factory/`. Giving
|
|
19
|
+
// `redact.js` itself a new static import on `factory/desk-problem-template.js`
|
|
20
|
+
// broke that path even though nothing on it ever calls `argvSafeReason`,
|
|
21
|
+
// because an ES module's own static imports run at load time regardless of
|
|
22
|
+
// which export is actually used. `argvSafeReason` is only ever reached from
|
|
23
|
+
// `hooks/boot-checks.cjs` and the sync modules, which load this whole
|
|
24
|
+
// module tree from the real, complete checkout, never from that minimal copy.
|
|
25
|
+
|
|
26
|
+
import { redactDeskRelativePaths } from "../factory/desk-problem-template.js"
|
|
27
|
+
import { redactCredentialLikeText } from "../util/redact.js"
|
|
28
|
+
|
|
29
|
+
// An absolute path's own leading shape: a home-directory reference (`~` or
|
|
30
|
+
// `~/...`), a Unix path rooted at a well-known machine or user directory
|
|
31
|
+
// (`/Users/...`, `/home/...`, `/var/...`, `/tmp/...`, `/private/...`,
|
|
32
|
+
// `/mnt/...`, `/opt/...`, `/etc/...`), or a Windows drive path (`C:\...`).
|
|
33
|
+
// `redactCredentialLikeText` only catches a path segment that is itself
|
|
34
|
+
// secret-shaped, and `redactDeskRelativePaths` only catches a desk-relative
|
|
35
|
+
// path; neither touches a real machine path such as a repository checkout
|
|
36
|
+
// or a home directory, which names no secret but still names this machine
|
|
37
|
+
// and this operator's account.
|
|
38
|
+
const ABSOLUTE_PATH = /(?:~(?:[\\/][^\s"'`)\]]*)?|\/(?:Users|home|var|tmp|private|mnt|opt|etc)\/[^\s"'`)\]]*|[A-Za-z]:\\[^\s"'`)\]]*)/gu
|
|
39
|
+
const ARGV_REASON_MAX = 300
|
|
40
|
+
|
|
41
|
+
/** Credentials and absolute machine paths redacted; desk-relative paths and line breaks kept. */
|
|
42
|
+
export function redactMachineText(text) {
|
|
43
|
+
return redactCredentialLikeText(typeof text === "string" ? text : String(text ?? "")).replace(ABSOLUTE_PATH, "<redacted path>")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `argvSafeReason(text) -> string`: never throws -- a non-string input
|
|
48
|
+
* renders as its own `String(...)` form first.
|
|
49
|
+
*/
|
|
50
|
+
export function argvSafeReason(text) {
|
|
51
|
+
const raw = typeof text === "string" ? text : String(text ?? "")
|
|
52
|
+
const deskPathsCollapsed = redactDeskRelativePaths(raw)
|
|
53
|
+
const oneLine = redactMachineText(deskPathsCollapsed).replace(/\s+/gu, " ").trim()
|
|
54
|
+
return oneLine.length > ARGV_REASON_MAX ? `${oneLine.slice(0, ARGV_REASON_MAX)}…` : oneLine
|
|
55
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Runtime dependencies for session-boot.js.
|
|
2
|
+
//
|
|
3
|
+
// The Desk MCP server never runs from the bare plugin folder: it restores the
|
|
4
|
+
// plugin's shipped runtime pack into a cache folder (`bootstrap.js`) and loads
|
|
5
|
+
// its code and node_modules from there. session-boot.js runs straight from the
|
|
6
|
+
// plugin folder, where no node_modules is installed, so it needs the same
|
|
7
|
+
// dependencies (gray-matter, to read task cards' `repos:` lists) the same way:
|
|
8
|
+
// this restores the same pack into the same cache folder, with the same
|
|
9
|
+
// atomic publication, and registers the result for the card readers.
|
|
10
|
+
//
|
|
11
|
+
// It never throws: no pack for this machine, an unwritable cache or a corrupt
|
|
12
|
+
// archive leave the dependency-free reader in place, and the reason is kept
|
|
13
|
+
// for boot's pending line.
|
|
14
|
+
|
|
15
|
+
import { readFileSync } from "node:fs"
|
|
16
|
+
import { createRequire } from "node:module"
|
|
17
|
+
import * as path from "node:path"
|
|
18
|
+
import { restoreRuntimeDependencies, resolveRuntimeCacheDir } from "./bootstrap.js"
|
|
19
|
+
import { deriveRuntimeDependencyPackPaths } from "./runtime-deps.js"
|
|
20
|
+
import { setRuntimeResolver, setRuntimeResolverFailure } from "../desk/runtime-resolver.js"
|
|
21
|
+
|
|
22
|
+
function readJson(file) {
|
|
23
|
+
return JSON.parse(readFileSync(file, "utf8"))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Makes gray-matter loadable for this process. Returns `{ source }`:
|
|
28
|
+
* "installed" when it already resolves beside the plugin, "runtime-cache" when
|
|
29
|
+
* it was restored from the runtime pack, "none" (with `reason`) otherwise.
|
|
30
|
+
* Every collaborator is a test seam.
|
|
31
|
+
*/
|
|
32
|
+
export function ensureBootDependencies({
|
|
33
|
+
mcpRoot,
|
|
34
|
+
env,
|
|
35
|
+
platform = process.platform,
|
|
36
|
+
arch = process.arch,
|
|
37
|
+
nodeAbi = process.versions.modules,
|
|
38
|
+
restore = restoreRuntimeDependencies,
|
|
39
|
+
requireFrom = (file) => createRequire(file),
|
|
40
|
+
}) {
|
|
41
|
+
try {
|
|
42
|
+
requireFrom(path.join(mcpRoot, "package.json")).resolve("gray-matter")
|
|
43
|
+
return { source: "installed" }
|
|
44
|
+
} catch {
|
|
45
|
+
// Not installed beside the plugin: restore it from the runtime pack.
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const packageJson = readJson(path.join(mcpRoot, "package.json"))
|
|
49
|
+
const packageLockPath = path.join(mcpRoot, "package-lock.json")
|
|
50
|
+
const target = `${platform}-${arch}-node-${nodeAbi}`
|
|
51
|
+
const packPaths = deriveRuntimeDependencyPackPaths({
|
|
52
|
+
mcpRoot,
|
|
53
|
+
packageJson,
|
|
54
|
+
packageLock: readJson(packageLockPath),
|
|
55
|
+
platform,
|
|
56
|
+
arch,
|
|
57
|
+
nodeAbi,
|
|
58
|
+
})
|
|
59
|
+
const runtimeCacheDir = resolveRuntimeCacheDir({
|
|
60
|
+
env,
|
|
61
|
+
packageJson,
|
|
62
|
+
target,
|
|
63
|
+
prodDependencyLockHash: path.basename(packPaths.packDir),
|
|
64
|
+
})
|
|
65
|
+
restore({ mcpRoot, packageJson, packageLockPath, packPaths, runtimeCacheDir, target, platform, arch, nodeAbi })
|
|
66
|
+
const fromCache = requireFrom(path.join(runtimeCacheDir, "node_modules", "package.json"))
|
|
67
|
+
fromCache.resolve("gray-matter")
|
|
68
|
+
setRuntimeResolver((name) => fromCache(name))
|
|
69
|
+
return { source: "runtime-cache", runtimeCacheDir }
|
|
70
|
+
} catch (error) {
|
|
71
|
+
const reason = error instanceof Error ? error.message : String(error)
|
|
72
|
+
setRuntimeResolverFailure(reason)
|
|
73
|
+
return { source: "none", reason }
|
|
74
|
+
}
|
|
75
|
+
}
|