@h-rig/cli 0.0.6-alpha.83 → 0.0.6-alpha.84
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/dist/bin/rig.js +22085 -14618
- package/dist/src/app/board.js +155 -28
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
- package/dist/src/app-opentui/adapters/doctor.js +1 -25
- package/dist/src/app-opentui/adapters/family.d.ts +62 -0
- package/dist/src/app-opentui/adapters/family.js +14305 -0
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
- package/dist/src/app-opentui/adapters/fleet.js +6 -40
- package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
- package/dist/src/app-opentui/adapters/inbox.js +54 -59
- package/dist/src/app-opentui/adapters/init.d.ts +0 -2
- package/dist/src/app-opentui/adapters/init.js +0 -26
- package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
- package/dist/src/app-opentui/adapters/inspect.js +1024 -0
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
- package/dist/src/app-opentui/adapters/pi-attach.js +348 -93
- package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
- package/dist/src/app-opentui/adapters/pi.js +363 -0
- package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
- package/dist/src/app-opentui/adapters/plugin.js +544 -0
- package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
- package/dist/src/app-opentui/adapters/repo.js +186 -0
- package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
- package/dist/src/app-opentui/adapters/run-detail.js +97 -44
- package/dist/src/app-opentui/adapters/server.d.ts +10 -2
- package/dist/src/app-opentui/adapters/server.js +96 -27
- package/dist/src/app-opentui/adapters/tasks.d.ts +0 -2
- package/dist/src/app-opentui/adapters/tasks.js +437 -105
- package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
- package/dist/src/app-opentui/adapters/workspace.js +333 -0
- package/dist/src/app-opentui/autocomplete.d.ts +20 -0
- package/dist/src/app-opentui/autocomplete.js +576 -0
- package/dist/src/app-opentui/bootstrap.js +24296 -16919
- package/dist/src/app-opentui/command-palette.d.ts +3 -0
- package/dist/src/app-opentui/command-palette.js +1010 -0
- package/dist/src/app-opentui/drone.js +8 -6
- package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
- package/dist/src/app-opentui/fleet-stats.js +114 -0
- package/dist/src/app-opentui/index.js +3438 -1724
- package/dist/src/app-opentui/intent.js +71 -48
- package/dist/src/app-opentui/keymap.d.ts +6 -5
- package/dist/src/app-opentui/keymap.js +1064 -23
- package/dist/src/app-opentui/layout.d.ts +7 -0
- package/dist/src/app-opentui/layout.js +13 -6
- package/dist/src/app-opentui/list-search.d.ts +24 -0
- package/dist/src/app-opentui/list-search.js +88 -1
- package/dist/src/app-opentui/pi-host-child.js +33 -1
- package/dist/src/app-opentui/pi-pty-host.d.ts +5 -0
- package/dist/src/app-opentui/pi-pty-host.js +21 -3
- package/dist/src/app-opentui/react/App.d.ts +9 -0
- package/dist/src/app-opentui/react/App.js +5144 -0
- package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
- package/dist/src/app-opentui/react/Backdrop.js +1834 -0
- package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
- package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
- package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
- package/dist/src/app-opentui/react/context.d.ts +17 -0
- package/dist/src/app-opentui/react/context.js +37 -0
- package/dist/src/app-opentui/react/launch.d.ts +2 -0
- package/dist/src/app-opentui/react/launch.js +5743 -0
- package/dist/src/app-opentui/react/nav.d.ts +18 -0
- package/dist/src/app-opentui/react/nav.js +54 -0
- package/dist/src/app-opentui/react/scroll.d.ts +12 -0
- package/dist/src/app-opentui/react/scroll.js +21 -0
- package/dist/src/app-opentui/react/syntax.d.ts +2 -0
- package/dist/src/app-opentui/react/syntax.js +64 -0
- package/dist/src/app-opentui/registry.js +19923 -5151
- package/dist/src/app-opentui/render/constants.d.ts +31 -0
- package/dist/src/app-opentui/render/constants.js +66 -0
- package/dist/src/app-opentui/render/graphics.d.ts +2 -1
- package/dist/src/app-opentui/render/graphics.js +106 -39
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +108 -20
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +7 -0
- package/dist/src/app-opentui/render/image-visual-layer.js +109 -20
- package/dist/src/app-opentui/render/native-host.d.ts +37 -0
- package/dist/src/app-opentui/render/native-host.js +179 -0
- package/dist/src/app-opentui/render/panels.js +18 -11
- package/dist/src/app-opentui/render/preloader.js +8 -6
- package/dist/src/app-opentui/render/scene.d.ts +50 -1
- package/dist/src/app-opentui/render/scene.js +183 -6
- package/dist/src/app-opentui/render/text.d.ts +7 -1
- package/dist/src/app-opentui/render/text.js +10 -7
- package/dist/src/app-opentui/render/type-bar.js +69 -30
- package/dist/src/app-opentui/runtime.d.ts +44 -1
- package/dist/src/app-opentui/runtime.js +3231 -1363
- package/dist/src/app-opentui/scenes/command.js +20 -6
- package/dist/src/app-opentui/scenes/doctor.js +176 -11
- package/dist/src/app-opentui/scenes/error.js +20 -10
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
- package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
- package/dist/src/app-opentui/scenes/family.d.ts +3 -0
- package/dist/src/app-opentui/scenes/family.js +2144 -0
- package/dist/src/app-opentui/scenes/fleet.js +521 -31
- package/dist/src/app-opentui/scenes/handoff.js +204 -12
- package/dist/src/app-opentui/scenes/help.js +609 -40
- package/dist/src/app-opentui/scenes/inbox.js +278 -17
- package/dist/src/app-opentui/scenes/init.js +84 -39
- package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
- package/dist/src/app-opentui/scenes/inspect.js +793 -0
- package/dist/src/app-opentui/scenes/main.js +218 -39
- package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
- package/dist/src/app-opentui/scenes/pi.js +508 -0
- package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
- package/dist/src/app-opentui/scenes/plugin.js +486 -0
- package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
- package/dist/src/app-opentui/scenes/repo.js +424 -0
- package/dist/src/app-opentui/scenes/run-detail.js +333 -20
- package/dist/src/app-opentui/scenes/server.js +181 -15
- package/dist/src/app-opentui/scenes/tasks.js +486 -31
- package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
- package/dist/src/app-opentui/scenes/workspace.js +426 -0
- package/dist/src/app-opentui/selectable.d.ts +19 -0
- package/dist/src/app-opentui/selectable.js +79 -0
- package/dist/src/app-opentui/state.js +83 -30
- package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
- package/dist/src/app-opentui/surface-catalog.js +540 -0
- package/dist/src/app-opentui/theme.d.ts +28 -6
- package/dist/src/app-opentui/theme.js +61 -8
- package/dist/src/app-opentui/types.d.ts +121 -4
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +2 -12
- package/dist/src/commands/_help-catalog.js +95 -15
- package/dist/src/commands/_operator-view.js +34 -2
- package/dist/src/commands/_pi-frontend.d.ts +2 -0
- package/dist/src/commands/_pi-frontend.js +34 -0
- package/dist/src/commands/_server-events.d.ts +26 -0
- package/dist/src/commands/_server-events.js +310 -0
- package/dist/src/commands/agent.js +2 -12
- package/dist/src/commands/run.js +34 -2
- package/dist/src/commands/server.js +2 -12
- package/dist/src/commands/stats.js +95 -15
- package/dist/src/commands/task-run-driver.js +2 -12
- package/dist/src/commands/task.js +131 -29
- package/dist/src/commands.js +192 -31
- package/dist/src/index.js +192 -31
- package/package.json +11 -9
|
@@ -306,18 +306,8 @@ import {
|
|
|
306
306
|
import { resolveMonorepoRoot } from "@rig/runtime/control-plane/native/utils";
|
|
307
307
|
|
|
308
308
|
// packages/cli/src/commands/_authority-runs.ts
|
|
309
|
-
function normalizeRuntimeAdapter(
|
|
310
|
-
|
|
311
|
-
if (!normalized) {
|
|
312
|
-
return "pi";
|
|
313
|
-
}
|
|
314
|
-
if (normalized === "codex" || normalized === "codex-cli" || normalized === "codex-app-server" || normalized === "gpt-codex") {
|
|
315
|
-
return "codex";
|
|
316
|
-
}
|
|
317
|
-
if (normalized === "pi" || normalized === "rig-pi" || normalized === "@rig/pi") {
|
|
318
|
-
return "pi";
|
|
319
|
-
}
|
|
320
|
-
return "claude-code";
|
|
309
|
+
function normalizeRuntimeAdapter(_value) {
|
|
310
|
+
return "pi";
|
|
321
311
|
}
|
|
322
312
|
|
|
323
313
|
// packages/cli/src/commands/_preflight.ts
|
|
@@ -1372,6 +1362,14 @@ import { homedir as homedir2, tmpdir } from "os";
|
|
|
1372
1362
|
import { join } from "path";
|
|
1373
1363
|
import { main as runPiMain } from "@earendil-works/pi-coding-agent";
|
|
1374
1364
|
import createPiRigExtension from "@rig/pi-rig";
|
|
1365
|
+
var TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
|
|
1366
|
+
|
|
1367
|
+
class OperatorTranscriptUnavailableError extends Error {
|
|
1368
|
+
constructor(message2) {
|
|
1369
|
+
super(message2);
|
|
1370
|
+
this.name = "OperatorTranscriptUnavailableError";
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1375
1373
|
function setTemporaryEnv(updates) {
|
|
1376
1374
|
const previous = new Map;
|
|
1377
1375
|
for (const [key, value] of Object.entries(updates)) {
|
|
@@ -1399,6 +1397,23 @@ function buildOperatorPiEnv(input) {
|
|
|
1399
1397
|
...input.serverProjectRoot ? { RIG_PROJECT_ROOT: input.serverProjectRoot } : {}
|
|
1400
1398
|
};
|
|
1401
1399
|
}
|
|
1400
|
+
function shouldRequireOperatorTranscript(status) {
|
|
1401
|
+
return typeof status === "string" && TERMINAL_RUN_STATUSES.has(status.trim().toLowerCase());
|
|
1402
|
+
}
|
|
1403
|
+
function missingOperatorTranscriptMessage(runId, status) {
|
|
1404
|
+
const shortRun = runId.trim().slice(0, 8) || "unknown";
|
|
1405
|
+
const statusText = typeof status === "string" && status.trim() ? status.trim() : "terminal";
|
|
1406
|
+
return `Run ${shortRun} is ${statusText}, but no worker Pi session transcript is recorded for this run. It likely failed before Pi started or predates full-session capture. Use \`rig run show ${runId}\` and \`rig run logs ${runId}\` for the lifecycle details.`;
|
|
1407
|
+
}
|
|
1408
|
+
function statusFromRunDetails(run) {
|
|
1409
|
+
if (!run || typeof run !== "object" || Array.isArray(run))
|
|
1410
|
+
return;
|
|
1411
|
+
const record = run;
|
|
1412
|
+
if (typeof record.status === "string")
|
|
1413
|
+
return record.status;
|
|
1414
|
+
const nested = record.run;
|
|
1415
|
+
return nested && typeof nested === "object" && !Array.isArray(nested) ? nested.status : undefined;
|
|
1416
|
+
}
|
|
1402
1417
|
async function prepareOperatorConsole(context, runId, tempSessionDir) {
|
|
1403
1418
|
const server = await ensureServerForCli(context.projectRoot);
|
|
1404
1419
|
const localCwd = join(homedir2(), ".rig", "drones", runId.slice(0, 8));
|
|
@@ -1428,6 +1443,13 @@ async function prepareOperatorConsole(context, runId, tempSessionDir) {
|
|
|
1428
1443
|
sessionFileArg = ["--session", localSessionPath];
|
|
1429
1444
|
}
|
|
1430
1445
|
} catch {}
|
|
1446
|
+
if (sessionFileArg.length === 0) {
|
|
1447
|
+
const run = await getRunDetailsViaServer(context, runId).catch(() => null);
|
|
1448
|
+
const status = statusFromRunDetails(run);
|
|
1449
|
+
if (shouldRequireOperatorTranscript(status)) {
|
|
1450
|
+
throw new OperatorTranscriptUnavailableError(missingOperatorTranscriptMessage(runId, status));
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1431
1453
|
return { server, sessionFileArg };
|
|
1432
1454
|
}
|
|
1433
1455
|
var RIG_PI_THEME = {
|
|
@@ -1575,7 +1597,7 @@ async function attachRunBundledPiFrontend(context, input) {
|
|
|
1575
1597
|
}
|
|
1576
1598
|
|
|
1577
1599
|
// packages/cli/src/commands/_operator-view.ts
|
|
1578
|
-
var
|
|
1600
|
+
var TERMINAL_RUN_STATUSES2 = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
|
|
1579
1601
|
function runStatusFromPayload(payload) {
|
|
1580
1602
|
const run = payload.run && typeof payload.run === "object" && !Array.isArray(payload.run) ? payload.run : payload;
|
|
1581
1603
|
return String(run.status ?? "unknown").toLowerCase();
|
|
@@ -1653,7 +1675,7 @@ async function attachRunOperatorView(context, input) {
|
|
|
1653
1675
|
}
|
|
1654
1676
|
const pollMs = Math.max(250, Math.trunc(input.pollMs ?? 2000));
|
|
1655
1677
|
let timelineCursor = snapshot.timelineCursor;
|
|
1656
|
-
while (!detached && !
|
|
1678
|
+
while (!detached && !TERMINAL_RUN_STATUSES2.has(runStatusFromPayload(snapshot.run))) {
|
|
1657
1679
|
await Bun.sleep(pollMs);
|
|
1658
1680
|
snapshot = await readOperatorSnapshot(context, input.runId, { timelineCursor });
|
|
1659
1681
|
timelineCursor = snapshot.timelineCursor;
|
|
@@ -2123,30 +2145,62 @@ var PRIMARY_GROUPS = [
|
|
|
2123
2145
|
}
|
|
2124
2146
|
];
|
|
2125
2147
|
var ADVANCED_GROUPS = [
|
|
2126
|
-
{
|
|
2127
|
-
|
|
2148
|
+
{
|
|
2149
|
+
name: "setup",
|
|
2150
|
+
summary: "Bootstrap/check local setup.",
|
|
2151
|
+
usage: ["rig setup <bootstrap|check|preflight>"],
|
|
2152
|
+
commands: [
|
|
2153
|
+
{ command: "bootstrap", description: "Bootstrap local setup dependencies.", primary: true },
|
|
2154
|
+
{ command: "check", description: "Check local setup state (toolchain, deps, config).", primary: true },
|
|
2155
|
+
{ command: "preflight", description: "Run preflight checks before a run.", primary: true }
|
|
2156
|
+
]
|
|
2157
|
+
},
|
|
2158
|
+
{
|
|
2159
|
+
name: "profile",
|
|
2160
|
+
summary: "Runtime profile/model defaults.",
|
|
2161
|
+
usage: ["rig profile <show|set>"],
|
|
2162
|
+
commands: [
|
|
2163
|
+
{ command: "show", description: "Show the active execution profile.", primary: true },
|
|
2164
|
+
{ command: "set [--model <model>] [--runtime <runtime>] [--plugin <plugin>]", description: "Set model/runtime/plugin profile defaults.", primary: true }
|
|
2165
|
+
]
|
|
2166
|
+
},
|
|
2128
2167
|
{
|
|
2129
2168
|
name: "review",
|
|
2130
2169
|
summary: "Inspect or change completion review gate policy.",
|
|
2131
2170
|
usage: ["rig review <show|set>"],
|
|
2132
2171
|
commands: [
|
|
2133
2172
|
{ command: "show", description: "Show current review gate settings." },
|
|
2134
|
-
{ command: "set <off|advisory|required> [--provider
|
|
2173
|
+
{ command: "set <off|advisory|required> [--provider <provider>]", description: "Change review strictness/provider (e.g. --provider greptile)." }
|
|
2135
2174
|
],
|
|
2136
2175
|
examples: ["rig review show", "rig review set required --provider greptile"],
|
|
2137
2176
|
next: ["Use `rig inbox approvals` for blocked run handoffs."]
|
|
2138
2177
|
},
|
|
2139
2178
|
{
|
|
2140
2179
|
name: "browser",
|
|
2141
|
-
summary: "Browser
|
|
2142
|
-
usage: ["rig browser <help|explain|demo|
|
|
2180
|
+
summary: "Browser workstation actions for browser-required tasks: launch, check, CDP probe, profile reset, and app-specific smokes.",
|
|
2181
|
+
usage: ["rig browser <help|explain|demo|hp-next|cdp-probe|profile-persistence|profile-lock-check|smoke-test> [options]"],
|
|
2143
2182
|
commands: [
|
|
2144
|
-
{ command: "help", description: "Rich browser command help (canonical: `rig browser help`)." },
|
|
2145
|
-
{ command: "explain", description: "Explain the browser-required task contract." },
|
|
2146
|
-
{ command: "demo", description: "Run
|
|
2147
|
-
{ command: "
|
|
2148
|
-
{ command: "hp-next
|
|
2149
|
-
|
|
2183
|
+
{ command: "help", description: "Rich browser command help (canonical: `rig browser help`).", primary: true },
|
|
2184
|
+
{ command: "explain", description: "Explain the browser-required task contract and runtime helper commands.", primary: true },
|
|
2185
|
+
{ command: "demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]", description: "Run a guided real browser/agent demo flow.", primary: true },
|
|
2186
|
+
{ command: "hp-next dev", description: "Start hp-next Rig Browser in dev/watch mode.", primary: true },
|
|
2187
|
+
{ command: "hp-next start", description: "Build/start the hp-next browser workstation without watch mode.", primary: true },
|
|
2188
|
+
{ command: "hp-next check", description: "Validate the hp-next CDP endpoint on the configured port.", primary: true },
|
|
2189
|
+
{ command: "hp-next e2e", description: "Run hp-next browser e2e smoke checks through Rig Browser.", primary: true },
|
|
2190
|
+
{ command: "hp-next reset", description: "Reset the hp-next browser profile when stale browser state is suspected.", primary: true },
|
|
2191
|
+
{ command: "cdp-probe", description: "Run an isolated CDP attach/evaluate/layout probe." },
|
|
2192
|
+
{ command: "profile-persistence", description: "Verify a named browser profile persists browser state." },
|
|
2193
|
+
{ command: "profile-lock-check", description: "Verify concurrent launches reject the same profile." },
|
|
2194
|
+
{ command: "smoke-test", description: "Run the browser package smoke test." }
|
|
2195
|
+
],
|
|
2196
|
+
examples: [
|
|
2197
|
+
"rig browser help",
|
|
2198
|
+
"rig browser hp-next check",
|
|
2199
|
+
"rig browser hp-next e2e",
|
|
2200
|
+
"rig browser cdp-probe",
|
|
2201
|
+
"rig browser profile-lock-check"
|
|
2202
|
+
],
|
|
2203
|
+
next: ["Inside a task run, use rig-browser-launch, rig-browser-check, and rig-browser-attach-info from the worker PATH."]
|
|
2150
2204
|
},
|
|
2151
2205
|
{
|
|
2152
2206
|
name: "pi",
|
|
@@ -2161,12 +2215,60 @@ var ADVANCED_GROUPS = [
|
|
|
2161
2215
|
examples: ["rig pi search subagents", "rig pi add pi-subagents", "rig pi list"],
|
|
2162
2216
|
next: ["Config-managed extensions: declare `runtime: { pi: { packages: [...] } }` in rig.config.ts \u2014 workers pick them up automatically."]
|
|
2163
2217
|
},
|
|
2164
|
-
{
|
|
2165
|
-
|
|
2218
|
+
{
|
|
2219
|
+
name: "queue",
|
|
2220
|
+
summary: "Run task queues locally.",
|
|
2221
|
+
usage: ["rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]"],
|
|
2222
|
+
commands: [
|
|
2223
|
+
{ command: "run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]", description: "Process queue work: drain matching tasks with N workers, optional per-task action and isolation.", primary: true }
|
|
2224
|
+
]
|
|
2225
|
+
},
|
|
2226
|
+
{
|
|
2227
|
+
name: "agent",
|
|
2228
|
+
summary: "Runtime agent workspace helpers.",
|
|
2229
|
+
usage: ["rig agent <list|prepare|run|cleanup>"],
|
|
2230
|
+
commands: [
|
|
2231
|
+
{ command: "list", description: "List prepared agent runtimes.", primary: true },
|
|
2232
|
+
{ command: "prepare [--id <id>] [--mode <mode>] [--task <task>]", description: "Prepare an isolated agent runtime workspace.", primary: true },
|
|
2233
|
+
{ command: "run [--id <id>] [--mode <mode>] [--task <task>] [--skip-project-sync]", description: "Prepare (if needed) and run an agent in its workspace.", primary: true },
|
|
2234
|
+
{ command: "cleanup [--all] [--id <id>]", description: "Remove prepared agent workspaces.", primary: true }
|
|
2235
|
+
]
|
|
2236
|
+
},
|
|
2166
2237
|
{ name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
|
|
2167
|
-
{
|
|
2238
|
+
{
|
|
2239
|
+
name: "dist",
|
|
2240
|
+
summary: "Build/install packaged Rig CLI.",
|
|
2241
|
+
usage: ["rig dist <build|install|doctor|rebuild-agent>"],
|
|
2242
|
+
commands: [
|
|
2243
|
+
{ command: "build [--output-dir <dir>]", description: "Build the distributable Rig CLI.", primary: true },
|
|
2244
|
+
{ command: "install [--scope <scope>] [--path <path>]", description: "Install the built CLI to a scope/path.", primary: true },
|
|
2245
|
+
{ command: "doctor", description: "Diagnose the dist toolchain and install state.", primary: true },
|
|
2246
|
+
{ command: "rebuild-agent", description: "Rebuild the agent runtime image, pruning stale images.", primary: true }
|
|
2247
|
+
]
|
|
2248
|
+
},
|
|
2168
2249
|
{ name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
|
|
2169
|
-
{
|
|
2250
|
+
{
|
|
2251
|
+
name: "remote",
|
|
2252
|
+
summary: "Compatibility remote orchestration controls.",
|
|
2253
|
+
usage: ["rig remote <status|tasks|watch|pause|resume|continue|stop|refresh|add-iterations|remove-iterations|endpoint ...>"],
|
|
2254
|
+
commands: [
|
|
2255
|
+
{ command: "status [--remote <alias>]", description: "Show the remote orchestration state.", primary: true },
|
|
2256
|
+
{ command: "tasks [--remote <alias>]", description: "List the remote's tracked tasks.", primary: true },
|
|
2257
|
+
{ command: "watch [--remote <alias>] [--seconds <n>] [--event <type>]", description: "Stream remote orchestration events.", primary: true },
|
|
2258
|
+
{ command: "pause [--remote <alias>]", description: "Pause the running remote orchestration.", primary: true },
|
|
2259
|
+
{ command: "resume [--remote <alias>] [--max-workers <n>] [--max-iterations <n>] [--direct-merge]", description: "Resume the remote with optional tuning.", primary: true },
|
|
2260
|
+
{ command: "continue [--remote <alias>]", description: "Continue a paused remote orchestration.", primary: true },
|
|
2261
|
+
{ command: "stop [--remote <alias>]", description: "Stop the remote orchestration.", primary: true },
|
|
2262
|
+
{ command: "refresh [--remote <alias>]", description: "Refresh remote state.", primary: true },
|
|
2263
|
+
{ command: "add-iterations [--count <n>] [--remote <alias>]", description: "Grant the remote more iterations.", primary: true },
|
|
2264
|
+
{ command: "remove-iterations [--count <n>] [--remote <alias>]", description: "Reduce the remote's iteration budget.", primary: true },
|
|
2265
|
+
{ command: "endpoint list", description: "List configured remote endpoints.", primary: true },
|
|
2266
|
+
{ command: "endpoint add --alias <alias> --host <host> --port <n> [--token <token>]", description: "Register a remote endpoint.", primary: true },
|
|
2267
|
+
{ command: "endpoint remove --alias <alias>", description: "Remove a remote endpoint.", primary: true },
|
|
2268
|
+
{ command: "endpoint test [--alias <alias>]", description: "Test connectivity to a remote endpoint.", primary: true },
|
|
2269
|
+
{ command: "endpoint doctor", description: "Diagnose remote endpoint configuration.", primary: true }
|
|
2270
|
+
]
|
|
2271
|
+
},
|
|
2170
2272
|
{ name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
|
|
2171
2273
|
{ name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
|
|
2172
2274
|
{ name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
|
package/dist/src/commands.js
CHANGED
|
@@ -1656,18 +1656,8 @@ import {
|
|
|
1656
1656
|
readJsonlFile as readJsonlFile2,
|
|
1657
1657
|
writeAuthorityRunRecord
|
|
1658
1658
|
} from "@rig/runtime/control-plane/authority-files";
|
|
1659
|
-
function normalizeRuntimeAdapter(
|
|
1660
|
-
|
|
1661
|
-
if (!normalized) {
|
|
1662
|
-
return "pi";
|
|
1663
|
-
}
|
|
1664
|
-
if (normalized === "codex" || normalized === "codex-cli" || normalized === "codex-app-server" || normalized === "gpt-codex") {
|
|
1665
|
-
return "codex";
|
|
1666
|
-
}
|
|
1667
|
-
if (normalized === "pi" || normalized === "rig-pi" || normalized === "@rig/pi") {
|
|
1668
|
-
return "pi";
|
|
1669
|
-
}
|
|
1670
|
-
return "claude-code";
|
|
1659
|
+
function normalizeRuntimeAdapter(_value) {
|
|
1660
|
+
return "pi";
|
|
1671
1661
|
}
|
|
1672
1662
|
function readLatestBeadRecord(projectRoot, taskId) {
|
|
1673
1663
|
const issuesPath = resolve11(resolveControlPlaneMonorepoRoot(projectRoot), ".beads", "issues.jsonl");
|
|
@@ -2621,6 +2611,23 @@ function buildOperatorPiEnv(input) {
|
|
|
2621
2611
|
...input.serverProjectRoot ? { RIG_PROJECT_ROOT: input.serverProjectRoot } : {}
|
|
2622
2612
|
};
|
|
2623
2613
|
}
|
|
2614
|
+
function shouldRequireOperatorTranscript(status) {
|
|
2615
|
+
return typeof status === "string" && TERMINAL_RUN_STATUSES.has(status.trim().toLowerCase());
|
|
2616
|
+
}
|
|
2617
|
+
function missingOperatorTranscriptMessage(runId, status) {
|
|
2618
|
+
const shortRun = runId.trim().slice(0, 8) || "unknown";
|
|
2619
|
+
const statusText = typeof status === "string" && status.trim() ? status.trim() : "terminal";
|
|
2620
|
+
return `Run ${shortRun} is ${statusText}, but no worker Pi session transcript is recorded for this run. It likely failed before Pi started or predates full-session capture. Use \`rig run show ${runId}\` and \`rig run logs ${runId}\` for the lifecycle details.`;
|
|
2621
|
+
}
|
|
2622
|
+
function statusFromRunDetails(run) {
|
|
2623
|
+
if (!run || typeof run !== "object" || Array.isArray(run))
|
|
2624
|
+
return;
|
|
2625
|
+
const record = run;
|
|
2626
|
+
if (typeof record.status === "string")
|
|
2627
|
+
return record.status;
|
|
2628
|
+
const nested = record.run;
|
|
2629
|
+
return nested && typeof nested === "object" && !Array.isArray(nested) ? nested.status : undefined;
|
|
2630
|
+
}
|
|
2624
2631
|
async function prepareOperatorConsole(context, runId, tempSessionDir) {
|
|
2625
2632
|
const server = await ensureServerForCli(context.projectRoot);
|
|
2626
2633
|
const localCwd = join3(homedir6(), ".rig", "drones", runId.slice(0, 8));
|
|
@@ -2650,6 +2657,13 @@ async function prepareOperatorConsole(context, runId, tempSessionDir) {
|
|
|
2650
2657
|
sessionFileArg = ["--session", localSessionPath];
|
|
2651
2658
|
}
|
|
2652
2659
|
} catch {}
|
|
2660
|
+
if (sessionFileArg.length === 0) {
|
|
2661
|
+
const run = await getRunDetailsViaServer(context, runId).catch(() => null);
|
|
2662
|
+
const status = statusFromRunDetails(run);
|
|
2663
|
+
if (shouldRequireOperatorTranscript(status)) {
|
|
2664
|
+
throw new OperatorTranscriptUnavailableError(missingOperatorTranscriptMessage(runId, status));
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2653
2667
|
return { server, sessionFileArg };
|
|
2654
2668
|
}
|
|
2655
2669
|
function trustDroneCwd(localCwd) {
|
|
@@ -2721,10 +2735,17 @@ async function attachRunBundledPiFrontend(context, input) {
|
|
|
2721
2735
|
rendered: "stock Pi operator console with the pi-rig extension"
|
|
2722
2736
|
};
|
|
2723
2737
|
}
|
|
2724
|
-
var RIG_PI_THEME;
|
|
2738
|
+
var TERMINAL_RUN_STATUSES, OperatorTranscriptUnavailableError, RIG_PI_THEME;
|
|
2725
2739
|
var init__pi_frontend = __esm(() => {
|
|
2726
2740
|
init__server_client();
|
|
2727
2741
|
init__async_ui();
|
|
2742
|
+
TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
|
|
2743
|
+
OperatorTranscriptUnavailableError = class OperatorTranscriptUnavailableError extends Error {
|
|
2744
|
+
constructor(message2) {
|
|
2745
|
+
super(message2);
|
|
2746
|
+
this.name = "OperatorTranscriptUnavailableError";
|
|
2747
|
+
}
|
|
2748
|
+
};
|
|
2728
2749
|
RIG_PI_THEME = {
|
|
2729
2750
|
$schema: "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
2730
2751
|
name: "rig",
|
|
@@ -2879,7 +2900,7 @@ async function attachRunOperatorView(context, input) {
|
|
|
2879
2900
|
}
|
|
2880
2901
|
const pollMs = Math.max(250, Math.trunc(input.pollMs ?? 2000));
|
|
2881
2902
|
let timelineCursor = snapshot.timelineCursor;
|
|
2882
|
-
while (!detached && !
|
|
2903
|
+
while (!detached && !TERMINAL_RUN_STATUSES2.has(runStatusFromPayload(snapshot.run))) {
|
|
2883
2904
|
await Bun.sleep(pollMs);
|
|
2884
2905
|
snapshot = await readOperatorSnapshot(context, input.runId, { timelineCursor });
|
|
2885
2906
|
timelineCursor = snapshot.timelineCursor;
|
|
@@ -2891,13 +2912,13 @@ async function attachRunOperatorView(context, input) {
|
|
|
2891
2912
|
}
|
|
2892
2913
|
return { ...snapshot, steered, detached };
|
|
2893
2914
|
}
|
|
2894
|
-
var
|
|
2915
|
+
var TERMINAL_RUN_STATUSES2;
|
|
2895
2916
|
var init__operator_view = __esm(() => {
|
|
2896
2917
|
init__server_client();
|
|
2897
2918
|
init__operator_surface();
|
|
2898
2919
|
init__pi_frontend();
|
|
2899
2920
|
init__async_ui();
|
|
2900
|
-
|
|
2921
|
+
TERMINAL_RUN_STATUSES2 = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
|
|
2901
2922
|
});
|
|
2902
2923
|
|
|
2903
2924
|
// packages/cli/src/commands/_help-catalog.ts
|
|
@@ -3254,30 +3275,62 @@ var init__help_catalog = __esm(() => {
|
|
|
3254
3275
|
}
|
|
3255
3276
|
];
|
|
3256
3277
|
ADVANCED_GROUPS = [
|
|
3257
|
-
{
|
|
3258
|
-
|
|
3278
|
+
{
|
|
3279
|
+
name: "setup",
|
|
3280
|
+
summary: "Bootstrap/check local setup.",
|
|
3281
|
+
usage: ["rig setup <bootstrap|check|preflight>"],
|
|
3282
|
+
commands: [
|
|
3283
|
+
{ command: "bootstrap", description: "Bootstrap local setup dependencies.", primary: true },
|
|
3284
|
+
{ command: "check", description: "Check local setup state (toolchain, deps, config).", primary: true },
|
|
3285
|
+
{ command: "preflight", description: "Run preflight checks before a run.", primary: true }
|
|
3286
|
+
]
|
|
3287
|
+
},
|
|
3288
|
+
{
|
|
3289
|
+
name: "profile",
|
|
3290
|
+
summary: "Runtime profile/model defaults.",
|
|
3291
|
+
usage: ["rig profile <show|set>"],
|
|
3292
|
+
commands: [
|
|
3293
|
+
{ command: "show", description: "Show the active execution profile.", primary: true },
|
|
3294
|
+
{ command: "set [--model <model>] [--runtime <runtime>] [--plugin <plugin>]", description: "Set model/runtime/plugin profile defaults.", primary: true }
|
|
3295
|
+
]
|
|
3296
|
+
},
|
|
3259
3297
|
{
|
|
3260
3298
|
name: "review",
|
|
3261
3299
|
summary: "Inspect or change completion review gate policy.",
|
|
3262
3300
|
usage: ["rig review <show|set>"],
|
|
3263
3301
|
commands: [
|
|
3264
3302
|
{ command: "show", description: "Show current review gate settings." },
|
|
3265
|
-
{ command: "set <off|advisory|required> [--provider
|
|
3303
|
+
{ command: "set <off|advisory|required> [--provider <provider>]", description: "Change review strictness/provider (e.g. --provider greptile)." }
|
|
3266
3304
|
],
|
|
3267
3305
|
examples: ["rig review show", "rig review set required --provider greptile"],
|
|
3268
3306
|
next: ["Use `rig inbox approvals` for blocked run handoffs."]
|
|
3269
3307
|
},
|
|
3270
3308
|
{
|
|
3271
3309
|
name: "browser",
|
|
3272
|
-
summary: "Browser
|
|
3273
|
-
usage: ["rig browser <help|explain|demo|
|
|
3310
|
+
summary: "Browser workstation actions for browser-required tasks: launch, check, CDP probe, profile reset, and app-specific smokes.",
|
|
3311
|
+
usage: ["rig browser <help|explain|demo|hp-next|cdp-probe|profile-persistence|profile-lock-check|smoke-test> [options]"],
|
|
3274
3312
|
commands: [
|
|
3275
|
-
{ command: "help", description: "Rich browser command help (canonical: `rig browser help`)." },
|
|
3276
|
-
{ command: "explain", description: "Explain the browser-required task contract." },
|
|
3277
|
-
{ command: "demo", description: "Run
|
|
3278
|
-
{ command: "
|
|
3279
|
-
{ command: "hp-next
|
|
3280
|
-
|
|
3313
|
+
{ command: "help", description: "Rich browser command help (canonical: `rig browser help`).", primary: true },
|
|
3314
|
+
{ command: "explain", description: "Explain the browser-required task contract and runtime helper commands.", primary: true },
|
|
3315
|
+
{ command: "demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]", description: "Run a guided real browser/agent demo flow.", primary: true },
|
|
3316
|
+
{ command: "hp-next dev", description: "Start hp-next Rig Browser in dev/watch mode.", primary: true },
|
|
3317
|
+
{ command: "hp-next start", description: "Build/start the hp-next browser workstation without watch mode.", primary: true },
|
|
3318
|
+
{ command: "hp-next check", description: "Validate the hp-next CDP endpoint on the configured port.", primary: true },
|
|
3319
|
+
{ command: "hp-next e2e", description: "Run hp-next browser e2e smoke checks through Rig Browser.", primary: true },
|
|
3320
|
+
{ command: "hp-next reset", description: "Reset the hp-next browser profile when stale browser state is suspected.", primary: true },
|
|
3321
|
+
{ command: "cdp-probe", description: "Run an isolated CDP attach/evaluate/layout probe." },
|
|
3322
|
+
{ command: "profile-persistence", description: "Verify a named browser profile persists browser state." },
|
|
3323
|
+
{ command: "profile-lock-check", description: "Verify concurrent launches reject the same profile." },
|
|
3324
|
+
{ command: "smoke-test", description: "Run the browser package smoke test." }
|
|
3325
|
+
],
|
|
3326
|
+
examples: [
|
|
3327
|
+
"rig browser help",
|
|
3328
|
+
"rig browser hp-next check",
|
|
3329
|
+
"rig browser hp-next e2e",
|
|
3330
|
+
"rig browser cdp-probe",
|
|
3331
|
+
"rig browser profile-lock-check"
|
|
3332
|
+
],
|
|
3333
|
+
next: ["Inside a task run, use rig-browser-launch, rig-browser-check, and rig-browser-attach-info from the worker PATH."]
|
|
3281
3334
|
},
|
|
3282
3335
|
{
|
|
3283
3336
|
name: "pi",
|
|
@@ -3292,12 +3345,60 @@ var init__help_catalog = __esm(() => {
|
|
|
3292
3345
|
examples: ["rig pi search subagents", "rig pi add pi-subagents", "rig pi list"],
|
|
3293
3346
|
next: ["Config-managed extensions: declare `runtime: { pi: { packages: [...] } }` in rig.config.ts \u2014 workers pick them up automatically."]
|
|
3294
3347
|
},
|
|
3295
|
-
{
|
|
3296
|
-
|
|
3348
|
+
{
|
|
3349
|
+
name: "queue",
|
|
3350
|
+
summary: "Run task queues locally.",
|
|
3351
|
+
usage: ["rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]"],
|
|
3352
|
+
commands: [
|
|
3353
|
+
{ command: "run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]", description: "Process queue work: drain matching tasks with N workers, optional per-task action and isolation.", primary: true }
|
|
3354
|
+
]
|
|
3355
|
+
},
|
|
3356
|
+
{
|
|
3357
|
+
name: "agent",
|
|
3358
|
+
summary: "Runtime agent workspace helpers.",
|
|
3359
|
+
usage: ["rig agent <list|prepare|run|cleanup>"],
|
|
3360
|
+
commands: [
|
|
3361
|
+
{ command: "list", description: "List prepared agent runtimes.", primary: true },
|
|
3362
|
+
{ command: "prepare [--id <id>] [--mode <mode>] [--task <task>]", description: "Prepare an isolated agent runtime workspace.", primary: true },
|
|
3363
|
+
{ command: "run [--id <id>] [--mode <mode>] [--task <task>] [--skip-project-sync]", description: "Prepare (if needed) and run an agent in its workspace.", primary: true },
|
|
3364
|
+
{ command: "cleanup [--all] [--id <id>]", description: "Remove prepared agent workspaces.", primary: true }
|
|
3365
|
+
]
|
|
3366
|
+
},
|
|
3297
3367
|
{ name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
|
|
3298
|
-
{
|
|
3368
|
+
{
|
|
3369
|
+
name: "dist",
|
|
3370
|
+
summary: "Build/install packaged Rig CLI.",
|
|
3371
|
+
usage: ["rig dist <build|install|doctor|rebuild-agent>"],
|
|
3372
|
+
commands: [
|
|
3373
|
+
{ command: "build [--output-dir <dir>]", description: "Build the distributable Rig CLI.", primary: true },
|
|
3374
|
+
{ command: "install [--scope <scope>] [--path <path>]", description: "Install the built CLI to a scope/path.", primary: true },
|
|
3375
|
+
{ command: "doctor", description: "Diagnose the dist toolchain and install state.", primary: true },
|
|
3376
|
+
{ command: "rebuild-agent", description: "Rebuild the agent runtime image, pruning stale images.", primary: true }
|
|
3377
|
+
]
|
|
3378
|
+
},
|
|
3299
3379
|
{ name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
|
|
3300
|
-
{
|
|
3380
|
+
{
|
|
3381
|
+
name: "remote",
|
|
3382
|
+
summary: "Compatibility remote orchestration controls.",
|
|
3383
|
+
usage: ["rig remote <status|tasks|watch|pause|resume|continue|stop|refresh|add-iterations|remove-iterations|endpoint ...>"],
|
|
3384
|
+
commands: [
|
|
3385
|
+
{ command: "status [--remote <alias>]", description: "Show the remote orchestration state.", primary: true },
|
|
3386
|
+
{ command: "tasks [--remote <alias>]", description: "List the remote's tracked tasks.", primary: true },
|
|
3387
|
+
{ command: "watch [--remote <alias>] [--seconds <n>] [--event <type>]", description: "Stream remote orchestration events.", primary: true },
|
|
3388
|
+
{ command: "pause [--remote <alias>]", description: "Pause the running remote orchestration.", primary: true },
|
|
3389
|
+
{ command: "resume [--remote <alias>] [--max-workers <n>] [--max-iterations <n>] [--direct-merge]", description: "Resume the remote with optional tuning.", primary: true },
|
|
3390
|
+
{ command: "continue [--remote <alias>]", description: "Continue a paused remote orchestration.", primary: true },
|
|
3391
|
+
{ command: "stop [--remote <alias>]", description: "Stop the remote orchestration.", primary: true },
|
|
3392
|
+
{ command: "refresh [--remote <alias>]", description: "Refresh remote state.", primary: true },
|
|
3393
|
+
{ command: "add-iterations [--count <n>] [--remote <alias>]", description: "Grant the remote more iterations.", primary: true },
|
|
3394
|
+
{ command: "remove-iterations [--count <n>] [--remote <alias>]", description: "Reduce the remote's iteration budget.", primary: true },
|
|
3395
|
+
{ command: "endpoint list", description: "List configured remote endpoints.", primary: true },
|
|
3396
|
+
{ command: "endpoint add --alias <alias> --host <host> --port <n> [--token <token>]", description: "Register a remote endpoint.", primary: true },
|
|
3397
|
+
{ command: "endpoint remove --alias <alias>", description: "Remove a remote endpoint.", primary: true },
|
|
3398
|
+
{ command: "endpoint test [--alias <alias>]", description: "Test connectivity to a remote endpoint.", primary: true },
|
|
3399
|
+
{ command: "endpoint doctor", description: "Diagnose remote endpoint configuration.", primary: true }
|
|
3400
|
+
]
|
|
3401
|
+
},
|
|
3301
3402
|
{ name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
|
|
3302
3403
|
{ name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
|
|
3303
3404
|
{ name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
|
|
@@ -3880,6 +3981,47 @@ var init_task = __esm(() => {
|
|
|
3880
3981
|
init__connection_state();
|
|
3881
3982
|
});
|
|
3882
3983
|
|
|
3984
|
+
// packages/cli/src/commands/_server-events.ts
|
|
3985
|
+
import { WsTransport } from "@rig/client";
|
|
3986
|
+
import { RIG_WS_CHANNELS } from "@rig/contracts";
|
|
3987
|
+
function buildRigWebSocketUrl(baseUrl, authToken) {
|
|
3988
|
+
const url = new URL(baseUrl);
|
|
3989
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
3990
|
+
if (authToken)
|
|
3991
|
+
url.searchParams.set("token", authToken);
|
|
3992
|
+
return url.toString();
|
|
3993
|
+
}
|
|
3994
|
+
async function connectRigServerEvents(projectRoot, handlers) {
|
|
3995
|
+
const { baseUrl, authToken } = await ensureServerForCli(projectRoot);
|
|
3996
|
+
const transport = new WsTransport(buildRigWebSocketUrl(baseUrl, authToken));
|
|
3997
|
+
const unsubscribers = [];
|
|
3998
|
+
if (handlers.onSnapshotInvalidated)
|
|
3999
|
+
unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.snapshotInvalidated, handlers.onSnapshotInvalidated));
|
|
4000
|
+
if (handlers.onRunLogAppended)
|
|
4001
|
+
unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.runLogAppended, handlers.onRunLogAppended));
|
|
4002
|
+
if (handlers.onEngineEvent)
|
|
4003
|
+
unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.event, handlers.onEngineEvent));
|
|
4004
|
+
let status = "connecting";
|
|
4005
|
+
unsubscribers.push(transport.subscribeState((state) => {
|
|
4006
|
+
status = state.status;
|
|
4007
|
+
handlers.onStatus?.(state.status);
|
|
4008
|
+
}));
|
|
4009
|
+
return {
|
|
4010
|
+
connected: () => status === "connected",
|
|
4011
|
+
close: () => {
|
|
4012
|
+
for (const unsubscribe of unsubscribers) {
|
|
4013
|
+
try {
|
|
4014
|
+
unsubscribe();
|
|
4015
|
+
} catch {}
|
|
4016
|
+
}
|
|
4017
|
+
transport.dispose();
|
|
4018
|
+
}
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
var init__server_events = __esm(() => {
|
|
4022
|
+
init__server_client();
|
|
4023
|
+
});
|
|
4024
|
+
|
|
3883
4025
|
// packages/cli/src/app/board.ts
|
|
3884
4026
|
var exports_board = {};
|
|
3885
4027
|
__export(exports_board, {
|
|
@@ -4718,7 +4860,24 @@ async function runOperatorBoard(context, options = {}) {
|
|
|
4718
4860
|
tui.requestRender();
|
|
4719
4861
|
}
|
|
4720
4862
|
}, BOARD_TICK_MS);
|
|
4863
|
+
const live = { subscription: null };
|
|
4864
|
+
const refreshActiveView = () => {
|
|
4865
|
+
refresh({ quiet: true });
|
|
4866
|
+
if (view === "tasks")
|
|
4867
|
+
refreshTasks();
|
|
4868
|
+
if (view === "inbox")
|
|
4869
|
+
refreshInbox();
|
|
4870
|
+
};
|
|
4871
|
+
connectRigServerEvents(context.projectRoot, {
|
|
4872
|
+
onSnapshotInvalidated: () => refreshActiveView()
|
|
4873
|
+
}).then((subscription) => {
|
|
4874
|
+
live.subscription = subscription;
|
|
4875
|
+
}).catch(() => {
|
|
4876
|
+
live.subscription = null;
|
|
4877
|
+
});
|
|
4721
4878
|
const refreshTimer = setInterval(() => {
|
|
4879
|
+
if (live.subscription?.connected())
|
|
4880
|
+
return;
|
|
4722
4881
|
refresh();
|
|
4723
4882
|
}, BOARD_REFRESH_MS);
|
|
4724
4883
|
tui.start();
|
|
@@ -4733,6 +4892,7 @@ async function runOperatorBoard(context, options = {}) {
|
|
|
4733
4892
|
});
|
|
4734
4893
|
clearInterval(animation);
|
|
4735
4894
|
clearInterval(refreshTimer);
|
|
4895
|
+
live.subscription?.close();
|
|
4736
4896
|
return outcome;
|
|
4737
4897
|
}
|
|
4738
4898
|
async function runOperatorBoardLoop(context, attach, options = {}) {
|
|
@@ -4751,6 +4911,7 @@ var init_board = __esm(() => {
|
|
|
4751
4911
|
init__help_catalog();
|
|
4752
4912
|
init__server_client();
|
|
4753
4913
|
init__authority_runs();
|
|
4914
|
+
init__server_events();
|
|
4754
4915
|
init_inbox();
|
|
4755
4916
|
init_task();
|
|
4756
4917
|
});
|