@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,637 @@
|
|
|
1
|
+
// The publishing transform: the only code that produces what leaves this
|
|
2
|
+
// machine for a factory store.
|
|
3
|
+
//
|
|
4
|
+
// `toPublished(local, { visibility, deskVisibility, storeVisibility,
|
|
5
|
+
// machineSecret, now })` turns
|
|
6
|
+
// one valid local facts file (`desk.factory.local/2`, `schema.js`) into
|
|
7
|
+
// published facts (`desk.factory.published/4`, `published-schema.js`). Every
|
|
8
|
+
// file is `/4`, so the first flush after this change sends each session in
|
|
9
|
+
// the outbox once more, with the `/4` keys. The stores are public, so the
|
|
10
|
+
// published form carries no who and no time of day, just how, and one date
|
|
11
|
+
// per job, the UTC day the task finished:
|
|
12
|
+
//
|
|
13
|
+
// - No when. `session.duration_ms` is `derived_through - started_at` and
|
|
14
|
+
// `ended` is whether `ended_at` is set. Every interval becomes
|
|
15
|
+
// `start_ms`/`end_ms`, milliseconds since `started_at`. An interval that
|
|
16
|
+
// starts before the session or ends after `derived_through` (most often
|
|
17
|
+
// a subagent still working after the main log's last line, which a live
|
|
18
|
+
// session's derivation can catch mid-run) is dropped, never clamped,
|
|
19
|
+
// and its field is marked `interval_outside_session_clock` (compactions
|
|
20
|
+
// count under `turns`, subagents under `tool_durations`, as in the
|
|
21
|
+
// derivers). The reason says only that some intervals are missing, so
|
|
22
|
+
// every figure it reaches is partial, never unavailable. For a
|
|
23
|
+
// job with a task-card creation time, `session_offset_ms` is
|
|
24
|
+
// `started_at - task_created_at` (signed: a session may begin before its
|
|
25
|
+
// task card exists), and each transition's and the observation's
|
|
26
|
+
// `offset_ms` is its time minus `task_created_at`. A job without a
|
|
27
|
+
// creation time publishes `session_offset_ms: null`, drops its
|
|
28
|
+
// transitions and publishes its observation with `offset_ms: null`. An
|
|
29
|
+
// offset beyond `PUBLISHED_LIMITS.maxOffsetMs` (a zeroed or bogus card
|
|
30
|
+
// time) is treated the same way, since it would be close to an epoch
|
|
31
|
+
// value. Either loss adds `{job_offsets, source_unreadable}` once. A
|
|
32
|
+
// non-terminal card's observation (`at: null`, M3-4) publishes its
|
|
33
|
+
// status with `offset_ms: null`; no observation publishes `null`.
|
|
34
|
+
// - Finish day (`/4`). A job whose card was observed `done` or `cancelled`
|
|
35
|
+
// publishes `finished_on`, the UTC day (`YYYY-MM-DD`) of the session's
|
|
36
|
+
// own last transition into that status (`finished_basis:
|
|
37
|
+
// "transition"`), else of the observation's `at`, the card's `updated`
|
|
38
|
+
// time, which is an upper bound (`"card_updated"`); binding never gives
|
|
39
|
+
// an observation an `updated` time that is not after the card's
|
|
40
|
+
// `created` time (`binding.js`). Only a source this
|
|
41
|
+
// file also publishes with an offset counts, so a job with no readable
|
|
42
|
+
// card creation time, an open job and any job of a desk that withholds
|
|
43
|
+
// its timing publish `null` for both. A day before the gate's `FINISHED_ON_MIN` (2025-01-01, imported, not copied), or after
|
|
44
|
+
// the UTC day of the optional `now` (milliseconds; a hand-edited card
|
|
45
|
+
// dated ahead), is `null` too, because the store would refuse the file.
|
|
46
|
+
// - Offsets and durations are capped at `PUBLISHED_LIMITS.maxOffsetMs`,
|
|
47
|
+
// ten years (controller rulings, M3-5 fix rounds 1 and 2). Ten years is
|
|
48
|
+
// less than the time since 1970, so no offset can be an epoch value in
|
|
49
|
+
// disguise. A session longer than the cap cannot be real: its start is
|
|
50
|
+
// a bogus early timestamp (one log line dated 1970, say), and every
|
|
51
|
+
// interval offset would carry that anchor's absolute time. Such a
|
|
52
|
+
// session is refused, not published: the result is `{ published: null,
|
|
53
|
+
// reason: "implausible_session_span" }`, and the flush quarantines it
|
|
54
|
+
// locally. So is a session that starts before `EARLIEST_SESSION_START`
|
|
55
|
+
// (2025-01-01, controller ruling, fix round 3): neither host existed
|
|
56
|
+
// before then, so such a start is a bogus anchor too, and a guessable one
|
|
57
|
+
// (`2020-01-01`) inside the ten-year cap would otherwise still turn every
|
|
58
|
+
// interval offset back into absolute time.
|
|
59
|
+
// - A session ID that is not a version-4 UUID could carry a timestamp or a
|
|
60
|
+
// machine identifier, in the file and in its name. A version-4 ID
|
|
61
|
+
// publishes unchanged. A version-7 ID (Codex threads) carries its
|
|
62
|
+
// creation time, so it publishes as a keyed version-4-shaped ID,
|
|
63
|
+
// `HMAC-SHA256(machineSecret, "session:" + id)`, on every desk: the same
|
|
64
|
+
// ID in the facts, the store path and the labels, stable per machine so
|
|
65
|
+
// a re-derive updates the same file. Anything else is refused with
|
|
66
|
+
// `reason: "session_id_not_v4"`.
|
|
67
|
+
// - A desk that is public, or not known to be private, keeps its job
|
|
68
|
+
// timing private (controller ruling, fix round 2): anyone could compute
|
|
69
|
+
// a public desk's plain job IDs from its task paths and read each card's
|
|
70
|
+
// public `created` date, which would turn job offsets back into absolute
|
|
71
|
+
// time. So unless `deskVisibility` is `"private"` or `"internal"`, every
|
|
72
|
+
// job publishes `session_offset_ms: null`, no transition offsets and an
|
|
73
|
+
// observation `offset_ms: null`, `unavailable` gains `{job_offsets,
|
|
74
|
+
// desk_public}`, and each job ID is replaced with the first 32 hex of
|
|
75
|
+
// `HMAC-SHA256(machineSecret, jobId)`, a per-machine key the flush keeps
|
|
76
|
+
// in the factory state folder. Those jobs are sorted by their keyed ID,
|
|
77
|
+
// so their order says nothing about the plain IDs (which binding sorts
|
|
78
|
+
// by).
|
|
79
|
+
// - No who. Local facts carry no contributor, and nothing here adds a
|
|
80
|
+
// machine, host name, desk path, account or branch. The file name is
|
|
81
|
+
// `<host>-<session id>.json` (`publishedFileName`).
|
|
82
|
+
// - A commit's `at_ms` (when the session recorded it, on the session
|
|
83
|
+
// clock) is published under the rule for a controller PR's `at_ms`: only
|
|
84
|
+
// on a desk known to be private and only in a session whose jobs carry
|
|
85
|
+
// segments, where it can place the commit in a job's segment.
|
|
86
|
+
// - Created PRs (`/4`). `refs.prs[].created` is `true` only when the local
|
|
87
|
+
// ref says the session's own call created the PR; a ref written before
|
|
88
|
+
// derivers kept the flag publishes `false`. A desk that withholds its
|
|
89
|
+
// timing publishes `false` for every PR, because GitHub's public creation
|
|
90
|
+
// time of a created PR would date the session.
|
|
91
|
+
// - Stop facts (`/4`). Each human wait keeps its `stop` (how the agent's
|
|
92
|
+
// turn ended, whether its last reply ended in a question mark, whether
|
|
93
|
+
// its background agents were running: codes and booleans, no text). A
|
|
94
|
+
// wait derived before stop facts were recorded publishes `{ end:
|
|
95
|
+
// "not_recorded", asks: null, pending_agents: null }`.
|
|
96
|
+
// - Public references only. A PR or commit is kept only when
|
|
97
|
+
// `visibility(repo)` returns exactly `"public"`. Private and unknown
|
|
98
|
+
// repositories, commits without a repository, and a repository whose
|
|
99
|
+
// name holds a date shape are dropped and counted in `refs.private`,
|
|
100
|
+
// together with the references the deriver could not resolve
|
|
101
|
+
// (`refs.unresolved`); the same totals are returned as `dropped`.
|
|
102
|
+
// `visibility` is asked once per repository and never for a date-shaped
|
|
103
|
+
// one. A reference repeated in the local file is published once.
|
|
104
|
+
// - Public plugins only, unless the store is not public (controller
|
|
105
|
+
// ruling, M3-12). A plugin is named when its install `source`, the GitHub
|
|
106
|
+
// repository it was installed from, is public by `visibility`, or when
|
|
107
|
+
// `storeVisibility` is `"private"` or `"internal"` (a work store). Any
|
|
108
|
+
// other plugin, including one with no known source, and every plugin
|
|
109
|
+
// when the store's visibility is unknown, is counted in
|
|
110
|
+
// `refs.private.plugins` and in `dropped.plugins`. The source itself is
|
|
111
|
+
// never published.
|
|
112
|
+
// - No date or time shapes. A model ID or plugin name holding an ISO date
|
|
113
|
+
// (such as `gpt-4o-2024-08-06`) loses that date's hyphens
|
|
114
|
+
// (`gpt-4o-20240806`), and a model ID holding a time of day loses its
|
|
115
|
+
// colons (repeatedly, since removing one can uncover the other), so the
|
|
116
|
+
// file passes the public gate's date and time checks
|
|
117
|
+
// without losing the model. That date is the model's or plugin's
|
|
118
|
+
// release, not when the work happened, so keeping its digits says
|
|
119
|
+
// nothing about the session.
|
|
120
|
+
// - Outcomes. Each task outcome entry keeps its state, verified flag,
|
|
121
|
+
// reason code, delivery count and a wait class (`lt_1h`, `lt_1d`,
|
|
122
|
+
// `lt_7d`, `ge_7d`, and whether the wait is still running); the
|
|
123
|
+
// delivery, sign-off and observation times, and any exact wait, stay
|
|
124
|
+
// local. The job ID is keyed exactly as the `jobs` entries' are, on every
|
|
125
|
+
// desk class.
|
|
126
|
+
// - Human turns. Each turn keeps its basis, its gap and two size classes;
|
|
127
|
+
// its time becomes `at_ms`, milliseconds since `started_at`, on the same
|
|
128
|
+
// clock as the intervals. A turn outside that clock is dropped, never
|
|
129
|
+
// moved, and `human_turns` is marked `source_unreadable`. A desk that is
|
|
130
|
+
// not private publishes the same list: it holds no text and no date.
|
|
131
|
+
//
|
|
132
|
+
// `publishedClock(local)` is the session clock alone: the same duration,
|
|
133
|
+
// intervals and refusals `toPublished` produces, for the waste evaluator,
|
|
134
|
+
// whose labels must cite exactly the intervals the store will hold.
|
|
135
|
+
//
|
|
136
|
+
// `toPublishedLabels(labels, { deskVisibility, machineSecret })` is the
|
|
137
|
+
// labels' transform. Local labels (`desk.factory.labels/3`, `/2` or `/1`, `label-schema.js`)
|
|
138
|
+
// are already on the published session clock and carry no free text, so
|
|
139
|
+
// only the job changes: a desk that is not known to be private publishes
|
|
140
|
+
// the same keyed job ID as its facts. The file goes to
|
|
141
|
+
// `labels/<job>/<session id>.json`.
|
|
142
|
+
//
|
|
143
|
+
// `unavailable` keeps the local entries once each and adds the transform's
|
|
144
|
+
// own markers after them. Nothing is trimmed: the schema limit holds every
|
|
145
|
+
// field with every reason once, so the union always fits. A public store
|
|
146
|
+
// that hides a plugin adds `{plugins, withheld_public}`. The transform is
|
|
147
|
+
// pure and deterministic: it never mutates its input, shares no object with
|
|
148
|
+
// it and reads no clock.
|
|
149
|
+
//
|
|
150
|
+
// `src/factory/**` imports only `node:` built-ins and other `src/factory/`
|
|
151
|
+
// files.
|
|
152
|
+
|
|
153
|
+
import { createHmac } from "node:crypto"
|
|
154
|
+
|
|
155
|
+
import { publishedAgentType } from "./agent-types.js"
|
|
156
|
+
import { validateLabels } from "./label-schema.js"
|
|
157
|
+
import { PRIVATE_VISIBILITIES, deskTimingKept } from "./desk-visibility.js"
|
|
158
|
+
import { waitClass } from "./outcome.js"
|
|
159
|
+
import { intervalInSession } from "./pipeline/timeline.js"
|
|
160
|
+
import { validateLocalFacts } from "./schema.js"
|
|
161
|
+
import { DATE_SHAPE, FINISHED_ON_MIN, PUBLISHED_LIMITS, PUBLISHED_SCHEMA, SESSION_ID_V4, publishableToken, scrub, validatePublished } from "./published-schema.js"
|
|
162
|
+
|
|
163
|
+
/** Why `toPublished` returned no file. */
|
|
164
|
+
export const REFUSALS = Object.freeze(["implausible_session_span", "session_id_not_v4"])
|
|
165
|
+
|
|
166
|
+
/** No session this transform publishes can start earlier: neither host existed before it. */
|
|
167
|
+
export const EARLIEST_SESSION_START = "2025-01-01T00:00:00.000Z"
|
|
168
|
+
|
|
169
|
+
// Desks whose remote is known not to be public keep their job timing.
|
|
170
|
+
// Stores known not to be public (a work store) keep every plugin's name.
|
|
171
|
+
|
|
172
|
+
const MIN_SECRET_BYTES = 32
|
|
173
|
+
|
|
174
|
+
// The reason an interval dropped for running outside the published session clock gives its field.
|
|
175
|
+
const OUTSIDE_SESSION_CLOCK = "interval_outside_session_clock"
|
|
176
|
+
|
|
177
|
+
// The `unavailable` field an interval kind's data belongs to.
|
|
178
|
+
const INTERVAL_FIELD = Object.freeze({
|
|
179
|
+
turn: "turns",
|
|
180
|
+
tool: "tool_durations",
|
|
181
|
+
subagent: "tool_durations",
|
|
182
|
+
human_wait: "human_waits",
|
|
183
|
+
permission_wait: "permission_waits",
|
|
184
|
+
api_retry: "api_retries",
|
|
185
|
+
compaction: "turns",
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
// The worker's number, parent and models, plus its agent type when it has one: kept
|
|
189
|
+
// for a built-in type or a public plugin's type, `custom` for any other. A per-worker
|
|
190
|
+
// value the published validator would reject never blocks the file: the model becomes
|
|
191
|
+
// `unknown`, the requested model is left out and the type is `custom`.
|
|
192
|
+
function publishAgent(agent, host, publicPluginNames) {
|
|
193
|
+
return {
|
|
194
|
+
n: agent.n,
|
|
195
|
+
parent: agent.parent,
|
|
196
|
+
model: publishableToken(scrub(agent.model)) ? scrub(agent.model) : "unknown",
|
|
197
|
+
...(Object.hasOwn(agent, "agent_type") ? { agent_type: publishedAgentType(host, agent.agent_type, publicPluginNames) } : {}),
|
|
198
|
+
...(Object.hasOwn(agent, "requested_model") && publishableToken(scrub(agent.requested_model)) ? { requested_model: scrub(agent.requested_model) } : {}),
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function publishSession(session, durationMs, id) {
|
|
203
|
+
return {
|
|
204
|
+
host: session.host,
|
|
205
|
+
id,
|
|
206
|
+
host_version: session.host_version,
|
|
207
|
+
entrypoint: session.entrypoint,
|
|
208
|
+
duration_ms: durationMs,
|
|
209
|
+
ended: session.ended_at !== null,
|
|
210
|
+
end_reason: session.end_reason,
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const NOT_RECORDED_STOP = Object.freeze({ end: "not_recorded", asks: null, pending_agents: null })
|
|
215
|
+
|
|
216
|
+
function publishIntervals(intervals, startedMs, durationMs, flag) {
|
|
217
|
+
const kept = []
|
|
218
|
+
for (const interval of intervals) {
|
|
219
|
+
const startMs = Date.parse(interval.start) - startedMs
|
|
220
|
+
const endMs = Date.parse(interval.end) - startedMs
|
|
221
|
+
if (!intervalInSession(startMs, endMs, durationMs)) {
|
|
222
|
+
flag(INTERVAL_FIELD[interval.kind], OUTSIDE_SESSION_CLOCK)
|
|
223
|
+
continue
|
|
224
|
+
}
|
|
225
|
+
const out = { kind: interval.kind, agent: interval.agent }
|
|
226
|
+
if (interval.kind === "tool") {
|
|
227
|
+
out.tool = interval.tool
|
|
228
|
+
out.outcome = interval.outcome
|
|
229
|
+
}
|
|
230
|
+
out.start_ms = startMs
|
|
231
|
+
out.end_ms = endMs
|
|
232
|
+
if (interval.kind === "human_wait") {
|
|
233
|
+
const stop = interval.stop ?? NOT_RECORDED_STOP
|
|
234
|
+
out.stop = { end: stop.end, asks: stop.asks, pending_agents: stop.pending_agents }
|
|
235
|
+
}
|
|
236
|
+
kept.push(out)
|
|
237
|
+
}
|
|
238
|
+
return kept
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// `visibility` asked once per repository, for references and plugin sources alike.
|
|
242
|
+
function publicRepos(visibility) {
|
|
243
|
+
const answers = new Map()
|
|
244
|
+
return (repo) => {
|
|
245
|
+
if (!answers.has(repo)) answers.set(repo, visibility(repo) === "public")
|
|
246
|
+
return answers.get(repo)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// `timed`: whether a controller PR and a commit keep their `at_ms` (see `toPublished`). `deskPrivate`: whether a PR may say it was created.
|
|
251
|
+
function publishRefs(refs, askPublic, timed, deskPrivate) {
|
|
252
|
+
const isPublic = (repo) => repo !== null && !DATE_SHAPE.test(repo) && askPublic(repo)
|
|
253
|
+
const dropped = { prs: refs.unresolved.prs, commits: refs.unresolved.commits }
|
|
254
|
+
// Keeps each public reference once (by `keyOf`) and counts the others.
|
|
255
|
+
const keep = (list, kind, keyOf, copy) => {
|
|
256
|
+
const seen = new Set()
|
|
257
|
+
const kept = []
|
|
258
|
+
for (const item of list) {
|
|
259
|
+
if (!isPublic(item.repo)) dropped[kind] += 1
|
|
260
|
+
else if (!seen.has(keyOf(item))) {
|
|
261
|
+
seen.add(keyOf(item))
|
|
262
|
+
kept.push(copy(item))
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return kept
|
|
266
|
+
}
|
|
267
|
+
const prs = keep(refs.prs, "prs", (pr) => `${pr.repo}#${pr.number}`, (pr) => ({
|
|
268
|
+
repo: pr.repo,
|
|
269
|
+
number: pr.number,
|
|
270
|
+
...(Object.hasOwn(pr, "agent") ? { agent: pr.agent } : {}),
|
|
271
|
+
...(timed && pr.agent === 0 && Object.hasOwn(pr, "at_ms") ? { at_ms: pr.at_ms } : {}),
|
|
272
|
+
created: deskPrivate && pr.created === true,
|
|
273
|
+
}))
|
|
274
|
+
const commits = keep(refs.commits, "commits", (commit) => commit.sha, (commit) => ({
|
|
275
|
+
repo: commit.repo,
|
|
276
|
+
sha: commit.sha,
|
|
277
|
+
...(timed && Object.hasOwn(commit, "at_ms") ? { at_ms: commit.at_ms } : {}),
|
|
278
|
+
}))
|
|
279
|
+
return { prs, commits, dropped }
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const TOKEN_KEYS = ["input", "output", "cache_read", "cache_write", "reasoning"]
|
|
283
|
+
|
|
284
|
+
// The sum of two counts; unknown (`null`) when either is unknown or the sum is unsafe, as everywhere else.
|
|
285
|
+
function sumKnown(a, b) {
|
|
286
|
+
if (a === null || b === null) return null
|
|
287
|
+
const sum = a + b
|
|
288
|
+
return Number.isSafeInteger(sum) ? sum : null
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// A model id the published validator would refuse publishes as `unknown`. Models that end up with the same id merge, so the published ids stay unique, and the result is sorted by id. A merged count that cannot be summed is unknown, and says so in `unavailable`.
|
|
292
|
+
function publishModels(models, flag) {
|
|
293
|
+
const byId = new Map()
|
|
294
|
+
const merged = (field, a, b) => {
|
|
295
|
+
const sum = sumKnown(a, b)
|
|
296
|
+
if (sum === null && !(a === null && b === null)) flag(field, "source_unreadable")
|
|
297
|
+
return sum
|
|
298
|
+
}
|
|
299
|
+
for (const model of models) {
|
|
300
|
+
const id = publishableToken(scrub(model.id)) ? scrub(model.id) : "unknown"
|
|
301
|
+
const held = byId.get(id)
|
|
302
|
+
if (held === undefined) {
|
|
303
|
+
byId.set(id, { id, requests: model.requests, tokens: Object.fromEntries(TOKEN_KEYS.map((key) => [key, model.tokens[key]])) })
|
|
304
|
+
} else {
|
|
305
|
+
held.requests = merged("requests", held.requests, model.requests)
|
|
306
|
+
for (const key of TOKEN_KEYS) held.tokens[key] = merged("tokens", held.tokens[key], model.tokens[key])
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return [...byId.values()].sort((a, b) => (a.id < b.id ? -1 : 1))
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// A plugin is named in a public store only when it was installed from a public
|
|
313
|
+
// repository; the rest are counted. A store known not to be public names them all.
|
|
314
|
+
// A name the published validator would refuse (a credential-shaped one) is hidden the same way.
|
|
315
|
+
function publishPlugins(plugins, isPublic, storeVisibility) {
|
|
316
|
+
const privateStore = PRIVATE_VISIBILITIES.has(storeVisibility)
|
|
317
|
+
const kept = []
|
|
318
|
+
const names = []
|
|
319
|
+
let hidden = 0
|
|
320
|
+
for (const plugin of plugins) {
|
|
321
|
+
const source = plugin.source ?? null
|
|
322
|
+
if (publishableToken(scrub(plugin.name)) && (privateStore || (source !== null && isPublic(source)))) {
|
|
323
|
+
kept.push({ name: scrub(plugin.name), version: plugin.version })
|
|
324
|
+
names.push(plugin.name)
|
|
325
|
+
} else hidden += 1
|
|
326
|
+
}
|
|
327
|
+
return { plugins: kept, hidden, names }
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// The per-machine keyed form of a job ID, for a desk that is not known to be private.
|
|
331
|
+
export function keyedJobId(job, machineSecret) {
|
|
332
|
+
return createHmac("sha256", machineSecret).update(job).digest("hex").slice(0, 32)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const SESSION_ID_V7 = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u
|
|
336
|
+
|
|
337
|
+
function validSecret(machineSecret) {
|
|
338
|
+
return machineSecret instanceof Uint8Array && machineSecret.length >= MIN_SECRET_BYTES
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** The session ID as it publishes: a v4 unchanged, a v7 as a keyed v4-shaped ID, which needs the machine secret on any desk. */
|
|
342
|
+
function publishedSessionId(id, machineSecret, caller) {
|
|
343
|
+
if (!SESSION_ID_V7.test(id)) return id
|
|
344
|
+
if (!validSecret(machineSecret)) throw Object.assign(new TypeError(`${caller}: Pass a machineSecret of at least 32 bytes: a version-7 session ID needs one`), { code: "publish_pass_a_machinesecret_of_at_2" })
|
|
345
|
+
const hex = createHmac("sha256", machineSecret).update(`session:${id}`).digest("hex").slice(0, 32)
|
|
346
|
+
const variant = "89ab"[Number.parseInt(hex[16], 16) % 4]
|
|
347
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Whether job timing is kept; a desk that withholds it needs the key for its job IDs.
|
|
351
|
+
function deskIsPrivate(deskVisibility, machineSecret, caller) {
|
|
352
|
+
const deskPrivate = deskTimingKept(deskVisibility)
|
|
353
|
+
if (!deskPrivate && !validSecret(machineSecret)) {
|
|
354
|
+
throw Object.assign(new TypeError(`${caller}: Pass a machineSecret of at least 32 bytes: a desk that is not private needs one`), { code: "publish_pass_a_machinesecret_of_at" })
|
|
355
|
+
}
|
|
356
|
+
return deskPrivate
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Why a session cannot be published at all, or `null`.
|
|
360
|
+
function refusalOf(local, startedMs, durationMs) {
|
|
361
|
+
if (durationMs > PUBLISHED_LIMITS.maxOffsetMs || startedMs < Date.parse(EARLIEST_SESSION_START)) return "implausible_session_span"
|
|
362
|
+
if (!SESSION_ID_V4.test(local.session.id) && !SESSION_ID_V7.test(local.session.id)) return "session_id_not_v4"
|
|
363
|
+
return null
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// The job's workers, when it records them (absent: every worker in the session).
|
|
367
|
+
function agentsOf(job) {
|
|
368
|
+
return Object.hasOwn(job, "agents") ? { agents: [...job.agents] } : {}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// A public (or not surely private) desk's job: a keyed ID and no timing.
|
|
372
|
+
function protectedJob(job, machineSecret) {
|
|
373
|
+
return {
|
|
374
|
+
job: keyedJobId(job.job, machineSecret),
|
|
375
|
+
basis: [...job.basis],
|
|
376
|
+
session_offset_ms: null,
|
|
377
|
+
transitions: [],
|
|
378
|
+
observed: job.observed === null ? null : { status: job.observed.status, offset_ms: null },
|
|
379
|
+
...agentsOf(job),
|
|
380
|
+
finished_on: null,
|
|
381
|
+
finished_basis: null,
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const TERMINAL = new Set(["done", "cancelled"])
|
|
386
|
+
const utcDay = (ms) => new Date(ms).toISOString().slice(0, 10)
|
|
387
|
+
|
|
388
|
+
// The job's finish day and its source (see the header): the last published transition into the terminal status the card was observed in,
|
|
389
|
+
// else the published observation. `transitionMs` holds each published transition's instant.
|
|
390
|
+
function finishOf(observed, transitions, transitionMs, observedMs, now) {
|
|
391
|
+
const none = { finished_on: null, finished_basis: null }
|
|
392
|
+
if (observed === null || !TERMINAL.has(observed.status)) return none
|
|
393
|
+
let latest = null
|
|
394
|
+
transitions.forEach((transition, index) => {
|
|
395
|
+
if (transition.to === observed.status && (latest === null || transitionMs[index] > latest)) latest = transitionMs[index]
|
|
396
|
+
})
|
|
397
|
+
let found = none
|
|
398
|
+
if (latest !== null) found = { finished_on: utcDay(latest), finished_basis: "transition" }
|
|
399
|
+
else if (observed.offset_ms !== null) found = { finished_on: utcDay(observedMs), finished_basis: "card_updated" }
|
|
400
|
+
if (found.finished_on === null || found.finished_on < FINISHED_ON_MIN) return none
|
|
401
|
+
if (Number.isFinite(now) && found.finished_on > utcDay(now)) return none
|
|
402
|
+
return found
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function publishJob(job, startedMs, flag, now) {
|
|
406
|
+
const anchor = job.task_created_at === null ? null : Date.parse(job.task_created_at)
|
|
407
|
+
const offsetOf = (ms) => {
|
|
408
|
+
if (anchor === null) return null
|
|
409
|
+
const offset = ms - anchor
|
|
410
|
+
return Math.abs(offset) <= PUBLISHED_LIMITS.maxOffsetMs ? offset : null
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const sessionOffset = offsetOf(startedMs)
|
|
414
|
+
let lost = sessionOffset === null
|
|
415
|
+
const transitions = []
|
|
416
|
+
const transitionMs = []
|
|
417
|
+
for (const transition of job.transitions) {
|
|
418
|
+
const offset = offsetOf(Date.parse(transition.at))
|
|
419
|
+
if (offset === null) lost = true
|
|
420
|
+
else {
|
|
421
|
+
transitions.push({ to: transition.to, offset_ms: offset })
|
|
422
|
+
transitionMs.push(Date.parse(transition.at))
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
let observed = null
|
|
426
|
+
if (job.observed !== null) {
|
|
427
|
+
const offset = job.observed.at === null ? null : offsetOf(Date.parse(job.observed.at))
|
|
428
|
+
if (job.observed.at !== null && offset === null) lost = true
|
|
429
|
+
observed = { status: job.observed.status, offset_ms: offset }
|
|
430
|
+
}
|
|
431
|
+
if (lost) flag("job_offsets", "source_unreadable")
|
|
432
|
+
|
|
433
|
+
return {
|
|
434
|
+
job: job.job, basis: [...job.basis], session_offset_ms: sessionOffset, transitions, observed, ...agentsOf(job),
|
|
435
|
+
...(Object.hasOwn(job, "segments") ? { segments: job.segments.map((segment) => ({ ...segment })) } : {}),
|
|
436
|
+
...finishOf(observed, transitions, transitionMs, observed === null || job.observed.at === null ? null : Date.parse(job.observed.at), now),
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// How long a delivery waited for its sign-off, as a coarse class and never a number. A signed delivery (accepted or refused) waited from delivery to sign-off; an unsigned one has waited at least from delivery to the time it was observed (`censored`). Any other state, a missing time, or a difference that is negative or not finite has no wait: `null`, never a zero and never the lowest class.
|
|
441
|
+
function publishWait(entry) {
|
|
442
|
+
const censored = entry.state === "delivered_unsigned"
|
|
443
|
+
if (!censored && entry.state !== "accepted" && entry.state !== "refused") return null
|
|
444
|
+
const end = censored ? entry.observed_at : entry.signed_at
|
|
445
|
+
if (entry.delivered_at === null || end === null) return null
|
|
446
|
+
const ms = Date.parse(end) - Date.parse(entry.delivered_at)
|
|
447
|
+
if (!Number.isFinite(ms) || ms < 0) return null
|
|
448
|
+
return { class: waitClass(ms), censored }
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// The published counts stop at 9999 (read it as "9999 or more"), so a larger local value never makes the whole file invalid.
|
|
452
|
+
const capped = (count) => Math.min(count, 9999)
|
|
453
|
+
|
|
454
|
+
// A return as published: its codes and flag, and no time.
|
|
455
|
+
const publishReturn = (item) => ({ reason: item.reason, caught: item.caught, counts: item.counts, refusal: item.refusal, refusal_verified: item.refusal_verified })
|
|
456
|
+
|
|
457
|
+
// The outcome entries as published: the state and its codes, the delivery count, the wait class and, when the entry has them, the record's start and its returns, with no time (the milestone times stay local). `keyJob` gives a job's published id, which is exactly the id its `jobs` entry has.
|
|
458
|
+
function publishOutcomes(local, { keyJob }) {
|
|
459
|
+
return local.outcomes
|
|
460
|
+
.map((entry) => ({
|
|
461
|
+
job: keyJob(entry.job), rev: capped(entry.rev), state: entry.state, verified: entry.verified, reason: entry.reason, deliveries: capped(entry.deliveries), wait: publishWait(entry),
|
|
462
|
+
...(Object.hasOwn(entry, "since") ? { since: entry.since } : {}),
|
|
463
|
+
...(Object.hasOwn(entry, "returns") ? { returns: entry.returns.map(publishReturn) } : {}),
|
|
464
|
+
...(Object.hasOwn(entry, "returns_truncated") ? { returns_truncated: entry.returns_truncated } : {}),
|
|
465
|
+
...(Object.hasOwn(entry, "returns_unreadable") ? { returns_unreadable: capped(entry.returns_unreadable) } : {}),
|
|
466
|
+
}))
|
|
467
|
+
.sort((a, b) => (a.job < b.job ? -1 : 1))
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// The human turns on the session clock, as intervals are: `at_ms` is the prompt's time minus `started_at`. A turn before the start or after `derived_through` cannot be placed on that clock; it is dropped, never moved, and the field is marked `source_unreadable`, as for an interval.
|
|
471
|
+
function publishHumanTurns(turns, startedMs, durationMs, flag) {
|
|
472
|
+
const kept = []
|
|
473
|
+
for (const turn of turns) {
|
|
474
|
+
const atMs = Date.parse(turn.at) - startedMs
|
|
475
|
+
if (!intervalInSession(atMs, atMs, durationMs)) {
|
|
476
|
+
flag("human_turns", "source_unreadable")
|
|
477
|
+
continue
|
|
478
|
+
}
|
|
479
|
+
kept.push({ at_ms: atMs, basis: turn.basis, window_ms: turn.window_ms, prompt_class: turn.prompt_class, output_class: turn.output_class })
|
|
480
|
+
}
|
|
481
|
+
return kept
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* `toPublished(local, { visibility, deskVisibility, storeVisibility,
|
|
486
|
+
* machineSecret, now }) -> { published, dropped: { prs, commits, plugins } }`,
|
|
487
|
+
* or `{ published: null,
|
|
488
|
+
* dropped: null, reason }` with a reason from `REFUSALS` when the session
|
|
489
|
+
* cannot be published at all.
|
|
490
|
+
*
|
|
491
|
+
* `local` must pass `validateLocalFacts`; `visibility(repo)` answers
|
|
492
|
+
* `"public"`, `"private"` or `"unknown"` for an `owner/repo` name;
|
|
493
|
+
* `deskVisibility` is the same answer for the desk's own remote (`"private"`
|
|
494
|
+
* or `"internal"` keep job timing; anything else, including a missing
|
|
495
|
+
* value, withholds it); `storeVisibility` is the same answer for the store
|
|
496
|
+
* the file goes to (`"private"` or `"internal"` name every plugin; anything
|
|
497
|
+
* else, including a missing value, names only plugins whose `source`
|
|
498
|
+
* repository is public); `machineSecret` (at least 32 bytes) keys the job IDs
|
|
499
|
+
* of a desk that withholds its timing and is required then; `now`, when a
|
|
500
|
+
* finite number of milliseconds, withholds a finish day after its UTC day
|
|
501
|
+
* (the transform reads no clock of its own). These are
|
|
502
|
+
* caller contracts: a violation throws a `TypeError` that names no value.
|
|
503
|
+
*/
|
|
504
|
+
export function toPublished(local, { visibility, deskVisibility, storeVisibility, machineSecret, now } = {}) {
|
|
505
|
+
if (typeof visibility !== "function") throw Object.assign(new TypeError("toPublished: Pass visibility as a function"), { code: "publish_topublished_pass_visibility_as_a" })
|
|
506
|
+
if (!validateLocalFacts(local).ok) throw Object.assign(new TypeError("toPublished: Pass local facts that pass validateLocalFacts"), { code: "publish_topublished_pass_local_facts_that" })
|
|
507
|
+
const deskPrivate = deskIsPrivate(deskVisibility, machineSecret, "toPublished")
|
|
508
|
+
const sessionId = publishedSessionId(local.session.id, machineSecret, "toPublished")
|
|
509
|
+
|
|
510
|
+
const startedMs = Date.parse(local.session.started_at)
|
|
511
|
+
const durationMs = Date.parse(local.session.derived_through) - startedMs
|
|
512
|
+
const reason = refusalOf(local, startedMs, durationMs)
|
|
513
|
+
if (reason !== null) return { published: null, dropped: null, reason }
|
|
514
|
+
|
|
515
|
+
// The local entries once each, then the transform's own.
|
|
516
|
+
const own = []
|
|
517
|
+
const localEntries = []
|
|
518
|
+
const has = (list, field, reason) => list.some((entry) => entry.field === field && entry.reason === reason)
|
|
519
|
+
for (const entry of local.unavailable) {
|
|
520
|
+
if (!has(localEntries, entry.field, entry.reason)) localEntries.push({ field: entry.field, reason: entry.reason })
|
|
521
|
+
}
|
|
522
|
+
const flag = (field, reason) => {
|
|
523
|
+
if (!has(own, field, reason)) own.push({ field, reason })
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const intervals = publishIntervals(local.intervals, startedMs, durationMs, flag)
|
|
527
|
+
// Marked before `unavailable` is built below; absent in local facts stays absent.
|
|
528
|
+
const humanTurns = Object.hasOwn(local, "human_turns") ? publishHumanTurns(local.human_turns, startedMs, durationMs, flag) : null
|
|
529
|
+
const isPublic = publicRepos(visibility)
|
|
530
|
+
// Job segments and controller PR and commit times are job timing: a desk that withholds its timing publishes none of them.
|
|
531
|
+
// Elsewhere a PR's `at_ms` is published only where it decides a PR's job: a controller (worker 0) PR in a session whose jobs carry segments.
|
|
532
|
+
// A commit's `at_ms` follows the same rule; a commit names no worker, and the one host that times commits (Copilot) records them as the root's.
|
|
533
|
+
const refs = publishRefs(local.refs, isPublic, deskPrivate && local.jobs.some((job) => Object.hasOwn(job, "segments")), deskPrivate)
|
|
534
|
+
const plugins = publishPlugins(local.plugins, isPublic, storeVisibility)
|
|
535
|
+
const dropped = { ...refs.dropped, plugins: plugins.hidden }
|
|
536
|
+
// A list with names left out says so, so a short list never reads as the whole one.
|
|
537
|
+
if (plugins.hidden > 0) flag("plugins", "withheld_public")
|
|
538
|
+
const jobs = deskPrivate
|
|
539
|
+
? local.jobs.map((job) => publishJob(job, startedMs, flag, now))
|
|
540
|
+
: local.jobs.map((job) => protectedJob(job, machineSecret)).sort((a, b) => (a.job < b.job ? -1 : 1))
|
|
541
|
+
if (!deskPrivate && jobs.length > 0) flag("job_offsets", "desk_public")
|
|
542
|
+
|
|
543
|
+
// Every flag is raised before the list is built: the models' merge can raise one.
|
|
544
|
+
const models = publishModels(local.models, flag)
|
|
545
|
+
const unavailable = [...localEntries.filter((entry) => !has(own, entry.field, entry.reason)), ...own]
|
|
546
|
+
const published = {
|
|
547
|
+
schema: PUBLISHED_SCHEMA,
|
|
548
|
+
session: publishSession(local.session, durationMs, sessionId),
|
|
549
|
+
plugins: plugins.plugins,
|
|
550
|
+
models,
|
|
551
|
+
agents: local.agents.map((agent) => publishAgent(agent, local.session.host, plugins.names)),
|
|
552
|
+
intervals,
|
|
553
|
+
counts: {
|
|
554
|
+
tool_calls: { ...local.counts.tool_calls },
|
|
555
|
+
tool_failures: { ...local.counts.tool_failures },
|
|
556
|
+
tool_retries: local.counts.tool_retries,
|
|
557
|
+
api_retries: local.counts.api_retries,
|
|
558
|
+
compactions: local.counts.compactions,
|
|
559
|
+
},
|
|
560
|
+
refs: { prs: refs.prs, commits: refs.commits, private: { ...dropped } },
|
|
561
|
+
jobs,
|
|
562
|
+
unavailable,
|
|
563
|
+
...(Object.hasOwn(local, "outcomes") ? { outcomes: publishOutcomes(local, { keyJob: deskPrivate ? (job) => job : (job) => keyedJobId(job, machineSecret) }) } : {}),
|
|
564
|
+
...(humanTurns === null ? {} : { human_turns: humanTurns }),
|
|
565
|
+
}
|
|
566
|
+
return { published, dropped: { ...dropped } }
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/** The bytes a store receives: canonical JSON and one trailing newline. */
|
|
570
|
+
export function serializePublished(published) {
|
|
571
|
+
return `${JSON.stringify(published)}\n`
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/** `<host>-<session id>.json` for a valid published file; anything else is a caller bug. */
|
|
575
|
+
export function publishedFileName(published) {
|
|
576
|
+
if (!validatePublished(published).ok) throw Object.assign(new TypeError("publishedFileName: Pass a value that passes validatePublished"), { code: "publish_publishedfilename_pass_a_value_that" })
|
|
577
|
+
return `${published.session.host}-${published.session.id}.json`
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* `publishedClock(local) -> { clock: { duration_ms, ended, intervals } }`,
|
|
582
|
+
* or `{ clock: null, reason }` with a reason from `REFUSALS`: the published
|
|
583
|
+
* session clock `toPublished` would produce for valid local facts, and
|
|
584
|
+
* nothing else. An interval `toPublished` drops is dropped here too. A
|
|
585
|
+
* version-7 session (Codex) has a clock, because `toPublished` publishes it
|
|
586
|
+
* under a keyed ID; the labels path cannot carry that ID, so callers that
|
|
587
|
+
* label sessions test `SESSION_ID_V4` on the local ID themselves.
|
|
588
|
+
*/
|
|
589
|
+
export function publishedClock(local) {
|
|
590
|
+
if (!validateLocalFacts(local).ok) throw Object.assign(new TypeError("publishedClock: Pass local facts that pass validateLocalFacts"), { code: "publish_publishedclock_pass_local_facts_that" })
|
|
591
|
+
const startedMs = Date.parse(local.session.started_at)
|
|
592
|
+
const durationMs = Date.parse(local.session.derived_through) - startedMs
|
|
593
|
+
const reason = refusalOf(local, startedMs, durationMs)
|
|
594
|
+
if (reason !== null) return { clock: null, reason }
|
|
595
|
+
return {
|
|
596
|
+
clock: {
|
|
597
|
+
duration_ms: durationMs,
|
|
598
|
+
ended: local.session.ended_at !== null,
|
|
599
|
+
intervals: publishIntervals(local.intervals, startedMs, durationMs, () => {}),
|
|
600
|
+
},
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* `toPublishedLabels(labels, { deskVisibility, machineSecret }) -> { path,
|
|
606
|
+
* published }`: valid local labels as the store receives them, at
|
|
607
|
+
* `labels/<job>/<session id>.json`. The job is keyed exactly as
|
|
608
|
+
* `toPublished` keys it; everything else is copied field by field. Caller
|
|
609
|
+
* contracts as for `toPublished`: a violation throws a `TypeError` that
|
|
610
|
+
* names no value.
|
|
611
|
+
*/
|
|
612
|
+
export function toPublishedLabels(labels, { deskVisibility, machineSecret } = {}) {
|
|
613
|
+
// The labels schema is the published one (version-4 sessions), so a version-7 session is mapped before it is checked.
|
|
614
|
+
const session = publishedSessionId(String(labels?.session), machineSecret, "toPublishedLabels")
|
|
615
|
+
if (!validateLabels({ ...labels, session }).ok) throw Object.assign(new TypeError("toPublishedLabels: Pass labels that pass validateLabels"), { code: "publish_topublishedlabels_pass_labels_that_pass" })
|
|
616
|
+
const job = deskIsPrivate(deskVisibility, machineSecret, "toPublishedLabels") ? labels.job : keyedJobId(labels.job, machineSecret)
|
|
617
|
+
const published = {
|
|
618
|
+
schema: labels.schema,
|
|
619
|
+
job,
|
|
620
|
+
session,
|
|
621
|
+
evaluator: { plugin_version: labels.evaluator.plugin_version, model: labels.evaluator.model, rubric: labels.evaluator.rubric },
|
|
622
|
+
stretches: labels.stretches.map((stretch) => ({
|
|
623
|
+
start_ms: stretch.start_ms,
|
|
624
|
+
end_ms: stretch.end_ms,
|
|
625
|
+
class: stretch.class,
|
|
626
|
+
waste: stretch.waste,
|
|
627
|
+
mura: stretch.mura,
|
|
628
|
+
muri: stretch.muri,
|
|
629
|
+
evidence: stretch.evidence.map((range) => [range[0], range[1]]),
|
|
630
|
+
...(Object.hasOwn(stretch, "confidence") ? { confidence: stretch.confidence, evaluator_version: stretch.evaluator_version } : {}),
|
|
631
|
+
...(Object.hasOwn(stretch, "caught") ? { caught: stretch.caught } : {}),
|
|
632
|
+
})),
|
|
633
|
+
...(Object.hasOwn(labels, "stops") ? { stops: labels.stops.map((stop) => ({ wait: [stop.wait[0], stop.wait[1]], why: stop.why, confidence: stop.confidence, evaluator_version: stop.evaluator_version })) } : {}),
|
|
634
|
+
unavailable: [...labels.unavailable],
|
|
635
|
+
}
|
|
636
|
+
return { path: `labels/${job}/${session}.json`, published }
|
|
637
|
+
}
|