@openrig/cli 0.7.17 → 0.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/plugin.json +1 -1
- 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/refocus.cjs +5 -0
- package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +23 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +11 -0
- package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +25 -5
- package/daemon/assets/skills/rigs/SKILL.md +33 -19
- package/daemon/assets/skills/rigs/references/installing-for-someone.md +2 -2
- 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 +42 -8
- package/daemon/context-packs/reference/getting-started.md +4 -4
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +166 -0
- package/daemon/context-packs/reference/whats-new.md +107 -6
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/SKILL.md +23 -0
- 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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/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 +11 -0
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +25 -5
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +16 -5
- 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 +13 -5
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
- package/daemon/dist/adapters/kernel-authority.js +22 -10
- package/daemon/dist/adapters/kernel-authority.js.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.d.ts +43 -0
- package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts +50 -1
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +463 -13
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/tmux-credential-env.d.ts +4 -0
- package/daemon/dist/adapters/tmux-credential-env.d.ts.map +1 -0
- package/daemon/dist/adapters/tmux-credential-env.js +14 -0
- package/daemon/dist/adapters/tmux-credential-env.js.map +1 -0
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +4 -3
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/adapters/tmux-server.d.ts +2 -2
- package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-server.js +12 -4
- package/daemon/dist/adapters/tmux-server.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +220 -12
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +835 -29
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/attention-surface.d.ts +4 -1
- 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 +8 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/171_claude_auto_mode.d.ts +4 -0
- package/daemon/dist/db/migrations/171_claude_auto_mode.d.ts.map +1 -0
- package/daemon/dist/db/migrations/171_claude_auto_mode.js +9 -0
- package/daemon/dist/db/migrations/171_claude_auto_mode.js.map +1 -0
- package/daemon/dist/db/migrations/171_node_input_route.d.ts +4 -0
- package/daemon/dist/db/migrations/171_node_input_route.d.ts.map +1 -0
- package/daemon/dist/db/migrations/171_node_input_route.js +6 -0
- package/daemon/dist/db/migrations/171_node_input_route.js.map +1 -0
- package/daemon/dist/db/migrations/172_queue_return_route.d.ts +3 -0
- package/daemon/dist/db/migrations/172_queue_return_route.d.ts.map +1 -0
- package/daemon/dist/db/migrations/172_queue_return_route.js +13 -0
- package/daemon/dist/db/migrations/172_queue_return_route.js.map +1 -0
- package/daemon/dist/db/migrations/173_node_process_limits.d.ts +4 -0
- package/daemon/dist/db/migrations/173_node_process_limits.d.ts.map +1 -0
- package/daemon/dist/db/migrations/173_node_process_limits.js +6 -0
- package/daemon/dist/db/migrations/173_node_process_limits.js.map +1 -0
- package/daemon/dist/domain/activity-grants.d.ts.map +1 -1
- package/daemon/dist/domain/activity-grants.js +2 -0
- package/daemon/dist/domain/activity-grants.js.map +1 -1
- package/daemon/dist/domain/agent-activity-store.d.ts +36 -1
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +192 -3
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts +10 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts.map +1 -1
- package/daemon/dist/domain/agent-images/resume-token-discovery.js +21 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
- package/daemon/dist/domain/applied-launch-observation-store.d.ts +5 -0
- package/daemon/dist/domain/applied-launch-observation-store.d.ts.map +1 -1
- package/daemon/dist/domain/applied-launch-observation-store.js +57 -21
- package/daemon/dist/domain/applied-launch-observation-store.js.map +1 -1
- package/daemon/dist/domain/builtin-startup-files.d.ts +26 -12
- package/daemon/dist/domain/builtin-startup-files.d.ts.map +1 -1
- package/daemon/dist/domain/builtin-startup-files.js +73 -34
- package/daemon/dist/domain/builtin-startup-files.js.map +1 -1
- package/daemon/dist/domain/claude-auto-mode.d.ts +64 -0
- package/daemon/dist/domain/claude-auto-mode.d.ts.map +1 -0
- package/daemon/dist/domain/claude-auto-mode.js +114 -0
- package/daemon/dist/domain/claude-auto-mode.js.map +1 -0
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +2 -0
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +11 -4
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.d.ts +5 -1
- package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.js +51 -2
- package/daemon/dist/domain/claude-continuation-launch.js.map +1 -1
- package/daemon/dist/domain/claude-core-plugin-env.d.ts +7 -3
- package/daemon/dist/domain/claude-core-plugin-env.d.ts.map +1 -1
- package/daemon/dist/domain/claude-core-plugin-env.js +11 -8
- package/daemon/dist/domain/claude-core-plugin-env.js.map +1 -1
- package/daemon/dist/domain/codex-daemon-support.d.ts.map +1 -1
- package/daemon/dist/domain/codex-daemon-support.js +6 -1
- package/daemon/dist/domain/codex-daemon-support.js.map +1 -1
- package/daemon/dist/domain/community-harness-launch-result.d.ts +2 -0
- package/daemon/dist/domain/community-harness-launch-result.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-launch-result.js +5 -1
- package/daemon/dist/domain/community-harness-launch-result.js.map +1 -1
- package/daemon/dist/domain/connection-contract.d.ts +91 -0
- package/daemon/dist/domain/connection-contract.d.ts.map +1 -1
- package/daemon/dist/domain/connection-contract.js +73 -0
- package/daemon/dist/domain/connection-contract.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts +5 -0
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +37 -2
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +6 -1
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +41 -8
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/cwd-resolution.d.ts +2 -0
- package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
- package/daemon/dist/domain/cwd-resolution.js +7 -2
- package/daemon/dist/domain/cwd-resolution.js.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js +5 -1
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/errors.d.ts +4 -0
- package/daemon/dist/domain/errors.d.ts.map +1 -1
- package/daemon/dist/domain/errors.js +7 -0
- package/daemon/dist/domain/errors.js.map +1 -1
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +8 -1
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/existing-rig-restore.d.ts +2 -0
- package/daemon/dist/domain/existing-rig-restore.d.ts.map +1 -1
- package/daemon/dist/domain/existing-rig-restore.js +1 -0
- package/daemon/dist/domain/existing-rig-restore.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 +107 -3
- package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/capabilities.d.ts +9 -1
- package/daemon/dist/domain/gateway/slack/capabilities.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/capabilities.js +6 -1
- package/daemon/dist/domain/gateway/slack/capabilities.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound-admission.js +1 -1
- package/daemon/dist/domain/gateway/slack/inbound-admission.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +15 -1
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/manifest.d.ts +5 -1
- package/daemon/dist/domain/gateway/slack/manifest.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/manifest.js +12 -3
- package/daemon/dist/domain/gateway/slack/manifest.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +1 -0
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +4 -1
- package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts +2 -0
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js +1 -0
- package/daemon/dist/domain/gateway/slack/queue-access.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 +6 -5
- package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts +1 -0
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.js +7 -2
- package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
- package/daemon/dist/domain/harness-not-started-notice.d.ts +36 -0
- package/daemon/dist/domain/harness-not-started-notice.d.ts.map +1 -0
- package/daemon/dist/domain/harness-not-started-notice.js +81 -0
- package/daemon/dist/domain/harness-not-started-notice.js.map +1 -0
- package/daemon/dist/domain/hot-potato-enforcer.d.ts +1 -1
- package/daemon/dist/domain/input-read-diagnostic.js +1 -1
- package/daemon/dist/domain/input-read-diagnostic.js.map +1 -1
- package/daemon/dist/domain/instance-initialization.d.ts +2 -0
- package/daemon/dist/domain/instance-initialization.d.ts.map +1 -1
- package/daemon/dist/domain/instance-initialization.js +2 -1
- package/daemon/dist/domain/instance-initialization.js.map +1 -1
- package/daemon/dist/domain/member-connection.d.ts +14 -0
- package/daemon/dist/domain/member-connection.d.ts.map +1 -0
- package/daemon/dist/domain/member-connection.js +34 -0
- package/daemon/dist/domain/member-connection.js.map +1 -0
- package/daemon/dist/domain/model-divergence/current-model-reader.d.ts +3 -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 +32 -7
- package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
- package/daemon/dist/domain/native-permission-store.d.ts +6 -2
- package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
- package/daemon/dist/domain/native-permission-store.js +12 -5
- package/daemon/dist/domain/native-permission-store.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts +5 -0
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +94 -10
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-connector.js +11 -2
- package/daemon/dist/domain/network/network-connector.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +28 -0
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +8 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +19 -4
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +50 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +255 -1
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/parked-query.d.ts.map +1 -1
- package/daemon/dist/domain/parked-query.js +3 -1
- package/daemon/dist/domain/parked-query.js.map +1 -1
- package/daemon/dist/domain/permission-account.d.ts +28 -1
- package/daemon/dist/domain/permission-account.d.ts.map +1 -1
- package/daemon/dist/domain/permission-account.js +55 -11
- package/daemon/dist/domain/permission-account.js.map +1 -1
- package/daemon/dist/domain/permission-drift.d.ts +2 -0
- package/daemon/dist/domain/permission-drift.d.ts.map +1 -1
- package/daemon/dist/domain/permission-drift.js.map +1 -1
- package/daemon/dist/domain/pi-compaction-request-store.d.ts +16 -0
- package/daemon/dist/domain/pi-compaction-request-store.d.ts.map +1 -0
- package/daemon/dist/domain/pi-compaction-request-store.js +40 -0
- package/daemon/dist/domain/pi-compaction-request-store.js.map +1 -0
- package/daemon/dist/domain/pi-compaction-service.d.ts +82 -0
- package/daemon/dist/domain/pi-compaction-service.d.ts.map +1 -0
- package/daemon/dist/domain/pi-compaction-service.js +229 -0
- package/daemon/dist/domain/pi-compaction-service.js.map +1 -0
- package/daemon/dist/domain/process-limits.d.ts +37 -0
- package/daemon/dist/domain/process-limits.d.ts.map +1 -0
- package/daemon/dist/domain/process-limits.js +69 -0
- package/daemon/dist/domain/process-limits.js.map +1 -0
- package/daemon/dist/domain/process-table.d.ts +9 -0
- package/daemon/dist/domain/process-table.d.ts.map +1 -1
- package/daemon/dist/domain/process-table.js +21 -4
- package/daemon/dist/domain/process-table.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +7 -0
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +27 -1
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +2 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +6 -1
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-erasure.d.ts +11 -6
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
- package/daemon/dist/domain/queue-erasure.js +44 -21
- package/daemon/dist/domain/queue-erasure.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +62 -14
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +270 -65
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +3 -0
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +45 -13
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +5 -3
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +9 -6
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts +8 -0
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +155 -17
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.d.ts +2 -1
- package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.js +31 -4
- package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts +10 -0
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +76 -3
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +60 -2
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +241 -50
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts +28 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +17 -5
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/restore-preconditions.d.ts +24 -0
- package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
- package/daemon/dist/domain/restore-preconditions.js +61 -1
- package/daemon/dist/domain/restore-preconditions.js.map +1 -1
- package/daemon/dist/domain/resume-token-validation.d.ts +3 -1
- package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-validation.js +6 -3
- package/daemon/dist/domain/resume-token-validation.js.map +1 -1
- package/daemon/dist/domain/return-route.d.ts +73 -0
- package/daemon/dist/domain/return-route.d.ts.map +1 -0
- package/daemon/dist/domain/return-route.js +124 -0
- package/daemon/dist/domain/return-route.js.map +1 -0
- package/daemon/dist/domain/rig-expansion-service.js +1 -1
- package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +12 -0
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +73 -0
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +4 -2
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +32 -13
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +9 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts +6 -0
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +30 -0
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +22 -2
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +82 -23
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +44 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +12 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -1
- package/daemon/dist/domain/rosters.js +17 -4
- package/daemon/dist/domain/rosters.js.map +1 -1
- package/daemon/dist/domain/runner-channel.d.ts +33 -0
- package/daemon/dist/domain/runner-channel.d.ts.map +1 -0
- package/daemon/dist/domain/runner-channel.js +179 -0
- package/daemon/dist/domain/runner-channel.js.map +1 -0
- package/daemon/dist/domain/runner-grant-launch.js +2 -2
- 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.map +1 -1
- package/daemon/dist/domain/runtime-switch-materials.js +4 -3
- package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
- package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
- package/daemon/dist/domain/scope/scope-audit.js +55 -3
- package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +6 -4
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +17 -10
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +2 -1
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +27 -4
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +203 -63
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.d.ts +8 -1
- package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.js +52 -12
- package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +21 -4
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +68 -2
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +9 -2
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +34 -2
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts +4 -0
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +9 -3
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-status-service.d.ts +4 -0
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +31 -6
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +16 -3
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +134 -9
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/shared-conversation.d.ts +58 -0
- package/daemon/dist/domain/shared-conversation.d.ts.map +1 -0
- package/daemon/dist/domain/shared-conversation.js +98 -0
- package/daemon/dist/domain/shared-conversation.js.map +1 -0
- package/daemon/dist/domain/startup-phase-timing.d.ts +19 -0
- package/daemon/dist/domain/startup-phase-timing.d.ts.map +1 -0
- package/daemon/dist/domain/startup-phase-timing.js +23 -0
- package/daemon/dist/domain/startup-phase-timing.js.map +1 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts +9 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +24 -7
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/team-operations.d.ts +6 -6
- package/daemon/dist/domain/team-operations.d.ts.map +1 -1
- package/daemon/dist/domain/team-operations.js +2 -4
- package/daemon/dist/domain/team-operations.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +6 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-provider.js +23 -1
- package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -1
- package/daemon/dist/domain/terminal-policy.js +1 -1
- package/daemon/dist/domain/terminal-policy.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +82 -5
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/watchdog-delivery.d.ts +1 -1
- package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-delivery.js +6 -3
- package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js +1 -0
- package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts +5 -0
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +14 -4
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +4 -2
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +35 -7
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- package/daemon/dist/gateway-slack-surface.d.ts +2 -2
- package/daemon/dist/gateway-slack-surface.d.ts.map +1 -1
- package/daemon/dist/gateway-slack-surface.js +1 -1
- package/daemon/dist/gateway-slack-surface.js.map +1 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +13 -2
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +105 -2
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/agent-images.d.ts.map +1 -1
- package/daemon/dist/routes/agent-images.js +6 -1
- package/daemon/dist/routes/agent-images.js.map +1 -1
- package/daemon/dist/routes/attention.d.ts.map +1 -1
- package/daemon/dist/routes/attention.js +2 -1
- package/daemon/dist/routes/attention.js.map +1 -1
- package/daemon/dist/routes/compaction.d.ts.map +1 -1
- package/daemon/dist/routes/compaction.js +46 -7
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts +4 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +232 -34
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts +4 -3
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/restore-check.d.ts.map +1 -1
- package/daemon/dist/routes/restore-check.js +1 -0
- package/daemon/dist/routes/restore-check.js.map +1 -1
- package/daemon/dist/routes/rigspec.d.ts.map +1 -1
- package/daemon/dist/routes/rigspec.js +24 -4
- package/daemon/dist/routes/rigspec.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +107 -6
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.js +14 -3
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/startup.js +7 -1
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/up.d.ts.map +1 -1
- package/daemon/dist/routes/up.js +14 -4
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/watchdog.d.ts.map +1 -1
- package/daemon/dist/routes/watchdog.js +18 -1
- package/daemon/dist/routes/watchdog.js.map +1 -1
- package/daemon/dist/server.d.ts +3 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +11 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +51 -16
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-startup-guide.md +2 -1
- package/daemon/docs/reference/community-harness-examples/dsh/README.md +8 -0
- package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +139 -5
- package/daemon/docs/reference/community-harness-presets.md +2 -0
- package/daemon/docs/reference/daemon-http-clients.md +61 -12
- package/daemon/docs/reference/getting-started.md +4 -4
- package/daemon/docs/reference/harness-runner-contract.md +91 -1
- package/daemon/docs/reference/herdr-app.md +6 -0
- package/daemon/docs/reference/quickstart.md +2 -2
- package/daemon/docs/reference/rig-spec.md +166 -0
- package/daemon/docs/reference/rosters.md +9 -0
- package/daemon/docs/reference/sdlc-conventions.md +5 -1
- package/daemon/docs/reference/slack-app-setup.md +39 -21
- package/daemon/docs/reference/whats-new.md +107 -6
- package/daemon/specs/agents/shared/skills/core/messaging-the-human/SKILL.md +23 -0
- package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +26 -5
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +19 -5
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +1 -1
- package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +12 -0
- package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +26 -5
- package/dist/acp/connector.js +1 -1
- package/dist/acp/connector.js.map +1 -1
- package/dist/build-info.js +3 -3
- package/dist/cli-error.d.ts.map +1 -1
- package/dist/cli-error.js +7 -1
- package/dist/cli-error.js.map +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/ask.d.ts.map +1 -1
- package/dist/commands/ask.js +92 -11
- package/dist/commands/ask.js.map +1 -1
- package/dist/commands/broadcast.js +9 -5
- package/dist/commands/broadcast.js.map +1 -1
- package/dist/commands/compact.d.ts +3 -4
- package/dist/commands/compact.d.ts.map +1 -1
- package/dist/commands/compact.js +76 -16
- package/dist/commands/compact.js.map +1 -1
- package/dist/commands/config-init-workspace.d.ts.map +1 -1
- package/dist/commands/config-init-workspace.js +3 -0
- package/dist/commands/config-init-workspace.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +3 -1
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +2 -1
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/fork.d.ts.map +1 -1
- package/dist/commands/fork.js +2 -0
- package/dist/commands/fork.js.map +1 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +11 -3
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/ps.d.ts +28 -0
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +76 -2
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +309 -21
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/rig.d.ts +2 -0
- package/dist/commands/rig.d.ts.map +1 -1
- package/dist/commands/rig.js +36 -2
- package/dist/commands/rig.js.map +1 -1
- package/dist/commands/roster.d.ts +3 -0
- package/dist/commands/roster.d.ts.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +126 -7
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +47 -6
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.js +2 -2
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/slack.d.ts +2 -1
- package/dist/commands/slack.d.ts.map +1 -1
- package/dist/commands/slack.js +38 -2
- package/dist/commands/slack.js.map +1 -1
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +5 -5
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +3 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +4 -0
- package/dist/commands/workflow.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +1 -0
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/lib/model-observation.d.ts.map +1 -1
- package/dist/lib/model-observation.js +9 -3
- package/dist/lib/model-observation.js.map +1 -1
- package/dist/lib/scope/scope-audit.d.ts.map +1 -1
- package/dist/lib/scope/scope-audit.js +55 -3
- package/dist/lib/scope/scope-audit.js.map +1 -1
- package/dist/local-db.d.ts +5 -0
- package/dist/local-db.d.ts.map +1 -0
- package/dist/local-db.js +23 -0
- package/dist/local-db.js.map +1 -0
- package/dist/local-origin.d.ts.map +1 -1
- package/dist/local-origin.js +2 -17
- package/dist/local-origin.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +122 -18
- package/dist/mcp-server.js.map +1 -1
- package/dist/sender-identity.d.ts +18 -6
- package/dist/sender-identity.d.ts.map +1 -1
- package/dist/sender-identity.js +67 -7
- package/dist/sender-identity.js.map +1 -1
- package/dist/terminal-window-rex.d.ts +1 -1
- package/dist/terminal-window-rex.d.ts.map +1 -1
- package/dist/terminal-window-rex.js +3 -2
- package/dist/terminal-window-rex.js.map +1 -1
- package/dist/terminal-window.js +3 -3
- package/dist/terminal-window.js.map +1 -1
- package/package.json +1 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +2 -1
- package/tui/dist/daemon-client.js.map +1 -1
- package/ui/dist/assets/{index-BvUEh33d.js → index-1O1f3A7K.js} +55 -55
- package/ui/dist/index.html +1 -1
|
@@ -594,7 +594,7 @@ export function createRunnerInput(input, output, onSubmit, pane) {
|
|
|
594
594
|
}
|
|
595
595
|
pane?.refresh();
|
|
596
596
|
};
|
|
597
|
-
const wasRaw = input.isRaw;
|
|
597
|
+
const wasRaw = input.isRaw ?? false;
|
|
598
598
|
const end = () => editor.close();
|
|
599
599
|
input.setRawMode(true);
|
|
600
600
|
output.write("\u001b[?2004h");
|
|
@@ -720,7 +720,8 @@ export function mapPiEvent(event, runtime = "pi", style = STYLE) {
|
|
|
720
720
|
// summary (Pi's docs/rpc.md). An end that names neither is done.
|
|
721
721
|
const failure = diagnosticText([event.errorMessage]).slice(0, 400);
|
|
722
722
|
return { mirrorLines: [event.aborted === true ? `[${runtime}] compaction cancelled`
|
|
723
|
-
: failure ? `[${runtime}] compaction failed: ${failure}` : `[${runtime}] compaction done`]
|
|
723
|
+
: failure ? `[${runtime}] compaction failed: ${failure}` : `[${runtime}] compaction done`],
|
|
724
|
+
...(runtime === "pi" ? { activity: { hookEvent: "Stop", subtype: "compaction" } } : {}) };
|
|
724
725
|
}
|
|
725
726
|
// OMP names its automatic compaction separately. Pi keeps main's mapping
|
|
726
727
|
// (unmapped), so an idle Pi seat never reads as running after one.
|
|
@@ -744,7 +745,15 @@ export function mapPiEvent(event, runtime = "pi", style = STYLE) {
|
|
|
744
745
|
return { mirrorLines: [] };
|
|
745
746
|
}
|
|
746
747
|
}
|
|
748
|
+
export function writePiRunnerSidecar(path, state) {
|
|
749
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
750
|
+
fs.writeFileSync(temporary, JSON.stringify(state), { mode: 0o600 });
|
|
751
|
+
fs.renameSync(temporary, path);
|
|
752
|
+
}
|
|
747
753
|
const GET_STATE_ID = "pi-runner-get-state";
|
|
754
|
+
/** The reserved manual-compaction input carries its attempt id in the RPC id, so a
|
|
755
|
+
* reply and the sidecar record can name exactly the request OpenRig made. */
|
|
756
|
+
const COMPACT_ID = "pi-runner-compact:";
|
|
748
757
|
const CATCH_UP_ID = "pi-runner-catch-up";
|
|
749
758
|
const CURSOR_REFRESH_ID = "pi-runner-cursor-refresh";
|
|
750
759
|
const NEGOTIATE_ID = "omp-runner-negotiate";
|
|
@@ -821,6 +830,26 @@ export class RunnerCore {
|
|
|
821
830
|
io;
|
|
822
831
|
identity;
|
|
823
832
|
opts;
|
|
833
|
+
compaction;
|
|
834
|
+
/** The last attempt-stamped record, kept beside `compaction` so a later
|
|
835
|
+
* automatic run cannot erase a requested attempt's result. */
|
|
836
|
+
requestedCompaction;
|
|
837
|
+
/** The attempt a `/openrig-compact <id>` input named, awaiting its compaction_start. */
|
|
838
|
+
pendingCompactAttemptId = null;
|
|
839
|
+
/** Durable copy of that pending attempt: written before the compact RPC, so a
|
|
840
|
+
* restarted daemon reads the newest request as uncertain, not as an older run. */
|
|
841
|
+
pendingCompaction;
|
|
842
|
+
managed = new Map();
|
|
843
|
+
managedQueue = [];
|
|
844
|
+
managedRpc = new Map();
|
|
845
|
+
managedWake = null;
|
|
846
|
+
managedQuarantined = false;
|
|
847
|
+
pendingManagedStart = false;
|
|
848
|
+
personPreflights = new Set();
|
|
849
|
+
promptRevision = 0;
|
|
850
|
+
idleRevision = -1;
|
|
851
|
+
idleQuery = null;
|
|
852
|
+
nativeQueueStateAvailable = false;
|
|
824
853
|
streaming = false;
|
|
825
854
|
/** The child is gone; the status row says exited, never idle. */
|
|
826
855
|
paneExited = false;
|
|
@@ -884,6 +913,9 @@ export class RunnerCore {
|
|
|
884
913
|
}
|
|
885
914
|
/** Runner readiness is the sidecar's acknowledged get_state, not RPC transport ready. */
|
|
886
915
|
isReady() { return this.ready; }
|
|
916
|
+
/** A permanent reporting-authority refusal fences new managed dispatch, not person input or native work already in flight. */
|
|
917
|
+
quarantineManagedChannel() { this.managedQuarantined = true; }
|
|
918
|
+
nativeChannelCapabilities() { return { input: this.ready && !this.managedQuarantined && this.runtime === "pi", wake: this.ready && !this.managedQuarantined && this.nativeQueueStateAvailable && this.runtime === "pi", cancel: false }; }
|
|
887
919
|
/** Kick off identity capture. Called once pi's RPC stream is up; for OMP, with its `ready` frame. */
|
|
888
920
|
start(ready) {
|
|
889
921
|
// K4: the first credential observation, before Pi can make any request of this runner's.
|
|
@@ -968,8 +1000,125 @@ export class RunnerCore {
|
|
|
968
1000
|
this.diag(`[omp-runner] ERROR rpc frame: ${reason}; the chunked frame was dropped`);
|
|
969
1001
|
}
|
|
970
1002
|
get runtime() { return this.opts.runtime ?? "pi"; }
|
|
1003
|
+
async acceptRunnerRequest(frame) {
|
|
1004
|
+
if (!this.ready || this.runtime !== "pi" || !this.io.postRunner || frame.version !== 1 || frame.runId !== this.identity.runId
|
|
1005
|
+
|| !Number.isSafeInteger(frame.sequence) || frame.sequence < 1 || typeof frame.requestId !== "string"
|
|
1006
|
+
|| !["input", "wake"].includes(frame.kind) || typeof (frame.kind === "wake" ? frame.payload?.question : frame.payload?.text) !== "string")
|
|
1007
|
+
return;
|
|
1008
|
+
frame = { version: 1, runId: frame.runId, requestId: frame.requestId, sequence: frame.sequence, kind: frame.kind,
|
|
1009
|
+
payload: frame.kind === "wake" ? { question: frame.payload.question } : { text: frame.payload.text } };
|
|
1010
|
+
if ([...this.managed.values()].some(entry => entry.frame.sequence === frame.sequence && entry.frame.requestId !== frame.requestId))
|
|
1011
|
+
throw new Error("Conflicting native sequence");
|
|
1012
|
+
const old = this.managed.get(frame.requestId);
|
|
1013
|
+
if (old) {
|
|
1014
|
+
if (JSON.stringify(old.frame) !== JSON.stringify(frame))
|
|
1015
|
+
throw new Error("Conflicting native request identity");
|
|
1016
|
+
await old.acceptance;
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
const entry = { frame, state: "accepting", reports: Promise.resolve() };
|
|
1020
|
+
this.managed.set(frame.requestId, entry);
|
|
1021
|
+
entry.acceptance = (async () => {
|
|
1022
|
+
const accepted = await this.io.postRunner({ type: "ack", runId: frame.runId, requestId: frame.requestId, sequence: frame.sequence, state: "accepted" });
|
|
1023
|
+
if (!accepted) {
|
|
1024
|
+
entry.state = "unavailable";
|
|
1025
|
+
this.pumpManaged();
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
entry.state = "queued";
|
|
1029
|
+
this.managedQueue.push(entry);
|
|
1030
|
+
this.managedQueue.sort((a, b) => a.frame.sequence - b.frame.sequence);
|
|
1031
|
+
this.pumpManaged();
|
|
1032
|
+
})();
|
|
1033
|
+
await entry.acceptance;
|
|
1034
|
+
}
|
|
1035
|
+
reportManaged(entry, type, result) {
|
|
1036
|
+
const f = entry.frame;
|
|
1037
|
+
if (type !== "submitted" && result)
|
|
1038
|
+
entry.terminalResult = result;
|
|
1039
|
+
entry.reports = entry.reports.then(() => this.io.postRunner?.({ type, runId: f.runId, requestId: f.requestId, sequence: f.sequence,
|
|
1040
|
+
...(f.kind === "wake" ? { nativeTurnId: `pi-wake-${f.requestId}` } : {}), ...(result ? { result } : {}) })).catch(() => { });
|
|
1041
|
+
}
|
|
1042
|
+
pumpManaged() {
|
|
1043
|
+
if (!this.ready || this.managedQuarantined || this.managedWake || this.pendingManagedStart && !this.streaming)
|
|
1044
|
+
return;
|
|
1045
|
+
const entry = this.managedQueue[0];
|
|
1046
|
+
if (!entry || this.personPreflights.size || [...this.managed.values()].some(prior => prior.state === "accepting" && prior.frame.sequence < entry.frame.sequence)
|
|
1047
|
+
|| entry.frame.kind === "wake" && (this.streaming || this.pendingManagedStart))
|
|
1048
|
+
return;
|
|
1049
|
+
if (entry.frame.kind === "wake" && this.idleRevision !== this.promptRevision) {
|
|
1050
|
+
if (!this.idleQuery) {
|
|
1051
|
+
this.idleQuery = { id: `openrig-native-idle-${this.promptRevision}`, revision: this.promptRevision };
|
|
1052
|
+
this.io.sendRpc({ type: "get_state", id: this.idleQuery.id });
|
|
1053
|
+
}
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
this.promptRevision += 1;
|
|
1057
|
+
this.managedQueue.shift();
|
|
1058
|
+
entry.state = "writing";
|
|
1059
|
+
if (entry.frame.kind === "wake") {
|
|
1060
|
+
this.managedWake = entry;
|
|
1061
|
+
entry.answer = [];
|
|
1062
|
+
}
|
|
1063
|
+
if (!this.streaming)
|
|
1064
|
+
this.pendingManagedStart = true;
|
|
1065
|
+
const id = `openrig-native-${entry.frame.requestId}`;
|
|
1066
|
+
this.managedRpc.set(id, entry);
|
|
1067
|
+
this.io.sendRpc({ id, type: "prompt", message: entry.frame.kind === "wake" ? entry.frame.payload.question : entry.frame.payload.text, streamingBehavior: "steer" });
|
|
1068
|
+
this.acceptIntoOpenRun();
|
|
1069
|
+
// Ordinary busy messages may steer; the next queued wake waits for agent_end, not this RPC response.
|
|
1070
|
+
this.pumpManaged();
|
|
1071
|
+
}
|
|
1072
|
+
finishManagedWake(entry, forced) {
|
|
1073
|
+
// Pi reports started before agent.prompt, but awaits extension handlers before handled.
|
|
1074
|
+
// Events before that authoritative disposition cannot establish this invocation's ownership.
|
|
1075
|
+
if (!forced && entry.disposition === undefined)
|
|
1076
|
+
return;
|
|
1077
|
+
const ownershipUnknown = !["started", "handled"].includes(entry.disposition ?? "") || entry.preDispositionEvents === true;
|
|
1078
|
+
if (ownershipUnknown)
|
|
1079
|
+
this.managedQuarantined = true;
|
|
1080
|
+
const completion = ownershipUnknown || forced && !entry.nativeAccepted ? "unknown" : forced ?? (entry.contaminated || !entry.wakeOpened ? "unknown"
|
|
1081
|
+
: entry.stopReason === "stop" && entry.answer?.some(text => text.length > 0) ? "completed" : entry.stopReason === "aborted" ? "interrupted" : entry.stopReason === "error" ? "failed" : "unknown");
|
|
1082
|
+
entry.state = "terminal";
|
|
1083
|
+
entry.terminalResult = { kind: "wake", nativeTurnId: `pi-wake-${entry.frame.requestId}`,
|
|
1084
|
+
completion, answer: completion === "completed" ? entry.answer?.join("\n") ?? "" : null,
|
|
1085
|
+
...(ownershipUnknown ? { ownershipUnknown: true } : {}),
|
|
1086
|
+
...(forced && !entry.nativeAccepted ? { submissionUnknown: true } : {}) };
|
|
1087
|
+
if (entry.nativeAccepted || forced)
|
|
1088
|
+
this.reportManaged(entry, "result", entry.terminalResult);
|
|
1089
|
+
if (this.managedWake === entry)
|
|
1090
|
+
this.managedWake = null;
|
|
1091
|
+
}
|
|
1092
|
+
personPrompt(command) {
|
|
1093
|
+
if (this.runtime !== "pi" || !this.io.postRunner) {
|
|
1094
|
+
this.io.sendRpc(command);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
const id = `openrig-person-${++this.promptRevision}`;
|
|
1098
|
+
this.personPreflights.add(id);
|
|
1099
|
+
if (!this.streaming)
|
|
1100
|
+
this.pendingManagedStart = true;
|
|
1101
|
+
this.io.sendRpc({ ...command, id });
|
|
1102
|
+
}
|
|
971
1103
|
/** One aggregated paste block from pane stdin. */
|
|
972
1104
|
handleUserBlock(block) {
|
|
1105
|
+
const compact = /^\/openrig-compact ([\w-]+)$/.exec(block);
|
|
1106
|
+
if (this.runtime === "pi" && compact) {
|
|
1107
|
+
const attemptId = compact[1];
|
|
1108
|
+
if (this.pendingCompactAttemptId || (this.compaction?.startedAt && !this.compaction.endedAt)) {
|
|
1109
|
+
this.diag("[pi-runner] compact already in progress; request not sent");
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
this.pendingCompactAttemptId = attemptId;
|
|
1113
|
+
this.pendingCompaction = { attemptId, requestedAt: this.io.now() };
|
|
1114
|
+
// Persist the request before the RPC leaves: the id survives a daemon
|
|
1115
|
+
// restart, so the newest attempt reads uncertain, never an older result.
|
|
1116
|
+
this.writeSidecar({});
|
|
1117
|
+
this.io.sendRpc({ type: "compact", id: COMPACT_ID + attemptId });
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
if (this.managedWake)
|
|
1121
|
+
this.managedWake.contaminated = true;
|
|
973
1122
|
if (block === "/abort") {
|
|
974
1123
|
this.io.sendRpc({ type: "abort" });
|
|
975
1124
|
this.diag("[pi-runner] abort sent");
|
|
@@ -977,7 +1126,7 @@ export class RunnerCore {
|
|
|
977
1126
|
}
|
|
978
1127
|
if (block.startsWith("/followup ")) {
|
|
979
1128
|
const message = block.slice("/followup ".length);
|
|
980
|
-
this.
|
|
1129
|
+
this.personPrompt({ type: "follow_up", message });
|
|
981
1130
|
this.io.mirrorLine(`${this.style.commit("you (follow-up) ▸")} ${message}`);
|
|
982
1131
|
this.acceptIntoOpenRun();
|
|
983
1132
|
return;
|
|
@@ -986,7 +1135,7 @@ export class RunnerCore {
|
|
|
986
1135
|
// while busy, queue it as a steer, delivered after the current turn's tool calls and before the next model call.
|
|
987
1136
|
// The runner's `streaming` starts only at agent_start, so it can't tell when a turn is about to start (#1932) or
|
|
988
1137
|
// when a prompt was consumed locally and started none. It labels the mirror line only.
|
|
989
|
-
this.
|
|
1138
|
+
this.personPrompt({ type: "prompt", message: block, streamingBehavior: "steer" });
|
|
990
1139
|
this.io.mirrorLine(this.streaming ? `${this.style.commit("you (steer) ▸")} ${block}` : `${this.style.commit("you ▸")} ${block}`);
|
|
991
1140
|
this.acceptIntoOpenRun();
|
|
992
1141
|
}
|
|
@@ -1004,6 +1153,8 @@ export class RunnerCore {
|
|
|
1004
1153
|
handlePiExit(code) {
|
|
1005
1154
|
this.ready = false;
|
|
1006
1155
|
this.paneExited = true;
|
|
1156
|
+
if (this.managedWake)
|
|
1157
|
+
this.finishManagedWake(this.managedWake, "failed");
|
|
1007
1158
|
this.reportDroppedFrame(this.frameDecoder?.incomplete());
|
|
1008
1159
|
this.io.mirrorLine(`[${this.runtime}-runner] EXITED ${this.runtime} exited (code ${code ?? "unknown"})`);
|
|
1009
1160
|
this.writeSidecar({ exited: { code, at: this.io.now() } });
|
|
@@ -1011,6 +1162,74 @@ export class RunnerCore {
|
|
|
1011
1162
|
this.refreshPaneStatus();
|
|
1012
1163
|
}
|
|
1013
1164
|
handleResponse(record) {
|
|
1165
|
+
if (this.idleQuery && record.id === this.idleQuery.id) {
|
|
1166
|
+
const query = this.idleQuery;
|
|
1167
|
+
this.idleQuery = null;
|
|
1168
|
+
const data = record.data;
|
|
1169
|
+
if (record.success === true && data?.isStreaming === false && data.pendingMessageCount === 0 && query.revision === this.promptRevision) {
|
|
1170
|
+
this.idleRevision = query.revision;
|
|
1171
|
+
this.pumpManaged();
|
|
1172
|
+
}
|
|
1173
|
+
else if (record.success === true && typeof data?.isStreaming === "boolean" && Number.isSafeInteger(data.pendingMessageCount) && Number(data.pendingMessageCount) >= 0) {
|
|
1174
|
+
setTimeout(() => this.pumpManaged(), 250).unref();
|
|
1175
|
+
}
|
|
1176
|
+
else {
|
|
1177
|
+
const next = this.managedQueue.shift();
|
|
1178
|
+
if (next) {
|
|
1179
|
+
next.state = "terminal";
|
|
1180
|
+
this.reportManaged(next, "rejected", { kind: next.frame.kind, reason: "native_idle_state_unavailable" });
|
|
1181
|
+
}
|
|
1182
|
+
this.pumpManaged();
|
|
1183
|
+
}
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
if (typeof record.id === "string" && this.personPreflights.delete(record.id)) {
|
|
1187
|
+
if (record.success !== true || record.data?.disposition === "handled")
|
|
1188
|
+
this.pendingManagedStart = false;
|
|
1189
|
+
this.pumpManaged();
|
|
1190
|
+
if (record.success !== false && record.error == null)
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
const managed = typeof record.id === "string" ? this.managedRpc.get(record.id) : undefined;
|
|
1194
|
+
if (managed) {
|
|
1195
|
+
this.managedRpc.delete(String(record.id));
|
|
1196
|
+
if (record.success === true) {
|
|
1197
|
+
managed.nativeAccepted = true;
|
|
1198
|
+
managed.state = "submitted";
|
|
1199
|
+
this.reportManaged(managed, "submitted");
|
|
1200
|
+
if (managed.frame.kind === "wake") {
|
|
1201
|
+
const disposition = record.data?.disposition;
|
|
1202
|
+
managed.disposition = typeof disposition === "string" ? disposition : "unknown";
|
|
1203
|
+
if (!["started", "handled"].includes(managed.disposition) || managed.preDispositionEvents)
|
|
1204
|
+
this.managedQuarantined = true;
|
|
1205
|
+
if (managed.nativeTerminal || managed.disposition !== "started" && !this.streaming)
|
|
1206
|
+
this.finishManagedWake(managed);
|
|
1207
|
+
else if (managed.terminalResult)
|
|
1208
|
+
this.reportManaged(managed, "result", managed.terminalResult);
|
|
1209
|
+
if (this.managedWake !== managed && !this.streaming) {
|
|
1210
|
+
this.pendingManagedStart = false;
|
|
1211
|
+
this.pumpManaged();
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
else {
|
|
1215
|
+
managed.state = "terminal";
|
|
1216
|
+
this.reportManaged(managed, "result", { kind: "input", accepted: true });
|
|
1217
|
+
if (record.data?.disposition === "handled") {
|
|
1218
|
+
this.pendingManagedStart = false;
|
|
1219
|
+
this.pumpManaged();
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1224
|
+
managed.state = "terminal";
|
|
1225
|
+
this.pendingManagedStart = false;
|
|
1226
|
+
this.reportManaged(managed, "rejected", { kind: managed.frame.kind, reason: "native_prompt_rejected" });
|
|
1227
|
+
if (this.managedWake === managed)
|
|
1228
|
+
this.managedWake = null;
|
|
1229
|
+
this.pumpManaged();
|
|
1230
|
+
}
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1014
1233
|
if (record.id === NEGOTIATE_ID && this.v2Limit !== null) {
|
|
1015
1234
|
if (record.success === true) {
|
|
1016
1235
|
this.frameDecoder = new OmpFrameDecoder(this.v2Limit);
|
|
@@ -1022,9 +1241,43 @@ export class RunnerCore {
|
|
|
1022
1241
|
}
|
|
1023
1242
|
return;
|
|
1024
1243
|
}
|
|
1244
|
+
if (this.runtime === "pi" && record.success === true && record.error == null
|
|
1245
|
+
&& typeof record.id === "string" && record.id.startsWith(COMPACT_ID)) {
|
|
1246
|
+
const attemptId = record.id.slice(COMPACT_ID.length);
|
|
1247
|
+
if (this.pendingCompactAttemptId === attemptId)
|
|
1248
|
+
this.pendingCompactAttemptId = null;
|
|
1249
|
+
if (this.pendingCompaction?.attemptId === attemptId)
|
|
1250
|
+
this.pendingCompaction = undefined;
|
|
1251
|
+
this.writeSidecar({});
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1025
1254
|
if (record.success === false || record.error != null) {
|
|
1026
1255
|
const detail = typeof record.error === "string" ? record.error : "request failed";
|
|
1027
1256
|
const message = detail + (this.runtime === "pi" ? piCredentialHint(detail) : "");
|
|
1257
|
+
const compactId = this.runtime === "pi" && typeof record.id === "string" && record.id.startsWith(COMPACT_ID)
|
|
1258
|
+
? record.id : null;
|
|
1259
|
+
if (compactId) {
|
|
1260
|
+
const attemptId = compactId.slice(COMPACT_ID.length);
|
|
1261
|
+
const unsupported = /unknown command|unsupported|not supported/i.test(detail);
|
|
1262
|
+
this.io.mirrorLine(`[pi-runner] ERROR rpc compact${unsupported ? " unsupported" : " failed"}: ${message}`);
|
|
1263
|
+
// A failure with no start replaces any older record: this attempt is the answer.
|
|
1264
|
+
const prior = this.compaction?.attemptId === attemptId ? this.compaction : undefined;
|
|
1265
|
+
const wasPending = this.pendingCompactAttemptId === attemptId;
|
|
1266
|
+
if (this.pendingCompactAttemptId === attemptId)
|
|
1267
|
+
this.pendingCompactAttemptId = null;
|
|
1268
|
+
if (this.pendingCompaction?.attemptId === attemptId)
|
|
1269
|
+
this.pendingCompaction = undefined;
|
|
1270
|
+
const failed = { attemptId, reason: prior?.reason ?? "manual",
|
|
1271
|
+
...(prior?.requestId ? { requestId: prior.requestId } : {}),
|
|
1272
|
+
...(prior?.startedAt ? { startedAt: prior.startedAt } : {}),
|
|
1273
|
+
endedAt: prior?.endedAt ?? this.io.now(), errorMessage: detail };
|
|
1274
|
+
if (wasPending || !this.compaction?.attemptId || this.compaction.attemptId === attemptId)
|
|
1275
|
+
this.compaction = failed;
|
|
1276
|
+
if (wasPending || !this.requestedCompaction || this.requestedCompaction.attemptId === attemptId)
|
|
1277
|
+
this.requestedCompaction = failed;
|
|
1278
|
+
this.writeSidecar({});
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1028
1281
|
if (record.id === GET_STATE_ID) {
|
|
1029
1282
|
this.ready = false;
|
|
1030
1283
|
this.paneError = true;
|
|
@@ -1059,7 +1312,10 @@ export class RunnerCore {
|
|
|
1059
1312
|
this.sessionFile = sessionFile ?? this.sessionFile;
|
|
1060
1313
|
this.sessionId = sessionId ?? this.sessionId;
|
|
1061
1314
|
const wasReady = this.ready;
|
|
1315
|
+
this.nativeQueueStateAvailable = typeof data.isStreaming === "boolean" && Number.isSafeInteger(data.pendingMessageCount) && Number(data.pendingMessageCount) >= 0;
|
|
1062
1316
|
this.ready = this.runtime === "pi" || !!this.sessionFile;
|
|
1317
|
+
if (this.ready)
|
|
1318
|
+
this.pumpManaged();
|
|
1063
1319
|
if (!this.ready) {
|
|
1064
1320
|
if (this.runtime === "omp") {
|
|
1065
1321
|
this.diag("[omp-runner] ERROR rpc get_state returned no session file; cannot provide a resume token");
|
|
@@ -1290,6 +1546,44 @@ export class RunnerCore {
|
|
|
1290
1546
|
/** Emphasis for the lines the runner writes itself; model output stays plain. */
|
|
1291
1547
|
get style() { return this.opts.style ?? STYLE; }
|
|
1292
1548
|
handleEvent(event) {
|
|
1549
|
+
if (this.runtime === "pi" && (event.type === "compaction_start" || event.type === "compaction_end")) {
|
|
1550
|
+
const identity = {
|
|
1551
|
+
...(typeof event.requestId === "string" ? { requestId: event.requestId } : {}),
|
|
1552
|
+
...(typeof event.reason === "string" ? { reason: event.reason } : {}),
|
|
1553
|
+
};
|
|
1554
|
+
// The attempt id OpenRig's reserved input named rides the runner's native
|
|
1555
|
+
// compact command and returns here. An automatic run (threshold/overflow)
|
|
1556
|
+
// never takes it, so its result cannot answer a requested attempt.
|
|
1557
|
+
const manualReason = typeof event.reason !== "string" || event.reason === "manual";
|
|
1558
|
+
if (event.type === "compaction_start") {
|
|
1559
|
+
const attemptId = manualReason ? this.pendingCompactAttemptId ?? undefined : undefined;
|
|
1560
|
+
if (attemptId) {
|
|
1561
|
+
this.pendingCompactAttemptId = null;
|
|
1562
|
+
this.pendingCompaction = undefined;
|
|
1563
|
+
}
|
|
1564
|
+
this.compaction = { ...(attemptId ? { attemptId } : {}), ...identity, startedAt: this.io.now() };
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
const result = event.result;
|
|
1568
|
+
const summary = result !== null && typeof result === "object" ? Object.fromEntries(Object.entries(result).filter(([key, value]) => (["summary", "firstKeptEntryId"].includes(key) && typeof value === "string") ||
|
|
1569
|
+
(["tokensBefore", "estimatedTokensAfter"].includes(key) && typeof value === "number"))) : undefined;
|
|
1570
|
+
const attemptId = this.compaction?.attemptId
|
|
1571
|
+
?? (manualReason ? this.pendingCompactAttemptId ?? undefined : undefined);
|
|
1572
|
+
if (attemptId && this.pendingCompactAttemptId === attemptId)
|
|
1573
|
+
this.pendingCompactAttemptId = null;
|
|
1574
|
+
this.compaction = { ...this.compaction, ...(attemptId ? { attemptId } : {}), ...identity, endedAt: this.io.now(),
|
|
1575
|
+
...(result === null ? { result: null } : summary ? { result: summary } : {}),
|
|
1576
|
+
...(typeof event.aborted === "boolean" ? { aborted: event.aborted } : {}),
|
|
1577
|
+
...(typeof event.willRetry === "boolean" ? { willRetry: event.willRetry } : {}),
|
|
1578
|
+
...(typeof event.errorMessage === "string" ? { errorMessage: event.errorMessage } : {}),
|
|
1579
|
+
};
|
|
1580
|
+
// Keep the attempt-stamped record beside `compaction`: a later automatic
|
|
1581
|
+
// run replaces that field, and this request must still read completed.
|
|
1582
|
+
if (this.compaction.attemptId)
|
|
1583
|
+
this.requestedCompaction = this.compaction;
|
|
1584
|
+
}
|
|
1585
|
+
this.writeSidecar({});
|
|
1586
|
+
}
|
|
1293
1587
|
if (event.type === "extension_ui_request") {
|
|
1294
1588
|
const method = event.method;
|
|
1295
1589
|
const dialog = method === "select" || method === "confirm" || method === "input" || method === "editor";
|
|
@@ -1376,6 +1670,21 @@ export class RunnerCore {
|
|
|
1376
1670
|
if (event.type === "turn_start")
|
|
1377
1671
|
this.assistantErrorShown = false;
|
|
1378
1672
|
}
|
|
1673
|
+
const wake = this.managedWake;
|
|
1674
|
+
if (wake && wake.disposition === undefined && ["agent_start", "message_end", "agent_end"].includes(String(event.type)))
|
|
1675
|
+
wake.preDispositionEvents = true;
|
|
1676
|
+
if (event.type === "agent_start" && wake) {
|
|
1677
|
+
if (wake.wakeOpened)
|
|
1678
|
+
wake.contaminated = true;
|
|
1679
|
+
wake.wakeOpened = true;
|
|
1680
|
+
}
|
|
1681
|
+
if (event.type === "message_end" && wake && wake.disposition === "started" && !wake.preDispositionEvents && wake.wakeOpened) {
|
|
1682
|
+
const assistant = event.message;
|
|
1683
|
+
if (assistant?.role === "assistant") {
|
|
1684
|
+
wake.answer.push(...(Array.isArray(assistant.content) ? assistant.content : []).filter(part => part.type === "text" && typeof part.text === "string").map(part => part.text));
|
|
1685
|
+
wake.stopReason = assistant.stopReason;
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1379
1688
|
const mapped = mapPiEvent(event, this.runtime, this.style);
|
|
1380
1689
|
// A working beat counts only for the latest accepted turn. Pi's runs start from this runner's prompts, so the run
|
|
1381
1690
|
// that opens is posted as one, before its first event; a prompt Pi handles without a run opens none. A prompt sent
|
|
@@ -1388,6 +1697,7 @@ export class RunnerCore {
|
|
|
1388
1697
|
this.refreshPaneStatus();
|
|
1389
1698
|
}
|
|
1390
1699
|
if (opening) {
|
|
1700
|
+
setImmediate(() => this.pumpManaged());
|
|
1391
1701
|
this.turn += 1;
|
|
1392
1702
|
this.io.postActivity(this.activityPayload("UserPromptSubmit", "accepted", { turnId: String(this.turn) }));
|
|
1393
1703
|
}
|
|
@@ -1401,6 +1711,13 @@ export class RunnerCore {
|
|
|
1401
1711
|
this.paneRetrying = false;
|
|
1402
1712
|
this.refreshPaneStatus();
|
|
1403
1713
|
}
|
|
1714
|
+
this.idleRevision = -1;
|
|
1715
|
+
this.pendingManagedStart = false;
|
|
1716
|
+
if (wake) {
|
|
1717
|
+
wake.nativeTerminal = true;
|
|
1718
|
+
this.finishManagedWake(wake);
|
|
1719
|
+
}
|
|
1720
|
+
setImmediate(() => this.pumpManaged());
|
|
1404
1721
|
// QA RED fold: live events do not reliably carry
|
|
1405
1722
|
// session-entry ids, so the durable cursor starved (lastEntryId stayed
|
|
1406
1723
|
// null in real runs). Refresh it from the source of truth after every
|
|
@@ -1455,15 +1772,25 @@ export class RunnerCore {
|
|
|
1455
1772
|
return;
|
|
1456
1773
|
if (event.type === "agent_end" && this.attention === "transient_turn_error")
|
|
1457
1774
|
this.clearAttention();
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1775
|
+
const compactionBeat = this.runtime === "pi" && mapped.activity.subtype === "compaction";
|
|
1776
|
+
try {
|
|
1777
|
+
if (mapped.activity.hookEvent === "Stop" && this.attention) {
|
|
1778
|
+
// The turn ended, but the operator still has to act. Drop the Stop; if
|
|
1779
|
+
// later activity replaced the attention, restore it as the final state.
|
|
1780
|
+
if (!this.attentionIsLatest)
|
|
1781
|
+
this.raiseAttention(this.attention);
|
|
1782
|
+
}
|
|
1783
|
+
else {
|
|
1784
|
+
this.attentionIsLatest = false;
|
|
1785
|
+
this.io.postActivity(this.activityPayload(mapped.activity.hookEvent, mapped.activity.subtype, compactionBeat ? { requestId: this.compaction?.requestId, reason: this.compaction?.reason,
|
|
1786
|
+
...(event.type === "compaction_end" ? { endedAt: this.compaction?.endedAt } : {}) } : {}));
|
|
1787
|
+
}
|
|
1463
1788
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1789
|
+
finally {
|
|
1790
|
+
if (compactionBeat && event.type === "compaction_end") {
|
|
1791
|
+
this.lastPostedHook = null;
|
|
1792
|
+
this.lastHeartbeatMs = null;
|
|
1793
|
+
}
|
|
1467
1794
|
}
|
|
1468
1795
|
}
|
|
1469
1796
|
/** Re-deliver OMP or managed run identity until the daemon confirms the resume token.
|
|
@@ -1535,6 +1862,11 @@ export class RunnerCore {
|
|
|
1535
1862
|
sessionFile: this.sessionFile,
|
|
1536
1863
|
sessionId: this.sessionId,
|
|
1537
1864
|
lastEntryId: this.lastEntryId,
|
|
1865
|
+
...(this.runtime === "pi" ? {
|
|
1866
|
+
compaction: this.compaction,
|
|
1867
|
+
requestedCompaction: this.requestedCompaction,
|
|
1868
|
+
pendingCompaction: this.pendingCompaction,
|
|
1869
|
+
} : {}),
|
|
1538
1870
|
updatedAt: this.io.now(),
|
|
1539
1871
|
...patch,
|
|
1540
1872
|
});
|
|
@@ -1801,6 +2133,115 @@ export function piLaunchCapabilityError(command, trust, line, readVersion) {
|
|
|
1801
2133
|
catch { /* diagnostics only; never changes the child's outcome */ }
|
|
1802
2134
|
return `Pi invoked as ${command} (${version}; exact executable path unknown) rejects the managed --name/--${trust} flags. Install the current @earendil-works/pi-coding-agent (npm install -g @earendil-works/pi-coding-agent) and check 'command -v pi' in this pane; an older Pi installation may be shadowing it.`;
|
|
1803
2135
|
}
|
|
2136
|
+
function isPermanentPiRunRefusal(status, code) {
|
|
2137
|
+
if (![401, 403, 404, 409, 410].includes(status) || ["runner_hello_required", "runner_grant_pending", "runner_grant_unverified"].includes(code ?? ""))
|
|
2138
|
+
return false;
|
|
2139
|
+
return status === 401 || status === 403 || ["runner_grant_required", "runner_grant_revoked", "runner_grant_stale"].includes(code ?? "");
|
|
2140
|
+
}
|
|
2141
|
+
function runnerFrameBound(buffer) {
|
|
2142
|
+
const overhead = 64 * 1024;
|
|
2143
|
+
const fallback = { limit: 6 * 1024 * 1024 + overhead };
|
|
2144
|
+
if (!buffer.startsWith(": runner-frame-chars=") || !buffer.includes("\n"))
|
|
2145
|
+
return fallback;
|
|
2146
|
+
const header = /^: runner-frame-chars=([0-9]+)\n/.exec(buffer);
|
|
2147
|
+
const chars = header ? Number(header[1]) : NaN;
|
|
2148
|
+
if (!Number.isSafeInteger(chars) || chars < 1 || chars > Number.MAX_SAFE_INTEGER - overhead)
|
|
2149
|
+
throw new Error("Invalid channel frame size");
|
|
2150
|
+
return { limit: chars + overhead, chars };
|
|
2151
|
+
}
|
|
2152
|
+
/** Pi's HTTP/SSE wire loop; it owns no native executor or durable receiver journal. */
|
|
2153
|
+
export async function connectPiRunnerChannel(core, endpoint, runId, signal) {
|
|
2154
|
+
let retained = false, cursor = 0;
|
|
2155
|
+
while (!signal.aborted) {
|
|
2156
|
+
try {
|
|
2157
|
+
if (!core.isReady()) {
|
|
2158
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
2159
|
+
continue;
|
|
2160
|
+
}
|
|
2161
|
+
const hello = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { method: "POST", signal: AbortSignal.any([signal, AbortSignal.timeout(3000)]),
|
|
2162
|
+
headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" },
|
|
2163
|
+
body: JSON.stringify({ type: "hello", version: 1, runId, retained, capabilities: core.nativeChannelCapabilities() }) });
|
|
2164
|
+
if (!hello.ok) {
|
|
2165
|
+
const failure = await hello.json().catch(() => null);
|
|
2166
|
+
if (isPermanentPiRunRefusal(hello.status, failure?.code)) {
|
|
2167
|
+
core.quarantineManagedChannel();
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
throw new Error("Channel handshake unavailable");
|
|
2171
|
+
}
|
|
2172
|
+
retained = true;
|
|
2173
|
+
const response = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { signal,
|
|
2174
|
+
headers: { authorization: `Bearer ${endpoint.token}`, "Last-Event-ID": String(cursor) } });
|
|
2175
|
+
if (!response.ok) {
|
|
2176
|
+
const failure = await response.json().catch(() => null);
|
|
2177
|
+
if (isPermanentPiRunRefusal(response.status, failure?.code)) {
|
|
2178
|
+
core.quarantineManagedChannel();
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
throw new Error("Channel subscription unavailable");
|
|
2182
|
+
}
|
|
2183
|
+
if (!response.body)
|
|
2184
|
+
throw new Error("Channel subscription unavailable");
|
|
2185
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
2186
|
+
let buffer = "";
|
|
2187
|
+
try {
|
|
2188
|
+
for (;;) {
|
|
2189
|
+
const chunk = await reader.read();
|
|
2190
|
+
if (chunk.done)
|
|
2191
|
+
break;
|
|
2192
|
+
buffer += chunk.value.replace(/\r/g, "");
|
|
2193
|
+
let end;
|
|
2194
|
+
while ((end = buffer.indexOf("\n\n")) >= 0) {
|
|
2195
|
+
const bound = runnerFrameBound(buffer);
|
|
2196
|
+
if (end > bound.limit)
|
|
2197
|
+
throw new Error("Channel frame too large");
|
|
2198
|
+
const block = buffer.slice(0, end);
|
|
2199
|
+
buffer = buffer.slice(end + 2);
|
|
2200
|
+
const data = block.split("\n").filter(line => line.startsWith("data: ")).map(line => line.slice(6)).join("\n");
|
|
2201
|
+
if (bound.chars !== undefined && data.length !== bound.chars)
|
|
2202
|
+
throw new Error("Channel frame size mismatch");
|
|
2203
|
+
if (!data)
|
|
2204
|
+
continue;
|
|
2205
|
+
const frame = JSON.parse(data);
|
|
2206
|
+
if (frame.runId !== runId || !Number.isSafeInteger(frame.sequence) || frame.sequence < 1)
|
|
2207
|
+
throw new Error("Invalid channel frame");
|
|
2208
|
+
cursor = Math.max(cursor, frame.sequence);
|
|
2209
|
+
// Do not block reconnection on an ack whose response was lost; the core retains its acceptance promise.
|
|
2210
|
+
void core.acceptRunnerRequest(frame).catch(() => { });
|
|
2211
|
+
}
|
|
2212
|
+
if (buffer.length > runnerFrameBound(buffer).limit)
|
|
2213
|
+
throw new Error("Channel frame too large");
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
finally {
|
|
2217
|
+
await reader.cancel().catch(() => { });
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
catch { /* Same live process/map reconnects; native writes never replay here. */ }
|
|
2221
|
+
if (!signal.aborted)
|
|
2222
|
+
await new Promise(resolve => setTimeout(resolve, 250));
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
async function postPiRunnerChannel(endpoint, body, signal, onPermanentRunRefusal) {
|
|
2226
|
+
while (!signal.aborted) {
|
|
2227
|
+
try {
|
|
2228
|
+
const response = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { method: "POST",
|
|
2229
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(3000)]), headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" }, body: JSON.stringify(body) });
|
|
2230
|
+
if (response.ok)
|
|
2231
|
+
return true;
|
|
2232
|
+
const failure = await response.json().catch(() => null);
|
|
2233
|
+
if ([401, 403, 404, 409, 410].includes(response.status) && !["runner_hello_required", "runner_grant_pending", "runner_grant_unverified"].includes(failure?.code ?? "")) {
|
|
2234
|
+
if (isPermanentPiRunRefusal(response.status, failure?.code))
|
|
2235
|
+
onPermanentRunRefusal();
|
|
2236
|
+
return false;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
catch { /* A lost response retries the saved receipt, never the native operation. */ }
|
|
2240
|
+
if (!signal.aborted)
|
|
2241
|
+
await new Promise(resolve => setTimeout(resolve, 250));
|
|
2242
|
+
}
|
|
2243
|
+
return false;
|
|
2244
|
+
}
|
|
1804
2245
|
export async function main(argv = process.argv.slice(2)) {
|
|
1805
2246
|
let args;
|
|
1806
2247
|
try {
|
|
@@ -1985,7 +2426,11 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
1985
2426
|
.catch(() => null)
|
|
1986
2427
|
.finally(() => clearTimeout(timeout));
|
|
1987
2428
|
});
|
|
2429
|
+
const nativePosts = new AbortController(), nativeStream = new AbortController();
|
|
2430
|
+
child.once("exit", () => { nativeStream.abort(); setTimeout(() => nativePosts.abort(), 2000).unref(); });
|
|
2431
|
+
child.once("error", () => { nativeStream.abort(); nativePosts.abort(); });
|
|
1988
2432
|
const io = {
|
|
2433
|
+
...(runtime === "pi" && endpoint && runId ? { postRunner: (body) => postPiRunnerChannel(endpoint, body, nativePosts.signal, () => core.quarantineManagedChannel()) } : {}),
|
|
1989
2434
|
sendRpc: (cmd) => {
|
|
1990
2435
|
try {
|
|
1991
2436
|
child.stdin.write(`${JSON.stringify(cmd)}\n`);
|
|
@@ -2008,7 +2453,10 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
2008
2453
|
},
|
|
2009
2454
|
writeSidecar: (state) => {
|
|
2010
2455
|
try {
|
|
2011
|
-
|
|
2456
|
+
if (runtime === "pi")
|
|
2457
|
+
writePiRunnerSidecar(paths.runnerStatePath, state);
|
|
2458
|
+
else
|
|
2459
|
+
fs.writeFileSync(paths.runnerStatePath, JSON.stringify(state));
|
|
2012
2460
|
}
|
|
2013
2461
|
catch { /* best-effort; adapter falls back to pane markers */ }
|
|
2014
2462
|
},
|
|
@@ -2063,6 +2511,8 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
2063
2511
|
runId: runId,
|
|
2064
2512
|
}, { catchUpSince, runtime, usageFacts: args.usageFacts === true, openRouterCharge: args.openRouterCharge === true, launchCredentialEvidence,
|
|
2065
2513
|
requestedSessionFile: args.sessionFile, model: args.model, thinking: args.thinking });
|
|
2514
|
+
if (runtime === "pi" && endpoint && runId)
|
|
2515
|
+
void connectPiRunnerChannel(core, endpoint, runId, nativeStream.signal);
|
|
2066
2516
|
let transportUp = runtime !== "omp";
|
|
2067
2517
|
readline.createInterface({ input: child.stdout }).on("line", (line) => {
|
|
2068
2518
|
if (runtime === "omp" && !core.isReady()) {
|