@openrig/cli 0.7.7 → 0.7.8
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/openshell/Dockerfile +15 -0
- package/daemon/assets/openshell/README.md +137 -0
- package/daemon/assets/openshell/agents/coordinator/agent.yaml +20 -0
- package/daemon/assets/openshell/agents/coordinator/role.md +1 -0
- package/daemon/assets/openshell/agents/worker/agent.yaml +20 -0
- package/daemon/assets/openshell/agents/worker/role.md +3 -0
- package/daemon/assets/openshell/claude-code-provider.yaml +55 -0
- package/daemon/assets/openshell/driver-v1.schema.json +81 -0
- package/daemon/assets/openshell/guest.py +306 -0
- package/daemon/assets/openshell/policy.yaml +33 -0
- package/daemon/assets/openshell/preset.yaml +12 -0
- package/daemon/assets/openshell/rig.yaml +20 -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/skills/seat-continuity-and-handover/SKILL.md +1 -1
- 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 +16 -6
- package/daemon/context-packs/reference/getting-started.md +8 -3
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +69 -12
- package/daemon/context-packs/reference/whats-new.md +119 -15
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/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/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/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +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 +37 -6
- 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 +6 -3
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +4 -7
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +86 -33
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +13 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +28 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/openshell-driver.d.ts +39 -0
- package/daemon/dist/adapters/openshell-driver.d.ts.map +1 -0
- package/daemon/dist/adapters/openshell-driver.js +139 -0
- package/daemon/dist/adapters/openshell-driver.js.map +1 -0
- package/daemon/dist/adapters/openshell-podman-observer.d.ts +30 -0
- package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -0
- package/daemon/dist/adapters/openshell-podman-observer.js +94 -0
- package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -0
- package/daemon/dist/adapters/pi-openrouter-charge.d.ts +1 -0
- package/daemon/dist/adapters/pi-openrouter-charge.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-openrouter-charge.js +17 -3
- package/daemon/dist/adapters/pi-openrouter-charge.js.map +1 -1
- package/daemon/dist/adapters/tmux-control.d.ts +12 -6
- package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-control.js +42 -21
- package/daemon/dist/adapters/tmux-control.js.map +1 -1
- package/daemon/dist/adapters/tmux-server.d.ts +6 -3
- package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-server.js +13 -8
- package/daemon/dist/adapters/tmux-server.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +8 -2
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +38 -11
- package/daemon/dist/adapters/tmux.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/142_node_claude_mcp.d.ts +3 -0
- package/daemon/dist/db/migrations/142_node_claude_mcp.d.ts.map +1 -0
- package/daemon/dist/db/migrations/142_node_claude_mcp.js +5 -0
- package/daemon/dist/db/migrations/142_node_claude_mcp.js.map +1 -0
- package/daemon/dist/db/migrations/143_activity_grants.d.ts +8 -0
- package/daemon/dist/db/migrations/143_activity_grants.d.ts.map +1 -0
- package/daemon/dist/db/migrations/143_activity_grants.js +22 -0
- package/daemon/dist/db/migrations/143_activity_grants.js.map +1 -0
- package/daemon/dist/db/migrations/144_environment_bindings.d.ts +4 -0
- package/daemon/dist/db/migrations/144_environment_bindings.d.ts.map +1 -0
- package/daemon/dist/db/migrations/144_environment_bindings.js +31 -0
- package/daemon/dist/db/migrations/144_environment_bindings.js.map +1 -0
- package/daemon/dist/db/migrations/145_node_permissions_to.d.ts +5 -0
- package/daemon/dist/db/migrations/145_node_permissions_to.d.ts.map +1 -0
- package/daemon/dist/db/migrations/145_node_permissions_to.js +7 -0
- package/daemon/dist/db/migrations/145_node_permissions_to.js.map +1 -0
- package/daemon/dist/domain/active-occupant.d.ts +2 -0
- package/daemon/dist/domain/active-occupant.d.ts.map +1 -1
- package/daemon/dist/domain/active-occupant.js +9 -1
- package/daemon/dist/domain/active-occupant.js.map +1 -1
- package/daemon/dist/domain/activity-grants.d.ts +63 -0
- package/daemon/dist/domain/activity-grants.d.ts.map +1 -0
- package/daemon/dist/domain/activity-grants.js +106 -0
- package/daemon/dist/domain/activity-grants.js.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/agent-images/agent-image-library-service.js +5 -2
- package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +11 -4
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +34 -10
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-mcp.d.ts +10 -0
- package/daemon/dist/domain/claude-mcp.d.ts.map +1 -0
- package/daemon/dist/domain/claude-mcp.js +19 -0
- package/daemon/dist/domain/claude-mcp.js.map +1 -0
- package/daemon/dist/domain/codex-owned-plugin-trust.d.ts.map +1 -1
- package/daemon/dist/domain/codex-owned-plugin-trust.js +2 -1
- package/daemon/dist/domain/codex-owned-plugin-trust.js.map +1 -1
- package/daemon/dist/domain/community-harness-presets.d.ts +2 -1
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +3 -2
- package/daemon/dist/domain/community-harness-presets.js.map +1 -1
- package/daemon/dist/domain/context-monitor.d.ts +2 -2
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +8 -2
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +21 -0
- package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -0
- package/daemon/dist/domain/desired-claude-activity-hooks.js +30 -0
- package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -0
- 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/environment-artifacts.d.ts +49 -0
- package/daemon/dist/domain/environment-artifacts.d.ts.map +1 -0
- package/daemon/dist/domain/environment-artifacts.js +158 -0
- package/daemon/dist/domain/environment-artifacts.js.map +1 -0
- package/daemon/dist/domain/environment-lifecycle.d.ts +119 -0
- package/daemon/dist/domain/environment-lifecycle.d.ts.map +1 -0
- package/daemon/dist/domain/environment-lifecycle.js +461 -0
- package/daemon/dist/domain/environment-lifecycle.js.map +1 -0
- package/daemon/dist/domain/environment-platform.d.ts +121 -0
- package/daemon/dist/domain/environment-platform.d.ts.map +1 -0
- package/daemon/dist/domain/environment-platform.js +280 -0
- package/daemon/dist/domain/environment-platform.js.map +1 -0
- package/daemon/dist/domain/environment-startup.d.ts +41 -0
- package/daemon/dist/domain/environment-startup.d.ts.map +1 -0
- package/daemon/dist/domain/environment-startup.js +281 -0
- package/daemon/dist/domain/environment-startup.js.map +1 -0
- package/daemon/dist/domain/expected-conversation.d.ts +20 -0
- package/daemon/dist/domain/expected-conversation.d.ts.map +1 -0
- package/daemon/dist/domain/expected-conversation.js +101 -0
- package/daemon/dist/domain/expected-conversation.js.map +1 -0
- package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts +8 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.js +61 -4
- package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts +2 -0
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +40 -8
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +16 -0
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +216 -7
- package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts +14 -0
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js +9 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.js +9 -4
- package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +2 -0
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js +6 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts +22 -0
- package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/hosts-registry-writer.js +116 -0
- package/daemon/dist/domain/hosts/hosts-registry-writer.js.map +1 -1
- package/daemon/dist/domain/kernel-hook-review.d.ts +16 -0
- package/daemon/dist/domain/kernel-hook-review.d.ts.map +1 -0
- package/daemon/dist/domain/kernel-hook-review.js +49 -0
- package/daemon/dist/domain/kernel-hook-review.js.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +3 -0
- 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 +20 -5
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.js +10 -6
- package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
- package/daemon/dist/domain/native-process-lineage.d.ts +3 -0
- package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-lineage.js +34 -1
- package/daemon/dist/domain/native-process-lineage.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts +2 -1
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +4 -2
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +18 -8
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +3 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +6 -0
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +12 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +32 -3
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +10 -0
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js +60 -4
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts +9 -3
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.js +100 -17
- package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.js +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service.d.ts +32 -2
- package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-types.d.ts +1 -1
- package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +36 -5
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +155 -37
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +31 -0
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts +3 -0
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +124 -25
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts +2 -7
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +35 -3
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +166 -21
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -1
- package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.js +20 -6
- package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
- 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 +10 -0
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +37 -0
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +4 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts +8 -0
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +60 -2
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +19 -4
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +24 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/runner-permissions.d.ts +135 -0
- package/daemon/dist/domain/runner-permissions.d.ts.map +1 -0
- package/daemon/dist/domain/runner-permissions.js +318 -0
- package/daemon/dist/domain/runner-permissions.js.map +1 -0
- package/daemon/dist/domain/runtime-adapter.d.ts +10 -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/seat-effort.d.ts +6 -0
- package/daemon/dist/domain/seat-effort.d.ts.map +1 -1
- package/daemon/dist/domain/seat-effort.js +0 -2
- package/daemon/dist/domain/seat-effort.js.map +1 -1
- package/daemon/dist/domain/seat-handover-planner.js +1 -1
- package/daemon/dist/domain/seat-handover-planner.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +2 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +45 -28
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +24 -2
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +62 -1
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +6 -1
- package/daemon/dist/domain/seat-restart-in-place.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 +4 -0
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.d.ts +6 -4
- package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.js +25 -5
- package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
- package/daemon/dist/domain/seat-status-service.d.ts +5 -0
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +9 -0
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/self-attach-service.d.ts +8 -1
- package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
- package/daemon/dist/domain/self-attach-service.js +26 -0
- package/daemon/dist/domain/self-attach-service.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +10 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +112 -10
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +14 -0
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +32 -1
- package/daemon/dist/domain/startup-orchestrator.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/herdr-follow-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-follow-view.js +22 -4
- package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +12 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js +120 -18
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-following.js +1 -1
- package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +3 -2
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +18 -27
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.d.ts +6 -3
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +15 -5
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/tmux-server-selection.d.ts +47 -0
- package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -0
- package/daemon/dist/domain/tmux-server-selection.js +220 -0
- package/daemon/dist/domain/tmux-server-selection.js.map +1 -0
- package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-store.js +8 -5
- package/daemon/dist/domain/transcript-store.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +38 -0
- 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.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +3 -1
- 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 +9 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/watchdog-delivery.d.ts +1 -0
- package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-delivery.js +15 -3
- package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts +2 -0
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +3 -1
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts +1 -1
- package/daemon/dist/index.d.ts +4 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +14 -0
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/activity.d.ts +4 -0
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +258 -18
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/compaction.js +4 -2
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/environments.d.ts +3 -0
- package/daemon/dist/routes/environments.d.ts.map +1 -0
- package/daemon/dist/routes/environments.js +104 -0
- package/daemon/dist/routes/environments.js.map +1 -0
- package/daemon/dist/routes/hosts.d.ts.map +1 -1
- package/daemon/dist/routes/hosts.js +80 -4
- package/daemon/dist/routes/hosts.js.map +1 -1
- package/daemon/dist/routes/provider.d.ts.map +1 -1
- package/daemon/dist/routes/provider.js +53 -7
- package/daemon/dist/routes/provider.js.map +1 -1
- package/daemon/dist/routes/restore-check.d.ts.map +1 -1
- package/daemon/dist/routes/restore-check.js +5 -19
- package/daemon/dist/routes/restore-check.js.map +1 -1
- package/daemon/dist/routes/rigs.js +3 -0
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/rigspec.d.ts.map +1 -1
- package/daemon/dist/routes/rigspec.js +8 -3
- 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 +29 -2
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +66 -20
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +23 -2
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/server.d.ts +6 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +56 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +2 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +61 -26
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-startup-guide.md +4 -0
- package/daemon/docs/reference/author-contracts.md +6 -6
- package/daemon/docs/reference/community-harness-examples/dsh/README.md +71 -0
- package/daemon/docs/reference/community-harness-examples/dsh/dsh.yaml +20 -0
- package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +543 -0
- package/daemon/docs/reference/community-harness-examples/openshell/README.md +5 -0
- package/daemon/docs/reference/community-harness-presets.md +25 -1
- package/daemon/docs/reference/execution-platform-contract.md +1 -1
- package/daemon/docs/reference/getting-started.md +8 -3
- package/daemon/docs/reference/harness-runner-contract.md +151 -16
- package/daemon/docs/reference/pi-tool-selection-recovery.md +83 -0
- package/daemon/docs/reference/quickstart.md +1 -1
- package/daemon/docs/reference/rig-spec.md +69 -12
- package/daemon/docs/reference/runner-conformance/README.md +75 -0
- package/daemon/docs/reference/runner-conformance/check-runner.mjs +698 -0
- package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +143 -0
- package/daemon/docs/reference/terminal-sessions.md +85 -9
- package/daemon/docs/reference/tmux-servers.md +166 -0
- package/daemon/docs/reference/whats-new.md +119 -15
- package/dist/acp/connector.d.ts.map +1 -1
- package/dist/acp/connector.js +6 -1
- package/dist/acp/connector.js.map +1 -1
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -0
- package/dist/client.js.map +1 -1
- package/dist/commands/attach.d.ts +1 -0
- package/dist/commands/attach.d.ts.map +1 -1
- package/dist/commands/attach.js +8 -2
- package/dist/commands/attach.js.map +1 -1
- package/dist/commands/compact.d.ts.map +1 -1
- package/dist/commands/compact.js +7 -4
- package/dist/commands/compact.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +8 -3
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +7 -1
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/destroy.d.ts.map +1 -1
- package/dist/commands/destroy.js +2 -0
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/doctor.d.ts +8 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +79 -5
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/environment.d.ts +8 -0
- package/dist/commands/environment.d.ts.map +1 -0
- package/dist/commands/environment.js +194 -0
- package/dist/commands/environment.js.map +1 -0
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +5 -2
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +77 -7
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +2 -0
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +12 -2
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +54 -4
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +18 -0
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/terminal.d.ts +2 -0
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +31 -2
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/tui.d.ts +3 -2
- package/dist/commands/tui.d.ts.map +1 -1
- package/dist/commands/tui.js.map +1 -1
- package/dist/config-store.d.ts +3 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +10 -0
- package/dist/config-store.js.map +1 -1
- package/dist/cross-host-target.d.ts.map +1 -1
- package/dist/cross-host-target.js +3 -1
- package/dist/cross-host-target.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +6 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +66 -4
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-reachability.d.ts +2 -1
- package/dist/daemon-reachability.d.ts.map +1 -1
- package/dist/daemon-reachability.js +3 -2
- package/dist/daemon-reachability.js.map +1 -1
- package/dist/destroy-helpers.d.ts +3 -2
- package/dist/destroy-helpers.d.ts.map +1 -1
- package/dist/destroy-helpers.js +6 -3
- package/dist/destroy-helpers.js.map +1 -1
- package/dist/host-bindings.js +1 -1
- package/dist/host-bindings.js.map +1 -1
- package/dist/host-registry.d.ts +22 -0
- package/dist/host-registry.d.ts.map +1 -1
- package/dist/host-registry.js +121 -0
- package/dist/host-registry.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lazy-program.d.ts.map +1 -1
- package/dist/lazy-program.js +1 -0
- package/dist/lazy-program.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +36 -2
- package/dist/mcp-server.js.map +1 -1
- package/dist/openrig-compat.d.ts +1 -1
- package/dist/openrig-compat.d.ts.map +1 -1
- package/dist/openrig-compat.js +2 -2
- package/dist/openrig-compat.js.map +1 -1
- package/dist/shared-tui.d.ts +4 -2
- package/dist/shared-tui.d.ts.map +1 -1
- package/dist/shared-tui.js +4 -11
- package/dist/shared-tui.js.map +1 -1
- package/dist/terminal-window.d.ts.map +1 -1
- package/dist/terminal-window.js +34 -29
- package/dist/terminal-window.js.map +1 -1
- package/dist/tmux-attachment.d.ts +17 -0
- package/dist/tmux-attachment.d.ts.map +1 -0
- package/dist/tmux-attachment.js +89 -0
- package/dist/tmux-attachment.js.map +1 -0
- package/package.json +2 -2
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +8 -3
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +7 -1
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
- package/tui/dist/terminals/terminal-model.js +2 -1
- package/tui/dist/terminals/terminal-model.js.map +1 -1
- package/ui/dist/assets/{index-CMBgYrS7.js → index-Ch6UxNld.js} +88 -88
- package/ui/dist/index.html +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Install as $OPENRIG_HOME/community-harnesses/dsh.yaml, with openrig-dsh-runner.mjs (executable) on the seat's PATH.
|
|
2
|
+
format: 1
|
|
3
|
+
name: dsh
|
|
4
|
+
command: openrig-dsh-runner.mjs
|
|
5
|
+
maintainer: Your name or team
|
|
6
|
+
runner: true
|
|
7
|
+
launch_result: true
|
|
8
|
+
first_input: true
|
|
9
|
+
limits:
|
|
10
|
+
- written for dsh 0.2.1-rc.2 (npm @deepseek-ai/dsh) over ACP protocol 1, with Node 22 or later, and checked against a stand-in agent only
|
|
11
|
+
- each seat gets its own dsh home under $OPENRIG_HOME/state/dsh/<node>/home, holding a patch that turns off dsh's session-log and plugin-list uploads to DeepSeek; give it credentials (.credentials.yaml there) or a provider key in the seat's env
|
|
12
|
+
- DSH_PERMISSION_MODE defaults to workspace-write; a permission request goes to the default person or the seat's override (rig seat set-permissions-to), is permitted with dsh's allow_once (else allow_always) when no one can be asked or OpenRig can't answer, and is refused and held as needs input only after --deny
|
|
13
|
+
- allow_always creates a standing grant in dsh, which OpenRig doesn't record or revoke; the runner prefers allow_once, and where dsh keeps the grant and for how long isn't checked
|
|
14
|
+
- resume isn't declared until a real dsh has reopened a conversation and refused a missing one; the runner reopens by the method dsh advertises and reports missing only on dsh's own not-found error
|
|
15
|
+
- a prompt whose whole text is /abort can't be sent; a Ctrl-C byte inside a paste also aborts; without a TTY, input is read line by line; this isn't a binary-safe channel
|
|
16
|
+
- one prompt at a time; a message that arrives mid-turn waits for the next turn
|
|
17
|
+
- the seat's model isn't passed; dsh uses its own configured model
|
|
18
|
+
- no guidance, skills or startup files are placed; dsh reads its own AGENTS.md and skill folders
|
|
19
|
+
- when the pane closes, the runner cancels a running turn and stops dsh; anything dsh's tools started may keep running
|
|
20
|
+
- fork unsupported
|
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Example OpenRig runner for DeepSeek Harness (dsh), not installed by OpenRig. Checked against a stand-in agent only;
|
|
3
|
+
// written for dsh 0.2.1-rc.2 (npm @deepseek-ai/dsh), ACP protocol 1 and Node 22 or later. No dependencies.
|
|
4
|
+
//
|
|
5
|
+
// It follows docs/reference/harness-runner-contract.md: it hosts `dsh --profile acp` over ACP on stdio, writes the
|
|
6
|
+
// launch record once the conversation is open, turns each submitted block into one prompt, reports turn boundaries as
|
|
7
|
+
// activity hooks, cancels on /abort or Ctrl-C, and sends permission requests to OpenRig: a person answers, or OpenRig
|
|
8
|
+
// permits when no one can be asked, and so does the runner when OpenRig can't answer (refusing and holding needs input
|
|
9
|
+
// only when the seat opted in to refusal). Copy it and maintain it as your own.
|
|
10
|
+
|
|
11
|
+
import { spawn } from "node:child_process";
|
|
12
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { homedir } from "node:os";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { createInterface } from "node:readline";
|
|
16
|
+
import { pathToFileURL } from "node:url";
|
|
17
|
+
|
|
18
|
+
const RUNNER = "openrig-dsh-runner 1";
|
|
19
|
+
const NAME = process.env.OPENRIG_RUNTIME || "dsh"; // the preset's name: OpenRig passes it, and checks the record against it
|
|
20
|
+
const LIVENESS_SECONDS = 60;
|
|
21
|
+
const BEAT_MS = 30_000;
|
|
22
|
+
const ACTIVE_EVERY_MS = 15_000;
|
|
23
|
+
const POST_TIMEOUT_MS = 2_000;
|
|
24
|
+
const WAIT_SECONDS = 25;
|
|
25
|
+
const READ_TRIES = 3; // reads in a row that get no answer before the runner permits
|
|
26
|
+
// Refusals that say the request certainly isn't the seat's current occupant's live one: cancel it, and hold nothing.
|
|
27
|
+
const NOT_LIVE = ["stale_generation", "activity_grant_wrong_seat", "activity_grant_stale"];
|
|
28
|
+
// A read's states that end the request, answered cancelled (an `answered` that reaches there names an option dsh didn't
|
|
29
|
+
// offer). Any other state, like an unlisted status, permits.
|
|
30
|
+
const ENDED = ["refused", "withdrawn", "stale", "answered"];
|
|
31
|
+
const CANCELLED = { outcome: { outcome: "cancelled" } };
|
|
32
|
+
const ACP_RESOURCE_NOT_FOUND = -32002;
|
|
33
|
+
|
|
34
|
+
const PASTE_START = "\x1b[200~";
|
|
35
|
+
const PASTE_END = "\x1b[201~";
|
|
36
|
+
|
|
37
|
+
/** Turns terminal bytes into submitted blocks. Everything up to an Enter outside a paste is one block, line breaks
|
|
38
|
+
* included; a block that is exactly /abort, or a Ctrl-C byte, is the only control. */
|
|
39
|
+
export class InputFramer {
|
|
40
|
+
#buffer = "";
|
|
41
|
+
#pasting = false;
|
|
42
|
+
#partial = "";
|
|
43
|
+
|
|
44
|
+
push(chunk) {
|
|
45
|
+
const events = [];
|
|
46
|
+
const data = this.#partial + chunk;
|
|
47
|
+
this.#partial = "";
|
|
48
|
+
let i = 0;
|
|
49
|
+
while (i < data.length) {
|
|
50
|
+
if (data[i] === "\x1b") {
|
|
51
|
+
const rest = data.slice(i);
|
|
52
|
+
if (rest.startsWith(PASTE_START) || rest.startsWith(PASTE_END)) {
|
|
53
|
+
this.#pasting = rest.startsWith(PASTE_START);
|
|
54
|
+
i += PASTE_START.length;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (PASTE_START.startsWith(rest) || PASTE_END.startsWith(rest)) { this.#partial = rest; break; }
|
|
58
|
+
if (!this.#pasting) { i += escapeLength(rest); continue; } // arrow keys and the like
|
|
59
|
+
}
|
|
60
|
+
const ch = data[i];
|
|
61
|
+
i += 1;
|
|
62
|
+
if (ch === "\x03") { this.#buffer = ""; this.#pasting = false; events.push({ type: "abort" }); continue; }
|
|
63
|
+
if (this.#pasting) {
|
|
64
|
+
if (ch === "\r") { if (data[i] === "\n") i += 1; this.#buffer += "\n"; } else this.#buffer += ch;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (ch === "\r" || ch === "\n") {
|
|
68
|
+
const text = this.#buffer;
|
|
69
|
+
this.#buffer = "";
|
|
70
|
+
if (text.trim() === "/abort") events.push({ type: "abort" });
|
|
71
|
+
else if (text.trim()) events.push({ type: "block", text });
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (ch === "\x7f" || ch === "\b") {
|
|
75
|
+
if (this.#buffer) { this.#buffer = this.#buffer.slice(0, -1); events.push({ type: "erase" }); }
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (ch >= " ") { this.#buffer += ch; events.push({ type: "echo", text: ch }); }
|
|
79
|
+
}
|
|
80
|
+
return events;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function escapeLength(rest) {
|
|
85
|
+
if (rest[1] === "[") {
|
|
86
|
+
let j = 2;
|
|
87
|
+
while (j < rest.length && !(rest.charCodeAt(j) >= 0x40 && rest.charCodeAt(j) <= 0x7e)) j += 1;
|
|
88
|
+
return Math.min(j + 1, rest.length);
|
|
89
|
+
}
|
|
90
|
+
return rest[1] === "O" ? Math.min(3, rest.length) : 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** JSON-RPC 2.0 with the agent, one message per line on its stdio. */
|
|
94
|
+
class AgentPeer {
|
|
95
|
+
#child;
|
|
96
|
+
#next = 1;
|
|
97
|
+
#waiting = new Map();
|
|
98
|
+
#requests = new Map();
|
|
99
|
+
#notifications = new Map();
|
|
100
|
+
|
|
101
|
+
constructor(child, onNoise) {
|
|
102
|
+
this.#child = child;
|
|
103
|
+
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
104
|
+
let message;
|
|
105
|
+
try { message = JSON.parse(line); } catch { message = null; }
|
|
106
|
+
if (!message || typeof message !== "object") { if (line.trim()) onNoise(line); return; }
|
|
107
|
+
if (message.method === undefined) {
|
|
108
|
+
const waiter = this.#waiting.get(message.id);
|
|
109
|
+
if (!waiter) return;
|
|
110
|
+
this.#waiting.delete(message.id);
|
|
111
|
+
if (message.error) waiter.reject(Object.assign(new Error(message.error.message ?? "error"), { code: message.error.code }));
|
|
112
|
+
else waiter.resolve(message.result);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (message.id === undefined) { this.#notifications.get(message.method)?.(message.params ?? {}); return; }
|
|
116
|
+
const handler = this.#requests.get(message.method);
|
|
117
|
+
if (!handler) { this.#write({ id: message.id, error: { code: -32601, message: `Method not found: ${message.method}` } }); return; }
|
|
118
|
+
Promise.resolve().then(() => handler(message.params ?? {}, message.id)).then(
|
|
119
|
+
(result) => this.#write({ id: message.id, result }),
|
|
120
|
+
(error) => this.#write({ id: message.id, error: { code: error.code ?? -32603, message: error.message } }));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
request(method, params) {
|
|
125
|
+
const id = this.#next++;
|
|
126
|
+
return new Promise((resolve, reject) => { this.#waiting.set(id, { resolve, reject }); this.#write({ id, method, params }); });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
notify(method, params) { this.#write({ method, params }); }
|
|
130
|
+
onRequest(method, handler) { this.#requests.set(method, handler); }
|
|
131
|
+
onNotification(method, handler) { this.#notifications.set(method, handler); }
|
|
132
|
+
|
|
133
|
+
failAll(reason) {
|
|
134
|
+
for (const waiter of this.#waiting.values()) waiter.reject(new Error(reason));
|
|
135
|
+
this.#waiting.clear();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#write(message) {
|
|
139
|
+
if (this.#child.stdin.writable) this.#child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", ...message })}\n`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const openrigHome = () => process.env.OPENRIG_HOME || join(homedir(), ".openrig");
|
|
144
|
+
|
|
145
|
+
/** The daemon's base URL and the seat's token: from the environment, else from activity-endpoint.json. */
|
|
146
|
+
function openrigEndpoint() {
|
|
147
|
+
const env = process.env;
|
|
148
|
+
let base = env.OPENRIG_URL || (env.OPENRIG_PORT ? `http://${env.OPENRIG_HOST || "127.0.0.1"}:${env.OPENRIG_PORT}` : "");
|
|
149
|
+
let token = env.OPENRIG_ACTIVITY_HOOK_TOKEN || "";
|
|
150
|
+
if (!base || !token) {
|
|
151
|
+
try {
|
|
152
|
+
const file = JSON.parse(readFileSync(join(openrigHome(), "activity-endpoint.json"), "utf8"));
|
|
153
|
+
base ||= file.baseUrl ?? "";
|
|
154
|
+
token ||= file.token ?? "";
|
|
155
|
+
} catch { /* no daemon has written one yet */ }
|
|
156
|
+
}
|
|
157
|
+
return base && token ? { base: base.replace(/\/+$/, ""), token } : null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function callOpenRig(method, path, body, timeoutMs) {
|
|
161
|
+
const endpoint = openrigEndpoint();
|
|
162
|
+
if (!endpoint) return { status: 0, body: null };
|
|
163
|
+
try {
|
|
164
|
+
const response = await fetch(`${endpoint.base}${path}`, {
|
|
165
|
+
method, signal: AbortSignal.timeout(timeoutMs),
|
|
166
|
+
headers: { authorization: `Bearer ${endpoint.token}`, ...(body ? { "content-type": "application/json" } : {}) },
|
|
167
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
168
|
+
});
|
|
169
|
+
let parsed = null;
|
|
170
|
+
try { parsed = await response.json(); } catch { /* not JSON */ }
|
|
171
|
+
return { status: response.status, body: parsed };
|
|
172
|
+
} catch {
|
|
173
|
+
return { status: 0, body: null };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Activity posts go one at a time, in order, and never hold up the agent. */
|
|
178
|
+
class Activity {
|
|
179
|
+
#sequence = 0;
|
|
180
|
+
#chain = Promise.resolve();
|
|
181
|
+
|
|
182
|
+
constructor(identity) { this.identity = identity; }
|
|
183
|
+
|
|
184
|
+
post(hookEvent, subtype, extra = {}) {
|
|
185
|
+
const body = { ...this.identity, sequence: ++this.#sequence, occurredAt: new Date().toISOString(), hookEvent, subtype, ...extra };
|
|
186
|
+
this.#chain = this.#chain.then(() => callOpenRig("POST", "/api/activity/hooks", body, POST_TIMEOUT_MS)).then(() => {}, () => {});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
flushed() { return this.#chain; }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const UPLOADS_OFF = [
|
|
193
|
+
"# Written by openrig-dsh-runner for this seat; safe to edit, and an existing file is left alone.",
|
|
194
|
+
"# Don't attach this seat's session log, or its plugin package names and versions, to DeepSeek API requests.",
|
|
195
|
+
"- id: session-log-deepseek",
|
|
196
|
+
" config:",
|
|
197
|
+
" enabled: false",
|
|
198
|
+
"- id: plugin-package-inventory-deepseek",
|
|
199
|
+
" config:",
|
|
200
|
+
" enabled: false",
|
|
201
|
+
"",
|
|
202
|
+
].join("\n");
|
|
203
|
+
|
|
204
|
+
/** Each seat gets its own writable dsh home (dsh rewrites its profile there on every start). OPENRIG_DSH_HOME names
|
|
205
|
+
* one you prepared yourself, which is used as it is. */
|
|
206
|
+
function seatHome() {
|
|
207
|
+
if (process.env.OPENRIG_DSH_HOME) return process.env.OPENRIG_DSH_HOME;
|
|
208
|
+
const seat = process.env.OPENRIG_NODE_ID || process.env.OPENRIG_SESSION_NAME || "default";
|
|
209
|
+
const home = join(openrigHome(), "state", "dsh", seat, "home");
|
|
210
|
+
mkdirSync(home, { recursive: true, mode: 0o700 });
|
|
211
|
+
const patch = join(home, "cordis.patch.yml");
|
|
212
|
+
if (!existsSync(patch)) writeFileSync(patch, UPLOADS_OFF, { mode: 0o600 });
|
|
213
|
+
return home;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function writeLaunchRecord(fields) {
|
|
217
|
+
const path = process.env.OPENRIG_LAUNCH_RESULT;
|
|
218
|
+
if (!path) return;
|
|
219
|
+
const record = { format: 1, attempt: process.env.OPENRIG_LAUNCH_ATTEMPT, harness: NAME, ...fields };
|
|
220
|
+
const temp = `${path}.${process.pid}.tmp`;
|
|
221
|
+
writeFileSync(temp, `${JSON.stringify(record)}\n`, { mode: 0o600 });
|
|
222
|
+
renameSync(temp, path);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const sleep = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
226
|
+
const say = (line) => process.stdout.write(`${line}\n`);
|
|
227
|
+
const firstLine = (text) => {
|
|
228
|
+
const lines = text.split("\n");
|
|
229
|
+
return lines.length > 1 ? `${lines[0]} … (+${lines.length - 1} lines)` : lines[0];
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
async function main() {
|
|
233
|
+
const env = process.env;
|
|
234
|
+
const cwd = process.cwd();
|
|
235
|
+
let firstInput = null;
|
|
236
|
+
if (env.OPENRIG_FIRST_INPUT) {
|
|
237
|
+
try { firstInput = readFileSync(env.OPENRIG_FIRST_INPUT, "utf8"); } catch (error) {
|
|
238
|
+
console.error(`openrig-dsh-runner: the first startup turn couldn't be read (${error.message}); not starting`);
|
|
239
|
+
process.exit(2);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const home = seatHome();
|
|
244
|
+
const activity = new Activity({ sessionName: env.OPENRIG_SESSION_NAME, nodeId: env.OPENRIG_NODE_ID,
|
|
245
|
+
runtime: NAME, generation: env.OPENRIG_OCCUPANT_GENERATION });
|
|
246
|
+
const agentEnv = { ...env, DSH_HOME: home };
|
|
247
|
+
delete agentEnv.OPENRIG_ACTIVITY_HOOK_TOKEN; // dsh's shell tool inherits this environment
|
|
248
|
+
agentEnv.DSH_PERMISSION_MODE ??= "workspace-write";
|
|
249
|
+
if (agentEnv.DSH_TELEMETRY_DISABLED === undefined && agentEnv.DSH_TELEMETRY_MODE === undefined) agentEnv.DSH_TELEMETRY_DISABLED = "1";
|
|
250
|
+
|
|
251
|
+
const child = spawn(env.OPENRIG_DSH || "dsh", ["--profile", "acp"], { cwd, env: agentEnv, stdio: ["pipe", "pipe", "inherit"] });
|
|
252
|
+
child.stdin.on("error", () => {});
|
|
253
|
+
const peer = new AgentPeer(child, (line) => say(`[dsh] ${line}`));
|
|
254
|
+
const state = { sessionId: null, turn: 0, running: false, cancelRequestedAt: null, holding: false, refused: false, queue: [], asks: new Set(), lastActive: 0 };
|
|
255
|
+
const inflight = new Set();
|
|
256
|
+
const track = (promise) => { inflight.add(promise); promise.finally(() => inflight.delete(promise)); return promise; };
|
|
257
|
+
let agentExited = false;
|
|
258
|
+
let stopping = false;
|
|
259
|
+
let heartbeat;
|
|
260
|
+
let tty = false;
|
|
261
|
+
|
|
262
|
+
const restoreTty = () => {
|
|
263
|
+
if (!tty) return;
|
|
264
|
+
tty = false;
|
|
265
|
+
process.stdout.write("\x1b[?2004l");
|
|
266
|
+
try { process.stdin.setRawMode(false); } catch { /* already closed */ }
|
|
267
|
+
};
|
|
268
|
+
const finish = async (code) => {
|
|
269
|
+
clearInterval(heartbeat);
|
|
270
|
+
restoreTty();
|
|
271
|
+
await Promise.race([Promise.allSettled([...inflight, activity.flushed()]), sleep(2_000)]);
|
|
272
|
+
process.exit(code);
|
|
273
|
+
};
|
|
274
|
+
const fatal = async (message, code) => {
|
|
275
|
+
stopping = true;
|
|
276
|
+
say(`[openrig-dsh] ${message}`);
|
|
277
|
+
if (!agentExited) {
|
|
278
|
+
child.kill("SIGTERM");
|
|
279
|
+
await Promise.race([new Promise((done) => child.once("exit", done)), sleep(3_000)]);
|
|
280
|
+
}
|
|
281
|
+
await finish(code);
|
|
282
|
+
};
|
|
283
|
+
const postIdle = (subtype) => activity.post("Stop", subtype, { livenessSeconds: LIVENESS_SECONDS });
|
|
284
|
+
const withdraw = (askId, reason) => track(callOpenRig("POST", `/api/activity/permission-requests/${encodeURIComponent(askId)}/withdraw`, { reason }, POST_TIMEOUT_MS));
|
|
285
|
+
|
|
286
|
+
child.once("error", (error) => { agentExited = true; void fatal(`dsh couldn't be started (${error.message}); is it on PATH?`, 1); });
|
|
287
|
+
child.on("exit", (code, signal) => {
|
|
288
|
+
agentExited = true;
|
|
289
|
+
peer.failAll("dsh exited");
|
|
290
|
+
if (stopping) return;
|
|
291
|
+
for (const ask of state.asks) ask.end("exited");
|
|
292
|
+
say(`\n[openrig-dsh] dsh exited (code ${code ?? "none"}, signal ${signal ?? "none"})`);
|
|
293
|
+
activity.post("Stop", `${NAME}_exited`);
|
|
294
|
+
void finish(code === 0 ? 0 : 1);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
peer.onNotification("session/update", (params) => {
|
|
298
|
+
if (params.sessionId !== state.sessionId || !params.update) return;
|
|
299
|
+
const update = params.update;
|
|
300
|
+
const reporting = state.running && !state.holding; // while needs input is held, nothing may read working
|
|
301
|
+
if (update.sessionUpdate === "agent_message_chunk") {
|
|
302
|
+
if (update.content?.type === "text") process.stdout.write(update.content.text);
|
|
303
|
+
if (reporting && Date.now() - state.lastActive >= ACTIVE_EVERY_MS) { state.lastActive = Date.now(); activity.post("active", "agent_message"); }
|
|
304
|
+
} else if (update.sessionUpdate === "tool_call") {
|
|
305
|
+
say(`\n[tool] ${update.title ?? "tool"} (${update.kind ?? "other"})`);
|
|
306
|
+
if (reporting) activity.post("PreToolUse", String(update.kind ?? "other"));
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
const refuse = (why) => {
|
|
311
|
+
state.holding = true;
|
|
312
|
+
state.refused = true; // the seat's own refusal holds needs input until the next prompt
|
|
313
|
+
say(`[permission] refused: ${why}. The seat reads needs input until the next prompt.`);
|
|
314
|
+
activity.post("Notification", "permission_prompt", { turnId: String(state.turn) });
|
|
315
|
+
return CANCELLED;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
// The answered path: OpenRig opens one ask to the default person (or the seat's override, `rig seat
|
|
319
|
+
// set-permissions-to`), and the runner reads the answer back for this same live request. With no one to ask, OpenRig
|
|
320
|
+
// permits at once, and so does the runner when OpenRig can't answer. Only the seat's opt-in (`--deny`) refuses; a
|
|
321
|
+
// request OpenRig says isn't the current occupant's, or that a person said no to with no reject option, is cancelled.
|
|
322
|
+
const askOwner = async (requestId, toolCall, options) => {
|
|
323
|
+
const turn = state.turn;
|
|
324
|
+
const live = () => state.running && state.turn === turn && !state.cancelRequestedAt && !agentExited;
|
|
325
|
+
const submitted = await callOpenRig("POST", "/api/activity/permission-requests", {
|
|
326
|
+
sessionName: env.OPENRIG_SESSION_NAME, nodeId: env.OPENRIG_NODE_ID, generation: env.OPENRIG_OCCUPANT_GENERATION,
|
|
327
|
+
nativeRef: state.sessionId, turnId: String(turn), requestId: String(requestId), toolCall,
|
|
328
|
+
options: options.map((option) => ({ optionId: option.optionId, name: option.name ?? option.optionId, kind: option.kind })),
|
|
329
|
+
occurredAt: new Date().toISOString(),
|
|
330
|
+
}, 10_000);
|
|
331
|
+
const askId = submitted.body?.ok ? submitted.body.askId : undefined;
|
|
332
|
+
if (!live()) {
|
|
333
|
+
if (askId) withdraw(askId, state.cancelRequestedAt ? "turn_cancelled" : agentExited ? "exited" : "turn_ended");
|
|
334
|
+
return CANCELLED;
|
|
335
|
+
}
|
|
336
|
+
const offered = (optionId) => options.some((option) => option.optionId === optionId);
|
|
337
|
+
// No one can be asked: OpenRig's default is permit, with the agent's own allow option.
|
|
338
|
+
if (submitted.body?.ok && submitted.body.state === "permitted" && offered(submitted.body.optionId)) {
|
|
339
|
+
say(`[permission] permitted: ${submitted.body.reason ?? "no one can be asked"} (${submitted.body.optionId})`);
|
|
340
|
+
return { outcome: { outcome: "selected", optionId: submitted.body.optionId } };
|
|
341
|
+
}
|
|
342
|
+
// When OpenRig can't answer, nobody can be asked either, so the same default applies. allow_once is preferred, so
|
|
343
|
+
// dsh doesn't remember a permission nobody chose.
|
|
344
|
+
const allow = options.find((option) => option.kind === "allow_once") ?? options.find((option) => option.kind === "allow_always");
|
|
345
|
+
const permit = (why) => {
|
|
346
|
+
if (!allow) return refuse(`${why}, and the agent offered no allow option`);
|
|
347
|
+
state.holding = false;
|
|
348
|
+
say(`[permission] permitted: ${why} (${allow.optionId})`);
|
|
349
|
+
return { outcome: { outcome: "selected", optionId: allow.optionId } };
|
|
350
|
+
};
|
|
351
|
+
if (!askId) {
|
|
352
|
+
if (submitted.body?.code === "denied_by_seat") return refuse("the seat's operator chose to refuse its permission requests");
|
|
353
|
+
if (NOT_LIVE.includes(submitted.body?.code)) {
|
|
354
|
+
say(`[permission] cancelled: OpenRig says this isn't the seat's current request (${submitted.body.code})`);
|
|
355
|
+
return CANCELLED;
|
|
356
|
+
}
|
|
357
|
+
return permit(submitted.status === 404 ? "this OpenRig has no answered path"
|
|
358
|
+
: submitted.status === 0 ? "OpenRig couldn't be reached" : `OpenRig couldn't ask anyone (${submitted.body?.code ?? submitted.status})`);
|
|
359
|
+
}
|
|
360
|
+
state.holding = true; // OpenRig recorded the seat's permission prompt when it opened the ask
|
|
361
|
+
say(`[permission] OpenRig asked a person (${askId}); waiting for their answer`);
|
|
362
|
+
return new Promise((resolve) => {
|
|
363
|
+
let done = false; // the agent has its answer
|
|
364
|
+
let ended = false; // OpenRig was told the request is over
|
|
365
|
+
const ask = { end: (reason) => {
|
|
366
|
+
if (ended) return;
|
|
367
|
+
ended = true;
|
|
368
|
+
state.asks.delete(ask);
|
|
369
|
+
withdraw(askId, reason);
|
|
370
|
+
if (done) return;
|
|
371
|
+
done = true;
|
|
372
|
+
if (!state.refused) state.holding = false; // the turn ended the person's ask: no one is still being asked
|
|
373
|
+
resolve(CANCELLED);
|
|
374
|
+
} };
|
|
375
|
+
state.asks.add(ask);
|
|
376
|
+
void (async () => {
|
|
377
|
+
let unanswered = 0;
|
|
378
|
+
while (!done) {
|
|
379
|
+
const read = await callOpenRig("GET", `/api/activity/permission-requests/${encodeURIComponent(askId)}?waitSeconds=${WAIT_SECONDS}`, null, (WAIT_SECONDS + 10) * 1_000);
|
|
380
|
+
if (done) return;
|
|
381
|
+
if (read.status === 0 && ++unanswered < READ_TRIES) { await sleep(2_000); continue; }
|
|
382
|
+
if (read.status === 200 && read.body?.state === "pending") { unanswered = 0; continue; }
|
|
383
|
+
done = true;
|
|
384
|
+
const answer = read.body ?? {};
|
|
385
|
+
// A person's option, or OpenRig's permit when they closed it without one.
|
|
386
|
+
if ((answer.state === "answered" || answer.state === "permitted") && offered(answer.optionId) && live()) {
|
|
387
|
+
state.asks.delete(ask);
|
|
388
|
+
state.holding = false;
|
|
389
|
+
say(`[permission] ${answer.state}: ${answer.optionId}`);
|
|
390
|
+
resolve({ outcome: { outcome: "selected", optionId: answer.optionId } });
|
|
391
|
+
} else if (live() && (read.status === 200 ? !ENDED.includes(answer.state) : !NOT_LIVE.includes(answer.code))) {
|
|
392
|
+
// OpenRig stopped answering, or answered in a way the contract doesn't list: nobody can be asked. The ask stays
|
|
393
|
+
// tracked, so the turn's end still withdraws it.
|
|
394
|
+
resolve(permit(read.status === 0 ? "OpenRig couldn't be reached" : `OpenRig couldn't answer (${answer.code ?? read.status})`));
|
|
395
|
+
} else {
|
|
396
|
+
state.asks.delete(ask);
|
|
397
|
+
state.holding = false; // a person said no, or the request is over: no one is still waiting
|
|
398
|
+
say(`[permission] not answered (${answer.reason ?? answer.state ?? answer.code ?? read.status}); answered cancelled`);
|
|
399
|
+
resolve(CANCELLED);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
})();
|
|
403
|
+
});
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
peer.onRequest("session/request_permission", (params, requestId) => {
|
|
407
|
+
if (params.sessionId !== state.sessionId) throw Object.assign(new Error(`no turn of conversation ${params.sessionId} runs here`), { code: -32602 });
|
|
408
|
+
const toolCall = { title: String(params.toolCall?.title ?? "a tool call"), kind: String(params.toolCall?.kind ?? "other") };
|
|
409
|
+
const options = Array.isArray(params.options) ? params.options : [];
|
|
410
|
+
say(`\n[permission] dsh asks: ${toolCall.title} (${toolCall.kind}); options ${options.map((option) => option.optionId).join(", ")}`);
|
|
411
|
+
if (!state.running || state.cancelRequestedAt) return CANCELLED;
|
|
412
|
+
return askOwner(requestId, toolCall, options);
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
const abort = () => {
|
|
416
|
+
if (!state.running) { say("[openrig-dsh] no turn is running"); return; }
|
|
417
|
+
if (state.cancelRequestedAt) return;
|
|
418
|
+
state.cancelRequestedAt = new Date().toISOString();
|
|
419
|
+
peer.notify("session/cancel", { sessionId: state.sessionId });
|
|
420
|
+
say(`\n[openrig-dsh] cancel requested at ${state.cancelRequestedAt}; the turn ends when dsh says so`);
|
|
421
|
+
if (!state.refused) state.holding = false; // the seat's own refusal holds until the next accepted prompt
|
|
422
|
+
for (const ask of state.asks) ask.end("turn_cancelled");
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const runTurn = async (text) => {
|
|
426
|
+
state.running = true;
|
|
427
|
+
state.turn += 1;
|
|
428
|
+
state.holding = false;
|
|
429
|
+
state.refused = false;
|
|
430
|
+
state.cancelRequestedAt = null;
|
|
431
|
+
state.lastActive = 0;
|
|
432
|
+
const turnId = String(state.turn);
|
|
433
|
+
say(`\nyou ▸ ${firstLine(text)}`);
|
|
434
|
+
activity.post("UserPromptSubmit", "accepted", { turnId });
|
|
435
|
+
let stopReason;
|
|
436
|
+
try {
|
|
437
|
+
const result = await peer.request("session/prompt", { sessionId: state.sessionId, prompt: [{ type: "text", text }] });
|
|
438
|
+
stopReason = String(result?.stopReason ?? "unreported");
|
|
439
|
+
} catch (error) {
|
|
440
|
+
if (agentExited) return;
|
|
441
|
+
say(`\n[openrig-dsh] the turn failed: ${error.message}`);
|
|
442
|
+
activity.post("Notification", "runtime_error", { turnId });
|
|
443
|
+
stopReason = "error";
|
|
444
|
+
}
|
|
445
|
+
state.running = false;
|
|
446
|
+
for (const ask of state.asks) ask.end("turn_ended");
|
|
447
|
+
say(`\n── turn end (${stopReason}) ──`);
|
|
448
|
+
if (state.holding) say("[openrig-dsh] a permission request was refused, so the seat reads needs input until the next prompt");
|
|
449
|
+
else postIdle(stopReason);
|
|
450
|
+
pump();
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
const pump = () => {
|
|
454
|
+
if (state.running || agentExited || state.queue.length === 0) return;
|
|
455
|
+
void runTurn(state.queue.shift());
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const submit = (text) => {
|
|
459
|
+
if (agentExited) return;
|
|
460
|
+
state.queue.push(text);
|
|
461
|
+
if (state.running) say(`[queued: ${state.queue.length}] this goes to dsh after the current turn`);
|
|
462
|
+
pump();
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// Handshake, then open or reopen the conversation, then report it. Nothing is read as ready before this.
|
|
466
|
+
let init;
|
|
467
|
+
try {
|
|
468
|
+
init = await peer.request("initialize", { protocolVersion: 1, clientCapabilities: {}, clientInfo: { name: "openrig-dsh-runner", version: "1" } });
|
|
469
|
+
} catch (error) {
|
|
470
|
+
return fatal(`dsh didn't complete the ACP handshake (${error.message})`, 1);
|
|
471
|
+
}
|
|
472
|
+
const capabilities = init?.agentCapabilities ?? {};
|
|
473
|
+
const producer = `${RUNNER}; dsh ${init?.agentInfo?.version ?? "(version not reported)"}; ACP ${init?.protocolVersion ?? "?"}`;
|
|
474
|
+
const resumeRef = env.OPENRIG_RESUME_REF;
|
|
475
|
+
if (resumeRef) {
|
|
476
|
+
// The method dsh advertises; with neither advertised, session/resume, the method dsh 0.2.1-rc.2 answered in its
|
|
477
|
+
// maintainer's checks. Only dsh's own "not found" counts as missing; anything else leaves the resume unconfirmed.
|
|
478
|
+
const method = capabilities.sessionCapabilities?.resume ? "session/resume" : capabilities.loadSession ? "session/load" : "session/resume";
|
|
479
|
+
try {
|
|
480
|
+
await peer.request(method, { sessionId: resumeRef, cwd, mcpServers: [] });
|
|
481
|
+
} catch (error) {
|
|
482
|
+
if (error.code === ACP_RESOURCE_NOT_FOUND) {
|
|
483
|
+
writeLaunchRecord({ error: "missing", producer });
|
|
484
|
+
return fatal(`dsh says conversation ${resumeRef} doesn't exist (${error.message}); no new one was started`, 3);
|
|
485
|
+
}
|
|
486
|
+
return fatal(`dsh couldn't reopen conversation ${resumeRef} (${method}: ${error.message}); the resume is unconfirmed and no new conversation was started`, 4);
|
|
487
|
+
}
|
|
488
|
+
state.sessionId = resumeRef;
|
|
489
|
+
} else {
|
|
490
|
+
try {
|
|
491
|
+
state.sessionId = (await peer.request("session/new", { cwd, mcpServers: [] }))?.sessionId ?? null;
|
|
492
|
+
} catch (error) {
|
|
493
|
+
return fatal(`dsh couldn't open a conversation (${error.message})`, 1);
|
|
494
|
+
}
|
|
495
|
+
if (!state.sessionId) return fatal("dsh opened a conversation without naming it", 1);
|
|
496
|
+
}
|
|
497
|
+
writeLaunchRecord({ nativeRef: state.sessionId, producer });
|
|
498
|
+
say(`[openrig-dsh] ready · ${producer} · conversation ${state.sessionId}`);
|
|
499
|
+
say(`[openrig-dsh] DSH_HOME ${home} · DSH_PERMISSION_MODE ${agentEnv.DSH_PERMISSION_MODE}`);
|
|
500
|
+
say("[openrig-dsh] each submitted message is one prompt; /abort or Ctrl-C cancels the running turn");
|
|
501
|
+
|
|
502
|
+
heartbeat = setInterval(() => { if (!state.running && !state.holding && !agentExited) postIdle("idle_heartbeat"); }, BEAT_MS);
|
|
503
|
+
for (const signal of ["SIGHUP", "SIGTERM"]) {
|
|
504
|
+
process.on(signal, () => {
|
|
505
|
+
if (state.running && !state.cancelRequestedAt) peer.notify("session/cancel", { sessionId: state.sessionId });
|
|
506
|
+
for (const ask of state.asks) ask.end("exited");
|
|
507
|
+
child.kill("SIGTERM");
|
|
508
|
+
setTimeout(() => child.kill("SIGKILL"), 3_000).unref();
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
process.on("SIGINT", abort);
|
|
512
|
+
|
|
513
|
+
const framer = new InputFramer();
|
|
514
|
+
if (process.stdin.isTTY) {
|
|
515
|
+
process.stdin.setRawMode(true);
|
|
516
|
+
process.stdout.write("\x1b[?2004h");
|
|
517
|
+
tty = true;
|
|
518
|
+
process.stdin.setEncoding("utf8");
|
|
519
|
+
process.stdin.on("data", (chunk) => {
|
|
520
|
+
for (const event of framer.push(chunk)) {
|
|
521
|
+
if (event.type === "echo") process.stdout.write(event.text);
|
|
522
|
+
else if (event.type === "erase") process.stdout.write("\b \b");
|
|
523
|
+
else if (event.type === "abort") { process.stdout.write("\n"); abort(); }
|
|
524
|
+
else if (event.type === "block") { process.stdout.write("\n"); submit(event.text); }
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
} else {
|
|
528
|
+
createInterface({ input: process.stdin }).on("line", (line) => {
|
|
529
|
+
if (line.trim() === "/abort") abort();
|
|
530
|
+
else if (line.trim()) submit(line);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (firstInput !== null) submit(firstInput);
|
|
535
|
+
else postIdle("idle_heartbeat");
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const invoked = (() => {
|
|
539
|
+
try { return process.argv[1] ? pathToFileURL(realpathSync(process.argv[1])).href : null; } catch { return null; }
|
|
540
|
+
})();
|
|
541
|
+
if (invoked === import.meta.url) {
|
|
542
|
+
main().catch((error) => { console.error(`openrig-dsh-runner: ${error.stack ?? error}`); process.exit(1); });
|
|
543
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# OpenShell reference driver
|
|
2
|
+
|
|
3
|
+
Run `rig environment setup --help` to install the maintained OpenShell 0.1.6 / Claude Code reference from the packaged daemon assets. Its README, image recipe, endpoint-specific policy, example RigSpec/AgentSpecs and versioned driver schema are installed together. Setup prepares files and an ordinary scoped work grant; it does not create compute or launch a provider.
|
|
4
|
+
|
|
5
|
+
This first cut supports explicit owned create or exact attached binding, required destination projection and verified JSON artifact return through authenticated MCP work tools. Explicit owned lifecycle operations retain separate observed receipts. Exact same-host recreate/restore requires verified private history and the selected checkpoint; attached native, storage and compute are preserved. A native process receipt is not a successful model-work claim. Existing unbound host runtimes retain their launch/projection paths.
|
|
@@ -20,7 +20,7 @@ it never reads an unsupported capability as idle, working, ready or verified.
|
|
|
20
20
|
| Resume | when declared | `resume: true` with one of the two above (see [Reopening a conversation](#reopening-a-conversation-resume-true)). Without it, a resume says `Resume is unsupported: community harness "<name>" is launch-only`, and a restore stops and asks. |
|
|
21
21
|
| Activity | partly | Read from the screen only; there are no activity hooks. Work and attention the screen shows are kept, but a screen that looks idle reads `unknown`, never idle, because a quiet prompt can be an approval or a pause. A [runner preset](#runner-presets-runner-true)'s own reports decide it instead. |
|
|
22
22
|
| Attention | partly | Read from the screen: a permission question or numbered choice that OpenRig recognizes reads as needing attention, and `rig send` won't type into it. A prompt it doesn't recognize reads `unknown`. |
|
|
23
|
-
| Approval | no | Approvals stay in the harness's own pane. OpenRig relays none, so a person answers them there. |
|
|
23
|
+
| Approval | no | Approvals stay in the harness's own pane. OpenRig relays none, so a person answers them there. A [runner preset](#runner-presets-runner-true) is the exception: its runner submits the agent's permission requests to OpenRig, which asks a person, and the default is permit (section 7 of the [harness and runner contract](harness-runner-contract.md)). |
|
|
24
24
|
| Cancel | no | OpenRig has no verb that cancels a running turn. `rig seat stop` and `rig down` end the seat's tmux session; anything the harness runs outside its pane, such as a gateway, is its own, and the preset's `limits` should say what keeps running. Restarting in place and switching harness are refused. |
|
|
25
25
|
| Transport | yes | The seat is a tmux pane like any other, so `rig capture`, `rig send` and `--host` work as they do for any seat. |
|
|
26
26
|
|
|
@@ -285,6 +285,30 @@ on it, not Pi choosing by itself to park or hand work on.
|
|
|
285
285
|
|
|
286
286
|
Copy both and maintain them as your own.
|
|
287
287
|
|
|
288
|
+
## An example runner: dsh
|
|
289
|
+
|
|
290
|
+
[`community-harness-examples/dsh/`](community-harness-examples/dsh/) has a runner preset (`runner: true`) and a small runner
|
|
291
|
+
for DeepSeek Harness, which speaks ACP on stdio and has no terminal UI of its own. It's written for dsh 0.2.1-rc.2 and
|
|
292
|
+
checked only against a stand-in agent.
|
|
293
|
+
- **The runner:**
|
|
294
|
+
- it opens the conversation and writes the launch record;
|
|
295
|
+
- it turns each submitted block into one prompt;
|
|
296
|
+
- it reports turn boundaries as activity hooks;
|
|
297
|
+
- it cancels on `/abort` or Ctrl-C, as the [runner contract](harness-runner-contract.md) describes.
|
|
298
|
+
- **Permissions:** it sends each request to OpenRig, which asks the default person or the seat's override.
|
|
299
|
+
- **When no one can be asked, or OpenRig can't answer,** it permits with dsh's own allow option (`allow_once`, else
|
|
300
|
+
`allow_always`), which is OpenRig's default. `allow_always` creates a standing grant in dsh.
|
|
301
|
+
- **It refuses and holds needs input** only after `--deny`. A person's no when dsh offered no reject option, or a
|
|
302
|
+
request OpenRig says isn't the current occupant's, is answered cancelled.
|
|
303
|
+
- **Each seat gets its own dsh home,** with dsh's session-log and plugin-list uploads to DeepSeek turned off. Give that
|
|
304
|
+
home credentials, or put a provider key in the seat's environment.
|
|
305
|
+
- **Resume isn't declared.** The runner reopens a conversation by the method dsh advertises, and reports one missing only
|
|
306
|
+
on dsh's own not-found error. Declare `resume: true` only after a real dsh has reopened a conversation and refused a
|
|
307
|
+
missing one.
|
|
308
|
+
|
|
309
|
+
Its [README](community-harness-examples/dsh/README.md) has the setup and a check you can run without a model. Copy both
|
|
310
|
+
and maintain them as your own.
|
|
311
|
+
|
|
288
312
|
The launcher is the contributor's code, in the contributor's package. OpenRig runs no code from a preset and loads no
|
|
289
313
|
module into its daemon. A preset that sets `launch_result`, `names_conversation`, `startup_assisted`, `first_input`, `runner` or `passes_model` is refused by an older
|
|
290
314
|
OpenRig that doesn't know the field.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This chapter describes the placement and resource responsibilities of an integration author. The harness/runner chapter owns native protocol, model input, activity, attention, permission exchange and turn cancellation. This chapter owns where that harness runs, which files and credentials it can reach, how native state survives an environment change, and how results and resources return to their owners.
|
|
4
4
|
|
|
5
|
-
**Status:** a design contract for authors, with an existing-compatible composition and one measured private implementation. The measured baseline used OpenRig 0.7.4, OpenShell 0.1.6 and Claude Code 2.1.310.
|
|
5
|
+
**Status:** a design contract for authors, with an existing-compatible composition and one measured private implementation. The measured baseline used OpenRig 0.7.4, OpenShell 0.1.6 and Claude Code 2.1.310. 0.7.6 published this draft; publishing it does not implement a generic environment driver, a `DeploySpec` loader or a cross-host native-resume guarantee. Proposed operations below are not commands or accepted configuration keys. Capability support must be stated for the actual integration and version.
|
|
6
6
|
|
|
7
7
|
## Keep the identities and responsibilities separate
|
|
8
8
|
|
|
@@ -191,11 +191,11 @@ You can also read [`skills/rigs/SKILL.md`](../../skills/rigs/SKILL.md) directly.
|
|
|
191
191
|
script will do and changes nothing:
|
|
192
192
|
|
|
193
193
|
```sh
|
|
194
|
-
curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.
|
|
194
|
+
curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.8/scripts/install.sh | sh -s -- --dry-run
|
|
195
195
|
```
|
|
196
196
|
|
|
197
197
|
The same command without `--dry-run`,
|
|
198
|
-
`curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.
|
|
198
|
+
`curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.8/scripts/install.sh | sh`, installs the
|
|
199
199
|
latest published `@openrig/cli` with `npm install -g`,
|
|
200
200
|
runs the Node.js and SQLite check, then `rig setup --dry-run` and `rig setup`. `rig setup` checks both Claude Code and
|
|
201
201
|
Codex and may install a missing one, as described below. A failed step prints
|
|
@@ -509,7 +509,12 @@ rig terminal open saved:kernel --provider herdr --json
|
|
|
509
509
|
rig terminal open saved:kernel --provider cmux --json
|
|
510
510
|
```
|
|
511
511
|
|
|
512
|
-
Use `rig terminal status --json` to inspect provider availability and
|
|
512
|
+
Use `rig terminal status --json` to inspect provider availability, liveness and the
|
|
513
|
+
daemon's effective tmux server. To keep managed seats out of your personal tmux
|
|
514
|
+
session list, opt into [an isolated server](tmux-servers.md) with
|
|
515
|
+
`rig config set terminal.tmux_server isolated`; existing live seats defer the
|
|
516
|
+
switch until they are stopped and the daemon restarts.
|
|
517
|
+
|
|
513
518
|
To keep rigs in separate Herdr sessions, select one explicitly:
|
|
514
519
|
`rig terminal open future-prod-rig --provider herdr --session future-prod`.
|
|
515
520
|
`--session default` selects Herdr's default session; omitting the option keeps
|