@openrig/cli 0.7.10 → 0.7.12
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 +9 -6
- package/daemon/assets/claude-permission-policies.cjs +41 -0
- package/daemon/assets/claude-permission-policies.d.cts +3 -0
- package/daemon/assets/claude-team-permissions.cjs +13 -3
- package/daemon/assets/guidance/openrig-context-entry.md +8 -0
- package/daemon/assets/herdr-app/mods/rig-cell-header/main.js +15 -0
- package/daemon/assets/herdr-app/mods/rig-cell-header/mod.json +1 -0
- package/daemon/assets/herdr-app/mods/rig-ended/main.js +14 -0
- package/daemon/assets/herdr-app/mods/rig-ended/mod.json +1 -0
- package/daemon/assets/herdr-app/mods/rig-pad/main.js +10 -0
- package/daemon/assets/herdr-app/mods/rig-pad/mod.json +1 -0
- package/daemon/assets/herdr-app/mods/rig-strip/main.js +153 -0
- package/daemon/assets/herdr-app/mods/rig-strip/mod.json +1 -0
- package/daemon/assets/openshell/README.md +1 -1
- package/daemon/assets/pi-account-lock.cjs +39 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/marketplace.json +15 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +32 -0
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +39 -0
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +6 -0
- package/daemon/assets/plugins/openrig/LICENSE +200 -0
- package/daemon/assets/plugins/openrig/README.md +106 -0
- package/daemon/assets/plugins/openrig/assets/logo.svg +1 -0
- package/daemon/assets/plugins/openrig/mcp.json +10 -0
- package/daemon/assets/plugins/openrig/plugin.json +14 -0
- package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +90 -0
- 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/hooks/scripts/activity-relay.cjs +35 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus-state.cjs +103 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +177 -86
- package/daemon/assets/plugins/openrig-core/skills/agent-operated-software/SKILL.md +5 -1
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +3 -2
- package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +25 -9
- package/daemon/assets/plugins/openrig-core/skills/refocusing/SKILL.md +5 -0
- package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +26 -4
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
- package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +10 -6
- package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +1 -1
- package/daemon/assets/skills/rigs/SKILL.md +37 -2
- package/daemon/context-packs/help/help.md +18 -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 +104 -14
- package/daemon/context-packs/reference/acp-agents.md +68 -0
- package/daemon/context-packs/reference/getting-started.md +19 -3
- package/daemon/context-packs/reference/manifest.yaml +4 -1
- package/daemon/context-packs/reference/rig-spec.md +71 -8
- package/daemon/context-packs/reference/tmux-servers.md +214 -0
- package/daemon/context-packs/reference/whats-new.md +402 -132
- package/daemon/context-packs/skills/agent-operated-software/SKILL.md +5 -1
- 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/SKILL.md +3 -2
- 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/SKILL.md +7 -0
- 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 +1 -0
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -0
- 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/core/working-with-an-openrig-team/SKILL.md +90 -0
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +10 -0
- 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 +25 -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/SKILL.md +2 -0
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/SKILL.md +5 -0
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +26 -4
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +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/SKILL.md +10 -6
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +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 +3 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +59 -15
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +2 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +28 -6
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-resume.js +6 -2
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +2 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +54 -13
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +10 -6
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +78 -24
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts +2 -4
- package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
- package/daemon/dist/adapters/kernel-authority.js +10 -41
- package/daemon/dist/adapters/kernel-authority.js.map +1 -1
- package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
- package/daemon/dist/adapters/openshell-podman-observer.js +5 -3
- package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
- package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +27 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.js +38 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -0
- package/daemon/dist/adapters/pi-resume.d.ts +4 -1
- package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-resume.js +38 -9
- package/daemon/dist/adapters/pi-resume.js.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.d.ts +9 -3
- package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.js +13 -1
- package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts +14 -4
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +174 -29
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts +37 -14
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.js +97 -31
- package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux-control.d.ts +32 -1
- package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-control.js +149 -9
- package/daemon/dist/adapters/tmux-control.js.map +1 -1
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +13 -4
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/adapters/tmux-server.d.ts +11 -0
- package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-server.js +13 -1
- package/daemon/dist/adapters/tmux-server.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +32 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +241 -27
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/attention-surface.d.ts +7 -0
- package/daemon/dist/attention-surface.d.ts.map +1 -1
- package/daemon/dist/attention-surface.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +20 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts +3 -0
- package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts.map +1 -0
- package/daemon/dist/db/migrations/150_node_launch_wrapper.js +5 -0
- package/daemon/dist/db/migrations/150_node_launch_wrapper.js.map +1 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.d.ts +4 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.d.ts.map +1 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.js +44 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.js.map +1 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts +8 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts.map +1 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.js +13 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.js.map +1 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.d.ts +7 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.d.ts.map +1 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.js +17 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.js.map +1 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts +7 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts.map +1 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js +11 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js.map +1 -0
- package/daemon/dist/db/migrations/155_queue_erasure.d.ts +12 -0
- package/daemon/dist/db/migrations/155_queue_erasure.d.ts.map +1 -0
- package/daemon/dist/db/migrations/155_queue_erasure.js +28 -0
- package/daemon/dist/db/migrations/155_queue_erasure.js.map +1 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts +4 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts.map +1 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js +14 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js.map +1 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts +9 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts.map +1 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.js +18 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.js.map +1 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts +8 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts.map +1 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.js +15 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.js.map +1 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts +5 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js +9 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js.map +1 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts +9 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
- package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
- package/daemon/dist/domain/agent-activity-store.d.ts +4 -2
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +11 -7
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +11 -1
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/builtin-startup-files.d.ts +8 -0
- package/daemon/dist/domain/builtin-startup-files.d.ts.map +1 -1
- package/daemon/dist/domain/builtin-startup-files.js +37 -11
- package/daemon/dist/domain/builtin-startup-files.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +73 -20
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +442 -84
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.d.ts +16 -0
- package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -0
- package/daemon/dist/domain/claude-continuation-launch.js +110 -0
- package/daemon/dist/domain/claude-continuation-launch.js.map +1 -0
- package/daemon/dist/domain/claude-git-trust-root.d.ts +11 -0
- package/daemon/dist/domain/claude-git-trust-root.d.ts.map +1 -0
- package/daemon/dist/domain/claude-git-trust-root.js +72 -0
- package/daemon/dist/domain/claude-git-trust-root.js.map +1 -0
- package/daemon/dist/domain/claude-managed-launch.d.ts +3 -0
- package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.js +17 -7
- package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
- package/daemon/dist/domain/community-harness-presets.d.ts +5 -0
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +33 -6
- package/daemon/dist/domain/community-harness-presets.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.js +37 -6
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +3 -0
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +10 -1
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +52 -0
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +215 -0
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/default-receiver.d.ts +40 -0
- package/daemon/dist/domain/default-receiver.d.ts.map +1 -0
- package/daemon/dist/domain/default-receiver.js +70 -0
- package/daemon/dist/domain/default-receiver.js.map +1 -0
- package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +4 -3
- package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -1
- package/daemon/dist/domain/desired-claude-activity-hooks.js +49 -15
- package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js +6 -2
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
- package/daemon/dist/domain/escalation-owner.js +8 -3
- package/daemon/dist/domain/escalation-owner.js.map +1 -1
- package/daemon/dist/domain/event-bus.d.ts +47 -8
- package/daemon/dist/domain/event-bus.d.ts.map +1 -1
- package/daemon/dist/domain/event-bus.js +137 -17
- package/daemon/dist/domain/event-bus.js.map +1 -1
- package/daemon/dist/domain/execution-view.d.ts +9 -0
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +41 -3
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/gateway/connections-projection.d.ts +13 -1
- package/daemon/dist/domain/gateway/connections-projection.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/connections-projection.js +38 -10
- package/daemon/dist/domain/gateway/connections-projection.js.map +1 -1
- package/daemon/dist/domain/gateway/dispatcher.d.ts +2 -0
- package/daemon/dist/domain/gateway/dispatcher.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/dispatcher.js +14 -1
- package/daemon/dist/domain/gateway/dispatcher.js.map +1 -1
- package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +5 -0
- package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/gateway-subsystem.js +10 -0
- package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.d.ts +2 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
- package/daemon/dist/domain/gateway/human-readiness.d.ts +7 -0
- package/daemon/dist/domain/gateway/human-readiness.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-readiness.js +45 -0
- package/daemon/dist/domain/gateway/human-readiness.js.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.d.ts +35 -4
- package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.js +130 -42
- package/daemon/dist/domain/gateway/human-registry.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 +8 -2
- package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
- package/daemon/dist/domain/gateway/relay-config.d.ts +83 -0
- package/daemon/dist/domain/gateway/relay-config.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/relay-config.js +321 -0
- package/daemon/dist/domain/gateway/relay-config.js.map +1 -0
- package/daemon/dist/domain/gateway/relay-inbound.d.ts +85 -0
- package/daemon/dist/domain/gateway/relay-inbound.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/relay-inbound.js +981 -0
- package/daemon/dist/domain/gateway/relay-inbound.js.map +1 -0
- package/daemon/dist/domain/gateway/relay-outbound.d.ts +218 -0
- package/daemon/dist/domain/gateway/relay-outbound.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/relay-outbound.js +801 -0
- package/daemon/dist/domain/gateway/relay-outbound.js.map +1 -0
- package/daemon/dist/domain/gateway/slack/config.d.ts +21 -0
- package/daemon/dist/domain/gateway/slack/config.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/config.js +30 -3
- package/daemon/dist/domain/gateway/slack/config.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +7 -2
- package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/open-asks.d.ts +13 -1
- package/daemon/dist/domain/gateway/slack/open-asks.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/open-asks.js +72 -8
- package/daemon/dist/domain/gateway/slack/open-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +9 -0
- package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.js +19 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts +3 -0
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.js +12 -4
- package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +2 -0
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.js +38 -12
- package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts +12 -1
- package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-recovery.js +68 -10
- package/daemon/dist/domain/gateway/slack/slack-recovery.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 +363 -67
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts +1 -0
- package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/socket-inbound.js +5 -0
- package/daemon/dist/domain/gateway/slack/socket-inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/state-store.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/state-store.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/state-store.js +4 -1
- package/daemon/dist/domain/gateway/slack/state-store.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts +23 -3
- package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-recovery.js +52 -10
- package/daemon/dist/domain/gateway/slack/thread-recovery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts +4 -1
- package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-seat-map.js +7 -4
- package/daemon/dist/domain/gateway/slack/thread-seat-map.js.map +1 -1
- package/daemon/dist/domain/guidance-projection.d.ts +39 -0
- package/daemon/dist/domain/guidance-projection.d.ts.map +1 -0
- package/daemon/dist/domain/guidance-projection.js +91 -0
- package/daemon/dist/domain/guidance-projection.js.map +1 -0
- package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.js +31 -12
- package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
- package/daemon/dist/domain/hosted-wake.d.ts +5 -1
- package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
- package/daemon/dist/domain/hosted-wake.js +13 -3
- package/daemon/dist/domain/hosted-wake.js.map +1 -1
- package/daemon/dist/domain/hosts/pairing-ask.d.ts +10 -0
- package/daemon/dist/domain/hosts/pairing-ask.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/pairing-ask.js +9 -0
- package/daemon/dist/domain/hosts/pairing-ask.js.map +1 -0
- package/daemon/dist/domain/launch-wrapper.d.ts +29 -0
- package/daemon/dist/domain/launch-wrapper.d.ts.map +1 -0
- package/daemon/dist/domain/launch-wrapper.js +97 -0
- package/daemon/dist/domain/launch-wrapper.js.map +1 -0
- package/daemon/dist/domain/managed-blocks.d.ts +3 -0
- package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
- package/daemon/dist/domain/managed-blocks.js +5 -0
- package/daemon/dist/domain/managed-blocks.js.map +1 -1
- package/daemon/dist/domain/markdown-address.d.ts.map +1 -1
- package/daemon/dist/domain/markdown-address.js +12 -1
- package/daemon/dist/domain/markdown-address.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +1 -1
- 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 +116 -28
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/model-divergence/current-model-reader.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-model-reader.js +14 -3
- package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
- package/daemon/dist/domain/native-process-arguments.d.ts +5 -0
- package/daemon/dist/domain/native-process-arguments.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-arguments.js +60 -5
- package/daemon/dist/domain/native-process-arguments.js.map +1 -1
- package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-lineage.js +32 -9
- package/daemon/dist/domain/native-process-lineage.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +9 -2
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +9 -2
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +53 -3
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +101 -6
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/package-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/package-manifest.js +10 -5
- package/daemon/dist/domain/package-manifest.js.map +1 -1
- package/daemon/dist/domain/parent-session-env.d.ts +2 -1
- package/daemon/dist/domain/parent-session-env.d.ts.map +1 -1
- package/daemon/dist/domain/parent-session-env.js +9 -1
- package/daemon/dist/domain/parent-session-env.js.map +1 -1
- package/daemon/dist/domain/parked-query.d.ts +6 -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/pi-account-state.d.ts +6 -0
- package/daemon/dist/domain/pi-account-state.d.ts.map +1 -0
- package/daemon/dist/domain/pi-account-state.js +14 -0
- package/daemon/dist/domain/pi-account-state.js.map +1 -0
- package/daemon/dist/domain/policies/delivery-digest-flush.d.ts.map +1 -1
- package/daemon/dist/domain/policies/delivery-digest-flush.js +9 -1
- package/daemon/dist/domain/policies/delivery-digest-flush.js.map +1 -1
- package/daemon/dist/domain/policies/mode-scheduled-end.d.ts +4 -1
- package/daemon/dist/domain/policies/mode-scheduled-end.d.ts.map +1 -1
- package/daemon/dist/domain/policies/mode-scheduled-end.js +19 -10
- package/daemon/dist/domain/policies/mode-scheduled-end.js.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -0
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js +13 -3
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/policies/quiet-release.d.ts +19 -6
- package/daemon/dist/domain/policies/quiet-release.d.ts.map +1 -1
- package/daemon/dist/domain/policies/quiet-release.js +50 -10
- package/daemon/dist/domain/policies/quiet-release.js.map +1 -1
- package/daemon/dist/domain/projection-planner.d.ts +4 -1
- package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
- package/daemon/dist/domain/projection-planner.js +3 -0
- package/daemon/dist/domain/projection-planner.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +11 -0
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +61 -38
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/queue-blocker.d.ts +5 -0
- package/daemon/dist/domain/queue-blocker.d.ts.map +1 -0
- package/daemon/dist/domain/queue-blocker.js +12 -0
- package/daemon/dist/domain/queue-blocker.js.map +1 -0
- package/daemon/dist/domain/queue-erasure.d.ts +173 -0
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -0
- package/daemon/dist/domain/queue-erasure.js +885 -0
- package/daemon/dist/domain/queue-erasure.js.map +1 -0
- package/daemon/dist/domain/queue-owner.d.ts +6 -0
- package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
- package/daemon/dist/domain/queue-owner.js +13 -4
- package/daemon/dist/domain/queue-owner.js.map +1 -1
- package/daemon/dist/domain/queue-pickup.d.ts +20 -1
- package/daemon/dist/domain/queue-pickup.d.ts.map +1 -1
- package/daemon/dist/domain/queue-pickup.js +38 -6
- package/daemon/dist/domain/queue-pickup.js.map +1 -1
- package/daemon/dist/domain/queue-recovery.d.ts +14 -0
- package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/queue-recovery.js +33 -1
- package/daemon/dist/domain/queue-recovery.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +226 -20
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +786 -91
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +82 -0
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +168 -0
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +38 -4
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +763 -190
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +52 -1
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +241 -3
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts +49 -3
- package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
- package/daemon/dist/domain/queue-waiting.js +73 -13
- package/daemon/dist/domain/queue-waiting.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +86 -30
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/quiet-hold-custody.d.ts.map +1 -1
- package/daemon/dist/domain/quiet-hold-custody.js +7 -3
- package/daemon/dist/domain/quiet-hold-custody.js.map +1 -1
- package/daemon/dist/domain/rebuild-priming-chain.d.ts +3 -1
- package/daemon/dist/domain/rebuild-priming-chain.d.ts.map +1 -1
- package/daemon/dist/domain/rebuild-priming-chain.js +3 -1
- package/daemon/dist/domain/rebuild-priming-chain.js.map +1 -1
- package/daemon/dist/domain/refocus-record.d.ts +17 -0
- package/daemon/dist/domain/refocus-record.d.ts.map +1 -0
- package/daemon/dist/domain/refocus-record.js +94 -0
- package/daemon/dist/domain/refocus-record.js.map +1 -0
- package/daemon/dist/domain/restore-check-service.js +1 -1
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-guidance.d.ts.map +1 -1
- package/daemon/dist/domain/restore-guidance.js +5 -6
- package/daemon/dist/domain/restore-guidance.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +15 -2
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +100 -42
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +2 -1
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/resume-token-validation.d.ts +7 -0
- package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-validation.js +13 -3
- package/daemon/dist/domain/resume-token-validation.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +3 -0
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +46 -1
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +2 -1
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigs-being-built.d.ts +5 -0
- package/daemon/dist/domain/rigs-being-built.d.ts.map +1 -0
- package/daemon/dist/domain/rigs-being-built.js +18 -0
- package/daemon/dist/domain/rigs-being-built.js.map +1 -0
- 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 +5 -0
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +20 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +100 -22
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +13 -0
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +26 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/runner-permissions.d.ts +16 -0
- package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/runner-permissions.js +95 -14
- package/daemon/dist/domain/runner-permissions.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +2 -0
- 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 +1 -1
- package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-switch-materials.js +2 -2
- package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.js +14 -0
- package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +50 -1
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +144 -5
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +13 -0
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +45 -1
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +8 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +61 -19
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-kinds.d.ts +21 -0
- package/daemon/dist/domain/seat-kinds.d.ts.map +1 -0
- package/daemon/dist/domain/seat-kinds.js +27 -0
- package/daemon/dist/domain/seat-kinds.js.map +1 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts +14 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +64 -16
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +12 -0
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +59 -14
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +2 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +19 -1
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-home.d.ts +4 -1
- package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-home.js +6 -4
- package/daemon/dist/domain/seat-runtime-home.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +87 -13
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-skill-apply.d.ts +2 -0
- package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-apply.js +5 -2
- package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.d.ts +57 -4
- package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.js +339 -9
- package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
- package/daemon/dist/domain/seat-status-service.d.ts +12 -2
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +39 -4
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.d.ts +8 -0
- package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.js +8 -2
- package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
- package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
- package/daemon/dist/domain/self-attach-service.js +11 -4
- package/daemon/dist/domain/self-attach-service.js.map +1 -1
- package/daemon/dist/domain/session-jsonl.d.ts +4 -2
- package/daemon/dist/domain/session-jsonl.d.ts.map +1 -1
- package/daemon/dist/domain/session-jsonl.js +56 -22
- package/daemon/dist/domain/session-jsonl.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +20 -3
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +39 -3
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +52 -5
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +434 -85
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/skill-catalog.d.ts +37 -0
- package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
- package/daemon/dist/domain/skill-catalog.js +152 -3
- package/daemon/dist/domain/skill-catalog.js.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.js +11 -13
- package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +41 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +463 -22
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +12 -3
- 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 +18 -4
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +1 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +1 -0
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts +2 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js +146 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js.map +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach.js +42 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +3 -2
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-install.d.ts +28 -0
- package/daemon/dist/domain/terminal/herdr-app-install.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-install.js +170 -0
- package/daemon/dist/domain/terminal/herdr-app-install.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.d.ts +79 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.js +134 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +123 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.js +681 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-state.d.ts +91 -0
- package/daemon/dist/domain/terminal/herdr-app-state.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-state.js +140 -0
- package/daemon/dist/domain/terminal/herdr-app-state.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.d.ts +68 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.js +133 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-follow-view.js +43 -19
- package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts +7 -4
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.js +101 -47
- package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-following.js +3 -3
- package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +18 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +28 -3
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +56 -8
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.d.ts +6 -3
- package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js +11 -46
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +1 -0
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/time-bound-advisory.js +3 -3
- package/daemon/dist/domain/time-bound-advisory.js.map +1 -1
- package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -1
- package/daemon/dist/domain/tmux-server-selection.js +8 -2
- package/daemon/dist/domain/tmux-server-selection.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +69 -1
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts +2 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +22 -3
- package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +83 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/view-event-bridge.js +1 -1
- package/daemon/dist/domain/view-event-bridge.js.map +1 -1
- package/daemon/dist/domain/view-projector.d.ts +4 -1
- package/daemon/dist/domain/view-projector.d.ts.map +1 -1
- package/daemon/dist/domain/view-projector.js +9 -4
- package/daemon/dist/domain/view-projector.js.map +1 -1
- package/daemon/dist/domain/wake-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/wake-recovery.js +10 -2
- package/daemon/dist/domain/wake-recovery.js.map +1 -1
- package/daemon/dist/domain/whoami-service.d.ts +6 -0
- package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
- package/daemon/dist/domain/whoami-service.js +9 -1
- package/daemon/dist/domain/whoami-service.js.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.d.ts +3 -2
- package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts +8 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.js +21 -3
- package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +1 -1
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.js +2 -1
- package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts +4 -1
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +24 -11
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +38 -4
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +115 -14
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-unregister.d.ts +36 -0
- package/daemon/dist/domain/workflow-spec-unregister.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-spec-unregister.js +105 -0
- package/daemon/dist/domain/workflow-spec-unregister.js.map +1 -0
- package/daemon/dist/domain/workflow-types.d.ts +14 -0
- package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
- package/daemon/dist/index.d.ts +3 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +31 -5
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/learned-host-bindings-surface.d.ts +2 -0
- package/daemon/dist/learned-host-bindings-surface.d.ts.map +1 -0
- package/daemon/dist/learned-host-bindings-surface.js +4 -0
- package/daemon/dist/learned-host-bindings-surface.js.map +1 -0
- package/daemon/dist/lib/pane-envelope.d.ts +3 -0
- package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
- package/daemon/dist/lib/pane-envelope.js +3 -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 +147 -25
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/adapters.d.ts.map +1 -1
- package/daemon/dist/routes/adapters.js +4 -0
- package/daemon/dist/routes/adapters.js.map +1 -1
- package/daemon/dist/routes/attention.d.ts.map +1 -1
- package/daemon/dist/routes/attention.js +2 -0
- package/daemon/dist/routes/attention.js.map +1 -1
- package/daemon/dist/routes/compaction.js +2 -0
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/config.d.ts.map +1 -1
- package/daemon/dist/routes/config.js +9 -1
- package/daemon/dist/routes/config.js.map +1 -1
- package/daemon/dist/routes/events.js +11 -2
- package/daemon/dist/routes/events.js.map +1 -1
- package/daemon/dist/routes/gateway.d.ts +3 -0
- package/daemon/dist/routes/gateway.d.ts.map +1 -1
- package/daemon/dist/routes/gateway.js +87 -8
- package/daemon/dist/routes/gateway.js.map +1 -1
- package/daemon/dist/routes/hosts.d.ts.map +1 -1
- package/daemon/dist/routes/hosts.js +400 -37
- package/daemon/dist/routes/hosts.js.map +1 -1
- package/daemon/dist/routes/provider.js +1 -1
- package/daemon/dist/routes/provider.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts +19 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +242 -46
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +4 -3
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/skills.d.ts.map +1 -1
- package/daemon/dist/routes/skills.js +8 -2
- package/daemon/dist/routes/skills.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +156 -28
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/terminal-ws.d.ts +1 -0
- package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
- package/daemon/dist/routes/terminal-ws.js +1 -1
- package/daemon/dist/routes/terminal-ws.js.map +1 -1
- package/daemon/dist/routes/terminal.d.ts.map +1 -1
- package/daemon/dist/routes/terminal.js +40 -3
- package/daemon/dist/routes/terminal.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +0 -1
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +24 -0
- package/daemon/dist/routes/workflow.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 +7 -2
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +34 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +255 -25
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts +18 -13
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.js +113 -76
- package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
- package/daemon/dist/terminal/window-pin.d.ts +3 -3
- package/daemon/dist/terminal/window-pin.d.ts.map +1 -1
- package/daemon/dist/terminal/window-pin.js +2 -2
- package/daemon/dist/terminal/window-pin.js.map +1 -1
- package/daemon/docs/reference/acp-agents.md +68 -0
- package/daemon/docs/reference/agent-spec.md +51 -1
- package/daemon/docs/reference/agent-startup-guide.md +52 -2
- package/daemon/docs/reference/agent-state-taxonomy.md +7 -0
- package/daemon/docs/reference/community-harness-examples/omo/omo.yaml +14 -0
- package/daemon/docs/reference/community-harness-presets.md +56 -2
- package/daemon/docs/reference/daemon-http-clients.md +31 -8
- package/daemon/docs/reference/edge-types.md +6 -4
- package/daemon/docs/reference/gateway-participants.md +23 -1
- package/daemon/docs/reference/gateway-relay.md +268 -0
- package/daemon/docs/reference/getting-started.md +19 -3
- package/daemon/docs/reference/harness-runner-contract.md +61 -12
- package/daemon/docs/reference/health-diagnosis.md +5 -1
- package/daemon/docs/reference/help.md +18 -0
- package/daemon/docs/reference/herdr-app.md +148 -0
- package/daemon/docs/reference/hosted-members.md +56 -7
- package/daemon/docs/reference/keeping-a-watch.md +3 -1
- package/daemon/docs/reference/project-workspace.md +4 -0
- package/daemon/docs/reference/queue-erasure.md +161 -0
- package/daemon/docs/reference/quickstart.md +1 -1
- package/daemon/docs/reference/reconstructions.md +90 -0
- package/daemon/docs/reference/rig-spec.md +71 -8
- package/daemon/docs/reference/runner-conformance/README.md +3 -0
- package/daemon/docs/reference/runner-conformance/check-runner.mjs +27 -6
- package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +1 -1
- package/daemon/docs/reference/sdlc-conventions.md +16 -1
- package/daemon/docs/reference/seat-delivery.md +30 -3
- package/daemon/docs/reference/slack-app-setup.md +37 -12
- package/daemon/docs/reference/terminal-sessions.md +101 -26
- package/daemon/docs/reference/tmux-servers.md +50 -2
- package/daemon/docs/reference/whats-new.md +402 -132
- package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +7 -0
- package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +1 -0
- package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -0
- package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
- package/daemon/specs/agents/shared/skills/pods/review-team/SKILL.md +2 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +24 -0
- package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +7 -4
- package/daemon/specs/rigs/launch/kernel/rig.yaml +6 -3
- package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +3 -1
- package/dist/acp/agent-server.d.ts +126 -0
- package/dist/acp/agent-server.d.ts.map +1 -0
- package/dist/acp/agent-server.js +449 -0
- package/dist/acp/agent-server.js.map +1 -0
- package/dist/acp/json-rpc-stdio.d.ts +24 -10
- package/dist/acp/json-rpc-stdio.d.ts.map +1 -1
- package/dist/acp/json-rpc-stdio.js +58 -36
- package/dist/acp/json-rpc-stdio.js.map +1 -1
- package/dist/bin-wrapper.d.ts.map +1 -1
- package/dist/bin-wrapper.js +3 -1
- package/dist/bin-wrapper.js.map +1 -1
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +9 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/acp.d.ts +14 -0
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/acp.js +189 -2
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/attach.js +1 -1
- package/dist/commands/attach.js.map +1 -1
- package/dist/commands/capture.js +6 -6
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/compact.d.ts.map +1 -1
- package/dist/commands/compact.js +14 -2
- package/dist/commands/compact.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +46 -7
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context-reconstruction.d.ts +5 -0
- package/dist/commands/context-reconstruction.d.ts.map +1 -0
- package/dist/commands/context-reconstruction.js +69 -0
- package/dist/commands/context-reconstruction.js.map +1 -0
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +46 -4
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +22 -5
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +61 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/gateway.d.ts.map +1 -1
- package/dist/commands/gateway.js +36 -11
- package/dist/commands/gateway.js.map +1 -1
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +68 -12
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/launch.d.ts +1 -0
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +1 -1
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +29 -5
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/proof.d.ts.map +1 -1
- package/dist/commands/proof.js +18 -6
- package/dist/commands/proof.js.map +1 -1
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +4 -1
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/ps.d.ts +11 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +26 -3
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +3 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +429 -75
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/scope.d.ts +2 -0
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +15 -0
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +79 -13
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts +2 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +16 -6
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +5 -0
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/slack.d.ts +1 -1
- package/dist/commands/slack.d.ts.map +1 -1
- package/dist/commands/slack.js +5 -1
- package/dist/commands/slack.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +11 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/stream.d.ts.map +1 -1
- package/dist/commands/stream.js +24 -1
- package/dist/commands/stream.js.map +1 -1
- package/dist/commands/terminal.d.ts +22 -0
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +117 -8
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +22 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +13 -2
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/workflow-errors.js +1 -1
- package/dist/commands/workflow-errors.js.map +1 -1
- package/dist/commands/workflow-render.d.ts +4 -0
- package/dist/commands/workflow-render.d.ts.map +1 -1
- package/dist/commands/workflow-render.js +7 -0
- package/dist/commands/workflow-render.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +70 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +15 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +112 -1
- package/dist/config-store.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +2 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +38 -5
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-reachability.d.ts +1 -1
- package/dist/daemon-reachability.d.ts.map +1 -1
- package/dist/daemon-reachability.js +4 -2
- package/dist/daemon-reachability.js.map +1 -1
- package/dist/daemon-start-lock.d.ts +24 -2
- package/dist/daemon-start-lock.d.ts.map +1 -1
- package/dist/daemon-start-lock.js +125 -4
- package/dist/daemon-start-lock.js.map +1 -1
- package/dist/lib/reconstruction-reader.d.ts +122 -0
- package/dist/lib/reconstruction-reader.d.ts.map +1 -0
- package/dist/lib/reconstruction-reader.js +481 -0
- package/dist/lib/reconstruction-reader.js.map +1 -0
- package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
- package/dist/lib/scope/logical-checkbox.js +14 -0
- package/dist/lib/scope/logical-checkbox.js.map +1 -1
- package/dist/lib/scope/scope-fs.d.ts.map +1 -1
- package/dist/lib/scope/scope-fs.js +36 -2
- package/dist/lib/scope/scope-fs.js.map +1 -1
- package/dist/lib/work-install.d.ts +28 -0
- package/dist/lib/work-install.d.ts.map +1 -1
- package/dist/lib/work-install.js +80 -20
- package/dist/lib/work-install.js.map +1 -1
- package/dist/mcp-http.d.ts +7 -0
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +30 -6
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-server.d.ts +33 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +489 -57
- package/dist/mcp-server.js.map +1 -1
- package/dist/queue-artifact.d.ts +57 -0
- package/dist/queue-artifact.d.ts.map +1 -0
- package/dist/queue-artifact.js +70 -0
- package/dist/queue-artifact.js.map +1 -0
- package/dist/queue-receipt.d.ts.map +1 -1
- package/dist/queue-receipt.js +4 -3
- package/dist/queue-receipt.js.map +1 -1
- package/dist/recap-seat.d.ts +28 -0
- package/dist/recap-seat.d.ts.map +1 -0
- package/dist/recap-seat.js +41 -0
- package/dist/recap-seat.js.map +1 -0
- package/dist/seat-attention.d.ts +24 -0
- package/dist/seat-attention.d.ts.map +1 -0
- package/dist/seat-attention.js +119 -0
- package/dist/seat-attention.js.map +1 -0
- package/dist/system-preflight.d.ts.map +1 -1
- package/dist/system-preflight.js +15 -7
- package/dist/system-preflight.js.map +1 -1
- package/dist/terminal-window.d.ts.map +1 -1
- package/dist/terminal-window.js +16 -13
- package/dist/terminal-window.js.map +1 -1
- package/package.json +1 -1
- package/tui/dist/attention/attention-model.d.ts +2 -1
- package/tui/dist/attention/attention-model.d.ts.map +1 -1
- package/tui/dist/attention/attention-model.js +21 -4
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/config/config-model.d.ts.map +1 -1
- package/tui/dist/config/config-model.js +7 -1
- package/tui/dist/config/config-model.js.map +1 -1
- package/tui/dist/config/pairing.d.ts +49 -0
- package/tui/dist/config/pairing.d.ts.map +1 -0
- package/tui/dist/config/pairing.js +98 -0
- package/tui/dist/config/pairing.js.map +1 -0
- package/tui/dist/daemon-client.d.ts +18 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +33 -9
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/demo-data.js +2 -2
- package/tui/dist/demo-data.js.map +1 -1
- package/tui/dist/detail.d.ts +3 -0
- package/tui/dist/detail.d.ts.map +1 -1
- package/tui/dist/detail.js +6 -1
- package/tui/dist/detail.js.map +1 -1
- package/tui/dist/execution/execution-model.d.ts +2 -0
- package/tui/dist/execution/execution-model.d.ts.map +1 -1
- package/tui/dist/execution/execution-model.js +10 -3
- package/tui/dist/execution/execution-model.js.map +1 -1
- package/tui/dist/health/health-model.d.ts.map +1 -1
- package/tui/dist/health/health-model.js +27 -11
- package/tui/dist/health/health-model.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +4 -2
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/main.js +11 -2
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/scopes/scopes-model.d.ts +9 -0
- package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
- package/tui/dist/scopes/scopes-model.js +27 -1
- package/tui/dist/scopes/scopes-model.js.map +1 -1
- package/tui/dist/state.d.ts.map +1 -1
- package/tui/dist/state.js +4 -3
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/terminals/open-window.d.ts +21 -1
- package/tui/dist/terminals/open-window.d.ts.map +1 -1
- package/tui/dist/terminals/open-window.js +46 -9
- package/tui/dist/terminals/open-window.js.map +1 -1
- package/tui/dist/terminals/terminal-model.d.ts +8 -1
- package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
- package/tui/dist/terminals/terminal-model.js +25 -8
- package/tui/dist/terminals/terminal-model.js.map +1 -1
- package/tui/dist/types.d.ts +18 -2
- package/tui/dist/types.d.ts.map +1 -1
- package/ui/dist/assets/index-BOYrLyfQ.js +623 -0
- package/ui/dist/assets/index-DqSRu4OY.css +32 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-BFOs3ejL.css +0 -32
- package/ui/dist/assets/index-CdkFwtld.js +0 -623
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerminalPolicyRefusal } from "./terminal-policy.js";
|
|
2
2
|
import { DeliveryGuardError } from "./seat-delivery-guard.js";
|
|
3
|
-
import { CAPTURE_READABLE_BUDGET_MS } from "./session-transport.js";
|
|
3
|
+
import { CAPTURE_READABLE_BUDGET_MS, SEND_READINESS_FRESHNESS_MS } from "./session-transport.js";
|
|
4
4
|
import { postCompactExtraSetting } from "./managed-restore-read-access.js";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
@@ -35,10 +35,9 @@ import * as path from "node:path";
|
|
|
35
35
|
* second one (`recoverAfterRestart`). A prompt or /compact is marked in
|
|
36
36
|
* flight at its write, so a restart never sends it again. A restart between
|
|
37
37
|
* a post-compact stage's send and its record can send that one stage again.
|
|
38
|
-
* - A /compact whose outcome is unknown
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* is held, visibly, while the box holds text or can't be read.
|
|
38
|
+
* - A /compact whose outcome is unknown is never replayed, with or without
|
|
39
|
+
* a restart. Only its first owed step waits until the recorded possible
|
|
40
|
+
* write clears; subsequent input follows ordinary draft-delivery settings.
|
|
42
41
|
* - Definite pre-write prep failures retry at most three times. Uncertain
|
|
43
42
|
* delivery never replays. Unfinished preparation stops visibly until an
|
|
44
43
|
* explicit retry. A completed automatic map keeps its bounded idle grace.
|
|
@@ -65,6 +64,11 @@ export const AUTO_PREP_WAIT_MS_DEFAULT = 25 * 60_000;
|
|
|
65
64
|
// How long a stopped attempt holds automatic compaction off for its seat before a fresh attempt may begin. Without it one
|
|
66
65
|
// failed preparation turned automatic compaction off for the seat until someone noticed. Operational, not measured.
|
|
67
66
|
export const AUTO_RETRY_AFTER_STOP_MS_DEFAULT = 10 * 60_000;
|
|
67
|
+
/** A held map retires once usage has risen this many points since its request (#2682). Operational, not measured: with the
|
|
68
|
+
* default 80% threshold, 95% is still reachable. */
|
|
69
|
+
export const PREPARED_MAP_MAX_GROWTH_PERCENT = 15;
|
|
70
|
+
/** A held map retires this long after it was first seen ready (#2682). Operational, not measured. */
|
|
71
|
+
export const PREPARED_MAP_MAX_AGE_MS = 2 * 60 * 60_000;
|
|
68
72
|
const PREP_SEND_ATTEMPTS_MAX = 3;
|
|
69
73
|
// Slices 13–14 fix — each post-compact back-half send (turn_boundary → restore →
|
|
70
74
|
// audit) is idle-gated so it cannot be injected into the busy pane right after
|
|
@@ -270,9 +274,21 @@ export function buildPostCompactTurnBoundaryPrompt() {
|
|
|
270
274
|
"Do not restore yet; the next normal user message will contain the restore instructions.",
|
|
271
275
|
].join(" ");
|
|
272
276
|
}
|
|
273
|
-
/** #2575
|
|
274
|
-
* draft still holds it. Waiting doesn't show the box is empty, so the delivery is recorded as over an unreadable box. */
|
|
277
|
+
/** Legacy #2575 threshold for old diagnostics. Managed input now follows ordinary draft-delivery defaults. */
|
|
275
278
|
export const UNREADABLE_POLLS_BEFORE_DELIVERY = 2;
|
|
279
|
+
const UNKNOWN_READINESS_POLLS_BEFORE_DELIVERY = 2;
|
|
280
|
+
/** Under --skip-map, a map the seat completed at the attempt path anyway, or null. Nothing publishes the .tmp under
|
|
281
|
+
* --skip-map, so the final path is checked first, then the .tmp, and whichever ends with the marker is named. */
|
|
282
|
+
function completedSkippedMap({ mapPath, marker }) {
|
|
283
|
+
return [mapPath, `${mapPath}.tmp`].find((file) => {
|
|
284
|
+
try {
|
|
285
|
+
return fs.readFileSync(file, "utf8").trimEnd().endsWith(marker);
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}) ?? null;
|
|
291
|
+
}
|
|
276
292
|
/** The file, beside an attempt's restore map, where the daemon records what it last did for that attempt. The agent
|
|
277
293
|
* never writes it. A restarted daemon reads it to pick the attempt up again. */
|
|
278
294
|
export const COMPACTION_RECORD_FILE = "COMPACTION-STATE.json";
|
|
@@ -281,6 +297,11 @@ export const COMPACTION_RECORD_FILE = "COMPACTION-STATE.json";
|
|
|
281
297
|
export const RESTART_RECOVERY_WINDOW_MS_DEFAULT = 6 * 60 * 60_000;
|
|
282
298
|
/** This daemon process. A record this process wrote is its own state, never something to recover. */
|
|
283
299
|
const DAEMON_PROCESS_ID = randomUUID();
|
|
300
|
+
/** What an automatic attempt returns while it is held, its map complete, until a window opens (#2682). */
|
|
301
|
+
const PREPARED_AWAITING_WINDOW = "prepared_awaiting_window";
|
|
302
|
+
/** Refusals of the /compact before any input that hold a completed map instead of stopping it: a draft in the box (in
|
|
303
|
+
* the receipt or thrown by the guard) and a pane in a tmux mode. Every other refusal stops as before. */
|
|
304
|
+
const HOLD_REASONS = new Set(["draft_input_busy", "draft_input_unknown", "draft_input_changed", "pane_in_mode"]);
|
|
284
305
|
const RECORD_PHASES = new Set(["preparing", "turn_boundary", "restore_prompt", "compliance_prompt", "compact_uncertain", "done", "ended"]);
|
|
285
306
|
const RECORD_DELIVERIES = new Set(["pending", "not_sent", "delivered", "uncertain"]);
|
|
286
307
|
/** A record only in the shape this daemon writes. Any other (a newer daemon's after a rollback, a damaged file) is ignored,
|
|
@@ -297,6 +318,12 @@ function readCompactionRecord(file) {
|
|
|
297
318
|
&& text(r.mapPath) && text(r.marker) && text(r.compactInstruction) && textOrNull(r.preparationRoot) && Number.isFinite(r.updatedAt)
|
|
298
319
|
&& (r.operatorInitiated === undefined || typeof r.operatorInitiated === "boolean") && (r.compactSending === undefined || r.compactSending === true)
|
|
299
320
|
&& (r.uncertainCompact === undefined || r.uncertainCompact === true)
|
|
321
|
+
&& (r.prepared === undefined || r.prepared === true) && (r.preparedAt === undefined || Number.isFinite(r.preparedAt))
|
|
322
|
+
&& (r.preparedReason === undefined || text(r.preparedReason)) && (r.belowSince === undefined || Number.isFinite(r.belowSince))
|
|
323
|
+
&& (r.mapReadyAt === undefined || Number.isFinite(r.mapReadyAt)) && (r.mapUsedPercentage === undefined || Number.isFinite(r.mapUsedPercentage))
|
|
324
|
+
&& (r.sessionId === undefined || text(r.sessionId)) && (r.endedAt === undefined || Number.isFinite(r.endedAt))
|
|
325
|
+
&& (r.afterEnded === undefined || Number.isFinite(r.afterEnded))
|
|
326
|
+
&& (r.afterEndedSessionId === undefined || textOrNull(r.afterEndedSessionId))
|
|
300
327
|
&& (carry === undefined || (typeof carry === "object" && carry !== null && textOrNull(carry.mapPath) && textOrNull(carry.compactInstruction)
|
|
301
328
|
&& (carry.skipMap === undefined || (text(carry.skipMap?.mapPath) && text(carry.skipMap?.marker)))));
|
|
302
329
|
return valid ? r : null;
|
|
@@ -305,8 +332,6 @@ function readCompactionRecord(file) {
|
|
|
305
332
|
return null;
|
|
306
333
|
}
|
|
307
334
|
}
|
|
308
|
-
/** Input-box readings that hold nothing typed: an owed step after an uncertain /compact may go in. A harness suggestion isn't input. */
|
|
309
|
-
const INPUT_BOX_CLEAR = new Set(["empty", "likely-suggestion"]);
|
|
310
335
|
function strandedSummary(record) {
|
|
311
336
|
return { attemptId: record.attemptId, mapPath: record.mapPath, phase: record.phase, recordedAt: new Date(record.updatedAt).toISOString() };
|
|
312
337
|
}
|
|
@@ -330,6 +355,9 @@ export class ClaudeCompactionEnforcer {
|
|
|
330
355
|
postCompactRestoreCooldownUntil = new Map();
|
|
331
356
|
triggeredAboveThreshold = new Set();
|
|
332
357
|
pendingPreCompactPrep = new Map();
|
|
358
|
+
/** The seat's last attempt that ended with its request delivered (or possibly delivered) and no /compact (#2682): a fresh
|
|
359
|
+
* automatic preparation for the same occupant and conversation waits for an idle seat. Kept across a restart by the record. */
|
|
360
|
+
lastEnded = new Map();
|
|
333
361
|
pendingPostCompactRestore = new Map();
|
|
334
362
|
// OPR.0.4.3.14 — per-seat manual-trigger surfaced state (AC-3). In-memory,
|
|
335
363
|
// non-persisted (a daemon restart reset is the safe-failure direction).
|
|
@@ -344,19 +372,19 @@ export class ClaudeCompactionEnforcer {
|
|
|
344
372
|
recovered = new Set();
|
|
345
373
|
/** Open records too old to resume: the seat's restore may still be owed. */
|
|
346
374
|
stranded = new Map();
|
|
347
|
-
/** Seats whose owed restore steps follow a /compact whose outcome is unknown
|
|
348
|
-
* box, where any Enter would submit it, so each step goes only into an empty box. */
|
|
375
|
+
/** Seats whose owed restore steps follow a /compact whose outcome is unknown; never replay that command. */
|
|
349
376
|
afterUncertainCompact = new Set();
|
|
350
|
-
/** What the input box last read for such a seat, before an owed step (absent until the first check). */
|
|
351
377
|
lastInputBox = new Map();
|
|
352
378
|
restartRecoveryWindowMs;
|
|
353
379
|
daemonInstance;
|
|
354
380
|
resolveOccupantGeneration;
|
|
355
381
|
onPostRestoreComplete;
|
|
382
|
+
onPreparationFailure;
|
|
356
383
|
onRestoreDeliveryFailure;
|
|
357
384
|
terminalPolicies;
|
|
358
385
|
constructor(settingsStore, sessionTransport, opts) {
|
|
359
386
|
this.onRestoreDeliveryFailure = opts?.onRestoreDeliveryFailure;
|
|
387
|
+
this.onPreparationFailure = opts?.onPreparationFailure;
|
|
360
388
|
this.terminalPolicies = opts?.terminalPolicies;
|
|
361
389
|
this.settingsStore = settingsStore;
|
|
362
390
|
this.sessionTransport = sessionTransport;
|
|
@@ -368,7 +396,8 @@ export class ClaudeCompactionEnforcer {
|
|
|
368
396
|
this.now = opts?.now ?? (() => Date.now());
|
|
369
397
|
this.sleep = opts?.sleep ?? (ms => new Promise(resolve => setTimeout(resolve, ms)));
|
|
370
398
|
this.postCompactSendWaitMs = opts?.postCompactSendWaitMs ?? POST_COMPACT_SEND_WAIT_MS_DEFAULT;
|
|
371
|
-
|
|
399
|
+
// A fresh preparation hook can veto even a visibly idle pane for the full send-readiness window.
|
|
400
|
+
this.compactSendIdleWaitMs = opts?.compactSendIdleWaitMs ?? SEND_READINESS_FRESHNESS_MS;
|
|
372
401
|
this.restartRecoveryWindowMs = opts?.restartRecoveryWindowMs ?? RESTART_RECOVERY_WINDOW_MS_DEFAULT;
|
|
373
402
|
this.daemonInstance = opts?.daemonInstance ?? DAEMON_PROCESS_ID;
|
|
374
403
|
this.resolveOccupantGeneration = opts?.resolveOccupantGeneration;
|
|
@@ -381,8 +410,69 @@ export class ClaudeCompactionEnforcer {
|
|
|
381
410
|
*/
|
|
382
411
|
async maybeAutoCompact(input) {
|
|
383
412
|
this.reconcilePreparations();
|
|
413
|
+
const gated = await this.endedAttemptGate(input);
|
|
414
|
+
if (gated)
|
|
415
|
+
return gated;
|
|
384
416
|
return this.withDeliveryGuard(input, () => this.maybeAutoCompactUnchecked(input));
|
|
385
417
|
}
|
|
418
|
+
liveGeneration(session) {
|
|
419
|
+
return this.resolveOccupantGeneration?.(session) ?? this.sessionTransport.deliveryGuard?.maybeTarget(session)?.occupant ?? null;
|
|
420
|
+
}
|
|
421
|
+
/** #2682: before a fresh automatic preparation after an attempt that ended with its request delivered, for the same
|
|
422
|
+
* occupant and conversation, the seat must read idle. Runs outside the delivery lease, as the manual path's idle wait. */
|
|
423
|
+
async endedAttemptGate(input) {
|
|
424
|
+
const session = input.sessionName;
|
|
425
|
+
if (input.runtime !== "claude-code" || input.usedPercentage == null)
|
|
426
|
+
return null;
|
|
427
|
+
this.recoverSeat(input);
|
|
428
|
+
const ended = this.lastEnded.get(session);
|
|
429
|
+
if (!ended)
|
|
430
|
+
return null;
|
|
431
|
+
const live = this.liveGeneration(session);
|
|
432
|
+
// A generation that reads unknown for a moment is not another occupant: the ended attempt is kept (below).
|
|
433
|
+
if (ended.occupantGeneration === null || (live !== null && live !== ended.occupantGeneration)
|
|
434
|
+
|| (ended.sessionId && input.sessionId && ended.sessionId !== input.sessionId)
|
|
435
|
+
|| this.now() - ended.endedAt >= this.restartRecoveryWindowMs) {
|
|
436
|
+
this.lastEnded.delete(session);
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
let policy;
|
|
440
|
+
try {
|
|
441
|
+
policy = this.settingsStore.resolveClaudeCompactionPolicy();
|
|
442
|
+
}
|
|
443
|
+
catch {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
if (!policy.enabled || !isValidThresholdPercent(policy.thresholdPercent) || input.usedPercentage < policy.thresholdPercent)
|
|
447
|
+
return null;
|
|
448
|
+
if (this.pendingPostCompactRestore.has(session))
|
|
449
|
+
return null;
|
|
450
|
+
const attempt = this.pendingPreCompactPrep.get(session);
|
|
451
|
+
// The replacement whose request hasn't gone out yet (a busy send refused it) stays behind the gate.
|
|
452
|
+
const unsentReplacement = attempt?.mode === "automatic" && attempt.status === "sending" && attempt.afterEnded !== undefined;
|
|
453
|
+
if (attempt && !unsentReplacement && (attempt.status !== "stopped" || attempt.cancelled || attempt.compact !== "not_sent"))
|
|
454
|
+
return null;
|
|
455
|
+
// The stopped attempt's cooldown holds after a restart too.
|
|
456
|
+
if (this.now() - ended.endedAt < this.autoRetryAfterStopMs)
|
|
457
|
+
return { triggered: false, reason: "preparation_stopped" };
|
|
458
|
+
// With no occupant to name, no attempt could begin (it would stop as occupant_generation_unavailable and drop this one).
|
|
459
|
+
if (live === null)
|
|
460
|
+
return { triggered: false, reason: "occupant_generation_unavailable" };
|
|
461
|
+
// One readiness read, with no wait after it: this runs inside the monitor's serial poll, so a busy seat must not hold
|
|
462
|
+
// the other seats' polls. A busy seat, or a read that fails, waits for a later poll.
|
|
463
|
+
let idle;
|
|
464
|
+
try {
|
|
465
|
+
idle = await this.sessionTransport.waitUntilIdle(session, CAPTURE_READABLE_BUDGET_MS, undefined, { singleObservation: true, allowDraft: true });
|
|
466
|
+
}
|
|
467
|
+
catch {
|
|
468
|
+
idle = { ok: false };
|
|
469
|
+
}
|
|
470
|
+
if (!idle.ok)
|
|
471
|
+
return { triggered: false, reason: "waiting_for_idle" };
|
|
472
|
+
// The gate is used up only when the replacement request goes out (deliverPreparation), and that send checks idle
|
|
473
|
+
// again: an observation refused as stale, or a peer's turn starting before the send, keeps it.
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
386
476
|
/**
|
|
387
477
|
* What this enforcer has recorded about a managed compaction of `sessionName`, for a sender's context, or null when
|
|
388
478
|
* none is under way. Read-only: it reports the enforcer's own state (the preparation attempt and the post-compact
|
|
@@ -421,6 +511,11 @@ export class ClaudeCompactionEnforcer {
|
|
|
421
511
|
this.recoverSeat({ sessionName, ...seat });
|
|
422
512
|
return this.pendingPostCompactRestore.has(sessionName);
|
|
423
513
|
}
|
|
514
|
+
/** #2661 (c): since when (epoch ms) a post-compact stage has been owed to this seat — the /compact this daemon sent,
|
|
515
|
+
* or this daemon's recovery of one recorded before a restart (a lower bound then) — or null when none is owed. */
|
|
516
|
+
postCompactStageOwedSince(sessionName) {
|
|
517
|
+
return this.pendingPostCompactRestore.has(sessionName) ? this.lastAutoCompactAt.get(sessionName) ?? null : null;
|
|
518
|
+
}
|
|
424
519
|
/** The first time this daemon reaches a seat (a poll, a manual request, a state read): pick up its record from before a
|
|
425
520
|
* restart, with the policy's preparation root (`recoverAfterRestart`). */
|
|
426
521
|
recoverSeat(seat) {
|
|
@@ -435,28 +530,35 @@ export class ClaudeCompactionEnforcer {
|
|
|
435
530
|
}
|
|
436
531
|
/** The restore step OpenRig owes this seat next, or null. After a /compact whose outcome is unknown (see
|
|
437
532
|
* `afterUncertainCompact`) it also gives what the input box last read (`not_checked` before the first check) and
|
|
438
|
-
* whether the step is held for it. */
|
|
533
|
+
* whether the step is held for it. It names the attempt's restore map, which a person's restore notice leaves out. */
|
|
439
534
|
getOwedRestore(sessionName) {
|
|
440
535
|
const stage = this.pendingPostCompactRestore.get(sessionName);
|
|
441
536
|
if (!stage)
|
|
442
537
|
return null;
|
|
443
|
-
const
|
|
538
|
+
const record = this.records.get(sessionName)?.record;
|
|
539
|
+
const lastDelivery = record?.lastDelivery;
|
|
444
540
|
const failed = !!lastDelivery && lastDelivery.failures > 0;
|
|
445
|
-
|
|
541
|
+
// The map the restore request names: under --skip-map only one the seat completed anyway, never a path with no map.
|
|
542
|
+
// The record keeps the --skip-map choice through every owed stage; the in-memory carry ends once the request lands.
|
|
543
|
+
const skipMap = record?.restoreCarry?.skipMap;
|
|
544
|
+
const mapPath = skipMap ? completedSkippedMap(skipMap) : record?.mapPath;
|
|
545
|
+
const last = { ...(lastDelivery ? { lastDelivery } : {}), ...(mapPath ? { mapPath } : {}) };
|
|
446
546
|
const steps = { turn_boundary: "post-compaction turn boundary", restore_prompt: "restore request", compliance_prompt: "post-restore audit" };
|
|
447
547
|
const failure = !lastDelivery ? "" : lastDelivery.reason === "delivered_over_unreadable_input_box"
|
|
448
548
|
? ` The ${steps[lastDelivery.stage]} went in at ${lastDelivery.at} over an input box OpenRig couldn't read (it read ${lastDelivery.inputBox ?? "unknown"}); a draft there, if any, may hold its text.`
|
|
449
|
-
:
|
|
450
|
-
? `
|
|
549
|
+
: lastDelivery.reason === "delivered_over_unreadable_pane"
|
|
550
|
+
? ` The ${steps[lastDelivery.stage]} went in at ${lastDelivery.at} over a pane OpenRig couldn't read; its activity remained unknown.`
|
|
551
|
+
: ` ${failed ? "Last delivery" : "waiting: seat busy"} at ${lastDelivery.at}: ${[lastDelivery.reason, lastDelivery.activity?.reason, lastDelivery.errorClass, lastDelivery.noticeErrorClass && `owner notice failed (${lastDelivery.noticeErrorClass})`].filter(Boolean).join("; ")}. OpenRig will retry on its existing polls.${lastDelivery.unreadable
|
|
552
|
+
? " The operator’s draft-protection settings still apply." : ""}`;
|
|
451
553
|
const step = steps[stage];
|
|
452
554
|
if (!this.afterUncertainCompact.has(sessionName)) {
|
|
453
|
-
return { stage, held: failed, ...last, detail: `OpenRig owes this seat its ${step} next, sent
|
|
555
|
+
return { stage, held: failed, ...last, detail: `OpenRig owes this seat its ${step} next, sent once the pane is idle or after two consecutive polls cannot determine its activity.${failure}` };
|
|
454
556
|
}
|
|
455
|
-
const inputBox = this.lastInputBox.get(sessionName) ?? "not_checked";
|
|
456
|
-
const held = inputBox !== "not_checked" &&
|
|
457
|
-
return { stage, held
|
|
458
|
-
? `held: OpenRig
|
|
459
|
-
: `OpenRig owes this seat its ${step}
|
|
557
|
+
const inputBox = lastDelivery?.inputBox ?? this.lastInputBox.get(sessionName) ?? "not_checked";
|
|
558
|
+
const held = failed || (inputBox !== "not_checked" && inputBox !== "empty" && inputBox !== "likely-suggestion");
|
|
559
|
+
return { stage, held, inputBox, ...last, detail: held
|
|
560
|
+
? `held: OpenRig may have /compact text waiting from this attempt's uncertain write; any Enter could submit it. The input box reads ${inputBox}; check the pane and reconcile that effect. No command or restore input is replayed.${failure}`
|
|
561
|
+
: `OpenRig owes this seat its ${step} after an uncertain /compact. The outstanding write is checked before any restore Enter; unrelated delivery keeps ordinary draft settings.${failure}` };
|
|
460
562
|
}
|
|
461
563
|
/** An open record from before a restart that was too old to resume, while no later attempt has replaced it. */
|
|
462
564
|
getStrandedCompaction(sessionName) {
|
|
@@ -488,20 +590,51 @@ export class ClaudeCompactionEnforcer {
|
|
|
488
590
|
return (await this.drainPendingStage(unsampled, policy)) ?? { triggered: false, reason: "no_pending_stage" };
|
|
489
591
|
});
|
|
490
592
|
}
|
|
491
|
-
/** Finish only an already-armed automatic map when usage has gone stale; never request another preparation.
|
|
593
|
+
/** Finish only an already-armed automatic map when usage has gone stale; never request another preparation.
|
|
594
|
+
* `lastUsedPercentage` and `sessionId` are the seat's newest sample, however old: a map whose context has since dropped
|
|
595
|
+
* below the threshold, or whose conversation changed (Claude Code's own compaction, a person's /compact or /clear, also
|
|
596
|
+
* while the daemon was down), never compacts (#2682). */
|
|
492
597
|
async drainPendingPreparedCompact(input) {
|
|
493
|
-
const
|
|
598
|
+
const { lastUsedPercentage, ...rest } = input;
|
|
599
|
+
const unsampled = { ...rest, usedPercentage: null };
|
|
494
600
|
this.recoverSeat(input);
|
|
495
601
|
this.reconcilePreparations();
|
|
496
602
|
const attempt = this.pendingPreCompactPrep.get(input.sessionName);
|
|
497
603
|
if (input.runtime !== "claude-code" || attempt?.mode !== "automatic" || attempt.status !== "waiting"
|
|
498
|
-
|| attempt.delivery === "pending"
|
|
604
|
+
|| attempt.delivery === "pending")
|
|
499
605
|
return { triggered: false, reason: "no_pending_stage" };
|
|
500
|
-
|
|
606
|
+
const threshold = this.settingsStore.resolveClaudeCompactionPolicy().thresholdPercent;
|
|
607
|
+
if (!isValidThresholdPercent(threshold))
|
|
501
608
|
return { triggered: false, reason: "invalid_policy" };
|
|
609
|
+
const otherConversation = !!attempt.sessionId && !!input.sessionId && attempt.sessionId !== input.sessionId;
|
|
610
|
+
// Another conversation, known on both sides, ends an armed or held map, as on the fresh path, also one whose map isn't
|
|
611
|
+
// complete yet: a later sample whose conversation reads unknown must not compact with it.
|
|
612
|
+
if (otherConversation && !attempt.compactInFlight) {
|
|
613
|
+
this.stopPreparation(input.sessionName, "below_threshold_while_prepared", attempt);
|
|
614
|
+
return { triggered: false, reason: "preparation_stopped" };
|
|
615
|
+
}
|
|
616
|
+
if (!this.mapReady(attempt))
|
|
617
|
+
return { triggered: false, reason: "no_pending_stage" };
|
|
618
|
+
const dropped = lastUsedPercentage != null && lastUsedPercentage < threshold;
|
|
619
|
+
if (dropped && !attempt.compactInFlight) {
|
|
620
|
+
// A held map ends, as on a fresh dip. An attempt not held keeps its deadline (and a later fresh sample above may
|
|
621
|
+
// still use its map), but a stale sample never compacts it.
|
|
622
|
+
if (attempt.prepared) {
|
|
623
|
+
this.stopPreparation(input.sessionName, "below_threshold_while_prepared", attempt);
|
|
624
|
+
return { triggered: false, reason: "preparation_stopped" };
|
|
625
|
+
}
|
|
626
|
+
return { triggered: false, reason: "below_threshold" };
|
|
627
|
+
}
|
|
628
|
+
// The same growth rule as on a fresh sample: a stale sample (a restart, a slow sidecar) that usage has carried
|
|
629
|
+
// PREPARED_MAP_MAX_GROWTH_PERCENT above the map retires it instead of compacting with it.
|
|
630
|
+
if (attempt.prepared && !attempt.compactInFlight && lastUsedPercentage != null && attempt.mapUsedPercentage !== undefined
|
|
631
|
+
&& lastUsedPercentage - attempt.mapUsedPercentage >= PREPARED_MAP_MAX_GROWTH_PERCENT) {
|
|
632
|
+
this.stopPreparation(input.sessionName, "prepared_map_stale", attempt);
|
|
633
|
+
return { triggered: false, reason: "preparation_stopped" };
|
|
634
|
+
}
|
|
502
635
|
return this.withDeliveryGuard(unsampled, async () => {
|
|
503
636
|
const result = await this.sendPreparedCompact(unsampled, attempt, false);
|
|
504
|
-
return result.ok ? { triggered: true } : { triggered: false, reason: result.reason === "waiting_for_idle" ?
|
|
637
|
+
return result.ok ? { triggered: true } : { triggered: false, reason: result.reason === "waiting_for_idle" || result.reason === PREPARED_AWAITING_WINDOW ? result.reason : "send_failed" };
|
|
505
638
|
});
|
|
506
639
|
}
|
|
507
640
|
terminalPolicyReason(input, actor) {
|
|
@@ -548,9 +681,12 @@ export class ClaudeCompactionEnforcer {
|
|
|
548
681
|
finally {
|
|
549
682
|
// The awaited lifecycle has settled: notice work must not inherit its active lease.
|
|
550
683
|
const lastDelivery = record?.record.lastDelivery;
|
|
551
|
-
|
|
684
|
+
const deliveredUnreadable = lastDelivery?.reason === "delivered_over_unreadable_pane";
|
|
685
|
+
if (record && lastDelivery && lastDelivery !== previous && (lastDelivery.failures >= 2 || deliveredUnreadable) && this.onRestoreDeliveryFailure) {
|
|
552
686
|
void Promise.resolve().then(() => {
|
|
553
|
-
|
|
687
|
+
const current = this.records.get(input.sessionName);
|
|
688
|
+
if ((current !== record && !(deliveredUnreadable && !current && !this.pendingPostCompactRestore.has(input.sessionName)))
|
|
689
|
+
|| record.record.lastDelivery !== lastDelivery || (!deliveredUnreadable && this.pendingPostCompactRestore.get(input.sessionName) !== stage))
|
|
554
690
|
return;
|
|
555
691
|
return this.onRestoreDeliveryFailure({ sessionName: input.sessionName, attemptId: record.record.attemptId, mapPath: record.record.mapPath,
|
|
556
692
|
markerPath: path.join(this.openrigHome, "compaction", "restore-pending", `${sanitizeSessionKey(input.sessionName)}.json`), lastDelivery });
|
|
@@ -569,8 +705,9 @@ export class ClaudeCompactionEnforcer {
|
|
|
569
705
|
const prior = record.record.lastDelivery;
|
|
570
706
|
// Active work is the expected wait between restore steps, not an undeliverable stage.
|
|
571
707
|
const waiting = result.reason === "wait_for_idle_timeout" && result.activity?.state === "running";
|
|
572
|
-
|
|
573
|
-
|
|
708
|
+
const unknownReadinessPolls = !result.ok && result.reason === "target_activity_unknown"
|
|
709
|
+
? (prior?.stage === stage ? prior.unknownReadinessPolls ?? 0 : 0) + 1 : 0;
|
|
710
|
+
// Retain the earlier input-box diagnostic separately from unknown pane readiness.
|
|
574
711
|
const held = result.heldInputBox;
|
|
575
712
|
const unreadable = !result.ok && result.reason === "draft_input_unknown" && held && held !== "typed" && held !== "typed-with-suggestion"
|
|
576
713
|
? (prior && prior.stage === stage ? prior.unreadable ?? 0 : 0) + 1 : 0;
|
|
@@ -580,6 +717,7 @@ export class ClaudeCompactionEnforcer {
|
|
|
580
717
|
...(result.activity ? { activity: { state: result.activity.state, reason: result.activity.reason, evidenceSource: result.activity.evidenceSource } } : {}),
|
|
581
718
|
...(errorClass ? { errorClass } : {}), failures: waiting ? 0 : (prior?.failures ?? 0) + 1,
|
|
582
719
|
...(held ? { inputBox: held } : {}), ...(unreadable ? { unreadable } : {}),
|
|
720
|
+
...(unknownReadinessPolls ? { unknownReadinessPolls } : {}),
|
|
583
721
|
};
|
|
584
722
|
this.persist(session, record.record.attemptId, { lastDelivery });
|
|
585
723
|
}
|
|
@@ -596,19 +734,18 @@ export class ClaudeCompactionEnforcer {
|
|
|
596
734
|
*/
|
|
597
735
|
async drainPendingStage(input, policy) {
|
|
598
736
|
// A missing or still-high sample need not show that /compact has finished. The newest idle
|
|
599
|
-
// hook can predate it
|
|
737
|
+
// hook can predate it: require live readiness, then admit only unknown after two consecutive owed-stage polls.
|
|
600
738
|
const pendingStage = this.pendingPostCompactRestore.get(input.sessionName);
|
|
601
739
|
const attempt = this.pendingPreCompactPrep.get(input.sessionName);
|
|
602
740
|
const isCurrent = () => this.pendingPostCompactRestore.get(input.sessionName) === pendingStage
|
|
603
741
|
&& this.pendingPreCompactPrep.get(input.sessionName) === attempt;
|
|
604
|
-
//
|
|
605
|
-
// Not after a /compact whose result was lost: there an Enter could submit /compact, so that check below stays strict.
|
|
606
|
-
const last = this.records.get(input.sessionName)?.record.lastDelivery;
|
|
607
|
-
const overUnreadable = !this.afterUncertainCompact.has(input.sessionName) && !!last && last.stage === pendingStage && !last.ok
|
|
608
|
-
&& (last.unreadable ?? 0) >= UNREADABLE_POLLS_BEFORE_DELIVERY;
|
|
742
|
+
// Owed input uses the ordinary delivery policy, including the operator's explicit draft protection.
|
|
609
743
|
const sendOpts = {
|
|
610
744
|
openrigNotice: true,
|
|
611
|
-
|
|
745
|
+
allowDraftWhileIdle: true,
|
|
746
|
+
...((this.records.get(input.sessionName)?.record.lastDelivery?.unknownReadinessPolls ?? 0) >= UNKNOWN_READINESS_POLLS_BEFORE_DELIVERY
|
|
747
|
+
? { allowUnknownWhileIdle: true } : {}),
|
|
748
|
+
...(pendingStage === "turn_boundary" && this.afterUncertainCompact.has(input.sessionName) ? { preserveInput: true } : {}),
|
|
612
749
|
beforeWrite: () => {
|
|
613
750
|
if (!isCurrent())
|
|
614
751
|
throw new DeliveryGuardError("compaction_cancelled", "Managed compaction was cancelled or replaced; no further input is authorized.");
|
|
@@ -643,16 +780,16 @@ export class ClaudeCompactionEnforcer {
|
|
|
643
780
|
return { triggered: false, reason: "stale_generation" };
|
|
644
781
|
}
|
|
645
782
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
// holds text or can't be read, the step waits for the next poll, and the notice and --state say why.
|
|
649
|
-
if (this.afterUncertainCompact.has(input.sessionName)) {
|
|
783
|
+
if (pendingStage === "turn_boundary" && this.afterUncertainCompact.has(input.sessionName)) {
|
|
784
|
+
// Only this attempt's possible /compact write is outstanding. A later Enter must not submit it.
|
|
650
785
|
const box = await this.inputBoxStatus(input.sessionName);
|
|
651
786
|
if (!isCurrent())
|
|
652
787
|
return { triggered: false, reason: "preparation_stopped" };
|
|
653
788
|
this.lastInputBox.set(input.sessionName, box);
|
|
654
|
-
if (
|
|
789
|
+
if (box !== "empty" && box !== "likely-suggestion") {
|
|
790
|
+
this.recordRestoreFailure(input.sessionName, pendingStage, this.records.get(input.sessionName), { ok: false, reason: "input_box_not_empty", heldInputBox: box });
|
|
655
791
|
return { triggered: false, reason: "input_box_not_empty" };
|
|
792
|
+
}
|
|
656
793
|
}
|
|
657
794
|
if (pendingStage === "turn_boundary") {
|
|
658
795
|
// Only this first step after /compact reads past the compaction output that fills the screen above the input box.
|
|
@@ -663,6 +800,8 @@ export class ClaudeCompactionEnforcer {
|
|
|
663
800
|
// Busy/never-idle → no delivery, no advance; the SAME stage retries next tick.
|
|
664
801
|
return { triggered: false, reason: "send_failed" };
|
|
665
802
|
}
|
|
803
|
+
this.afterUncertainCompact.delete(input.sessionName);
|
|
804
|
+
this.lastInputBox.delete(input.sessionName);
|
|
666
805
|
this.pendingPostCompactRestore.set(input.sessionName, "restore_prompt");
|
|
667
806
|
this.persistStage(input.sessionName, "restore_prompt", undefined, this.overUnreadableDelivery("turn_boundary", boundary));
|
|
668
807
|
return { triggered: true };
|
|
@@ -724,7 +863,6 @@ export class ClaudeCompactionEnforcer {
|
|
|
724
863
|
this.persistStage(input.sessionName, "done", undefined, this.overUnreadableDelivery("compliance_prompt", compliance));
|
|
725
864
|
this.records.delete(input.sessionName);
|
|
726
865
|
this.afterUncertainCompact.delete(input.sessionName);
|
|
727
|
-
this.lastInputBox.delete(input.sessionName);
|
|
728
866
|
this.restoreCarry.delete(input.sessionName);
|
|
729
867
|
// The attempt is finished, including one stopped after a lost /compact result whose restore this was.
|
|
730
868
|
const finished = this.pendingPreCompactPrep.get(input.sessionName);
|
|
@@ -761,11 +899,37 @@ export class ClaudeCompactionEnforcer {
|
|
|
761
899
|
return { triggered: false, reason: "invalid_policy" };
|
|
762
900
|
}
|
|
763
901
|
this.recoverAfterRestart(input, policy.preparationRoot || null);
|
|
902
|
+
await this.noteEndedPreparation(input, policy);
|
|
764
903
|
// A trigger sample must not block work already owed to this occupant. Restore reads can
|
|
765
904
|
// themselves exceed a low threshold; keep the same stage, authorization and idle gates.
|
|
766
905
|
const drained = await this.drainPendingStage(input, policy);
|
|
767
906
|
if (drained)
|
|
768
907
|
return drained;
|
|
908
|
+
// Another conversation, proved by both sample and attempt naming theirs, ends an armed or held automatic attempt, on a
|
|
909
|
+
// low sample as on a high one, as in the stale-sample drain: the map is of a context that is gone, and a later sample
|
|
910
|
+
// whose conversation reads unknown must not compact with it.
|
|
911
|
+
// A conversation that reads unknown on either side is not a mismatch.
|
|
912
|
+
const armed = this.pendingPreCompactPrep.get(input.sessionName);
|
|
913
|
+
// A request that never went out was made in no conversation: the attempt takes the sample's, and only a request
|
|
914
|
+
// delivered (or possibly delivered) in another conversation stops it.
|
|
915
|
+
if (armed?.mode === "automatic" && armed.status === "sending" && armed.delivery === "not_sent"
|
|
916
|
+
&& !!input.sessionId && armed.sessionId !== input.sessionId) {
|
|
917
|
+
// A replacement moving to another conversation drops the gate it was replacing only when that gate fell in memory on
|
|
918
|
+
// this same sample (endedAttemptGate ran first), so a restart must not bring it back for the new conversation. An
|
|
919
|
+
// ended attempt whose conversation read unknown keeps its gate, and so does the replacement.
|
|
920
|
+
const dropGate = armed.afterEnded !== undefined && !this.lastEnded.has(input.sessionName);
|
|
921
|
+
if (dropGate) {
|
|
922
|
+
armed.afterEnded = undefined;
|
|
923
|
+
armed.afterEndedSessionId = undefined;
|
|
924
|
+
}
|
|
925
|
+
armed.sessionId = input.sessionId;
|
|
926
|
+
this.persist(input.sessionName, armed.attemptId, { sessionId: input.sessionId, ...(dropGate ? { afterEnded: undefined, afterEndedSessionId: undefined } : {}) });
|
|
927
|
+
}
|
|
928
|
+
if (armed?.mode === "automatic" && armed.status === "waiting" && armed.compact === "not_sent" && !armed.compactInFlight
|
|
929
|
+
&& !!armed.sessionId && !!input.sessionId && armed.sessionId !== input.sessionId) {
|
|
930
|
+
this.stopPreparation(input.sessionName, "below_threshold_while_prepared", armed);
|
|
931
|
+
return { triggered: false, reason: "preparation_stopped" };
|
|
932
|
+
}
|
|
769
933
|
if (input.usedPercentage < policy.thresholdPercent) {
|
|
770
934
|
this.triggeredAboveThreshold.delete(input.sessionName);
|
|
771
935
|
const preparation = this.pendingPreCompactPrep.get(input.sessionName);
|
|
@@ -773,8 +937,20 @@ export class ClaudeCompactionEnforcer {
|
|
|
773
937
|
this.pendingPreCompactPrep.delete(input.sessionName);
|
|
774
938
|
// A usage dip is not cancellation: retain an unfinished attempt and its
|
|
775
939
|
// deadline so a later high sample can use its map without another prep.
|
|
940
|
+
// A held attempt ends on a fresh sample below the threshold (#2682): the context already dropped, by Claude Code's own
|
|
941
|
+
// compaction or a person's /compact or /clear, so its map would restore a context that is gone. On any other armed
|
|
942
|
+
// automatic attempt the dip is recorded, and such an attempt is never held later: it stops at its deadline as before.
|
|
943
|
+
if (preparation?.prepared && preparation.status === "waiting" && !preparation.compactInFlight) {
|
|
944
|
+
this.stopPreparation(input.sessionName, "below_threshold_while_prepared", preparation);
|
|
945
|
+
}
|
|
946
|
+
else if (preparation?.mode === "automatic" && preparation.status === "waiting" && preparation.compact === "not_sent"
|
|
947
|
+
&& preparation.belowSince === undefined) {
|
|
948
|
+
preparation.belowSince = this.now();
|
|
949
|
+
this.persist(input.sessionName, preparation.attemptId, { belowSince: preparation.belowSince });
|
|
950
|
+
}
|
|
776
951
|
return { triggered: false, reason: "below_threshold" };
|
|
777
952
|
}
|
|
953
|
+
// A climb back above the threshold keeps the dip's mark (belowSince): the attempt that dipped is never held (#2682).
|
|
778
954
|
// No new automatic compaction while disabled. An already-owed stage above uses
|
|
779
955
|
// drainPendingStage's existing operator-initiated manual exemption.
|
|
780
956
|
if (!policy.enabled) {
|
|
@@ -836,9 +1012,15 @@ export class ClaudeCompactionEnforcer {
|
|
|
836
1012
|
}
|
|
837
1013
|
if (attempt.delivery === "pending" || !this.mapReady(attempt))
|
|
838
1014
|
return { triggered: false, reason: "preparation_pending" };
|
|
1015
|
+
// A held map that usage has outgrown retires; the next idle window prepares afresh (#2682).
|
|
1016
|
+
if (attempt.prepared && attempt.mapUsedPercentage !== undefined
|
|
1017
|
+
&& input.usedPercentage - attempt.mapUsedPercentage >= PREPARED_MAP_MAX_GROWTH_PERCENT) {
|
|
1018
|
+
this.stopPreparation(input.sessionName, "prepared_map_stale", attempt);
|
|
1019
|
+
return { triggered: false, reason: "preparation_stopped" };
|
|
1020
|
+
}
|
|
839
1021
|
const compact = await this.sendPreparedCompact(input, attempt, false);
|
|
840
1022
|
if (!compact.ok)
|
|
841
|
-
return { triggered: false, reason: compact.reason === "waiting_for_idle" ?
|
|
1023
|
+
return { triggered: false, reason: compact.reason === "waiting_for_idle" || compact.reason === PREPARED_AWAITING_WINDOW ? compact.reason : "send_failed" };
|
|
842
1024
|
return { triggered: true };
|
|
843
1025
|
}
|
|
844
1026
|
/**
|
|
@@ -919,7 +1101,7 @@ export class ClaudeCompactionEnforcer {
|
|
|
919
1101
|
if (remaining <= 0)
|
|
920
1102
|
return failed(this.mapReady(attempt) ? "map_complete_seat_never_idle" : "preparation_incomplete");
|
|
921
1103
|
try {
|
|
922
|
-
idle = await this.sessionTransport.waitUntilIdle(input.sessionName, remaining, attempt.controller.signal);
|
|
1104
|
+
idle = await this.sessionTransport.waitUntilIdle(input.sessionName, remaining, attempt.controller.signal, { allowDraft: true });
|
|
923
1105
|
}
|
|
924
1106
|
catch {
|
|
925
1107
|
idle = { ok: false, reason: "transport_unavailable" };
|
|
@@ -971,6 +1153,17 @@ export class ClaudeCompactionEnforcer {
|
|
|
971
1153
|
const stranded = this.stranded.get(input.sessionName);
|
|
972
1154
|
if (stranded)
|
|
973
1155
|
attempt.supersedes = strandedSummary(stranded);
|
|
1156
|
+
if (input.sessionId)
|
|
1157
|
+
attempt.sessionId = input.sessionId;
|
|
1158
|
+
// A manual compaction is explicit and replaces the ended attempt at once. An automatic one keeps the gate until its
|
|
1159
|
+
// request goes out (deliverPreparation).
|
|
1160
|
+
if (mode === "manual")
|
|
1161
|
+
this.lastEnded.delete(input.sessionName);
|
|
1162
|
+
else if (this.lastEnded.has(input.sessionName)) {
|
|
1163
|
+
const ended = this.lastEnded.get(input.sessionName);
|
|
1164
|
+
attempt.afterEnded = ended.endedAt;
|
|
1165
|
+
attempt.afterEndedSessionId = ended.sessionId;
|
|
1166
|
+
}
|
|
974
1167
|
this.pendingPreCompactPrep.set(input.sessionName, attempt);
|
|
975
1168
|
this.stranded.delete(input.sessionName);
|
|
976
1169
|
// A map cannot satisfy an unknown occupant. Keep the failed attempt visible and
|
|
@@ -1044,8 +1237,10 @@ export class ClaudeCompactionEnforcer {
|
|
|
1044
1237
|
}
|
|
1045
1238
|
};
|
|
1046
1239
|
// Preserve maps already published by agents using the older protocol.
|
|
1047
|
-
if (complete(attempt.mapPath))
|
|
1240
|
+
if (complete(attempt.mapPath)) {
|
|
1241
|
+
this.noteMapReady(attempt);
|
|
1048
1242
|
return true;
|
|
1243
|
+
}
|
|
1049
1244
|
const temporary = attempt.mapPath + ".tmp";
|
|
1050
1245
|
if (!complete(temporary))
|
|
1051
1246
|
return false;
|
|
@@ -1059,8 +1254,19 @@ export class ClaudeCompactionEnforcer {
|
|
|
1059
1254
|
return false;
|
|
1060
1255
|
}
|
|
1061
1256
|
}
|
|
1257
|
+
this.noteMapReady(attempt);
|
|
1062
1258
|
return true;
|
|
1063
1259
|
}
|
|
1260
|
+
/** The first time an attempt's map is seen ready, on any path (#2682): a held map's age counts from here. */
|
|
1261
|
+
noteMapReady(attempt) {
|
|
1262
|
+
if (attempt.mapReadyAt !== undefined)
|
|
1263
|
+
return;
|
|
1264
|
+
attempt.mapReadyAt = this.now();
|
|
1265
|
+
for (const [session, current] of this.pendingPreCompactPrep) {
|
|
1266
|
+
if (current === attempt)
|
|
1267
|
+
this.persist(session, attempt.attemptId, { mapReadyAt: attempt.mapReadyAt });
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1064
1270
|
async deliverPreparation(input, attempt) {
|
|
1065
1271
|
if (attempt.sends >= PREP_SEND_ATTEMPTS_MAX) {
|
|
1066
1272
|
this.stopPreparation(input.sessionName, "send_failed");
|
|
@@ -1070,6 +1276,9 @@ export class ClaudeCompactionEnforcer {
|
|
|
1070
1276
|
// Mark waiting BEFORE the await: concurrent polls cannot replay an in-flight delivery.
|
|
1071
1277
|
attempt.status = "waiting";
|
|
1072
1278
|
const policy = this.settingsStore.resolveClaudeCompactionPolicy();
|
|
1279
|
+
// After an ended attempt, the replacement request goes only to a seat the send itself reads idle (a live pane read),
|
|
1280
|
+
// within the /compact send's short wait, so a turn that began after the gate's idle read gets no request (#2682).
|
|
1281
|
+
const idleGate = attempt.afterEnded !== undefined ? { waitForIdleMs: this.compactSendIdleWaitMs + CAPTURE_READABLE_BUDGET_MS, readinessFromPaneOnly: true } : {};
|
|
1073
1282
|
let prep;
|
|
1074
1283
|
let marked = false;
|
|
1075
1284
|
try {
|
|
@@ -1078,7 +1287,7 @@ export class ClaudeCompactionEnforcer {
|
|
|
1078
1287
|
overflowCompactInstruction: composed.instructionInCommand ? null : attempt.compactInstruction,
|
|
1079
1288
|
usedPercentage: input.usedPercentage, thresholdPercent: policy.thresholdPercent,
|
|
1080
1289
|
preCompactInstruction: policy.preCompactInstruction, preparation: attempt, constructedAt: this.now(),
|
|
1081
|
-
}), { openrigNotice: true,
|
|
1290
|
+
}), { openrigNotice: true, allowDraftWhileIdle: true, ...idleGate, beforeWrite: () => {
|
|
1082
1291
|
this.reconcilePreparations();
|
|
1083
1292
|
if (this.pendingPreCompactPrep.get(input.sessionName) !== attempt || attempt.controller.signal.aborted || attempt.status === "stopped")
|
|
1084
1293
|
throw new DeliveryGuardError("preparation_stopped", "This compaction attempt ended before preparation input.");
|
|
@@ -1108,7 +1317,11 @@ export class ClaudeCompactionEnforcer {
|
|
|
1108
1317
|
// Record this attempt's effect even if cancellation/retry happened during the await.
|
|
1109
1318
|
// Neither a failed response nor its loss proves no paste/Enter. Never replay uncertainty.
|
|
1110
1319
|
attempt.delivery = prep?.ok && prep.outcome !== "retained" ? "delivered" : notSent ? "not_sent" : "uncertain";
|
|
1111
|
-
|
|
1320
|
+
attempt.inputBox = prep?.heldInputBoxReading;
|
|
1321
|
+
this.persist(input.sessionName, attempt.attemptId, { delivery: attempt.delivery, sends: attempt.sends, inputBox: attempt.inputBox });
|
|
1322
|
+
// The replacement request went out (or may have): the ended attempt's gate is used up.
|
|
1323
|
+
if (!notSent && attempt.afterEnded !== undefined && this.pendingPreCompactPrep.get(input.sessionName) === attempt)
|
|
1324
|
+
this.lastEnded.delete(input.sessionName);
|
|
1112
1325
|
if (this.pendingPreCompactPrep.get(input.sessionName) !== attempt || attempt.controller.signal.aborted)
|
|
1113
1326
|
return;
|
|
1114
1327
|
if (notSent) {
|
|
@@ -1119,7 +1332,10 @@ export class ClaudeCompactionEnforcer {
|
|
|
1119
1332
|
}
|
|
1120
1333
|
if (attempt.mode === "automatic")
|
|
1121
1334
|
attempt.deadlineAt = this.now() + AUTO_PREP_WAIT_MS_DEFAULT;
|
|
1122
|
-
|
|
1335
|
+
// The usage the map is written at: a held map retires once usage has outgrown it (#2682).
|
|
1336
|
+
if (input.usedPercentage != null)
|
|
1337
|
+
attempt.mapUsedPercentage = input.usedPercentage;
|
|
1338
|
+
this.persist(input.sessionName, attempt.attemptId, { deadlineAt: attempt.deadlineAt, mapUsedPercentage: attempt.mapUsedPercentage });
|
|
1123
1339
|
this.reconcilePreparations();
|
|
1124
1340
|
}
|
|
1125
1341
|
async sendPreparedCompact(input, attempt, skipMap) {
|
|
@@ -1147,15 +1363,18 @@ export class ClaudeCompactionEnforcer {
|
|
|
1147
1363
|
check();
|
|
1148
1364
|
if (!marked) {
|
|
1149
1365
|
marked = true;
|
|
1366
|
+
attempt.compactInFlight = true;
|
|
1150
1367
|
this.persist(input.sessionName, attempt.attemptId, { compactSending: true, restoreCarry: carry, operatorInitiated });
|
|
1151
1368
|
}
|
|
1152
1369
|
};
|
|
1153
1370
|
const send = async () => {
|
|
1154
1371
|
check();
|
|
1155
1372
|
// Both paths send only to an idle seat. Include the readable observation's budget in the wait,
|
|
1156
|
-
// still bounded by the attempt's existing deadline
|
|
1373
|
+
// still bounded by the attempt's existing deadline, except for a held attempt: its deadline has no effect
|
|
1374
|
+
// any more, and a capped wait would discard every idle read that ends after it, so the window would never open.
|
|
1157
1375
|
// Idle comes from a live pane read: the newest hook can predate the rest of the preparation turn.
|
|
1158
|
-
|
|
1376
|
+
const idleWait = this.compactSendIdleWaitMs + CAPTURE_READABLE_BUDGET_MS;
|
|
1377
|
+
return this.sessionTransport.send(input.sessionName, composed.command, { openrigNotice: true, allowDraftWhileIdle: true, beforeWrite, ...(attempt.deadlineAt !== null ? { waitForIdleMs: attempt.prepared ? idleWait : Math.max(1, Math.min(idleWait, this.compactDeadline(attempt) - this.now())), readinessFromPaneOnly: true } : {}) });
|
|
1159
1378
|
};
|
|
1160
1379
|
let result;
|
|
1161
1380
|
let guardRefused = false;
|
|
@@ -1171,6 +1390,9 @@ export class ClaudeCompactionEnforcer {
|
|
|
1171
1390
|
result = { ok: false, reason: error instanceof DeliveryGuardError ? error.code : "delivery_uncertain",
|
|
1172
1391
|
...(written ? { sent: true, inputPhase: "written" } : attempted ? { inputPhase: "attempted" } : {}) };
|
|
1173
1392
|
}
|
|
1393
|
+
finally {
|
|
1394
|
+
delete attempt.compactInFlight;
|
|
1395
|
+
}
|
|
1174
1396
|
if (!result.ok || result.outcome === "retained") {
|
|
1175
1397
|
const phase = result.inputPhase;
|
|
1176
1398
|
// A write that was issued, or text already in the input, is never "nothing sent".
|
|
@@ -1180,11 +1402,20 @@ export class ClaudeCompactionEnforcer {
|
|
|
1180
1402
|
const notSent = !writeAttempted && (guardRefused || result.outcome === "retained" || result.sent === false);
|
|
1181
1403
|
if (notSent && marked)
|
|
1182
1404
|
this.persist(input.sessionName, attempt.attemptId, { compactSending: undefined });
|
|
1405
|
+
// A completed map whose /compact was refused before any input, for a window that isn't open yet, is held with the
|
|
1406
|
+
// same map instead of stopped and asked for again after the retry cooldown (#2682).
|
|
1407
|
+
// Explicit global draft refusal is reported by the idle preflight, before a draft_* input exception.
|
|
1408
|
+
const policyDraftHold = result.reason === "target_needs_input" && result.activity?.reason === "prompt_draft"
|
|
1409
|
+
&& result.activity.evidenceSource === "pane_heuristic" && (result.heldInputBox === "typed" || result.heldInputBox === "typed-with-suggestion");
|
|
1410
|
+
const windowReason = policyDraftHold ? "draft_input_busy" : result.reason;
|
|
1411
|
+
if (notSent && typeof windowReason === "string" && HOLD_REASONS.has(windowReason) && this.holdPrepared(input.sessionName, attempt, windowReason)) {
|
|
1412
|
+
return { ok: false, reason: PREPARED_AWAITING_WINDOW };
|
|
1413
|
+
}
|
|
1183
1414
|
// Only a known pre-input idle deferral keeps the automatic attempt armed for a later poll; the transport
|
|
1184
1415
|
// marks those `not_reached`. Reconciliation still bounds the idle grace and stops on an occupant change.
|
|
1185
1416
|
// A typing-guard draft hold (`draft_*`) is `not_reached` too, but it is a refusal, not an idle wait: it stops
|
|
1186
1417
|
// as not sent, and a fresh attempt may begin after the retry cooldown.
|
|
1187
|
-
const draftHold = typeof result.reason === "string" && result.reason.startsWith("draft_");
|
|
1418
|
+
const draftHold = policyDraftHold || (typeof result.reason === "string" && result.reason.startsWith("draft_"));
|
|
1188
1419
|
if (attempt.mode === "automatic" && attempt.status === "waiting" && notSent && phase === "not_reached" && !draftHold) {
|
|
1189
1420
|
return { ok: false, reason: "waiting_for_idle" };
|
|
1190
1421
|
}
|
|
@@ -1209,12 +1440,11 @@ export class ClaudeCompactionEnforcer {
|
|
|
1209
1440
|
this.persist(input.sessionName, attempt.attemptId, { phase: "turn_boundary", restoreCarry: carry, operatorInitiated });
|
|
1210
1441
|
return { ok: true };
|
|
1211
1442
|
}
|
|
1212
|
-
/**
|
|
1213
|
-
* why it couldn't be read. Never throws. */
|
|
1443
|
+
/** Reconcile this attempt's possible write using the existing capture path. Unknown is not a resolved write. */
|
|
1214
1444
|
async inputBoxStatus(sessionName) {
|
|
1215
1445
|
try {
|
|
1216
1446
|
const capture = await this.sessionTransport.capture(sessionName, { inputBox: true, readable: { width: 120, height: 40 } });
|
|
1217
|
-
return capture.inputBox?.status ??
|
|
1447
|
+
return capture.inputBox?.status ?? "unknown";
|
|
1218
1448
|
}
|
|
1219
1449
|
catch {
|
|
1220
1450
|
return "unknown";
|
|
@@ -1229,25 +1459,17 @@ export class ClaudeCompactionEnforcer {
|
|
|
1229
1459
|
this.restoreCarry.delete(sessionName);
|
|
1230
1460
|
this.lastAutoCompactAt.set(sessionName, this.now());
|
|
1231
1461
|
this.triggeredAboveThreshold.add(sessionName);
|
|
1462
|
+
this.lastEnded.delete(sessionName);
|
|
1232
1463
|
this.pendingPostCompactRestore.set(sessionName, "turn_boundary");
|
|
1233
1464
|
this.pendingStageGeneration.set(sessionName, attempt.occupantGeneration);
|
|
1234
1465
|
}
|
|
1235
|
-
/** The map the restore request names. With --skip-map: a map the seat completed
|
|
1236
|
-
*
|
|
1237
|
-
* the final path is checked first, then the .tmp, and whichever ends with the marker is named. */
|
|
1466
|
+
/** The map the restore request names. With --skip-map: a map the seat completed anyway (`completedSkippedMap`),
|
|
1467
|
+
* or a plain statement that none was required. */
|
|
1238
1468
|
restoreMapFields(sessionName) {
|
|
1239
1469
|
const carry = this.restoreCarry.get(sessionName);
|
|
1240
1470
|
if (!carry?.skipMap)
|
|
1241
1471
|
return { attemptMapPath: carry?.mapPath ?? null, noMapRequired: false };
|
|
1242
|
-
const
|
|
1243
|
-
const completed = [mapPath, `${mapPath}.tmp`].find((file) => {
|
|
1244
|
-
try {
|
|
1245
|
-
return fs.readFileSync(file, "utf8").trimEnd().endsWith(marker);
|
|
1246
|
-
}
|
|
1247
|
-
catch {
|
|
1248
|
-
return false;
|
|
1249
|
-
}
|
|
1250
|
-
});
|
|
1472
|
+
const completed = completedSkippedMap(carry.skipMap);
|
|
1251
1473
|
return completed ? { attemptMapPath: completed, noMapRequired: false } : { attemptMapPath: null, noMapRequired: true };
|
|
1252
1474
|
}
|
|
1253
1475
|
/** Reuse the retry interval a new automatic preparation would otherwise wait through. The original deadline stays
|
|
@@ -1270,20 +1492,52 @@ export class ClaudeCompactionEnforcer {
|
|
|
1270
1492
|
this.stopPreparation(session, "stale_generation");
|
|
1271
1493
|
else if (!enabled && (attempt.mode === "automatic" || attempt.policyWasEnabled))
|
|
1272
1494
|
this.stopPreparation(session, "disabled");
|
|
1273
|
-
|
|
1274
|
-
|
|
1495
|
+
// A held map that stopped reading ready (its file or marker gone) stops the attempt (#2682).
|
|
1496
|
+
else if (attempt.prepared && !attempt.compactInFlight && !this.mapReady(attempt))
|
|
1497
|
+
this.stopPreparation(session, "preparation_incomplete");
|
|
1498
|
+
// A held map retires after a long while; a /compact already being written is never stopped (#2682).
|
|
1499
|
+
else if (attempt.prepared && !attempt.compactInFlight && this.now() - (attempt.mapReadyAt ?? attempt.preparedAt ?? this.now()) >= PREPARED_MAP_MAX_AGE_MS) {
|
|
1500
|
+
this.stopPreparation(session, "prepared_map_stale");
|
|
1501
|
+
}
|
|
1502
|
+
// A held attempt's deadline has no effect: it ends only as above, on a fresh dip, a stale map or a cancel (#2682).
|
|
1503
|
+
else if (!attempt.prepared && attempt.deadlineAt !== null && this.now() >= this.compactDeadline(attempt)) {
|
|
1504
|
+
const ready = this.mapReady(attempt);
|
|
1505
|
+
if (!(ready && this.holdPrepared(session, attempt, "map_complete_seat_never_idle"))) {
|
|
1506
|
+
this.stopPreparation(session, ready ? "map_complete_seat_never_idle" : "preparation_incomplete");
|
|
1507
|
+
}
|
|
1275
1508
|
}
|
|
1276
1509
|
if (enabled)
|
|
1277
1510
|
attempt.policyWasEnabled = true;
|
|
1278
1511
|
}
|
|
1279
1512
|
}
|
|
1513
|
+
/** Hold an automatic attempt whose map is complete until a window opens, instead of stopping it (#2682). Only the
|
|
1514
|
+
* attempt that is current, armed and untouched: never one cancelled, stopped, manual, or with a /compact sent or in
|
|
1515
|
+
* flight. It keeps its controller, map and deadline, and is persisted only on the transition. */
|
|
1516
|
+
holdPrepared(session, attempt, reason) {
|
|
1517
|
+
if (attempt.mode !== "automatic" || attempt.status !== "waiting" || attempt.compact !== "not_sent" || attempt.compactInFlight
|
|
1518
|
+
|| attempt.controller.signal.aborted || attempt.cancelled || attempt.reason !== undefined || attempt.belowSince !== undefined
|
|
1519
|
+
|| this.pendingPreCompactPrep.get(session) !== attempt || !this.mapReady(attempt))
|
|
1520
|
+
return false;
|
|
1521
|
+
if (!attempt.prepared) {
|
|
1522
|
+
attempt.prepared = true;
|
|
1523
|
+
attempt.preparedAt = this.now();
|
|
1524
|
+
attempt.preparedReason = reason;
|
|
1525
|
+
this.persist(session, attempt.attemptId, { prepared: true, preparedAt: attempt.preparedAt, preparedReason: reason });
|
|
1526
|
+
}
|
|
1527
|
+
return true;
|
|
1528
|
+
}
|
|
1280
1529
|
/** Start the record for a new attempt, beside its map. */
|
|
1281
1530
|
startRecord(sessionName, attempt) {
|
|
1531
|
+
const previous = this.records.get(sessionName)?.record;
|
|
1532
|
+
const preparationFailures = attempt.mode === "automatic" && previous?.occupantGeneration === attempt.occupantGeneration
|
|
1533
|
+
? previous?.preparationFailures : undefined;
|
|
1282
1534
|
this.records.set(sessionName, { file: path.join(path.dirname(attempt.mapPath), COMPACTION_RECORD_FILE), record: {
|
|
1283
1535
|
daemon: this.daemonInstance, attemptId: attempt.attemptId, session: sessionName, occupantGeneration: attempt.occupantGeneration, mode: attempt.mode,
|
|
1284
|
-
phase: "preparing", delivery: attempt.delivery, deadlineAt: attempt.deadlineAt, sends: attempt.sends,
|
|
1536
|
+
phase: "preparing", delivery: attempt.delivery, deadlineAt: attempt.deadlineAt, sends: attempt.sends, preparationFailures,
|
|
1285
1537
|
mapPath: attempt.mapPath, marker: attempt.marker, compactInstruction: attempt.compactInstruction,
|
|
1286
|
-
preparationRoot: attempt.preparationRoot,
|
|
1538
|
+
preparationRoot: attempt.preparationRoot, ...(attempt.sessionId ? { sessionId: attempt.sessionId } : {}),
|
|
1539
|
+
...(attempt.afterEnded !== undefined ? { afterEnded: attempt.afterEnded, afterEndedSessionId: attempt.afterEndedSessionId ?? null } : {}),
|
|
1540
|
+
updatedAt: this.now(),
|
|
1287
1541
|
} });
|
|
1288
1542
|
this.persist(sessionName, attempt.attemptId, {});
|
|
1289
1543
|
}
|
|
@@ -1311,8 +1565,11 @@ export class ClaudeCompactionEnforcer {
|
|
|
1311
1565
|
if (current)
|
|
1312
1566
|
this.persist(sessionName, current.record.attemptId, { phase, ...(reason !== undefined ? { reason } : {}), lastDelivery });
|
|
1313
1567
|
}
|
|
1314
|
-
/**
|
|
1568
|
+
/** An unreadable pane or input box stays explicit on the delivered step; any other advance clears it. */
|
|
1315
1569
|
overUnreadableDelivery(stage, result) {
|
|
1570
|
+
if (result.activity?.state === "unknown")
|
|
1571
|
+
return { stage, at: new Date(this.now()).toISOString(), ok: true,
|
|
1572
|
+
reason: "delivered_over_unreadable_pane", activity: { state: "unknown", reason: result.activity.reason, evidenceSource: result.activity.evidenceSource }, failures: 0 };
|
|
1316
1573
|
return result.pastedOverInputBox ? { stage, at: new Date(this.now()).toISOString(), ok: true,
|
|
1317
1574
|
reason: "delivered_over_unreadable_input_box", inputBox: result.pastedOverInputBox, failures: 0 } : undefined;
|
|
1318
1575
|
}
|
|
@@ -1362,19 +1619,48 @@ export class ClaudeCompactionEnforcer {
|
|
|
1362
1619
|
return;
|
|
1363
1620
|
const { record } = newest;
|
|
1364
1621
|
// This process's own record (another enforcer in it) is live state, not a predecessor's.
|
|
1365
|
-
if (record.daemon === this.daemonInstance || record.phase === "done"
|
|
1622
|
+
if (record.daemon === this.daemonInstance || record.phase === "done")
|
|
1366
1623
|
return;
|
|
1367
1624
|
const live = this.resolveOccupantGeneration?.(session) ?? this.sessionTransport.deliveryGuard?.maybeTarget(session)?.occupant ?? null;
|
|
1625
|
+
if (record.phase === "ended") {
|
|
1626
|
+
if (record.occupantGeneration !== null && live === record.occupantGeneration
|
|
1627
|
+
&& this.now() - (record.endedAt ?? record.updatedAt) < this.restartRecoveryWindowMs)
|
|
1628
|
+
this.records.set(session, newest);
|
|
1629
|
+
// An ended automatic attempt of this occupant whose request was delivered and whose /compact was never sent keeps a
|
|
1630
|
+
// busy seat from a fresh request (#2682), as in memory. Only a stop writes endedAt; a /compact that was sent (and then
|
|
1631
|
+
// cancelled) never stopped, and one whose result was lost is marked uncertainCompact.
|
|
1632
|
+
const endedAt = record.endedAt;
|
|
1633
|
+
if (endedAt !== undefined && !record.uncertainCompact && !record.compactSending
|
|
1634
|
+
&& record.mode === "automatic" && (record.delivery === "delivered" || record.delivery === "uncertain")
|
|
1635
|
+
// An occupant that reads unknown at this first look keeps the record, inert: the gate compares the generation once
|
|
1636
|
+
// it can be read, and a different occupant then discards it.
|
|
1637
|
+
&& record.occupantGeneration !== null && (live === null || live === record.occupantGeneration)
|
|
1638
|
+
&& this.now() - endedAt < this.restartRecoveryWindowMs)
|
|
1639
|
+
this.lastEnded.set(session, { endedAt, occupantGeneration: record.occupantGeneration, sessionId: record.sessionId ?? null });
|
|
1640
|
+
// A replacement that stopped with its request never sent keeps the gate of the attempt it replaced, as in memory and
|
|
1641
|
+
// as a replacement still preparing does below.
|
|
1642
|
+
else if (record.mode === "automatic" && record.afterEnded !== undefined && record.delivery === "not_sent"
|
|
1643
|
+
&& record.occupantGeneration !== null && (live === null || live === record.occupantGeneration)
|
|
1644
|
+
&& this.now() - record.afterEnded < this.restartRecoveryWindowMs) {
|
|
1645
|
+
this.lastEnded.set(session, { endedAt: record.afterEnded, occupantGeneration: record.occupantGeneration, sessionId: record.afterEndedSessionId ?? null });
|
|
1646
|
+
}
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1368
1649
|
if (record.occupantGeneration !== null && live !== null && live !== record.occupantGeneration)
|
|
1369
1650
|
return;
|
|
1370
1651
|
const stale = this.now() - record.updatedAt > this.restartRecoveryWindowMs;
|
|
1371
1652
|
// A /compact whose send had begun, or whose outcome was lost, is never sent again; its restore steps are owed in case it
|
|
1372
|
-
// ran
|
|
1653
|
+
// ran. Only the first step reconciles that possible write; later input follows ordinary delivery settings.
|
|
1373
1654
|
const phase = (record.phase === "preparing" && record.compactSending) || record.phase === "compact_uncertain" ? "turn_boundary" : record.phase;
|
|
1374
1655
|
const inFlight = phase !== record.phase;
|
|
1375
1656
|
if (phase === "preparing") {
|
|
1376
|
-
|
|
1377
|
-
|
|
1657
|
+
// Its preparation deadline passed long ago; a fresh attempt may begin. A held attempt of this same occupant has no
|
|
1658
|
+
// deadline that matters: it is picked up as it was, however old, and the reconcile below retires its map once it is
|
|
1659
|
+
// too old (#2682). One whose context dropped before it was held never comes back held.
|
|
1660
|
+
const held = record.prepared === true && record.mode === "automatic" && record.deadlineAt !== null && record.belowSince === undefined;
|
|
1661
|
+
const heldHere = held && record.occupantGeneration !== null && live === record.occupantGeneration;
|
|
1662
|
+
if (stale && !heldHere)
|
|
1663
|
+
return;
|
|
1378
1664
|
this.records.set(session, newest);
|
|
1379
1665
|
this.pendingPreCompactPrep.set(session, {
|
|
1380
1666
|
policyActor: { source: "openrig" }, attemptId: record.attemptId, occupantGeneration: record.occupantGeneration,
|
|
@@ -1384,10 +1670,25 @@ export class ClaudeCompactionEnforcer {
|
|
|
1384
1670
|
compact: "not_sent", sends: record.sends,
|
|
1385
1671
|
deadlineAt: record.deadlineAt ?? (record.delivery === "not_sent" ? null : record.updatedAt + AUTO_PREP_WAIT_MS_DEFAULT),
|
|
1386
1672
|
policyWasEnabled: true, preparationRoot: record.preparationRoot, controller: new AbortController(),
|
|
1387
|
-
compactInstruction: record.compactInstruction,
|
|
1673
|
+
compactInstruction: record.compactInstruction, inputBox: record.inputBox,
|
|
1674
|
+
// A held attempt comes back held, with its recorded hold (never stamped again) and its map's age and usage.
|
|
1675
|
+
...(held ? { prepared: true, preparedAt: record.preparedAt ?? record.updatedAt, preparedReason: record.preparedReason ?? "map_complete_seat_never_idle" } : {}),
|
|
1676
|
+
...(held ? { mapReadyAt: record.mapReadyAt ?? record.preparedAt ?? record.updatedAt } : record.mapReadyAt !== undefined ? { mapReadyAt: record.mapReadyAt } : {}),
|
|
1677
|
+
...(record.mapUsedPercentage !== undefined ? { mapUsedPercentage: record.mapUsedPercentage } : {}),
|
|
1678
|
+
...(record.sessionId !== undefined ? { sessionId: record.sessionId } : {}),
|
|
1679
|
+
...(record.mode === "automatic" && record.belowSince !== undefined ? { belowSince: record.belowSince } : {}),
|
|
1680
|
+
...(record.mode === "automatic" && record.afterEnded !== undefined ? { afterEnded: record.afterEnded, afterEndedSessionId: record.afterEndedSessionId ?? null } : {}),
|
|
1388
1681
|
});
|
|
1682
|
+
// A replacement whose request never went out keeps the ended attempt's gate, as in memory.
|
|
1683
|
+
if (record.mode === "automatic" && record.afterEnded !== undefined && record.delivery === "not_sent" && record.occupantGeneration !== null
|
|
1684
|
+
&& this.now() - record.afterEnded < this.restartRecoveryWindowMs) {
|
|
1685
|
+
this.lastEnded.set(session, { endedAt: record.afterEnded, occupantGeneration: record.occupantGeneration, sessionId: record.afterEndedSessionId ?? null });
|
|
1686
|
+
}
|
|
1389
1687
|
if (record.mode === "manual")
|
|
1390
1688
|
this.stopPreparation(session, "daemon_restarted");
|
|
1689
|
+
// A held map of any age is checked at once, without waiting for a send's checks (#2682).
|
|
1690
|
+
else
|
|
1691
|
+
this.reconcilePreparations();
|
|
1391
1692
|
return;
|
|
1392
1693
|
}
|
|
1393
1694
|
if (stale) {
|
|
@@ -1398,7 +1699,8 @@ export class ClaudeCompactionEnforcer {
|
|
|
1398
1699
|
this.pendingPostCompactRestore.set(session, phase);
|
|
1399
1700
|
this.pendingStageGeneration.set(session, record.occupantGeneration);
|
|
1400
1701
|
if (inFlight || record.uncertainCompact) {
|
|
1401
|
-
|
|
1702
|
+
if (phase === "turn_boundary")
|
|
1703
|
+
this.afterUncertainCompact.add(session);
|
|
1402
1704
|
this.persist(session, record.attemptId, { uncertainCompact: true });
|
|
1403
1705
|
}
|
|
1404
1706
|
if (record.restoreCarry)
|
|
@@ -1410,6 +1712,49 @@ export class ClaudeCompactionEnforcer {
|
|
|
1410
1712
|
this.setManualStage(session, phase === "compliance_prompt" ? "restore-sent" : "compact-sent", undefined, record.operatorInitiated);
|
|
1411
1713
|
}
|
|
1412
1714
|
}
|
|
1715
|
+
/** Count ended attempts, never individual send calls. The current attempt record carries the run across restarts. */
|
|
1716
|
+
async noteEndedPreparation(input, policy) {
|
|
1717
|
+
const current = this.records.get(input.sessionName);
|
|
1718
|
+
if (!current)
|
|
1719
|
+
return;
|
|
1720
|
+
const r = current.record, generation = this.liveGeneration(input.sessionName);
|
|
1721
|
+
const interrupted = this.pendingPreCompactPrep.get(input.sessionName)?.cancelled || !policy.enabled || input.usedPercentage == null || input.usedPercentage < policy.thresholdPercent
|
|
1722
|
+
|| r.mode !== "automatic" || generation === null || generation !== r.occupantGeneration
|
|
1723
|
+
|| (r.sessionId && input.sessionId && r.sessionId !== input.sessionId)
|
|
1724
|
+
|| r.delivery !== "not_sent" || r.belowSince !== undefined || r.compactSending || r.uncertainCompact
|
|
1725
|
+
|| ["preparation_cancelled", "preparation_replaced", "stale_generation", "disabled", "daemon_restarted",
|
|
1726
|
+
"below_threshold_while_prepared", "prepared_map_stale", "occupant_generation_unavailable"].includes(r.reason ?? "");
|
|
1727
|
+
if (interrupted) {
|
|
1728
|
+
if (r.preparationFailures)
|
|
1729
|
+
this.persist(input.sessionName, r.attemptId, { preparationFailures: undefined });
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
if (r.phase !== "ended" || r.endedAt === undefined || r.sends === 0)
|
|
1733
|
+
return;
|
|
1734
|
+
const old = r.preparationFailures;
|
|
1735
|
+
const run = old && Number.isSafeInteger(old.endedAttempts) && old.endedAttempts >= 0
|
|
1736
|
+
&& typeof old.lastAttemptId === "string" && (old.sessionId === null || typeof old.sessionId === "string")
|
|
1737
|
+
&& old.occupantGeneration === generation
|
|
1738
|
+
&& (!old.sessionId || !input.sessionId || old.sessionId === input.sessionId) ? old
|
|
1739
|
+
: { occupantGeneration: generation, sessionId: input.sessionId ?? null, endedAttempts: 0, lastAttemptId: "" };
|
|
1740
|
+
if (run.lastAttemptId !== r.attemptId) {
|
|
1741
|
+
run.lastAttemptId = r.attemptId;
|
|
1742
|
+
run.endedAttempts++;
|
|
1743
|
+
this.persist(input.sessionName, r.attemptId, { preparationFailures: run });
|
|
1744
|
+
}
|
|
1745
|
+
if (run.endedAttempts < 3 || run.reportedAttempts === run.endedAttempts || !this.onPreparationFailure)
|
|
1746
|
+
return;
|
|
1747
|
+
try {
|
|
1748
|
+
await this.onPreparationFailure({ sessionName: input.sessionName, occupantGeneration: generation,
|
|
1749
|
+
attemptId: r.attemptId, mapPath: r.mapPath, statePath: current.file, endedAttempts: run.endedAttempts,
|
|
1750
|
+
reason: r.reason ?? "send_failed", ...(r.inputBox ? { inputBox: r.inputBox } : {}) });
|
|
1751
|
+
if (this.records.get(input.sessionName) === current && current.record.preparationFailures === run) {
|
|
1752
|
+
run.reportedAttempts = run.endedAttempts;
|
|
1753
|
+
this.persist(input.sessionName, r.attemptId, { preparationFailures: run });
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
catch { /* The same diagnostic stays eligible on existing polls; no input effect or new scheduler. */ }
|
|
1757
|
+
}
|
|
1413
1758
|
stopPreparation(session, reason, expected) {
|
|
1414
1759
|
const attempt = this.pendingPreCompactPrep.get(session);
|
|
1415
1760
|
if ((expected && expected !== attempt) || !attempt || attempt.status === "stopped" || attempt.status === "compact-sent")
|
|
@@ -1418,7 +1763,14 @@ export class ClaudeCompactionEnforcer {
|
|
|
1418
1763
|
attempt.reason = reason;
|
|
1419
1764
|
attempt.stoppedAt = this.now();
|
|
1420
1765
|
attempt.controller.abort();
|
|
1421
|
-
|
|
1766
|
+
// A stopped attempt is no longer held (#2682).
|
|
1767
|
+
const wasPrepared = attempt.prepared === true;
|
|
1768
|
+
delete attempt.prepared;
|
|
1769
|
+
this.persist(session, attempt.attemptId, { phase: attempt.compact === "uncertain" ? "compact_uncertain" : "ended", reason, endedAt: attempt.stoppedAt,
|
|
1770
|
+
...(wasPrepared ? { prepared: undefined } : {}) });
|
|
1771
|
+
if (attempt.mode === "automatic" && (attempt.delivery === "delivered" || attempt.delivery === "uncertain") && attempt.compact === "not_sent") {
|
|
1772
|
+
this.lastEnded.set(session, { endedAt: attempt.stoppedAt, occupantGeneration: attempt.occupantGeneration, sessionId: attempt.sessionId ?? null });
|
|
1773
|
+
}
|
|
1422
1774
|
if (attempt.mode === "manual")
|
|
1423
1775
|
this.setManualStage(session, "skipped-or-failed", reason);
|
|
1424
1776
|
}
|
|
@@ -1426,6 +1778,10 @@ export class ClaudeCompactionEnforcer {
|
|
|
1426
1778
|
const attempt = this.pendingPreCompactPrep.get(session);
|
|
1427
1779
|
if (attempt)
|
|
1428
1780
|
attempt.cancelled = true;
|
|
1781
|
+
const record = this.records.get(session)?.record;
|
|
1782
|
+
if (record)
|
|
1783
|
+
this.persist(session, record.attemptId, { preparationFailures: undefined,
|
|
1784
|
+
...(!attempt && record.phase === "ended" ? { reason: "preparation_cancelled" } : {}) });
|
|
1429
1785
|
if (attempt?.status === "compact-sent" || this.pendingPostCompactRestore.has(session)) {
|
|
1430
1786
|
// Abandon management, not the provider command: keep its unconfirmed receipt and map.
|
|
1431
1787
|
// Do not clear automatic dedup/re-arm state or send any input. A later explicit retry
|
|
@@ -1456,8 +1812,9 @@ export class ClaudeCompactionEnforcer {
|
|
|
1456
1812
|
const attempt = this.pendingPreCompactPrep.get(session);
|
|
1457
1813
|
if (!attempt)
|
|
1458
1814
|
return null;
|
|
1459
|
-
const { controller: _controller, sends: _sends, policyWasEnabled: _enabled, preparationRoot: _preparationRoot, compactInstruction: _instruction, stoppedAt: _stoppedAt, cancelled: _cancelled, ...state } = attempt;
|
|
1460
|
-
|
|
1815
|
+
const { controller: _controller, sends: _sends, policyWasEnabled: _enabled, preparationRoot: _preparationRoot, compactInstruction: _instruction, stoppedAt: _stoppedAt, cancelled: _cancelled, belowSince: _belowSince, compactInFlight: _inFlight, sessionId: _sessionId, afterEnded: _afterEnded, afterEndedSessionId: _afterEndedSessionId, ...state } = attempt;
|
|
1816
|
+
// A held attempt has no idle deadline left to show: it waits for its window.
|
|
1817
|
+
return { ...state, ...(attempt.mode === "automatic" && !attempt.prepared && attempt.deadlineAt !== null && this.mapReady(attempt)
|
|
1461
1818
|
? { idleDeadlineAt: this.compactDeadline(attempt) } : {}) };
|
|
1462
1819
|
}
|
|
1463
1820
|
/** OPR.0.4.3.14 — read the surfaced manual-trigger state for a seat (AC-3). */
|
|
@@ -1474,6 +1831,7 @@ export class ClaudeCompactionEnforcer {
|
|
|
1474
1831
|
*/
|
|
1475
1832
|
invalidateOccupant(sessionName) {
|
|
1476
1833
|
this.stopPreparation(sessionName, "stale_generation");
|
|
1834
|
+
this.lastEnded.delete(sessionName);
|
|
1477
1835
|
this.persistStage(sessionName, "ended");
|
|
1478
1836
|
this.records.delete(sessionName);
|
|
1479
1837
|
this.stranded.delete(sessionName);
|