@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,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fs = require("node:fs");
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const { pathToFileURL } = require("node:url");
|
|
5
|
+
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/;
|
|
6
|
+
const SUCCESS = 'Skill "brainstorming" loaded successfully. Follow the instructions in the skill context.';
|
|
7
|
+
|
|
8
|
+
function matching(input) {
|
|
9
|
+
if (!input || typeof input !== "object" || Array.isArray(input) ||
|
|
10
|
+
["agentId", "agentType", "parentAgentId"].some(key => Object.hasOwn(input, key)) ||
|
|
11
|
+
typeof input.sessionId !== "string" || !UUID.test(input.sessionId) || !Number.isFinite(input.timestamp) ||
|
|
12
|
+
typeof input.cwd !== "string" || !path.isAbsolute(input.cwd) || input.toolName !== "skill")
|
|
13
|
+
return false;
|
|
14
|
+
let args = input.toolArgs;
|
|
15
|
+
if (typeof args === "string") {
|
|
16
|
+
try { args = JSON.parse(args); } catch { return false; }
|
|
17
|
+
}
|
|
18
|
+
const result = input.toolResult;
|
|
19
|
+
if (!(!!args && typeof args === "object" && !Array.isArray(args) && args.skill === "brainstorming" &&
|
|
20
|
+
!!result && typeof result === "object" && !Array.isArray(result) &&
|
|
21
|
+
result.resultType === "success")) return false;
|
|
22
|
+
if (Object.keys(input).sort().join(",") !== "cwd,sessionId,timestamp,toolArgs,toolName,toolResult" ||
|
|
23
|
+
Object.keys(args).join(",") !== "skill" ||
|
|
24
|
+
Object.keys(result).sort().join(",") !== "resultType,textResultForLlm" ||
|
|
25
|
+
result.textResultForLlm !== SUCCESS)
|
|
26
|
+
throw Object.assign(new Error("Send a recognized brainstorming success payload."), { code: "input_schema_changed" });
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function intakeContext(pluginRoot) {
|
|
31
|
+
const start = path.join(pluginRoot, "skills/start-task/SKILL.md");
|
|
32
|
+
const adapter = path.join(pluginRoot, "skills/using-superpowers-with-desk/SKILL.md");
|
|
33
|
+
return { additionalContext: [
|
|
34
|
+
"Desk intake handoff (context only; this grants no authority and does not attest the loaded provider):",
|
|
35
|
+
"If this is engineering work on this Desk, apply its existing intake contract before your next reply.",
|
|
36
|
+
`Read ${start}. Resolve the canonical task first: search live and archived work for the same outcome; reuse it, or create and focus the task before entering the adapter. Do not create a second task for a retry, review or continuation.`,
|
|
37
|
+
"For an unapproved new outcome, record the actual intake_proposal with task_create and present its returned alignment_packet contents together: Outcome, Assumptions, Recommended decisions and Done means. Resolve routine defaults yourself; ask only remaining human judgments in normal chat, never a form or a format-only menu.",
|
|
38
|
+
"Consume existing go and settled choices without reopening approval. Explicit instructions not to write override task capture. Do not infer go from a skill call, a success result or this context.",
|
|
39
|
+
`Then apply ${adapter}, carrying the canonical task, authority, endpoint and artifact paths. If the selected provider is already loaded, apply the handoff before its next reply without loading that skill again. Keep non-engineering conversation as conversation.`,
|
|
40
|
+
].join("\n") };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function readStdin() {
|
|
44
|
+
const chunks = [];
|
|
45
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
46
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function main() {
|
|
50
|
+
let output = {};
|
|
51
|
+
try {
|
|
52
|
+
const raw = await readStdin();
|
|
53
|
+
if (Buffer.byteLength(raw) > 262144) throw Object.assign(Error(), { code: "input_too_large" });
|
|
54
|
+
const input = JSON.parse(raw);
|
|
55
|
+
if (matching(input)) {
|
|
56
|
+
const pluginRoot = path.resolve(__dirname, "../..");
|
|
57
|
+
const { readCopilotSession } = await import(pathToFileURL(path.join(pluginRoot, "mcp/src/runtime/copilot-session.js")).href);
|
|
58
|
+
const record = readCopilotSession({ env: { ...process.env, COPILOT_AGENT_SESSION_ID: input.sessionId } });
|
|
59
|
+
if (record && record.folder === path.resolve(input.cwd)) {
|
|
60
|
+
const { selectEngineeringMethod } = await import(pathToFileURL(path.join(pluginRoot, "mcp/src/activation/validate.js")).href);
|
|
61
|
+
const activation = JSON.parse(fs.readFileSync(path.join(pluginRoot, "activation/desk.activation.json"), "utf8"));
|
|
62
|
+
const target = activation.provides.activation_targets.find(entry => entry.id === "desk:worker");
|
|
63
|
+
if (selectEngineeringMethod(target?.depends_on || []) === "superpowers")
|
|
64
|
+
output = intakeContext(pluginRoot);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
process.stderr.write("Desk intake context unavailable (" + (error.code || error.name) + "): check the hook payload and Desk install, then try again.\n");
|
|
69
|
+
}
|
|
70
|
+
process.stdout.write(JSON.stringify(output) + "\n");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = { main };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Keeps a running session on the current release. The host fixes a plugin's skills, hooks and agents when it starts, from the
|
|
4
|
+
// copy Agency made for that session (`<agency data>/plugins/sessions/agency-plugin-*/root-N/<plugin>`), while Agency's cache
|
|
5
|
+
// (`<agency data>/plugins/cache`) and Desk's own release copies (`<cache>/ouroboros-skills/desk/release-copies/<version>`) already
|
|
6
|
+
// hold the newer release. Hooks are scripts the host starts afresh for every event, so a hook can run the newer script, and a
|
|
7
|
+
// skill's text can be handed over once the agent has asked for it. Everything here is a few local reads: no network, no throw.
|
|
8
|
+
//
|
|
9
|
+
// Plain CommonJS and synchronous: a hook runs it before reading its input, and it must work on any Node that runs a hook.
|
|
10
|
+
|
|
11
|
+
const fs = require("node:fs");
|
|
12
|
+
const os = require("node:os");
|
|
13
|
+
const path = require("node:path");
|
|
14
|
+
const childProcess = require("node:child_process");
|
|
15
|
+
|
|
16
|
+
// <...>/agency-plugin-<id>[.p<pid>]/root-N/<plugin>: the layout of a session's plugin roots.
|
|
17
|
+
const SESSION_ROOT = /^(.*[\\/]agency-plugin-[^\\/]+)[\\/]root-\d+[\\/][^\\/]+$/u;
|
|
18
|
+
const PINNED = /@[0-9a-f]{40}$/u;
|
|
19
|
+
const MAX_SKILL_BYTES = 64 * 1024;
|
|
20
|
+
|
|
21
|
+
const readText = (file) => { try { return fs.readFileSync(file, "utf8"); } catch { return null; } };
|
|
22
|
+
const readJson = (file) => { try { return JSON.parse(fs.readFileSync(file, "utf8")); } catch { return null; } };
|
|
23
|
+
const list = (dir) => { try { return fs.readdirSync(dir); } catch { return []; } };
|
|
24
|
+
|
|
25
|
+
function core(version) {
|
|
26
|
+
const found = /^(\d+)\.(\d+)\.(\d+)$/u.exec(typeof version === "string" ? version.trim() : "");
|
|
27
|
+
return found === null ? null : [Number(found[1]), Number(found[2]), Number(found[3])];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Is `a` a newer plain release than `b`? A prerelease or unreadable version is never newer. */
|
|
31
|
+
function isNewer(a, b) {
|
|
32
|
+
const left = core(a);
|
|
33
|
+
const right = core(b);
|
|
34
|
+
if (left === null || right === null) return false;
|
|
35
|
+
for (let i = 0; i < 3; i += 1) if (left[i] !== right[i]) return left[i] > right[i];
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function manifest(dir) {
|
|
40
|
+
for (const file of [path.join(dir, "plugin.json"), path.join(dir, ".claude-plugin", "plugin.json")]) {
|
|
41
|
+
const found = readJson(file);
|
|
42
|
+
if (found !== null && typeof found.name === "string" && core(found.version) !== null) return { name: found.name, version: found.version.trim() };
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The session folder a plugin root belongs to, or null when it is not an Agency session copy (a source checkout never follows a cache). */
|
|
48
|
+
const sessionFolder = (pluginRoot) => (SESSION_ROOT.exec(path.resolve(pluginRoot)) ?? [])[1] ?? null;
|
|
49
|
+
|
|
50
|
+
/** The plugins this session loaded: [{ name, version, dir }]. */
|
|
51
|
+
function loadedPlugins(session) {
|
|
52
|
+
const out = [];
|
|
53
|
+
for (const root of list(session).filter((entry) => /^root-\d+$/u.test(entry))) {
|
|
54
|
+
for (const plugin of list(path.join(session, root))) {
|
|
55
|
+
const dir = path.join(session, root, plugin);
|
|
56
|
+
const found = manifest(dir);
|
|
57
|
+
if (found !== null) out.push({ ...found, dir });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function releaseCopiesDir(env, home) {
|
|
64
|
+
const cacheHome = typeof env.XDG_CACHE_HOME === "string" && env.XDG_CACHE_HOME.trim() !== "" ? env.XDG_CACHE_HOME : path.join(env.HOME || home, ".cache");
|
|
65
|
+
return path.join(cacheHome, "ouroboros-skills", "desk", "release-copies");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Every release of plugin `name` on disk beyond the session copy: Agency's unpinned cache entries and, for Desk, Desk's complete release copies. */
|
|
69
|
+
function releasesOf({ name, session, env, home }) {
|
|
70
|
+
const found = [];
|
|
71
|
+
const cache = path.join(path.dirname(path.dirname(session)), "cache");
|
|
72
|
+
const entries = readJson(path.join(cache, "cache_index.json"))?.entries;
|
|
73
|
+
// Only this plugin's entries are worth a manifest read: a hook runs on every event.
|
|
74
|
+
const wanted = new RegExp(`[:/]${name.replace(/[^\w-]/gu, "\\$&")}@`, "u");
|
|
75
|
+
for (const entry of Object.values(entries && typeof entries === "object" ? entries : {})) {
|
|
76
|
+
if (typeof entry?.spec !== "string" || !wanted.test(entry.spec) || PINNED.test(entry.spec) || typeof entry.dir_name !== "string" || !/^[\w.-]+$/u.test(entry.dir_name)) continue;
|
|
77
|
+
const dir = path.join(cache, "entries", entry.dir_name);
|
|
78
|
+
const there = manifest(dir);
|
|
79
|
+
if (there !== null && there.name === name) found.push({ ...there, dir });
|
|
80
|
+
}
|
|
81
|
+
if (name === "desk") {
|
|
82
|
+
const copies = releaseCopiesDir(env, home);
|
|
83
|
+
for (const version of list(copies)) {
|
|
84
|
+
const dir = path.join(copies, version);
|
|
85
|
+
if (!fs.existsSync(path.join(dir, ".complete.json"))) continue;
|
|
86
|
+
const there = manifest(dir);
|
|
87
|
+
if (there !== null) found.push({ ...there, dir });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return found;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The newest release of plugin `name` that is newer than `loaded` and passes `usable(dir)`, or null. The first of equal versions wins. */
|
|
94
|
+
function newestBeyond({ name, loaded, session, env, home, usable }) {
|
|
95
|
+
let best = null;
|
|
96
|
+
for (const release of releasesOf({ name, session, env, home })) {
|
|
97
|
+
if (!isNewer(release.version, loaded) || !usable(release.dir)) continue;
|
|
98
|
+
if (best === null || isNewer(release.version, best.version)) best = release;
|
|
99
|
+
}
|
|
100
|
+
return best;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The newest Desk release beyond the copy at `pluginRoot` that has the hook script `hookFile`, or null. */
|
|
104
|
+
function currentDesk({ pluginRoot, hookFile, env = process.env, home = os.homedir() }) {
|
|
105
|
+
const session = sessionFolder(pluginRoot);
|
|
106
|
+
const own = manifest(pluginRoot);
|
|
107
|
+
if (session === null || own === null) return null;
|
|
108
|
+
return newestBeyond({ name: "desk", loaded: own.version, session, env, home, usable: (dir) => fs.existsSync(path.join(dir, "hooks", hookFile)) });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Runs `file` (a hook entry script) from the newest Desk release on disk, with this process's input, output and arguments, and
|
|
113
|
+
* returns true when it did; the caller then returns. False means nothing ran, and the caller runs its own copy. Off with
|
|
114
|
+
* `DESK_HOOKS_CURRENT=0`.
|
|
115
|
+
*/
|
|
116
|
+
function delegate(file) {
|
|
117
|
+
try {
|
|
118
|
+
if (process.env.DESK_HOOK_DELEGATED === "1" || String(process.env.DESK_HOOKS_CURRENT ?? "").trim() === "0") return false;
|
|
119
|
+
const pluginRoot = path.resolve(path.dirname(file), "..");
|
|
120
|
+
const hookFile = path.basename(file);
|
|
121
|
+
const current = currentDesk({ pluginRoot, hookFile });
|
|
122
|
+
if (current === null) return false;
|
|
123
|
+
const env = { ...process.env, DESK_HOOK_DELEGATED: "1" };
|
|
124
|
+
for (const name of ["PLUGIN_ROOT", "CLAUDE_PLUGIN_ROOT", "COPILOT_PLUGIN_ROOT", "DESK_PLUGIN_ROOT"]) if (typeof env[name] === "string" && env[name] !== "") env[name] = current.dir;
|
|
125
|
+
const ran = childProcess.spawnSync(process.execPath, [path.join(current.dir, "hooks", hookFile), ...process.argv.slice(2)], { stdio: "inherit", env, windowsHide: true });
|
|
126
|
+
if (ran.error) return false;
|
|
127
|
+
process.exitCode = ran.status === null ? 1 : ran.status;
|
|
128
|
+
return true;
|
|
129
|
+
} catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* When the skill the agent just loaded has newer text in a newer release of its plugin, the context that gives it: the current text
|
|
136
|
+
* and where that release's docs are. Null when nothing newer differs. `name` may be `plugin:skill`.
|
|
137
|
+
*/
|
|
138
|
+
function currentSkill({ pluginRoot, name, env = process.env, home = os.homedir() }) {
|
|
139
|
+
const session = sessionFolder(pluginRoot);
|
|
140
|
+
if (session === null || typeof name !== "string") return null;
|
|
141
|
+
const [plugin, skill] = name.includes(":") ? [name.slice(0, name.indexOf(":")), name.slice(name.indexOf(":") + 1)] : [null, name];
|
|
142
|
+
if (!/^[\w.-]+$/u.test(skill)) return null;
|
|
143
|
+
for (const loaded of loadedPlugins(session)) {
|
|
144
|
+
if (plugin !== null && plugin !== loaded.name) continue;
|
|
145
|
+
const before = readText(path.join(loaded.dir, "skills", skill, "SKILL.md"));
|
|
146
|
+
if (before === null) continue;
|
|
147
|
+
const release = newestBeyond({ name: loaded.name, loaded: loaded.version, session, env, home, usable: (dir) => readText(path.join(dir, "skills", skill, "SKILL.md")) !== null });
|
|
148
|
+
if (release === null) continue;
|
|
149
|
+
const after = readText(path.join(release.dir, "skills", skill, "SKILL.md"));
|
|
150
|
+
if (after === before) continue;
|
|
151
|
+
const text = Buffer.byteLength(after) > MAX_SKILL_BYTES ? `(too long to repeat here; read ${path.join(release.dir, "skills", skill, "SKILL.md")})` : after;
|
|
152
|
+
return [
|
|
153
|
+
`The ${loaded.name} skill "${skill}" has a newer release (${release.version}) than the copy this session loaded (${loaded.version}), and its text changed, so the text the skill tool just returned is out of date.`,
|
|
154
|
+
`Follow this current text instead. Anything it points to under the plugin folder (docs, references) is in ${release.dir}; read it there, not in ${loaded.dir}.`,
|
|
155
|
+
"",
|
|
156
|
+
text,
|
|
157
|
+
].join("\n");
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = { currentSkill, delegate };
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// A reply check, not a second task lifecycle. Native Desk receipts are read
|
|
4
|
+
// only in this human turn; no transcript, packet or correction state is saved.
|
|
5
|
+
// Host decision contracts: docs.github.com/en/copilot/reference/hooks-reference
|
|
6
|
+
// and code.claude.com/docs/en/hooks#stop. The native active flag is a ceiling,
|
|
7
|
+
// not permission to consume the hosts' larger runaway-continuation budget.
|
|
8
|
+
const fs = require("node:fs");
|
|
9
|
+
const path = require("node:path");
|
|
10
|
+
const { createInterface } = require("node:readline");
|
|
11
|
+
const TAG = "[DESK_DELIVERY_CORRECTION]";
|
|
12
|
+
const MAX_BYTES = 64 * 1024 * 1024;
|
|
13
|
+
const MAX_LINE = 2 * 1024 * 1024;
|
|
14
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
15
|
+
const DESK = /^(?:desk-|mcp__[^ ]*desk[^ ]*__)(task_create|task_focus|task_update|task_archive|task_signoff)$/u;
|
|
16
|
+
const INTAKE_FIELDS = ["outcome", "assumptions", "recommended_decisions", "completion_checks"];
|
|
17
|
+
const text = value => typeof value === "string";
|
|
18
|
+
const plain = value => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
19
|
+
function clean(value, intake = false) {
|
|
20
|
+
const code = [];
|
|
21
|
+
// Escape native NULs before reserving local tokens: human text cannot
|
|
22
|
+
// impersonate a token. Restore code only after prose presentation folding.
|
|
23
|
+
let rendered = value.replace(/\0/gu, "\0\0")
|
|
24
|
+
.replace(/(?<!`)(`+)(?!`)([\s\S]*?)\1(?!`)/gu, (_, delimiter, content) => `\0c${code.push(content) - 1}\0`)
|
|
25
|
+
.replace(/(\*\*|__)(.+?)\1/gu, "$2");
|
|
26
|
+
if (intake) rendered = rendered
|
|
27
|
+
.replace(/(?<!\w)\*([^*\n]+)\*(?!\w)/gu, "$1").replace(/(?<!\w)_([^_\n]+)_(?!\w)/gu, "$1")
|
|
28
|
+
.replace(/^[ \t]*(?:#{1,6}|[-*])\s+/gmu, "").replace(/\s+/gu, " ");
|
|
29
|
+
return rendered.trim().replace(/\0(?:\0|c(\d+)\0)/gu, (_, index) =>
|
|
30
|
+
index === undefined ? "\0" : code[Number(index)].replace(/\0\0/gu, "\0"));
|
|
31
|
+
}
|
|
32
|
+
function proofIn(line, ref) {
|
|
33
|
+
const proof = ref.trim();
|
|
34
|
+
if (/^[0-9a-f]{7,40}$/iu.test(proof)) {
|
|
35
|
+
return (clean(line).match(/\b[0-9a-f]{7,40}\b/giu) ?? []).some(x => x.length <= proof.length && proof.toLowerCase().startsWith(x.toLowerCase()));
|
|
36
|
+
}
|
|
37
|
+
return line.includes(proof);
|
|
38
|
+
}
|
|
39
|
+
function packetOf(value) {
|
|
40
|
+
if (!plain(value) || value.signoff !== "delivered_unsigned") return null;
|
|
41
|
+
const p = value.signoff_packet;
|
|
42
|
+
return Array.isArray(p) && p.length === 3 && p.every(x => text(x) && x.length <= 2000 && !/[\r\n]/u.test(x))
|
|
43
|
+
&& /^Asked: \S/u.test(p[0]) && /^Delivered: \S/u.test(p[1]) && p[2] === "Accept or send back?" ? p : null;
|
|
44
|
+
}
|
|
45
|
+
function intakeOf(value, call) {
|
|
46
|
+
const p = value.alignment_packet;
|
|
47
|
+
const context = value.work_context;
|
|
48
|
+
if (call.kind !== "task_create" || call.focus !== true || value.status !== "created"
|
|
49
|
+
|| (call.status && call.status !== "drafting") || call.planningComplete
|
|
50
|
+
|| !plain(context) || context.status !== "drafting" || context.planning_complete !== false
|
|
51
|
+
|| !plain(p) || p.kind !== "intake_proposal" || p.boundary !== "awaiting_intake"
|
|
52
|
+
|| p.authority !== "unknown" || p.task !== call.target || !plain(p.parts) || !plain(call.proposal)
|
|
53
|
+
|| Object.keys(p.parts).length !== INTAKE_FIELDS.length
|
|
54
|
+
|| INTAKE_FIELDS.some(key => !text(p.parts[key]) || !p.parts[key].trim()
|
|
55
|
+
|| p.parts[key].length > 2000 || p.parts[key].includes("\0")
|
|
56
|
+
|| !text(call.proposal[key]) || p.parts[key] !== call.proposal[key].trim())) return null;
|
|
57
|
+
return p.parts;
|
|
58
|
+
}
|
|
59
|
+
function hasIntake(reply, parts) {
|
|
60
|
+
if (!text(reply)) return false;
|
|
61
|
+
const fold = value => clean(value, true);
|
|
62
|
+
const body = fold(reply);
|
|
63
|
+
let after = 0;
|
|
64
|
+
return INTAKE_FIELDS.every(key => {
|
|
65
|
+
const value = fold(parts[key]);
|
|
66
|
+
const at = body.indexOf(value, after);
|
|
67
|
+
if (at < 0) return false;
|
|
68
|
+
after = at + value.length;
|
|
69
|
+
return true;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function hasEnding(reply, packets) {
|
|
73
|
+
if (!text(reply)) return false;
|
|
74
|
+
const lines = reply.split(/\r?\n/u).map(x => x.trim()).filter(Boolean);
|
|
75
|
+
const tail = lines.slice(-packets.length * 3);
|
|
76
|
+
return tail.length === packets.length * 3 && packets.every((p, i) =>
|
|
77
|
+
/^Asked:\s*\S/u.test(clean(tail[i * 3])) && /^Delivered:\s*\S/u.test(clean(tail[i * 3 + 1]))
|
|
78
|
+
&& proofIn(tail[i * 3 + 1], p[1].slice("Delivered: ".length)) && clean(tail[i * 3 + 2]) === "Accept or send back?");
|
|
79
|
+
}
|
|
80
|
+
function resultOf(content) {
|
|
81
|
+
if (plain(content)) return content;
|
|
82
|
+
if (Array.isArray(content)) content = content.filter(x => x?.type === "text").map(x => x.text).join("");
|
|
83
|
+
if (!text(content) || content.length > 65536) return null;
|
|
84
|
+
try { return JSON.parse(content); } catch { return null; }
|
|
85
|
+
}
|
|
86
|
+
function targetOf(args) {
|
|
87
|
+
// Native CRUD owns name/path validation, including legacy read identities.
|
|
88
|
+
// These opaque IDs only pair in-memory receipts; they never form a file path.
|
|
89
|
+
return plain(args) && [args.track, args.slug].every(x => text(x) && x.length > 0 && x.length <= 4096 && !/[\r\n]/u.test(x))
|
|
90
|
+
? `${args.track}/${args.slug}` : null;
|
|
91
|
+
}
|
|
92
|
+
const failure = reason => ({ status: "unavailable", diagnostic: reason });
|
|
93
|
+
function state() {
|
|
94
|
+
return { calls: new Map(), packets: new Map(), intakes: new Map(), unavailableIntake: new Set(), housekeepingErrors: new Set(), execution: new Set(), delivered: new Set(), sentCurrent: false, human: null,
|
|
95
|
+
corrected: false, interrupted: false, rollover: false, envelope: false, final: null, currentHook: null };
|
|
96
|
+
}
|
|
97
|
+
function reset(s, human) {
|
|
98
|
+
s.calls.clear(); s.packets.clear(); s.intakes.clear(); s.unavailableIntake.clear(); s.housekeepingErrors.clear(); s.sentCurrent = false;
|
|
99
|
+
s.human = human; s.corrected = false; s.interrupted = false; s.rollover = false; s.final = null;
|
|
100
|
+
}
|
|
101
|
+
function receipt(s, call, value) {
|
|
102
|
+
if (!call || !value) return;
|
|
103
|
+
if (["read", "other", "housekeeping"].includes(call.kind)) return;
|
|
104
|
+
if (call.kind === "task_focus") {
|
|
105
|
+
if (call.clear && value.status === "cleared") { s.intakes.clear(); s.unavailableIntake.clear(); return; }
|
|
106
|
+
if (value.status !== "focused" || `${value.track}/${value.slug}` !== call.target) return;
|
|
107
|
+
const execution = value.planning_complete === true || (value.task_status && value.task_status !== "drafting")
|
|
108
|
+
|| (Array.isArray(value.recent_progress) && value.recent_progress.some(x => text(x) && x.trim()));
|
|
109
|
+
if (execution || (!(s.intakes.has(call.target) || s.unavailableIntake.has(call.target)))) {
|
|
110
|
+
s.intakes.clear(); s.unavailableIntake.clear();
|
|
111
|
+
}
|
|
112
|
+
if (execution) s.execution.add(call.target);
|
|
113
|
+
if (["blocked", "collaborating", "paused"].includes(value.task_status)) s.interrupted = true;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (call.kind === "task_create" && call.focus === true && value.status === "created") {
|
|
117
|
+
s.intakes.clear(); s.unavailableIntake.clear();
|
|
118
|
+
}
|
|
119
|
+
if (["blocked", "collaborating", "paused"].includes(call.status)) s.interrupted = true;
|
|
120
|
+
// Existing recorded execution excludes intake; it never proves a human
|
|
121
|
+
// agreement. Keep that conservative exclusion across real human turns.
|
|
122
|
+
if (call.planningComplete || value.work_context?.planning_complete === true
|
|
123
|
+
|| (call.status && call.status !== "drafting")
|
|
124
|
+
|| (value.work_context?.status && value.work_context.status !== "drafting")) s.execution.add(call.target);
|
|
125
|
+
if (s.execution.has(call.target) || call.kind !== "task_create") {
|
|
126
|
+
s.intakes.delete(call.target); s.unavailableIntake.delete(call.target);
|
|
127
|
+
}
|
|
128
|
+
if (call.kind === "task_create") {
|
|
129
|
+
const proposal = intakeOf(value, call);
|
|
130
|
+
if (proposal && !s.execution.has(call.target)) {
|
|
131
|
+
s.intakes.clear(); s.intakes.set(call.target, proposal);
|
|
132
|
+
s.unavailableIntake.clear();
|
|
133
|
+
} else if (!s.execution.has(call.target) && call.focus === true
|
|
134
|
+
&& value.alignment_packet_unavailable === "proposal_not_supplied") {
|
|
135
|
+
s.unavailableIntake.add(call.target);
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (call.kind === "task_signoff" || (call.kind === "task_update" && call.status && call.status !== "done")) {
|
|
140
|
+
if (call.kind === "task_update" || value.signoff?.state === "refused") {
|
|
141
|
+
for (const key of s.delivered) if (key.startsWith(`${call.target}\n`)) s.delivered.delete(key);
|
|
142
|
+
}
|
|
143
|
+
s.packets.delete(call.target); return;
|
|
144
|
+
}
|
|
145
|
+
const packet = packetOf(value);
|
|
146
|
+
if (!packet) {
|
|
147
|
+
// A newer native observation without unsigned evidence cannot keep an older
|
|
148
|
+
// packet authoritative (accepted/cancelled/returned or no longer evidenced).
|
|
149
|
+
s.packets.delete(call.target); return;
|
|
150
|
+
}
|
|
151
|
+
const key = `${call.target}\n${packet.join("\n")}`;
|
|
152
|
+
if (!s.delivered.has(key)) s.packets.set(call.target, { packet, key });
|
|
153
|
+
}
|
|
154
|
+
function reply(s, content) {
|
|
155
|
+
if (!text(content) || !content.trim()) return;
|
|
156
|
+
s.final = content;
|
|
157
|
+
for (const [target, parts] of s.intakes) if (hasIntake(content, parts)) {
|
|
158
|
+
s.intakes.delete(target); s.sentCurrent = true;
|
|
159
|
+
}
|
|
160
|
+
if (s.packets.size && hasEnding(content, [...s.packets.values()].map(x => x.packet))) {
|
|
161
|
+
for (const held of s.packets.values()) s.delivered.add(held.key);
|
|
162
|
+
s.sentCurrent = true;
|
|
163
|
+
s.packets.clear(); return;
|
|
164
|
+
}
|
|
165
|
+
for (const [target, held] of s.packets) {
|
|
166
|
+
if (hasEnding(content, [held.packet])) {
|
|
167
|
+
s.delivered.add(held.key); s.sentCurrent = true; s.packets.delete(target);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function callOf(name, args) {
|
|
172
|
+
if (["view", "Read"].includes(name)) return { kind: "read" };
|
|
173
|
+
if (text(name) && /^(?:desk-|mcp__[^ ]*desk[^ ]*__)desk_save$/u.test(name)) return { kind: "housekeeping", name };
|
|
174
|
+
const match = text(name) ? DESK.exec(name) : null;
|
|
175
|
+
const target = targetOf(args);
|
|
176
|
+
if (match?.[1] === "task_focus" && plain(args) && args.clear === true) return { kind: "task_focus", clear: true, target: null };
|
|
177
|
+
return match && target ? { kind: match[1], target, status: args.status ?? args.frontmatter?.status,
|
|
178
|
+
focus: args.focus, planningComplete: args.planning_complete === true || args.frontmatter?.planning_complete === true,
|
|
179
|
+
proposal: args.intake_proposal } : text(name) ? { kind: "other" } : null;
|
|
180
|
+
}
|
|
181
|
+
function outcome(s, call, failed, value) {
|
|
182
|
+
// Never infer recovery from prose. Only a paired read has no mutation
|
|
183
|
+
// authority; a failed housekeeping save remains pending until this owning
|
|
184
|
+
// turn receives the same tool's actual committed receipt. Unpaired/unknown
|
|
185
|
+
// failures, other operations and lifecycle failures remain exclusions.
|
|
186
|
+
if (!failed) {
|
|
187
|
+
if (call?.kind === "housekeeping" && value?.status === "committed") s.housekeepingErrors.delete(call.name);
|
|
188
|
+
receipt(s, call, value);
|
|
189
|
+
} else {
|
|
190
|
+
if (call?.kind === "read") return;
|
|
191
|
+
if (call?.kind === "housekeeping") s.housekeepingErrors.add(call.name);
|
|
192
|
+
else s.interrupted = true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function copilot(s, e, payload) {
|
|
196
|
+
const d = e.data ?? {};
|
|
197
|
+
if (e.agentId || d.agentId || d.parentToolCallId) return;
|
|
198
|
+
if (e.type === "session.start" || e.type === "session.resume") {
|
|
199
|
+
reset(s, null);
|
|
200
|
+
s.envelope = d.sessionId === payload.sessionId && d.context?.cwd === payload.cwd;
|
|
201
|
+
}
|
|
202
|
+
if (e.type === "session.context_cleared" && s.human) s.rollover = true;
|
|
203
|
+
if (e.type === "user.message") {
|
|
204
|
+
// Native memory rollover changes the primary interaction, not the owning
|
|
205
|
+
// human turn. Keep receipt/interrupt/correction state; summary prose cannot
|
|
206
|
+
// grant new authority or spend a correction from an older quoted marker.
|
|
207
|
+
if (s.rollover && d.source === "session-memory-rollover" && text(d.interactionId)) {
|
|
208
|
+
s.human = d.interactionId; s.rollover = false; s.final = null;
|
|
209
|
+
} else if (text(d.content) && d.content.includes(TAG)) {
|
|
210
|
+
s.corrected = true;
|
|
211
|
+
if (text(d.interactionId)) s.human = d.interactionId;
|
|
212
|
+
} else if (!d.source && !d.isAutopilotContinuation && text(d.content) && text(d.interactionId)) reset(s, d.interactionId);
|
|
213
|
+
}
|
|
214
|
+
if (!s.human) return;
|
|
215
|
+
if (e.type === "abort" || e.type === "session.error" || e.type === "session.shutdown") s.interrupted = true;
|
|
216
|
+
if (e.type === "tool.execution_start") {
|
|
217
|
+
const call = callOf(d.toolName, d.arguments);
|
|
218
|
+
if (call) s.calls.set(d.toolCallId, call);
|
|
219
|
+
}
|
|
220
|
+
if (e.type === "tool.execution_complete") {
|
|
221
|
+
const call = s.calls.get(d.toolCallId); s.calls.delete(d.toolCallId);
|
|
222
|
+
if (d.interactionId === s.human) {
|
|
223
|
+
if (d.success === true || d.success === false) outcome(s, call, d.success === false || d.result?.isError === true, resultOf(d.result?.content));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (e.type === "assistant.message" && d.interactionId === s.human && !d.toolRequests?.length) reply(s, d.content);
|
|
227
|
+
if (e.type === "hook.end" && d.hookType === "agentStop" && d.output?.decision === "block" && text(d.output.reason) && d.output.reason.includes(TAG)) s.corrected = true;
|
|
228
|
+
if (e.type === "hook.start" && d.hookType === "agentStop" && d.input?.timestamp === payload.timestamp && d.input?.sessionId === payload.sessionId) {
|
|
229
|
+
s.currentHook = e.parentId;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function claude(s, e, payload) {
|
|
233
|
+
if (e.isSidechain || e.agentId) return;
|
|
234
|
+
if (e.sessionId && e.sessionId !== payload.session_id) return;
|
|
235
|
+
if (e.cwd === payload.cwd && e.sessionId === payload.session_id) s.envelope = true;
|
|
236
|
+
const blocks = e.message?.content;
|
|
237
|
+
const content = text(blocks) ? blocks : Array.isArray(blocks) ? blocks.filter(x => x?.type === "text" && text(x.text)).map(x => x.text).join("\n") : "";
|
|
238
|
+
if (e.type === "user") {
|
|
239
|
+
if (content.includes(TAG) && (e.isMeta || e.promptSource === "system" || e.origin?.kind === "system")) s.corrected = true;
|
|
240
|
+
else if (!e.isMeta && !e.isCompactSummary && !["system", "sdk"].includes(e.promptSource)
|
|
241
|
+
&& !Object.hasOwn(e, "scheduledTaskId") && !Object.hasOwn(e, "scheduledFireId")
|
|
242
|
+
&& (!Object.hasOwn(e, "turnOrigin") || e.turnOrigin === "human") && e.origin?.kind === "human"
|
|
243
|
+
&& (text(blocks) || Array.isArray(blocks) && blocks.some(x => ["text", "image"].includes(x?.type)))) reset(s, "human");
|
|
244
|
+
if (content.startsWith("[Request interrupted by user")) s.interrupted = true;
|
|
245
|
+
}
|
|
246
|
+
if (!s.human) return;
|
|
247
|
+
if (e.type === "system" && ["error", "api_error", "stop_hook_error"].includes(e.subtype)) {
|
|
248
|
+
if (text(e.content) && e.content.includes(TAG)) s.corrected = true;
|
|
249
|
+
else s.interrupted = true;
|
|
250
|
+
}
|
|
251
|
+
if (e.toolUseResult?.interrupted || e.toolUseResult?.timedOutAfterMs || e.message?.stop_reason === "refusal") s.interrupted = true;
|
|
252
|
+
if (e.type === "assistant" && Array.isArray(blocks)) {
|
|
253
|
+
for (const block of blocks) if (block.type === "tool_use") {
|
|
254
|
+
const call = callOf(block.name, block.input);
|
|
255
|
+
if (call) s.calls.set(block.id, call);
|
|
256
|
+
}
|
|
257
|
+
if (["end_turn", "stop_sequence"].includes(e.message.stop_reason)) reply(s, blocks.filter(x => x.type === "text").map(x => x.text).join("\n"));
|
|
258
|
+
}
|
|
259
|
+
if (e.type === "user" && Array.isArray(blocks)) for (const block of blocks) {
|
|
260
|
+
if (block.type === "text" && text(block.text) && block.text.includes(TAG)) s.corrected = true;
|
|
261
|
+
if (block.type !== "tool_result") continue;
|
|
262
|
+
const call = s.calls.get(block.tool_use_id); s.calls.delete(block.tool_use_id);
|
|
263
|
+
outcome(s, call, block.is_error === true, resultOf(block.content));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async function checkDelivery({ host, payload, env = process.env }) {
|
|
267
|
+
if (!plain(payload) || !["copilot", "claude"].includes(host)) return { status: "excluded" };
|
|
268
|
+
if (env.DESK_FACTORY_HEADLESS && env.DESK_FACTORY_HEADLESS !== "0") return { status: "excluded" };
|
|
269
|
+
if (payload.agentId || payload.agent_id || payload.agent_transcript_path || payload.parent_thread_id || payload.error) return { status: "excluded" };
|
|
270
|
+
if (host === "copilot" ? payload.stopReason !== "end_turn" || payload.reason : payload.hook_event_name !== "Stop" || (payload.stop_reason && payload.stop_reason !== "end_turn")) return { status: "excluded" };
|
|
271
|
+
const id = host === "copilot" ? payload.sessionId : payload.session_id;
|
|
272
|
+
const log = host === "copilot" ? payload.transcriptPath : payload.transcript_path;
|
|
273
|
+
if (!UUID.test(id ?? "") || !text(log) || !path.isAbsolute(log) || !text(payload.cwd) || !path.isAbsolute(payload.cwd)) return failure("invalid_identity");
|
|
274
|
+
const home = host === "copilot" ? env.COPILOT_HOME || path.join(env.HOME || "", ".copilot") : path.join(env.CLAUDE_CONFIG_DIR || path.join(env.HOME || "", ".claude"), "projects");
|
|
275
|
+
const expected = host === "copilot" ? path.join(home, "session-state", id, "events.jsonl") : null;
|
|
276
|
+
if (expected ? path.resolve(log) !== path.resolve(expected) : !path.resolve(log).startsWith(path.resolve(home) + path.sep) || path.basename(log) !== `${id}.jsonl`) return failure("foreign_transcript");
|
|
277
|
+
const until = host === "copilot" ? payload.timestamp : Date.now();
|
|
278
|
+
if (!Number.isSafeInteger(until) || until < 0) return failure("invalid_timestamp");
|
|
279
|
+
const s = state();
|
|
280
|
+
let bytes = 0, lastId = null, finalEndId = null;
|
|
281
|
+
try {
|
|
282
|
+
const stat = await fs.promises.lstat(log);
|
|
283
|
+
if (!stat.isFile() || stat.size > MAX_BYTES) return failure("transcript_limit");
|
|
284
|
+
// Resolve the actual file as well as its lexical path: a foreign symlink is not an admitted transcript.
|
|
285
|
+
const actual = await fs.promises.realpath(log);
|
|
286
|
+
const admitted = await fs.promises.realpath(home);
|
|
287
|
+
if (!actual.startsWith(admitted + path.sep)) return failure("foreign_transcript");
|
|
288
|
+
const stream = fs.createReadStream(log);
|
|
289
|
+
const lines = createInterface({ input: stream, crlfDelay: Infinity });
|
|
290
|
+
try {
|
|
291
|
+
for await (const line of lines) {
|
|
292
|
+
bytes += Buffer.byteLength(line) + 1;
|
|
293
|
+
if (bytes > MAX_BYTES || Buffer.byteLength(line) > MAX_LINE) return failure("transcript_limit");
|
|
294
|
+
if (!line.trim()) continue;
|
|
295
|
+
let e; try { e = JSON.parse(line); } catch { return failure("transcript_unreadable"); }
|
|
296
|
+
const time = Date.parse(e.timestamp);
|
|
297
|
+
if (!Number.isFinite(time)) return failure("transcript_timestamp");
|
|
298
|
+
if (time > until) continue;
|
|
299
|
+
if (host === "copilot") {
|
|
300
|
+
copilot(s, e, payload);
|
|
301
|
+
if (e.type === "assistant.turn_end" && e.parentId === lastId) finalEndId = e.id;
|
|
302
|
+
if (e.type === "assistant.message" && e.data?.interactionId === s.human && text(e.data?.content) && !e.data?.toolRequests?.length) lastId = e.id;
|
|
303
|
+
} else claude(s, e, payload);
|
|
304
|
+
}
|
|
305
|
+
} finally { lines.close(); stream.destroy(); }
|
|
306
|
+
} catch { return failure("transcript_unreadable"); }
|
|
307
|
+
if (!s.envelope) return failure("foreign_session");
|
|
308
|
+
if (!s.human || s.interrupted || s.housekeepingErrors.size) return { status: "not_delivery" };
|
|
309
|
+
if (!s.packets.size && !s.intakes.size && s.unavailableIntake.size) return failure("intake_packet_unavailable");
|
|
310
|
+
if (s.packets.size === 0 && s.intakes.size === 0) return { status: s.sentCurrent ? "complete" : "not_delivery" };
|
|
311
|
+
if (host === "copilot" && (!s.currentHook || s.currentHook !== finalEndId)) return { status: "not_delivery" };
|
|
312
|
+
const packets = [...s.packets.values()].map(x => x.packet);
|
|
313
|
+
// Claude explicitly supplies this field because final transcript persistence can lag Stop.
|
|
314
|
+
const final = host === "claude" ? payload.last_assistant_message : s.final;
|
|
315
|
+
if (!text(final)) return failure("final_reply_unavailable");
|
|
316
|
+
const intakes = [...s.intakes.values()];
|
|
317
|
+
if ((!packets.length || hasEnding(final, packets)) && intakes.every(parts => hasIntake(final, parts))) return { status: "complete" };
|
|
318
|
+
if (payload.stop_hook_active === true || s.corrected) return { status: "unverified", diagnostic: "correction_exhausted" };
|
|
319
|
+
const intakeText = intakes.map(parts => INTAKE_FIELDS.map((key, i) =>
|
|
320
|
+
`${["Outcome", "Assumptions", "Recommended decisions", "Completion checks"][i]}: ${parts[key]}`).join("\n\n")).join("\n\n");
|
|
321
|
+
return { status: "correction", output: { decision: "block", reason:
|
|
322
|
+
intakes.length
|
|
323
|
+
? `Restate only this existing proposal. ${TAG} Copy all four field contents below VERBATIM: do not paraphrase, shorten, or replace clauses. Retain existing proof${packets.length ? " and end with the existing delivery packet" : ""}. Human approval classification is unknown; do not assert Go is absent or reopen it. No tools, new questions, approval waits, implementation, review, commits, external effects or acceptance inference. This is the only correction; continue no further work.\n\n${intakeText}${packets.length ? "\n\n" + packets.flat().join("\n") : ""}`
|
|
324
|
+
: `Restate only the final delivery reply. ${TAG} End it with the existing packet below, retaining its evidence. Do not rerun completed implementation, call task/card tools, create a commit, reopen approval, infer acceptance, or repeat external effects. This is the only correction; continue no further work.\n\n${packets.flat().join("\n")}` } };
|
|
325
|
+
}
|
|
326
|
+
module.exports = { checkDelivery };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
// Session-end hooks hand their work to a detached copy of themselves and exit. On a loaded machine starting Node, loading
|
|
6
|
+
// Desk's modules and running Git can take longer than the host's hook timeout (3 s on Copilot), and nothing the host does
|
|
7
|
+
// with the hook's result depends on that work.
|
|
8
|
+
const WRITE_WAIT_MS = 1000;
|
|
9
|
+
// A detached worker that hangs would outlive the session unseen, so it stops itself after this long.
|
|
10
|
+
const WORKER_LIMIT_MS = 60_000;
|
|
11
|
+
|
|
12
|
+
/** Starts `node entry ...args` detached with `payload` as its stdin; resolves `true` once the payload is handed over. Never throws. */
|
|
13
|
+
function startDetached(entry, args, payload, { env = process.env, waitMs = WRITE_WAIT_MS } = {}) {
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
let child;
|
|
16
|
+
try {
|
|
17
|
+
child = spawn(process.execPath, [entry, ...args], { detached: true, stdio: ["pipe", "ignore", "ignore"], windowsHide: true, env });
|
|
18
|
+
} catch {
|
|
19
|
+
resolve(false);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let settled = false;
|
|
23
|
+
const done = (ok) => {
|
|
24
|
+
if (settled) return;
|
|
25
|
+
settled = true;
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
child.stdin.destroy();
|
|
28
|
+
child.unref();
|
|
29
|
+
resolve(ok);
|
|
30
|
+
};
|
|
31
|
+
const timer = setTimeout(() => done(false), waitMs);
|
|
32
|
+
child.once("error", () => done(false));
|
|
33
|
+
child.stdin.on("error", () => done(false));
|
|
34
|
+
child.stdin.end(JSON.stringify(payload), () => done(true));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Called first in a detached worker: ends the process after `WORKER_LIMIT_MS` whatever it is doing. */
|
|
39
|
+
function limitWorker(ms = WORKER_LIMIT_MS) {
|
|
40
|
+
setTimeout(() => process.exit(0), ms).unref();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = { startDetached, limitWorker };
|