@ouro.bot/cli 0.1.0-alpha.153 → 0.1.0-alpha.1532
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/LICENSE +21 -0
- package/README.md +158 -42
- package/RepairGuide.ouro/agent.json +5 -0
- package/RepairGuide.ouro/psyche/IDENTITY.md +19 -0
- package/RepairGuide.ouro/psyche/SOUL.md +55 -0
- package/RepairGuide.ouro/skills/diagnose-broken-remote.md +63 -0
- package/RepairGuide.ouro/skills/diagnose-stacked-typed-issues.md +35 -0
- package/RepairGuide.ouro/skills/diagnose-sync-blocked.md +54 -0
- package/RepairGuide.ouro/skills/diagnose-vault-expired.md +60 -0
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +4 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +2 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +1 -1
- package/assets/bluebubbles-host +264 -0
- package/assets/sanctuary-host-launcher.sh +16 -0
- package/changelog.json +8964 -41
- package/deploy/unraid/Dockerfile +85 -0
- package/deploy/unraid/INSTALL.md +64 -0
- package/deploy/unraid/README.txt +3034 -0
- package/deploy/unraid/audit-container-spec.sh +4 -0
- package/deploy/unraid/container-runtime.json +1 -0
- package/deploy/unraid/credit-gateway.md +95 -0
- package/deploy/unraid/docker-man-template-transaction.mjs +733 -0
- package/deploy/unraid/docker-man-template-xml.cjs +105 -0
- package/deploy/unraid/github_known_hosts +3 -0
- package/deploy/unraid/install.sh +274 -0
- package/deploy/unraid/migrate-sanctuary-bundle.mjs +63 -0
- package/deploy/unraid/ouro-events/bootstrap-spool.sh +92 -0
- package/deploy/unraid/ouro-events/emit-event.mjs +310 -0
- package/deploy/unraid/ouro-events/emit-usenet-event.sh +54 -0
- package/deploy/unraid/ouro-events/install-usenet-guard.sh +435 -0
- package/deploy/unraid/ouro-events/usenet-health.sh +176 -0
- package/deploy/unraid/ouro-host-lock.mjs +245 -0
- package/deploy/unraid/ouro-sync-ssh +98 -0
- package/deploy/unraid/ouro-sync.sudoers +3 -0
- package/deploy/unraid/sanctuary-acceptance-adapter.sh +43 -0
- package/deploy/unraid/sanctuary-acceptance-contract.json +198 -0
- package/deploy/unraid/sanctuary-acceptance-harness.sh +23 -0
- package/deploy/unraid/sanctuary-authority-installation.json +36 -0
- package/deploy/unraid/sanctuary-authority-service.sh +30 -0
- package/deploy/unraid/sanctuary-butler-upgrade.mjs +1604 -0
- package/deploy/unraid/sanctuary-deployment-target.mjs +710 -0
- package/deploy/unraid/sanctuary-replay-gate.mjs +2781 -0
- package/deploy/unraid/sanctuary-safe-rename.py +24 -0
- package/deploy/unraid/sanctuary-sync-cutover.sh +1039 -0
- package/deploy/unraid/sanctuary-unit16-host-broker.mjs +2088 -0
- package/deploy/unraid/sanctuary-unit16-run.sh +570 -0
- package/deploy/unraid/sanctuary-unit18-target-audit.sh +27 -0
- package/deploy/unraid/sanctuary.ouro/agent.json +72 -0
- package/deploy/unraid/sanctuary.ouro/arc/README.md +3 -0
- package/deploy/unraid/sanctuary.ouro/awaiting/house-care-sweep.md +17 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +5 -0
- package/deploy/unraid/sanctuary.ouro/habits/sanctuary-health.md +8 -0
- package/deploy/unraid/sanctuary.ouro/mcp/media-mcp.mjs +2533 -0
- package/deploy/unraid/sanctuary.ouro/product/PRODUCT.md +13 -0
- package/deploy/unraid/sanctuary.ouro/provider-readiness.json +11 -0
- package/deploy/unraid/sanctuary.ouro/psyche/ASPIRATIONS.md +5 -0
- package/deploy/unraid/sanctuary.ouro/psyche/IDENTITY.md +7 -0
- package/deploy/unraid/sanctuary.ouro/psyche/LORE.md +7 -0
- package/deploy/unraid/sanctuary.ouro/psyche/SOUL.md +15 -0
- package/deploy/unraid/sanctuary.ouro/psyche/TACIT.md +3 -0
- package/deploy/unraid/sanctuary.ouro/state/policy/steward.json +7 -0
- package/deploy/unraid/sanctuary.ouro/tool-profiles.json +274 -0
- package/deploy/unraid/sanctuary.xml +30 -0
- package/desk.lock.json +8 -0
- package/dist/a2a/approval-relay-forward.js +117 -0
- package/dist/a2a/approval-relay.js +95 -0
- package/dist/a2a/approval-request-wire.js +123 -0
- package/dist/a2a/card.js +57 -0
- package/dist/a2a/client.js +331 -0
- package/dist/a2a/config.js +50 -0
- package/dist/a2a/delegated-command-grants.js +93 -0
- package/dist/a2a/delegated-command.js +200 -0
- package/dist/a2a/delegation-stores.js +56 -0
- package/dist/a2a/did-resolution.js +205 -0
- package/dist/a2a/escalation-grants.js +84 -0
- package/dist/a2a/escalation-wiring.js +60 -0
- package/dist/a2a/identity.js +258 -0
- package/dist/a2a/inbound-share.js +131 -0
- package/dist/a2a/mission-result-wire.js +265 -0
- package/dist/a2a/onboarding.js +133 -0
- package/dist/a2a/operator-trust.js +399 -0
- package/dist/a2a/outbox-client.js +59 -0
- package/dist/a2a/outbox-store.js +245 -0
- package/dist/a2a/outbox-wire.js +106 -0
- package/dist/a2a/pin-store.js +167 -0
- package/dist/a2a/refusals.js +55 -0
- package/dist/a2a/relay-client.js +106 -0
- package/dist/a2a/relay-config-vault.js +64 -0
- package/dist/a2a/relay-contacts.js +120 -0
- package/dist/a2a/relay-inbox.js +360 -0
- package/dist/a2a/relay-retirements.js +89 -0
- package/dist/a2a/replay-grant-holders.js +33 -0
- package/dist/a2a/replay-harness.js +188 -0
- package/dist/a2a/resolution-proof.js +53 -0
- package/dist/a2a/sealed-chat.js +142 -0
- package/dist/a2a/seen-ledger.js +216 -0
- package/dist/a2a/server.js +1088 -0
- package/dist/a2a/task-store.js +69 -0
- package/dist/a2a/transport.js +100 -0
- package/dist/a2a/trust-commands.js +203 -0
- package/dist/a2a/trusted-files.js +185 -0
- package/dist/a2a/types.js +3 -0
- package/dist/actions/generated/mailbox/actions.json +592 -0
- package/dist/actions/generated/mailbox/commands.json +181 -0
- package/dist/actions/generated/mailbox/mcp.json +454 -0
- package/dist/actions/generated/mailbox-tools/tools.json +516 -0
- package/dist/arc/attention-types.js +8 -0
- package/dist/arc/cares.js +360 -0
- package/dist/arc/episodes.js +118 -0
- package/dist/arc/evolution.js +490 -0
- package/dist/arc/flight-recorder.js +1009 -0
- package/dist/arc/intentions.js +134 -0
- package/dist/arc/json-store.js +117 -0
- package/dist/arc/obligations.js +386 -0
- package/dist/arc/packets.js +336 -0
- package/dist/arc/presence.js +185 -0
- package/dist/arc/task-lifecycle.js +57 -0
- package/dist/commerce/store.js +755 -0
- package/dist/commerce/types.js +3 -0
- package/dist/eval/assertions/index.js +378 -0
- package/dist/eval/billing-guard.js +23 -0
- package/dist/eval/budget.js +142 -0
- package/dist/eval/domain/case.js +115 -0
- package/dist/eval/domain/stats.js +19 -0
- package/dist/eval/guest-entry.js +18 -0
- package/dist/eval/h-guest-entry.js +19 -0
- package/dist/eval/interview-entry.js +174 -0
- package/dist/eval/interview-grade-entry.js +36 -0
- package/dist/eval/interview-guest-entry.js +19 -0
- package/dist/eval/interviews/allocation.js +90 -0
- package/dist/eval/interviews/final.js +133 -0
- package/dist/eval/interviews/grader.js +209 -0
- package/dist/eval/interviews/guest/arms.js +173 -0
- package/dist/eval/interviews/guest/ax/ax-command.js +792 -0
- package/dist/eval/interviews/guest/ax/effects.js +51 -0
- package/dist/eval/interviews/guest/ax/exit-codes.js +51 -0
- package/dist/eval/interviews/guest/ax/help.js +181 -0
- package/dist/eval/interviews/guest/ax/mcp.js +246 -0
- package/dist/eval/interviews/guest/ax/outcome.js +211 -0
- package/dist/eval/interviews/guest/ax/output.js +53 -0
- package/dist/eval/interviews/guest/ax/precise-copy.js +200 -0
- package/dist/eval/interviews/guest/ax/problem.js +95 -0
- package/dist/eval/interviews/guest/ax/voice.js +83 -0
- package/dist/eval/interviews/guest/ax/wait.js +158 -0
- package/dist/eval/interviews/guest/books-core.js +54 -0
- package/dist/eval/interviews/guest/cli-shell.js +267 -0
- package/dist/eval/interviews/guest/h/codex.js +201 -0
- package/dist/eval/interviews/guest/h/fidelity.js +59 -0
- package/dist/eval/interviews/guest/h/openhands.js +176 -0
- package/dist/eval/interviews/guest/h/run.js +99 -0
- package/dist/eval/interviews/guest/h/wire.js +403 -0
- package/dist/eval/interviews/guest/loop.js +87 -0
- package/dist/eval/interviews/guest/operations.js +108 -0
- package/dist/eval/interviews/guest/run.js +81 -0
- package/dist/eval/interviews/guest/u/arms.js +268 -0
- package/dist/eval/interviews/h/kit.js +119 -0
- package/dist/eval/interviews/latch.js +143 -0
- package/dist/eval/interviews/protocol.js +120 -0
- package/dist/eval/interviews/rewrite.js +57 -0
- package/dist/eval/interviews/runner.js +354 -0
- package/dist/eval/interviews/u/kit.js +117 -0
- package/dist/eval/kill-switch.js +33 -0
- package/dist/eval/month-ledger.js +95 -0
- package/dist/eval/readback/hedges.js +39 -0
- package/dist/eval/remote-entry.js +32 -0
- package/dist/eval/report.js +85 -0
- package/dist/eval/run-command.js +188 -0
- package/dist/eval/run-entry.js +93 -0
- package/dist/eval/sandbox/agent-profile.js +74 -0
- package/dist/eval/sandbox/declared-gaps.js +17 -0
- package/dist/eval/sandbox/docker.js +353 -0
- package/dist/eval/sandbox/guest.js +55 -0
- package/dist/eval/sandbox/host-lock.js +62 -0
- package/dist/eval/sandbox/images.js +39 -0
- package/dist/eval/sandbox/oracle.js +32 -0
- package/dist/eval/sandbox/projection.js +127 -0
- package/dist/eval/sandbox/readback.js +137 -0
- package/dist/eval/sandbox/remote.js +102 -0
- package/dist/eval/sandbox/slugger-projection.js +377 -0
- package/dist/eval/self-test.js +84 -0
- package/dist/eval/stop-command.js +71 -0
- package/dist/eval/stop-entry.js +46 -0
- package/dist/eval/targets/index.js +127 -0
- package/dist/eval/transport/provider-proxy.js +262 -0
- package/dist/eval/transport/synthetic-sanctuary.js +111 -0
- package/dist/eval/transport/telegram-turn.js +241 -0
- package/dist/eval/watch/cli.js +63 -0
- package/dist/eval/watch/guarded-fs.js +254 -0
- package/dist/eval/watch/log-reader.js +99 -0
- package/dist/eval/watch/rows.js +143 -0
- package/dist/eval/watch/run-watch.js +160 -0
- package/dist/eval/watch-entry.js +26 -0
- package/dist/gateway/keys.js +117 -0
- package/dist/gateway/server.js +429 -0
- package/dist/heart/active-work.js +421 -45
- package/dist/heart/agent-entry.js +255 -4
- package/dist/heart/approval-files.js +94 -0
- package/dist/heart/approval-store.js +1000 -0
- package/dist/heart/atomic-file.js +115 -0
- package/dist/heart/attachments/downloaded-store.js +89 -0
- package/dist/heart/attachments/image-normalize.js +201 -0
- package/dist/heart/attachments/materialize.js +97 -0
- package/dist/heart/attachments/originals.js +102 -0
- package/dist/heart/attachments/render.js +29 -0
- package/dist/heart/attachments/sources/bluebubbles.js +155 -0
- package/dist/heart/attachments/sources/cli-local-file.js +78 -0
- package/dist/heart/attachments/sources/downloaded.js +76 -0
- package/dist/heart/attachments/sources/index.js +19 -0
- package/dist/heart/attachments/store.js +132 -0
- package/dist/heart/attachments/transcribe-audio.js +231 -0
- package/dist/heart/attachments/types.js +93 -0
- package/dist/heart/attachments/understand.js +195 -0
- package/dist/heart/auth/auth-flow.js +589 -0
- package/dist/heart/auth/github-device-login.js +104 -0
- package/dist/heart/autonomy-budget.js +426 -0
- package/dist/heart/awaiting/a2a-await-delivery.js +109 -0
- package/dist/heart/awaiting/await-alert.js +152 -0
- package/dist/heart/awaiting/await-expiry.js +143 -0
- package/dist/heart/awaiting/await-loader.js +91 -0
- package/dist/heart/awaiting/await-parser.js +152 -0
- package/dist/heart/awaiting/await-runtime-state.js +130 -0
- package/dist/heart/awaiting/await-scheduler.js +462 -0
- package/dist/heart/background-operations.js +281 -0
- package/dist/heart/bluebubbles-host-account.js +78 -0
- package/dist/heart/bridges/manager.js +137 -17
- package/dist/heart/bridges/store.js +14 -2
- package/dist/heart/bundle-state.js +168 -0
- package/dist/heart/chat-interaction.js +69 -0
- package/dist/heart/commitments.js +44 -14
- package/dist/heart/config-registry.js +340 -0
- package/dist/heart/config.js +191 -140
- package/dist/heart/context-loss-gauntlet.js +387 -0
- package/dist/heart/context-loss-sentinel.js +1206 -0
- package/dist/heart/core.js +2760 -695
- package/dist/heart/cross-chat-delivery.js +29 -22
- package/dist/heart/daemon/agent-config-check.js +494 -0
- package/dist/heart/daemon/agent-discovery.js +304 -3
- package/dist/heart/daemon/agent-home.js +409 -0
- package/dist/heart/daemon/agent-service.js +210 -28
- package/dist/heart/daemon/agentic-repair.js +548 -0
- package/dist/heart/daemon/app-sessions-record.js +82 -0
- package/dist/heart/daemon/await-private-wake.js +59 -0
- package/dist/heart/daemon/bluebubbles-cli-integration.js +71 -0
- package/dist/heart/daemon/bluebubbles-health-diagnostics.js +122 -0
- package/dist/heart/daemon/bluebubbles-host-protocol.js +433 -0
- package/dist/heart/daemon/bluebubbles-host.js +273 -0
- package/dist/heart/daemon/boot-sync-probe.js +223 -0
- package/dist/heart/daemon/cadence.js +110 -0
- package/dist/heart/daemon/cli-arg-redaction.js +26 -0
- package/dist/heart/daemon/cli-commands/a2a.js +26 -0
- package/dist/heart/daemon/cli-commands/cards.js +68 -0
- package/dist/heart/daemon/cli-commands/coding-tools.js +13 -0
- package/dist/heart/daemon/cli-commands/desk.js +43 -0
- package/dist/heart/daemon/cli-commands/dns.js +13 -0
- package/dist/heart/daemon/cli-commands/entry-points.js +182 -0
- package/dist/heart/daemon/cli-commands/failure-code.js +11 -0
- package/dist/heart/daemon/cli-commands/friends.js +18 -0
- package/dist/heart/daemon/cli-commands/habits.js +15 -0
- package/dist/heart/daemon/cli-commands/lifecycle.js +42 -0
- package/dist/heart/daemon/cli-commands/mail.js +11 -0
- package/dist/heart/daemon/cli-commands/mind.js +25 -0
- package/dist/heart/daemon/cli-commands/presence.js +28 -0
- package/dist/heart/daemon/cli-commands/providers.js +20 -0
- package/dist/heart/daemon/cli-commands/rsvp.js +20 -0
- package/dist/heart/daemon/cli-commands/shepherd.js +17 -0
- package/dist/heart/daemon/cli-commands/vault.js +23 -0
- package/dist/heart/daemon/cli-defaults.js +997 -0
- package/dist/heart/daemon/cli-desk.js +346 -0
- package/dist/heart/daemon/cli-exec.js +9688 -0
- package/dist/heart/daemon/cli-gate.js +198 -0
- package/dist/heart/daemon/cli-help.js +800 -0
- package/dist/heart/daemon/cli-manifest.js +115 -0
- package/dist/heart/daemon/cli-parse.js +3635 -0
- package/dist/heart/daemon/cli-render-doctor.js +57 -0
- package/dist/heart/daemon/cli-render.js +816 -0
- package/dist/heart/daemon/cli-types.js +8 -0
- package/dist/heart/daemon/compile-cache.js +69 -0
- package/dist/heart/daemon/connect-bay.js +323 -0
- package/dist/heart/daemon/container-credential-bootstrap.js +273 -0
- package/dist/heart/daemon/container-healthcheck.js +123 -0
- package/dist/heart/daemon/container-runtime.js +97 -0
- package/dist/heart/daemon/container-spec-auditor-main.js +187 -0
- package/dist/heart/daemon/container-spec-auditor.js +261 -0
- package/dist/heart/daemon/daemon-bootstrap-startup.js +115 -0
- package/dist/heart/daemon/daemon-cli.js +29 -3163
- package/dist/heart/daemon/daemon-entry.js +1074 -55
- package/dist/heart/daemon/daemon-health.js +51 -1
- package/dist/heart/daemon/daemon-rollup.js +57 -0
- package/dist/heart/daemon/daemon-runtime-sync.js +147 -13
- package/dist/heart/daemon/daemon-tombstone.js +116 -3
- package/dist/heart/daemon/daemon.js +1983 -131
- package/dist/heart/daemon/desk-admin.js +420 -0
- package/dist/heart/daemon/dns-workflow.js +394 -0
- package/dist/heart/daemon/doctor-types.js +8 -0
- package/dist/heart/daemon/doctor.js +1890 -0
- package/dist/heart/daemon/freshness.js +345 -0
- package/dist/heart/daemon/habit-private-wake.js +61 -0
- package/dist/heart/daemon/health-monitor.js +242 -12
- package/dist/heart/daemon/home-filesystem.js +93 -0
- package/dist/heart/daemon/hook-post-tool-use.js +149 -0
- package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +135 -1
- package/dist/heart/daemon/http-health-probe.js +80 -0
- package/dist/heart/daemon/human-command-screens.js +234 -0
- package/dist/heart/daemon/human-readiness.js +114 -0
- package/dist/heart/daemon/inner-status.js +7 -18
- package/dist/heart/daemon/interactive-repair.js +394 -0
- package/dist/heart/daemon/launchd.js +40 -8
- package/dist/heart/daemon/linux-service.js +382 -0
- package/dist/heart/daemon/log-tailer.js +79 -10
- package/dist/heart/daemon/logs-prune.js +132 -0
- package/dist/heart/daemon/mailroom-copy-proof.js +158 -0
- package/dist/heart/daemon/mcp-canary.js +525 -0
- package/dist/heart/daemon/message-router.js +65 -5
- package/dist/heart/daemon/migrate-to-desk.js +848 -0
- package/dist/heart/daemon/os-cron-deps.js +5 -0
- package/dist/heart/daemon/os-cron.js +45 -15
- package/dist/heart/daemon/ouro-bot-entry.js +8 -3
- package/dist/heart/daemon/ouro-cli-main.js +50 -0
- package/dist/heart/daemon/ouro-entry.js +43 -20
- package/dist/heart/daemon/plugin-cli.js +432 -0
- package/dist/heart/daemon/portable-git-install.js +265 -0
- package/dist/heart/daemon/portable-git.js +179 -0
- package/dist/heart/daemon/presence-daemon.js +265 -0
- package/dist/heart/daemon/presence-roster.js +260 -0
- package/dist/heart/daemon/presence.js +469 -0
- package/dist/heart/daemon/process-manager.js +790 -71
- package/dist/heart/daemon/process-tree.js +109 -0
- package/dist/heart/daemon/provider-discovery.js +171 -0
- package/dist/heart/daemon/provider-ping-progress.js +83 -0
- package/dist/heart/daemon/prunable-bundle.js +144 -0
- package/dist/heart/daemon/pulse.js +511 -0
- package/dist/heart/daemon/readiness-repair.js +365 -0
- package/dist/heart/daemon/run-hooks.js +2 -0
- package/dist/heart/daemon/runtime-logging.js +54 -14
- package/dist/heart/daemon/runtime-metadata.js +2 -30
- package/dist/heart/daemon/runtime-mode.js +13 -2
- package/dist/heart/daemon/runtime-replacement-handoff.js +207 -0
- package/dist/heart/daemon/sanctuary-acceptance-adapter.js +2659 -0
- package/dist/heart/daemon/sanctuary-acceptance-harness.js +1832 -0
- package/dist/heart/daemon/sanctuary-acceptance-marker.js +267 -0
- package/dist/heart/daemon/sanctuary-acceptance-scenarios.js +956 -0
- package/dist/heart/daemon/sanctuary-authority-codec.js +86 -0
- package/dist/heart/daemon/sanctuary-authority-epoch.js +291 -0
- package/dist/heart/daemon/sanctuary-authority-installation.js +161 -0
- package/dist/heart/daemon/sanctuary-authority-ledger.js +241 -0
- package/dist/heart/daemon/sanctuary-authority-root-lifecycle.js +1370 -0
- package/dist/heart/daemon/sanctuary-authority-vault-migration.js +79 -0
- package/dist/heart/daemon/sanctuary-bundle-migration.js +974 -0
- package/dist/heart/daemon/sanctuary-host-authority.js +1008 -0
- package/dist/heart/daemon/sanctuary-host-detached-supervisor.js +493 -0
- package/dist/heart/daemon/sanctuary-host-executor.js +670 -0
- package/dist/heart/daemon/sanctuary-host-linux-kernel.js +334 -0
- package/dist/heart/daemon/sanctuary-host-supervisor-entry.js +210 -0
- package/dist/heart/daemon/sanctuary-host-supervisor.js +95 -0
- package/dist/heart/daemon/sanctuary-package-management.js +113 -0
- package/dist/heart/daemon/sanctuary-scheduler-liveness.js +227 -0
- package/dist/heart/daemon/sanctuary-scheduler-origin.js +132 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-entry.js +481 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-gateway.js +614 -0
- package/dist/heart/daemon/sanctuary-telegram-authority-service.js +763 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver-entry.js +97 -0
- package/dist/heart/daemon/sanctuary-telegram-test-driver.js +294 -0
- package/dist/heart/daemon/sense-manager.js +1071 -60
- package/dist/heart/daemon/skill-management-installer.js +1 -1
- package/dist/heart/daemon/socket-client.js +180 -12
- package/dist/heart/daemon/stale-bundle-prune.js +113 -0
- package/dist/heart/daemon/startup-tui.js +339 -0
- package/dist/heart/daemon/state-retention.js +234 -0
- package/dist/heart/daemon/supercronic-supervisor.js +282 -0
- package/dist/heart/daemon/task-scheduler.js +115 -15
- package/dist/heart/daemon/terminal-ui.js +503 -0
- package/dist/heart/daemon/thoughts.js +133 -49
- package/dist/heart/daemon/up-progress.js +366 -0
- package/dist/heart/daemon/vault-items.js +56 -0
- package/dist/heart/daemon/vault-outage.js +74 -0
- package/dist/heart/delegated-work-report.js +115 -0
- package/dist/heart/delegation.js +0 -3
- package/dist/heart/external-events/router.js +1556 -0
- package/dist/heart/failure-reports.js +398 -0
- package/dist/heart/file-lock.js +109 -0
- package/dist/heart/frontend-approval-runtime.js +506 -0
- package/dist/heart/frontend-journal.js +215 -0
- package/dist/heart/frontend-session-service.js +330 -0
- package/dist/heart/frontend-socket-client.js +173 -0
- package/dist/heart/frontend-socket.js +434 -0
- package/dist/heart/frontend-turn-errors.js +20 -0
- package/dist/heart/git-binary.js +115 -0
- package/dist/heart/habits/habit-cancel.js +810 -0
- package/dist/heart/habits/habit-lifecycle.js +1324 -0
- package/dist/heart/{daemon → habits}/habit-migration.js +41 -28
- package/dist/heart/habits/habit-parser.js +258 -0
- package/dist/heart/habits/habit-runtime-state.js +93 -0
- package/dist/heart/habits/habit-scheduler.js +667 -0
- package/dist/heart/habits/habit-session-summary.js +318 -0
- package/dist/heart/habits/habit-session.js +638 -0
- package/dist/heart/{daemon → hatch}/hatch-flow.js +60 -36
- package/dist/heart/{daemon → hatch}/hatch-specialist.js +6 -8
- package/dist/heart/{daemon → hatch}/specialist-prompt.js +10 -6
- package/dist/heart/hatch/specialist-tools.js +395 -0
- package/dist/heart/identity.js +384 -60
- package/dist/heart/kept-notes.js +289 -0
- package/dist/heart/letters/doors-tools.js +63 -0
- package/dist/heart/letters/doors.js +436 -0
- package/dist/heart/letters/letter-index.js +89 -0
- package/dist/heart/letters/letter.js +247 -0
- package/dist/heart/letters/store.js +210 -0
- package/dist/heart/letters/writer.js +298 -0
- package/dist/heart/machine-identity.js +175 -0
- package/dist/heart/mail-import-discovery.js +356 -0
- package/dist/heart/mcp/mcp-server.js +922 -0
- package/dist/heart/migrate-config.js +100 -0
- package/dist/heart/model-capabilities.js +98 -16
- package/dist/heart/model-limits.js +49 -0
- package/dist/heart/optional-packages.js +77 -0
- package/dist/heart/orientation-frame.js +393 -0
- package/dist/heart/platform.js +81 -0
- package/dist/heart/primitives.js +1 -1
- package/dist/heart/private-runtime/decision-renderer.js +158 -0
- package/dist/heart/private-runtime/index.js +18 -0
- package/dist/heart/private-runtime/ledger.js +212 -0
- package/dist/heart/private-runtime/policy.js +303 -0
- package/dist/heart/private-runtime/types.js +2 -0
- package/dist/heart/progress-story.js +1 -1
- package/dist/heart/provider-attempt.js +137 -0
- package/dist/heart/provider-binding-resolver.js +273 -0
- package/dist/heart/provider-credentials.js +449 -0
- package/dist/heart/provider-failover.js +260 -37
- package/dist/heart/provider-fallback.js +228 -0
- package/dist/heart/provider-models.js +96 -0
- package/dist/heart/provider-ping-child.js +125 -0
- package/dist/heart/provider-ping-entry.js +8 -0
- package/dist/heart/provider-ping.js +217 -78
- package/dist/heart/provider-readiness-cache.js +119 -0
- package/dist/heart/provider-visibility.js +188 -0
- package/dist/heart/providers/account-pool.js +717 -0
- package/dist/heart/providers/anthropic-token.js +15 -47
- package/dist/heart/providers/anthropic.js +275 -80
- package/dist/heart/providers/azure.js +19 -31
- package/dist/heart/providers/error-classification.js +129 -0
- package/dist/heart/providers/github-copilot.js +131 -36
- package/dist/heart/providers/minimax-vlm.js +189 -0
- package/dist/heart/providers/minimax.js +19 -27
- package/dist/heart/providers/openai-codex-token.js +349 -0
- package/dist/heart/providers/openai-codex.js +46 -57
- package/dist/heart/providers/openai-compatible.js +177 -0
- package/dist/heart/quota/fleet-readings.js +222 -0
- package/dist/heart/quota/tranche.js +59 -0
- package/dist/heart/reach-channel.js +85 -0
- package/dist/heart/reply-style.js +52 -0
- package/dist/heart/run-ledger.js +247 -0
- package/dist/heart/runtime-capability-check.js +170 -0
- package/dist/heart/runtime-credentials.js +647 -0
- package/dist/heart/runtime-cwd.js +87 -0
- package/dist/heart/sense-truth.js +26 -4
- package/dist/heart/sent-message-ledger.js +98 -0
- package/dist/heart/session-activity.js +89 -23
- package/dist/heart/session-events.js +1609 -0
- package/dist/heart/session-playback-cli-main.js +10 -0
- package/dist/heart/session-playback-cli.js +36 -0
- package/dist/heart/session-playback.js +231 -0
- package/dist/heart/session-redaction-repair-cli-main.js +34 -0
- package/dist/heart/session-redaction-repair.js +552 -0
- package/dist/heart/session-stats-cli-main.js +10 -0
- package/dist/heart/session-stats.js +183 -0
- package/dist/heart/session-transcript.js +133 -0
- package/dist/heart/shelf-claims.js +136 -0
- package/dist/heart/shepherd/custody-types.js +2 -0
- package/dist/heart/shepherd/mandates.js +352 -0
- package/dist/heart/shepherd/operation-commands.js +19 -0
- package/dist/heart/shepherd/operations.js +139 -0
- package/dist/heart/shepherd/supervision-read.js +131 -0
- package/dist/heart/shepherd/supervision.js +114 -0
- package/dist/heart/shepherd/types.js +2 -0
- package/dist/heart/shepherd-config.js +113 -0
- package/dist/heart/source-grounding.js +313 -0
- package/dist/heart/sqlite.js +18 -0
- package/dist/heart/start-of-turn-packet.js +372 -0
- package/dist/heart/steward-policy.js +656 -0
- package/dist/heart/streaming.js +627 -193
- package/dist/heart/structured-output.js +196 -0
- package/dist/heart/sync-classification.js +176 -0
- package/dist/heart/sync-health.js +152 -0
- package/dist/heart/sync-lock.js +431 -0
- package/dist/heart/sync.js +1583 -0
- package/dist/heart/target-resolution.js +7 -7
- package/dist/heart/tempo.js +93 -0
- package/dist/heart/temporal-view.js +41 -0
- package/dist/heart/termination-guard.js +27 -0
- package/dist/heart/timeouts.js +101 -0
- package/dist/heart/tool-activity-callbacks.js +59 -0
- package/dist/heart/tool-approval.js +382 -0
- package/dist/heart/tool-description.js +155 -0
- package/dist/heart/tool-friction.js +55 -0
- package/dist/heart/tool-images.js +42 -0
- package/dist/heart/tool-loop.js +9 -3
- package/dist/heart/tool-output-budget.js +41 -0
- package/dist/heart/turn-context.js +503 -0
- package/dist/heart/turn-execution-lease.js +78 -0
- package/dist/heart/turn-summary.js +216 -0
- package/dist/heart/versioning/host-self-update.js +118 -0
- package/dist/heart/{daemon → versioning}/ouro-bot-global-installer.js +6 -5
- package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +3 -2
- package/dist/heart/versioning/ouro-path-installer.js +432 -0
- package/dist/heart/versioning/ouro-recovery-launcher.js +98 -0
- package/dist/heart/versioning/ouro-version-manager.js +432 -0
- package/dist/heart/versioning/release-sources.js +185 -0
- package/dist/heart/versioning/self-update-defaults.js +443 -0
- package/dist/heart/versioning/self-update.js +270 -0
- package/dist/heart/{daemon → versioning}/staged-restart.js +40 -8
- package/dist/heart/{daemon → versioning}/update-checker.js +12 -35
- package/dist/heart/versioning/update-hooks.js +160 -0
- package/dist/heart/versioning/update-state.js +134 -0
- package/dist/heart/versioning/updater-launchd.js +204 -0
- package/dist/heart/versioning/version-intent.js +114 -0
- package/dist/heart/work-card.js +380 -0
- package/dist/mailroom/attention.js +167 -0
- package/dist/mailroom/autonomy.js +209 -0
- package/dist/mailroom/azure-sdk.js +27 -0
- package/dist/mailroom/blob-store.js +991 -0
- package/dist/mailroom/body-cache.js +61 -0
- package/dist/mailroom/cache-sync-cli.js +58 -0
- package/dist/mailroom/core.js +813 -0
- package/dist/mailroom/entry.js +169 -0
- package/dist/mailroom/file-store.js +568 -0
- package/dist/mailroom/hosted-cache-sync.js +384 -0
- package/dist/mailroom/mbox-import.js +393 -0
- package/dist/mailroom/migration.js +164 -0
- package/dist/mailroom/outbound.js +380 -0
- package/dist/mailroom/policy.js +263 -0
- package/dist/mailroom/reader.js +308 -0
- package/dist/mailroom/search-cache.js +513 -0
- package/dist/mailroom/search-relevance.js +319 -0
- package/dist/mailroom/smtp-ingress.js +176 -0
- package/dist/mailroom/source-state.js +176 -0
- package/dist/mailroom/sweep-orphans-cli.js +34 -0
- package/dist/mailroom/thread.js +109 -0
- package/dist/mailroom/travel-extract.js +89 -0
- package/dist/mind/bundle-manifest.js +25 -4
- package/dist/mind/context.js +335 -198
- package/dist/mind/desk-section.js +332 -0
- package/dist/mind/diary-integrity.js +60 -0
- package/dist/mind/diary.js +31 -53
- package/dist/mind/embedding-provider.js +60 -0
- package/dist/mind/file-state.js +179 -0
- package/dist/mind/friend-link-codes.js +209 -0
- package/dist/mind/friend-merge.js +336 -0
- package/dist/mind/house-names.js +43 -0
- package/dist/mind/note-search.js +198 -0
- package/dist/mind/obligation-steering.js +15 -9
- package/dist/mind/outbound-record.js +176 -0
- package/dist/mind/pending.js +294 -11
- package/dist/mind/prompt-budget.js +511 -0
- package/dist/mind/prompt-refresh.js +3 -2
- package/dist/mind/prompt.js +953 -370
- package/dist/mind/provenance-trust.js +26 -0
- package/dist/mind/record-paths.js +312 -0
- package/dist/mind/scrutiny.js +121 -0
- package/dist/mind/session-transaction.js +642 -0
- package/dist/mind/token-estimate.js +17 -0
- package/dist/mind/where-am-i.js +176 -0
- package/dist/nerves/cli-logging.js +7 -1
- package/dist/nerves/coverage/audit-rules.js +15 -6
- package/dist/nerves/coverage/audit.js +28 -2
- package/dist/nerves/coverage/cli-main.js +6 -1
- package/dist/nerves/coverage/cli.js +1 -1
- package/dist/nerves/coverage/contract.js +5 -5
- package/dist/nerves/coverage/file-completeness.js +153 -5
- package/dist/nerves/coverage/run-artifacts.js +55 -35
- package/dist/nerves/coverage/source-scanner.js +4 -4
- package/dist/nerves/index.js +266 -30
- package/dist/nerves/observation.js +18 -0
- package/dist/nerves/redact.js +79 -0
- package/dist/nerves/review/cli-main.js +10 -0
- package/dist/nerves/review/cli.js +156 -0
- package/dist/nerves/review/core.js +159 -0
- package/dist/nerves/runtime.js +16 -1
- package/dist/repertoire/ado-client.js +15 -56
- package/dist/repertoire/ado-semantic.js +108 -40
- package/dist/repertoire/api-client.js +97 -0
- package/dist/repertoire/auth-required.js +22 -0
- package/dist/repertoire/bitwarden-native.js +458 -0
- package/dist/repertoire/bitwarden-store.js +1296 -0
- package/dist/repertoire/bundle-templates.js +71 -0
- package/dist/repertoire/bw-installer.js +268 -0
- package/dist/repertoire/coding/context-pack.js +80 -3
- package/dist/repertoire/coding/feedback.js +27 -26
- package/dist/repertoire/coding/index.js +63 -6
- package/dist/repertoire/coding/manager.js +31 -14
- package/dist/repertoire/coding/orca-client.js +194 -0
- package/dist/repertoire/coding/orca-manager.js +460 -0
- package/dist/repertoire/coding/router.js +124 -0
- package/dist/repertoire/coding/spawner.js +3 -2
- package/dist/repertoire/coding/tools.js +178 -34
- package/dist/repertoire/coding/workbench-client.js +272 -0
- package/dist/repertoire/coding/workbench-manager.js +404 -0
- package/dist/repertoire/commerce-errors.js +109 -0
- package/dist/repertoire/commerce-self-test.js +156 -0
- package/dist/repertoire/credential-access.js +183 -0
- package/dist/repertoire/desk/classifier.js +362 -0
- package/dist/repertoire/desk-mcp.js +140 -0
- package/dist/repertoire/duffel-client.js +185 -0
- package/dist/repertoire/github-client.js +14 -55
- package/dist/repertoire/graph-client.js +11 -52
- package/dist/repertoire/guardrails.js +1174 -70
- package/dist/repertoire/house-sweep.js +471 -0
- package/dist/repertoire/in-turn-tools-door.js +55 -0
- package/dist/repertoire/mcp-client.js +58 -5
- package/dist/repertoire/mcp-declared-tools.js +156 -0
- package/dist/repertoire/mcp-manager.js +457 -141
- package/dist/repertoire/mcp-tools.js +199 -0
- package/dist/repertoire/mcp-write-guard.js +85 -0
- package/dist/repertoire/plugin-mcp.js +175 -0
- package/dist/repertoire/plugins.js +253 -0
- package/dist/repertoire/relationship-authorization.js +322 -0
- package/dist/repertoire/sanctuary-container-policy.js +50 -0
- package/dist/repertoire/shell-sessions.js +136 -0
- package/dist/repertoire/skill-search.js +177 -0
- package/dist/repertoire/skill-summaries.js +129 -0
- package/dist/repertoire/skills.js +34 -4
- package/dist/repertoire/stripe-client.js +163 -0
- package/dist/repertoire/tool-arguments.js +180 -0
- package/dist/repertoire/tool-candidates.js +50 -0
- package/dist/repertoire/tool-catalog.js +228 -0
- package/dist/repertoire/tool-error-code.js +30 -0
- package/dist/repertoire/tool-limits.js +20 -0
- package/dist/repertoire/tool-results.js +29 -0
- package/dist/repertoire/tools-a2a.js +792 -0
- package/dist/repertoire/tools-app-sessions.js +219 -0
- package/dist/repertoire/tools-attachments.js +302 -0
- package/dist/repertoire/tools-awaiting.js +934 -0
- package/dist/repertoire/tools-base.js +85 -1420
- package/dist/repertoire/tools-bridge.js +153 -0
- package/dist/repertoire/tools-bundle.js +998 -0
- package/dist/repertoire/tools-chat.js +185 -0
- package/dist/repertoire/tools-commerce.js +272 -0
- package/dist/repertoire/tools-config.js +199 -0
- package/dist/repertoire/tools-continuity.js +648 -0
- package/dist/repertoire/tools-credential.js +410 -0
- package/dist/repertoire/tools-escalation.js +98 -0
- package/dist/repertoire/tools-evolution.js +560 -0
- package/dist/repertoire/tools-files.js +521 -0
- package/dist/repertoire/tools-flight.js +313 -0
- package/dist/repertoire/tools-flow.js +169 -0
- package/dist/repertoire/tools-friend-link.js +65 -0
- package/dist/repertoire/tools-github.js +11 -4
- package/dist/repertoire/tools-habits.js +111 -0
- package/dist/repertoire/tools-house-care.js +190 -0
- package/dist/repertoire/tools-mail.js +1928 -0
- package/dist/repertoire/tools-notes.js +567 -0
- package/dist/repertoire/tools-obligations.js +187 -0
- package/dist/repertoire/tools-orientation.js +36 -0
- package/dist/repertoire/tools-record.js +497 -0
- package/dist/repertoire/tools-rsvp.js +148 -0
- package/dist/repertoire/tools-runtime.js +260 -0
- package/dist/repertoire/tools-sanctuary-host.js +213 -0
- package/dist/repertoire/tools-session.js +1190 -0
- package/dist/repertoire/tools-shell.js +275 -0
- package/dist/repertoire/tools-shepherd-guidance.js +183 -0
- package/dist/repertoire/tools-shepherd.js +369 -0
- package/dist/repertoire/tools-steward-policy.js +157 -0
- package/dist/repertoire/tools-stripe.js +244 -0
- package/dist/repertoire/tools-surface.js +553 -0
- package/dist/repertoire/tools-teams.js +67 -17
- package/dist/repertoire/tools-telegram-contacts.js +41 -0
- package/dist/repertoire/tools-travel.js +142 -0
- package/dist/repertoire/tools-trip.js +1041 -0
- package/dist/repertoire/tools-unraid.js +627 -0
- package/dist/repertoire/tools-user-profile.js +166 -0
- package/dist/repertoire/tools-vault.js +46 -0
- package/dist/repertoire/tools-voice-local.js +210 -0
- package/dist/repertoire/tools-voice.js +153 -0
- package/dist/repertoire/tools-web.js +238 -0
- package/dist/repertoire/tools.js +614 -288
- package/dist/repertoire/travel-api-client.js +463 -0
- package/dist/repertoire/unraid-client.js +155 -0
- package/dist/repertoire/unraid-restart.js +342 -0
- package/dist/repertoire/user-profile.js +131 -0
- package/dist/repertoire/vault-setup.js +298 -0
- package/dist/repertoire/vault-unlock.js +816 -0
- package/dist/rsvp/aisleplanner-client.js +354 -0
- package/dist/rsvp/cli.js +936 -0
- package/dist/rsvp/config.js +327 -0
- package/dist/rsvp/cutover.js +453 -0
- package/dist/rsvp/diagnostics.js +232 -0
- package/dist/rsvp/diff-renderer.js +176 -0
- package/dist/rsvp/habit-policy.js +109 -0
- package/dist/rsvp/habit-stage.js +122 -0
- package/dist/rsvp/incident-bundle.js +97 -0
- package/dist/rsvp/migration.js +204 -0
- package/dist/rsvp/native-habit-runner.js +621 -0
- package/dist/rsvp/outbound-state.js +628 -0
- package/dist/rsvp/query.js +118 -0
- package/dist/rsvp/replay.js +233 -0
- package/dist/rsvp/snapshot.js +232 -0
- package/dist/rsvp/spend-ledger.js +175 -0
- package/dist/scripts/claude-code-stop-hook.js +4 -3
- package/dist/senses/a2a-entry.js +145 -0
- package/dist/senses/acp-server.js +386 -0
- package/dist/senses/app-sessions/client.js +128 -0
- package/dist/senses/app-sessions/digest-cards.js +263 -0
- package/dist/senses/app-sessions/digest-push.js +108 -0
- package/dist/senses/app-sessions/digest-sources.js +204 -0
- package/dist/senses/app-sessions/digest.js +284 -0
- package/dist/senses/app-sessions/run-command.js +51 -0
- package/dist/senses/app-sessions/sense.js +242 -0
- package/dist/senses/app-sessions/shepherd-cli.js +166 -0
- package/dist/senses/app-sessions/shepherd-rows.js +67 -0
- package/dist/senses/app-sessions/store.js +149 -0
- package/dist/senses/app-sessions/waiting-prompts.js +137 -0
- package/dist/senses/app-sessions/waiting-status.js +23 -0
- package/dist/senses/app-sessions-entry.js +87 -0
- package/dist/senses/attention-queue.js +95 -6
- package/dist/senses/await-turn-message.js +65 -0
- package/dist/senses/bluebubbles/active-turns.js +241 -0
- package/dist/senses/bluebubbles/attachment-cache.js +53 -0
- package/dist/senses/bluebubbles/attachment-download.js +143 -0
- package/dist/senses/{bluebubbles-client.js → bluebubbles/client.js} +391 -49
- package/dist/senses/bluebubbles/context-packet.js +207 -0
- package/dist/senses/bluebubbles/context-smoke.js +144 -0
- package/dist/senses/bluebubbles/entry.js +80 -0
- package/dist/senses/bluebubbles/host-account-verifier.js +113 -0
- package/dist/senses/{bluebubbles-inbound-log.js → bluebubbles/inbound-log.js} +21 -3
- package/dist/senses/bluebubbles/index.js +4663 -0
- package/dist/senses/bluebubbles/latest-turn.js +342 -0
- package/dist/senses/bluebubbles/media.js +255 -0
- package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +152 -30
- package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +24 -13
- package/dist/senses/bluebubbles/outbound-state.js +335 -0
- package/dist/senses/bluebubbles/processed-log.js +133 -0
- package/dist/senses/bluebubbles/reactions.js +18 -0
- package/dist/senses/bluebubbles/replay.js +284 -0
- package/dist/senses/{bluebubbles-runtime-state.js → bluebubbles/runtime-state.js} +47 -4
- package/dist/senses/bluebubbles/semantic-receipts.js +2014 -0
- package/dist/senses/bluebubbles/send-file.js +20 -0
- package/dist/senses/bluebubbles/send-health.js +126 -0
- package/dist/senses/{bluebubbles-session-cleanup.js → bluebubbles/session-cleanup.js} +1 -1
- package/dist/senses/bluebubbles/webhook-registration.js +257 -0
- package/dist/senses/bluebubbles-meta-guard.js +39 -0
- package/dist/senses/chat-file.js +75 -0
- package/dist/senses/cli/bracketed-paste.js +82 -0
- package/dist/senses/cli/image-paste.js +287 -0
- package/dist/senses/cli/image-ref-navigation.js +75 -0
- package/dist/senses/cli/ink-app.js +156 -0
- package/dist/senses/cli/inline-diff.js +64 -0
- package/dist/senses/cli/input-keys.js +209 -0
- package/dist/senses/cli/kill-ring.js +86 -0
- package/dist/senses/cli/message-list.js +51 -0
- package/dist/senses/cli/ouro-tui.js +633 -0
- package/dist/senses/cli/spinner-imperative.js +135 -0
- package/dist/senses/cli/spinner.js +101 -0
- package/dist/senses/cli/status-line.js +60 -0
- package/dist/senses/cli/streaming-markdown.js +526 -0
- package/dist/senses/cli/tool-display.js +85 -0
- package/dist/senses/cli/tool-render.js +85 -0
- package/dist/senses/cli/tui-store.js +252 -0
- package/dist/senses/cli/virtual-list.js +35 -0
- package/dist/senses/cli-entry.js +62 -9
- package/dist/senses/cli.js +627 -350
- package/dist/senses/commands.js +66 -3
- package/dist/senses/context-packet-ledger.js +367 -0
- package/dist/senses/context-packets.js +154 -0
- package/dist/senses/habit-lifecycle-guard.js +24 -0
- package/dist/senses/habit-turn-message.js +160 -0
- package/dist/senses/inbound-journal.js +186 -0
- package/dist/senses/ingress-evidence.js +2 -0
- package/dist/senses/mail-entry.js +69 -0
- package/dist/senses/mail.js +524 -0
- package/dist/senses/ordinary-owner-decision.js +98 -0
- package/dist/senses/pipeline.js +1216 -289
- package/dist/senses/private-runtime-worker.js +820 -0
- package/dist/senses/private-runtime.js +1648 -0
- package/dist/senses/proactive-content-guard.js +51 -0
- package/dist/senses/program-status.js +155 -0
- package/dist/senses/repeat-while.js +36 -0
- package/dist/senses/root-host-approval-port.js +345 -0
- package/dist/senses/root-host-approval-runtime.js +393 -0
- package/dist/senses/sanctuary-authority-resident.js +102 -0
- package/dist/senses/sanctuary-download-credit-presentation.js +31 -0
- package/dist/senses/sanctuary-full-visibility-contract.js +302 -0
- package/dist/senses/sanctuary-grounding.js +118 -0
- package/dist/senses/sanctuary-health-acceptance-probe-entry.js +21 -0
- package/dist/senses/sanctuary-health-acceptance-probe.js +802 -0
- package/dist/senses/sanctuary-health-runner.js +106 -0
- package/dist/senses/sanctuary-health.js +442 -0
- package/dist/senses/sanctuary-house.js +97 -0
- package/dist/senses/sanctuary-install-state-contract.js +169 -0
- package/dist/senses/sanctuary-interactive-control.js +410 -0
- package/dist/senses/sanctuary-media-catalog-contract.js +268 -0
- package/dist/senses/sanctuary-media-optimization.js +517 -0
- package/dist/senses/sanctuary-runtime.js +392 -0
- package/dist/senses/sanctuary-sab.js +85 -0
- package/dist/senses/sanctuary-storage-optimization-contract.js +32 -0
- package/dist/senses/sense-shutdown.js +72 -0
- package/dist/senses/shared-turn.js +741 -97
- package/dist/senses/shepherd/agent-presentation.js +88 -0
- package/dist/senses/shepherd/attention-page.js +166 -0
- package/dist/senses/shepherd/attention-sidebar.js +76 -0
- package/dist/senses/shepherd/attention.js +295 -0
- package/dist/senses/shepherd/checkin-config.js +76 -0
- package/dist/senses/shepherd/checkin-store.js +383 -0
- package/dist/senses/shepherd/client.js +196 -0
- package/dist/senses/shepherd/cmux.js +483 -0
- package/dist/senses/shepherd/composer.js +336 -0
- package/dist/senses/shepherd/conversation-hold.js +78 -0
- package/dist/senses/shepherd/feedback-reply.js +108 -0
- package/dist/senses/shepherd/feedback-source.js +20 -0
- package/dist/senses/shepherd/feedback-store.js +328 -0
- package/dist/senses/shepherd/feedback-submit.js +182 -0
- package/dist/senses/shepherd/feedback-worker.js +208 -0
- package/dist/senses/shepherd/guidance.js +273 -0
- package/dist/senses/shepherd/herdr.js +427 -0
- package/dist/senses/shepherd/host.js +14 -0
- package/dist/senses/shepherd/human-decision-guard.js +29 -0
- package/dist/senses/shepherd/judge-evaluation-command.js +185 -0
- package/dist/senses/shepherd/judge-evaluation-entry.js +20 -0
- package/dist/senses/shepherd/judge-evaluation.js +144 -0
- package/dist/senses/shepherd/judge.js +210 -0
- package/dist/senses/shepherd/notice-outbox.js +254 -0
- package/dist/senses/shepherd/observation-publisher.js +320 -0
- package/dist/senses/shepherd/operations-defaults.js +86 -0
- package/dist/senses/shepherd/operations.js +159 -0
- package/dist/senses/shepherd/owner-notice.js +496 -0
- package/dist/senses/shepherd/prompt-state.js +60 -0
- package/dist/senses/shepherd/recovery.js +543 -0
- package/dist/senses/shepherd/redact.js +66 -0
- package/dist/senses/shepherd/returns.js +79 -0
- package/dist/senses/shepherd/sense.js +862 -0
- package/dist/senses/shepherd/shepherd-judge-corpus-v1.json +170 -0
- package/dist/senses/shepherd/surface.js +125 -0
- package/dist/senses/shepherd/target-binding.js +13 -0
- package/dist/senses/shepherd/terminal-process.js +147 -0
- package/dist/senses/shepherd-entry.js +98 -0
- package/dist/senses/surface-tool.js +60 -34
- package/dist/senses/teams-attachments.js +68 -0
- package/dist/senses/teams-entry.js +80 -9
- package/dist/senses/teams-image.js +128 -0
- package/dist/senses/teams-inbound.js +76 -0
- package/dist/senses/teams-off-turn.js +199 -0
- package/dist/senses/teams-outbox.js +249 -0
- package/dist/senses/teams.js +1270 -378
- package/dist/senses/telegram-admission.js +700 -0
- package/dist/senses/telegram-approval-relay.js +293 -0
- package/dist/senses/telegram-approval-runtime.js +831 -0
- package/dist/senses/telegram-attachments.js +128 -0
- package/dist/senses/telegram-audit-ledger.js +220 -0
- package/dist/senses/telegram-authority-transport.js +233 -0
- package/dist/senses/telegram-chat-actions.js +57 -0
- package/dist/senses/telegram-client.js +1896 -0
- package/dist/senses/telegram-effect-adapter.js +892 -0
- package/dist/senses/telegram-entry.js +87 -0
- package/dist/senses/telegram-handoff.js +150 -0
- package/dist/senses/telegram-identity-key.js +143 -0
- package/dist/senses/telegram-markdown.js +331 -0
- package/dist/senses/telegram-owner-route.js +129 -0
- package/dist/senses/telegram.js +2789 -0
- package/dist/senses/terminal-handoff.js +44 -0
- package/dist/senses/trust-gate.js +104 -9
- package/dist/senses/turn-attempts.js +171 -0
- package/dist/senses/turn-watch.js +268 -0
- package/dist/senses/voice/audio-playback.js +237 -0
- package/dist/senses/voice/audio-routing.js +119 -0
- package/dist/senses/voice/call-auth.js +250 -0
- package/dist/senses/voice/elevenlabs.js +202 -0
- package/dist/senses/voice/floor-control.js +431 -0
- package/dist/senses/voice/floor-controller.js +115 -0
- package/dist/senses/voice/golden-path.js +116 -0
- package/dist/senses/voice/index.js +29 -0
- package/dist/senses/voice/local-audio-control.js +344 -0
- package/dist/senses/voice/local-audio-devices.js +516 -0
- package/dist/senses/voice/local-audio-disclosure.js +174 -0
- package/dist/senses/voice/local-audio-identity.js +103 -0
- package/dist/senses/voice/local-audio-join.js +325 -0
- package/dist/senses/voice/local-audio-mute.js +199 -0
- package/dist/senses/voice/local-audio-notify.js +124 -0
- package/dist/senses/voice/local-audio-prompts.js +116 -0
- package/dist/senses/voice/local-audio-transport.js +427 -0
- package/dist/senses/voice/local-audio.js +281 -0
- package/dist/senses/voice/local-media-stream.js +145 -0
- package/dist/senses/voice/meeting.js +113 -0
- package/dist/senses/voice/outbound.js +190 -0
- package/dist/senses/voice/phone.js +33 -0
- package/dist/senses/voice/playback.js +139 -0
- package/dist/senses/voice/process-guards.js +51 -0
- package/dist/senses/voice/realtime-eval.js +496 -0
- package/dist/senses/voice/realtime-tool-schema.js +195 -0
- package/dist/senses/voice/realtime-trace.js +531 -0
- package/dist/senses/voice/realtime-utterances.js +158 -0
- package/dist/senses/voice/transcript.js +70 -0
- package/dist/senses/voice/turn.js +219 -0
- package/dist/senses/voice/twilio-phone-runtime.js +836 -0
- package/dist/senses/voice/twilio-phone.js +5660 -0
- package/dist/senses/voice/types.js +2 -0
- package/dist/senses/voice/utterances.js +207 -0
- package/dist/senses/voice/whisper.js +153 -0
- package/dist/senses/voice-entry.js +84 -0
- package/dist/senses/voice-realtime-eval-command.js +99 -0
- package/dist/senses/voice-realtime-eval-entry.js +25 -0
- package/dist/senses/voice-twilio-entry.js +88 -0
- package/dist/trips/core.js +138 -0
- package/dist/trips/store.js +265 -0
- package/dist/util/frontmatter.js +69 -0
- package/node_modules/@ouro.bot/friends/LICENSE +201 -0
- package/node_modules/@ouro.bot/friends/README.md +687 -0
- package/node_modules/@ouro.bot/friends/actions/generated/mcp.json +1105 -0
- package/node_modules/@ouro.bot/friends/changelog.json +197 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.d.ts +39 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/a2a-message.js +54 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.d.ts +117 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/adapter.js +202 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.d.ts +50 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/agent-card.js +32 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.d.ts +38 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-key.js +120 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.d.ts +195 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-verifier.js +342 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/did-web.js +140 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.d.ts +62 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/envelope-binding.js +83 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/index.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/index.js +82 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/jcs.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/reachability.js +17 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.d.ts +15 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/roster-verify.js +61 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.d.ts +47 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/seal.js +95 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.d.ts +58 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sealed-envelope.js +113 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.d.ts +42 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sign.js +87 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.d.ts +5 -0
- package/node_modules/@ouro.bot/friends/dist/a2a-client/sodium.js +19 -0
- package/node_modules/@ouro.bot/friends/dist/account-roster.d.ts +52 -0
- package/node_modules/@ouro.bot/friends/dist/account-roster.js +108 -0
- package/node_modules/@ouro.bot/friends/dist/agent-peer.d.ts +26 -0
- package/node_modules/@ouro.bot/friends/dist/agent-peer.js +138 -0
- package/node_modules/@ouro.bot/friends/dist/audit.d.ts +42 -0
- package/node_modules/@ouro.bot/friends/dist/audit.js +86 -0
- package/node_modules/@ouro.bot/friends/dist/channel.d.ts +16 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/channel.js +83 -4
- package/node_modules/@ouro.bot/friends/dist/connect-authority.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/connect-authority.js +84 -0
- package/node_modules/@ouro.bot/friends/dist/connect.d.ts +56 -0
- package/node_modules/@ouro.bot/friends/dist/connect.js +163 -0
- package/node_modules/@ouro.bot/friends/dist/consent.d.ts +34 -0
- package/node_modules/@ouro.bot/friends/dist/consent.js +65 -0
- package/node_modules/@ouro.bot/friends/dist/coordination.d.ts +116 -0
- package/node_modules/@ouro.bot/friends/dist/coordination.js +329 -0
- package/node_modules/@ouro.bot/friends/dist/delegation-grant.d.ts +21 -0
- package/node_modules/@ouro.bot/friends/dist/delegation-grant.js +39 -0
- package/node_modules/@ouro.bot/friends/dist/file-bundle.d.ts +17 -0
- package/node_modules/@ouro.bot/friends/dist/file-bundle.js +27 -0
- package/node_modules/@ouro.bot/friends/dist/friend-lookup.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/friend-lookup.js +69 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.d.ts +19 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store-file.js +157 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/grant-store.js +8 -0
- package/node_modules/@ouro.bot/friends/dist/grants.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/grants.js +100 -0
- package/node_modules/@ouro.bot/friends/dist/group-context.d.ts +21 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/group-context.js +5 -4
- package/node_modules/@ouro.bot/friends/dist/identity.d.ts +17 -0
- package/node_modules/@ouro.bot/friends/dist/identity.js +68 -0
- package/node_modules/@ouro.bot/friends/dist/index.d.ts +73 -0
- package/node_modules/@ouro.bot/friends/dist/index.js +164 -0
- package/node_modules/@ouro.bot/friends/dist/link-identity.d.ts +14 -0
- package/node_modules/@ouro.bot/friends/dist/link-identity.js +157 -0
- package/node_modules/@ouro.bot/friends/dist/mailbox/index.d.ts +105 -0
- package/node_modules/@ouro.bot/friends/dist/mailbox/index.js +205 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.d.ts +2 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/bin.js +17 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.d.ts +40 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/dispatch.js +744 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/index.d.ts +6 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/index.js +14 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/run-main.js +59 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/schemas.js +23 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.d.ts +30 -0
- package/node_modules/@ouro.bot/friends/dist/mcp/server.js +195 -0
- package/node_modules/@ouro.bot/friends/dist/message.d.ts +93 -0
- package/node_modules/@ouro.bot/friends/dist/message.js +129 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.d.ts +89 -0
- package/node_modules/@ouro.bot/friends/dist/mission-result.js +207 -0
- package/node_modules/@ouro.bot/friends/dist/mission-share.d.ts +94 -0
- package/node_modules/@ouro.bot/friends/dist/mission-share.js +232 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.d.ts +18 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store-file.js +169 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/mission-store.js +9 -0
- package/node_modules/@ouro.bot/friends/dist/missions.d.ts +31 -0
- package/node_modules/@ouro.bot/friends/dist/missions.js +99 -0
- package/node_modules/@ouro.bot/friends/dist/notes.d.ts +11 -0
- package/node_modules/@ouro.bot/friends/dist/notes.js +90 -0
- package/node_modules/@ouro.bot/friends/dist/observability.d.ts +27 -0
- package/node_modules/@ouro.bot/friends/dist/observability.js +31 -0
- package/node_modules/@ouro.bot/friends/dist/outcomes.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/outcomes.js +51 -0
- package/node_modules/@ouro.bot/friends/dist/resolver.d.ts +59 -0
- package/node_modules/@ouro.bot/friends/dist/resolver.js +276 -0
- package/node_modules/@ouro.bot/friends/dist/results.d.ts +10 -0
- package/node_modules/@ouro.bot/friends/dist/results.js +2 -0
- package/node_modules/@ouro.bot/friends/dist/room.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/room.js +40 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-file.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-file.js +125 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-memory.d.ts +9 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store-memory.js +20 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store.d.ts +29 -0
- package/node_modules/@ouro.bot/friends/dist/roster-store.js +9 -0
- package/node_modules/@ouro.bot/friends/dist/roster-verifier.d.ts +23 -0
- package/node_modules/@ouro.bot/friends/dist/roster-verifier.js +47 -0
- package/node_modules/@ouro.bot/friends/dist/share.d.ts +113 -0
- package/node_modules/@ouro.bot/friends/dist/share.js +314 -0
- package/node_modules/@ouro.bot/friends/dist/standing.d.ts +83 -0
- package/node_modules/@ouro.bot/friends/dist/standing.js +111 -0
- package/node_modules/@ouro.bot/friends/dist/store-file.d.ts +82 -0
- package/node_modules/@ouro.bot/friends/dist/store-file.js +1089 -0
- package/node_modules/@ouro.bot/friends/dist/store.d.ts +43 -0
- package/node_modules/@ouro.bot/friends/dist/tokens.d.ts +10 -0
- package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/tokens.js +7 -4
- package/node_modules/@ouro.bot/friends/dist/trust-explanation.d.ts +22 -0
- package/node_modules/@ouro.bot/friends/dist/trust-explanation.js +90 -0
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.d.ts +16 -0
- package/node_modules/@ouro.bot/friends/dist/trust-mutation.js +67 -0
- package/node_modules/@ouro.bot/friends/dist/types.d.ts +333 -0
- package/node_modules/@ouro.bot/friends/dist/types.js +55 -0
- package/node_modules/@ouro.bot/friends/dist/util/cap-string.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/util/cap-string.js +35 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.d.ts +1 -0
- package/node_modules/@ouro.bot/friends/dist/util/safe-id.js +10 -0
- package/node_modules/@ouro.bot/friends/dist/verifier.d.ts +11 -0
- package/node_modules/@ouro.bot/friends/dist/verifier.js +29 -0
- package/node_modules/@ouro.bot/friends/dist/whoami.d.ts +7 -0
- package/node_modules/@ouro.bot/friends/dist/whoami.js +39 -0
- package/node_modules/@ouro.bot/friends/package.json +82 -0
- package/node_modules/libsodium/LICENSE +16 -0
- package/node_modules/libsodium/README.md +281 -0
- package/node_modules/libsodium/dist/modules/libsodium.js +1 -0
- package/node_modules/libsodium/dist/modules-esm/libsodium.mjs +1 -0
- package/node_modules/libsodium/package.json +54 -0
- package/node_modules/libsodium-wrappers/LICENSE +16 -0
- package/node_modules/libsodium-wrappers/README.md +281 -0
- package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.d.ts +2155 -0
- package/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js +1 -0
- package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.d.mts +2743 -0
- package/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.mjs +1 -0
- package/node_modules/libsodium-wrappers/package.json +74 -0
- package/npm-shrinkwrap.json +8789 -0
- package/package.json +97 -12
- package/skills/agent-commerce.md +116 -0
- package/skills/browser-navigation.md +120 -0
- package/skills/commerce-setup-guide.md +116 -0
- package/skills/commerce-setup.md +87 -0
- package/skills/configure-dev-tools.md +32 -14
- package/skills/sense-setup.md +56 -0
- package/skills/travel-planning.md +141 -0
- 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
- package/dist/heart/daemon/auth-flow.js +0 -457
- package/dist/heart/daemon/habit-parser.js +0 -119
- package/dist/heart/daemon/habit-scheduler.js +0 -366
- package/dist/heart/daemon/mcp-server.js +0 -591
- package/dist/heart/daemon/ouro-path-installer.js +0 -221
- package/dist/heart/daemon/ouro-version-manager.js +0 -171
- package/dist/heart/daemon/specialist-tools.js +0 -283
- package/dist/heart/daemon/update-hooks.js +0 -138
- package/dist/heart/obligations.js +0 -197
- package/dist/heart/session-recall.js +0 -216
- package/dist/mind/associative-recall.js +0 -287
- package/dist/mind/friends/resolver.js +0 -84
- package/dist/mind/friends/store-file.js +0 -190
- package/dist/mind/friends/trust-explanation.js +0 -74
- package/dist/mind/friends/types.js +0 -29
- package/dist/mind/journal-index.js +0 -161
- package/dist/mind/obligations.js +0 -134
- package/dist/repertoire/tasks/board.js +0 -134
- package/dist/repertoire/tasks/index.js +0 -224
- package/dist/repertoire/tasks/lifecycle.js +0 -80
- package/dist/repertoire/tasks/middleware.js +0 -65
- package/dist/repertoire/tasks/parser.js +0 -171
- package/dist/repertoire/tasks/scanner.js +0 -132
- package/dist/repertoire/tasks/transitions.js +0 -126
- package/dist/repertoire/tools-bluebubbles.js +0 -94
- package/dist/senses/bluebubbles-entry.js +0 -13
- package/dist/senses/bluebubbles-media.js +0 -339
- package/dist/senses/bluebubbles.js +0 -1268
- package/dist/senses/contextual-heartbeat.js +0 -106
- package/dist/senses/debug-activity.js +0 -154
- package/dist/senses/inner-dialog-worker.js +0 -154
- package/dist/senses/inner-dialog.js +0 -780
- package/subagents/README.md +0 -7
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
- /package/dist/{repertoire/tasks/types.js → heart/attachments/sources/adapter.js} +0 -0
- /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
- /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
- /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
- /package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +0 -0
- /package/{dist/mind/friends → node_modules/@ouro.bot/friends/dist}/store.js +0 -0
|
@@ -0,0 +1,1677 @@
|
|
|
1
|
+
// The boot script: one call that does session-start's mechanical steps and
|
|
2
|
+
// returns one JSON result, instead of a chain of prose steps the agent
|
|
3
|
+
// re-derives and re-runs by hand each session (boot-in-one-call, scope items
|
|
4
|
+
// 2, 3, 4, 5, 6, 8, 9, 11, 13).
|
|
5
|
+
//
|
|
6
|
+
// What it fixes:
|
|
7
|
+
// - the missing `--root` bug: `session-sync.js`'s CLI only reads `--root`
|
|
8
|
+
// or `$DESK`, but the hook's own root resolution never exports `$DESK`
|
|
9
|
+
// and never passes `--root`, so sync silently no-ops whenever the root
|
|
10
|
+
// comes from activation-config or host-project source. This module
|
|
11
|
+
// resolves the root itself and calls `syncWorkspace` in-process, so
|
|
12
|
+
// there is no argv boundary to drop the root across.
|
|
13
|
+
// - the RECOVERING-vs-ready contradiction: this module never calls the
|
|
14
|
+
// admission-controller readiness convergence `desk_status` does (slow,
|
|
15
|
+
// network-bound). It reports one `status` word derived only from the
|
|
16
|
+
// checks it actually ran, and lists what it could not finish under
|
|
17
|
+
// `pending` rather than blocking or guessing.
|
|
18
|
+
// - the opaque "1 task card with unreadable repos" line: `card_validation`
|
|
19
|
+
// below names the task (by redacted track/slug and stable handle) and
|
|
20
|
+
// the specific reason for every corrupted card, mirroring
|
|
21
|
+
// `runtime/workspace-tidy.js`'s `skippedIssue`/`cardLabel` pattern.
|
|
22
|
+
//
|
|
23
|
+
// Every step is independently wrapped: a step that throws degrades only
|
|
24
|
+
// that part of the result (an entry in `degraded`, the field left `null` or
|
|
25
|
+
// empty) and never stops the others from reporting. `active_tasks` and
|
|
26
|
+
// `card_validation` come from a plain filesystem walk (this module's own,
|
|
27
|
+
// mirroring `desk/active-tasks.js`'s scan without its terminal-status
|
|
28
|
+
// filter, since every card needs validating, not just the open ones) —
|
|
29
|
+
// never from the slow runtime status. A step that needs the network (the
|
|
30
|
+
// prereq probe's `gh auth status`, and push-account resolution) is bounded
|
|
31
|
+
// by an overall wall-clock budget; anything still unresolved when the
|
|
32
|
+
// budget runs out is reported under `pending`, never left to hang the
|
|
33
|
+
// whole call.
|
|
34
|
+
//
|
|
35
|
+
// `bootOnce` returns `{ boot_complete: true, status, degraded, pending,
|
|
36
|
+
// instructions, root, host, prereqs, sync, sync_summary, agents_md, agents_md_in_host_instructions, notes, active_tasks,
|
|
37
|
+
// card_validation, push_accounts }` (among others); `notes` is the open notes teammates left in this
|
|
38
|
+
// person's `_inbox/` (`inbox.js`), or null. The CLI prints it as readable
|
|
39
|
+
// text (`boot-text.js`) unless `--json` asks for this structure. `status` is one of "ready", "degraded" or
|
|
40
|
+
// "setup_required" — never two words, and `degraded` always lists why.
|
|
41
|
+
// `instructions` is the one list of next steps an agent acts on, each naming
|
|
42
|
+
// the task, repo or file it is about (it used to be mirrored by an `actions`
|
|
43
|
+
// list; nothing read that, and agents saw every line twice, so it is gone).
|
|
44
|
+
// There is no `export DESK` line either: an environment variable does not
|
|
45
|
+
// survive an agent's separate shell calls, so the instructions give the
|
|
46
|
+
// desk's absolute path to use directly. `boot_complete` is always `true`: it marks that
|
|
47
|
+
// the script finished and returned a complete result, not that everything
|
|
48
|
+
// it found is healthy.
|
|
49
|
+
|
|
50
|
+
import { execFile, spawn as nodeSpawn, spawnSync } from "node:child_process"
|
|
51
|
+
import { closeSync, existsSync, mkdirSync, openSync, readdirSync, readSync, realpathSync, writeFileSync } from "node:fs"
|
|
52
|
+
import * as os from "node:os"
|
|
53
|
+
import * as path from "node:path"
|
|
54
|
+
import { fileURLToPath } from "node:url"
|
|
55
|
+
|
|
56
|
+
import { defineCli, defineCommand } from "../lib/ouro-ui/registry/ouro/ax/ax-command.ts"
|
|
57
|
+
import { runCli } from "../lib/ouro-ui/registry/ouro/ax/cli.ts"
|
|
58
|
+
import { normalizeRemote } from "../factory/binding.js"
|
|
59
|
+
import { ghRunner, chooseAccount, signedInAccounts } from "../factory/flush.js"
|
|
60
|
+
import { PATTERNS } from "../factory/schema.js"
|
|
61
|
+
import { activeTasks } from "../desk/active-tasks.js"
|
|
62
|
+
import { folderHandle } from "../desk/handles.js"
|
|
63
|
+
import { loadFrontmatterParser } from "../desk/organization.js"
|
|
64
|
+
import { parseFrontmatterLite } from "../desk/frontmatter-lite.js"
|
|
65
|
+
import {
|
|
66
|
+
claudeBindingPath,
|
|
67
|
+
DESK_ROOT_NOT_FOUND,
|
|
68
|
+
resolveLocalPath,
|
|
69
|
+
} from "../util/paths.js"
|
|
70
|
+
import { redactCredentialLikeText, redactName } from "../util/redact.js"
|
|
71
|
+
import { shellQuote, shellQuotePath } from "../util/shell-quote.js"
|
|
72
|
+
import { readSmallText } from "../factory/marker.js"
|
|
73
|
+
import { readRemotes } from "../util/git-config-file.js"
|
|
74
|
+
import { startupChangesNothing } from "../factory/headless-flag.js"
|
|
75
|
+
import { isNoninteractive } from "../factory/session-kind.js"
|
|
76
|
+
import { improvementPerson } from "../desk/improvement-person.js"
|
|
77
|
+
import { memberMessage, resolveMember } from "../desk/crew-member.js"
|
|
78
|
+
import { personAgentsCap } from "./agents-md.js"
|
|
79
|
+
import { shelfIndex } from "./lessons-shelf.js"
|
|
80
|
+
import { openNotes } from "./inbox.js"
|
|
81
|
+
import { runtimeResolverFailure } from "../desk/runtime-resolver.js"
|
|
82
|
+
import { LIFECYCLE_STATES, TERMINAL_STATES } from "../desk/lifecycle.js"
|
|
83
|
+
import { healthWord, syncDegradation } from "./health.js"
|
|
84
|
+
import { pendingMigrations, migrationLine, bashHint } from "./pending-migrations.js"
|
|
85
|
+
import { startBackgroundFetch, syncWorkspace } from "./session-sync.js"
|
|
86
|
+
import { recordLocalOnlyOnCards } from "../tools/local-only.js"
|
|
87
|
+
import { resolveStartupDeskRoot, resolveStartupStateBranch } from "./startup-resolve.js"
|
|
88
|
+
import { installCardGuard } from "../desk/card-commit-guard.js"
|
|
89
|
+
import { NEW_WORK_INSTRUCTION, NEW_WORK_INSTRUCTION_UNATTENDED, NO_TASK_INSTRUCTION, NO_TASK_INSTRUCTION_TEXT, ROUTE_CHECKED, UNMATCHED_TASK_INSTRUCTION, UNMATCHED_TASK_INSTRUCTION_TEXT, formatBootText, lastSyncedAt, notesInstruction, pushRoute, readAgentsMd, shownRepoPath, syncSummary } from "./boot-text.js"
|
|
90
|
+
import { checkStaleDesk } from "./stale-desk.js"
|
|
91
|
+
import { checkPluginUpdate } from "./plugin-update.js"
|
|
92
|
+
import { checkReleaseAlert } from "./release-alert.js"
|
|
93
|
+
import { planStaleRefresh, startStaleRefresh, startedLine } from "./stale-desk-refresh.js"
|
|
94
|
+
import { deferredToolsHint, deferredToolsHintShort } from "../util/deferred-tools.js"
|
|
95
|
+
import { recordUnsigned, signoffInstructions } from "../desk/unsigned-deliveries.js"
|
|
96
|
+
import { noteSignoffListed } from "./signoff-listed.js"
|
|
97
|
+
import { stuckSaves } from "./unmerged-saves.js"
|
|
98
|
+
import { otherSessions } from "./other-sessions.js"
|
|
99
|
+
import { readMachineDesks } from "../desk/machine-desks.js"
|
|
100
|
+
import { resolveDeskStateDir } from "./last-start.js"
|
|
101
|
+
import { applyPublicationMode } from "./publication-mode.js"
|
|
102
|
+
import { renameWithRetry } from "../util/rename-retry.js"
|
|
103
|
+
|
|
104
|
+
const parseFrontmatter = loadFrontmatterParser()
|
|
105
|
+
// Without gray-matter (a plugin run straight from its install folder) the
|
|
106
|
+
// dependency-free reader stands in; it does not parse nested values, so `repos`
|
|
107
|
+
// lists cannot be validated on that path.
|
|
108
|
+
const NESTED_CARD_FIELDS = parseFrontmatter !== parseFrontmatterLite
|
|
109
|
+
const DESK_PLUGIN_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..")
|
|
110
|
+
|
|
111
|
+
// ── Root resolution ─────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The desk root, classified for boot: `{ status: "ready", path, source,
|
|
115
|
+
* binding_path }`, `{ status: "setup_required", binding_path, tried }` (no
|
|
116
|
+
* source names a desk at all — a first run, not an outage), or
|
|
117
|
+
* `{ status: "degraded", binding_path, tried, reason, message, path?,
|
|
118
|
+
* source? }` (a source names a desk whose folder is missing, unreadable or
|
|
119
|
+
* malformed). Mirrors `scripts/resolve-desk-root.js`'s `resolveHookDeskRoot`
|
|
120
|
+
* but keeps the thrown error's `code` so boot can tell the two failure
|
|
121
|
+
* shapes apart instead of collapsing them into one message string.
|
|
122
|
+
*/
|
|
123
|
+
export function resolveBootRoot({
|
|
124
|
+
env = process.env,
|
|
125
|
+
cwd = process.cwd(),
|
|
126
|
+
homeDir = env.HOME || os.homedir(),
|
|
127
|
+
readActivationConfig = (file) => readSmallText(file),
|
|
128
|
+
} = {}) {
|
|
129
|
+
const bindingPath = claudeBindingPath(env)
|
|
130
|
+
try {
|
|
131
|
+
// The tool server's own resolver: the Copilot session record, CLAUDE_PROJECT_DIR, then this process's folder (a weak
|
|
132
|
+
// hint unless it is a Crew workspace clone), so the boot and the server never name different desks.
|
|
133
|
+
const resolved = resolveStartupDeskRoot({ args: {}, env, cwd, homeDir, readActivationConfig })
|
|
134
|
+
return { status: "ready", path: resolved.root, source: resolved.source, binding_path: bindingPath }
|
|
135
|
+
} catch (error) {
|
|
136
|
+
const status = error.code === DESK_ROOT_NOT_FOUND ? "setup_required" : "degraded"
|
|
137
|
+
return {
|
|
138
|
+
status,
|
|
139
|
+
path: error.path ?? null,
|
|
140
|
+
source: error.source ?? null,
|
|
141
|
+
binding_path: bindingPath,
|
|
142
|
+
tried: error.tried ?? [],
|
|
143
|
+
// Every throw out of the shared resolver (`resolveDeskRootWithSource`) — including through
|
|
144
|
+
// the injectable `readActivationConfig` seam, which `loadActivationConfig`
|
|
145
|
+
// always re-wraps in a `codedError` — sets `.code` (see `util/paths.js`),
|
|
146
|
+
// so this never falls back to a message-only reason.
|
|
147
|
+
reason: error.code,
|
|
148
|
+
message: error.message,
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── The session's person ────────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
// How long the boot waits for each GitHub answer about which signed-in account is this session's member.
|
|
156
|
+
const MEMBER_BUDGET_MS = 3000
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The person this session writes as in a Crew workspace, as `desk_status` reports it in `write_scope`:
|
|
160
|
+
* `{ alias, source, identity, write_path, problem }`, or null on a personal desk. `problem` is the one plain message
|
|
161
|
+
* when no person is known, and then the session is read-only.
|
|
162
|
+
*/
|
|
163
|
+
export function personSummary(member) {
|
|
164
|
+
if (member?.crew !== true) return null
|
|
165
|
+
return {
|
|
166
|
+
alias: member.person,
|
|
167
|
+
source: member.source,
|
|
168
|
+
identity: member.identity ?? null,
|
|
169
|
+
write_path: member.person === null ? null : `desks/${member.person}`,
|
|
170
|
+
problem: memberMessage(member),
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ── Host identity ───────────────────────────────────────────────────────
|
|
175
|
+
|
|
176
|
+
/** `{ hostname, user, cwd, platform, release, probed_at }`. Never throws. */
|
|
177
|
+
export function probeHost({
|
|
178
|
+
env = process.env,
|
|
179
|
+
hostname = os.hostname,
|
|
180
|
+
userInfo = os.userInfo,
|
|
181
|
+
cwd = process.cwd,
|
|
182
|
+
platform = os.platform,
|
|
183
|
+
release = os.release,
|
|
184
|
+
now = Date.now,
|
|
185
|
+
} = {}) {
|
|
186
|
+
const envUser = typeof env.USER === "string" && env.USER !== "" ? env.USER : env.USERNAME
|
|
187
|
+
let user = typeof envUser === "string" && envUser !== "" ? envUser : null
|
|
188
|
+
if (user === null) {
|
|
189
|
+
try {
|
|
190
|
+
user = userInfo().username
|
|
191
|
+
} catch {
|
|
192
|
+
user = null
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
let host
|
|
196
|
+
try {
|
|
197
|
+
host = hostname()
|
|
198
|
+
} catch {
|
|
199
|
+
host = null
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
hostname: host,
|
|
203
|
+
user,
|
|
204
|
+
cwd: cwd(),
|
|
205
|
+
platform: platform(),
|
|
206
|
+
release: release(),
|
|
207
|
+
probed_at: new Date(now()).toISOString(),
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ── Prerequisite probe ──────────────────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
/** A generic subprocess runner shaped like `factory/flush.js`'s `ghRunner`, for commands other than `gh`. */
|
|
214
|
+
export function commandRunner(cmd, { spawn = nodeSpawn, env = process.env, maxOutput = 1024 * 1024 } = {}) {
|
|
215
|
+
return (args, { timeoutMs = 5000 } = {}) => new Promise((resolve) => {
|
|
216
|
+
const stdout = []
|
|
217
|
+
const stderr = []
|
|
218
|
+
let size = 0
|
|
219
|
+
let settled = false
|
|
220
|
+
const finish = (value) => {
|
|
221
|
+
if (settled) return
|
|
222
|
+
settled = true
|
|
223
|
+
clearTimeout(timer)
|
|
224
|
+
resolve(value)
|
|
225
|
+
}
|
|
226
|
+
const text = (chunks) => Buffer.concat(chunks).toString("utf8")
|
|
227
|
+
const child = spawn(cmd, args, { env, stdio: ["ignore", "pipe", "pipe"], windowsHide: true })
|
|
228
|
+
const timer = setTimeout(() => {
|
|
229
|
+
child.kill("SIGKILL")
|
|
230
|
+
finish({ code: null, stdout: text(stdout), stderr: text(stderr), timedOut: true })
|
|
231
|
+
}, timeoutMs)
|
|
232
|
+
const collect = (into) => (chunk) => {
|
|
233
|
+
size += chunk.length
|
|
234
|
+
if (size <= maxOutput) into.push(Buffer.from(chunk))
|
|
235
|
+
}
|
|
236
|
+
child.stdout.on("data", collect(stdout))
|
|
237
|
+
child.stderr.on("data", collect(stderr))
|
|
238
|
+
child.on("error", (error) => finish({ code: null, stdout: "", stderr: "", spawnError: error.code ?? "spawn_failed" }))
|
|
239
|
+
child.on("close", (code) => finish({ code, stdout: text(stdout), stderr: text(stderr) }))
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const GH_VERSION_FLOOR = [2, 40]
|
|
244
|
+
|
|
245
|
+
function parseGhVersion(stdout) {
|
|
246
|
+
const match = /gh version (\d+)\.(\d+)\.(\d+)/u.exec(stdout ?? "")
|
|
247
|
+
return match === null ? null : [Number(match[1]), Number(match[2]), Number(match[3])]
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function meetsGhFloor([major, minor]) {
|
|
251
|
+
return major > GH_VERSION_FLOOR[0] || (major === GH_VERSION_FLOOR[0] && minor >= GH_VERSION_FLOOR[1])
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function trimmed(text, limit = 300) {
|
|
255
|
+
return (text ?? "").trim().slice(0, limit)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function evaluateGh(result) {
|
|
259
|
+
if (result.spawnError) return { ok: false, reason: "gh_missing", detail: "the `gh` binary was not found on PATH" }
|
|
260
|
+
if (result.timedOut) return { ok: false, reason: "gh_timeout", detail: "`gh --version` did not respond in time" }
|
|
261
|
+
if (result.code !== 0) return { ok: false, reason: "gh_error", detail: trimmed(result.stderr || result.stdout) }
|
|
262
|
+
const version = parseGhVersion(result.stdout)
|
|
263
|
+
if (version === null) return { ok: false, reason: "gh_version_unparseable", detail: trimmed(result.stdout) }
|
|
264
|
+
const versionText = version.join(".")
|
|
265
|
+
if (!meetsGhFloor(version)) {
|
|
266
|
+
return {
|
|
267
|
+
ok: false,
|
|
268
|
+
reason: "gh_too_old",
|
|
269
|
+
version: versionText,
|
|
270
|
+
detail: `gh ${versionText} is older than the 2.40 floor \`gh auth switch -u\` needs`,
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return { ok: true, version: versionText }
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function evaluateJq(result) {
|
|
277
|
+
if (result.spawnError) return { ok: false, reason: "jq_missing", detail: "the `jq` binary was not found on PATH" }
|
|
278
|
+
if (result.timedOut) return { ok: false, reason: "jq_timeout", detail: "`jq --version` did not respond in time" }
|
|
279
|
+
if (result.code !== 0) return { ok: false, reason: "jq_error", detail: trimmed(result.stderr || result.stdout) }
|
|
280
|
+
return { ok: true }
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// gh says the host has no usable sign-in: the one answer that is a hard stop.
|
|
284
|
+
const AUTH_STALE = /no longer valid|not logged into|you are not logged|no accounts? (?:are |is )?(?:logged|found|configured)|gh auth login/iu
|
|
285
|
+
const RATE_LIMITED = /rate limit|\bHTTP 429\b|\bHTTP 403\b|\b(?:429|403)\b|secondary rate|abuse detection/iu
|
|
286
|
+
const NETWORK_ERROR = /timed? ?out|timeout|dial tcp|no such host|connection (?:refused|reset)|ECONN|ENOTFOUND|EAI_AGAIN|network|TLS|EOF|temporary failure|unreachable|HTTP 5\d\d/iu
|
|
287
|
+
|
|
288
|
+
/** Why `gh auth status` could not tell, in words for a warning line. */
|
|
289
|
+
function authTransientWhy(result) {
|
|
290
|
+
if (result.timedOut) return "timed out"
|
|
291
|
+
const text = `${result.stdout ?? ""}\n${result.stderr ?? ""}`
|
|
292
|
+
if (RATE_LIMITED.test(text)) return "rate limited"
|
|
293
|
+
if (NETWORK_ERROR.test(text)) return "network error"
|
|
294
|
+
return "unrecognised gh error"
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function evaluateAuth(result) {
|
|
298
|
+
if (result.spawnError) return { ok: false, reason: "gh_missing", detail: "the `gh` binary was not found on PATH" }
|
|
299
|
+
const text = `${result.stdout ?? ""}\n${result.stderr ?? ""}`
|
|
300
|
+
// Not logged in is judged on gh's own words, even after a timeout or an exit 0: the output says what gh found.
|
|
301
|
+
if (AUTH_STALE.test(text) && (result.code === 0 || !RATE_LIMITED.test(text))) return { ok: false, reason: "auth_stale", detail: trimmed(text, 500) }
|
|
302
|
+
if (result.code === 0 && result.timedOut !== true) return { ok: true }
|
|
303
|
+
// Anything else (a timeout, the network, a rate limit, an exit gh gave no reason for) is a failure to check, not a failure to sign in.
|
|
304
|
+
const why = authTransientWhy(result)
|
|
305
|
+
return { ok: false, reason: "auth_unverified", soft: true, detail: `${why}${trimmed(text, 300) === "" ? "" : `: ${trimmed(text, 300)}`}`, why }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const AUTH_RETRY_BACKOFF_MS = 750
|
|
309
|
+
const sleepFor = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Whether gh is signed in for github.com. The offline check comes first (`gh auth token`, which reads the stored token
|
|
313
|
+
* and asks GitHub nothing, so a rate limit or a bad network cannot fail it); only when that does not show a token does
|
|
314
|
+
* `gh auth status` (an online check) run. A failure that is not "not logged in" gets one retry after a short backoff, then
|
|
315
|
+
* resolves as `auth_unverified` (a warning, never a hard stop). The token itself is never read into the result.
|
|
316
|
+
*/
|
|
317
|
+
export async function checkAuth(ghAuth, { timeoutMs = 8000, sleep = sleepFor, backoffMs = AUTH_RETRY_BACKOFF_MS } = {}) {
|
|
318
|
+
// The three calls share the one budget the old single call had (`timeoutMs`), so a slow GitHub never makes boot slower than it was:
|
|
319
|
+
// the offline check gets a quarter, the online check half, and the retry what is left after the backoff.
|
|
320
|
+
const offlineMs = Math.floor(timeoutMs / 4)
|
|
321
|
+
const onlineMs = Math.floor(timeoutMs / 2)
|
|
322
|
+
const offline = await ghAuth(["auth", "token", "--hostname", "github.com"], { timeoutMs: offlineMs })
|
|
323
|
+
if (offline.spawnError === undefined && offline.code === 0 && offline.timedOut !== true && String(offline.stdout ?? "").trim() !== "") return { ok: true }
|
|
324
|
+
let verdict = evaluateAuth(await ghAuth(["auth", "status", "--hostname", "github.com"], { timeoutMs: onlineMs }))
|
|
325
|
+
if (verdict.soft === true) {
|
|
326
|
+
await sleep(backoffMs)
|
|
327
|
+
verdict = evaluateAuth(await ghAuth(["auth", "status", "--hostname", "github.com"], { timeoutMs: Math.max(1, timeoutMs - offlineMs - onlineMs - backoffMs) }))
|
|
328
|
+
}
|
|
329
|
+
return verdict
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The five-part prereq probe (`session-start/SKILL.md` Step 0.75), as one
|
|
334
|
+
* call: `{ gh: {ok, version?, reason?, detail?}, jq: {...}, auth: {...} }`.
|
|
335
|
+
* Every check resolves rather than rejects — a missing binary, a timeout or
|
|
336
|
+
* a nonzero exit all come back as `{ ok: false, reason, detail }`, never a
|
|
337
|
+
* thrown error.
|
|
338
|
+
*/
|
|
339
|
+
export async function checkPrereqs({ gh = ghRunner(), jq = commandRunner("jq"), ghAuth = gh, timeoutMs = 8000, authOptions = {} } = {}) {
|
|
340
|
+
// `ghAuth` runs with the ambient environment: `gh` itself honors GH_TOKEN,
|
|
341
|
+
// so a host signed in only through that variable is healthy. (`gh`, the
|
|
342
|
+
// factory's runner, strips ambient tokens on purpose.)
|
|
343
|
+
const [ghVersion, jqVersion, auth] = await Promise.all([
|
|
344
|
+
gh(["--version"], { timeoutMs }),
|
|
345
|
+
jq(["--version"], { timeoutMs }),
|
|
346
|
+
checkAuth(ghAuth, { timeoutMs, ...authOptions }),
|
|
347
|
+
])
|
|
348
|
+
return { gh: evaluateGh(ghVersion), jq: evaluateJq(jqVersion), auth }
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ── Task-card frontmatter validation ────────────────────────────────────
|
|
352
|
+
|
|
353
|
+
const MAX_CARD_BYTES = 64 * 1024
|
|
354
|
+
const VALID_STATUSES = new Set(LIFECYCLE_STATES)
|
|
355
|
+
const TERMINAL_STATUSES = new Set(TERMINAL_STATES)
|
|
356
|
+
const REQUIRED_TEXT_FIELDS = ["title", "status", "created", "updated", "track"]
|
|
357
|
+
|
|
358
|
+
function isTimestampField(field) {
|
|
359
|
+
return field === "created" || field === "updated"
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function isNumericKeyedObject(value) {
|
|
363
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false
|
|
364
|
+
const keys = Object.keys(value)
|
|
365
|
+
return keys.length > 0 && keys.every((key) => /^\d+$/u.test(key))
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Every problem with a task card's already-parsed frontmatter, in plain
|
|
370
|
+
* language naming the field: numeric-string-keyed objects where a list was
|
|
371
|
+
* expected (the corruption pattern the faster-desk-pr-flow card hit, a
|
|
372
|
+
* pre-#51 bug — generalized here to every field, not just `repos`), missing
|
|
373
|
+
* or malformed required fields, an unrecognized `status`, unparseable
|
|
374
|
+
* `created`/`updated`, and malformed `repos[]` entries. `[]` when the card
|
|
375
|
+
* is healthy.
|
|
376
|
+
*/
|
|
377
|
+
export function cardProblems(data, { nested = true } = {}) {
|
|
378
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
379
|
+
return ["frontmatter did not parse as a YAML mapping"]
|
|
380
|
+
}
|
|
381
|
+
const problems = []
|
|
382
|
+
const corrupted = new Set()
|
|
383
|
+
for (const [field, value] of Object.entries(data)) {
|
|
384
|
+
if (isNumericKeyedObject(value)) {
|
|
385
|
+
corrupted.add(field)
|
|
386
|
+
const keys = Object.keys(value).slice(0, 5).join(", ")
|
|
387
|
+
problems.push(`\`${field}\` is an object with numeric-string keys (${keys}) where a list was expected — frontmatter is likely corrupted`)
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
for (const field of REQUIRED_TEXT_FIELDS) {
|
|
391
|
+
if (corrupted.has(field)) continue
|
|
392
|
+
// An unquoted YAML timestamp parses as a Date; that is a valid timestamp.
|
|
393
|
+
if (isTimestampField(field) && data[field] instanceof Date) continue
|
|
394
|
+
if (typeof data[field] !== "string" || data[field].trim() === "") problems.push(`\`${field}\` is missing or not a string`)
|
|
395
|
+
}
|
|
396
|
+
if (typeof data.status === "string" && !VALID_STATUSES.has(data.status)) {
|
|
397
|
+
problems.push(`\`status: ${data.status}\` is not one of the task-lifecycle states`)
|
|
398
|
+
}
|
|
399
|
+
for (const field of ["created", "updated"]) {
|
|
400
|
+
const value = data[field]
|
|
401
|
+
const unparseable = value instanceof Date ? Number.isNaN(value.getTime()) : typeof value === "string" && Number.isNaN(Date.parse(value))
|
|
402
|
+
if (unparseable) problems.push(`\`${field}\` is not a parseable timestamp`)
|
|
403
|
+
}
|
|
404
|
+
// A card with no `repos` field touches no code repository, the same as `repos: []`: plain hand-written cards stay healthy.
|
|
405
|
+
if (nested && !corrupted.has("repos") && data.repos !== undefined) {
|
|
406
|
+
if (!Array.isArray(data.repos)) {
|
|
407
|
+
problems.push("`repos` is not a list")
|
|
408
|
+
} else {
|
|
409
|
+
data.repos.forEach((entry, index) => {
|
|
410
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
411
|
+
problems.push(`repos[${index}] is not an object`)
|
|
412
|
+
return
|
|
413
|
+
}
|
|
414
|
+
// A remote repo has no local checkout, so `local_path` is required only for a local (or unset) mode.
|
|
415
|
+
const needsLocalPath = entry.mode !== "remote"
|
|
416
|
+
for (const field of ["name", "local_path", "mode"]) {
|
|
417
|
+
if (field === "local_path" && !needsLocalPath && entry[field] === undefined) continue
|
|
418
|
+
if (typeof entry[field] !== "string") problems.push(`repos[${index}].${field} is missing or not a string`)
|
|
419
|
+
}
|
|
420
|
+
if (entry.url !== undefined && typeof entry.url !== "string") problems.push(`repos[${index}].url is not a string`)
|
|
421
|
+
if (typeof entry.mode === "string" && entry.mode !== "local" && entry.mode !== "remote") {
|
|
422
|
+
problems.push(`repos[${index}].mode is "${entry.mode}", not "local" or "remote"`)
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return problems
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function listDirs(dir) {
|
|
431
|
+
try {
|
|
432
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
433
|
+
.filter((entry) => entry.isDirectory() && !entry.name.startsWith("_") && !entry.name.startsWith("."))
|
|
434
|
+
.map((entry) => entry.name)
|
|
435
|
+
.sort()
|
|
436
|
+
} catch {
|
|
437
|
+
return []
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function readCardText(filePath) {
|
|
442
|
+
let fd
|
|
443
|
+
try {
|
|
444
|
+
fd = openSync(filePath, "r")
|
|
445
|
+
} catch {
|
|
446
|
+
return null
|
|
447
|
+
}
|
|
448
|
+
try {
|
|
449
|
+
const buffer = Buffer.alloc(MAX_CARD_BYTES)
|
|
450
|
+
const bytesRead = readSync(fd, buffer, 0, MAX_CARD_BYTES, 0)
|
|
451
|
+
return buffer.toString("utf8", 0, bytesRead)
|
|
452
|
+
} finally {
|
|
453
|
+
closeSync(fd)
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function scanTracks(scanRoot, deskRaw) {
|
|
458
|
+
const cards = []
|
|
459
|
+
for (const track of listDirs(scanRoot)) {
|
|
460
|
+
if (deskRaw === null && track === "desks") continue
|
|
461
|
+
const trackDir = path.join(scanRoot, track)
|
|
462
|
+
for (const slug of listDirs(trackDir)) {
|
|
463
|
+
const file = path.join(trackDir, slug, "task.md")
|
|
464
|
+
const text = readCardText(file)
|
|
465
|
+
if (text === null) continue
|
|
466
|
+
let data
|
|
467
|
+
try {
|
|
468
|
+
data = parseFrontmatter(text).data
|
|
469
|
+
} catch {
|
|
470
|
+
data = {}
|
|
471
|
+
}
|
|
472
|
+
cards.push({ track, slug, desk: deskRaw, file, data })
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return cards
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Every task card under `root`, raw (unredacted) `{ track, slug, desk,
|
|
480
|
+
* file, data }` tuples — the desk root plus every `desks/<alias>/` subtree,
|
|
481
|
+
* skipping `_` and `.` folders, same layout as `desk/active-tasks.js`'s
|
|
482
|
+
* scan, but without its terminal-status filter: every card is read, not
|
|
483
|
+
* only the open ones, since a `done` card's frontmatter can be corrupted
|
|
484
|
+
* too. `data` is `{}` when a card's frontmatter fails to parse at all.
|
|
485
|
+
*/
|
|
486
|
+
export function walkTaskCards(root) {
|
|
487
|
+
const cards = scanTracks(root, null)
|
|
488
|
+
for (const alias of listDirs(path.join(root, "desks"))) {
|
|
489
|
+
cards.push(...scanTracks(path.join(root, "desks", alias), alias))
|
|
490
|
+
}
|
|
491
|
+
return cards
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** `card_validation`: every card `walk(root)` finds with `cardProblems(card.data).length > 0`, named by redacted track/slug/desk plus a stable handle — never by re-opening a redacted name. */
|
|
495
|
+
export function cardValidation(root, walk = walkTaskCards, { nested = NESTED_CARD_FIELDS } = {}) {
|
|
496
|
+
const results = []
|
|
497
|
+
for (const card of walk(root)) {
|
|
498
|
+
const problems = cardProblems(card.data, { nested })
|
|
499
|
+
if (problems.length === 0) continue
|
|
500
|
+
results.push({
|
|
501
|
+
track: redactName(card.track),
|
|
502
|
+
slug: redactName(card.slug),
|
|
503
|
+
...(card.desk === null ? {} : { desk: redactName(card.desk) }),
|
|
504
|
+
handle: folderHandle("task", root, path.dirname(card.file)),
|
|
505
|
+
problems,
|
|
506
|
+
})
|
|
507
|
+
}
|
|
508
|
+
return results
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// ── Per-task-repo push-account resolution ───────────────────────────────
|
|
512
|
+
|
|
513
|
+
const MIN_ACCOUNT_CALL_MS = 3000
|
|
514
|
+
|
|
515
|
+
// `spawnGit` follows `runtime/session-sync.js`'s own convention: its result
|
|
516
|
+
// shape (`status`, `stdout`), never an exception, is the contract every
|
|
517
|
+
// caller in this codebase trusts. `normalizeRemote` throws only for a
|
|
518
|
+
// non-string or blank remote (`factory/binding.js`), which the `url === ""`
|
|
519
|
+
// check above already rules out, so neither call needs its own try/catch —
|
|
520
|
+
// a card whose `local_path` cannot be read still degrades cleanly, one
|
|
521
|
+
// level up, through `resolvePushAccounts`'s own caller in `bootOnce`.
|
|
522
|
+
function resolveLocalStore(localPath, { spawnGit, homeDir, deskRoot, timeoutMs, fileOnly = false }) {
|
|
523
|
+
if (typeof localPath !== "string" || localPath.trim() === "") return null
|
|
524
|
+
const resolved = resolveLocalPath(localPath, { homeDir, deskRoot })
|
|
525
|
+
// The clone's own config file answers without a git process; git is asked only when the file cannot say.
|
|
526
|
+
const found = readRemotes(resolved)
|
|
527
|
+
let url = found === null ? null : found.remotes.origin ?? null
|
|
528
|
+
if (found === null && !fileOnly) {
|
|
529
|
+
const result = spawnGit("git", ["-C", resolved, "config", "--get", "remote.origin.url"], { windowsHide: true, encoding: "utf8", timeout: timeoutMs })
|
|
530
|
+
if (!result || result.status !== 0 || typeof result.stdout !== "string") return null
|
|
531
|
+
url = result.stdout
|
|
532
|
+
}
|
|
533
|
+
url = (url ?? "").trim()
|
|
534
|
+
if (url === "") return null
|
|
535
|
+
const normalized = normalizeRemote(url)
|
|
536
|
+
const match = /^https:\/\/github\.com\/(.+)$/u.exec(normalized)
|
|
537
|
+
return match !== null && PATTERNS.prRepo.test(match[1]) ? match[1] : null
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// Only a URL git would clone as a remote: https://, ssh:// or scp-style git@host:path, with nothing a shell or git
|
|
541
|
+
// option parser could read as anything else. Credentials embedded in the URL are dropped first.
|
|
542
|
+
const CLONE_URL = /^(?:https:\/\/[\w.-]+(?::\d+)?\/[\w.~%+@:/-]+|ssh:\/\/(?:[\w.-]+@)?[\w.-]+(?::\d+)?\/[\w.~%+@:/-]+|git@[\w.-]+:[\w.~%+/-]+)$/u
|
|
543
|
+
|
|
544
|
+
/** A repo entry's `url` (where to clone it from) as a safe clone URL, or null when it has none or it is not one. */
|
|
545
|
+
function cloneUrl(value) {
|
|
546
|
+
if (typeof value !== "string") return null
|
|
547
|
+
const text = value.trim().replace(/^(https:\/\/)[^/@\s]*@/u, "$1")
|
|
548
|
+
return CLONE_URL.test(text) ? redactCredentialLikeText(text) : null
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function repoLabel(card, repo) {
|
|
552
|
+
return {
|
|
553
|
+
track: redactName(card.track),
|
|
554
|
+
slug: redactName(card.slug),
|
|
555
|
+
...(card.desk === null ? {} : { desk: redactName(card.desk) }),
|
|
556
|
+
repo: typeof repo.name === "string" ? redactCredentialLikeText(repo.name) : null,
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* The push account for every repo of every non-terminal task card, reusing
|
|
562
|
+
* `factory/flush.js`'s `chooseAccount` — the same per-store, per-signed-in-
|
|
563
|
+
* account resolution the factory's account choice uses, asking each
|
|
564
|
+
* account's own token about push/fork permission rather than assuming
|
|
565
|
+
* `gh`'s active account. A repo entry that resolves to a real `owner/repo`
|
|
566
|
+
* slug (a `remote`-mode `name` matching `PATTERNS.prRepo`, or a
|
|
567
|
+
* `local`-mode clone's own `git remote` normalized the same way) gets one
|
|
568
|
+
* `chooseAccount` call per distinct store, shared by every task that
|
|
569
|
+
* references it; a repo with no resolvable slug is reported with
|
|
570
|
+
* `result: "not_a_github_repo"` and no network call. A store whose call
|
|
571
|
+
* would not fit in the remaining wall-clock budget is reported with
|
|
572
|
+
* `result: "pending"` instead of blocking the rest of boot.
|
|
573
|
+
*/
|
|
574
|
+
export async function resolvePushAccounts({
|
|
575
|
+
root,
|
|
576
|
+
cards,
|
|
577
|
+
runner,
|
|
578
|
+
now = Date.now,
|
|
579
|
+
deadlineMs = 20000,
|
|
580
|
+
spawnGit = spawnSync,
|
|
581
|
+
homeDir = os.homedir(),
|
|
582
|
+
perCallTimeoutMs = 12000,
|
|
583
|
+
}) {
|
|
584
|
+
const deadline = now() + deadlineMs
|
|
585
|
+
const results = []
|
|
586
|
+
const entries = []
|
|
587
|
+
for (const card of cards) {
|
|
588
|
+
if (TERMINAL_STATUSES.has(card.data?.status)) continue
|
|
589
|
+
if (!Array.isArray(card.data?.repos)) continue
|
|
590
|
+
for (const repo of card.data.repos) {
|
|
591
|
+
if (repo === null || typeof repo !== "object") continue
|
|
592
|
+
const label = repoLabel(card, repo)
|
|
593
|
+
let store = null
|
|
594
|
+
if (repo.mode === "remote" && typeof repo.name === "string" && PATTERNS.prRepo.test(repo.name)) {
|
|
595
|
+
store = repo.name
|
|
596
|
+
} else if (repo.mode === "local") {
|
|
597
|
+
store = resolveLocalStore(repo.local_path, { spawnGit, homeDir, deskRoot: root, timeoutMs: 5000 })
|
|
598
|
+
}
|
|
599
|
+
if (store === null) {
|
|
600
|
+
results.push({ ...label, result: "not_a_github_repo" })
|
|
601
|
+
continue
|
|
602
|
+
}
|
|
603
|
+
entries.push({ label, store })
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Every store is asked at once, so boot waits for the slowest store, not the sum of them. `chooseAccount` resolves
|
|
608
|
+
// every failure of its own into a `{ result }` code (see `factory/flush.js`); a card whose data makes this
|
|
609
|
+
// itself throw is still caught one level up, by `resolvePushAccounts`'s caller in `bootOnce`.
|
|
610
|
+
const stores = [...new Set(entries.map((entry) => entry.store))]
|
|
611
|
+
const remaining = deadline - now()
|
|
612
|
+
const answers = await Promise.all(stores.map((store) => (remaining < MIN_ACCOUNT_CALL_MS
|
|
613
|
+
? { result: "pending", reason: "boot_budget_exceeded" }
|
|
614
|
+
: chooseAccount({ store, runner, deadlineMs: Math.min(remaining, perCallTimeoutMs), now }))))
|
|
615
|
+
const resolved = new Map(stores.map((store, index) => [store, answers[index]]))
|
|
616
|
+
for (const entry of entries) results.push({ ...entry.label, store: entry.store, ...resolved.get(entry.store) })
|
|
617
|
+
return results
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// ── Ambient GitHub token as one account ─────────────────────────────────
|
|
621
|
+
|
|
622
|
+
export const ENV_TOKEN_ACCOUNT = "env-token"
|
|
623
|
+
|
|
624
|
+
function ambientToken(env) {
|
|
625
|
+
for (const name of ["GH_TOKEN", "GITHUB_TOKEN"]) {
|
|
626
|
+
if (typeof env[name] === "string" && env[name].trim() !== "") return env[name].trim()
|
|
627
|
+
}
|
|
628
|
+
return null
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Wraps the factory's account runner (which strips ambient tokens on purpose)
|
|
633
|
+
* so a host signed in to `gh` only through `GH_TOKEN`/`GITHUB_TOKEN` counts
|
|
634
|
+
* as one account, `env-token`, instead of as no account at all. Accounts
|
|
635
|
+
* `gh` itself lists are left alone; the token only ever stays in memory and
|
|
636
|
+
* answers `gh auth token --user env-token`.
|
|
637
|
+
*/
|
|
638
|
+
export function withAmbientToken(runner, env) {
|
|
639
|
+
const token = ambientToken(env)
|
|
640
|
+
if (token === null) return runner
|
|
641
|
+
return async (args, options) => {
|
|
642
|
+
const result = await runner(args, options)
|
|
643
|
+
if (args[0] === "auth" && args[1] === "status" && signedInAccounts([result.stdout, result.stderr].join("\n")).length === 0) {
|
|
644
|
+
return { code: 0, stdout: `github.com\n ✓ Logged in to github.com account ${ENV_TOKEN_ACCOUNT} (environment token)\n - Active account: true\n`, stderr: "" }
|
|
645
|
+
}
|
|
646
|
+
if (args[0] === "auth" && args[1] === "token" && args[3] === ENV_TOKEN_ACCOUNT) return { code: 0, stdout: `${token}\n`, stderr: "" }
|
|
647
|
+
return result
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// ── Named task ──────────────────────────────────────────────────────────
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Resolves `--task <query>` against the open task cards: an exact match on a
|
|
655
|
+
* handle, slug, `track/slug` or title (case-insensitive) wins; otherwise a
|
|
656
|
+
* substring match on those, which must be unique. Returns `{ status:
|
|
657
|
+
* "resolved", task }`, `{ status: "ambiguous", candidates }` or `{ status:
|
|
658
|
+
* "not_found" }`; names in the answer are redacted like every other field.
|
|
659
|
+
*/
|
|
660
|
+
export function resolveTaskQuery(query, cards, root) {
|
|
661
|
+
const needle = String(query).trim().toLowerCase()
|
|
662
|
+
if (needle === "") return { status: "not_found" }
|
|
663
|
+
const open = cards.filter((card) => !TERMINAL_STATUSES.has(card.data.status))
|
|
664
|
+
const keys = (card) => [
|
|
665
|
+
folderHandle("task", root, path.dirname(card.file)),
|
|
666
|
+
card.slug,
|
|
667
|
+
`${card.track}/${card.slug}`,
|
|
668
|
+
typeof card.data.title === "string" ? card.data.title : "",
|
|
669
|
+
].map((key) => key.toLowerCase())
|
|
670
|
+
const summary = (card) => ({
|
|
671
|
+
track: redactName(card.track),
|
|
672
|
+
slug: redactName(card.slug),
|
|
673
|
+
...(card.desk === null ? {} : { desk: redactName(card.desk) }),
|
|
674
|
+
title: typeof card.data.title === "string" ? redactCredentialLikeText(card.data.title) : null,
|
|
675
|
+
status: card.data.status ?? null,
|
|
676
|
+
handle: folderHandle("task", root, path.dirname(card.file)),
|
|
677
|
+
})
|
|
678
|
+
let matches = open.filter((card) => keys(card).includes(needle))
|
|
679
|
+
// `--task` takes whatever the operator typed ("resume valve-firmware-flasher"): one open task whose slug or track/slug stands in the phrase as a whole token is the task;
|
|
680
|
+
// two make it ambiguous. A partial slug ("flasher") never matches.
|
|
681
|
+
if (matches.length === 0) {
|
|
682
|
+
const whole = (key) => new RegExp(`(?<![\\w-])${key.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}(?![\\w-])`, "u").test(needle)
|
|
683
|
+
matches = open.filter((card) => [card.slug, `${card.track}/${card.slug}`].some((key) => key !== "" && whole(key.toLowerCase())))
|
|
684
|
+
}
|
|
685
|
+
// What is left is a partial match on a title only; a partial slug or handle is never a match.
|
|
686
|
+
if (matches.length === 0) matches = open.filter((card) => typeof card.data.title === "string" && card.data.title.toLowerCase().includes(needle))
|
|
687
|
+
if (matches.length === 0) return { status: "not_found" }
|
|
688
|
+
if (matches.length > 1) return { status: "ambiguous", candidates: matches.map(summary) }
|
|
689
|
+
return { status: "resolved", task: { ...summary(matches[0]), card: `${cardLocation({ desk: matches[0].desk, track: matches[0].track, slug: matches[0].slug })}/task.md`, file: matches[0].file } }
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// `$DESK/.machine-local.yml`'s `repos:` map (repo name to the path of this machine's clone), read with a small line parser
|
|
693
|
+
// because boot runs before any YAML dependency is certain to be installed. A missing, unreadable or malformed file is an
|
|
694
|
+
// empty map. Only `name: path` lines indented under `repos:` count; quotes and trailing comments are dropped.
|
|
695
|
+
function machineLocalRepos(root) {
|
|
696
|
+
let text
|
|
697
|
+
try {
|
|
698
|
+
text = readSmallText(path.join(root, ".machine-local.yml"))
|
|
699
|
+
} catch {
|
|
700
|
+
return new Map()
|
|
701
|
+
}
|
|
702
|
+
const repos = new Map()
|
|
703
|
+
let inRepos = false
|
|
704
|
+
for (const line of text.split(/\r?\n/u)) {
|
|
705
|
+
if (/^\S/u.test(line)) inRepos = /^repos:\s*(?:#.*)?$/u.test(line)
|
|
706
|
+
else if (inRepos) {
|
|
707
|
+
const entry = /^\s+["']?([^:"'#]+?)["']?\s*:\s*(?:"([^"]*)"|'([^']*)'|([^#\s][^#]*?))\s*(?:#.*)?$/u.exec(line)
|
|
708
|
+
const value = entry?.[2] ?? entry?.[3] ?? entry?.[4]
|
|
709
|
+
if (entry !== null && value !== undefined && value !== "") repos.set(entry[1], value)
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return repos
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Names of the card's repos that are remote-only: recorded as `mode: remote`, or with no local path, and with no clone
|
|
717
|
+
* this machine's `.machine-local.yml` points at (a `repos:` entry under the repo's name, or its name after the owner, whose path exists).
|
|
718
|
+
*/
|
|
719
|
+
function remoteRepoNames(card, { root, homeDir }) {
|
|
720
|
+
let repos
|
|
721
|
+
try {
|
|
722
|
+
repos = Array.isArray(card.data.repos) ? card.data.repos : []
|
|
723
|
+
} catch {
|
|
724
|
+
// An unreadable repos list names no repo here; card validation and the push-route check report it.
|
|
725
|
+
repos = []
|
|
726
|
+
}
|
|
727
|
+
const overrides = machineLocalRepos(root)
|
|
728
|
+
const hasLocalClone = (repo) => {
|
|
729
|
+
if (typeof repo.name !== "string" || repo.name === "") return false
|
|
730
|
+
const target = overrides.get(repo.name) ?? overrides.get(repo.name.split("/").at(-1))
|
|
731
|
+
return target !== undefined && existsSync(resolveLocalPath(target, { homeDir, deskRoot: root }))
|
|
732
|
+
}
|
|
733
|
+
return repos
|
|
734
|
+
.filter((repo) => repo !== null && typeof repo === "object" && (repo.mode === "remote" || typeof repo.local_path !== "string" || repo.local_path.trim() === "") && !hasLocalClone(repo))
|
|
735
|
+
.map((repo) => (typeof repo.name === "string" && repo.name !== "" ? redactCredentialLikeText(repo.name) : "a repo without a name"))
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
function hostLineHostname(cardText) {
|
|
739
|
+
const match = /^Host: `([^`]+)`/mu.exec(cardText)
|
|
740
|
+
return match === null ? null : match[1]
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// ── Code repos and open pull requests ───────────────────────────────────
|
|
744
|
+
|
|
745
|
+
const REPO_FETCH_TIMEOUT_MS = 10000
|
|
746
|
+
|
|
747
|
+
/** A `git fetch` run off the event loop; its caller reads only whether it succeeded (`status` 0). */
|
|
748
|
+
function fetchAsync(cmd, args, { timeout }) {
|
|
749
|
+
return new Promise((resolve) => {
|
|
750
|
+
execFile(cmd, args, { timeout, windowsHide: true }, (error) => resolve({ status: error ? 1 : 0 }))
|
|
751
|
+
})
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* `git fetch` plus branch and dirty state for every locally-cloned repo of every open task, within the deadline. The
|
|
756
|
+
* fetches run at once and off the event loop: run one after another with `spawnSync`, they held up the push checks
|
|
757
|
+
* started beside them, so a task-only boot waited for every fetch and then ran out of time for the push checks.
|
|
758
|
+
*/
|
|
759
|
+
export async function repoStates({ cards, root, spawnGit = spawnSync, homeDir = os.homedir(), now, deadline }) {
|
|
760
|
+
// The real `spawnSync` fetches asynchronously; a test's stand-in answers as it is.
|
|
761
|
+
const fetchGit = spawnGit === spawnSync ? fetchAsync : async (...args) => spawnGit(...args)
|
|
762
|
+
const repos = []
|
|
763
|
+
const pending = []
|
|
764
|
+
for (const card of cards) {
|
|
765
|
+
if (TERMINAL_STATUSES.has(card.data?.status) || !Array.isArray(card.data?.repos)) continue
|
|
766
|
+
for (const repo of card.data.repos) {
|
|
767
|
+
if (repo === null || typeof repo !== "object" || repo.mode !== "local" || typeof repo.local_path !== "string") continue
|
|
768
|
+
const label = repoLabel(card, repo)
|
|
769
|
+
if (deadline - now() < MIN_ACCOUNT_CALL_MS) {
|
|
770
|
+
pending.push(`repo state for ${label.repo} (${cardLocation(card)}): boot_budget_exceeded`)
|
|
771
|
+
continue
|
|
772
|
+
}
|
|
773
|
+
repos.push({ repo, label, dir: resolveLocalPath(repo.local_path, { homeDir, deskRoot: root }) })
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
const fetches = await Promise.all(repos.map(({ dir }) => fetchGit("git", ["-C", dir, "fetch", "--quiet", "origin"], { encoding: "utf8", timeout: REPO_FETCH_TIMEOUT_MS })))
|
|
777
|
+
const states = []
|
|
778
|
+
for (const [index, { repo, label, dir }] of repos.entries()) {
|
|
779
|
+
const fetched = fetches[index]
|
|
780
|
+
const status = spawnGit("git", ["-C", dir, "status", "--porcelain", "-b"], { windowsHide: true, encoding: "utf8", timeout: 5000 })
|
|
781
|
+
if (!status || status.status !== 0 || typeof status.stdout !== "string") {
|
|
782
|
+
states.push({ ...label, local_path: repo.local_path, path: dir, ...(cloneUrl(repo.url) === null ? {} : { url: cloneUrl(repo.url) }), present: false })
|
|
783
|
+
continue
|
|
784
|
+
}
|
|
785
|
+
const lines = status.stdout.split("\n").filter((line) => line !== "")
|
|
786
|
+
// A clone with no remote at all has nowhere to push: its commits are the delivered work (`done-evidence.js`).
|
|
787
|
+
const remotes = spawnGit("git", ["-C", dir, "remote"], { windowsHide: true, encoding: "utf8", timeout: 5000 })
|
|
788
|
+
states.push({
|
|
789
|
+
...label,
|
|
790
|
+
present: true,
|
|
791
|
+
local_path: repo.local_path,
|
|
792
|
+
path: dir,
|
|
793
|
+
branch: (lines[0] ?? "").replace(/^## (?:No commits yet on )?/u, "").split("...")[0] || null,
|
|
794
|
+
dirty: lines.length > 1,
|
|
795
|
+
fetched: Boolean(fetched) && fetched.status === 0,
|
|
796
|
+
...(remotes?.status === 0 && typeof remotes.stdout === "string" && remotes.stdout.trim() === "" ? { local_only: true } : {}),
|
|
797
|
+
})
|
|
798
|
+
}
|
|
799
|
+
return { states, pending }
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// What gh prints when GitHub refuses the credential itself (a revoked or expired token, a bad GH_TOKEN), as opposed to a rate limit or a network failure.
|
|
803
|
+
const AUTH_REJECTED = /HTTP 401|bad credentials|requires authentication|token[^.\n]{0,40}(?:invalid|expired|revoked)|no longer valid/iu
|
|
804
|
+
|
|
805
|
+
const PR_SEARCH_QUERY = "query($q: String!) { search(query: $q, type: ISSUE, first: 100) { issueCount nodes { ... on PullRequest { number title url isDraft reviewDecision repository { nameWithOwner } } } } }"
|
|
806
|
+
const PR_SEARCH_TIMEOUT_MS = 8000
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* The open pull requests the signed-in account authored, in the repos of open tasks (`stores`): one GitHub search for
|
|
810
|
+
* all of them, never one call per repo, so a desk with many repos costs what a desk with one does. GitHub returns the
|
|
811
|
+
* 100 most recently updated; `pending` says so when there were more, and says a failed or slow search in one line.
|
|
812
|
+
*/
|
|
813
|
+
export async function openPullRequests({ stores, runner, timeoutMs = PR_SEARCH_TIMEOUT_MS }) {
|
|
814
|
+
const wanted = new Set(stores.map((store) => store.toLowerCase()))
|
|
815
|
+
if (wanted.size === 0) return { prs: [], pending: [] }
|
|
816
|
+
const result = await runner(["api", "graphql", "-f", `query=${PR_SEARCH_QUERY}`, "-f", "q=is:pr is:open author:@me archived:false sort:updated-desc"], { timeoutMs })
|
|
817
|
+
if (result.timedOut) return { prs: [], pending: ["open pull requests: timeout"] }
|
|
818
|
+
if (result.code !== 0) {
|
|
819
|
+
const said = `${result.stderr ?? ""}\n${result.stdout ?? ""}`
|
|
820
|
+
// The offline sign-in check cannot see a token GitHub has revoked, or an invalid GH_TOKEN; this call can, so say it once, as a warning.
|
|
821
|
+
if (AUTH_REJECTED.test(said)) return { prs: [], pending: [`auth: GitHub rejected the sign-in gh uses (gh said: ${redactCredentialLikeText(trimmed(said, 200).replace(/\s+/gu, " "))}); pushes will fail until you run \`gh auth login --hostname github.com\`, or unset or replace GH_TOKEN if it is set`] }
|
|
822
|
+
return { prs: [], pending: ["open pull requests: GitHub search failed"] }
|
|
823
|
+
}
|
|
824
|
+
let search
|
|
825
|
+
try {
|
|
826
|
+
search = JSON.parse(result.stdout)?.data?.search
|
|
827
|
+
} catch {
|
|
828
|
+
search = null
|
|
829
|
+
}
|
|
830
|
+
if (search === null || typeof search !== "object" || !Array.isArray(search.nodes)) return { prs: [], pending: ["open pull requests: GitHub search failed"] }
|
|
831
|
+
const prs = []
|
|
832
|
+
for (const entry of search.nodes) {
|
|
833
|
+
const store = entry?.repository?.nameWithOwner
|
|
834
|
+
if (typeof store !== "string" || !wanted.has(store.toLowerCase())) continue
|
|
835
|
+
prs.push({ store, number: entry.number, title: redactCredentialLikeText(String(entry.title ?? "")), url: entry.url, draft: entry.isDraft === true, review: entry.reviewDecision ?? null })
|
|
836
|
+
}
|
|
837
|
+
const more = Number(search.issueCount) > search.nodes.length ? [`open pull requests: only the ${search.nodes.length} most recently updated of ${search.issueCount} were checked`] : []
|
|
838
|
+
return { prs, pending: more }
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// ── Orchestrator ────────────────────────────────────────────────────────
|
|
842
|
+
|
|
843
|
+
/** A push route that could not be found or checked, as a `degraded` or `pending` line, and a stored token GitHub refused, once per account, as a warning. */
|
|
844
|
+
function notePushAccounts(pushAccounts, degraded, pending) {
|
|
845
|
+
for (const entry of pushAccounts) {
|
|
846
|
+
const where = cardLocation(entry)
|
|
847
|
+
if (entry.result === "no_account_can_deliver") {
|
|
848
|
+
degraded.push(`push account: no signed-in account can push ${entry.store} for ${where}`)
|
|
849
|
+
} else if (entry.result === "pending") {
|
|
850
|
+
pending.push(`push account for ${entry.store} (${where}): ${entry.reason}`)
|
|
851
|
+
} else if (entry.result !== "account_found" && entry.result !== "not_a_github_repo") {
|
|
852
|
+
degraded.push(`push account: ${entry.store} (${where}) — ${entry.result}`)
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
for (const account of new Set(pushAccounts.flatMap((entry) => (Array.isArray(entry.accounts) ? entry.accounts.filter((item) => item.reason === "auth_failed").map((item) => item.account) : [])))) {
|
|
856
|
+
pending.push(`auth: GitHub rejected the stored sign-in for ${account}; pushes as ${account} will fail until you run \`gh auth login --hostname github.com\``)
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/** `result.task` for `--task <query>`: the resolved task with its remote-only repos and whether its Host line names another host, or why none resolved. */
|
|
861
|
+
function namedTaskResult(taskQuery, cards, { root, host, homeDir }) {
|
|
862
|
+
const resolved = resolveTaskQuery(taskQuery, cards, root.path)
|
|
863
|
+
if (resolved.status !== "resolved") return resolved
|
|
864
|
+
const { file, ...shown } = resolved.task
|
|
865
|
+
const recorded = hostLineHostname(readCardText(file) ?? "")
|
|
866
|
+
return { status: "resolved", task: { ...shown, remote_repos: remoteRepoNames(cards.find((card) => card.file === file), { root: root.path, homeDir }) }, host_line_changed: recorded !== null && recorded !== host.hostname }
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/** The cards of the task `resolveTaskQuery` resolved, or none. */
|
|
870
|
+
function namedCards(resolved, cards) {
|
|
871
|
+
return resolved.status === "resolved" ? cards.filter((card) => card.file === resolved.task.file) : []
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/** The GitHub `owner/repo` of every repo of every open task, read from the cards and the clones' config files, never by running git. */
|
|
875
|
+
function taskStores(cards, { root, homeDir }) {
|
|
876
|
+
const stores = new Set()
|
|
877
|
+
for (const card of cards) {
|
|
878
|
+
// A card that cannot be read here names no repo; card validation reports it.
|
|
879
|
+
try {
|
|
880
|
+
if (TERMINAL_STATUSES.has(card.data.status) || !Array.isArray(card.data.repos)) continue
|
|
881
|
+
for (const repo of card.data.repos) {
|
|
882
|
+
if (repo === null || typeof repo !== "object") continue
|
|
883
|
+
if (repo.mode === "remote" && typeof repo.name === "string" && PATTERNS.prRepo.test(repo.name)) stores.add(repo.name)
|
|
884
|
+
else if (repo.mode === "local") {
|
|
885
|
+
const store = resolveLocalStore(repo.local_path, { homeDir, deskRoot: root, fileOnly: true })
|
|
886
|
+
if (store !== null) stores.add(store)
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
} catch {
|
|
890
|
+
continue
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
return [...stores]
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* `--task <query> --task-only`: what a session that already booted needs once the operator picks a task, and nothing it
|
|
898
|
+
* already has. The task's push routes and repo state, and the instructions about that task; no sync, migrations, task
|
|
899
|
+
* list, pull requests, factory lines or AGENTS.md.
|
|
900
|
+
*/
|
|
901
|
+
async function taskOnlyBoot({ taskQuery, root, host, degraded, pending, walkFn, repoFn, gh, now, deadline, spawnGit, homeDir }) {
|
|
902
|
+
let cards = []
|
|
903
|
+
try {
|
|
904
|
+
cards = walkFn(root.path)
|
|
905
|
+
} catch (error) {
|
|
906
|
+
degraded.push(`cards: ${error.message}`)
|
|
907
|
+
}
|
|
908
|
+
const task = namedTaskResult(taskQuery, cards, { root, host, homeDir })
|
|
909
|
+
const named = namedCards(resolveTaskQuery(taskQuery, cards, root.path), cards)
|
|
910
|
+
const routes = resolvePushAccounts({ root: root.path, cards: named, runner: gh, now, deadlineMs: Math.max(deadline - now(), 0), spawnGit, homeDir })
|
|
911
|
+
// The routes run while the repos are fetched; a failure is reported where they are awaited, below.
|
|
912
|
+
routes.catch(() => {})
|
|
913
|
+
let repoStateList = []
|
|
914
|
+
try {
|
|
915
|
+
const found = await repoFn({ cards: named, root: root.path, spawnGit, homeDir, now, deadline })
|
|
916
|
+
repoStateList = found.states
|
|
917
|
+
pending.push(...found.pending)
|
|
918
|
+
} catch (error) {
|
|
919
|
+
degraded.push(`repo_states: ${error.message}`)
|
|
920
|
+
}
|
|
921
|
+
let pushAccounts = []
|
|
922
|
+
try {
|
|
923
|
+
pushAccounts = await routes
|
|
924
|
+
} catch (error) {
|
|
925
|
+
degraded.push(`push_accounts: ${error.message}`)
|
|
926
|
+
}
|
|
927
|
+
notePushAccounts(pushAccounts, degraded, pending)
|
|
928
|
+
const blockers = blockingClones(task, repoStateList)
|
|
929
|
+
const ask = blockers.length > 0 ? [askThenHandOff(blockers, task.task)] : []
|
|
930
|
+
const items = namedTaskInstructions({ task, repoStateList, root, host, blocked: blockers.length > 0, taskOnly: true })
|
|
931
|
+
return {
|
|
932
|
+
...emptyResult({ status: healthWord(degraded), degraded, pending, instructions: [...ask, ...pushLines(pushAccounts), ...items.map((item) => item.text)], root, host }),
|
|
933
|
+
task_only: true,
|
|
934
|
+
task,
|
|
935
|
+
push_accounts: pushAccounts,
|
|
936
|
+
repo_states: repoStateList,
|
|
937
|
+
// The text boot prints the routes in their own section, as the full boot prints them on each task.
|
|
938
|
+
text_instructions: [...ask, ...items.map((item) => item.plain)],
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// The checks' ceiling: each network check has its own, shorter limit, and they run at once, during the sync. The sync
|
|
943
|
+
// has its own 20 s limit (`session-sync.js`) and is never cut short; its budget here is only a backstop above it.
|
|
944
|
+
const DEFAULT_BUDGET_MS = 15000
|
|
945
|
+
const SYNC_BUDGET_MS = 25000
|
|
946
|
+
const AGENT_HOSTS = Object.freeze(["claude", "copilot"])
|
|
947
|
+
|
|
948
|
+
const HOST_ENV = Object.freeze({
|
|
949
|
+
claude: ["CLAUDECODE", "CLAUDE_PLUGIN_ROOT", "CLAUDE_PROJECT_DIR"],
|
|
950
|
+
copilot: ["COPILOT_AGENT_SESSION_ID", "COPILOT_CLI", "GITHUB_COPILOT_CLI"],
|
|
951
|
+
})
|
|
952
|
+
|
|
953
|
+
/** Which of the covered agent hosts this process runs under, from the variables each host sets; "unknown" otherwise. */
|
|
954
|
+
export function detectAgentHost(env) {
|
|
955
|
+
// A Copilot session started from a Claude Code shell inherits CLAUDECODE, so the session id Copilot itself sets wins.
|
|
956
|
+
if (env.COPILOT_AGENT_SESSION_ID) return "copilot"
|
|
957
|
+
const found = Object.entries(HOST_ENV).find(([, names]) => names.some((name) => Boolean(env[name])))
|
|
958
|
+
return found === undefined ? "unknown" : found[0]
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Whether the host has already put the desk's AGENTS.md into the model's instructions, so boot need not print it again.
|
|
963
|
+
* Copilot loads the AGENTS.md of the folder it starts in; only that exact file, read by a Copilot boot run from that
|
|
964
|
+
* folder, counts. Any other case, or a path that cannot be resolved, prints the file as before.
|
|
965
|
+
*/
|
|
966
|
+
export function hostLoadsAgentsMd({ agent, cwd, agentsMd }) {
|
|
967
|
+
if (agent !== "copilot" || !agentsMd) return false
|
|
968
|
+
try {
|
|
969
|
+
return realpathSync(path.join(cwd, "AGENTS.md")) === realpathSync(agentsMd.path)
|
|
970
|
+
} catch {
|
|
971
|
+
return false
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
function parserName(nested) {
|
|
976
|
+
return nested ? "gray-matter" : "lite"
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
function prereqAction(name, check) {
|
|
980
|
+
if (name === "gh" && check.reason === "gh_missing") {
|
|
981
|
+
return "Install gh: macOS `brew install gh`, Windows `winget install --id GitHub.cli`, Linux see https://cli.github.com/."
|
|
982
|
+
}
|
|
983
|
+
if (name === "gh" && check.reason === "gh_too_old") {
|
|
984
|
+
return `Upgrade gh (found ${check.version}, need >= 2.40): brew upgrade gh / winget upgrade GitHub.cli / sudo apt upgrade gh.`
|
|
985
|
+
}
|
|
986
|
+
if (name === "jq" && check.reason === "jq_missing") {
|
|
987
|
+
return "Install jq: `brew install jq`, `winget install jqlang.jq`, or `sudo apt install jq`."
|
|
988
|
+
}
|
|
989
|
+
if (name === "auth" && check.reason === "auth_stale") {
|
|
990
|
+
return `Re-authenticate: run \`gh auth login --hostname github.com\` (gh said: ${check.detail.replace(/\s+/gu, " ")}).`
|
|
991
|
+
}
|
|
992
|
+
return `Fix the ${name} prerequisite (${check.reason}) before continuing.`
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
function cardLocation(entry) {
|
|
996
|
+
return entry.desk ? `desks/${entry.desk}/${entry.track}/${entry.slug}` : `${entry.track}/${entry.slug}`
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
function emptyResult({ status, degraded, pending, instructions = [], root, host }) {
|
|
1000
|
+
return {
|
|
1001
|
+
boot_complete: true,
|
|
1002
|
+
status,
|
|
1003
|
+
degraded,
|
|
1004
|
+
pending,
|
|
1005
|
+
instructions,
|
|
1006
|
+
covers_hosts: AGENT_HOSTS,
|
|
1007
|
+
root,
|
|
1008
|
+
host,
|
|
1009
|
+
migrations: [],
|
|
1010
|
+
prereqs: null,
|
|
1011
|
+
sync: null,
|
|
1012
|
+
sync_summary: null,
|
|
1013
|
+
needs_operator: null,
|
|
1014
|
+
agents_md: null,
|
|
1015
|
+
person_agents_md: null,
|
|
1016
|
+
lessons_shelf: null,
|
|
1017
|
+
notes: null,
|
|
1018
|
+
active_tasks: null,
|
|
1019
|
+
card_parser: parserName(NESTED_CARD_FIELDS),
|
|
1020
|
+
card_validation: [],
|
|
1021
|
+
push_accounts: [],
|
|
1022
|
+
repo_states: [],
|
|
1023
|
+
open_prs: [],
|
|
1024
|
+
task: null,
|
|
1025
|
+
stale_desk: null,
|
|
1026
|
+
plugin_update: null,
|
|
1027
|
+
other_sessions: null,
|
|
1028
|
+
machine_desks: [],
|
|
1029
|
+
release_alert: null,
|
|
1030
|
+
desk_problems: null,
|
|
1031
|
+
unmerged_saves: [],
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export { isNoninteractive }
|
|
1036
|
+
|
|
1037
|
+
// The helper's result is evidence, not a permanent reporting rule after independent recovery.
|
|
1038
|
+
function syncInstruction(sync, root) {
|
|
1039
|
+
if (sync !== null && sync !== undefined && sync.state !== "unresolved") return null
|
|
1040
|
+
const git = `git -C ${shellQuote(root.path)}`
|
|
1041
|
+
return `Verify desk sync with direct Git before reporting local-only state (desk-problem, "Direct Git sync recovery"). Helper expiry means pending, effects unknown; it does not establish absent effects. Read back actual HEAD/index/files and observed Git-operation/conflict markers; do not race a checkout mutation. Through the established account-scoped Git transport, run \`${git} fetch --no-tags origin\`, then \`${git} rev-list --left-right --count 'HEAD...@{upstream}'\` on the confirmed state branch and origin upstream. Clean status or cached origin refs are not currentness evidence. A successful fresh fetch and 0 ahead and 0 behind, with no observed Git-operation/conflict barrier, establish current commits even with unrelated dirty files and an unknown helper outcome: do not report working from local state or repeat the helper-timeout banner. This does not prove helper settlement, publication of dirty files or binary/LFS readiness. Otherwise recover only within safe writer ownership; preserve authentication, access, conflict and unknown-effect barriers and report the remaining limitation, continuing independent authorized work. Never stash, rebase, reset, move or overwrite another writer's work, or bypass a lock.`
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// A push route worth telling the agent about: no account can deliver, the route goes through a fork, or the only
|
|
1045
|
+
// account with access is not the one gh has active (the agent would push with the wrong login). A plain direct push
|
|
1046
|
+
// by the active account needs no line. `accounts` lists gh's active account first.
|
|
1047
|
+
function pushInstruction(entry, where) {
|
|
1048
|
+
const store = entry.store
|
|
1049
|
+
if (entry.result === "no_account_can_deliver") {
|
|
1050
|
+
const reasons = Array.isArray(entry.accounts) && entry.accounts.length > 0
|
|
1051
|
+
? ` (${entry.accounts.map((item) => `${item.account}: ${item.reason}`).join("; ")})`
|
|
1052
|
+
: ""
|
|
1053
|
+
return `Do not push ${store} (${where}): no signed-in account can${reasons}. Ask the operator which account to use, or fork, and say so in one line when you report on the task.`
|
|
1054
|
+
}
|
|
1055
|
+
if (entry.result === "account_found") {
|
|
1056
|
+
const active = entry.accounts[0].account
|
|
1057
|
+
if (entry.route === "fork") {
|
|
1058
|
+
const notActive = entry.account === active ? "" : ` Push as ${entry.account} (\`GH_TOKEN=$(gh auth token --user ${entry.account})\` for the git or gh call), and write ${entry.account}, never ${active}, as the push account in any note.`
|
|
1059
|
+
const route = pushRoute(entry)
|
|
1060
|
+
return `Push route for ${store} (${where}): ${route}${route.endsWith(".") ? " Account" : "; account"} ${entry.account} cannot push to it directly. Push your branch to ${entry.account}'s fork and open the pull request from there; never push to ${store} itself.${notActive} Tell the operator this route in one line when you report on this task; it is one line of your report, not the whole of it. ${ROUTE_CHECKED}`
|
|
1061
|
+
}
|
|
1062
|
+
if (entry.account !== active) {
|
|
1063
|
+
return `Push route for ${store} (${where}): account ${entry.account} is the one with push access (route ${entry.route}), but gh's active account is ${active}. Push as ${entry.account} (\`GH_TOKEN=$(gh auth token --user ${entry.account})\` for the git or gh call), not with the active login. Tell the operator this in one line when you report on the task. ${ROUTE_CHECKED}`
|
|
1064
|
+
}
|
|
1065
|
+
return null
|
|
1066
|
+
}
|
|
1067
|
+
if (entry.result === "pending" || entry.result === "not_a_github_repo") return null
|
|
1068
|
+
return `Push access for ${store} (${where}) could not be checked (${entry.result}): treat it as unknown and verify with \`gh auth status\` before pushing.`
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// One line per store and outcome: boot checks push routes only for the task the operator named, so every line is that task's.
|
|
1072
|
+
function pushLines(pushAccounts) {
|
|
1073
|
+
const lines = new Map()
|
|
1074
|
+
for (const entry of pushAccounts) {
|
|
1075
|
+
const line = pushInstruction(entry, `task ${cardLocation(entry)}`)
|
|
1076
|
+
if (line !== null) lines.set([entry.store, entry.result, entry.account, entry.route].join("|"), line)
|
|
1077
|
+
}
|
|
1078
|
+
return [...lines.values()]
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// What to do about a recorded local clone that is not on this machine: the exact clone command when the card carries
|
|
1082
|
+
// the repo's `url` (or its name is owner/repo), otherwise exactly what to ask the operator (boot acceptance round A:
|
|
1083
|
+
// "no remote" left the agent guessing between inventing a repo and asking an open question).
|
|
1084
|
+
function hasCloneSource(missing) {
|
|
1085
|
+
return typeof missing.url === "string" || (typeof missing.repo === "string" && /^[\w.-]+\/[\w.-]+$/u.test(missing.repo))
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
function missingCloneInstruction(missing) {
|
|
1089
|
+
const where = shellQuotePath(missing.path ?? missing.local_path)
|
|
1090
|
+
const lead = `The named task's local repo ${missing.repo} is not at its recorded path ${shownRepoPath(missing)}`
|
|
1091
|
+
if (typeof missing.url === "string") {
|
|
1092
|
+
return `${lead}: only if the next step needs its code, clone it with \`git clone -- ${shellQuote(missing.url)} ${where}\` (the card's recorded url); otherwise do not clone it.`
|
|
1093
|
+
}
|
|
1094
|
+
return `${lead}: only if the next step needs its code, clone it with \`gh repo clone ${shellQuote(missing.repo)} ${where}\`; otherwise do not clone it.`
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// A missing clone with no source to clone from blocks the hand-off: the agent has to ask first. So the hand-off and the question are ONE instruction, in
|
|
1098
|
+
// the order they happen, never two parallel steps (boot acceptance round O: "I can't hand off to session-resumption if I first need to ask about the missing repo").
|
|
1099
|
+
// The one question boot makes the agent ask before any work, or null when nothing blocks. The text boot prints it right after the headline and
|
|
1100
|
+
// `--json` carries it as `needs_operator`; the consent line is left out of that boot (the operator has one question to answer first).
|
|
1101
|
+
function needsOperator(ctx) {
|
|
1102
|
+
const { taskQuery, task, repoStateList } = ctx
|
|
1103
|
+
if (taskQuery === null || task?.status !== "resolved") return null
|
|
1104
|
+
const blockers = repoStateList.filter((state) => state.present === false && state.track === task.task.track && state.slug === task.task.slug && !hasCloneSource(state))
|
|
1105
|
+
if (blockers.length === 0) return null
|
|
1106
|
+
const names = blockers.map((missing) => missing.repo)
|
|
1107
|
+
// The headline names at most three repos; the question may name them all but stays within 400 characters.
|
|
1108
|
+
const summary = `${names.slice(0, 3).join(", ")}${names.length > 3 ? ` and ${names.length - 3} more` : ""} not on this machine`
|
|
1109
|
+
const each = names.map((name) => `Where is ${name} cloned, or what URL should I clone it from?`).join(" ")
|
|
1110
|
+
if (each.length <= 400) return { question: each, summary }
|
|
1111
|
+
let listed = names
|
|
1112
|
+
const together = (list) => `Where are ${list.join(", ")}${list.length < names.length ? ` and ${names.length - list.length} more` : ""} cloned, or what URLs should I clone them from?`
|
|
1113
|
+
while (listed.length > 1 && together(listed).length > 400) listed = listed.slice(0, -1)
|
|
1114
|
+
return { question: together(listed), summary }
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
function askThenHandOff(blockers, task) {
|
|
1118
|
+
const named = blockers.length === 1 ? `its local repo ${blockers[0].repo} is not at its recorded path ${shownRepoPath(blockers[0])}` : `its local repos are not at their recorded paths (${blockers.map((missing) => `${missing.repo} at ${shownRepoPath(missing)}`).join("; ")})`
|
|
1119
|
+
const questions = blockers.map((missing) => `"Where is ${missing.repo} cloned, or what URL should I clone it from?"`).join(" and ")
|
|
1120
|
+
const finish = blockers.map((missing) => `clone ${missing.repo} to ${missing.path ?? missing.local_path} (or record the path they give)`).join(" and ")
|
|
1121
|
+
return `The operator named a task (${task.card}, handle ${task.handle}), but ${named}, and the card records no usable clone url for ${blockers.length === 1 ? "it" : "them"}. Do not invent the repo or any progress in it. Before anything else, ask the operator one question and stop until they answer: ${questions} Once they answer, ${finish}, save the answer on the card with task_update (a \`url\` or \`local_path\` on that repos entry) so the next session does not ask, and only then hand off to desk:session-resumption for ${task.card} (handle ${task.handle}), skipping the status block. Every other instruction below still applies.`
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// A repo the card records as remote-only, or with no local path: it is read through the hosting service, and cloned only
|
|
1125
|
+
// when the next step needs its code (an agent once cloned a public repo into the shared /tmp just to look at it).
|
|
1126
|
+
function remoteRepoInstruction(names, root) {
|
|
1127
|
+
return `The named task's remote-only repos (no local clone): ${names.join(", ")}. Do not clone any of them unless the next step needs its code. If it does, clone into the operator's code location (\`defaults.clone_root\` in ${root.path}/.machine-local.yml, default ~/code/), never /tmp, and record the clone on the card with task_update (the repo's \`local_path\`, with \`mode: local\`).`
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
// The instructions as `{ text, plain }` pairs: `text` is what `--json` carries, `plain` the shorter wording the text boot
|
|
1131
|
+
// prints, or null when the text boot says it elsewhere (a push route sits on its task) or not at all.
|
|
1132
|
+
/** The named task's missing clones with no source to clone them from: the agent has to ask the operator before it hands off. */
|
|
1133
|
+
function blockingClones(task, repoStateList) {
|
|
1134
|
+
return task?.status === "resolved" ? repoStateList.filter((state) => state.present === false && state.track === task.task.track && state.slug === task.task.slug && !hasCloneSource(state)) : []
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// A `--task-only` run comes after a boot that printed the task list, so it points back at that list.
|
|
1138
|
+
const TASK_ONLY_UNMATCHED = "The name matches no open task: use the task list from this session's first boot and ask what to resume or start."
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* The instructions about the task `--task` named, as `{ text, plain }` items: hand off, clone what is missing, read the
|
|
1142
|
+
* remote repos, fix the Host line; or ask which task when the name matched several or none. `blocked` means an
|
|
1143
|
+
* ask-first instruction already leads (`askThenHandOff`), which carries the hand-off itself.
|
|
1144
|
+
*/
|
|
1145
|
+
function namedTaskInstructions({ task, repoStateList, root, host, noninteractive, blocked, taskOnly = false }) {
|
|
1146
|
+
const items = []
|
|
1147
|
+
const add = (text, plain = text) => items.push({ text, plain })
|
|
1148
|
+
if (task?.status === "resolved") {
|
|
1149
|
+
const named = repoStateList.filter((state) => state.present === false && state.track === task.task.track && state.slug === task.task.slug)
|
|
1150
|
+
if (!blocked) add(taskOnly ? `Hand off to desk:session-resumption for ${task.task.card} (handle ${task.task.handle}). Every instruction from this session's first boot still applies.` : `The operator named a task: hand off to desk:session-resumption for ${task.task.card} (handle ${task.task.handle}) and skip the status block. Every check above still applies.`)
|
|
1151
|
+
for (const missing of named.filter(hasCloneSource)) add(missingCloneInstruction(missing))
|
|
1152
|
+
if (task.task.remote_repos.length > 0) add(remoteRepoInstruction(task.task.remote_repos, root))
|
|
1153
|
+
if (task.host_line_changed) add(`That card's Host line names a different host; replace it with: Host: \`${host.hostname}\` / user: \`${host.user}\` / cwd: \`${host.cwd}\` / OS: \`${host.platform}\` / probed: ${host.probed_at}.`)
|
|
1154
|
+
} else if (task?.status === "ambiguous") {
|
|
1155
|
+
add(`The name matches more than one open task (${task.candidates.map((c) => c.handle).join(", ")}): ask which one, in one line.`)
|
|
1156
|
+
} else if (taskOnly) {
|
|
1157
|
+
add(TASK_ONLY_UNMATCHED)
|
|
1158
|
+
} else {
|
|
1159
|
+
add(UNMATCHED_TASK_INSTRUCTION, UNMATCHED_TASK_INSTRUCTION_TEXT)
|
|
1160
|
+
add(noninteractive ? NEW_WORK_INSTRUCTION_UNATTENDED : NEW_WORK_INSTRUCTION)
|
|
1161
|
+
}
|
|
1162
|
+
return items
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
function buildInstructionItems(ctx) {
|
|
1166
|
+
const { root, prereqResults, pushAccounts, cardValidationResult, sync, task, host, migrationEntries, taskQuery, agentHost, noninteractive, repoStateList } = ctx
|
|
1167
|
+
const body = []
|
|
1168
|
+
const add = (text, plain = text) => body.push({ text, plain })
|
|
1169
|
+
// A question for the operator comes first, before the desk path and the tool names: the agent must not start anything until it is asked.
|
|
1170
|
+
const namedBlockers = taskQuery !== null ? blockingClones(task, repoStateList) : []
|
|
1171
|
+
if (namedBlockers.length > 0) add(askThenHandOff(namedBlockers, task.task))
|
|
1172
|
+
for (const entry of migrationEntries) {
|
|
1173
|
+
add(migrationLine([entry], ctx.pluginRoot, ctx.platform).replace(/^Desk migrations: /u, ""))
|
|
1174
|
+
}
|
|
1175
|
+
add(
|
|
1176
|
+
`Use the absolute path ${root.path} for the desk in every command and tool call. Each shell call starts fresh, so an exported \`$DESK\` would not persist; where a Desk skill says \`$DESK\`, it means this path.`,
|
|
1177
|
+
`Use ${root.path} as \`$DESK\` in every command and tool call.`,
|
|
1178
|
+
)
|
|
1179
|
+
if (ctx.notes) add(notesInstruction(ctx.notes))
|
|
1180
|
+
for (const [name, check] of Object.entries(prereqResults)) {
|
|
1181
|
+
if (check.ok || check.soft === true || check.reason.endsWith("_timeout")) continue
|
|
1182
|
+
add(`Prerequisite unavailable: ${prereqAction(name, check)} Only operations depending on ${name} are affected. Do not use an unverified identity, bypass a real access denial or protected write, or claim this check passed. Continue independent authorized work through available trusted tools; preserve the diagnostic without starting unsolicited maintenance.`)
|
|
1183
|
+
}
|
|
1184
|
+
const syncLine = syncInstruction(sync, root)
|
|
1185
|
+
if (syncLine !== null) add(syncLine)
|
|
1186
|
+
for (const entry of cardValidationResult) {
|
|
1187
|
+
add(`Fix the frontmatter of ${cardLocation(entry)}/task.md (handle ${entry.handle}): ${entry.problems.join("; ")}.`)
|
|
1188
|
+
}
|
|
1189
|
+
// The named task's push routes. The text boot prints each route on its task instead, so these are `--json`-only.
|
|
1190
|
+
for (const line of pushLines(pushAccounts)) add(line, null)
|
|
1191
|
+
add(deferredToolsHint(agentHost), deferredToolsHintShort(agentHost))
|
|
1192
|
+
if (taskQuery !== null) {
|
|
1193
|
+
body.push(...namedTaskInstructions({ task, repoStateList, root, host, noninteractive, blocked: namedBlockers.length > 0 }))
|
|
1194
|
+
} else {
|
|
1195
|
+
add(NO_TASK_INSTRUCTION, NO_TASK_INSTRUCTION_TEXT)
|
|
1196
|
+
add(noninteractive ? NEW_WORK_INSTRUCTION_UNATTENDED : NEW_WORK_INSTRUCTION)
|
|
1197
|
+
}
|
|
1198
|
+
signoffInstructions(ctx.unsigned, { noninteractive, seen: ctx.signoffSeen === true }).forEach((text) => add(text))
|
|
1199
|
+
add("If the next step needs something that is not on this machine (a branch, a file, a clone), say what is missing and stop; never recreate or simulate it. Never clone or fetch to look for something the card says is on another machine, and never clone inside the desk folder; clone a missing repo only where an instruction above says to, at the path it gives.", null)
|
|
1200
|
+
add("When you report on a task, say its real status; say 'done' only for a task whose status is done.", null)
|
|
1201
|
+
add(`This boot covers the ${AGENT_HOSTS.join(", ")} hosts${agentHost === "unknown" ? "" : `; this session looks like ${agentHost}`}.`, null)
|
|
1202
|
+
return body
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
function buildInstructions(ctx) {
|
|
1206
|
+
return buildInstructionItems(ctx).map((item) => item.text)
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
// The three closing rules that `--json` carries as separate lines, as one instruction, plus the step-heading rule.
|
|
1210
|
+
const CLOSING_RULES = "Missing: say so and stop; never recreate, clone or fetch it. Report real status. Durable work (reports, evidence, images others must find) goes in the focused task's desk folder; host session files/ is scratch, overriding its artifacts rule."
|
|
1211
|
+
|
|
1212
|
+
// What the plain-text boot says before its instructions: what Desk is, where its RFC is and the two boundaries.
|
|
1213
|
+
function introInstruction(pluginRoot) {
|
|
1214
|
+
return `Desk RFC: ${path.join(pluginRoot, "docs", "agentic-engineering-v3-rfc.md")}. Never do anything irreversible or contact anyone without approval.`
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
// The plain-text wording of the same instructions, in the order the text boot prints them: the closing rules last.
|
|
1218
|
+
function buildTextInstructions(ctx) {
|
|
1219
|
+
return [...buildInstructionItems(ctx).map((item) => item.plain).filter((line) => line !== null), CLOSING_RULES]
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
function withinBudget(promise, ms, timeoutValue) {
|
|
1223
|
+
let timer
|
|
1224
|
+
const timeout = new Promise((resolve) => {
|
|
1225
|
+
timer = setTimeout(() => resolve(timeoutValue), Math.max(ms, 0))
|
|
1226
|
+
})
|
|
1227
|
+
return Promise.race([promise, timeout]).finally(() => clearTimeout(timer))
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* One call replacing session-start's mechanical steps (migration check, host
|
|
1232
|
+
* probe, prereq probe, sync, active-task scan, card validation, push-account
|
|
1233
|
+
* resolution, repo fetch and open-PR lookup, named-task resolution): see the module header for the full result shape
|
|
1234
|
+
* and the design choices behind it. `taskQuery`, when given, names the task
|
|
1235
|
+
* the operator wants to resume.
|
|
1236
|
+
*/
|
|
1237
|
+
export async function bootOnce({
|
|
1238
|
+
env = process.env,
|
|
1239
|
+
cwd = process.cwd(),
|
|
1240
|
+
now = Date.now,
|
|
1241
|
+
budgetMs = DEFAULT_BUDGET_MS,
|
|
1242
|
+
syncBudgetMs = SYNC_BUDGET_MS,
|
|
1243
|
+
taskQuery = null,
|
|
1244
|
+
taskOnly = false,
|
|
1245
|
+
spawnGit = spawnSync,
|
|
1246
|
+
homeDir = env.HOME || os.homedir(),
|
|
1247
|
+
gh: ghArg,
|
|
1248
|
+
ghAuth: ghAuthArg,
|
|
1249
|
+
authOptions = {},
|
|
1250
|
+
jq = commandRunner("jq"),
|
|
1251
|
+
pluginRoot = DESK_PLUGIN_ROOT,
|
|
1252
|
+
migrationsFn = pendingMigrations,
|
|
1253
|
+
platform = process.platform,
|
|
1254
|
+
syncFn = syncWorkspace,
|
|
1255
|
+
backgroundFetchFn = startBackgroundFetch,
|
|
1256
|
+
activeTasksFn = activeTasks,
|
|
1257
|
+
walkFn = walkTaskCards,
|
|
1258
|
+
repoFn = repoStates,
|
|
1259
|
+
localOnlyFn = recordLocalOnlyOnCards,
|
|
1260
|
+
stateBranchFn = resolveStartupStateBranch,
|
|
1261
|
+
prFn = openPullRequests,
|
|
1262
|
+
lastSyncFn = lastSyncedAt,
|
|
1263
|
+
cardGuardFn = installCardGuard,
|
|
1264
|
+
agentsFn = readAgentsMd,
|
|
1265
|
+
shelfFn = shelfIndex,
|
|
1266
|
+
notesFn = openNotes,
|
|
1267
|
+
personFn = improvementPerson,
|
|
1268
|
+
memberFn = resolveMember,
|
|
1269
|
+
staleDeskFn = checkStaleDesk,
|
|
1270
|
+
pluginUpdateFn = checkPluginUpdate,
|
|
1271
|
+
otherSessionsFn = otherSessions,
|
|
1272
|
+
releaseAlertFn = checkReleaseAlert,
|
|
1273
|
+
nestedCards = NESTED_CARD_FIELDS,
|
|
1274
|
+
unsignedFn = recordUnsigned,
|
|
1275
|
+
signoffListedFn = noteSignoffListed,
|
|
1276
|
+
} = {}) {
|
|
1277
|
+
const gh = ghArg ?? ghRunner({ env })
|
|
1278
|
+
const ghAuth = ghAuthArg ?? (ghArg ?? commandRunner("gh", { env }))
|
|
1279
|
+
const deadline = now() + budgetMs
|
|
1280
|
+
const host = { ...probeHost({ env, now }), agent: detectAgentHost(env) }
|
|
1281
|
+
|
|
1282
|
+
const degraded = []
|
|
1283
|
+
const pending = []
|
|
1284
|
+
|
|
1285
|
+
// Migrations settle before anything touches `$DESK/`: a stale pre-migration
|
|
1286
|
+
// path must never be scanned or synced.
|
|
1287
|
+
let migrationEntries = []
|
|
1288
|
+
try {
|
|
1289
|
+
// A task-only boot follows a full boot of the same session, which ran the migration checks.
|
|
1290
|
+
migrationEntries = taskOnly && taskQuery !== null ? [] : await migrationsFn({ pluginRoot, env, cwd })
|
|
1291
|
+
} catch (error) {
|
|
1292
|
+
degraded.push(`migrations: ${error.message}`)
|
|
1293
|
+
}
|
|
1294
|
+
for (const entry of migrationEntries) {
|
|
1295
|
+
if (entry.state === "unchecked") pending.push(`migration ${entry.id}: not checked in time`)
|
|
1296
|
+
if (entry.state === "bash_unavailable") degraded.push(`migration ${entry.id}: not checked, bash could not run (${bashHint(platform)})`)
|
|
1297
|
+
if (entry.state === "restart" || entry.state === "run") degraded.push(`migration ${entry.id}: ${entry.state === "restart" ? "needs a restart" : entry.reason}`)
|
|
1298
|
+
}
|
|
1299
|
+
const migrationSummary = migrationEntries.map((entry) => ({ id: entry.id, state: entry.state }))
|
|
1300
|
+
const stopForMigration = migrationEntries.some((entry) => entry.state === "restart" || entry.state === "run")
|
|
1301
|
+
|
|
1302
|
+
const root = resolveBootRoot({ env, cwd, homeDir })
|
|
1303
|
+
if (root.status === "setup_required") {
|
|
1304
|
+
return { ...emptyResult({ status: root.status, degraded, pending, root, host }), migrations: migrationSummary, instructions: [
|
|
1305
|
+
"No desk is bound on this host: this is a first run, not an outage. Hand off to desk:first-run-bootstrap Entrance A (or the onboarding path desk_status names in `onboarding_skill`, such as an overlay's own) and skip the rest of session-start.",
|
|
1306
|
+
] }
|
|
1307
|
+
}
|
|
1308
|
+
if (root.status === "degraded") {
|
|
1309
|
+
// `resolveBootRoot` only ever reaches "degraded" through a thrown error
|
|
1310
|
+
// that `util/paths.js` (directly, or via `loadActivationConfig`'s
|
|
1311
|
+
// `codedError` wrapping) always attaches both `.message` and `.path` to,
|
|
1312
|
+
// so neither field falls back to a placeholder here.
|
|
1313
|
+
degraded.push(`root: ${root.message}`)
|
|
1314
|
+
return { ...emptyResult({ status: root.status, degraded, pending, root, host }), migrations: migrationSummary, instructions: [
|
|
1315
|
+
`Desk operations unavailable: the desk configured at ${root.path} is missing or unreadable. Never use a different desk to work around this. Continue independent authorized work through trusted available tools. Preserve the binding and diagnostic; restoration or rebinding is separate scoped work, not a prerequisite for the independent task.`,
|
|
1316
|
+
] }
|
|
1317
|
+
}
|
|
1318
|
+
if (stopForMigration) {
|
|
1319
|
+
const instructions = migrationEntries.map((entry) => migrationLine([entry], pluginRoot, platform).replace(/^Desk migrations: /u, ""))
|
|
1320
|
+
return { ...emptyResult({ status: "degraded", degraded, pending, root, host }), instructions, migrations: migrationSummary }
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
if (taskOnly && taskQuery !== null) {
|
|
1324
|
+
return taskOnlyBoot({ taskQuery, root, host, degraded, pending, walkFn, repoFn, gh: withAmbientToken(gh, env), now, deadline, spawnGit, homeDir })
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// A headless evaluator session or a read-only child (DESK_READ_ONLY_CHILD) changes nothing in the desk: no card guard, no sync, no stale refresh.
|
|
1328
|
+
const headless = startupChangesNothing(env)
|
|
1329
|
+
// The stale-Desk lookup runs alongside everything below; it has its own hard budget and never rejects.
|
|
1330
|
+
const staleDesk = Promise.resolve()
|
|
1331
|
+
.then(() => (headless ? null : staleDeskFn({ env, pluginRoot, agentHost: host.agent, now })))
|
|
1332
|
+
.catch(() => null)
|
|
1333
|
+
// Who else works in this repo on this machine (`./other-sessions.js`): a few local reads with their own budget.
|
|
1334
|
+
const others = Promise.resolve()
|
|
1335
|
+
.then(() => (headless ? null : otherSessionsFn({ env, cwd, now, platform, home: homeDir })))
|
|
1336
|
+
.catch(() => null)
|
|
1337
|
+
|
|
1338
|
+
// The network checks start now and run while the card guard and the sync run, so boot waits
|
|
1339
|
+
// for the slowest of them, not their sum. None of them reads the desk's content after the sync:
|
|
1340
|
+
// - the prerequisite probe (gh, jq, sign-in);
|
|
1341
|
+
// - one GitHub search for the operator's open pull requests, only when an open task names a GitHub repo;
|
|
1342
|
+
// - the push route of the named task's repos, only when the operator named a task. A boot that names no task
|
|
1343
|
+
// checks no push routes: the route matters only before a push, and the task_focus reply carries it (runtime/startup-boot.js
|
|
1344
|
+
// runs `--task <track/slug> --task-only` for it) once the operator picks one.
|
|
1345
|
+
// The card list read here, before the sync, only decides what to start; everything shown is read after the sync.
|
|
1346
|
+
const prereqsStarted = checkPrereqs({ gh, jq, ghAuth, authOptions })
|
|
1347
|
+
let earlyCards = []
|
|
1348
|
+
try {
|
|
1349
|
+
earlyCards = walkFn(root.path)
|
|
1350
|
+
} catch {
|
|
1351
|
+
earlyCards = []
|
|
1352
|
+
}
|
|
1353
|
+
const earlyStores = taskStores(earlyCards, { root: root.path, homeDir })
|
|
1354
|
+
// Called now (a promise executor runs at once), not in a later microtask: the card guard below blocks the event loop
|
|
1355
|
+
// for a moment, and the search must already be under way.
|
|
1356
|
+
const prsStarted = earlyStores.length === 0 ? null : new Promise((resolve) => resolve(prFn({ stores: earlyStores, runner: ghAuth }))).catch((error) => ({ error }))
|
|
1357
|
+
const pushRunner = withAmbientToken(gh, env)
|
|
1358
|
+
const pushFor = (selected) => resolvePushAccounts({ root: root.path, cards: selected, runner: pushRunner, now, deadlineMs: Math.max(deadline - now(), 0), spawnGit, homeDir })
|
|
1359
|
+
const earlyNamed = taskQuery === null ? [] : namedCards(resolveTaskQuery(taskQuery, earlyCards, root.path), earlyCards)
|
|
1360
|
+
const pushStarted = earlyNamed.length === 0 ? null : pushFor(earlyNamed)
|
|
1361
|
+
// A failure is reported where the routes are awaited, below; this only keeps it from being an unhandled rejection meanwhile.
|
|
1362
|
+
pushStarted?.catch(() => {})
|
|
1363
|
+
|
|
1364
|
+
// The desk's own pre-commit hook (refuses a hand commit that changes a task card; see desk/card-commit-guard.js). Installing is idempotent and quiet;
|
|
1365
|
+
// only a failure to install is worth a line.
|
|
1366
|
+
try {
|
|
1367
|
+
const guard = headless ? { state: "skipped" } : cardGuardFn(root.path, { spawnGit })
|
|
1368
|
+
if (guard.state === "failed") degraded.push(`card guard: ${guard.reason}`)
|
|
1369
|
+
// A tracked hooks folder is the team's choice, not a fault: one note with the manual remedy, nothing degraded.
|
|
1370
|
+
if (guard.state === "tracked") pending.push(`card guard not installed: ${guard.reason}; ${guard.remedy}`)
|
|
1371
|
+
} catch (error) {
|
|
1372
|
+
degraded.push(`card guard: ${error.message}`)
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
let sync = null
|
|
1376
|
+
let syncTimedOut = false
|
|
1377
|
+
try {
|
|
1378
|
+
const synced = headless ? { state: "skipped", nothingToSync: "headless" } : await withinBudget(syncFn({ root: root.path, env }), syncBudgetMs, { timedOut: true })
|
|
1379
|
+
if (synced.timedOut === true) {
|
|
1380
|
+
syncTimedOut = true
|
|
1381
|
+
pending.push("sync: boot_budget_exceeded")
|
|
1382
|
+
} else sync = synced
|
|
1383
|
+
// Keep the upstream fetched while this server lives, so the next pull is a local fast-forward.
|
|
1384
|
+
if (sync?.state === "synced" && sync.nothingToSync === undefined) backgroundFetchFn({ root: root.path, env })
|
|
1385
|
+
} catch (error) {
|
|
1386
|
+
degraded.push(`sync: ${error.message}`)
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
const prereqs = await prereqsStarted
|
|
1390
|
+
for (const [name, check] of Object.entries(prereqs)) {
|
|
1391
|
+
if (check.ok) continue
|
|
1392
|
+
if (check.soft === true) {
|
|
1393
|
+
pending.push(`${name}: Could not verify GitHub sign-in (${check.why}); continuing; pushes may fail until it clears`)
|
|
1394
|
+
} else if (check.reason.endsWith("_timeout")) {
|
|
1395
|
+
pending.push(`${name}: ${check.reason}`)
|
|
1396
|
+
} else {
|
|
1397
|
+
degraded.push(`${name}: ${check.reason}`)
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
const syncProblem = syncDegradation(sync)
|
|
1402
|
+
if (syncProblem !== null) degraded.push(syncProblem)
|
|
1403
|
+
let lastSyncAt = null
|
|
1404
|
+
try {
|
|
1405
|
+
lastSyncAt = lastSyncFn({ root: root.path, env })
|
|
1406
|
+
} catch {
|
|
1407
|
+
lastSyncAt = null
|
|
1408
|
+
}
|
|
1409
|
+
const syncSummaryText = syncSummary({ sync, timedOut: syncTimedOut, lastSyncAt })
|
|
1410
|
+
// The desk's own rules, read after the sync so a pull that changed them is already in. Never throws.
|
|
1411
|
+
let agentsMd = null
|
|
1412
|
+
try {
|
|
1413
|
+
agentsMd = agentsFn(root.path)
|
|
1414
|
+
} catch {
|
|
1415
|
+
agentsMd = null
|
|
1416
|
+
}
|
|
1417
|
+
const agentsMdInHostInstructions = hostLoadsAgentsMd({ agent: host.agent, cwd, agentsMd })
|
|
1418
|
+
// The person the Desk tools resolve (crew-member.js, the same resolver as the tool server's admission), worked out once:
|
|
1419
|
+
// it is printed on the status line and picks the person's own AGENTS.md. GitHub is
|
|
1420
|
+
// asked only when several signed-in accounts are on the roster, within a short budget. A bad DESK_PERSON never stops the boot.
|
|
1421
|
+
let member = null
|
|
1422
|
+
try {
|
|
1423
|
+
member = await memberFn({ deskRoot: root.path, env, homeDir, gh, timeoutMs: MEMBER_BUDGET_MS })
|
|
1424
|
+
} catch {
|
|
1425
|
+
member = null
|
|
1426
|
+
}
|
|
1427
|
+
let who = null
|
|
1428
|
+
try {
|
|
1429
|
+
who = await personFn({ deskRoot: root.path, env, now: now(), member })
|
|
1430
|
+
} catch {
|
|
1431
|
+
who = null
|
|
1432
|
+
}
|
|
1433
|
+
// In a shared workspace the root AGENTS.md is the team's; the person's own lessons and preferences are in theirs. The
|
|
1434
|
+
// two share one size budget, the desk's file first, so session start stays short enough for every host to show whole;
|
|
1435
|
+
// the person's file keeps a floor of that budget however large the team's file grows.
|
|
1436
|
+
let personAgentsMd = null
|
|
1437
|
+
try {
|
|
1438
|
+
if (who?.status === "ok" && who.personPrefix !== "") personAgentsMd = agentsFn(path.join(root.path, who.personPrefix), { cap: personAgentsCap(agentsMdInHostInstructions ? null : agentsMd) })
|
|
1439
|
+
} catch {
|
|
1440
|
+
personAgentsMd = null
|
|
1441
|
+
}
|
|
1442
|
+
// The lessons lesson_add moved to the shelf beside this person's AGENTS.md (the desk's own on a solo desk) once it
|
|
1443
|
+
// outgrew that budget: session start lists their topics, and task_focus returns their text.
|
|
1444
|
+
let lessonsShelf = null
|
|
1445
|
+
try {
|
|
1446
|
+
if (who?.status === "ok") lessonsShelf = shelfFn(path.join(root.path, who.personPrefix))
|
|
1447
|
+
} catch {
|
|
1448
|
+
lessonsShelf = null
|
|
1449
|
+
}
|
|
1450
|
+
// The notes teammates left in this person's inbox (note), in a shared workspace only: the open ones, oldest first.
|
|
1451
|
+
let notes = null
|
|
1452
|
+
try {
|
|
1453
|
+
if (who?.status === "ok" && who.personPrefix !== "") notes = notesFn(root.path, who.personPrefix)
|
|
1454
|
+
} catch {
|
|
1455
|
+
notes = null
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
let tasks = null
|
|
1459
|
+
try {
|
|
1460
|
+
tasks = await activeTasksFn(root.path)
|
|
1461
|
+
} catch (error) {
|
|
1462
|
+
degraded.push(`active_tasks: ${error.message}`)
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
let cards = []
|
|
1466
|
+
let cardValidationResult = []
|
|
1467
|
+
try {
|
|
1468
|
+
cards = walkFn(root.path)
|
|
1469
|
+
cardValidationResult = cardValidation(root.path, () => cards, { nested: nestedCards })
|
|
1470
|
+
} catch (error) {
|
|
1471
|
+
degraded.push(`card_validation: ${error.message}`)
|
|
1472
|
+
}
|
|
1473
|
+
// The release-alert lookup runs alongside the rest of boot, with its own hard budget; it never rejects.
|
|
1474
|
+
const releaseAlert = Promise.resolve()
|
|
1475
|
+
.then(() => (headless ? null : releaseAlertFn({ env, cards, now })))
|
|
1476
|
+
.catch(() => null)
|
|
1477
|
+
if (!nestedCards) {
|
|
1478
|
+
const why = runtimeResolverFailure()
|
|
1479
|
+
pending.push(`card repos: not validated, gray-matter is not installed (the dependency-free reader cannot parse repos lists)${why === null ? "" : `; restoring the runtime dependencies failed: ${redactCredentialLikeText(why)}`}`)
|
|
1480
|
+
}
|
|
1481
|
+
if (cardValidationResult.length > 0) {
|
|
1482
|
+
degraded.push(`${cardValidationResult.length} task card${cardValidationResult.length === 1 ? "" : "s"} with corrupted frontmatter`)
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
// The named task's repos are the only ones whose state and push route boot checks.
|
|
1486
|
+
const named = taskQuery === null ? [] : namedCards(resolveTaskQuery(taskQuery, cards, root.path), cards)
|
|
1487
|
+
let repoStateList = []
|
|
1488
|
+
if (named.length > 0) {
|
|
1489
|
+
try {
|
|
1490
|
+
const found = await repoFn({ cards: named, root: root.path, spawnGit, homeDir, now, deadline })
|
|
1491
|
+
repoStateList = found.states
|
|
1492
|
+
pending.push(...found.pending)
|
|
1493
|
+
} catch (error) {
|
|
1494
|
+
degraded.push(`repo_states: ${error.message}`)
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
// A clone seen with no remote and no card url is recorded on its card as local-only, once: the only record the done
|
|
1498
|
+
// check trusts for a commit with nowhere to push (`tools/local-only.js`).
|
|
1499
|
+
// In a Crew workspace only the member's own cards are written, the scope the tool server gives this session; with no
|
|
1500
|
+
// member, or when the member lookup failed, none are.
|
|
1501
|
+
const ownDesk = member?.crew === true && member.person !== null ? path.join(root.path, "desks", member.person) : null
|
|
1502
|
+
const isOwn = (card) => {
|
|
1503
|
+
const rel = path.relative(ownDesk, card.file)
|
|
1504
|
+
return !rel.startsWith("..") && !path.isAbsolute(rel)
|
|
1505
|
+
}
|
|
1506
|
+
const own = member?.crew === false ? cards : ownDesk === null ? [] : cards.filter(isOwn)
|
|
1507
|
+
try {
|
|
1508
|
+
await localOnlyFn({ cards: own, deskRoot: root.path, spawnGit, homeDir, stateBranch: stateBranchFn({ env, homeDir }) })
|
|
1509
|
+
} catch {
|
|
1510
|
+
// Recording is a convenience and never a reason to degrade a boot.
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
// The delivered tasks that await the operator's sign-off; the counts go to status.json.
|
|
1514
|
+
let unsigned = null
|
|
1515
|
+
try {
|
|
1516
|
+
unsigned = await unsignedFn(env, root.path, now())
|
|
1517
|
+
} catch {
|
|
1518
|
+
unsigned = null
|
|
1519
|
+
}
|
|
1520
|
+
// Whether an earlier boot of this session (a resume, a compaction) listed the same deliveries: then they are not raised again.
|
|
1521
|
+
const signoffSeen = isNoninteractive(env) ? undefined : signoffListedFn(env, unsigned, { stateDir: resolveDeskStateDir({ env, homeDir }), now })
|
|
1522
|
+
|
|
1523
|
+
let pushAccounts = []
|
|
1524
|
+
try {
|
|
1525
|
+
// The routes started before the sync stand unless the sync changed the named task's repos.
|
|
1526
|
+
const reposOf = (list) => JSON.stringify(list.map((card) => [card.file, card.data.repos ?? null]))
|
|
1527
|
+
const reuse = pushStarted !== null && reposOf(named) === reposOf(earlyNamed)
|
|
1528
|
+
pushAccounts = named.length === 0 ? [] : await (reuse ? pushStarted : pushFor(named))
|
|
1529
|
+
// A dropped early check may still have `gh` children; the script exits right after its output, which would leave them running. It started first and has the same limits.
|
|
1530
|
+
if (!reuse && pushStarted !== null) await Promise.allSettled([pushStarted])
|
|
1531
|
+
} catch (error) {
|
|
1532
|
+
degraded.push(`push_accounts: ${error.message}`)
|
|
1533
|
+
}
|
|
1534
|
+
notePushAccounts(pushAccounts, degraded, pending)
|
|
1535
|
+
|
|
1536
|
+
let openPrs = []
|
|
1537
|
+
try {
|
|
1538
|
+
const found = prsStarted === null ? { prs: [], pending: [] } : await prsStarted
|
|
1539
|
+
if (found.error) throw found.error
|
|
1540
|
+
// Only the pull requests in repos that open tasks still name after the sync.
|
|
1541
|
+
const wanted = new Set(taskStores(cards, { root: root.path, homeDir }).map((store) => store.toLowerCase()))
|
|
1542
|
+
openPrs = found.prs.filter((pr) => typeof pr.store !== "string" || wanted.has(pr.store.toLowerCase()))
|
|
1543
|
+
pending.push(...found.pending)
|
|
1544
|
+
} catch (error) {
|
|
1545
|
+
degraded.push(`open_prs: ${error.message}`)
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
const task = taskQuery === null ? null : namedTaskResult(taskQuery, cards, { root, host, homeDir })
|
|
1549
|
+
|
|
1550
|
+
const staleFinding = await staleDesk
|
|
1551
|
+
// Plugins other than Desk's tools load once per app process: when Agency has fetched a newer release of one, say so (the stale-Desk line already covers Desk itself).
|
|
1552
|
+
const pluginUpdate = headless ? null : (() => { try { return pluginUpdateFn({ env, pluginRoot, agentHost: host.agent, homeDir, skip: staleFinding === null ? [] : ["desk"] }) ?? null } catch { return null } })()
|
|
1553
|
+
const otherWork = await others
|
|
1554
|
+
const releaseFinding = await releaseAlert
|
|
1555
|
+
const status = healthWord(degraded)
|
|
1556
|
+
const instructionContext = { root, prereqResults: prereqs, pushAccounts, cardValidationResult, sync, task, host, migrationEntries, pluginRoot, platform, taskQuery, agentHost: host.agent, noninteractive: isNoninteractive(env), repoStateList, syncSummaryText, unsigned, signoffSeen, notes }
|
|
1557
|
+
const instructions = buildInstructions(instructionContext)
|
|
1558
|
+
return {
|
|
1559
|
+
boot_complete: true,
|
|
1560
|
+
status,
|
|
1561
|
+
degraded,
|
|
1562
|
+
pending,
|
|
1563
|
+
instructions,
|
|
1564
|
+
covers_hosts: AGENT_HOSTS,
|
|
1565
|
+
root,
|
|
1566
|
+
host,
|
|
1567
|
+
migrations: migrationSummary,
|
|
1568
|
+
prereqs,
|
|
1569
|
+
sync,
|
|
1570
|
+
sync_summary: syncSummaryText,
|
|
1571
|
+
agents_md: agentsMd,
|
|
1572
|
+
agents_md_in_host_instructions: agentsMdInHostInstructions,
|
|
1573
|
+
person_agents_md: personAgentsMd,
|
|
1574
|
+
lessons_shelf: lessonsShelf,
|
|
1575
|
+
notes,
|
|
1576
|
+
person: personSummary(member),
|
|
1577
|
+
active_tasks: tasks,
|
|
1578
|
+
card_parser: parserName(nestedCards),
|
|
1579
|
+
card_validation: cardValidationResult,
|
|
1580
|
+
push_accounts: pushAccounts,
|
|
1581
|
+
repo_states: repoStateList,
|
|
1582
|
+
open_prs: openPrs,
|
|
1583
|
+
task,
|
|
1584
|
+
stale_desk: staleFinding,
|
|
1585
|
+
plugin_update: pluginUpdate,
|
|
1586
|
+
other_sessions: otherWork,
|
|
1587
|
+
machine_desks: readMachineDesks({ homeDir, root: root.path, env }),
|
|
1588
|
+
release_alert: releaseFinding?.release_alert ?? null,
|
|
1589
|
+
desk_problems: releaseFinding?.desk_problems ?? null,
|
|
1590
|
+
unmerged_saves: headless ? [] : stuckSaves({ root: root.path, env, now: Date.now }),
|
|
1591
|
+
needs_operator: needsOperator(instructionContext),
|
|
1592
|
+
// Only for the plain-text boot (`runBootCli` leaves it out of `--json`).
|
|
1593
|
+
text_instructions: buildTextInstructions(instructionContext),
|
|
1594
|
+
text_intro: introInstruction(instructionContext.pluginRoot),
|
|
1595
|
+
unsigned_deliveries: unsigned,
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
function deliverText(file, text) {
|
|
1600
|
+
mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 })
|
|
1601
|
+
const temp = `${file}.${process.pid}.tmp`
|
|
1602
|
+
writeFileSync(temp, text, { mode: 0o600 })
|
|
1603
|
+
renameWithRetry(temp, file)
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* The CLI entrypoint, defined with Ouro AX: prints `bootOnce`'s result as readable text (or, with `--json`, as JSON for tools and
|
|
1608
|
+
* tests). A boot never fails on what it finds -- a failed boot is a degraded result -- so the exit code is 0 unless the command line is
|
|
1609
|
+
* wrong (one stderr line and exit 2).
|
|
1610
|
+
*/
|
|
1611
|
+
export async function runBootCli({ argv = [], env = process.env, io = process, bootFn = bootOnce, refreshOptions = {} }) {
|
|
1612
|
+
let quiet = false
|
|
1613
|
+
let full = null
|
|
1614
|
+
let refresh = null
|
|
1615
|
+
const command = defineCommand({
|
|
1616
|
+
name: "boot",
|
|
1617
|
+
summary: "Run the session-start boot: migrations, host, prerequisites, workspace sync, active tasks, push accounts and open PRs.",
|
|
1618
|
+
effect: "private",
|
|
1619
|
+
readOnly: true,
|
|
1620
|
+
output: "the boot result",
|
|
1621
|
+
flags: {
|
|
1622
|
+
task: { type: "string", placeholder: "<name>", description: "The task to open; a blank name is no task." },
|
|
1623
|
+
"task-only": { type: "boolean", description: "Check only the named task." },
|
|
1624
|
+
deliver: { type: "string", placeholder: "<file>", description: "Write the text to this file, renamed into place, and print nothing." },
|
|
1625
|
+
},
|
|
1626
|
+
run: async (input) => {
|
|
1627
|
+
applyPublicationMode({}, env)
|
|
1628
|
+
const taskQuery = typeof input.task === "string" && input.task.trim() !== "" ? input.task : null
|
|
1629
|
+
const taskOnly = input["task-only"] === true
|
|
1630
|
+
const deliverTo = typeof input.deliver === "string" && input.deliver !== "" ? input.deliver : null
|
|
1631
|
+
let result
|
|
1632
|
+
try {
|
|
1633
|
+
result = await bootFn({ env, taskQuery, taskOnly })
|
|
1634
|
+
} catch (error) {
|
|
1635
|
+
result = emptyResult({
|
|
1636
|
+
status: "degraded",
|
|
1637
|
+
degraded: [`boot: ${error.message}`],
|
|
1638
|
+
pending: [],
|
|
1639
|
+
instructions: ["The boot script failed unexpectedly: check `gh --version`, `jq --version` and `gh auth status` by hand, and record the failure as friction."],
|
|
1640
|
+
root: null,
|
|
1641
|
+
host: null,
|
|
1642
|
+
})
|
|
1643
|
+
}
|
|
1644
|
+
const finding = result.stale_desk ?? null
|
|
1645
|
+
// A stale Desk is refreshed on its own host, but only after the boot output is written, and by a detached runner: boot never waits for it.
|
|
1646
|
+
const options = { finding, env, pluginRoot: DESK_PLUGIN_ROOT, agentHost: result.host?.agent, root: result.root?.path ?? null, ...refreshOptions }
|
|
1647
|
+
const prepared = finding === null ? { state: "unavailable" } : planStaleRefresh(options)
|
|
1648
|
+
if (finding !== null) {
|
|
1649
|
+
const started = prepared.state === "ready"
|
|
1650
|
+
// The release notice already says how to pick the release up, so a started refresh does not replace it.
|
|
1651
|
+
result = { ...result, stale_desk: { ...finding, auto_refresh: started ? "started" : prepared.state, line: started && finding.channel !== "release" ? startedLine(finding, prepared.plan) : finding.line } }
|
|
1652
|
+
}
|
|
1653
|
+
const { text_instructions: _textOnly, text_intro: _introOnly, ...structured } = result
|
|
1654
|
+
full = result
|
|
1655
|
+
if (deliverTo !== null) {
|
|
1656
|
+
quiet = true
|
|
1657
|
+
const output = formatBootText(result)
|
|
1658
|
+
try {
|
|
1659
|
+
deliverText(deliverTo, output)
|
|
1660
|
+
} catch (error) {
|
|
1661
|
+
try {
|
|
1662
|
+
deliverText(deliverTo, `Desk boot: its result could not be written (${String(error.message).split("\n")[0].slice(0, 120)}). desk_status reports the desk's state.\n`)
|
|
1663
|
+
} catch {
|
|
1664
|
+
// The waiting reader sees the boot end without a result and says so.
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
if (prepared.state === "ready") refresh = { ...options, prepared }
|
|
1669
|
+
return structured
|
|
1670
|
+
},
|
|
1671
|
+
text: () => formatBootText(full),
|
|
1672
|
+
})
|
|
1673
|
+
const stdout = { write: (chunk) => (quiet ? undefined : io.stdout.write(chunk)) }
|
|
1674
|
+
const code = await runCli(defineCli({ name: "session-boot", about: "The one-call session-start boot.", command }), argv, { stdout, stderr: io.stderr ?? process.stderr })
|
|
1675
|
+
if (refresh !== null) startStaleRefresh(refresh)
|
|
1676
|
+
return code
|
|
1677
|
+
}
|