First slice of the second-runtime path. Missions now carry
runtime_kind ('zeroclaw' | 'local_herdr') + target_node_id (FK to
nodes) so the mission_orchestrator + phase executors can dispatch
differently depending on where the operator wants execution.
Migration:
- 0055_missions_runtime_kind.sql — adds runtime_kind (NOT NULL
DEFAULT 'zeroclaw' + CHECK), target_node_id (nullable FK ON
DELETE SET NULL). All existing missions backfill to 'zeroclaw'
so behavior is unchanged.
- topology_runs also grows herdr_workspace_id / herdr_tab_id /
herdr_pane_id text columns so a resumed run can reattach to the
same Herdr pane instead of spawning a duplicate.
Code:
- cm-db::repo::missions — Mission + NewMission carry the two new
fields; all SELECTs updated; INSERT COALESCE-defaults
runtime_kind to 'zeroclaw' when unspecified.
- routes::missions::create — validates runtime_kind and requires
target_node_id when kind='local_herdr' (400 otherwise).
- lib/api/missions.ts — RuntimeKind type; Mission carries both;
CreateMissionRequest optional fields.
Behavior is opt-in: no path exists yet to actually create a
local_herdr mission — that lands in Phase 1c (wizard picker). This
commit just makes the schema + validation in place so Phase 1b's
fleet_herdr dispatch module can key on it.
Tests: mission_orchestrator integration test still green.
30 lines
1.0 KiB
PL/PgSQL
30 lines
1.0 KiB
PL/PgSQL
-- Herdr second-runtime path (Phase 1a).
|
|
--
|
|
-- Missions can now execute either through the shared ZeroClaw daemon
|
|
-- (default, headless, browser-driven) OR through a Herdr session on
|
|
-- a specific fleet node (attended, operator-visible, uses that node's
|
|
-- local CLIs). Frontend picks in the wizard; mission_orchestrator +
|
|
-- phase executors dispatch on runtime_kind.
|
|
--
|
|
-- topology_runs grows a nullable (workspace, tab, pane) triple so a
|
|
-- run resumed after a server restart can reattach to the same Herdr
|
|
-- pane instead of spawning a duplicate.
|
|
|
|
BEGIN;
|
|
|
|
ALTER TABLE missions
|
|
ADD COLUMN runtime_kind TEXT NOT NULL DEFAULT 'zeroclaw'
|
|
CHECK (runtime_kind IN ('zeroclaw', 'local_herdr')),
|
|
ADD COLUMN target_node_id UUID REFERENCES nodes(id) ON DELETE SET NULL;
|
|
|
|
CREATE INDEX missions_target_node_idx
|
|
ON missions (target_node_id)
|
|
WHERE target_node_id IS NOT NULL;
|
|
|
|
ALTER TABLE topology_runs
|
|
ADD COLUMN herdr_workspace_id TEXT,
|
|
ADD COLUMN herdr_tab_id TEXT,
|
|
ADD COLUMN herdr_pane_id TEXT;
|
|
|
|
COMMIT;
|