@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,368 @@
|
|
|
1
|
+
// The factory's local status: what desk_status, desk_doctor and the task
|
|
2
|
+
// tools need to know about the bound desk's store, read synchronously from
|
|
3
|
+
// bounded local state and never written.
|
|
4
|
+
//
|
|
5
|
+
// `factoryLocalStatus({ env, deskRoot, pluginDirs, pluginScanIncomplete })`
|
|
6
|
+
// resolves the desk's store exactly as the end hook and the boot check do
|
|
7
|
+
// (`resolveStore`; an incomplete plugin scan holds routing unless the desk
|
|
8
|
+
// declares its own store) and returns:
|
|
9
|
+
//
|
|
10
|
+
// {
|
|
11
|
+
// store: "<owner/repo>" | null,
|
|
12
|
+
// source: "desk" | "overlay" | "default" | "invalid_declaration" | "plugin_scan_incomplete" | "no_desk",
|
|
13
|
+
// consent: "yes" | "no" | "undecided" | "unreadable" | "held",
|
|
14
|
+
// stores: [{ store, consent, pending, route_changed, quarantined, last_flush }],
|
|
15
|
+
// warnings: ["manifest_unreadable" | "manifest_unparseable", ...],
|
|
16
|
+
// }
|
|
17
|
+
//
|
|
18
|
+
// `consent` is the resolved store's decision; `held` means no store is
|
|
19
|
+
// resolved, so nothing is asked and nothing is sent. `stores` lists the
|
|
20
|
+
// resolved store first, then every other store with a recorded decision,
|
|
21
|
+
// sorted. `pending` counts the store's outbox files never delivered and not
|
|
22
|
+
// quarantined whose session the flush would publish there (`here`, or
|
|
23
|
+
// `unknown`, waiting for its route); `route_changed` counts its outbox files
|
|
24
|
+
// and kept copies (`retracted-copies/`), not quarantined, whose session routes
|
|
25
|
+
// elsewhere as the flush reads it (`session-route.js`: `away`, including a
|
|
26
|
+
// finished retraction's tombstone, `stale` or `stalled`; a copy without a
|
|
27
|
+
// positive route here and no checked route here is `stale`): the flush never publishes them there; `quarantined`
|
|
28
|
+
// counts its quarantined files; `last_flush` is the last flush's result
|
|
29
|
+
// code, or `null`.
|
|
30
|
+
//
|
|
31
|
+
// `visibility_unasked` is present only when a store's flushes have held sessions back, unable to ask their desk's visibility, for over 7 days:
|
|
32
|
+
// `[{ store, sessions }]` (the last flush records `visibility_unasked` and `visibility_unasked_since`).
|
|
33
|
+
// `orphans` is present only when the orphan pass (`derive-run.js` `rebuildOrphans`) needs attention: `"pass_failed"` (the last pass threw),
|
|
34
|
+
// `"pass_interrupted"` (a record with a start older than `ORPHAN_INTERRUPTED_MS`, or with a start that does not parse, and no result),
|
|
35
|
+
// `"orphans_hung"` (an orphan was interrupted twice and is frozen; `orphans_hung` then counts them), `"pass_stale"` (the last pass ran more than
|
|
36
|
+
// `ORPHAN_STALE_MS` ago) or `"walk_not_advancing"` (`sweeps_in_walk` is past `ceil((worked + unexamined) / max(1, worked))`, `worked` counting only
|
|
37
|
+
// the orphans that took a transcript slot, so the walk should have wrapped). `orphanPassLine(record, now)` is the one-line
|
|
38
|
+
// reading `factory.js status` prints; both read counts, times and fixed codes only.
|
|
39
|
+
// `retention` is present only when a pruning part stopped (`retention.js` `retentionFinding`): `"prune_failed"` (the last sweep's tombstone
|
|
40
|
+
// pruning failed) or `"copies_prune_failed"` (the last orphan pass counted a delivered-copy prune that threw). `capture_check_unavailable` is
|
|
41
|
+
// present only when a store's own capture check could not read the record `CHECK_UNAVAILABLE_ALARM` (3) or more times in a row:
|
|
42
|
+
// `[{ store, times }]`. `capture_dropped` is present when a record dropped from a rebuilt intake branch was still not sent six hours later: `[{ store, since }]`. `coverage_kept` is present when the coverage pass was kept back for a quarantine that did not settle within an hour and was recorded anyway: `{ since }`. Like `orphans`, all are pushed to the doctor and the boot status, not only shown by `factory.js status`.
|
|
43
|
+
//
|
|
44
|
+
// The result carries store names, codes and counts only: never the machine
|
|
45
|
+
// secret, an account, an intake ID, a token or any content, and no local
|
|
46
|
+
// path or time except where a held route needs one to be fixed. Manifest
|
|
47
|
+
// warnings keep their codes and drop their paths. `held_by` (this desk's
|
|
48
|
+
// route is held now), `route_holds` (`{ count, reasons }`: the sessions the
|
|
49
|
+
// last sweep counted as held, `held-route.js` `routeHolds`) and
|
|
50
|
+
// `held_pruned` (`{ count, last_at }`: held sessions pruned uncaptured after
|
|
51
|
+
// 90 days) name each hold's reason, the manifest or plugin folder to fix
|
|
52
|
+
// (`path`, or `null` when the hook named none) and its remedy, so a hold is
|
|
53
|
+
// never silent; the doctor and the boot print them.
|
|
54
|
+
//
|
|
55
|
+
// `factoryReportLink({ env, deskRoot, deskRemote, personPrefix, track, slug,
|
|
56
|
+
// pluginDirs, pluginScanIncomplete })` is the task card's `factory_report`
|
|
57
|
+
// link, `{ link }`, when the resolved store has consent `contribute: true`
|
|
58
|
+
// and the desk is known to be private: its cached visibility is `private` or
|
|
59
|
+
// `internal`, so the store publishes the plain job ID the link names. Any
|
|
60
|
+
// other contributing desk gets `{ link: null, reason }`: `desk_not_private`
|
|
61
|
+
// (a public or unknown desk, or one with no GitHub remote: its store job is
|
|
62
|
+
// keyed so that nobody can tie the desk's public cards to it, and a link
|
|
63
|
+
// would make that tie) or `visibility_not_known` (a GitHub desk whose cached
|
|
64
|
+
// answer is expired, absent or unreadable). Without consent it is
|
|
65
|
+
// `{ link: null }` with no reason: the factory is not in use for this desk.
|
|
66
|
+
// A link names the job's report path; the report exists only once the store
|
|
67
|
+
// has merged facts for the job and rebuilt its reports, so a job never
|
|
68
|
+
// credited with a session has none.
|
|
69
|
+
//
|
|
70
|
+
// `src/factory/**` imports only `node:` built-ins and other `src/factory/`
|
|
71
|
+
// files.
|
|
72
|
+
|
|
73
|
+
import { readdirSync, statSync } from "node:fs"
|
|
74
|
+
import * as path from "node:path"
|
|
75
|
+
import { deskVersion } from "../package-metadata.js"
|
|
76
|
+
|
|
77
|
+
import { consentDecision, consentRecords as readConsentRecords, factoryStateDir } from "./boot-check.js"
|
|
78
|
+
import { jobId } from "./binding.js"
|
|
79
|
+
import { deskTimingKept, deskVisibilityOf, freshVisibility, githubRepoOfRemote, visibilityMap } from "./desk-visibility.js"
|
|
80
|
+
import { readSmallText, validMarker } from "./marker.js"
|
|
81
|
+
import { jobReportUrl } from "./pipeline/build.js"
|
|
82
|
+
import { ENUMS, PATTERNS, isPlainObject } from "./schema.js"
|
|
83
|
+
import { captureCheckFindings, captureDroppedFindings, coverageKeptFinding, retentionFinding } from "./retention.js"
|
|
84
|
+
import { HOLD_REMEDIES, holdReason } from "./held-route.js"
|
|
85
|
+
import { RETRACTED_COPIES, derivedStoreOf, deskRootOf, isFolder, sessionPlace, sessionRoute } from "./session-route.js"
|
|
86
|
+
import { resolveStore } from "./store-route.js"
|
|
87
|
+
|
|
88
|
+
const STATE_BYTES = 8 * 1024 * 1024
|
|
89
|
+
const MAX_ENTRIES = 4096
|
|
90
|
+
const OUTBOX_NAME = new RegExp(`^(?:${ENUMS.host.join("|")})-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.json$`, "u")
|
|
91
|
+
const RESULT_CODE = /^[a-z][a-z0-9_]{0,63}$/u
|
|
92
|
+
const UNREADABLE = Symbol("unreadable")
|
|
93
|
+
// The places whose files the flush never publishes to the store they sit in (`session-route.js`).
|
|
94
|
+
const ELSEWHERE = new Set(["away", "stale", "stalled"])
|
|
95
|
+
|
|
96
|
+
/** A JSON object state file: `fallback` when absent, `UNREADABLE` when unsafe, unreadable or not an object (as the boot check reads it). */
|
|
97
|
+
function readState(file, fallback) {
|
|
98
|
+
let text
|
|
99
|
+
try {
|
|
100
|
+
text = readSmallText(file, STATE_BYTES)
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return error.code === "ENOENT" ? fallback : UNREADABLE
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const value = JSON.parse(text)
|
|
106
|
+
return isPlainObject(value) ? value : UNREADABLE
|
|
107
|
+
} catch {
|
|
108
|
+
return UNREADABLE
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** How long a pass may run before a record with a start and no result reads as interrupted: past the 150 s the start hook allows. */
|
|
113
|
+
export const ORPHAN_INTERRUPTED_MS = 5 * 60 * 1000
|
|
114
|
+
/** How long since the last pass ran before the doctor reports it: the pass runs at every session start. */
|
|
115
|
+
export const ORPHAN_STALE_MS = 2 * 24 * 60 * 60 * 1000
|
|
116
|
+
/** Interrupted passes that freeze an orphan (`derive-run.js` `ORPHAN_HUNG_STRIKES`; the status code stays in `src/factory/`). */
|
|
117
|
+
const HUNG_STRIKES = 2
|
|
118
|
+
|
|
119
|
+
const finiteCount = (value) => (Number.isSafeInteger(value) && value >= 0 ? value : null)
|
|
120
|
+
|
|
121
|
+
/** The version of Desk running this code, or `null` (`package-metadata.js`'s one resolver). */
|
|
122
|
+
export const ownVersion = () => deskVersion()
|
|
123
|
+
|
|
124
|
+
/** How many orphans the record holds frozen by repeated interruptions (two strikes) under Desk `version` (a newer Desk starts the count again), or 0. */
|
|
125
|
+
export function orphansHung(record, version) {
|
|
126
|
+
if (!isPlainObject(record) || !isPlainObject(record.hung) || typeof version !== "string") return 0
|
|
127
|
+
return Object.values(record.hung).filter((entry) => isPlainObject(entry) && entry.version === version && Number.isSafeInteger(entry.strikes) && entry.strikes >= HUNG_STRIKES).length
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* What is wrong with the orphan pass's record, or `null`: see the header. `now` is milliseconds; `version` is the running Desk's (hung strikes of
|
|
132
|
+
* another version do not count); `active` is whether this machine ended a session in the last `ORPHAN_STALE_MS` (a machine that stopped
|
|
133
|
+
* contributing is not alarmed that the pass has not run).
|
|
134
|
+
*/
|
|
135
|
+
export function orphanPassFinding(record, now = Date.now(), { version = null, active = false } = {}) {
|
|
136
|
+
if (!isPlainObject(record)) return null
|
|
137
|
+
if (record.failed !== undefined) return "pass_failed"
|
|
138
|
+
// A start time that does not parse is never "running".
|
|
139
|
+
if (record.ran_at === undefined) return now - Date.parse(record.started_at) <= ORPHAN_INTERRUPTED_MS ? null : "pass_interrupted"
|
|
140
|
+
if (orphansHung(record, version) > 0) return "orphans_hung"
|
|
141
|
+
if (active && now - Date.parse(record.ran_at) > ORPHAN_STALE_MS) return "pass_stale"
|
|
142
|
+
// `worked` is the orphans that took a transcript slot (a record from before it counted `examined`, which includes cheaply frozen ones).
|
|
143
|
+
const worked = finiteCount(record.worked) ?? finiteCount(record.examined)
|
|
144
|
+
const unexamined = finiteCount(record.unexamined)
|
|
145
|
+
const sweeps = finiteCount(record.sweeps_in_walk)
|
|
146
|
+
if (worked === null || unexamined === null || sweeps === null) return null
|
|
147
|
+
return sweeps > Math.ceil((worked + unexamined) / Math.max(1, worked)) ? "walk_not_advancing" : null
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Whether any marker on this machine records a session that ended within `ORPHAN_STALE_MS`. */
|
|
151
|
+
function endedSessionRecently(dir, now = Date.now()) {
|
|
152
|
+
return outboxNames(path.join(dir, "markers")).some((name) => {
|
|
153
|
+
const marker = readState(path.join(dir, "markers", name), null)
|
|
154
|
+
return validMarker(marker) && typeof marker.ended_at === "string" && now - Date.parse(marker.ended_at) <= ORPHAN_STALE_MS
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** How long a desk's visibility may go unasked (every flush deferring its sessions) before the doctor reports it. */
|
|
159
|
+
export const UNASKED_REPORT_MS = 7 * 24 * 60 * 60 * 1000
|
|
160
|
+
|
|
161
|
+
/** `[{ store, sessions, age? }]` (`age: "unknown"` when the start time does not parse) for each store whose last flush has held sessions back for want of a visibility answer for longer than `UNASKED_REPORT_MS`. */
|
|
162
|
+
export function visibilityUnasked(lastFlush, stores, now = Date.now()) {
|
|
163
|
+
if (!isPlainObject(lastFlush)) return []
|
|
164
|
+
return stores.flatMap((store) => {
|
|
165
|
+
const entry = lastFlush[store]
|
|
166
|
+
if (!isPlainObject(entry) || !Number.isSafeInteger(entry.visibility_unasked) || entry.visibility_unasked <= 0) return []
|
|
167
|
+
const age = now - Date.parse(entry.visibility_unasked_since)
|
|
168
|
+
// A start time that does not parse is a deferral of unknown age, reported, never ignored.
|
|
169
|
+
if (Number.isNaN(age)) return [{ store, sessions: entry.visibility_unasked, age: "unknown" }]
|
|
170
|
+
return age > UNASKED_REPORT_MS ? [{ store, sessions: entry.visibility_unasked }] : []
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** One sentence saying what to do about sessions held back for want of a visibility answer. */
|
|
175
|
+
export const UNASKED_ADVICE = (store) => `Run \`node mcp/scripts/factory.js flush --store ${store}\` from the Desk plugin folder and read its result; if it keeps failing, file a Desk problem.`
|
|
176
|
+
|
|
177
|
+
/** One sentence saying what to do about a finding. */
|
|
178
|
+
export const ORPHAN_FINDING_ADVICE = "Run `node mcp/scripts/factory.js status` from the Desk plugin folder and read its orphan_pass line; if the pass keeps failing or stalling, file a Desk problem."
|
|
179
|
+
|
|
180
|
+
/** One sentence saying what to do about a retention finding. */
|
|
181
|
+
export const RETENTION_FINDING_ADVICE = "Run `node mcp/scripts/factory.js status` from the Desk plugin folder and read its retention line; if pruning keeps failing, file a Desk problem."
|
|
182
|
+
|
|
183
|
+
/** One sentence saying what to do about a store whose own capture check keeps failing. */
|
|
184
|
+
export const CAPTURE_CHECK_ADVICE = (store) => `The store's own check, not this machine, is failing: file a problem against ${store}'s capture check, and run \`node mcp/scripts/factory.js status\` from the Desk plugin folder to see its capture line.`
|
|
185
|
+
|
|
186
|
+
/** One line for the orphan pass's record: counts, times and fixed codes only (a failure is its class, never a message). */
|
|
187
|
+
export function orphanPassLine(record, now = Date.now(), { version = null } = {}) {
|
|
188
|
+
if (!isPlainObject(record)) return "orphan pass: no record yet"
|
|
189
|
+
const wrap = typeof record.last_wrap_at === "string" ? record.last_wrap_at : "never"
|
|
190
|
+
if (record.failed !== undefined) return `orphan pass: failed (${typeof record.failed === "string" && RESULT_CODE.test(record.failed) ? record.failed : "unknown"}), last full walk ${wrap}`
|
|
191
|
+
if (record.ran_at === undefined) return `orphan pass: ${orphanPassFinding(record, now, { version }) === null ? "running" : "interrupted"}, started ${typeof record.started_at === "string" ? record.started_at : "unknown"}, last full walk ${wrap}`
|
|
192
|
+
const frozen = isPlainObject(record.frozen) ? Object.values(record.frozen).reduce((sum, count) => sum + (finiteCount(count) ?? 0), 0) : 0
|
|
193
|
+
const count = (value) => finiteCount(value) ?? "unknown"
|
|
194
|
+
const hung = orphansHung(record, version)
|
|
195
|
+
return `orphan pass: ran ${record.ran_at}, examined ${count(record.examined)}, unexamined ${count(record.unexamined)}, pending ${count(record.pending)}, frozen ${frozen}${hung > 0 ? ` (${hung} hung)` : ""}, last full walk ${wrap}, ${count(record.sweeps_in_walk)} sweeps into the walk`
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function outboxNames(dir) {
|
|
199
|
+
try {
|
|
200
|
+
return readdirSync(dir, { withFileTypes: true }).slice(0, MAX_ENTRIES).filter((entry) => entry.isFile() && OUTBOX_NAME.test(entry.name)).map((entry) => entry.name)
|
|
201
|
+
} catch {
|
|
202
|
+
return []
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** The recorded consent map, `{}` when nothing is decided, or `UNREADABLE`; read exactly as the boot check reads it. */
|
|
207
|
+
function consentRecords(dir) {
|
|
208
|
+
return readConsentRecords(dir) ?? UNREADABLE
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function decision(records, store) {
|
|
212
|
+
return consentDecision(records === UNREADABLE ? null : records, store)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function route({ deskRoot, pluginDirs, pluginScanIncomplete }) {
|
|
216
|
+
if (typeof deskRoot !== "string" || !path.isAbsolute(deskRoot)) return { store: null, source: "no_desk", warnings: [] }
|
|
217
|
+
const resolved = resolveStore({ deskRoot, pluginDirs, read: (file) => readSmallText(file) })
|
|
218
|
+
// As in the end hook and the boot check: an incomplete scan may have missed an overlay's declaration.
|
|
219
|
+
if (resolved.store !== null && pluginScanIncomplete && resolved.source !== "desk") return { store: null, source: "plugin_scan_incomplete", warnings: resolved.warnings }
|
|
220
|
+
return resolved
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Where an outbox file's session routes now, for `store`, read from the markers and receipts the flush reads (`session-route.js`).
|
|
224
|
+
// A marker that is missing, unreadable or malformed says nothing new, as `listMarkers` drops it for the flush.
|
|
225
|
+
function placer(dir, receipts) {
|
|
226
|
+
const markerOf = (name) => {
|
|
227
|
+
const marker = readState(path.join(dir, "markers", name), null)
|
|
228
|
+
return validMarker(marker) && `${marker.host}-${marker.session_id}.json` === name ? marker : null
|
|
229
|
+
}
|
|
230
|
+
let siblings = null
|
|
231
|
+
const listSiblings = () => (siblings ??= outboxNames(path.join(dir, "markers")).map(markerOf).filter((marker) => marker !== null))
|
|
232
|
+
// `retracting` is the store's retracting records and tombstones, by name. A session whose recorded desk folder no longer resolves is here
|
|
233
|
+
// only on a positive route, as the flush reads it. Returns `{ place, positive }`.
|
|
234
|
+
return (store, name, retracting) => {
|
|
235
|
+
// An outbox name, like a labels key, ends in the 36-character session id and `.json`.
|
|
236
|
+
const session = name.slice(-41, -5)
|
|
237
|
+
const names = ENUMS.host.map((host) => `${host}-${session}.json`)
|
|
238
|
+
const marker = names.map(markerOf).find((found) => found !== null) ?? null
|
|
239
|
+
const records = Object.entries(retracting).filter(([key, record]) => key.slice(-41, -5) === session && isPlainObject(record)).map(([, record]) => record)
|
|
240
|
+
const deskRoot = deskRootOf(receipts, names)
|
|
241
|
+
const route = sessionRoute(marker, { siblings: listSiblings, deskRoot })
|
|
242
|
+
const place = sessionPlace(store, route, derivedStoreOf(receipts, names), records)
|
|
243
|
+
const recorded = [marker?.desk_root, deskRoot].filter((root) => typeof root === "string")
|
|
244
|
+
const gone = recorded.length > 0 && !recorded.some(isFolder)
|
|
245
|
+
return { place: place === "here" && route.kind !== "store" && gone ? "stale" : place, positive: route.kind === "store" }
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function storeEntry(dir, consents, store, lastFlush, place, now) {
|
|
250
|
+
const slug = store.replace("/", "__")
|
|
251
|
+
const delivered = readState(path.join(dir, "delivered", `${slug}.json`), {})
|
|
252
|
+
const quarantined = new Set(outboxNames(path.join(dir, "quarantine", slug)))
|
|
253
|
+
const retracting = readState(path.join(dir, "retracting", `${slug}.json`), {})
|
|
254
|
+
// The kept copies of sessions that left the store (`session-route.js`) count with the outbox files: they are what `route_changed` reports.
|
|
255
|
+
const records = retracting === UNREADABLE ? {} : retracting
|
|
256
|
+
const live = new Set(outboxNames(path.join(dir, "outbox", slug)))
|
|
257
|
+
const keptDir = path.join(dir, RETRACTED_COPIES, slug)
|
|
258
|
+
const kept = outboxNames(keptDir).filter((name) => !live.has(name))
|
|
259
|
+
const listed = [...new Set([...live, ...kept])].filter((name) => !quarantined.has(name))
|
|
260
|
+
const away = new Set(listed.filter((name) => ELSEWHERE.has(place(store, name, records).place)))
|
|
261
|
+
// Kept copies with no positive route anywhere that are not here on a checked route are frozen (never published, never deleted): counted, with
|
|
262
|
+
// the oldest one's age.
|
|
263
|
+
const frozen = kept.filter((name) => { const { place: where, positive } = place(store, name, records); return !positive && where !== "here" })
|
|
264
|
+
const ages = frozen.map((name) => keptAgeDays(path.join(keptDir, name), now)).filter((days) => days !== null)
|
|
265
|
+
const pending = listed.filter((name) => !away.has(name) && (delivered === UNREADABLE || !Object.hasOwn(delivered, name))).length
|
|
266
|
+
const flush = isPlainObject(lastFlush) && isPlainObject(lastFlush[store]) ? lastFlush[store].result : null
|
|
267
|
+
const waiting = isPlainObject(lastFlush) && isPlainObject(lastFlush[store]) && Number.isSafeInteger(lastFlush[store].visibility_unasked) ? lastFlush[store].visibility_unasked : 0
|
|
268
|
+
const frozenFields = frozen.length > 0 ? { kept_frozen: frozen.length, kept_frozen_oldest_days: ages.length > 0 ? Math.max(...ages) : null } : {}
|
|
269
|
+
return { store, consent: decision(consents, store), pending, ...(waiting > 0 ? { waiting_for_visibility: waiting } : {}), route_changed: away.size, quarantined: quarantined.size, ...frozenFields, last_flush: typeof flush === "string" && RESULT_CODE.test(flush) ? flush : null }
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// A kept copy's age in whole days from its file's time, or null when it cannot be read.
|
|
273
|
+
function keptAgeDays(file, now) {
|
|
274
|
+
try {
|
|
275
|
+
return Math.max(0, Math.floor((now - statSync(file).mtimeMs) / (24 * 60 * 60 * 1000)))
|
|
276
|
+
} catch {
|
|
277
|
+
return null
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** See the header. Never writes and never throws for missing or unreadable state. */
|
|
282
|
+
export function factoryLocalStatus({ env, deskRoot, pluginDirs = [], pluginScanIncomplete = false, pluginScanReason = null }) {
|
|
283
|
+
const routing = route({ deskRoot, pluginDirs, pluginScanIncomplete })
|
|
284
|
+
const dir = factoryStateDir(env)
|
|
285
|
+
const records = consentRecords(dir)
|
|
286
|
+
const status = readState(path.join(dir, "status.json"), {})
|
|
287
|
+
const lastFlush = status === UNREADABLE ? null : status.last_flush
|
|
288
|
+
const place = placer(dir, status === UNREADABLE ? {} : status.derivations)
|
|
289
|
+
const decided = records === UNREADABLE ? [] : Object.keys(records).filter((store) => PATTERNS.prRepo.test(store)).sort()
|
|
290
|
+
const stores = [...new Set([...(routing.store === null ? [] : [routing.store]), ...decided])]
|
|
291
|
+
const version = ownVersion()
|
|
292
|
+
// Contribution must be switched on for a stale pass to mean anything: a machine that wrote markers but never opted in has no pass to run.
|
|
293
|
+
const contributing = stores.some((store) => decision(records, store) === "yes")
|
|
294
|
+
const orphans = status === UNREADABLE ? null : orphanPassFinding(status.orphans, Date.now(), { version, active: contributing && endedSessionRecently(dir) })
|
|
295
|
+
const unasked = visibilityUnasked(lastFlush, stores)
|
|
296
|
+
const hung = status === UNREADABLE ? 0 : orphansHung(status.orphans, version)
|
|
297
|
+
const retention = status === UNREADABLE ? null : retentionFinding(status)
|
|
298
|
+
// Only a store this machine still contributes to: a count left from before consent was withdrawn never settles, so it is no finding.
|
|
299
|
+
const captureCheck = status === UNREADABLE ? [] : captureCheckFindings(status).filter(({ store }) => PATTERNS.prRepo.test(store) && decision(records, store) === "yes")
|
|
300
|
+
const captureDropped = status === UNREADABLE ? [] : captureDroppedFindings(status, Date.now()).filter(({ store }) => PATTERNS.prRepo.test(store) && decision(records, store) === "yes")
|
|
301
|
+
const coverageKept = status === UNREADABLE ? null : coverageKeptFinding(status)
|
|
302
|
+
return {
|
|
303
|
+
store: routing.store,
|
|
304
|
+
source: routing.source,
|
|
305
|
+
consent: routing.store === null ? "held" : decision(records, routing.store),
|
|
306
|
+
stores: stores.map((store) => storeEntry(dir, records, store, lastFlush, place, Date.now())),
|
|
307
|
+
warnings: [...new Set(routing.warnings.map((warning) => warning.code))].sort(),
|
|
308
|
+
...(orphans === null ? {} : { orphans }),
|
|
309
|
+
...(unasked.length > 0 ? { visibility_unasked: unasked } : {}),
|
|
310
|
+
...(hung > 0 ? { orphans_hung: hung } : {}),
|
|
311
|
+
...(retention === null ? {} : { retention }),
|
|
312
|
+
...(captureCheck.length > 0 ? { capture_check_unavailable: captureCheck } : {}),
|
|
313
|
+
...(captureDropped.length > 0 ? { capture_dropped: captureDropped } : {}),
|
|
314
|
+
...(coverageKept === null ? {} : { coverage_kept: coverageKept }),
|
|
315
|
+
...heldFields(routing, pluginScanReason, status === UNREADABLE ? {} : status),
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const HELD_PRUNED_SHOWN_MS = 30 * 24 * 60 * 60 * 1000
|
|
320
|
+
const described = (reason, file) => ({ reason, path: file, remedy: HOLD_REMEDIES[reason] })
|
|
321
|
+
|
|
322
|
+
// What holds routes, with the paths to fix and the remedy (`held-route.js`): this desk's own route now (`held_by`), the sessions the last sweep
|
|
323
|
+
// counted as held (`route_holds`), and the held sessions pruned uncaptured (`held_pruned`). Present only when there is something to say.
|
|
324
|
+
function heldFields(routing, scanReason, status) {
|
|
325
|
+
const fields = {}
|
|
326
|
+
if (routing.store === null && routing.warnings.length > 0) fields.held_by = routing.warnings.map(({ code, manifest }) => described(holdReason(manifest, { code }), manifest))
|
|
327
|
+
else if (routing.source === "plugin_scan_incomplete") fields.held_by = [described(Object.hasOwn(HOLD_REMEDIES, scanReason ?? "") ? scanReason : "plugin_scan_incomplete", null)]
|
|
328
|
+
const holds = status.route_holds
|
|
329
|
+
if (isPlainObject(holds) && Number.isSafeInteger(holds.count) && holds.count > 0 && Array.isArray(holds.reasons)) {
|
|
330
|
+
const reasons = holds.reasons.filter((entry) => isPlainObject(entry) && (entry.path === null || typeof entry.path === "string") && Number.isSafeInteger(entry.sessions))
|
|
331
|
+
fields.route_holds = { count: holds.count, reasons: reasons.map((entry) => ({ ...described(holdReason(entry.path, { code: entry.code }), entry.path), sessions: entry.sessions })) }
|
|
332
|
+
}
|
|
333
|
+
const sessions = status.held_sessions
|
|
334
|
+
if (isPlainObject(sessions) && Array.isArray(sessions.groups)) {
|
|
335
|
+
const groups = sessions.groups.filter((group) => isPlainObject(group) && typeof group.route === "string" && typeof group.reason === "string" && Number.isSafeInteger(group.sessions) && group.sessions > 0 && typeof group.oldest_at === "string")
|
|
336
|
+
if (groups.length > 0) fields.held_groups = groups.map(({ route, reason, sessions: count, oldest_at: oldest }) => ({ route, reason, sessions: count, oldest_at: oldest }))
|
|
337
|
+
}
|
|
338
|
+
const pruned = status.held_pruned
|
|
339
|
+
// Said for 30 days after the last such prune: long enough to be read, never a standing line.
|
|
340
|
+
const recent = isPlainObject(pruned) && Date.now() - Date.parse(pruned.last_at) <= HELD_PRUNED_SHOWN_MS
|
|
341
|
+
if (recent && Number.isSafeInteger(pruned.count) && pruned.count > 0) fields.held_pruned = { count: pruned.count, last_at: pruned.last_at }
|
|
342
|
+
return fields
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* The job ID a task card may link for plain job ID `job` of the desk at `deskRemote`, read from this machine's factory state without creating
|
|
347
|
+
* anything: `{ job }` for a desk whose cached visibility is `private` or `internal`, else `{ job: null, reason }` with `visibility_not_known`
|
|
348
|
+
* (a GitHub desk whose cached answer is expired, absent or unreadable) or `desk_not_private` (any other desk). See the header.
|
|
349
|
+
*/
|
|
350
|
+
export function publishedJobId({ env, deskRemote, job, now = Date.now() }) {
|
|
351
|
+
const repo = githubRepoOfRemote(deskRemote)
|
|
352
|
+
if (repo === null) return { job: null, reason: "desk_not_private" }
|
|
353
|
+
const cached = readState(path.join(factoryStateDir(env), "visibility.json"), {})
|
|
354
|
+
const known = cached === UNREADABLE ? new Map() : visibilityMap(freshVisibility(cached, now))
|
|
355
|
+
if (!known.has(repo.toLowerCase())) return { job: null, reason: "visibility_not_known" }
|
|
356
|
+
return deskTimingKept(deskVisibilityOf(repo, known)) ? { job } : { job: null, reason: "desk_not_private" }
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* See the header: `{ link }`, the task card's `factory_report` link; `{ link: null, reason }` when the desk contributes but no link can be
|
|
361
|
+
* named; `{ link: null }` when the resolved store has no consent `contribute: true`, so the factory is not in use for this desk.
|
|
362
|
+
*/
|
|
363
|
+
export function factoryReportLink({ env, deskRoot, deskRemote, personPrefix, track, slug, pluginDirs = [], pluginScanIncomplete = false }) {
|
|
364
|
+
const routing = route({ deskRoot, pluginDirs, pluginScanIncomplete })
|
|
365
|
+
if (routing.store === null || decision(consentRecords(factoryStateDir(env)), routing.store) !== "yes") return { link: null }
|
|
366
|
+
const { job, reason } = publishedJobId({ env, deskRemote, job: jobId({ deskRemote, personPrefix, track, slug }) })
|
|
367
|
+
return job === null ? { link: null, reason } : { link: jobReportUrl({ store: routing.store, job }) }
|
|
368
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// The loop's conditions record. For each improvement-card key `<source>:<id>` it keeps, in `status.json` under
|
|
2
|
+
// `loop.conditions`, whether the condition held at the last successful observation and how many counted
|
|
3
|
+
// observations in a row found it clear. The route collectors write it; the measure and verify steps read it,
|
|
4
|
+
// so "the condition was false at 2 consecutive measures" is stated once. A missing or damaged entry reads as
|
|
5
|
+
// unavailable, never as clear, and an observation that could not be made is never recorded. Keys are the card
|
|
6
|
+
// library's own, so nothing but a well-formed key enters, and no free text is stored.
|
|
7
|
+
|
|
8
|
+
import { SOURCES, cardKey } from "../desk/improvement-cards.js"
|
|
9
|
+
import { PATTERNS } from "./schema.js"
|
|
10
|
+
import { isHeadlessFactorySession } from "./headless-flag.js"
|
|
11
|
+
import { updateStatus } from "./outbox.js"
|
|
12
|
+
|
|
13
|
+
/** The shortest time between two observations of a source that both count as a clear run, in hours. Two looks closer together are one look. */
|
|
14
|
+
export const MIN_OBSERVATION_GAP_HOURS = 6
|
|
15
|
+
|
|
16
|
+
/** The most keys kept. Over it, keys that are not present go first (damaged, then the longest since observed, then the fewest clear runs); a present key is never dropped. */
|
|
17
|
+
export const MAX_CONDITIONS = 500
|
|
18
|
+
|
|
19
|
+
const HOUR_MS = 3600 * 1000
|
|
20
|
+
|
|
21
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value)
|
|
22
|
+
const timeOf = (value) => (typeof value === "string" && PATTERNS.timestamp.test(value) ? Date.parse(value) : Number.NaN)
|
|
23
|
+
|
|
24
|
+
const isValidEntry = (entry) =>
|
|
25
|
+
isObject(entry) &&
|
|
26
|
+
typeof entry.present === "boolean" &&
|
|
27
|
+
Number.isSafeInteger(entry.clear_runs) && entry.clear_runs >= 0 &&
|
|
28
|
+
!(entry.present && entry.clear_runs !== 0) &&
|
|
29
|
+
!Number.isNaN(timeOf(entry.observed_at))
|
|
30
|
+
|
|
31
|
+
/** `conditionOf(status, key) -> { state: "measured", present, clear_runs, observed_at } | { state: "unavailable", reason: "not_observed" | "damaged" }`. */
|
|
32
|
+
export function conditionOf(status, key) {
|
|
33
|
+
const conditions = isObject(status?.loop) ? status.loop.conditions : undefined
|
|
34
|
+
if (conditions === undefined) return { state: "unavailable", reason: "not_observed" }
|
|
35
|
+
if (!isObject(conditions)) return { state: "unavailable", reason: "damaged" }
|
|
36
|
+
if (!Object.hasOwn(conditions, key)) return { state: "unavailable", reason: "not_observed" }
|
|
37
|
+
const entry = conditions[key]
|
|
38
|
+
if (!isValidEntry(entry)) return { state: "unavailable", reason: "damaged" }
|
|
39
|
+
return { state: "measured", present: entry.present, clear_runs: entry.clear_runs, observed_at: entry.observed_at }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function wellFormedKeys(source, present) {
|
|
43
|
+
const keys = new Set()
|
|
44
|
+
for (const id of present) {
|
|
45
|
+
try {
|
|
46
|
+
if (typeof id !== "string") return null
|
|
47
|
+
keys.add(cardKey(source, id))
|
|
48
|
+
} catch {
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return keys
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Drops keys over the bound, worst first; present keys are kept even when they alone exceed it. */
|
|
56
|
+
function bounded(conditions) {
|
|
57
|
+
const keys = Object.keys(conditions)
|
|
58
|
+
let over = keys.length - MAX_CONDITIONS
|
|
59
|
+
if (over <= 0) return conditions
|
|
60
|
+
const rank = (key) => {
|
|
61
|
+
const entry = conditions[key]
|
|
62
|
+
if (!isValidEntry(entry)) return [0, 0, 0]
|
|
63
|
+
return entry.present ? null : [1, timeOf(entry.observed_at), entry.clear_runs]
|
|
64
|
+
}
|
|
65
|
+
const droppable = keys.map((key) => ({ key, rank: rank(key) })).filter((item) => item.rank !== null)
|
|
66
|
+
droppable.sort((a, b) => a.rank[0] - b.rank[0] || a.rank[1] - b.rank[1] || a.rank[2] - b.rank[2])
|
|
67
|
+
const kept = { ...conditions }
|
|
68
|
+
for (const { key } of droppable) {
|
|
69
|
+
if (over-- <= 0) break
|
|
70
|
+
delete kept[key]
|
|
71
|
+
}
|
|
72
|
+
return kept
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* `observeConditions(env, { source, present, now, updateStatusImpl }) -> { ok, result }`: records one successful observation of `source`.
|
|
77
|
+
* `present` is every id of that source whose condition holds right now. A key in `present` is recorded as present with 0 clear runs; every other
|
|
78
|
+
* key of the source already recorded is recorded as not present with one more clear run, unless the last counted look at it was less than
|
|
79
|
+
* `MIN_OBSERVATION_GAP_HOURS` ago (then it is not counted again). A damaged entry of an absent key is left as it is, so it never reads as clear.
|
|
80
|
+
* A collector that could not look must not call this. Results: `observed`, `observed_within_gap` (ok); `headless_session`, `invalid_source`,
|
|
81
|
+
* `invalid_present`, `invalid_key`, `invalid_time`, `status_unwritable` (not ok, nothing written).
|
|
82
|
+
*/
|
|
83
|
+
export async function observeConditions(env, { source, present, now = new Date(), updateStatusImpl = updateStatus }) {
|
|
84
|
+
if (isHeadlessFactorySession(env)) return { ok: false, result: "headless_session" }
|
|
85
|
+
if (!SOURCES.includes(source)) return { ok: false, result: "invalid_source" }
|
|
86
|
+
if (!Array.isArray(present)) return { ok: false, result: "invalid_present" }
|
|
87
|
+
const keys = wellFormedKeys(source, present)
|
|
88
|
+
if (keys === null) return { ok: false, result: "invalid_key" }
|
|
89
|
+
const nowMs = now === null ? Number.NaN : new Date(now).getTime()
|
|
90
|
+
if (Number.isNaN(nowMs)) return { ok: false, result: "invalid_time" }
|
|
91
|
+
const stamp = new Date(nowMs).toISOString()
|
|
92
|
+
let counted = false
|
|
93
|
+
let skipped = false
|
|
94
|
+
try {
|
|
95
|
+
await updateStatusImpl(env, (current) => {
|
|
96
|
+
const loop = isObject(current.loop) ? current.loop : {}
|
|
97
|
+
const before = isObject(loop.conditions) ? loop.conditions : {}
|
|
98
|
+
const next = { ...before }
|
|
99
|
+
counted = false
|
|
100
|
+
skipped = false
|
|
101
|
+
for (const key of keys) next[key] = { present: true, clear_runs: 0, observed_at: stamp, counted_at: stamp }
|
|
102
|
+
for (const [key, entry] of Object.entries(before)) {
|
|
103
|
+
if (keys.has(key) || !key.startsWith(`${source}:`) || !isValidEntry(entry)) continue
|
|
104
|
+
const lastCounted = Number.isNaN(timeOf(entry.counted_at)) ? timeOf(entry.observed_at) : timeOf(entry.counted_at)
|
|
105
|
+
const elapsed = nowMs - lastCounted
|
|
106
|
+
const countsNow = elapsed >= MIN_OBSERVATION_GAP_HOURS * HOUR_MS
|
|
107
|
+
if (countsNow) counted = true
|
|
108
|
+
else skipped = true
|
|
109
|
+
// A clock that moved back, or an entry dated ahead, never counts; the stamp is pulled back to now so it blocks for at most one gap.
|
|
110
|
+
const stampKept = new Date(Math.min(lastCounted, nowMs)).toISOString()
|
|
111
|
+
next[key] = countsNow
|
|
112
|
+
? { present: false, clear_runs: entry.clear_runs + 1, observed_at: stamp, counted_at: stamp }
|
|
113
|
+
: { present: false, clear_runs: entry.clear_runs, observed_at: stamp, counted_at: stampKept }
|
|
114
|
+
}
|
|
115
|
+
return { ...current, loop: { ...loop, conditions: bounded(next) } }
|
|
116
|
+
})
|
|
117
|
+
} catch {
|
|
118
|
+
return { ok: false, result: "status_unwritable" }
|
|
119
|
+
}
|
|
120
|
+
return { ok: true, result: skipped && !counted ? "observed_within_gap" : "observed" }
|
|
121
|
+
}
|