Plugin System Phase 1: Runtime Slot (#9) - #20
Merged
Conversation
Abstract cmux behind a RuntimeDriver interface mirroring the existing AgentDriver pattern. Phase 1 of issue #9 — extracts current cmux usage across bash/TS, exposes ops via `cockpit runtime` CLI subcommand, adds optional per-project runtime override to config. Defers workspace/tracker/notifier slots and external plugin loading to later phases.
15-task plan for plugin system phase 1 — runtime abstraction. TDD flow for CmuxDriver + RuntimeRegistry, incremental migration of launch.ts, shutdown.ts, doctor.ts, execute-reaction.sh, spawn-workspace.sh.
…n string)" This reverts commit 7513b9d.
Prevents silent-wrong-send when user does 'cockpit runtime send --command foo bar': commander was binding foo as target and bar as message, then the action silently discarded one. Now errors with a clear message. Flagged by pre-PR code review.
This was referenced Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of issue #9 (Plugin/Extension System). Abstracts cmux behind a
RuntimeDriverinterface mirroring the existingsrc/drivers/agent driver pattern, and exposes runtime ops viacockpit runtime <op>CLI so bash scripts no longer hardcode thecmuxbinary.Closes the largest coupling point identified in the plugin system brainstorm (cmux-threaded through every script). Next phases (workspace/tracker/notifier slots, external plugin loading) remain deferred per spec §Non-Goals.
Spec:
docs/specs/2026-04-20-plugin-system-runtime-design.mdPlan:
docs/specs/2026-04-20-plugin-system-runtime-plan.mdWhat changed
New:
src/runtimes/types.ts—RuntimeDriverinterface + types (WorkspaceRef,RuntimeSpawnOptions,RuntimeProbeResult)src/runtimes/cmux.ts—createCmuxDriver()— cmux-backed impl extracted from scattered call-sitessrc/runtimes/registry.ts—RuntimeRegistrywithforProject/global/probeAllsrc/runtimes/index.ts+ tests (12 cmux tests, 6 registry tests)src/commands/runtime.ts—cockpit runtime status|send|send-key|list|read-screen|stopMigrated to driver:
src/commands/launch.ts— usesRuntimeRegistry(retains 3 boundedexecSynccalls forselect-workspace/current-workspace; phase-1 exception documented in spec §Non-Goals)src/commands/shutdown.ts— full rewrite via registrysrc/commands/doctor.ts— now probes configured runtimes instead of hardcoded cmux check; supports per-project overridesscripts/execute-reaction.sh— all cmux calls →cockpit runtime send/status; 0\$CMUXrefs remainscripts/spawn-workspace.sh— existence-check block migrated; spawn block intentionally deferredConfig (backward compatible):
runtime?: stringat top level (global default, absent = cmux)runtime?: stringper-project (overrides top-level)Doc updates:
README.md— commands table + config JSON example + Runtime Abstraction architecture noteContract highlights
RuntimeDriver.send()delivers AND commits (Enter).CmuxDriverpairscmux sendwithcmux send-key Enterinternally. Bash callers that previously did both explicitly now callcockpit runtime sendonce.status()returnsWorkspaceRef | null— replaces the fragile grep-list-workspaces-and-check-empty-string pattern.Test plan
npm run test -- --run— 56 pass (2 pre-existingconfig.test.tsfailures unrelated to this PR — emoji assertion mismatch that predates this work)npm run lintexits 0npm run buildexits 0cockpit doctorshows new "Runtime 'cmux' installed" checkcockpit runtime --helpshows 6 subcommandscockpit runtime listreturns live workspacescockpit launch+ "New day" force-fresh path (tested by reviewer)auto-fix-cidispatch via migratedexecute-reaction.shPre-PR code review
Internal review flagged one landmine —
cockpit runtime send --command foo barwould silently bindfooas target and discardbar. Fixed in commitd1bdda2with an explicit guard. Other reviewer notes (regex fragility inparseList, shell-injection surface inescape, partial-send atomicity,buildRegistryduplication) are tracked as phase-2 follow-ups per spec scope.Follow-ups (explicitly out of scope)
node_modules(phase 3)select-workspace/current-workspaceabstractionspawn-workspace.sh