@openrig/cli 0.5.10 → 0.5.11
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/daemon/assets/plugins/openrig-core/README.md +24 -5
- package/daemon/assets/plugins/openrig-core/skills/agent-operated-workflows/SKILL.md +4 -2
- package/daemon/assets/plugins/openrig-core/skills/applying-a-permission-policy/SKILL.md +11 -14
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +51 -59
- package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +11 -10
- package/daemon/assets/plugins/openrig-core/skills/openrig-operating-model/SKILL.md +39 -50
- package/daemon/assets/plugins/openrig-core/skills/openrig-operating-model/scripts/trunk-diff.sh +1 -1
- package/daemon/assets/plugins/openrig-core/skills/openrig-operating-model/templates/LEARNED.md +7 -5
- package/daemon/assets/plugins/openrig-core/skills/openrig-operating-model/templates/PLAYBOOK.md +3 -4
- package/daemon/assets/plugins/openrig-core/skills/openrig-operating-model/templates/SPEC.md +7 -7
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +55 -64
- package/daemon/assets/plugins/openrig-core/skills/orienting-to-an-inherited-seat/CHANGELOG.md +14 -58
- package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +8 -9
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/CHANGELOG.md +20 -46
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +62 -76
- package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +28 -22
- package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +13 -15
- package/daemon/context-packs/onboarding-width/manifest.yaml +1 -3
- package/daemon/context-packs/onboarding-width/public-reference-material.md +19 -24
- package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +55 -24
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/SKILL.md +4 -2
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/SKILL.md +11 -14
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +51 -59
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/SKILL.md +21 -19
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/SKILL.md +11 -10
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +84 -148
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +3 -3
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/SKILL.md +40 -47
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +16 -0
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/SKILL.md +12 -10
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/SKILL.md +15 -13
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/SKILL.md +11 -10
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
- package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-operating-model/SKILL.md +39 -50
- package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-operating-model/scripts/trunk-diff.sh +1 -1
- package/daemon/context-packs/skills/openrig-operating-model/templates/LEARNED.md +7 -5
- package/daemon/context-packs/skills/openrig-operating-model/templates/PLAYBOOK.md +3 -4
- package/daemon/context-packs/skills/openrig-operating-model/templates/SPEC.md +7 -7
- package/daemon/context-packs/skills/openrig-user/SKILL.md +55 -64
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/CHANGELOG.md +14 -58
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/SKILL.md +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/SKILL.md +2 -2
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/SKILL.md +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/ui-mockup/SKILL.md +3 -3
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/SKILL.md +41 -59
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/LOCAL-INSIGHTS.md +24 -53
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/find-polluter.sh +29 -15
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/SKILL.md +47 -40
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/SKILL.md +3 -3
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/SKILL.md +8 -9
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/CHANGELOG.md +20 -46
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +62 -76
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +28 -22
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +13 -15
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/build-your-world.md +12 -7
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/tmux.d.ts +7 -9
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +7 -35
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/daemon-shutdown.d.ts +27 -0
- package/daemon/dist/daemon-shutdown.d.ts.map +1 -0
- package/daemon/dist/daemon-shutdown.js +84 -0
- package/daemon/dist/daemon-shutdown.js.map +1 -0
- package/daemon/dist/domain/codex-thread-id.d.ts +1 -0
- package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
- package/daemon/dist/domain/codex-thread-id.js +32 -23
- package/daemon/dist/domain/codex-thread-id.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts +2 -0
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +7 -28
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/crash-cart-conductor.js +1 -1
- package/daemon/dist/domain/crash-cart-conductor.js.map +1 -1
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +24 -3
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/gateway/channel-operations.d.ts +1 -1
- package/daemon/dist/domain/gateway/channel-operations.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/connections-projection.d.ts +61 -0
- package/daemon/dist/domain/gateway/connections-projection.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/connections-projection.js +149 -0
- package/daemon/dist/domain/gateway/connections-projection.js.map +1 -0
- package/daemon/dist/domain/gateway/human-registry.d.ts +3 -1
- package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.js +3 -1
- package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js +3 -2
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/health-diagnosis.js +1 -1
- package/daemon/dist/domain/health-diagnosis.js.map +1 -1
- package/daemon/dist/domain/lifecycle-obligations.d.ts +18 -0
- package/daemon/dist/domain/lifecycle-obligations.d.ts.map +1 -0
- package/daemon/dist/domain/lifecycle-obligations.js +35 -0
- package/daemon/dist/domain/lifecycle-obligations.js.map +1 -0
- package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.js +6 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
- package/daemon/dist/domain/policies/workflow-keepalive.d.ts +1 -0
- package/daemon/dist/domain/policies/workflow-keepalive.d.ts.map +1 -1
- package/daemon/dist/domain/policies/workflow-keepalive.js +7 -4
- package/daemon/dist/domain/policies/workflow-keepalive.js.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.d.ts +7 -0
- package/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js +119 -23
- package/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +1 -0
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +8 -1
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +27 -11
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
- package/daemon/dist/domain/startup-proof.js +10 -9
- package/daemon/dist/domain/startup-proof.js.map +1 -1
- package/daemon/dist/domain/startup-resolver.d.ts +3 -1
- package/daemon/dist/domain/startup-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/startup-resolver.js +18 -0
- package/daemon/dist/domain/startup-resolver.js.map +1 -1
- package/daemon/dist/domain/startup-validation.d.ts.map +1 -1
- package/daemon/dist/domain/startup-validation.js +12 -1
- package/daemon/dist/domain/startup-validation.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +13 -1
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +14 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/workflow-boot-sweep.d.ts +1 -0
- package/daemon/dist/domain/workflow-boot-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-boot-sweep.js +3 -0
- package/daemon/dist/domain/workflow-boot-sweep.js.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.d.ts +4 -3
- package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js +22 -21
- package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
- package/daemon/dist/domain/workflow-exception-router.d.ts +4 -3
- package/daemon/dist/domain/workflow-exception-router.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-exception-router.js +7 -6
- package/daemon/dist/domain/workflow-exception-router.js.map +1 -1
- package/daemon/dist/domain/workflow-human-destination.d.ts +18 -0
- package/daemon/dist/domain/workflow-human-destination.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-human-destination.js +40 -0
- package/daemon/dist/domain/workflow-human-destination.js.map +1 -0
- package/daemon/dist/domain/workflow-projector.d.ts +4 -3
- package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +26 -17
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-role-context.d.ts +4 -6
- package/daemon/dist/domain/workflow-role-context.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-role-context.js +7 -14
- package/daemon/dist/domain/workflow-role-context.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts +12 -3
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +66 -14
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-validator.js +39 -24
- package/daemon/dist/domain/workflow-validator.js.map +1 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +37 -96
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/project-lifecycle-surface.d.ts +1 -1
- package/daemon/dist/project-lifecycle-surface.d.ts.map +1 -1
- package/daemon/dist/routes/gateway.d.ts.map +1 -1
- package/daemon/dist/routes/gateway.js +10 -0
- package/daemon/dist/routes/gateway.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +4 -3
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts +3 -1
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js +11 -5
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +95 -27
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +6 -1
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +2 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +6 -3
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-spec.md +6 -0
- package/daemon/docs/reference/getting-started.md +134 -28
- package/daemon/docs/reference/health-diagnosis.md +26 -0
- package/daemon/docs/reference/mission-install.md +5 -0
- package/daemon/docs/reference/project-release-profile.yaml +82 -0
- package/daemon/docs/reference/release-boundary.md +5 -0
- package/daemon/docs/reference/rig-spec.md +43 -4
- package/daemon/specs/agents/conveyor/planner/guidance/role.md +5 -3
- package/daemon/specs/agents/conveyor/planner/startup/context.md +13 -4
- package/daemon/specs/agents/design/product-designer/agent.yaml +4 -3
- package/daemon/specs/agents/design/product-designer/guidance/role.md +12 -10
- package/daemon/specs/agents/product-management/pm/guidance/role.md +19 -17
- package/daemon/specs/agents/shared/skills/core/agent-starters/SKILL.md +21 -19
- package/daemon/specs/agents/shared/skills/core/agent-startup-and-context-ingestion/SKILL.md +11 -10
- package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +84 -148
- package/daemon/specs/agents/shared/skills/core/openrig-architect/SKILL.md +40 -47
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +16 -0
- package/daemon/specs/agents/shared/skills/core/session-source-fork/SKILL.md +12 -10
- package/daemon/specs/agents/shared/skills/core/topology-mutation-and-seat-management/SKILL.md +15 -13
- package/daemon/specs/agents/shared/skills/pm/exec-summary/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/pm/plan-review/SKILL.md +2 -2
- package/daemon/specs/agents/shared/skills/pm/requirements-writer/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/pm/ui-mockup/SKILL.md +3 -3
- package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +41 -59
- package/daemon/specs/agents/shared/skills/process/agent-browser/LOCAL-INSIGHTS.md +24 -53
- package/daemon/specs/agents/shared/skills/process/systematic-debugging/find-polluter.sh +29 -15
- package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +47 -40
- package/daemon/specs/agents/shared/skills/process/verification-before-completion/SKILL.md +3 -3
- package/daemon/specs/rigs/launch/first-project/CULTURE.md +39 -0
- package/daemon/specs/rigs/launch/first-project/rig.yaml +31 -0
- package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/startup/context.md +1 -1
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +21 -7
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +2 -2
- package/daemon/specs/rigs/launch/kernel/agents/queue/worker/guidance/role.md +19 -11
- package/daemon/specs/rigs/launch/kernel/agents/queue/worker/startup/context.md +3 -2
- package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +15 -8
- package/daemon/specs/rigs/launch/kernel/rig-claude-only.yaml +7 -0
- package/daemon/specs/rigs/launch/kernel/rig-codex-only.yaml +7 -0
- package/daemon/specs/rigs/launch/kernel/rig.yaml +9 -4
- package/daemon/specs/rigs/preview/product-team/topology/seats/dev1-qa/CRAFT.md +6 -4
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +6 -20
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +53 -32
- package/dist/client.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +1 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +15 -13
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +31 -27
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/destroy.js +1 -1
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/health.d.ts.map +1 -1
- package/dist/commands/health.js +59 -7
- package/dist/commands/health.js.map +1 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +2 -2
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +9 -5
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +4 -8
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +10 -9
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/tui.d.ts +2 -0
- package/dist/commands/tui.d.ts.map +1 -1
- package/dist/commands/tui.js +26 -10
- package/dist/commands/tui.js.map +1 -1
- package/dist/commands/walk.d.ts.map +1 -1
- package/dist/commands/walk.js +24 -48
- package/dist/commands/walk.js.map +1 -1
- package/dist/commands/workflow-render.d.ts +19 -0
- package/dist/commands/workflow-render.d.ts.map +1 -1
- package/dist/commands/workflow-render.js +12 -1
- package/dist/commands/workflow-render.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +4 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +2 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +15 -0
- package/dist/config-store.js.map +1 -1
- package/dist/cross-host-executor.d.ts +1 -1
- package/dist/cross-host-executor.js +2 -2
- package/dist/cross-host-executor.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +8 -11
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +281 -146
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-start-lock.d.ts +9 -0
- package/dist/daemon-start-lock.d.ts.map +1 -0
- package/dist/daemon-start-lock.js +47 -0
- package/dist/daemon-start-lock.js.map +1 -0
- package/dist/front-door.d.ts.map +1 -1
- package/dist/front-door.js +8 -1
- package/dist/front-door.js.map +1 -1
- package/dist/lib/file-transfer.js +1 -1
- package/dist/lib/file-transfer.js.map +1 -1
- package/dist/lib/walk-consumption.d.ts +6 -0
- package/dist/lib/walk-consumption.d.ts.map +1 -0
- package/dist/lib/walk-consumption.js +78 -0
- package/dist/lib/walk-consumption.js.map +1 -0
- package/dist/local-origin.d.ts +3 -0
- package/dist/local-origin.d.ts.map +1 -0
- package/dist/local-origin.js +37 -0
- package/dist/local-origin.js.map +1 -0
- package/dist/read-view.d.ts +17 -0
- package/dist/read-view.d.ts.map +1 -0
- package/dist/read-view.js +17 -0
- package/dist/read-view.js.map +1 -0
- package/dist/shared-tui.d.ts +12 -0
- package/dist/shared-tui.d.ts.map +1 -0
- package/dist/shared-tui.js +37 -0
- package/dist/shared-tui.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts +7 -9
- package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/tmux.js +7 -35
- package/node_modules/@openrig/daemon/dist/adapters/tmux.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/build-info.js +3 -3
- package/node_modules/@openrig/daemon/dist/daemon-shutdown.d.ts +27 -0
- package/node_modules/@openrig/daemon/dist/daemon-shutdown.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/daemon-shutdown.js +84 -0
- package/node_modules/@openrig/daemon/dist/daemon-shutdown.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.d.ts +1 -0
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.js +32 -23
- package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-usage-store.d.ts +2 -0
- package/node_modules/@openrig/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-usage-store.js +7 -28
- package/node_modules/@openrig/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/crash-cart-conductor.js +1 -1
- package/node_modules/@openrig/daemon/dist/domain/crash-cart-conductor.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/execution-view.js +24 -3
- package/node_modules/@openrig/daemon/dist/domain/execution-view.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/channel-operations.d.ts +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/channel-operations.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/connections-projection.d.ts +61 -0
- package/node_modules/@openrig/daemon/dist/domain/gateway/connections-projection.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/gateway/connections-projection.js +149 -0
- package/node_modules/@openrig/daemon/dist/domain/gateway/connections-projection.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.d.ts +3 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.js +3 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/slack/slack-subsystem.js +3 -2
- package/node_modules/@openrig/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/health-diagnosis.js +1 -1
- package/node_modules/@openrig/daemon/dist/domain/health-diagnosis.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/lifecycle-obligations.d.ts +18 -0
- package/node_modules/@openrig/daemon/dist/domain/lifecycle-obligations.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/lifecycle-obligations.js +35 -0
- package/node_modules/@openrig/daemon/dist/domain/lifecycle-obligations.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.js +6 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/policies/workflow-keepalive.d.ts +1 -0
- package/node_modules/@openrig/daemon/dist/domain/policies/workflow-keepalive.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/policies/workflow-keepalive.js +7 -4
- package/node_modules/@openrig/daemon/dist/domain/policies/workflow-keepalive.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/project-lifecycle-compiler.d.ts +7 -0
- package/node_modules/@openrig/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/project-lifecycle-compiler.js +119 -23
- package/node_modules/@openrig/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/queue-stuck-sweep.js +1 -0
- package/node_modules/@openrig/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.js +8 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-orchestrator.js +27 -11
- package/node_modules/@openrig/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-proof.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-proof.js +10 -9
- package/node_modules/@openrig/daemon/dist/domain/startup-proof.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-resolver.d.ts +3 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-resolver.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-resolver.js +18 -0
- package/node_modules/@openrig/daemon/dist/domain/startup-resolver.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-validation.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-validation.js +12 -1
- package/node_modules/@openrig/daemon/dist/domain/startup-validation.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/types.d.ts +13 -1
- package/node_modules/@openrig/daemon/dist/domain/types.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/types.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.js +14 -0
- package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-boot-sweep.d.ts +1 -0
- package/node_modules/@openrig/daemon/dist/domain/workflow-boot-sweep.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-boot-sweep.js +3 -0
- package/node_modules/@openrig/daemon/dist/domain/workflow-boot-sweep.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-escalation.d.ts +4 -3
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-escalation.js +22 -21
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-router.d.ts +4 -3
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-router.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-router.js +7 -6
- package/node_modules/@openrig/daemon/dist/domain/workflow-exception-router.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-human-destination.d.ts +18 -0
- package/node_modules/@openrig/daemon/dist/domain/workflow-human-destination.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/workflow-human-destination.js +40 -0
- package/node_modules/@openrig/daemon/dist/domain/workflow-human-destination.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/workflow-projector.d.ts +4 -3
- package/node_modules/@openrig/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-projector.js +26 -17
- package/node_modules/@openrig/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-role-context.d.ts +4 -6
- package/node_modules/@openrig/daemon/dist/domain/workflow-role-context.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-role-context.js +7 -14
- package/node_modules/@openrig/daemon/dist/domain/workflow-role-context.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-runtime.d.ts +12 -3
- package/node_modules/@openrig/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-runtime.js +66 -14
- package/node_modules/@openrig/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workflow-validator.js +39 -24
- package/node_modules/@openrig/daemon/dist/domain/workflow-validator.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/index.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/index.js +37 -96
- package/node_modules/@openrig/daemon/dist/index.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/project-lifecycle-surface.d.ts +1 -1
- package/node_modules/@openrig/daemon/dist/project-lifecycle-surface.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/gateway.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/gateway.js +10 -0
- package/node_modules/@openrig/daemon/dist/routes/gateway.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/queue.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/queue.js +4 -3
- package/node_modules/@openrig/daemon/dist/routes/queue.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/require-sender-identity.d.ts +3 -1
- package/node_modules/@openrig/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/require-sender-identity.js +11 -5
- package/node_modules/@openrig/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/sessions.js +95 -27
- package/node_modules/@openrig/daemon/dist/routes/sessions.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/workflow.js +6 -1
- package/node_modules/@openrig/daemon/dist/routes/workflow.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/server.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/server.js +2 -1
- package/node_modules/@openrig/daemon/dist/server.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/startup.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/startup.js +6 -3
- package/node_modules/@openrig/daemon/dist/startup.js.map +1 -1
- package/node_modules/@openrig/daemon/package.json +5 -1
- package/package.json +1 -1
- package/tui/dist/commands/completion.d.ts +8 -0
- package/tui/dist/commands/completion.d.ts.map +1 -0
- package/tui/dist/commands/completion.js +37 -0
- package/tui/dist/commands/completion.js.map +1 -0
- package/tui/dist/commands/registry.d.ts +7 -1
- package/tui/dist/commands/registry.d.ts.map +1 -1
- package/tui/dist/commands/registry.js +47 -0
- package/tui/dist/commands/registry.js.map +1 -1
- package/tui/dist/connections/connections-model.d.ts +72 -0
- package/tui/dist/connections/connections-model.d.ts.map +1 -0
- package/tui/dist/connections/connections-model.js +64 -0
- package/tui/dist/connections/connections-model.js.map +1 -0
- package/tui/dist/daemon-client.d.ts +1 -0
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +1 -0
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/detail.d.ts +3 -0
- package/tui/dist/detail.d.ts.map +1 -1
- package/tui/dist/detail.js +23 -0
- package/tui/dist/detail.js.map +1 -1
- package/tui/dist/execution/execution-model.d.ts +1 -1
- package/tui/dist/execution/execution-model.d.ts.map +1 -1
- package/tui/dist/execution/execution-model.js +46 -170
- package/tui/dist/execution/execution-model.js.map +1 -1
- package/tui/dist/execution/workflow-model.d.ts +6 -0
- package/tui/dist/execution/workflow-model.d.ts.map +1 -0
- package/tui/dist/execution/workflow-model.js +219 -0
- package/tui/dist/execution/workflow-model.js.map +1 -0
- package/tui/dist/grammar.d.ts.map +1 -1
- package/tui/dist/grammar.js +1 -2
- package/tui/dist/grammar.js.map +1 -1
- package/tui/dist/health/health-model.d.ts +1 -1
- package/tui/dist/health/health-model.d.ts.map +1 -1
- package/tui/dist/health/health-model.js +5 -4
- package/tui/dist/health/health-model.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +45 -8
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/input.d.ts +2 -0
- package/tui/dist/input.d.ts.map +1 -1
- package/tui/dist/input.js +28 -6
- package/tui/dist/input.js.map +1 -1
- package/tui/dist/main.js +47 -10
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/render.d.ts +4 -0
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +128 -74
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/sections.d.ts.map +1 -1
- package/tui/dist/sections.js +1 -0
- package/tui/dist/sections.js.map +1 -1
- package/tui/dist/socket-server.d.ts +4 -0
- package/tui/dist/socket-server.d.ts.map +1 -1
- package/tui/dist/socket-server.js +4 -0
- package/tui/dist/socket-server.js.map +1 -1
- package/tui/dist/state.d.ts +3 -1
- package/tui/dist/state.d.ts.map +1 -1
- package/tui/dist/state.js +47 -9
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/stylize.js +3 -3
- package/tui/dist/stylize.js.map +1 -1
- package/tui/dist/time.d.ts +9 -0
- package/tui/dist/time.d.ts.map +1 -0
- package/tui/dist/time.js +42 -0
- package/tui/dist/time.js.map +1 -0
- package/tui/dist/types.d.ts +36 -1
- package/tui/dist/types.d.ts.map +1 -1
package/dist/daemon-lifecycle.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
+
import { DAEMON_STOP_WAIT_MS, DAEMON_SHUTDOWN_RECEIPT } from "@openrig/daemon/daemon-shutdown";
|
|
3
4
|
import { ConfigStore } from "./config-store.js";
|
|
5
|
+
import { readLocalOrigin } from "./local-origin.js";
|
|
4
6
|
import { OPENRIG_HOME, LEGACY_RIGGED_HOME, readOpenRigEnv } from "./openrig-compat.js";
|
|
5
7
|
import { ensureDefaultWorkspace, ensureOpenRigInstance, formatInstanceInitializationConflicts, } from "@openrig/daemon/instance-initialization";
|
|
6
8
|
/** Build the daemon HTTP URL from status. Uses persisted host or defaults to 127.0.0.1. */
|
|
@@ -202,7 +204,7 @@ function readState(deps) {
|
|
|
202
204
|
}
|
|
203
205
|
catch {
|
|
204
206
|
// Malformed daemon.json — treat as no state
|
|
205
|
-
console.error("Warning: malformed daemon.json
|
|
207
|
+
console.error("Warning: malformed daemon.json; target identity unavailable");
|
|
206
208
|
return null;
|
|
207
209
|
}
|
|
208
210
|
}
|
|
@@ -385,7 +387,27 @@ export async function verifyRequiredListeners(input) {
|
|
|
385
387
|
}
|
|
386
388
|
return { ok: true, verified };
|
|
387
389
|
}
|
|
390
|
+
class StartupIdentityError extends Error {
|
|
391
|
+
}
|
|
392
|
+
class StartupChildPendingError extends Error {
|
|
393
|
+
}
|
|
388
394
|
export async function startDaemon(opts, deps) {
|
|
395
|
+
if (!deps.acquireStartLock)
|
|
396
|
+
throw new Error("Daemon startup requires a local launch reservation");
|
|
397
|
+
const lock = deps.acquireStartLock();
|
|
398
|
+
let preserve = false;
|
|
399
|
+
try {
|
|
400
|
+
return await startOwnedDaemon(opts, deps, lock);
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
preserve = error instanceof StartupChildPendingError;
|
|
404
|
+
throw error;
|
|
405
|
+
}
|
|
406
|
+
finally {
|
|
407
|
+
lock.release(preserve);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async function startOwnedDaemon(opts, deps, lock) {
|
|
389
411
|
const port = opts.port ?? DEFAULT_PORT;
|
|
390
412
|
const db = opts.db ?? DEFAULT_DB;
|
|
391
413
|
// bug-fix slice auth-bearer-tailscale-trust: preserve the
|
|
@@ -437,151 +459,285 @@ export async function startDaemon(opts, deps) {
|
|
|
437
459
|
throw new Error(`OpenRig instance initialization blocked: ${formatInstanceInitializationConflicts(initialization)}`);
|
|
438
460
|
}
|
|
439
461
|
const logFd = deps.openForAppend(LOG_FILE);
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
462
|
+
let child;
|
|
463
|
+
try {
|
|
464
|
+
child = deps.spawn(process.execPath, [daemonEntry], {
|
|
465
|
+
env: buildDaemonEnv(process.env, {
|
|
466
|
+
port,
|
|
467
|
+
host: explicitHost,
|
|
468
|
+
db,
|
|
469
|
+
transcriptsEnabled: opts.transcriptsEnabled,
|
|
470
|
+
transcriptsPath: opts.transcriptsPath,
|
|
471
|
+
transcriptsLines: opts.transcriptsLines,
|
|
472
|
+
transcriptsPollIntervalSeconds: opts.transcriptsPollIntervalSeconds,
|
|
473
|
+
skipKernelBoot: opts.skipKernelBoot,
|
|
474
|
+
}),
|
|
475
|
+
stdio: ["ignore", logFd, logFd],
|
|
476
|
+
detached: true,
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
finally {
|
|
480
|
+
deps.closeFile?.(logFd);
|
|
481
|
+
}
|
|
482
|
+
let childFailure;
|
|
483
|
+
let rejectExit;
|
|
484
|
+
let resolveExit;
|
|
485
|
+
const exited = new Promise((resolve) => { resolveExit = resolve; });
|
|
486
|
+
const failed = new Promise((_, reject) => { rejectExit = reject; });
|
|
487
|
+
// An error can arrive during synchronous publication/cleanup, between awaits.
|
|
488
|
+
void failed.catch(() => { });
|
|
489
|
+
const onError = (error) => {
|
|
490
|
+
childFailure = new Error(`Daemon child failed to spawn: ${error.message}`);
|
|
491
|
+
rejectExit(childFailure);
|
|
492
|
+
};
|
|
493
|
+
const onExit = (code, signal) => {
|
|
494
|
+
childFailure = new Error(`Daemon child ${child.pid ?? "unknown"} exited before startup completed (code ${code}, signal ${signal ?? "none"})`);
|
|
495
|
+
rejectExit(childFailure);
|
|
496
|
+
resolveExit();
|
|
497
|
+
};
|
|
498
|
+
child.once("error", onError);
|
|
499
|
+
child.once("exit", onExit);
|
|
454
500
|
child.unref();
|
|
455
501
|
const pid = child.pid;
|
|
456
|
-
|
|
457
|
-
|
|
502
|
+
const hasExited = () => child.exitCode != null || child.signalCode != null;
|
|
503
|
+
const assertChild = () => {
|
|
504
|
+
if (childFailure)
|
|
505
|
+
throw childFailure;
|
|
506
|
+
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
507
|
+
throw new Error("Daemon spawn returned no valid child PID");
|
|
508
|
+
if (hasExited())
|
|
509
|
+
throw new Error(`Daemon child ${pid} exited before startup completed`);
|
|
510
|
+
};
|
|
458
511
|
const healthzUrl = `http://${probeHost}:${port}/healthz`;
|
|
459
|
-
|
|
460
|
-
|
|
512
|
+
const readOwnedHealth = async (url) => {
|
|
513
|
+
assertChild();
|
|
514
|
+
let timer;
|
|
461
515
|
try {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
516
|
+
return await Promise.race([
|
|
517
|
+
failed,
|
|
518
|
+
new Promise((_, reject) => {
|
|
519
|
+
timer = setTimeout(() => reject(new HealthProbeTimeoutError(url)), HEALTHZ_PROBE_TIMEOUT_MS);
|
|
520
|
+
}),
|
|
521
|
+
(async () => {
|
|
522
|
+
const res = await deps.fetch(url);
|
|
523
|
+
if (!res.ok)
|
|
524
|
+
return null;
|
|
525
|
+
let body;
|
|
526
|
+
try {
|
|
527
|
+
body = res.json ? await res.json() : null;
|
|
528
|
+
}
|
|
529
|
+
catch {
|
|
530
|
+
throw new StartupIdentityError(`Daemon startup identity unavailable at ${url}: expected child PID ${pid}; invalid health response`);
|
|
531
|
+
}
|
|
532
|
+
if (body?.pid !== pid) {
|
|
533
|
+
throw new StartupIdentityError(`Daemon startup identity mismatch at ${url}: expected child PID ${pid}, observed ${typeof body?.pid === "number" ? body.pid : "unknown"}; state not published`);
|
|
534
|
+
}
|
|
535
|
+
assertChild();
|
|
536
|
+
return body;
|
|
537
|
+
})(),
|
|
538
|
+
]);
|
|
470
539
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
try {
|
|
475
|
-
deps.kill(pid, "SIGTERM");
|
|
540
|
+
finally {
|
|
541
|
+
if (timer)
|
|
542
|
+
clearTimeout(timer);
|
|
476
543
|
}
|
|
477
|
-
|
|
478
|
-
const logContent = deps.readFile(resolveLifecycleFile(deps, "daemon.log"));
|
|
479
|
-
throw new Error(summarizeDaemonStartFailure(healthzUrl, logContent));
|
|
480
|
-
}
|
|
481
|
-
// S20 — the restored adoption/upgrade gate: when the daemon reports its bind plan,
|
|
482
|
-
// derive the required listener set from the EFFECTIVE mode and prove every listener
|
|
483
|
-
// by probing its own /healthz. A silently dropped listener fails the start LOUDLY
|
|
484
|
-
// (the 0.5.3-receipt regression accepted loopback health alone and missed exactly
|
|
485
|
-
// this). Older daemons without the payload skip the gate unchanged (additive).
|
|
544
|
+
};
|
|
486
545
|
try {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
546
|
+
assertChild();
|
|
547
|
+
lock.recordChild(pid);
|
|
548
|
+
let healthy = false;
|
|
549
|
+
let lastProbe = "health endpoint not responding";
|
|
550
|
+
for (let i = 0; i < HEALTHZ_RETRIES; i++) {
|
|
551
|
+
try {
|
|
552
|
+
const body = await readOwnedHealth(healthzUrl);
|
|
553
|
+
if (body) {
|
|
554
|
+
const bind = body.bind;
|
|
555
|
+
if (!bind || !["explicit", "default"].includes(bind.mode) || !Array.isArray(bind.hosts)
|
|
556
|
+
|| bind.hosts.length === 0 || !bind.hosts.every((host) => typeof host === "string" && host.length > 0)
|
|
557
|
+
|| typeof bind.tailscaleDetected !== "boolean") {
|
|
558
|
+
throw new StartupIdentityError(`Daemon startup listener identity unavailable for child PID ${pid}; state not published`);
|
|
500
559
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
560
|
+
const gate = await verifyRequiredListeners({ bind, port, probe: async (url) => {
|
|
561
|
+
try {
|
|
562
|
+
return await readOwnedHealth(url) ? "healthy" : "unhealthy";
|
|
563
|
+
}
|
|
564
|
+
catch (error) {
|
|
565
|
+
if (error instanceof StartupIdentityError || childFailure)
|
|
566
|
+
throw error;
|
|
567
|
+
const code = error.code
|
|
568
|
+
?? error.cause?.code;
|
|
569
|
+
return code === "ECONNREFUSED" ? "unhealthy" : "indeterminate";
|
|
570
|
+
}
|
|
571
|
+
} });
|
|
572
|
+
if (gate.ok === false)
|
|
573
|
+
throw new StartupIdentityError(`Daemon child ${pid} FAILED the listener adoption gate: ${gate.reason}`);
|
|
574
|
+
if (gate.ok === true) {
|
|
575
|
+
healthy = true;
|
|
576
|
+
break;
|
|
505
577
|
}
|
|
506
|
-
|
|
507
|
-
});
|
|
508
|
-
if (gate.ok === false) {
|
|
509
|
-
try {
|
|
510
|
-
deps.kill(pid, "SIGTERM");
|
|
578
|
+
lastProbe = gate.reason;
|
|
511
579
|
}
|
|
512
|
-
catch { /* best effort */ }
|
|
513
|
-
throw new Error(`daemon started but FAILED the listener adoption gate: ${gate.reason}`);
|
|
514
580
|
}
|
|
515
|
-
|
|
581
|
+
catch (error) {
|
|
582
|
+
assertChild();
|
|
583
|
+
if (error instanceof StartupIdentityError)
|
|
584
|
+
throw error;
|
|
585
|
+
lastProbe = error instanceof Error ? error.message : String(error);
|
|
586
|
+
}
|
|
587
|
+
await Promise.race([new Promise((resolve) => setTimeout(resolve, HEALTHZ_DELAY_MS)), failed]);
|
|
588
|
+
}
|
|
589
|
+
if (!healthy) {
|
|
590
|
+
throw new Error(`${summarizeDaemonStartFailure(healthzUrl, deps.readFile(resolveLifecycleFile(deps, "daemon.log")))}. Last probe: ${lastProbe}`);
|
|
591
|
+
}
|
|
592
|
+
assertChild();
|
|
593
|
+
if (!deps.isProcessAlive(pid))
|
|
594
|
+
throw new Error(`Daemon child ${pid} liveness could not be confirmed; state not published`);
|
|
595
|
+
const state = { pid: pid, port, host: probeHost, db, startedAt: new Date().toISOString() };
|
|
596
|
+
try {
|
|
597
|
+
deps.writeFile(STATE_FILE, JSON.stringify(state, null, 2));
|
|
598
|
+
assertChild();
|
|
599
|
+
// A synchronous writer can outlast the process while exit events remain
|
|
600
|
+
// undelivered. Recheck physical evidence on the other side of publication.
|
|
601
|
+
if (!deps.isProcessAlive(pid))
|
|
602
|
+
throw new Error(`Daemon child ${pid} liveness could not be confirmed at state publication; startup not accepted`);
|
|
603
|
+
}
|
|
604
|
+
catch (error) {
|
|
605
|
+
removeMatchingState(deps, STATE_FILE, state);
|
|
606
|
+
throw error;
|
|
516
607
|
}
|
|
608
|
+
return state;
|
|
517
609
|
}
|
|
518
|
-
catch (
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
// A
|
|
522
|
-
//
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
610
|
+
catch (error) {
|
|
611
|
+
// Only this launch's child may be cleaned up. A retained child also retains
|
|
612
|
+
// the reservation so a retry cannot run another pre-bind initialization.
|
|
613
|
+
// A failed ps is not exit evidence. This is our unreaped child: signal only
|
|
614
|
+
// that PID, then release exclusion only after its own exit is observed.
|
|
615
|
+
if (Number.isSafeInteger(pid) && pid > 0 && !hasExited()) {
|
|
616
|
+
try {
|
|
617
|
+
deps.kill(pid, "SIGTERM");
|
|
618
|
+
}
|
|
619
|
+
catch { /* confirm exit below */ }
|
|
620
|
+
let timer;
|
|
621
|
+
try {
|
|
622
|
+
const gone = await Promise.race([
|
|
623
|
+
exited.then(() => true),
|
|
624
|
+
new Promise((resolve) => { timer = setTimeout(() => resolve(false), DAEMON_STOP_WAIT_MS); }),
|
|
625
|
+
]);
|
|
626
|
+
if (!gone)
|
|
627
|
+
throw new StartupChildPendingError(`${error instanceof Error ? error.message : error}. Child PID ${pid} exit is unconfirmed; startup reservation retained. Inspect daemon-start.lock and daemon.log before recovery.`);
|
|
628
|
+
}
|
|
629
|
+
finally {
|
|
630
|
+
if (timer)
|
|
631
|
+
clearTimeout(timer);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
throw error;
|
|
635
|
+
}
|
|
636
|
+
finally {
|
|
637
|
+
// A native spawn failure with no PID emits its error on the next turn.
|
|
638
|
+
if (pid !== undefined || childFailure)
|
|
639
|
+
child.off("error", onError);
|
|
640
|
+
child.off("exit", onExit);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
function readShutdownReceipt(deps, stateFile) {
|
|
644
|
+
const receiptPath = path.join(path.dirname(stateFile), DAEMON_SHUTDOWN_RECEIPT);
|
|
645
|
+
const raw = deps.readFile(receiptPath);
|
|
646
|
+
let receipt;
|
|
647
|
+
try {
|
|
648
|
+
receipt = JSON.parse(raw ?? "null") ?? undefined;
|
|
649
|
+
}
|
|
650
|
+
catch { /* unavailable */ }
|
|
651
|
+
if (receipt?.schema !== "openrig.daemon-shutdown/v1" || !Number.isSafeInteger(receipt.pid) || receipt.pid <= 0
|
|
652
|
+
|| !Number.isFinite(Date.parse(receipt.startedAt)) || !(Date.parse(receipt.completedAt) >= Date.parse(receipt.startedAt))
|
|
653
|
+
|| !(Date.parse(receipt.completedAt) <= Date.now()) || typeof receipt.phase !== "string"
|
|
654
|
+
|| !Array.isArray(receipt.failures) || !["clean", "failed", "timed-out"].includes(receipt.outcome))
|
|
655
|
+
receipt = undefined;
|
|
656
|
+
return { receipt, present: raw !== null || deps.exists(receiptPath), receiptPath };
|
|
657
|
+
}
|
|
658
|
+
function receiptMatchesState(receipt, state, notBefore = Date.parse(state.startedAt)) {
|
|
659
|
+
return receipt?.pid === state.pid && Date.parse(receipt.startedAt) >= notBefore;
|
|
660
|
+
}
|
|
661
|
+
function isCleanShutdown(receipt) {
|
|
662
|
+
return receipt?.outcome === "clean" && receipt.phase === "complete" && receipt.failures.length === 0;
|
|
663
|
+
}
|
|
664
|
+
function removeMatchingState(deps, stateFile, state) {
|
|
665
|
+
// A concurrent start/rebind must not have its state removed by an old stop/status.
|
|
666
|
+
const current = readState(deps);
|
|
667
|
+
if (current?.pid === state.pid && current.startedAt === state.startedAt && current.port === state.port
|
|
668
|
+
&& current.host === state.host && current.db === state.db)
|
|
669
|
+
deps.removeFile(stateFile);
|
|
536
670
|
}
|
|
537
671
|
export async function stopDaemon(deps) {
|
|
538
672
|
const state = readState(deps);
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
673
|
+
const configured = resolveConfiguredDaemonTarget();
|
|
674
|
+
const explicitUrl = readOpenRigEnv("OPENRIG_URL", "RIGGED_URL");
|
|
675
|
+
const stateUrl = state ? `http://${state.host ?? DEFAULT_HOST}:${state.port}` : undefined;
|
|
676
|
+
const target = stateUrl ?? explicitUrl?.replace(/\/+$/, "") ?? `http://${configured.host}:${configured.port}`;
|
|
677
|
+
if (stateUrl && explicitUrl && new URL(explicitUrl).origin !== new URL(stateUrl).origin) {
|
|
678
|
+
throw new Error(`Cannot stop safely: addressed ${explicitUrl}/healthz does not match local PID ${state.pid} at ${stateUrl}/healthz; no signal sent.`);
|
|
679
|
+
}
|
|
680
|
+
const check = `${target}/healthz`;
|
|
681
|
+
const listener = async () => {
|
|
542
682
|
try {
|
|
543
|
-
await fetchDaemonProbe(deps,
|
|
544
|
-
|
|
683
|
+
await fetchDaemonProbe(deps, check, HEALTHZ_PROBE_TIMEOUT_MS);
|
|
684
|
+
return "responding";
|
|
545
685
|
}
|
|
546
|
-
catch (
|
|
547
|
-
|
|
548
|
-
throw new Error(`Daemon state is missing and port ${configured.port} is unresponsive — cannot stop safely.`);
|
|
549
|
-
}
|
|
686
|
+
catch (error) {
|
|
687
|
+
return isRefusedError(error) ? "refused" : "unavailable";
|
|
550
688
|
}
|
|
551
|
-
|
|
552
|
-
|
|
689
|
+
};
|
|
690
|
+
if (!state) {
|
|
691
|
+
const effect = await listener();
|
|
692
|
+
const sibling = findSiblingHome(deps);
|
|
693
|
+
if (effect !== "refused" || sibling) {
|
|
694
|
+
throw new Error(`Daemon state is missing — cannot stop safely. Checked ${check}; listener ${effect}.` +
|
|
695
|
+
(sibling ? ` Resolved home ${sibling.resolvedHome}; live sibling ${sibling.siblingHome}.` : ""));
|
|
553
696
|
}
|
|
554
|
-
|
|
697
|
+
const stateFile = resolveLifecycleFile(deps, "daemon.json");
|
|
698
|
+
if (deps.exists(stateFile)) {
|
|
699
|
+
throw new Error(`Daemon target state is unreadable; drain completion unverified. Checked ${check}; listener refused; no signal sent. Inspect ${stateFile}.`);
|
|
700
|
+
}
|
|
701
|
+
const prior = readShutdownReceipt(deps, stateFile);
|
|
702
|
+
if (prior.present && !isCleanShutdown(prior.receipt)) {
|
|
703
|
+
throw new Error(`Drain completion unverified: local shutdown evidence exists but no target state is recorded; cannot attribute it to ${target}. Checked ${check}; listener refused. Inspect ${prior.receiptPath}.`);
|
|
704
|
+
}
|
|
705
|
+
// No target is not a clean-drain verdict, including after an earlier clean stop.
|
|
706
|
+
return "no-target";
|
|
555
707
|
}
|
|
556
708
|
const stateFile = resolveLifecycleFile(deps, "daemon.json");
|
|
557
709
|
const pidState = await checkPid(state, deps);
|
|
558
|
-
if (pidState === "dead") {
|
|
559
|
-
// Already dead — clean up stale state
|
|
560
|
-
deps.removeFile(stateFile);
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
710
|
if (pidState === "not_openrig") {
|
|
564
|
-
|
|
565
|
-
deps.removeFile(stateFile);
|
|
566
|
-
return;
|
|
711
|
+
throw new Error(`Cannot stop safely: PID ${state.pid} is present but identity is not confirmed at ${check}; no signal sent, state preserved.`);
|
|
567
712
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
713
|
+
let notBefore = Date.parse(state.startedAt);
|
|
714
|
+
if (pidState !== "dead") {
|
|
715
|
+
notBefore = Date.now();
|
|
716
|
+
deps.kill(state.pid, "SIGTERM");
|
|
717
|
+
// One signal. An already-exited target goes straight to the same judgment.
|
|
718
|
+
const deadline = Date.now() + DAEMON_STOP_WAIT_MS;
|
|
719
|
+
while (deps.isProcessAlive(state.pid) && Date.now() < deadline) {
|
|
720
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
576
721
|
}
|
|
577
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
578
722
|
}
|
|
579
|
-
|
|
580
|
-
|
|
723
|
+
const present = deps.isProcessAlive(state.pid);
|
|
724
|
+
const effect = await listener();
|
|
725
|
+
const observation = `targeted ${target}; checked ${check}; PID ${state.pid} ${present ? "present" : "absent"}; listener ${effect}`;
|
|
726
|
+
if (present) {
|
|
727
|
+
throw new Error(`Daemon did not exit after SIGTERM within ${DAEMON_STOP_WAIT_MS}ms; ${observation}` +
|
|
728
|
+
(effect === "responding" ? " (still listening)" : "") + "; state file preserved.");
|
|
581
729
|
}
|
|
582
|
-
|
|
583
|
-
throw new Error(`Daemon
|
|
730
|
+
if (effect !== "refused")
|
|
731
|
+
throw new Error(`Daemon stop verification is unverified: ${observation}; state preserved.`);
|
|
732
|
+
const { receipt, receiptPath } = readShutdownReceipt(deps, stateFile);
|
|
733
|
+
if (!receiptMatchesState(receipt, state, notBefore)) {
|
|
734
|
+
throw new Error(`Daemon process stopped; ${observation}; drain completion unverified (no matching shutdown receipt); state preserved. Inspect ${path.join(path.dirname(stateFile), "daemon.log")}.`);
|
|
735
|
+
}
|
|
736
|
+
if (!isCleanShutdown(receipt)) {
|
|
737
|
+
throw new Error(`Daemon stopped with incomplete shutdown: ${receipt.outcome}; phase=${receipt.phase}; ${observation}. Pending effects are unverified; state preserved; inspect ${receiptPath}.`);
|
|
584
738
|
}
|
|
739
|
+
removeMatchingState(deps, stateFile, state);
|
|
740
|
+
return "stopped";
|
|
585
741
|
}
|
|
586
742
|
/** RULING 1ae863d2 — positive-down evidence classifier (lockstep with the daemon's
|
|
587
743
|
* crash-cart-detect semantics): ONLY a connection refusal is strong down evidence;
|
|
@@ -675,9 +831,11 @@ export async function getDaemonStatus(deps, options = {}) {
|
|
|
675
831
|
}
|
|
676
832
|
}
|
|
677
833
|
if (!deps.isProcessAlive(state.pid)) {
|
|
678
|
-
//
|
|
679
|
-
|
|
680
|
-
|
|
834
|
+
// A status read must not erase the identity needed to judge a failed stop.
|
|
835
|
+
const stateFile = resolveLifecycleFile(deps, "daemon.json");
|
|
836
|
+
const { receipt } = readShutdownReceipt(deps, stateFile);
|
|
837
|
+
if (options.cleanupStaleState !== false && receiptMatchesState(receipt, state) && isCleanShutdown(receipt)) {
|
|
838
|
+
removeMatchingState(deps, stateFile, state);
|
|
681
839
|
}
|
|
682
840
|
return { state: "stale" };
|
|
683
841
|
}
|
|
@@ -818,32 +976,9 @@ export async function fetchSelfHostIdentity(deps, url) {
|
|
|
818
976
|
return undefined;
|
|
819
977
|
}
|
|
820
978
|
}
|
|
821
|
-
/**
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
* daemon renders the ORIGIN host. The id comes from the LOCAL daemon's /healthz (env OPENRIG_URL,
|
|
825
|
-
* else the running local daemon), via the shipped fail-open `fetchSelfHostId`. C1 fail-open all the
|
|
826
|
-
* way down: no env URL and no running local daemon ⇒ `undefined` ⇒ the 2-part header stamps (today's
|
|
827
|
-
* behavior, no new failure mode). This is THIS host's own derived id, never a caller-supplied string.
|
|
828
|
-
*/
|
|
829
|
-
export async function resolveOriginSelfHostId(deps) {
|
|
830
|
-
// C1 fail-open around the WHOLE resolution, not just fetchSelfHostId: a remote op must NEVER depend on
|
|
831
|
-
// local daemon health. getDaemonStatus can throw (down / mid-restart / minimal test deps); ANY failure
|
|
832
|
-
// ⇒ undefined ⇒ the 2-part header stamps (today's behavior). Pin 5: no new failure mode on the remote path.
|
|
833
|
-
try {
|
|
834
|
-
let localUrl = readOpenRigEnv("OPENRIG_URL", "RIGGED_URL");
|
|
835
|
-
if (!localUrl) {
|
|
836
|
-
const status = await getDaemonStatus(deps);
|
|
837
|
-
if (status.state === "running" && status.port !== undefined)
|
|
838
|
-
localUrl = getDaemonUrl(status);
|
|
839
|
-
}
|
|
840
|
-
if (!localUrl)
|
|
841
|
-
return undefined;
|
|
842
|
-
return await fetchSelfHostId(deps, localUrl);
|
|
843
|
-
}
|
|
844
|
-
catch {
|
|
845
|
-
return undefined;
|
|
846
|
-
}
|
|
979
|
+
/** Resolve this instance's persisted identity even during an outage; never read it from the target. */
|
|
980
|
+
export async function resolveOriginSelfHostId(_deps) {
|
|
981
|
+
return readLocalOrigin();
|
|
847
982
|
}
|
|
848
983
|
const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
849
984
|
/**
|