@openrig/cli 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/skills/delegating-work/SKILL.md +1 -1
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +90 -9
- package/daemon/assets/skills/rigs/SKILL.md +40 -9
- package/daemon/context-packs/help/help.md +6 -0
- package/daemon/context-packs/help/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +70 -15
- package/daemon/context-packs/reference/acp-agents.md +77 -0
- package/daemon/context-packs/reference/getting-started.md +82 -10
- package/daemon/context-packs/reference/manifest.yaml +6 -3
- package/daemon/context-packs/reference/rig-spec.md +93 -3
- package/daemon/context-packs/reference/whats-new.md +262 -149
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- 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/manifest.yaml +1 -1
- 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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +17 -5
- 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-software-factory/manifest.yaml +1 -1
- 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/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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/SKILL.md +1 -1
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
- 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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-user/SKILL.md +90 -9
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- 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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- 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/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/LICENSE.txt +201 -0
- package/daemon/context-packs/skills/process/agent-browser/OPENRIG.md +13 -29
- package/daemon/context-packs/skills/process/agent-browser/SKILL.md +7 -7
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +3 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/LICENSE.txt +201 -0
- package/daemon/context-packs/skills/process/dogfood/SKILL.md +6 -2
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +3 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/LICENSE.txt +21 -0
- package/daemon/context-packs/skills/process/systematic-debugging/SKILL.md +6 -2
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +3 -1
- package/daemon/context-packs/skills/process/test-driven-development/LICENSE.txt +21 -0
- package/daemon/context-packs/skills/process/test-driven-development/SKILL.md +5 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +3 -1
- package/daemon/context-packs/skills/process/verification-before-completion/LICENSE.txt +21 -0
- package/daemon/context-packs/skills/process/verification-before-completion/SKILL.md +5 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +3 -1
- 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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- 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/manifest.yaml +1 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts +4 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +46 -17
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +8 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +29 -10
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts +10 -4
- package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-resume.js +59 -14
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +44 -12
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +445 -88
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +4 -0
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +38 -7
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/compose-services-adapter.d.ts +16 -0
- package/daemon/dist/adapters/compose-services-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/compose-services-adapter.js +46 -2
- package/daemon/dist/adapters/compose-services-adapter.js.map +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
- package/daemon/dist/adapters/kernel-authority.js +13 -2
- package/daemon/dist/adapters/kernel-authority.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +22 -15
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/tmux-server.d.ts +3 -0
- package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-server.js +11 -2
- package/daemon/dist/adapters/tmux-server.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +38 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +157 -14
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/adapters/yolo-mode.d.ts +7 -0
- package/daemon/dist/adapters/yolo-mode.d.ts.map +1 -1
- package/daemon/dist/adapters/yolo-mode.js +8 -0
- package/daemon/dist/adapters/yolo-mode.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/codex-auth-surface.d.ts +2 -0
- package/daemon/dist/codex-auth-surface.d.ts.map +1 -0
- package/daemon/dist/codex-auth-surface.js +2 -0
- package/daemon/dist/codex-auth-surface.js.map +1 -0
- package/daemon/dist/daemon-db-path.d.ts.map +1 -1
- package/daemon/dist/daemon-db-path.js +45 -12
- package/daemon/dist/daemon-db-path.js.map +1 -1
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +12 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/132_seat_runtime_switches.d.ts +10 -0
- package/daemon/dist/db/migrations/132_seat_runtime_switches.d.ts.map +1 -0
- package/daemon/dist/db/migrations/132_seat_runtime_switches.js +46 -0
- package/daemon/dist/db/migrations/132_seat_runtime_switches.js.map +1 -0
- package/daemon/dist/db/migrations/133_stream_reader_actions.d.ts +8 -0
- package/daemon/dist/db/migrations/133_stream_reader_actions.d.ts.map +1 -0
- package/daemon/dist/db/migrations/133_stream_reader_actions.js +25 -0
- package/daemon/dist/db/migrations/133_stream_reader_actions.js.map +1 -0
- package/daemon/dist/db/migrations/134_claude_token_readings.d.ts +3 -0
- package/daemon/dist/db/migrations/134_claude_token_readings.d.ts.map +1 -0
- package/daemon/dist/db/migrations/134_claude_token_readings.js +21 -0
- package/daemon/dist/db/migrations/134_claude_token_readings.js.map +1 -0
- package/daemon/dist/db/migrations/136_node_launch_recipe.d.ts +9 -0
- package/daemon/dist/db/migrations/136_node_launch_recipe.d.ts.map +1 -0
- package/daemon/dist/db/migrations/136_node_launch_recipe.js +11 -0
- package/daemon/dist/db/migrations/136_node_launch_recipe.js.map +1 -0
- package/daemon/dist/db/migrations/138_node_claude_token_ref.d.ts +3 -0
- package/daemon/dist/db/migrations/138_node_claude_token_ref.d.ts.map +1 -0
- package/daemon/dist/db/migrations/138_node_claude_token_ref.js +8 -0
- package/daemon/dist/db/migrations/138_node_claude_token_ref.js.map +1 -0
- package/daemon/dist/db/migrations/139_node_claude_permissions.d.ts +3 -0
- package/daemon/dist/db/migrations/139_node_claude_permissions.d.ts.map +1 -0
- package/daemon/dist/db/migrations/139_node_claude_permissions.js +5 -0
- package/daemon/dist/db/migrations/139_node_claude_permissions.js.map +1 -0
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +15 -0
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/claim-service.js +1 -1
- package/daemon/dist/domain/claim-service.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +24 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +70 -16
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-credential-precedence.d.ts +33 -0
- package/daemon/dist/domain/claude-credential-precedence.d.ts.map +1 -0
- package/daemon/dist/domain/claude-credential-precedence.js +62 -0
- package/daemon/dist/domain/claude-credential-precedence.js.map +1 -0
- package/daemon/dist/domain/claude-managed-launch.d.ts +43 -4
- package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.js +129 -27
- package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
- package/daemon/dist/domain/claude-permission-rules.d.ts +10 -0
- package/daemon/dist/domain/claude-permission-rules.d.ts.map +1 -0
- package/daemon/dist/domain/claude-permission-rules.js +41 -0
- package/daemon/dist/domain/claude-permission-rules.js.map +1 -0
- package/daemon/dist/domain/claude-seat-token.d.ts +30 -0
- package/daemon/dist/domain/claude-seat-token.d.ts.map +1 -0
- package/daemon/dist/domain/claude-seat-token.js +78 -0
- package/daemon/dist/domain/claude-seat-token.js.map +1 -0
- package/daemon/dist/domain/codex-auth.d.ts +148 -0
- package/daemon/dist/domain/codex-auth.d.ts.map +1 -0
- package/daemon/dist/domain/codex-auth.js +506 -0
- package/daemon/dist/domain/codex-auth.js.map +1 -0
- package/daemon/dist/domain/codex-daemon-support.d.ts +2 -1
- package/daemon/dist/domain/codex-daemon-support.d.ts.map +1 -1
- package/daemon/dist/domain/codex-daemon-support.js +3 -2
- package/daemon/dist/domain/codex-daemon-support.js.map +1 -1
- package/daemon/dist/domain/codex-git-add-dirs.d.ts +1 -1
- package/daemon/dist/domain/codex-git-add-dirs.d.ts.map +1 -1
- package/daemon/dist/domain/codex-network-default.d.ts +2 -1
- package/daemon/dist/domain/codex-network-default.d.ts.map +1 -1
- package/daemon/dist/domain/codex-network-default.js +3 -2
- package/daemon/dist/domain/codex-network-default.js.map +1 -1
- package/daemon/dist/domain/codex-team-workspace.d.ts +5 -0
- package/daemon/dist/domain/codex-team-workspace.d.ts.map +1 -1
- package/daemon/dist/domain/codex-team-workspace.js +37 -0
- package/daemon/dist/domain/codex-team-workspace.js.map +1 -1
- package/daemon/dist/domain/community-harness-first-input.d.ts +7 -0
- package/daemon/dist/domain/community-harness-first-input.d.ts.map +1 -0
- package/daemon/dist/domain/community-harness-first-input.js +16 -0
- package/daemon/dist/domain/community-harness-first-input.js.map +1 -0
- package/daemon/dist/domain/community-harness-presets.d.ts +2 -0
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +4 -2
- package/daemon/dist/domain/community-harness-presets.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts +6 -0
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -0
- package/daemon/dist/domain/compaction-restore-notice.js +27 -0
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -0
- package/daemon/dist/domain/context-packs/seat-recap-store.d.ts +14 -0
- package/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/seat-recap-store.js +57 -1
- package/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +6 -1
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +15 -4
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +26 -13
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +5 -2
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.js +3 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts +1 -0
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +6 -5
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +3 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +11 -9
- package/daemon/dist/domain/gateway/slack/message.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 +4 -0
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/managed-restore-read-access.d.ts +20 -0
- package/daemon/dist/domain/managed-restore-read-access.d.ts.map +1 -0
- package/daemon/dist/domain/managed-restore-read-access.js +77 -0
- package/daemon/dist/domain/managed-restore-read-access.js.map +1 -0
- package/daemon/dist/domain/markdown-address.d.ts.map +1 -1
- package/daemon/dist/domain/markdown-address.js +21 -2
- package/daemon/dist/domain/markdown-address.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +3 -3
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +11 -8
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.js +18 -1
- package/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
- package/daemon/dist/domain/native-permission-store.d.ts +7 -2
- package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
- package/daemon/dist/domain/native-permission-store.js +13 -8
- package/daemon/dist/domain/native-permission-store.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts +2 -0
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +162 -35
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +4 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +18 -0
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +11 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +41 -6
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/parent-session-env.d.ts +1 -1
- package/daemon/dist/domain/parent-session-env.d.ts.map +1 -1
- package/daemon/dist/domain/parent-session-env.js +3 -1
- package/daemon/dist/domain/parent-session-env.js.map +1 -1
- package/daemon/dist/domain/parked-query.d.ts +3 -0
- package/daemon/dist/domain/parked-query.d.ts.map +1 -1
- package/daemon/dist/domain/parked-query.js +1 -0
- package/daemon/dist/domain/parked-query.js.map +1 -1
- package/daemon/dist/domain/permission-account.d.ts +3 -0
- package/daemon/dist/domain/permission-account.d.ts.map +1 -1
- package/daemon/dist/domain/permission-account.js +17 -3
- package/daemon/dist/domain/permission-account.js.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +8 -0
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js +15 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +7 -4
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +12 -8
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/proof/source-watch.d.ts +6 -1
- package/daemon/dist/domain/proof/source-watch.d.ts.map +1 -1
- package/daemon/dist/domain/proof/source-watch.js +241 -35
- package/daemon/dist/domain/proof/source-watch.js.map +1 -1
- package/daemon/dist/domain/provider/claude-auth-status-reader.d.ts +12 -0
- package/daemon/dist/domain/provider/claude-auth-status-reader.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-auth-status-reader.js +4 -4
- package/daemon/dist/domain/provider/claude-auth-status-reader.js.map +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts +32 -0
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -0
- package/daemon/dist/domain/provider/claude-seat-switch.js +136 -0
- package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -0
- package/daemon/dist/domain/provider/claude-token-usage.d.ts +34 -0
- package/daemon/dist/domain/provider/claude-token-usage.d.ts.map +1 -0
- package/daemon/dist/domain/provider/claude-token-usage.js +168 -0
- package/daemon/dist/domain/provider/claude-token-usage.js.map +1 -0
- package/daemon/dist/domain/provider/provider-account-readings.d.ts +7 -6
- package/daemon/dist/domain/provider/provider-account-readings.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-account-readings.js +31 -10
- package/daemon/dist/domain/provider/provider-account-readings.js.map +1 -1
- package/daemon/dist/domain/provider/provider-collect.d.ts +3 -0
- package/daemon/dist/domain/provider/provider-collect.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-collect.js +3 -2
- package/daemon/dist/domain/provider/provider-collect.js.map +1 -1
- package/daemon/dist/domain/provider/provider-seat-accounts.d.ts +1 -1
- package/daemon/dist/domain/provider/provider-seat-accounts.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-seat-accounts.js +29 -2
- package/daemon/dist/domain/provider/provider-seat-accounts.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.d.ts +38 -4
- package/daemon/dist/domain/provider/provider-service-impl.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.js +147 -5
- package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service.d.ts +109 -4
- package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.d.ts +3 -0
- package/daemon/dist/domain/provider/provider-signals.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.js +7 -2
- package/daemon/dist/domain/provider/provider-signals.js.map +1 -1
- package/daemon/dist/domain/provider/provider-types.d.ts +61 -5
- package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.d.ts +4 -0
- package/daemon/dist/domain/provider/reactive-tap.d.ts.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.js +3 -0
- package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
- package/daemon/dist/domain/provider/usage-across-hosts.d.ts.map +1 -1
- package/daemon/dist/domain/provider/usage-across-hosts.js +8 -2
- package/daemon/dist/domain/provider/usage-across-hosts.js.map +1 -1
- package/daemon/dist/domain/provider/usage-windows.d.ts +2 -0
- package/daemon/dist/domain/provider/usage-windows.d.ts.map +1 -1
- package/daemon/dist/domain/provider/usage-windows.js +4 -0
- package/daemon/dist/domain/provider/usage-windows.js.map +1 -1
- package/daemon/dist/domain/queue-owner.d.ts +9 -0
- package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
- package/daemon/dist/domain/queue-owner.js +28 -0
- package/daemon/dist/domain/queue-owner.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +18 -3
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +94 -10
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +1 -1
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +6 -1
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +14 -3
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +50 -8
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +90 -28
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.d.ts +3 -0
- package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.js +5 -1
- package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +26 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +117 -11
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.d.ts +11 -2
- package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.js +32 -14
- package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
- package/daemon/dist/domain/resume-token-capture.d.ts +5 -1
- package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-capture.js +3 -1
- package/daemon/dist/domain/resume-token-capture.js.map +1 -1
- package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-expansion-service.js +1 -0
- package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +19 -2
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +247 -2
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +3 -1
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +4 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +7 -0
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +41 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +174 -13
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +24 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/running-name-guard.d.ts.map +1 -1
- package/daemon/dist/domain/running-name-guard.js +2 -1
- package/daemon/dist/domain/running-name-guard.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +17 -1
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/runtime-switch-materials.d.ts +77 -0
- package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -0
- package/daemon/dist/domain/runtime-switch-materials.js +253 -0
- package/daemon/dist/domain/runtime-switch-materials.js.map +1 -0
- package/daemon/dist/domain/scope/scope-approve.d.ts +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +4 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +17 -0
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +8 -2
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +31 -2
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +2 -2
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.d.ts +5 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +8 -4
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +19 -3
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +59 -13
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +9 -2
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +27 -7
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-dir.d.ts +17 -0
- package/daemon/dist/domain/seat-runtime-dir.d.ts.map +1 -0
- package/daemon/dist/domain/seat-runtime-dir.js +27 -0
- package/daemon/dist/domain/seat-runtime-dir.js.map +1 -0
- package/daemon/dist/domain/seat-runtime-home.d.ts +42 -0
- package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -0
- package/daemon/dist/domain/seat-runtime-home.js +89 -0
- package/daemon/dist/domain/seat-runtime-home.js.map +1 -0
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts +220 -0
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -0
- package/daemon/dist/domain/seat-runtime-switch-service.js +593 -0
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -0
- package/daemon/dist/domain/seat-skills-pointer.d.ts +5 -0
- package/daemon/dist/domain/seat-skills-pointer.d.ts.map +1 -0
- package/daemon/dist/domain/seat-skills-pointer.js +15 -0
- package/daemon/dist/domain/seat-skills-pointer.js.map +1 -0
- package/daemon/dist/domain/seat-status-service.d.ts +31 -0
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +44 -0
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.d.ts +3 -0
- package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.js +6 -0
- package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
- package/daemon/dist/domain/service-orchestrator.d.ts +7 -0
- package/daemon/dist/domain/service-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/service-orchestrator.js +4 -0
- package/daemon/dist/domain/service-orchestrator.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +19 -1
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +227 -47
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/snapshot-capture.d.ts +4 -1
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +4 -1
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/snapshot-repository.d.ts +4 -3
- package/daemon/dist/domain/snapshot-repository.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-repository.js +6 -5
- package/daemon/dist/domain/snapshot-repository.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts +3 -0
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +58 -16
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +1 -0
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +1 -0
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/stream-reader-actions.d.ts +49 -0
- package/daemon/dist/domain/stream-reader-actions.d.ts.map +1 -0
- package/daemon/dist/domain/stream-reader-actions.js +104 -0
- package/daemon/dist/domain/stream-reader-actions.js.map +1 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts +35 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +58 -3
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts +6 -28
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +16 -66
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/rex-adapter.d.ts +42 -0
- package/daemon/dist/domain/terminal/rex-adapter.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/rex-adapter.js +228 -0
- package/daemon/dist/domain/terminal/rex-adapter.js.map +1 -0
- package/daemon/dist/domain/terminal/rex-layout.d.ts +26 -0
- package/daemon/dist/domain/terminal/rex-layout.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/rex-layout.js +21 -0
- package/daemon/dist/domain/terminal/rex-layout.js.map +1 -0
- package/daemon/dist/domain/terminal/rex-transport.d.ts +43 -0
- package/daemon/dist/domain/terminal/rex-transport.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/rex-transport.js +176 -0
- package/daemon/dist/domain/terminal/rex-transport.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +11 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +2 -2
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +10 -11
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.d.ts +2 -0
- package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/tile-attach.js +42 -0
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -0
- package/daemon/dist/domain/terminal/tile-layout.d.ts +32 -0
- package/daemon/dist/domain/terminal/tile-layout.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/tile-layout.js +36 -0
- package/daemon/dist/domain/terminal/tile-layout.js.map +1 -0
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +11 -7
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +61 -0
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/wake-recovery.d.ts +16 -0
- package/daemon/dist/domain/wake-recovery.d.ts.map +1 -0
- package/daemon/dist/domain/wake-recovery.js +31 -0
- package/daemon/dist/domain/wake-recovery.js.map +1 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +5 -1
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/lib/pane-envelope.d.ts +5 -0
- package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
- package/daemon/dist/lib/pane-envelope.js +8 -1
- package/daemon/dist/lib/pane-envelope.js.map +1 -1
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +12 -0
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/agent-images.d.ts.map +1 -1
- package/daemon/dist/routes/agent-images.js +9 -0
- package/daemon/dist/routes/agent-images.js.map +1 -1
- package/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/daemon/dist/routes/context-packs.js +22 -0
- package/daemon/dist/routes/context-packs.js.map +1 -1
- package/daemon/dist/routes/mission-control.js +2 -2
- package/daemon/dist/routes/mission-control.js.map +1 -1
- package/daemon/dist/routes/provider.d.ts.map +1 -1
- package/daemon/dist/routes/provider.js +83 -3
- package/daemon/dist/routes/provider.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +102 -10
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts +10 -8
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js +13 -11
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/rigs.js +2 -0
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/runtime-switch-custody.d.ts +21 -0
- package/daemon/dist/routes/runtime-switch-custody.d.ts.map +1 -0
- package/daemon/dist/routes/runtime-switch-custody.js +55 -0
- package/daemon/dist/routes/runtime-switch-custody.js.map +1 -0
- package/daemon/dist/routes/scope-approve.js +2 -2
- package/daemon/dist/routes/scope-approve.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +90 -7
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +9 -0
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/startup.js +15 -5
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/stream.d.ts.map +1 -1
- package/daemon/dist/routes/stream.js +25 -2
- package/daemon/dist/routes/stream.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +31 -3
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/seat-recap-store-surface.d.ts +1 -1
- package/daemon/dist/seat-recap-store-surface.d.ts.map +1 -1
- package/daemon/dist/seat-recap-store-surface.js +1 -1
- package/daemon/dist/seat-recap-store-surface.js.map +1 -1
- package/daemon/dist/server.d.ts +2 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +1 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +5 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +106 -28
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.js +5 -0
- package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
- package/daemon/docs/reference/community-harness-examples/cursor/cursor.yaml +2 -2
- package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +7 -0
- package/daemon/docs/reference/community-harness-examples/openclaw/openclaw-gateway.yaml +15 -0
- package/daemon/docs/reference/community-harness-examples/openclaw/openclaw.yaml +5 -2
- package/daemon/docs/reference/community-harness-examples/openclaw/openrig-openclaw-launch +56 -24
- package/daemon/docs/reference/community-harness-presets.md +33 -18
- package/daemon/docs/reference/getting-started.md +82 -10
- package/daemon/docs/reference/health-diagnosis.md +13 -0
- package/daemon/docs/reference/help.md +6 -0
- package/daemon/docs/reference/keeping-a-watch.md +21 -0
- package/daemon/docs/reference/project-workspace.md +18 -0
- package/daemon/docs/reference/publishing-a-rig-bundle.md +11 -0
- package/daemon/docs/reference/quickstart.md +1 -1
- package/daemon/docs/reference/rig-spec.md +93 -3
- package/daemon/docs/reference/sdlc-conventions.md +3 -1
- package/daemon/docs/reference/seat-delivery.md +16 -5
- package/daemon/docs/reference/slack-app-setup.md +1 -1
- package/daemon/docs/reference/terminal-sessions.md +51 -0
- package/daemon/docs/reference/whats-new.md +262 -149
- package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +17 -5
- package/daemon/specs/agents/shared/skills/process/agent-browser/LICENSE.txt +201 -0
- package/daemon/specs/agents/shared/skills/process/agent-browser/OPENRIG.md +13 -29
- package/daemon/specs/agents/shared/skills/process/agent-browser/SKILL.md +7 -7
- package/daemon/specs/agents/shared/skills/process/dogfood/LICENSE.txt +201 -0
- package/daemon/specs/agents/shared/skills/process/dogfood/SKILL.md +6 -2
- package/daemon/specs/agents/shared/skills/process/systematic-debugging/LICENSE.txt +21 -0
- package/daemon/specs/agents/shared/skills/process/systematic-debugging/SKILL.md +6 -2
- package/daemon/specs/agents/shared/skills/process/test-driven-development/LICENSE.txt +21 -0
- package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +5 -1
- package/daemon/specs/agents/shared/skills/process/verification-before-completion/LICENSE.txt +21 -0
- package/daemon/specs/agents/shared/skills/process/verification-before-completion/SKILL.md +5 -1
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +18 -1
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +3 -0
- package/daemon/specs/rigs/launch/kernel/agents/queue/worker/guidance/role.md +3 -2
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +2 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/capture.d.ts.map +1 -1
- package/dist/commands/capture.js +8 -0
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/chatroom.d.ts.map +1 -1
- package/dist/commands/chatroom.js +6 -0
- package/dist/commands/chatroom.js.map +1 -1
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +29 -23
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +6 -2
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +3 -0
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +47 -0
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/health.js +1 -1
- package/dist/commands/health.js.map +1 -1
- package/dist/commands/launch.js +1 -1
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/project.d.ts.map +1 -1
- package/dist/commands/project.js +6 -1
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/proof.d.ts.map +1 -1
- package/dist/commands/proof.js +33 -2
- package/dist/commands/proof.js.map +1 -1
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +172 -24
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +154 -30
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +5 -2
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +212 -5
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +21 -0
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/stream-outcome.d.ts +586 -1
- package/dist/commands/stream-outcome.d.ts.map +1 -1
- package/dist/commands/stream-outcome.js +38 -1
- package/dist/commands/stream-outcome.js.map +1 -1
- package/dist/commands/stream.d.ts.map +1 -1
- package/dist/commands/stream.js +22 -0
- package/dist/commands/stream.js.map +1 -1
- package/dist/commands/terminal.d.ts +4 -0
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +7 -5
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +7 -1
- package/dist/commands/up.js.map +1 -1
- package/dist/lib/codex-auth.d.ts +1 -147
- package/dist/lib/codex-auth.d.ts.map +1 -1
- package/dist/lib/codex-auth.js +2 -505
- package/dist/lib/codex-auth.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +52 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/terminal-window-rex.d.ts +6 -0
- package/dist/terminal-window-rex.d.ts.map +1 -0
- package/dist/terminal-window-rex.js +129 -0
- package/dist/terminal-window-rex.js.map +1 -0
- package/dist/terminal-window.d.ts +2 -0
- package/dist/terminal-window.d.ts.map +1 -1
- package/dist/terminal-window.js +19 -7
- package/dist/terminal-window.js.map +1 -1
- package/package.json +1 -1
- package/tui/dist/commands/registry.js +1 -1
- package/tui/dist/commands/registry.js.map +1 -1
- package/tui/dist/daemon-client.d.ts +4 -3
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +5 -4
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +4 -1
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/live.d.ts.map +1 -1
- package/tui/dist/live.js +6 -4
- package/tui/dist/live.js.map +1 -1
- package/tui/dist/terminals/open-window.d.ts +9 -5
- package/tui/dist/terminals/open-window.d.ts.map +1 -1
- package/tui/dist/terminals/open-window.js +29 -12
- package/tui/dist/terminals/open-window.js.map +1 -1
- package/tui/dist/terminals/terminal-model.d.ts +2 -1
- package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
- package/tui/dist/terminals/terminal-model.js +5 -4
- package/tui/dist/terminals/terminal-model.js.map +1 -1
- package/tui/dist/usage/usage-model.d.ts.map +1 -1
- package/tui/dist/usage/usage-model.js +5 -3
- package/tui/dist/usage/usage-model.js.map +1 -1
- package/ui/dist/assets/{index-Blg-p32B.js → index-DLP1ipGq.js} +1 -1
- package/ui/dist/index.html +1 -1
|
@@ -33,7 +33,7 @@ const defaultCodexCli = (args, env) => new Promise((resolve) => {
|
|
|
33
33
|
});
|
|
34
34
|
// Codex's hook trust recipe (the key and hash Codex records for a trusted hook), kept in one script.
|
|
35
35
|
const codexHookTrust = createRequire(import.meta.url)("../../assets/plugins/openrig-core/hooks/scripts/codex-hook-trust.cjs");
|
|
36
|
-
import { listNativeProcesses, observeCodexPaneProcess, observeCodexForkProcess, verifyPaneIdleShell } from "../domain/native-process-lineage.js";
|
|
36
|
+
import { listNativeProcesses, observeCodexPaneProcess, observeCodexForkProcess, verifyCodexPaneProcess, verifyPaneIdleShell } from "../domain/native-process-lineage.js";
|
|
37
37
|
import { recordSeatSkillWrite, seatPluginSkillsLossNote, seatProjectionComplete, seatSkillWriteRefusal } from "../domain/seat-skill-storage.js";
|
|
38
38
|
import { codexPluginContentHash, planOwnedCodexContentApproval, recordOwnedCodexApproval } from "../domain/codex-owned-plugin-trust.js";
|
|
39
39
|
// The managed resume check's poll window: a quick phase, then an extended one for a slow boot.
|
|
@@ -58,6 +58,10 @@ export class CodexRuntimeAdapter {
|
|
|
58
58
|
sleep;
|
|
59
59
|
resolveHomeDirByPid;
|
|
60
60
|
codexHome;
|
|
61
|
+
/** A seat's own CODEX_HOME from its member or rig `env:`, when it declares one. */
|
|
62
|
+
seatHome;
|
|
63
|
+
/** One thread-id resolver per Codex home its seats use, the daemon's included. */
|
|
64
|
+
threadResolvers = new Map();
|
|
61
65
|
launchPath;
|
|
62
66
|
// Housekeeping B1 fixback (guard-blocking, arch HK-AR-1 = whole-probe DI):
|
|
63
67
|
// the Codex profile-LOAD probe is an injectable dep in the adapter's
|
|
@@ -72,9 +76,11 @@ export class CodexRuntimeAdapter {
|
|
|
72
76
|
// #275: Codex's own answer on whether the plain floor may get network access. Startup wires the
|
|
73
77
|
// real reader; absent keeps every invocation unchanged.
|
|
74
78
|
readNetworkDefault;
|
|
75
|
-
// Issue #121: git metadata dirs for the
|
|
79
|
+
// Issue #121: git metadata dirs for the `--add-dir`s of fresh, resume and fork (a linked worktree's `.git` is a file).
|
|
76
80
|
// Default = the real resolver; tests may inject a controlled one.
|
|
77
81
|
resolveGitAddDirs;
|
|
82
|
+
// The seat's own topology folder for the `--add-dir`s of fresh, resume and fork. Absent: none is added.
|
|
83
|
+
prepareSeatFolder;
|
|
78
84
|
prepareTeamWorkspace;
|
|
79
85
|
resolveManagedConfigSettings;
|
|
80
86
|
resolveHooksEnabled;
|
|
@@ -102,9 +108,11 @@ export class CodexRuntimeAdapter {
|
|
|
102
108
|
this.resolveManagedConfigSettings = deps.resolveManagedConfigSettings;
|
|
103
109
|
this.resolveHooksEnabled = deps.resolveHooksEnabled;
|
|
104
110
|
this.prepareTeamWorkspace = deps.prepareTeamWorkspace;
|
|
111
|
+
this.prepareSeatFolder = deps.prepareSeatFolder;
|
|
105
112
|
this.seatLaunchEnvironment = deps.seatLaunchEnvironment;
|
|
106
113
|
this.fs = deps.fsOps;
|
|
107
114
|
this.codexHome = deps.codexHome;
|
|
115
|
+
this.seatHome = deps.seatHome;
|
|
108
116
|
this.launchPath = deps.launchPath;
|
|
109
117
|
this.detectDaemonSupport = deps.detectDaemonSupport;
|
|
110
118
|
this.readNetworkDefault = deps.readNetworkDefault;
|
|
@@ -112,28 +120,63 @@ export class CodexRuntimeAdapter {
|
|
|
112
120
|
this.activityRelayPath = deps.activityRelayPath;
|
|
113
121
|
this.listProcesses = deps.listProcesses ?? defaultListProcesses;
|
|
114
122
|
this.resolveHomeDirByPid = deps.resolveHomeDirByPid ?? defaultResolveHomeDirByPid;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
this.readThreadIdByPid = deps.readThreadIdByPid ?? ((pid, identity) => identity === undefined
|
|
120
|
-
? this.readThreadIdFromLogs(pid) : threadIdResolver.resolveForkChild(pid, identity));
|
|
123
|
+
// A seat with its own CODEX_HOME logs its threads there, so each read names the home it searches.
|
|
124
|
+
this.readThreadIdByPid = deps.readThreadIdByPid ?? ((pid, identity, home) => identity === undefined
|
|
125
|
+
? this.readThreadIdFromLogs(pid, home) : this.threadResolverFor(home).resolveForkChild(pid, identity));
|
|
121
126
|
// A just-launched resume may log only inside its start second, so this reads like a fork child's ("by-process").
|
|
122
127
|
this.readResumeEvidence = deps.readResumeEvidence ?? (deps.readThreadIdByPid
|
|
123
|
-
? async (pid, identity) => {
|
|
124
|
-
const threadId = (await deps.readThreadIdByPid(pid, identity))?.trim();
|
|
128
|
+
? async (pid, identity, home) => {
|
|
129
|
+
const threadId = (await deps.readThreadIdByPid(pid, identity, home))?.trim();
|
|
125
130
|
return threadId ? { threadId } : { reason: "no_log_row" };
|
|
126
131
|
}
|
|
127
|
-
: async (pid, identity) => {
|
|
132
|
+
: async (pid, identity, home) => {
|
|
128
133
|
let reason;
|
|
129
|
-
const threadId = (await
|
|
134
|
+
const threadId = (await this.threadResolverFor(home).resolveForkChild(pid, identity, (d) => { reason = d.reason; }))?.trim();
|
|
130
135
|
return threadId ? { threadId } : { reason: reason ?? "no_log_row" };
|
|
131
136
|
});
|
|
132
137
|
this.resumeProofWindowMs = deps.resumeProofWindowMs ?? RESUME_QUICK_ATTEMPTS * RESUME_QUICK_SLEEP_MS + RESUME_EXTENDED_ATTEMPTS * RESUME_EXTENDED_SLEEP_MS;
|
|
133
138
|
this.readinessSettings = deps.readinessSettings;
|
|
134
139
|
this.sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
135
|
-
this.verifyProfilePreflight = deps.verifyProfilePreflight
|
|
136
|
-
|
|
140
|
+
this.verifyProfilePreflight = deps.verifyProfilePreflight ?? ((profile, cwd, home) => {
|
|
141
|
+
const selected = home ?? this.codexHome;
|
|
142
|
+
return defaultProfilePreflight(profile, selected ? { cwd, codexHome: selected, launchPath: this.launchPath } : undefined);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** The home a seat's Codex uses: its own from its member or rig `env:`, else the daemon's explicit CODEX_HOME. Undefined
|
|
146
|
+
* keeps the legacy OS/PID home behavior. */
|
|
147
|
+
homeFor(binding) {
|
|
148
|
+
return this.ownHome(binding) ?? this.codexHome;
|
|
149
|
+
}
|
|
150
|
+
/** Only the seat's own CODEX_HOME, undefined when it declares none. Probes and readers get it as an extra argument
|
|
151
|
+
* only when it's set, so a seat without one calls them exactly as before. */
|
|
152
|
+
ownHome(binding) {
|
|
153
|
+
return binding?.nodeId ? this.seatHome?.(binding.nodeId) : undefined;
|
|
154
|
+
}
|
|
155
|
+
ownHomeCommandOpt(binding) {
|
|
156
|
+
const own = this.ownHome(binding);
|
|
157
|
+
return own ? { codexHome: own } : {};
|
|
158
|
+
}
|
|
159
|
+
ownHomeOpt(binding) {
|
|
160
|
+
const own = this.ownHome(binding);
|
|
161
|
+
return own ? { home: own } : {};
|
|
162
|
+
}
|
|
163
|
+
/** A thread id read for this seat's process, in the seat's own home when it declares one. */
|
|
164
|
+
readThreadIdForSeat(binding, pid, identity) {
|
|
165
|
+
const own = this.ownHome(binding);
|
|
166
|
+
if (own)
|
|
167
|
+
return this.readThreadIdByPid(pid, identity, own);
|
|
168
|
+
return identity === undefined ? this.readThreadIdByPid(pid) : this.readThreadIdByPid(pid, identity);
|
|
169
|
+
}
|
|
170
|
+
/** The thread-id resolver for one Codex home (undefined: the daemon's), kept so its process-home cache is reused. */
|
|
171
|
+
threadResolverFor(home) {
|
|
172
|
+
const selected = home ?? this.codexHome;
|
|
173
|
+
let resolver = this.threadResolvers.get(selected ?? "");
|
|
174
|
+
if (!resolver) {
|
|
175
|
+
resolver = new CodexThreadIdResolver({ defaultHome: this.fs.homedir ?? os.homedir(), codexHome: selected,
|
|
176
|
+
resolveHomeDirByPid: this.resolveHomeDirByPid });
|
|
177
|
+
this.threadResolvers.set(selected ?? "", resolver);
|
|
178
|
+
}
|
|
179
|
+
return resolver;
|
|
137
180
|
}
|
|
138
181
|
/**
|
|
139
182
|
* Bring the Codex config.toml to the state OpenRig-managed seats need: feature flag,
|
|
@@ -142,8 +185,8 @@ export class CodexRuntimeAdapter {
|
|
|
142
185
|
* them: a rig with no Codex seat leaves the user's config alone. A failure warns and does
|
|
143
186
|
* not block the launch.
|
|
144
187
|
*/
|
|
145
|
-
async ensureManagedConfig() {
|
|
146
|
-
return this.withConfigLock(() => this.applyManagedConfig());
|
|
188
|
+
async ensureManagedConfig(home) {
|
|
189
|
+
return this.withConfigLock(() => this.applyManagedConfig(home));
|
|
147
190
|
}
|
|
148
191
|
/** Run `task` after every earlier config setup on this adapter has finished, whatever its outcome. */
|
|
149
192
|
withConfigLock(task) {
|
|
@@ -151,16 +194,16 @@ export class CodexRuntimeAdapter {
|
|
|
151
194
|
this.configLock = run.catch(() => undefined);
|
|
152
195
|
return run;
|
|
153
196
|
}
|
|
154
|
-
async applyManagedConfig() {
|
|
197
|
+
async applyManagedConfig(home) {
|
|
155
198
|
if (!this.resolveManagedConfigSettings)
|
|
156
199
|
return undefined;
|
|
157
200
|
try {
|
|
158
201
|
const { enabled, codexVersion } = await this.resolveManagedConfigSettings();
|
|
159
|
-
this.ensureCodexFeatureFlag(enabled, { codexVersion });
|
|
202
|
+
this.ensureCodexFeatureFlag(enabled, { codexVersion }, home);
|
|
160
203
|
if (enabled)
|
|
161
|
-
this.ensureCodexActivityHooks();
|
|
204
|
+
this.ensureCodexActivityHooks(home);
|
|
162
205
|
else
|
|
163
|
-
this.removeCodexActivityHooks();
|
|
206
|
+
this.removeCodexActivityHooks(home);
|
|
164
207
|
return { hooksEnabled: enabled };
|
|
165
208
|
}
|
|
166
209
|
catch (err) {
|
|
@@ -192,7 +235,7 @@ export class CodexRuntimeAdapter {
|
|
|
192
235
|
* doesn't disable the plugin (codexCorePluginEnablement), and only when the installed version differs from the vendored
|
|
193
236
|
* one. Codex owns its plugin cache; its immutable legacy trust baseline is never rewritten.
|
|
194
237
|
*/
|
|
195
|
-
async ensureCodexCorePlugin() {
|
|
238
|
+
async ensureCodexCorePlugin(home) {
|
|
196
239
|
const report = (outcome, reason) => {
|
|
197
240
|
if (outcome !== "current")
|
|
198
241
|
console.error(`[openrig] codex core plugin ${outcome}: ${reason}`);
|
|
@@ -242,7 +285,7 @@ export class CodexRuntimeAdapter {
|
|
|
242
285
|
return false;
|
|
243
286
|
}
|
|
244
287
|
};
|
|
245
|
-
const codexHome = nodePath.dirname(this.resolveCodexConfigPath());
|
|
288
|
+
const codexHome = nodePath.dirname(this.resolveCodexConfigPath(home));
|
|
246
289
|
const readLayers = () => codexReadableConfigLayers(codexHome, this.codexSystemConfigDir).map((layer) => {
|
|
247
290
|
if (!this.fs.exists(layer.path))
|
|
248
291
|
return { ...layer, state: "absent" };
|
|
@@ -283,7 +326,7 @@ export class CodexRuntimeAdapter {
|
|
|
283
326
|
const firstInstall = !this.fs.exists(cacheRoot) && !layers.some(layer => layer.state === "read"
|
|
284
327
|
&& Object.hasOwn((parseToml(layer.content).plugins ?? {}), CODEX_CORE_PLUGIN_KEY));
|
|
285
328
|
const renewContentApproval = (freshGrant = false) => {
|
|
286
|
-
const configPath = this.resolveCodexConfigPath();
|
|
329
|
+
const configPath = this.resolveCodexConfigPath(home);
|
|
287
330
|
const currentLayers = readLayers();
|
|
288
331
|
if (codexCorePluginEnablement(currentLayers).decision !== "allow")
|
|
289
332
|
return;
|
|
@@ -338,7 +381,7 @@ export class CodexRuntimeAdapter {
|
|
|
338
381
|
let freshGrants = 0;
|
|
339
382
|
const grantLayers = readLayers();
|
|
340
383
|
if (firstInstall && codexCorePluginEnablement(grantLayers).decision === "allow" && matchesShippedTree(cachedDir)) {
|
|
341
|
-
let content = this.fs.readFile(this.resolveCodexConfigPath());
|
|
384
|
+
let content = this.fs.readFile(this.resolveCodexConfigPath(home));
|
|
342
385
|
const hookManifest = JSON.parse(fs.readFileSync(nodePath.join(shipped, "hooks/codex.json"), "utf8"));
|
|
343
386
|
for (const [event, groups] of Object.entries(hookManifest.hooks)) {
|
|
344
387
|
groups.forEach((group, groupIndex) => group.hooks.forEach((handler, handlerIndex) => {
|
|
@@ -359,7 +402,7 @@ export class CodexRuntimeAdapter {
|
|
|
359
402
|
}
|
|
360
403
|
}));
|
|
361
404
|
}
|
|
362
|
-
this.fs.writeFile(this.resolveCodexConfigPath(), content);
|
|
405
|
+
this.fs.writeFile(this.resolveCodexConfigPath(home), content);
|
|
363
406
|
}
|
|
364
407
|
renewContentApproval(freshGrants === 6);
|
|
365
408
|
return report("installed", `${CODEX_CORE_PLUGIN_KEY} ${version} through Codex's own install (${enablement.reason})`);
|
|
@@ -394,14 +437,14 @@ export class CodexRuntimeAdapter {
|
|
|
394
437
|
* that lived inside the auto-injected activity-hook provisioning path
|
|
395
438
|
* pre-rip (plugin-primitive Phase 3a slice 3.1).
|
|
396
439
|
*/
|
|
397
|
-
ensureCodexFeatureFlag(enabled, opts) {
|
|
440
|
+
ensureCodexFeatureFlag(enabled, opts, home) {
|
|
398
441
|
if (!enabled)
|
|
399
442
|
return;
|
|
400
443
|
if (!opts?.codexVersion)
|
|
401
444
|
return;
|
|
402
445
|
if (isCodex013xOrLater(opts.codexVersion))
|
|
403
446
|
return;
|
|
404
|
-
const configPath = this.resolveCodexConfigPath();
|
|
447
|
+
const configPath = this.resolveCodexConfigPath(home);
|
|
405
448
|
const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : "";
|
|
406
449
|
const updated = upsertCodexHooksFeature(existing);
|
|
407
450
|
if (updated !== existing) {
|
|
@@ -430,7 +473,7 @@ export class CodexRuntimeAdapter {
|
|
|
430
473
|
* codex TUI launch lacks that context and may not deliver SessionStart — not how OpenRig
|
|
431
474
|
* launches seats.)
|
|
432
475
|
*/
|
|
433
|
-
ensureCodexActivityHooks() {
|
|
476
|
+
ensureCodexActivityHooks(home) {
|
|
434
477
|
const relay = this.activityRelayPath;
|
|
435
478
|
if (!relay || !this.fs.exists(relay)) {
|
|
436
479
|
if (relay) {
|
|
@@ -438,8 +481,15 @@ export class CodexRuntimeAdapter {
|
|
|
438
481
|
}
|
|
439
482
|
return;
|
|
440
483
|
}
|
|
441
|
-
const configPath = this.resolveCodexConfigPath();
|
|
484
|
+
const configPath = this.resolveCodexConfigPath(home);
|
|
442
485
|
const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : "";
|
|
486
|
+
// A Codex home that keeps its hooks in hooks.json gets OpenRig's there too: Codex warns when one layer mixes both
|
|
487
|
+
// formats. Without a hooks.json, the inline config.toml block below is unchanged.
|
|
488
|
+
const hooksPath = nodePath.join(nodePath.dirname(configPath), "hooks.json");
|
|
489
|
+
if (this.fs.exists(hooksPath)) {
|
|
490
|
+
this.ensureCodexJsonActivityHooks(existing, configPath, hooksPath, relay);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
443
493
|
const withHooks = upsertCodexActivityHooks(existing, relay);
|
|
444
494
|
if (withHooks !== existing) {
|
|
445
495
|
this.fs.mkdirp(nodePath.dirname(configPath));
|
|
@@ -458,6 +508,75 @@ export class CodexRuntimeAdapter {
|
|
|
458
508
|
this.fs.writeFile(configPath, trusted);
|
|
459
509
|
}
|
|
460
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* OpenRig's activity hooks in an existing hooks.json: one marked group per event (statusMessage "OpenRig activity"),
|
|
513
|
+
* replaced where it already is or appended after the user's groups, so their positions (and the trust Codex keys by
|
|
514
|
+
* position) don't move. OpenRig's own inline block from an earlier launch moves out of config.toml; the user's hooks,
|
|
515
|
+
* in either file, stay where they are. Trust is written for exactly our groups, keyed by the hooks.json path. A file
|
|
516
|
+
* OpenRig can't read as hooks is left untouched, with a warning.
|
|
517
|
+
*/
|
|
518
|
+
ensureCodexJsonActivityHooks(existing, configPath, hooksPath, relay) {
|
|
519
|
+
const original = this.fs.readFile(hooksPath);
|
|
520
|
+
let document;
|
|
521
|
+
try {
|
|
522
|
+
document = parseCodexHooksJson(original);
|
|
523
|
+
}
|
|
524
|
+
catch (err) {
|
|
525
|
+
console.error(`[openrig] codex activity hooks skipped: ${hooksPath} can't be read as hooks (${err.message}); left untouched`);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
const command = `node "${relay}"`;
|
|
529
|
+
const keySource = canonicalCodexHookSource(hooksPath);
|
|
530
|
+
const stripped = upsertCodexFeaturesHooksEnabled(stripCodexActivityHooks(existing));
|
|
531
|
+
let before = null;
|
|
532
|
+
let expected = null;
|
|
533
|
+
try {
|
|
534
|
+
before = parseToml(existing);
|
|
535
|
+
expected = parseToml(stripped);
|
|
536
|
+
}
|
|
537
|
+
catch (err) {
|
|
538
|
+
console.error(`[openrig] codex activity hooks skipped: ${configPath} can't be read as TOML (${err.message}); left untouched`);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (!expected)
|
|
542
|
+
return;
|
|
543
|
+
const inlineSource = canonicalCodexHookSource(configPath);
|
|
544
|
+
let config = stripped;
|
|
545
|
+
for (const event of OPENRIG_ACTIVITY_HOOK_EVENTS) {
|
|
546
|
+
const groups = document.hooks[event] ?? [];
|
|
547
|
+
const found = groups.findIndex(isOpenRigActivityGroup);
|
|
548
|
+
const groupIndex = found < 0 ? groups.length : found;
|
|
549
|
+
groups[groupIndex] = openRigActivityGroup(command);
|
|
550
|
+
document.hooks[event] = groups;
|
|
551
|
+
const { key, hash } = computeCodexHookTrust(event, { keySource, command, timeoutSec: 5, groupIndex, statusMessage: OPENRIG_ACTIVITY_STATUS });
|
|
552
|
+
config = upsertCodexHookTrust(config, key, hash);
|
|
553
|
+
// A person's disable of OpenRig's inline hook moves with it; an existing choice at the new key is kept as it is.
|
|
554
|
+
const inlineIndex = openRigInlineGroupIndex(before, event);
|
|
555
|
+
const disabled = inlineIndex >= 0
|
|
556
|
+
&& codexHookStateOf(before)[`${inlineSource}:${CODEX_HOOK_EVENT_KEY_LABEL[event]}:${inlineIndex}:0`]?.enabled === false;
|
|
557
|
+
if (disabled)
|
|
558
|
+
config = upsertCodexHookDisabled(config, key);
|
|
559
|
+
const state = ((expected.hooks ??= {}).state ??= {});
|
|
560
|
+
state[key] = { ...state[key], trusted_hash: hash, ...(disabled ? { enabled: false } : {}) };
|
|
561
|
+
}
|
|
562
|
+
// The line writers must give exactly the planned fields in valid TOML (they don't read every TOML spelling);
|
|
563
|
+
// otherwise neither file changes, and OpenRig's old inline block, if any, stays working.
|
|
564
|
+
try {
|
|
565
|
+
if (!isDeepStrictEqual(parseToml(config), expected))
|
|
566
|
+
throw new Error("its trust records couldn't be written exactly");
|
|
567
|
+
}
|
|
568
|
+
catch (err) {
|
|
569
|
+
console.error(`[openrig] codex activity hooks skipped: ${configPath}: ${err.message}; left untouched`);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const json = `${JSON.stringify(document, null, 2)}\n`;
|
|
573
|
+
if (json !== original)
|
|
574
|
+
this.fs.writeFile(hooksPath, json);
|
|
575
|
+
if (config !== existing) {
|
|
576
|
+
this.fs.mkdirp(nodePath.dirname(configPath));
|
|
577
|
+
this.fs.writeFile(configPath, config);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
461
580
|
/**
|
|
462
581
|
* OPR.0.4.3.33 — compute + splice Codex's `[hooks.state."<key>"] trusted_hash` for our 4
|
|
463
582
|
* authored activity hooks into `content`. `key_source` is the canonicalized config path
|
|
@@ -478,9 +597,15 @@ export class CodexRuntimeAdapter {
|
|
|
478
597
|
// absolute path is the honest best guess; a canonicalization delta is fail-safe (gate reappears).
|
|
479
598
|
}
|
|
480
599
|
const command = `node "${relay}"`;
|
|
600
|
+
// upsertCodexActivityHooks has just written our marked block. Codex keys by the
|
|
601
|
+
// group's position among this event's groups, not its position inside our block.
|
|
602
|
+
// Count only the groups before the marker: a person's groups after it do not
|
|
603
|
+
// move ours, and their trust/disable records must not be written as ours.
|
|
604
|
+
const prefix = parseToml(content.slice(0, content.indexOf(OPENRIG_ACTIVITY_HOOKS_BEGIN)));
|
|
481
605
|
let next = content;
|
|
482
606
|
for (const event of OPENRIG_ACTIVITY_HOOK_EVENTS) {
|
|
483
|
-
const
|
|
607
|
+
const groupIndex = prefix.hooks?.[event]?.length ?? 0;
|
|
608
|
+
const { key, hash } = computeCodexHookTrust(event, { keySource, command, timeoutSec: 5, groupIndex });
|
|
484
609
|
next = upsertCodexHookTrust(next, key, hash);
|
|
485
610
|
}
|
|
486
611
|
return next;
|
|
@@ -492,13 +617,50 @@ export class CodexRuntimeAdapter {
|
|
|
492
617
|
* Removes ONLY the managed block — preserves any user-owned hooks and leaves [features].hooks
|
|
493
618
|
* (the Codex 0.139 default) intact. Idempotent; no-op when the config or the block is absent.
|
|
494
619
|
*/
|
|
495
|
-
removeCodexActivityHooks() {
|
|
496
|
-
const configPath = this.resolveCodexConfigPath();
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
620
|
+
removeCodexActivityHooks(home) {
|
|
621
|
+
const configPath = this.resolveCodexConfigPath(home);
|
|
622
|
+
const hooksPath = nodePath.join(nodePath.dirname(configPath), "hooks.json");
|
|
623
|
+
const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : null;
|
|
624
|
+
let updated = existing === null ? null : stripCodexActivityHooks(existing);
|
|
625
|
+
if (this.fs.exists(hooksPath)) {
|
|
626
|
+
// Only OpenRig's groups leave. Codex keys trust and disables by position, so each later group's state moves with it.
|
|
627
|
+
try {
|
|
628
|
+
const original = this.fs.readFile(hooksPath);
|
|
629
|
+
const document = parseCodexHooksJson(original);
|
|
630
|
+
const keySource = canonicalCodexHookSource(hooksPath);
|
|
631
|
+
let config = updated ?? "";
|
|
632
|
+
const expected = parseToml(config);
|
|
633
|
+
for (const event of OPENRIG_ACTIVITY_HOOK_EVENTS) {
|
|
634
|
+
const groups = document.hooks[event];
|
|
635
|
+
if (!groups)
|
|
636
|
+
continue;
|
|
637
|
+
const kept = groups.flatMap((group, index) => isOpenRigActivityGroup(group) ? [] : [index]);
|
|
638
|
+
if (kept.length === groups.length)
|
|
639
|
+
continue;
|
|
640
|
+
const prefix = `${keySource}:${CODEX_HOOK_EVENT_KEY_LABEL[event]}:`;
|
|
641
|
+
const newIndexOf = (index) => { const at = kept.indexOf(index); return at < 0 ? null : at; };
|
|
642
|
+
config = rekeyCodexHookStateText(config, prefix, newIndexOf);
|
|
643
|
+
if (expected.hooks?.state)
|
|
644
|
+
expected.hooks.state = rekeyCodexHookState(expected.hooks.state, prefix, newIndexOf);
|
|
645
|
+
if (kept.length > 0)
|
|
646
|
+
document.hooks[event] = kept.map((index) => groups[index]);
|
|
647
|
+
else
|
|
648
|
+
delete document.hooks[event];
|
|
649
|
+
}
|
|
650
|
+
if (!isDeepStrictEqual(withoutEmptyHookTables(parseToml(config)), withoutEmptyHookTables(expected))) {
|
|
651
|
+
throw new Error("its hooks' trust records couldn't be moved exactly");
|
|
652
|
+
}
|
|
653
|
+
const json = `${JSON.stringify(document, null, 2)}\n`;
|
|
654
|
+
if (json !== original)
|
|
655
|
+
this.fs.writeFile(hooksPath, json);
|
|
656
|
+
if (updated !== null)
|
|
657
|
+
updated = config;
|
|
658
|
+
}
|
|
659
|
+
catch (err) {
|
|
660
|
+
console.error(`[openrig] codex activity hook removal skipped for ${hooksPath}: ${err.message}; left untouched`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (existing !== null && updated !== null && updated !== existing) {
|
|
502
664
|
this.fs.writeFile(configPath, updated);
|
|
503
665
|
}
|
|
504
666
|
}
|
|
@@ -523,7 +685,7 @@ export class CodexRuntimeAdapter {
|
|
|
523
685
|
continue;
|
|
524
686
|
}
|
|
525
687
|
try {
|
|
526
|
-
const didProject = this.projectEntry(entry, binding.cwd, warnings, binding.seatSkillsRoot, binding.seatSkillsRefused);
|
|
688
|
+
const didProject = this.projectEntry(entry, binding.cwd, warnings, binding.seatSkillsRoot, binding.seatSkillsRefused, this.homeFor(binding));
|
|
527
689
|
if (didProject) {
|
|
528
690
|
projected.push(entry.effectiveId);
|
|
529
691
|
}
|
|
@@ -609,7 +771,7 @@ export class CodexRuntimeAdapter {
|
|
|
609
771
|
const prepared = await this.prepareLaunch(binding, opts.name, undefined, { installCorePlugin: !opts.resumeToken });
|
|
610
772
|
if (!prepared.ok)
|
|
611
773
|
return prepared;
|
|
612
|
-
const { modelArg, effortArg, appliedLaunch, postureArg, queueStateDirArg, daemonArg, networkArg
|
|
774
|
+
const { modelArg, effortArg, appliedLaunch, postureArg, queueStateDirArg, gitDirArg, seatFolderArg, daemonArg, networkArg } = prepared;
|
|
613
775
|
// Fork branch: `codex fork <parent_thread_id>`. Captures the NEW thread id
|
|
614
776
|
// post-fork. Parent thread id is NOT persisted onto the new seat record
|
|
615
777
|
// (identity-honesty bedrock).
|
|
@@ -628,7 +790,9 @@ export class CodexRuntimeAdapter {
|
|
|
628
790
|
// -s danger-full-access on every seat; otherwise the named profile, or OpenRig's explicit
|
|
629
791
|
// -s workspace-write floor flag.
|
|
630
792
|
// 0.5.2-07 A2-3: the FORK path threads the SPEC model too (fork-instantiate reverted it before).
|
|
631
|
-
|
|
793
|
+
// The git dirs and the seat folder follow the parent id: ps flattens argv, so a path with a space placed before the
|
|
794
|
+
// id would be read as the id when the fork is verified.
|
|
795
|
+
const cmd = `codex${daemonArg}${postureArg}${networkArg}${modelArg}${effortArg} fork${queueStateDirArg} ${shellQuote(parentId)}${gitDirArg}${seatFolderArg}`;
|
|
632
796
|
const textResult = await this.tmux.sendShellCommand(binding.tmuxSession, await this.seatCommand(binding, cmd));
|
|
633
797
|
if (!textResult.ok) {
|
|
634
798
|
return { ok: false, error: `Failed to send launch command: ${textResult.message}` };
|
|
@@ -662,15 +826,11 @@ export class CodexRuntimeAdapter {
|
|
|
662
826
|
// OPR.0.4.8.2: one posture decision (codexPostureArg) for the fresh launch too — YOLO forces
|
|
663
827
|
// -s danger-full-access (overrides even a named profile); otherwise the named profile, or
|
|
664
828
|
// OpenRig's explicit -s workspace-write floor flag.
|
|
665
|
-
// Issue #121: only the fresh launch adds git metadata dirs; resume and fork never did.
|
|
666
|
-
const gitDirArg = opts.resumeToken || binding.codexRebuildPermissions
|
|
667
|
-
? ""
|
|
668
|
-
: suppressAutoAddDirs ? "" : (await this.resolveGitAddDirs(binding.cwd)).map((dir) => ` --add-dir ${shellQuote(dir)}`).join("");
|
|
669
829
|
const cmd = opts.resumeToken
|
|
670
830
|
// 0.5.2-07 A2-3: the pod-aware RESUME path threads the SPEC model too (reverted before — the
|
|
671
831
|
// grounding map assumed codex parity with the claude adapter, but only fresh emitted -m).
|
|
672
832
|
? this.resumeCore(prepared, opts.resumeToken, binding)
|
|
673
|
-
: `codex${daemonArg}${postureArg}${networkArg} -C ${shellQuote(binding.cwd)}${gitDirArg}${queueStateDirArg}${modelArg}${effortArg}`;
|
|
833
|
+
: `codex${daemonArg}${postureArg}${networkArg} -C ${shellQuote(binding.cwd)}${gitDirArg}${seatFolderArg}${queueStateDirArg}${modelArg}${effortArg}`;
|
|
674
834
|
const textResult = await this.tmux.sendShellCommand(binding.tmuxSession, await this.seatCommand(binding, cmd));
|
|
675
835
|
if (!textResult.ok) {
|
|
676
836
|
return { ok: false, error: `Failed to send launch command: ${textResult.message}` };
|
|
@@ -679,7 +839,7 @@ export class CodexRuntimeAdapter {
|
|
|
679
839
|
if (updatePrompt.failure)
|
|
680
840
|
return updatePrompt.failure;
|
|
681
841
|
if (opts.resumeToken) {
|
|
682
|
-
const verification = await this.verifyResumeLaunch(binding.tmuxSession, updatePrompt, { resumeToken: opts.resumeToken });
|
|
842
|
+
const verification = await this.verifyResumeLaunch(binding.tmuxSession, updatePrompt, { resumeToken: opts.resumeToken, ...this.ownHomeOpt(binding) });
|
|
683
843
|
if (!verification.ok)
|
|
684
844
|
return verification;
|
|
685
845
|
return { ok: true, resumeToken: opts.resumeToken, resumeType: "codex_id", appliedLaunch,
|
|
@@ -707,31 +867,36 @@ export class CodexRuntimeAdapter {
|
|
|
707
867
|
}
|
|
708
868
|
/** Type a command buildResumeCommand built into the pane's shell, then verify the resume as launchHarness
|
|
709
869
|
* does. Nothing is prepared again, so the command runs exactly as it was built and checked. */
|
|
710
|
-
async sendResumeCommand(tmuxSession, command, resumeToken) {
|
|
870
|
+
async sendResumeCommand(tmuxSession, command, resumeToken, nodeId, home) {
|
|
711
871
|
const textResult = await this.tmux.sendShellCommand(tmuxSession, command);
|
|
712
872
|
if (!textResult.ok)
|
|
713
873
|
return { ok: false, error: `Failed to send launch command: ${textResult.message}` };
|
|
714
|
-
return this.verifyResumeInPane(tmuxSession, resumeToken);
|
|
874
|
+
return this.verifyResumeInPane(tmuxSession, resumeToken, nodeId, home);
|
|
715
875
|
}
|
|
716
876
|
/** launchHarness's resume verification for a resume the caller started itself: dismiss a skippable update
|
|
717
|
-
* prompt, then require a proven resumed conversation (never process-alive alone).
|
|
718
|
-
|
|
877
|
+
* prompt, then require a proven resumed conversation (never process-alive alone). The proof reads `home` when the
|
|
878
|
+
* caller read it from the running Codex, else the seat's own CODEX_HOME when `nodeId` names a seat that declares one,
|
|
879
|
+
* where its resumed Codex logs. */
|
|
880
|
+
async verifyResumeInPane(tmuxSession, resumeToken, nodeId, home) {
|
|
719
881
|
const updatePrompt = { handled: false };
|
|
720
882
|
await this.dismissSkippableCodexUpdatePrompt(tmuxSession, updatePrompt);
|
|
721
883
|
if (updatePrompt.failure)
|
|
722
884
|
return updatePrompt.failure;
|
|
723
|
-
return this.verifyResumeLaunch(tmuxSession, updatePrompt, { resumeToken });
|
|
885
|
+
return this.verifyResumeLaunch(tmuxSession, updatePrompt, { resumeToken, ...(home ? { home } : this.ownHomeOpt({ nodeId })) });
|
|
724
886
|
}
|
|
725
887
|
/** Launch flags shared by fresh, fork and resume, decided once per launch. With `running`, the probed and
|
|
726
888
|
* prepared parts come from the running Codex instead, and no Codex process is started to decide them. */
|
|
727
889
|
async prepareLaunch(binding, name, running, opts) {
|
|
728
890
|
// The config write and, for a seat that selected openrig-core, its install run as one step under the config lock, so
|
|
729
891
|
// concurrent launches never interleave them. An unselected seat's launch never installs.
|
|
892
|
+
// A seat with its own CODEX_HOME gets OpenRig's managed config (hooks, feature flag) and plugin in that home.
|
|
893
|
+
const home = this.homeFor(binding);
|
|
894
|
+
const own = this.ownHome(binding);
|
|
730
895
|
await this.withConfigLock(async () => {
|
|
731
|
-
const managed = await this.applyManagedConfig();
|
|
896
|
+
const managed = await this.applyManagedConfig(home);
|
|
732
897
|
if (opts.installCorePlugin && managed?.hooksEnabled && this.resolveCorePluginSelected?.(binding.nodeId)) {
|
|
733
898
|
try {
|
|
734
|
-
await this.ensureCodexCorePlugin();
|
|
899
|
+
await this.ensureCodexCorePlugin(home);
|
|
735
900
|
}
|
|
736
901
|
catch (err) {
|
|
737
902
|
console.error(`[openrig] runtime setup warning: ${err.message}`);
|
|
@@ -754,9 +919,12 @@ export class CodexRuntimeAdapter {
|
|
|
754
919
|
const postureArg = posture + operationalLaunchArg(this.runtime, binding);
|
|
755
920
|
if (running) {
|
|
756
921
|
// The running Codex already loaded its profile; drift in -p is the caller's to compare.
|
|
922
|
+
// Its own --add-dirs, git dirs included, carry over as they ran; none are resolved again. They follow the
|
|
923
|
+
// conversation id, as on every resume, so the resume proof reads the id even when a dir has a space.
|
|
757
924
|
return { ok: true, model, modelArg, effort, effortArg, profile, appliedLaunch, postureArg,
|
|
758
|
-
queueStateDirArg:
|
|
759
|
-
|
|
925
|
+
queueStateDirArg: "",
|
|
926
|
+
gitDirArg: running.addDirs.map((dir) => ` --add-dir ${shellQuote(dir)}`).join(""),
|
|
927
|
+
seatFolderArg: "",
|
|
760
928
|
daemonOptOut: running.daemonOptOut, daemonArg: running.daemonOptOut ? " --no-daemon" : "",
|
|
761
929
|
networkArg: running.networkOverride ? ` -c ${shellQuote(CODEX_NETWORK_DEFAULT_OVERRIDE)}` : "" };
|
|
762
930
|
}
|
|
@@ -765,7 +933,7 @@ export class CodexRuntimeAdapter {
|
|
|
765
933
|
// `codex -p <profile> resume` failure. An absent .config.toml passes
|
|
766
934
|
// (Codex default-layers it; advisor Option B).
|
|
767
935
|
if (profile) {
|
|
768
|
-
const probeResult = await this.verifyProfilePreflight(profile, binding.cwd);
|
|
936
|
+
const probeResult = await (own ? this.verifyProfilePreflight(profile, binding.cwd, own) : this.verifyProfilePreflight(profile, binding.cwd));
|
|
769
937
|
if (!probeResult.ok) {
|
|
770
938
|
return {
|
|
771
939
|
ok: false,
|
|
@@ -776,7 +944,14 @@ export class CodexRuntimeAdapter {
|
|
|
776
944
|
// Codex rejects writable --add-dir roots under a read-only sandbox. Only
|
|
777
945
|
// suppress OpenRig's generated roots when later project layers cannot make it writable.
|
|
778
946
|
const suppressAutoAddDirs = Boolean(!binding.codexRebuildPermissions && profile
|
|
779
|
-
&& posture === profileArg && this.profileRemainsReadOnly(profile, binding.cwd));
|
|
947
|
+
&& posture === profileArg && this.profileRemainsReadOnly(profile, binding.cwd, home));
|
|
948
|
+
// Issue #121: fresh, resume and fork get the same git metadata dirs, so a restored or forked seat can still commit.
|
|
949
|
+
// A rebuild keeps the writable roots its observed envelope names instead.
|
|
950
|
+
const gitDirArg = binding.codexRebuildPermissions || suppressAutoAddDirs
|
|
951
|
+
? "" : (await this.resolveGitAddDirs(binding.cwd)).map((dir) => ` --add-dir ${shellQuote(dir)}`).join("");
|
|
952
|
+
// The seat's own topology folder, so it can keep its LEARNED.md and recap: the same launches and the same suppression.
|
|
953
|
+
const seatFolder = binding.codexRebuildPermissions || suppressAutoAddDirs ? undefined : this.prepareSeatFolder?.(name);
|
|
954
|
+
const seatFolderArg = seatFolder ? ` --add-dir ${shellQuote(seatFolder)}` : "";
|
|
780
955
|
const teamWorkspaceArg = !binding.codexRebuildPermissions && binding.teamPermissionDefault && !profile
|
|
781
956
|
&& appliedLaunch.state === "observed" && appliedLaunch.value === "workspace-write"
|
|
782
957
|
? codexTeamWorkspaceArg(this.prepareTeamWorkspace, name) : "";
|
|
@@ -784,7 +959,7 @@ export class CodexRuntimeAdapter {
|
|
|
784
959
|
? "" : teamWorkspaceArg || this.buildQueueStateAddDirArg(name);
|
|
785
960
|
// #69: one daemon-support decision for this launch, for the Codex the seat pane runs
|
|
786
961
|
// (its cwd, the launch PATH), applied to fresh, fork and resume.
|
|
787
|
-
const daemonSupport = this.detectDaemonSupport ? await this.detectDaemonSupport(binding.cwd) : undefined;
|
|
962
|
+
const daemonSupport = this.detectDaemonSupport ? await (own ? this.detectDaemonSupport(binding.cwd, own) : this.detectDaemonSupport(binding.cwd)) : undefined;
|
|
788
963
|
if (daemonSupport?.kind === "unknown") {
|
|
789
964
|
return { ok: false, error: unknownDaemonSupportMessage(daemonSupport.detail) };
|
|
790
965
|
}
|
|
@@ -792,19 +967,22 @@ export class CodexRuntimeAdapter {
|
|
|
792
967
|
const daemonArg = daemonOptOut ? " --no-daemon" : "";
|
|
793
968
|
// #275: on the plain floor, network access unless Codex reports an opt-out or policy.
|
|
794
969
|
const networkArg = binding.codexRebuildPermissions ? ""
|
|
795
|
-
: await codexNetworkDefaultArg(this.readNetworkDefault, appliedLaunch, binding.cwd, name);
|
|
970
|
+
: await codexNetworkDefaultArg(own && this.readNetworkDefault ? ((cwd) => this.readNetworkDefault(cwd, own)) : this.readNetworkDefault, appliedLaunch, binding.cwd, name);
|
|
796
971
|
// The launch facts keep the probed daemon choice, so a printed recovery command can repeat it; no probe, no fact.
|
|
797
972
|
const launchFacts = daemonSupport ? { ...appliedLaunch, daemonOptOut } : appliedLaunch;
|
|
798
|
-
return { ok: true, model, modelArg, effort, effortArg, profile, appliedLaunch: launchFacts, postureArg, queueStateDirArg,
|
|
973
|
+
return { ok: true, model, modelArg, effort, effortArg, profile, appliedLaunch: launchFacts, postureArg, queueStateDirArg, gitDirArg, seatFolderArg, daemonOptOut, daemonArg, networkArg };
|
|
799
974
|
}
|
|
800
975
|
resumeCore(prepared, resumeToken, binding) {
|
|
801
|
-
const { profile, queueStateDirArg, model, postureArg, networkArg, daemonOptOut, effort } = prepared;
|
|
802
|
-
|
|
976
|
+
const { profile, queueStateDirArg, gitDirArg, seatFolderArg, model, postureArg, networkArg, daemonOptOut, effort } = prepared;
|
|
977
|
+
// The git dirs and the seat folder follow the conversation id, as on a fork, so the resume proof reads the id even
|
|
978
|
+
// from a path with a space.
|
|
979
|
+
return buildCodexResumeCore(resumeToken, profile, false, queueStateDirArg.trim() || undefined, binding.launchPosture, model, `${postureArg}${networkArg}`, daemonOptOut, effort)
|
|
980
|
+
+ gitDirArg + seatFolderArg;
|
|
803
981
|
}
|
|
804
982
|
async seatCommand(binding, cmd) {
|
|
805
983
|
return this.seatLaunchEnvironment
|
|
806
|
-
? await this.seatLaunchEnvironment.command(binding.tmuxSession, cmd, { codexCwd: binding.cwd, nodeId: binding.nodeId, generation: binding.launchGeneration, runtime: this.runtime })
|
|
807
|
-
: this.launchCommand(cmd);
|
|
984
|
+
? await this.seatLaunchEnvironment.command(binding.tmuxSession, cmd, { codexCwd: binding.cwd, nodeId: binding.nodeId, generation: binding.launchGeneration, runtime: this.runtime, ...this.ownHomeCommandOpt(binding) })
|
|
985
|
+
: this.launchCommand(cmd, this.homeFor(binding));
|
|
808
986
|
}
|
|
809
987
|
buildQueueStateAddDirArg(sessionName) {
|
|
810
988
|
const sharedDocsRoot = process.env.OPENRIG_SHARED_DOCS_ROOT?.trim()
|
|
@@ -816,8 +994,8 @@ export class CodexRuntimeAdapter {
|
|
|
816
994
|
* Return true only when visible config proves a read-only profile within Codex's default project root.
|
|
817
995
|
* Unknown markers or unreadable layers retain the generated roots for native launch handling.
|
|
818
996
|
*/
|
|
819
|
-
profileRemainsReadOnly(profile, cwd) {
|
|
820
|
-
const root =
|
|
997
|
+
profileRemainsReadOnly(profile, cwd, home = this.codexHome) {
|
|
998
|
+
const root = home ?? nodePath.join(this.fs.homedir ?? os.homedir(), ".codex");
|
|
821
999
|
const path = nodePath.join(root, `${profile}.config.toml`);
|
|
822
1000
|
const userPath = nodePath.join(root, "config.toml");
|
|
823
1001
|
if (!this.fs.exists(path))
|
|
@@ -904,11 +1082,21 @@ export class CodexRuntimeAdapter {
|
|
|
904
1082
|
}
|
|
905
1083
|
const paneCommand = await this.tmux.getPaneCommand(binding.tmuxSession);
|
|
906
1084
|
const paneContent = await this.captureProbeScreen(binding.tmuxSession);
|
|
907
|
-
|
|
1085
|
+
let probe = assessNativeResumeProbe({
|
|
908
1086
|
runtime: "codex",
|
|
909
1087
|
paneCommand,
|
|
910
1088
|
paneContent,
|
|
911
1089
|
});
|
|
1090
|
+
if (probe.code === "returned_to_shell" || probe.code === "awaiting_runtime") {
|
|
1091
|
+
const process = await verifyCodexPaneProcess({ target: binding.tmuxSession, tmux: this.tmux,
|
|
1092
|
+
listProcesses: this.listProcesses });
|
|
1093
|
+
if (process) {
|
|
1094
|
+
const currentPaneCommand = await this.tmux.getPaneCommand(binding.tmuxSession);
|
|
1095
|
+
const currentPaneContent = await this.captureProbeScreen(binding.tmuxSession);
|
|
1096
|
+
probe = assessNativeResumeProbe({ runtime: "codex", paneCommand: currentPaneCommand,
|
|
1097
|
+
paneContent: currentPaneContent, codexProcessVerified: true });
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
912
1100
|
if (probe.code === "returned_to_shell") {
|
|
913
1101
|
const isIdleShell = await verifyPaneIdleShell({
|
|
914
1102
|
target: binding.tmuxSession,
|
|
@@ -937,7 +1125,7 @@ export class CodexRuntimeAdapter {
|
|
|
937
1125
|
return null;
|
|
938
1126
|
// Gate PID logs by process start time, then re-observe the whole foreground
|
|
939
1127
|
// chain. Neither a reused PID nor a replacement pane proves this child.
|
|
940
|
-
const child = (await this.
|
|
1128
|
+
const child = (await this.readThreadIdForSeat(binding, before.process.pid, before.process.startedAt))?.trim();
|
|
941
1129
|
if (!child || child === parentToken)
|
|
942
1130
|
return null;
|
|
943
1131
|
const after = await observeCodexForkProcess(input);
|
|
@@ -1011,10 +1199,10 @@ export class CodexRuntimeAdapter {
|
|
|
1011
1199
|
return observation ? JSON.stringify([paneCommand, observation.fingerprint]) : null;
|
|
1012
1200
|
}
|
|
1013
1201
|
ensureManagedBootstrap(binding) {
|
|
1014
|
-
this.provisionWorkspaceTrust(binding.cwd ?? null);
|
|
1202
|
+
this.provisionWorkspaceTrust(binding.cwd ?? null, this.homeFor(binding));
|
|
1015
1203
|
}
|
|
1016
|
-
projectEntry(entry, cwd, warnings, seatSkillsRoot, seatSkillsRefused) {
|
|
1017
|
-
if (entry.category === "runtime_resource" && this.applyRuntimeResource(entry)) {
|
|
1204
|
+
projectEntry(entry, cwd, warnings, seatSkillsRoot, seatSkillsRefused, home) {
|
|
1205
|
+
if (entry.category === "runtime_resource" && this.applyRuntimeResource(entry, home)) {
|
|
1018
1206
|
return true;
|
|
1019
1207
|
}
|
|
1020
1208
|
if (entry.category === "guidance" && entry.mergeStrategy === "managed_block") {
|
|
@@ -1157,11 +1345,11 @@ export class CodexRuntimeAdapter {
|
|
|
1157
1345
|
default: return null;
|
|
1158
1346
|
}
|
|
1159
1347
|
}
|
|
1160
|
-
applyRuntimeResource(entry) {
|
|
1348
|
+
applyRuntimeResource(entry, home) {
|
|
1161
1349
|
if (entry.resourceType !== "codex_config_fragment") {
|
|
1162
1350
|
return false;
|
|
1163
1351
|
}
|
|
1164
|
-
const configPath = this.resolveCodexConfigPath();
|
|
1352
|
+
const configPath = this.resolveCodexConfigPath(home);
|
|
1165
1353
|
this.fs.mkdirp(nodePath.dirname(configPath));
|
|
1166
1354
|
const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : "";
|
|
1167
1355
|
const fragment = this.fs.readFile(entry.absolutePath);
|
|
@@ -1204,10 +1392,10 @@ export class CodexRuntimeAdapter {
|
|
|
1204
1392
|
detectDeliveryHint(path, content, orientation) {
|
|
1205
1393
|
return resolveConcreteHint(path, content, orientation);
|
|
1206
1394
|
}
|
|
1207
|
-
provisionWorkspaceTrust(cwd) {
|
|
1395
|
+
provisionWorkspaceTrust(cwd, home) {
|
|
1208
1396
|
if (!cwd)
|
|
1209
1397
|
return;
|
|
1210
|
-
const configPath = this.resolveCodexConfigPath();
|
|
1398
|
+
const configPath = this.resolveCodexConfigPath(home);
|
|
1211
1399
|
this.fs.mkdirp(nodePath.dirname(configPath));
|
|
1212
1400
|
let content = "";
|
|
1213
1401
|
try {
|
|
@@ -1222,8 +1410,8 @@ export class CodexRuntimeAdapter {
|
|
|
1222
1410
|
}
|
|
1223
1411
|
this.fs.writeFile(configPath, content);
|
|
1224
1412
|
}
|
|
1225
|
-
resolveCodexConfigPath() {
|
|
1226
|
-
const root =
|
|
1413
|
+
resolveCodexConfigPath(home = this.codexHome) {
|
|
1414
|
+
const root = home
|
|
1227
1415
|
?? nodePath.join(this.fs.homedir ?? os.homedir(), ".codex");
|
|
1228
1416
|
return nodePath.join(root, "config.toml");
|
|
1229
1417
|
}
|
|
@@ -1265,7 +1453,7 @@ export class CodexRuntimeAdapter {
|
|
|
1265
1453
|
if (shellPid) {
|
|
1266
1454
|
const codexPids = await this.findCodexDescendantPids(shellPid);
|
|
1267
1455
|
for (const codexPid of codexPids) {
|
|
1268
|
-
const threadId = await this.
|
|
1456
|
+
const threadId = await this.readThreadIdForSeat(binding, codexPid);
|
|
1269
1457
|
if (threadId)
|
|
1270
1458
|
return threadId;
|
|
1271
1459
|
}
|
|
@@ -1330,7 +1518,7 @@ export class CodexRuntimeAdapter {
|
|
|
1330
1518
|
const value = await this.withinDeadline(Promise.resolve().then(work), deadline);
|
|
1331
1519
|
return Date.now() >= deadline ? null : value;
|
|
1332
1520
|
}
|
|
1333
|
-
async proveResumedProcess(tmuxSession, resumeToken, deadline) {
|
|
1521
|
+
async proveResumedProcess(tmuxSession, resumeToken, deadline, home) {
|
|
1334
1522
|
if (!this.tmux.getPanePid)
|
|
1335
1523
|
return { kind: "unknown", reason: "the pane's process can't be read" };
|
|
1336
1524
|
if (Date.now() >= deadline)
|
|
@@ -1347,7 +1535,7 @@ export class CodexRuntimeAdapter {
|
|
|
1347
1535
|
}
|
|
1348
1536
|
let evidence;
|
|
1349
1537
|
try {
|
|
1350
|
-
evidence = await this.beforeResumeDeadline(() => this.readResumeEvidence(before.process.pid, before.process.startedAt), deadline);
|
|
1538
|
+
evidence = await this.beforeResumeDeadline(() => home ? this.readResumeEvidence(before.process.pid, before.process.startedAt, home) : this.readResumeEvidence(before.process.pid, before.process.startedAt), deadline);
|
|
1351
1539
|
}
|
|
1352
1540
|
catch (err) {
|
|
1353
1541
|
return { kind: "unknown", reason: `Codex's records couldn't be read (${err.message})` };
|
|
@@ -1447,6 +1635,27 @@ export class CodexRuntimeAdapter {
|
|
|
1447
1635
|
paneCommand,
|
|
1448
1636
|
paneContent,
|
|
1449
1637
|
});
|
|
1638
|
+
if (probe.code === "returned_to_shell" || probe.code === "awaiting_runtime") {
|
|
1639
|
+
const process = resumeToken
|
|
1640
|
+
? await this.beforeResumeDeadline(() => verifyCodexPaneProcess({ target: tmuxSession, tmux: this.tmux,
|
|
1641
|
+
listProcesses: this.listProcesses }), deadline)
|
|
1642
|
+
: await verifyCodexPaneProcess({ target: tmuxSession, tmux: this.tmux,
|
|
1643
|
+
listProcesses: this.listProcesses });
|
|
1644
|
+
if (process) {
|
|
1645
|
+
const current = resumeToken
|
|
1646
|
+
? await this.beforeResumeDeadline(async () => ({
|
|
1647
|
+
command: await this.tmux.getPaneCommand(tmuxSession),
|
|
1648
|
+
content: await this.captureProbeScreen(tmuxSession),
|
|
1649
|
+
}), deadline)
|
|
1650
|
+
: { command: await this.tmux.getPaneCommand(tmuxSession), content: await this.captureProbeScreen(tmuxSession) };
|
|
1651
|
+
if (!current)
|
|
1652
|
+
break;
|
|
1653
|
+
paneCommand = current.command;
|
|
1654
|
+
paneContent = current.content;
|
|
1655
|
+
lastPaneContent = paneContent;
|
|
1656
|
+
probe = assessNativeResumeProbe({ runtime: "codex", paneCommand, paneContent, codexProcessVerified: true });
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1450
1659
|
if (probe.code === "no_saved_session") {
|
|
1451
1660
|
return {
|
|
1452
1661
|
ok: false,
|
|
@@ -1480,15 +1689,17 @@ export class CodexRuntimeAdapter {
|
|
|
1480
1689
|
return { ok: true, resumeToken: undefined, resumeType: undefined };
|
|
1481
1690
|
}
|
|
1482
1691
|
if (probe.status === "resumed" && resumeToken) {
|
|
1483
|
-
const proof = await this.proveResumedProcess(tmuxSession, resumeToken, deadline);
|
|
1692
|
+
const proof = await this.proveResumedProcess(tmuxSession, resumeToken, deadline, opts?.home);
|
|
1484
1693
|
if (proof.kind === "match")
|
|
1485
1694
|
return { ok: true, resumeToken, resumeType: "codex_id", resumedProcess: proof.process };
|
|
1486
1695
|
if (proof.kind === "mismatch") {
|
|
1696
|
+
const detail = `Codex resume opened a different conversation: the resumed process's records name ${proof.threadId}, not the requested ${resumeToken}.`;
|
|
1487
1697
|
return {
|
|
1488
1698
|
ok: false,
|
|
1489
|
-
error:
|
|
1699
|
+
error: `${detail} The session was preserved; nothing was restarted.`,
|
|
1490
1700
|
recovery: "attention_required",
|
|
1491
1701
|
resumeMismatch: { opened: proof.threadId },
|
|
1702
|
+
resumeDetail: detail,
|
|
1492
1703
|
verifierInput: verifierInput(),
|
|
1493
1704
|
evidence: paneContent.split("\n").slice(-12).join("\n"),
|
|
1494
1705
|
};
|
|
@@ -1540,9 +1751,10 @@ export class CodexRuntimeAdapter {
|
|
|
1540
1751
|
// Report the newest screen observed; a resumed or booting one names no gate. The loop's own decisions above used
|
|
1541
1752
|
// lastUnresolved. The text follows the newest screen too, so an older gate's text never stands for a newer screen.
|
|
1542
1753
|
const shown = report && report.probe.status !== "resumed" && report.probe.code !== "awaiting_runtime" ? report : null;
|
|
1543
|
-
const
|
|
1544
|
-
? `Codex resume could not be proven within the resume window: ${unproven}
|
|
1754
|
+
const unprovenDetail = unproven && report?.probe.status === "resumed"
|
|
1755
|
+
? `Codex resume could not be proven within the resume window: ${unproven}.`
|
|
1545
1756
|
: null;
|
|
1757
|
+
const unprovenText = unprovenDetail ? `${unprovenDetail} The session was preserved; nothing was restarted.` : null;
|
|
1546
1758
|
const newestText = unprovenText ? unprovenText : shown ? shown.probe.detail
|
|
1547
1759
|
: report?.probe.status === "resumed" ? "Codex resume could not be confirmed: the last screen observed looked ready, but the resume check ended before proving a restored conversation."
|
|
1548
1760
|
: report ? report.probe.detail
|
|
@@ -1558,6 +1770,7 @@ export class CodexRuntimeAdapter {
|
|
|
1558
1770
|
// With a conversation to prove and no gate on the newest screen, the end is "not proven": whatever the last frame
|
|
1559
1771
|
// was (a boot, a ready screen, or no capture at all before the deadline), the resumed Codex may be running.
|
|
1560
1772
|
...(resumeToken && !shown ? { resumeUnproven: true } : {}),
|
|
1773
|
+
...(unprovenDetail ? { resumeDetail: unprovenDetail } : {}),
|
|
1561
1774
|
verifierInput: verifierInput(),
|
|
1562
1775
|
evidence: (report?.paneContent ?? lastPaneContent).split("\n").slice(-12).join("\n"),
|
|
1563
1776
|
};
|
|
@@ -1566,11 +1779,11 @@ export class CodexRuntimeAdapter {
|
|
|
1566
1779
|
const processes = await this.listProcesses();
|
|
1567
1780
|
return findCodexDescendantPids(processes, parentPid);
|
|
1568
1781
|
}
|
|
1569
|
-
async readThreadIdFromLogs(pid) {
|
|
1570
|
-
return readCodexThreadIdFromCandidateHomes(pid,
|
|
1782
|
+
async readThreadIdFromLogs(pid, home = this.codexHome) {
|
|
1783
|
+
return readCodexThreadIdFromCandidateHomes(pid, home ? [] : [await this.resolveHomeDirByPid(pid), this.fs.homedir, os.homedir()], (path) => this.fs.exists(path), home);
|
|
1571
1784
|
}
|
|
1572
|
-
launchCommand(command) {
|
|
1573
|
-
const env = [this.launchPath ? `PATH=${shellQuote(this.launchPath)}` : "",
|
|
1785
|
+
launchCommand(command, home = this.codexHome) {
|
|
1786
|
+
const env = [this.launchPath ? `PATH=${shellQuote(this.launchPath)}` : "", home ? `CODEX_HOME=${shellQuote(home)}` : ""].filter(Boolean);
|
|
1574
1787
|
return env.length ? `env ${env.join(" ")} ${command}` : command;
|
|
1575
1788
|
}
|
|
1576
1789
|
}
|
|
@@ -1762,6 +1975,8 @@ function upsertCodexHooksFeature(content) {
|
|
|
1762
1975
|
}
|
|
1763
1976
|
// OPR.0.4.1.10 FR-A — config-layer activity-hook projection.
|
|
1764
1977
|
const OPENRIG_ACTIVITY_HOOKS_BEGIN = "# BEGIN OPENRIG MANAGED ACTIVITY HOOKS";
|
|
1978
|
+
/** The status Codex shows while OpenRig's hooks.json activity hook runs; it also marks the group as OpenRig's. */
|
|
1979
|
+
const OPENRIG_ACTIVITY_STATUS = "OpenRig activity";
|
|
1765
1980
|
const OPENRIG_ACTIVITY_HOOKS_END = "# END OPENRIG MANAGED ACTIVITY HOOKS";
|
|
1766
1981
|
const OPENRIG_ACTIVITY_HOOK_EVENTS = ["SessionStart", "UserPromptSubmit", "Stop", "PermissionRequest"];
|
|
1767
1982
|
/**
|
|
@@ -1788,6 +2003,148 @@ function upsertCodexActivityHooks(content, relayPath) {
|
|
|
1788
2003
|
const prefix = next.replace(/\n*$/, "");
|
|
1789
2004
|
return prefix.length > 0 ? `${prefix}\n\n${block}` : block;
|
|
1790
2005
|
}
|
|
2006
|
+
function canonicalCodexHookSource(path) {
|
|
2007
|
+
// Codex keys hook trust by the canonical source path; a file not on the real filesystem keeps its plain path.
|
|
2008
|
+
try {
|
|
2009
|
+
return fs.realpathSync.native(path);
|
|
2010
|
+
}
|
|
2011
|
+
catch {
|
|
2012
|
+
return path;
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
/** A hooks.json document as Codex reads it: `hooks` maps each event to matcher groups, each with a `hooks` list. */
|
|
2016
|
+
function parseCodexHooksJson(content) {
|
|
2017
|
+
const value = JSON.parse(content);
|
|
2018
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
2019
|
+
throw new Error("not a JSON object");
|
|
2020
|
+
const record = value;
|
|
2021
|
+
if (record.hooks === undefined)
|
|
2022
|
+
record.hooks = {};
|
|
2023
|
+
const hooks = record.hooks;
|
|
2024
|
+
if (hooks === null || typeof hooks !== "object" || Array.isArray(hooks)
|
|
2025
|
+
|| Object.values(hooks).some((groups) => !Array.isArray(groups)
|
|
2026
|
+
|| groups.some((group) => group === null || typeof group !== "object" || !Array.isArray(group.hooks)))) {
|
|
2027
|
+
throw new Error("expected hooks to map each event to matcher groups with a hooks list");
|
|
2028
|
+
}
|
|
2029
|
+
return record;
|
|
2030
|
+
}
|
|
2031
|
+
function openRigActivityGroup(command) {
|
|
2032
|
+
return { hooks: [{ type: "command", command, timeout: 5, statusMessage: OPENRIG_ACTIVITY_STATUS }] };
|
|
2033
|
+
}
|
|
2034
|
+
/** Where OpenRig's activity relay ships, in this install or an earlier one (the absolute path moves on upgrade). */
|
|
2035
|
+
const OPENRIG_ACTIVITY_RELAY_SUFFIX = "/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs";
|
|
2036
|
+
/** A hook command that runs OpenRig's own shipped activity relay, not a person's script that shares its name. */
|
|
2037
|
+
function isOpenRigRelayCommand(command) {
|
|
2038
|
+
const relay = typeof command === "string" ? /^node "(.*)"$/.exec(command)?.[1] : undefined;
|
|
2039
|
+
return relay !== undefined && relay.replaceAll("\\", "/").endsWith(OPENRIG_ACTIVITY_RELAY_SUFFIX);
|
|
2040
|
+
}
|
|
2041
|
+
/** OpenRig's own group, exactly as it authors it: no matcher, and one handler with only our fields, our status and
|
|
2042
|
+
* timeout, running OpenRig's shipped relay. Anything else is a person's group and is left alone. */
|
|
2043
|
+
function isOpenRigActivityGroup(group) {
|
|
2044
|
+
if (group === null || typeof group !== "object")
|
|
2045
|
+
return false;
|
|
2046
|
+
const { hooks, ...rest } = group;
|
|
2047
|
+
if (Object.keys(rest).length > 0 || !Array.isArray(hooks) || hooks.length !== 1)
|
|
2048
|
+
return false;
|
|
2049
|
+
const handler = hooks[0];
|
|
2050
|
+
if (handler === null || typeof handler !== "object")
|
|
2051
|
+
return false;
|
|
2052
|
+
const { type, command, timeout, statusMessage, ...extra } = handler;
|
|
2053
|
+
return Object.keys(extra).length === 0 && type === "command" && timeout === 5 && statusMessage === OPENRIG_ACTIVITY_STATUS
|
|
2054
|
+
&& isOpenRigRelayCommand(command);
|
|
2055
|
+
}
|
|
2056
|
+
function codexHookStateOf(document) {
|
|
2057
|
+
return document?.hooks?.state ?? {};
|
|
2058
|
+
}
|
|
2059
|
+
/** A parsed config without an empty `hooks.state`, or then an empty `hooks`: the text drops a table with its last
|
|
2060
|
+
* entry, and an empty table means the same as none. */
|
|
2061
|
+
function withoutEmptyHookTables(document) {
|
|
2062
|
+
const { hooks, ...rest } = document;
|
|
2063
|
+
if (hooks === undefined)
|
|
2064
|
+
return document;
|
|
2065
|
+
const { state, ...otherHooks } = hooks;
|
|
2066
|
+
const kept = state !== undefined && Object.keys(state).length > 0 ? hooks : otherHooks;
|
|
2067
|
+
return Object.keys(kept).length > 0 ? { ...rest, hooks: kept } : rest;
|
|
2068
|
+
}
|
|
2069
|
+
/** The index of OpenRig's inline group for `event` among a parsed config.toml's inline groups, or -1. */
|
|
2070
|
+
function openRigInlineGroupIndex(document, event) {
|
|
2071
|
+
const groups = document?.hooks?.[event];
|
|
2072
|
+
if (!Array.isArray(groups))
|
|
2073
|
+
return -1;
|
|
2074
|
+
return groups.findIndex((group) => {
|
|
2075
|
+
const handlers = group?.hooks;
|
|
2076
|
+
const handler = Array.isArray(handlers) && handlers.length === 1 ? handlers[0] : null;
|
|
2077
|
+
return !!handler && handler.type === "command" && Number(handler.timeout) === 5 && isOpenRigRelayCommand(handler.command);
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
/** Write `enabled = false` into one `[hooks.state."<key>"]` table (the trust write creates it first). */
|
|
2081
|
+
function upsertCodexHookDisabled(content, key) {
|
|
2082
|
+
const header = `[hooks.state.${JSON.stringify(key)}]`;
|
|
2083
|
+
const lines = content.split("\n");
|
|
2084
|
+
const at = lines.findIndex((line) => line.trim() === header);
|
|
2085
|
+
if (at < 0)
|
|
2086
|
+
return `${content.replace(/\n*$/, "")}\n\n${header}\nenabled = false\n`;
|
|
2087
|
+
let end = lines.length;
|
|
2088
|
+
for (let i = at + 1; i < lines.length; i++)
|
|
2089
|
+
if (lines[i].trim().startsWith("[")) {
|
|
2090
|
+
end = i;
|
|
2091
|
+
break;
|
|
2092
|
+
}
|
|
2093
|
+
const enabledAt = lines.findIndex((line, i) => i > at && i < end && /^\s*enabled\s*=/.test(line));
|
|
2094
|
+
if (enabledAt >= 0)
|
|
2095
|
+
lines[enabledAt] = "enabled = false";
|
|
2096
|
+
else
|
|
2097
|
+
lines.splice(at + 1, 0, "enabled = false");
|
|
2098
|
+
return lines.join("\n");
|
|
2099
|
+
}
|
|
2100
|
+
/** The parsed `hooks.state` after an event's groups move (`newIndexOf`; null = the group left): a group's tables move with it. */
|
|
2101
|
+
function rekeyCodexHookState(state, prefix, newIndexOf) {
|
|
2102
|
+
const next = {};
|
|
2103
|
+
for (const [key, value] of Object.entries(state)) {
|
|
2104
|
+
const tail = key.startsWith(prefix) ? /^(\d+):(\d+)$/.exec(key.slice(prefix.length)) : null;
|
|
2105
|
+
if (!tail) {
|
|
2106
|
+
next[key] = value;
|
|
2107
|
+
continue;
|
|
2108
|
+
}
|
|
2109
|
+
const index = newIndexOf(Number(tail[1]));
|
|
2110
|
+
if (index !== null)
|
|
2111
|
+
next[`${prefix}${index}:${tail[2]}`] = value;
|
|
2112
|
+
}
|
|
2113
|
+
return next;
|
|
2114
|
+
}
|
|
2115
|
+
/** The same move on config.toml's text: rename each moved group's `[hooks.state."<key>"]` header, and drop a removed
|
|
2116
|
+
* group's table. Other spellings aren't touched; the caller compares the parsed result before writing. */
|
|
2117
|
+
function rekeyCodexHookStateText(content, prefix, newIndexOf) {
|
|
2118
|
+
const out = [];
|
|
2119
|
+
let dropping = false;
|
|
2120
|
+
for (const line of content.split("\n")) {
|
|
2121
|
+
const trimmed = line.trim();
|
|
2122
|
+
if (trimmed.startsWith("[")) {
|
|
2123
|
+
dropping = false;
|
|
2124
|
+
const quoted = /^\[hooks\.state\.(".*")\]$/.exec(trimmed)?.[1];
|
|
2125
|
+
let key;
|
|
2126
|
+
try {
|
|
2127
|
+
key = quoted ? JSON.parse(quoted) : undefined;
|
|
2128
|
+
}
|
|
2129
|
+
catch {
|
|
2130
|
+
key = undefined;
|
|
2131
|
+
}
|
|
2132
|
+
const tail = key?.startsWith(prefix) ? /^(\d+):(\d+)$/.exec(key.slice(prefix.length)) : null;
|
|
2133
|
+
if (tail) {
|
|
2134
|
+
const index = newIndexOf(Number(tail[1]));
|
|
2135
|
+
if (index === null) {
|
|
2136
|
+
dropping = true;
|
|
2137
|
+
continue;
|
|
2138
|
+
}
|
|
2139
|
+
out.push(`[hooks.state.${JSON.stringify(`${prefix}${index}:${tail[2]}`)}]`);
|
|
2140
|
+
continue;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
if (!dropping)
|
|
2144
|
+
out.push(line);
|
|
2145
|
+
}
|
|
2146
|
+
return out.join("\n");
|
|
2147
|
+
}
|
|
1791
2148
|
/**
|
|
1792
2149
|
* OPR.0.4.1.10 B3 — remove the OpenRig-managed activity-hooks sentinel block (durable disable).
|
|
1793
2150
|
* Strips ONLY the BEGIN..END block (plus the leading blank-line separator it was appended with);
|