@h-rig/cli 0.0.6-alpha.83 → 0.0.6-alpha.85

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.
Files changed (163) hide show
  1. package/dist/bin/rig.js +22060 -14620
  2. package/dist/src/app/board.js +155 -28
  3. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
  4. package/dist/src/app-opentui/adapters/doctor.js +1 -25
  5. package/dist/src/app-opentui/adapters/family.d.ts +62 -0
  6. package/dist/src/app-opentui/adapters/family.js +14305 -0
  7. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
  8. package/dist/src/app-opentui/adapters/fleet.js +6 -40
  9. package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
  10. package/dist/src/app-opentui/adapters/inbox.js +54 -59
  11. package/dist/src/app-opentui/adapters/init.d.ts +0 -2
  12. package/dist/src/app-opentui/adapters/init.js +0 -26
  13. package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
  14. package/dist/src/app-opentui/adapters/inspect.js +1024 -0
  15. package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
  16. package/dist/src/app-opentui/adapters/pi-attach.js +348 -93
  17. package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
  18. package/dist/src/app-opentui/adapters/pi.js +363 -0
  19. package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
  20. package/dist/src/app-opentui/adapters/plugin.js +544 -0
  21. package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
  22. package/dist/src/app-opentui/adapters/repo.js +186 -0
  23. package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
  24. package/dist/src/app-opentui/adapters/run-detail.js +97 -44
  25. package/dist/src/app-opentui/adapters/server.d.ts +10 -2
  26. package/dist/src/app-opentui/adapters/server.js +96 -27
  27. package/dist/src/app-opentui/adapters/tasks.d.ts +0 -2
  28. package/dist/src/app-opentui/adapters/tasks.js +437 -105
  29. package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
  30. package/dist/src/app-opentui/adapters/workspace.js +333 -0
  31. package/dist/src/app-opentui/autocomplete.d.ts +20 -0
  32. package/dist/src/app-opentui/autocomplete.js +576 -0
  33. package/dist/src/app-opentui/bootstrap.js +24313 -16963
  34. package/dist/src/app-opentui/command-palette.d.ts +3 -0
  35. package/dist/src/app-opentui/command-palette.js +1010 -0
  36. package/dist/src/app-opentui/drone.js +8 -6
  37. package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
  38. package/dist/src/app-opentui/fleet-stats.js +114 -0
  39. package/dist/src/app-opentui/index.js +3438 -1724
  40. package/dist/src/app-opentui/intent.js +71 -48
  41. package/dist/src/app-opentui/keymap.d.ts +6 -5
  42. package/dist/src/app-opentui/keymap.js +1064 -23
  43. package/dist/src/app-opentui/layout.d.ts +7 -0
  44. package/dist/src/app-opentui/layout.js +13 -6
  45. package/dist/src/app-opentui/list-search.d.ts +24 -0
  46. package/dist/src/app-opentui/list-search.js +88 -1
  47. package/dist/src/app-opentui/pi-host-child.js +33 -1
  48. package/dist/src/app-opentui/pi-pty-host.d.ts +5 -0
  49. package/dist/src/app-opentui/pi-pty-host.js +21 -3
  50. package/dist/src/app-opentui/react/App.d.ts +9 -0
  51. package/dist/src/app-opentui/react/App.js +5099 -0
  52. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  53. package/dist/src/app-opentui/react/Backdrop.js +829 -0
  54. package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
  55. package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
  56. package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
  57. package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
  58. package/dist/src/app-opentui/react/context.d.ts +17 -0
  59. package/dist/src/app-opentui/react/context.js +37 -0
  60. package/dist/src/app-opentui/react/launch.d.ts +2 -0
  61. package/dist/src/app-opentui/react/launch.js +5698 -0
  62. package/dist/src/app-opentui/react/nav.d.ts +18 -0
  63. package/dist/src/app-opentui/react/nav.js +54 -0
  64. package/dist/src/app-opentui/react/scroll.d.ts +12 -0
  65. package/dist/src/app-opentui/react/scroll.js +21 -0
  66. package/dist/src/app-opentui/react/syntax.d.ts +2 -0
  67. package/dist/src/app-opentui/react/syntax.js +64 -0
  68. package/dist/src/app-opentui/registry.js +19923 -5151
  69. package/dist/src/app-opentui/render/constants.d.ts +31 -0
  70. package/dist/src/app-opentui/render/constants.js +66 -0
  71. package/dist/src/app-opentui/render/graphics.d.ts +2 -1
  72. package/dist/src/app-opentui/render/graphics.js +106 -39
  73. package/dist/src/app-opentui/render/image-visual-layer-worker.js +108 -20
  74. package/dist/src/app-opentui/render/image-visual-layer.d.ts +7 -0
  75. package/dist/src/app-opentui/render/image-visual-layer.js +109 -20
  76. package/dist/src/app-opentui/render/native-host.d.ts +37 -0
  77. package/dist/src/app-opentui/render/native-host.js +179 -0
  78. package/dist/src/app-opentui/render/panels.js +18 -11
  79. package/dist/src/app-opentui/render/preloader.js +8 -6
  80. package/dist/src/app-opentui/render/scene.d.ts +50 -1
  81. package/dist/src/app-opentui/render/scene.js +183 -6
  82. package/dist/src/app-opentui/render/text.d.ts +7 -1
  83. package/dist/src/app-opentui/render/text.js +10 -7
  84. package/dist/src/app-opentui/render/type-bar.js +69 -30
  85. package/dist/src/app-opentui/runtime.d.ts +44 -1
  86. package/dist/src/app-opentui/runtime.js +3231 -1363
  87. package/dist/src/app-opentui/scenes/command.js +20 -6
  88. package/dist/src/app-opentui/scenes/doctor.js +176 -11
  89. package/dist/src/app-opentui/scenes/error.js +20 -10
  90. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
  91. package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
  92. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
  93. package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
  94. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
  95. package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
  96. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
  97. package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
  98. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
  99. package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
  100. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
  101. package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
  102. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
  103. package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
  104. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
  105. package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
  106. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
  107. package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
  108. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
  109. package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
  110. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
  111. package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
  112. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
  113. package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
  114. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
  115. package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
  116. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
  117. package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
  118. package/dist/src/app-opentui/scenes/family.d.ts +3 -0
  119. package/dist/src/app-opentui/scenes/family.js +2144 -0
  120. package/dist/src/app-opentui/scenes/fleet.js +521 -31
  121. package/dist/src/app-opentui/scenes/handoff.js +204 -12
  122. package/dist/src/app-opentui/scenes/help.js +609 -40
  123. package/dist/src/app-opentui/scenes/inbox.js +278 -17
  124. package/dist/src/app-opentui/scenes/init.js +84 -39
  125. package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
  126. package/dist/src/app-opentui/scenes/inspect.js +793 -0
  127. package/dist/src/app-opentui/scenes/main.js +218 -39
  128. package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
  129. package/dist/src/app-opentui/scenes/pi.js +508 -0
  130. package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
  131. package/dist/src/app-opentui/scenes/plugin.js +486 -0
  132. package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
  133. package/dist/src/app-opentui/scenes/repo.js +424 -0
  134. package/dist/src/app-opentui/scenes/run-detail.js +333 -20
  135. package/dist/src/app-opentui/scenes/server.js +181 -15
  136. package/dist/src/app-opentui/scenes/tasks.js +486 -31
  137. package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
  138. package/dist/src/app-opentui/scenes/workspace.js +426 -0
  139. package/dist/src/app-opentui/selectable.d.ts +19 -0
  140. package/dist/src/app-opentui/selectable.js +79 -0
  141. package/dist/src/app-opentui/state.js +83 -30
  142. package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
  143. package/dist/src/app-opentui/surface-catalog.js +540 -0
  144. package/dist/src/app-opentui/theme.d.ts +28 -6
  145. package/dist/src/app-opentui/theme.js +61 -8
  146. package/dist/src/app-opentui/types.d.ts +121 -4
  147. package/dist/src/commands/_authority-runs.d.ts +1 -1
  148. package/dist/src/commands/_authority-runs.js +2 -12
  149. package/dist/src/commands/_help-catalog.js +95 -15
  150. package/dist/src/commands/_operator-view.js +34 -2
  151. package/dist/src/commands/_pi-frontend.d.ts +2 -0
  152. package/dist/src/commands/_pi-frontend.js +34 -0
  153. package/dist/src/commands/_server-events.d.ts +26 -0
  154. package/dist/src/commands/_server-events.js +310 -0
  155. package/dist/src/commands/agent.js +2 -12
  156. package/dist/src/commands/run.js +34 -2
  157. package/dist/src/commands/server.js +2 -12
  158. package/dist/src/commands/stats.js +95 -15
  159. package/dist/src/commands/task-run-driver.js +2 -12
  160. package/dist/src/commands/task.js +131 -29
  161. package/dist/src/commands.js +192 -31
  162. package/dist/src/index.js +192 -31
  163. package/package.json +11 -9
package/dist/src/index.js CHANGED
@@ -1845,18 +1845,8 @@ import {
1845
1845
  readJsonlFile as readJsonlFile2,
1846
1846
  writeAuthorityRunRecord
1847
1847
  } from "@rig/runtime/control-plane/authority-files";
1848
- function normalizeRuntimeAdapter(value) {
1849
- const normalized = value?.trim().toLowerCase();
1850
- if (!normalized) {
1851
- return "pi";
1852
- }
1853
- if (normalized === "codex" || normalized === "codex-cli" || normalized === "codex-app-server" || normalized === "gpt-codex") {
1854
- return "codex";
1855
- }
1856
- if (normalized === "pi" || normalized === "rig-pi" || normalized === "@rig/pi") {
1857
- return "pi";
1858
- }
1859
- return "claude-code";
1848
+ function normalizeRuntimeAdapter(_value) {
1849
+ return "pi";
1860
1850
  }
1861
1851
  function readLatestBeadRecord(projectRoot, taskId) {
1862
1852
  const issuesPath = resolve12(resolveControlPlaneMonorepoRoot(projectRoot), ".beads", "issues.jsonl");
@@ -2810,6 +2800,23 @@ function buildOperatorPiEnv(input) {
2810
2800
  ...input.serverProjectRoot ? { RIG_PROJECT_ROOT: input.serverProjectRoot } : {}
2811
2801
  };
2812
2802
  }
2803
+ function shouldRequireOperatorTranscript(status) {
2804
+ return typeof status === "string" && TERMINAL_RUN_STATUSES.has(status.trim().toLowerCase());
2805
+ }
2806
+ function missingOperatorTranscriptMessage(runId, status) {
2807
+ const shortRun = runId.trim().slice(0, 8) || "unknown";
2808
+ const statusText = typeof status === "string" && status.trim() ? status.trim() : "terminal";
2809
+ 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.`;
2810
+ }
2811
+ function statusFromRunDetails(run) {
2812
+ if (!run || typeof run !== "object" || Array.isArray(run))
2813
+ return;
2814
+ const record = run;
2815
+ if (typeof record.status === "string")
2816
+ return record.status;
2817
+ const nested = record.run;
2818
+ return nested && typeof nested === "object" && !Array.isArray(nested) ? nested.status : undefined;
2819
+ }
2813
2820
  async function prepareOperatorConsole(context, runId, tempSessionDir) {
2814
2821
  const server = await ensureServerForCli(context.projectRoot);
2815
2822
  const localCwd = join3(homedir6(), ".rig", "drones", runId.slice(0, 8));
@@ -2839,6 +2846,13 @@ async function prepareOperatorConsole(context, runId, tempSessionDir) {
2839
2846
  sessionFileArg = ["--session", localSessionPath];
2840
2847
  }
2841
2848
  } catch {}
2849
+ if (sessionFileArg.length === 0) {
2850
+ const run = await getRunDetailsViaServer(context, runId).catch(() => null);
2851
+ const status = statusFromRunDetails(run);
2852
+ if (shouldRequireOperatorTranscript(status)) {
2853
+ throw new OperatorTranscriptUnavailableError(missingOperatorTranscriptMessage(runId, status));
2854
+ }
2855
+ }
2842
2856
  return { server, sessionFileArg };
2843
2857
  }
2844
2858
  function trustDroneCwd(localCwd) {
@@ -2910,10 +2924,17 @@ async function attachRunBundledPiFrontend(context, input) {
2910
2924
  rendered: "stock Pi operator console with the pi-rig extension"
2911
2925
  };
2912
2926
  }
2913
- var RIG_PI_THEME;
2927
+ var TERMINAL_RUN_STATUSES, OperatorTranscriptUnavailableError, RIG_PI_THEME;
2914
2928
  var init__pi_frontend = __esm(() => {
2915
2929
  init__server_client();
2916
2930
  init__async_ui();
2931
+ TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
2932
+ OperatorTranscriptUnavailableError = class OperatorTranscriptUnavailableError extends Error {
2933
+ constructor(message2) {
2934
+ super(message2);
2935
+ this.name = "OperatorTranscriptUnavailableError";
2936
+ }
2937
+ };
2917
2938
  RIG_PI_THEME = {
2918
2939
  $schema: "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
2919
2940
  name: "rig",
@@ -3068,7 +3089,7 @@ async function attachRunOperatorView(context, input) {
3068
3089
  }
3069
3090
  const pollMs = Math.max(250, Math.trunc(input.pollMs ?? 2000));
3070
3091
  let timelineCursor = snapshot.timelineCursor;
3071
- while (!detached && !TERMINAL_RUN_STATUSES.has(runStatusFromPayload(snapshot.run))) {
3092
+ while (!detached && !TERMINAL_RUN_STATUSES2.has(runStatusFromPayload(snapshot.run))) {
3072
3093
  await Bun.sleep(pollMs);
3073
3094
  snapshot = await readOperatorSnapshot(context, input.runId, { timelineCursor });
3074
3095
  timelineCursor = snapshot.timelineCursor;
@@ -3080,13 +3101,13 @@ async function attachRunOperatorView(context, input) {
3080
3101
  }
3081
3102
  return { ...snapshot, steered, detached };
3082
3103
  }
3083
- var TERMINAL_RUN_STATUSES;
3104
+ var TERMINAL_RUN_STATUSES2;
3084
3105
  var init__operator_view = __esm(() => {
3085
3106
  init__server_client();
3086
3107
  init__operator_surface();
3087
3108
  init__pi_frontend();
3088
3109
  init__async_ui();
3089
- TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
3110
+ TERMINAL_RUN_STATUSES2 = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
3090
3111
  });
3091
3112
 
3092
3113
  // packages/cli/src/commands/_help-catalog.ts
@@ -3443,30 +3464,62 @@ var init__help_catalog = __esm(() => {
3443
3464
  }
3444
3465
  ];
3445
3466
  ADVANCED_GROUPS = [
3446
- { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
3447
- { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
3467
+ {
3468
+ name: "setup",
3469
+ summary: "Bootstrap/check local setup.",
3470
+ usage: ["rig setup <bootstrap|check|preflight>"],
3471
+ commands: [
3472
+ { command: "bootstrap", description: "Bootstrap local setup dependencies.", primary: true },
3473
+ { command: "check", description: "Check local setup state (toolchain, deps, config).", primary: true },
3474
+ { command: "preflight", description: "Run preflight checks before a run.", primary: true }
3475
+ ]
3476
+ },
3477
+ {
3478
+ name: "profile",
3479
+ summary: "Runtime profile/model defaults.",
3480
+ usage: ["rig profile <show|set>"],
3481
+ commands: [
3482
+ { command: "show", description: "Show the active execution profile.", primary: true },
3483
+ { command: "set [--model <model>] [--runtime <runtime>] [--plugin <plugin>]", description: "Set model/runtime/plugin profile defaults.", primary: true }
3484
+ ]
3485
+ },
3448
3486
  {
3449
3487
  name: "review",
3450
3488
  summary: "Inspect or change completion review gate policy.",
3451
3489
  usage: ["rig review <show|set>"],
3452
3490
  commands: [
3453
3491
  { command: "show", description: "Show current review gate settings." },
3454
- { command: "set <off|advisory|required> [--provider greptile]", description: "Change review strictness/provider." }
3492
+ { command: "set <off|advisory|required> [--provider <provider>]", description: "Change review strictness/provider (e.g. --provider greptile)." }
3455
3493
  ],
3456
3494
  examples: ["rig review show", "rig review set required --provider greptile"],
3457
3495
  next: ["Use `rig inbox approvals` for blocked run handoffs."]
3458
3496
  },
3459
3497
  {
3460
3498
  name: "browser",
3461
- summary: "Browser/app diagnostics for browser-required tasks.",
3462
- usage: ["rig browser <help|explain|demo|app|hp-next> [options]"],
3499
+ summary: "Browser workstation actions for browser-required tasks: launch, check, CDP probe, profile reset, and app-specific smokes.",
3500
+ usage: ["rig browser <help|explain|demo|hp-next|cdp-probe|profile-persistence|profile-lock-check|smoke-test> [options]"],
3463
3501
  commands: [
3464
- { command: "help", description: "Rich browser command help (canonical: `rig browser help`)." },
3465
- { command: "explain", description: "Explain the browser-required task contract." },
3466
- { command: "demo", description: "Run browser demo flows against a local page." },
3467
- { command: "app", description: "Launch the Rig Browser workstation app." },
3468
- { command: "hp-next <dev|check|e2e|reset>", description: "Drive the hp-next browser test harness." }
3469
- ]
3502
+ { command: "help", description: "Rich browser command help (canonical: `rig browser help`).", primary: true },
3503
+ { command: "explain", description: "Explain the browser-required task contract and runtime helper commands.", primary: true },
3504
+ { 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 },
3505
+ { command: "hp-next dev", description: "Start hp-next Rig Browser in dev/watch mode.", primary: true },
3506
+ { command: "hp-next start", description: "Build/start the hp-next browser workstation without watch mode.", primary: true },
3507
+ { command: "hp-next check", description: "Validate the hp-next CDP endpoint on the configured port.", primary: true },
3508
+ { command: "hp-next e2e", description: "Run hp-next browser e2e smoke checks through Rig Browser.", primary: true },
3509
+ { command: "hp-next reset", description: "Reset the hp-next browser profile when stale browser state is suspected.", primary: true },
3510
+ { command: "cdp-probe", description: "Run an isolated CDP attach/evaluate/layout probe." },
3511
+ { command: "profile-persistence", description: "Verify a named browser profile persists browser state." },
3512
+ { command: "profile-lock-check", description: "Verify concurrent launches reject the same profile." },
3513
+ { command: "smoke-test", description: "Run the browser package smoke test." }
3514
+ ],
3515
+ examples: [
3516
+ "rig browser help",
3517
+ "rig browser hp-next check",
3518
+ "rig browser hp-next e2e",
3519
+ "rig browser cdp-probe",
3520
+ "rig browser profile-lock-check"
3521
+ ],
3522
+ next: ["Inside a task run, use rig-browser-launch, rig-browser-check, and rig-browser-attach-info from the worker PATH."]
3470
3523
  },
3471
3524
  {
3472
3525
  name: "pi",
@@ -3481,12 +3534,60 @@ var init__help_catalog = __esm(() => {
3481
3534
  examples: ["rig pi search subagents", "rig pi add pi-subagents", "rig pi list"],
3482
3535
  next: ["Config-managed extensions: declare `runtime: { pi: { packages: [...] } }` in rig.config.ts \u2014 workers pick them up automatically."]
3483
3536
  },
3484
- { name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
3485
- { name: "agent", summary: "Runtime agent workspace helpers.", usage: ["rig agent <list|prepare|run|cleanup>"], commands: [{ command: "list", description: "List prepared agents." }] },
3537
+ {
3538
+ name: "queue",
3539
+ summary: "Run task queues locally.",
3540
+ usage: ["rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]"],
3541
+ commands: [
3542
+ { 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 }
3543
+ ]
3544
+ },
3545
+ {
3546
+ name: "agent",
3547
+ summary: "Runtime agent workspace helpers.",
3548
+ usage: ["rig agent <list|prepare|run|cleanup>"],
3549
+ commands: [
3550
+ { command: "list", description: "List prepared agent runtimes.", primary: true },
3551
+ { command: "prepare [--id <id>] [--mode <mode>] [--task <task>]", description: "Prepare an isolated agent runtime workspace.", primary: true },
3552
+ { command: "run [--id <id>] [--mode <mode>] [--task <task>] [--skip-project-sync]", description: "Prepare (if needed) and run an agent in its workspace.", primary: true },
3553
+ { command: "cleanup [--all] [--id <id>]", description: "Remove prepared agent workspaces.", primary: true }
3554
+ ]
3555
+ },
3486
3556
  { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
3487
- { name: "dist", summary: "Build/install packaged Rig CLI.", usage: ["rig dist <build|install|doctor>"], commands: [{ command: "build", description: "Build distribution." }] },
3557
+ {
3558
+ name: "dist",
3559
+ summary: "Build/install packaged Rig CLI.",
3560
+ usage: ["rig dist <build|install|doctor|rebuild-agent>"],
3561
+ commands: [
3562
+ { command: "build [--output-dir <dir>]", description: "Build the distributable Rig CLI.", primary: true },
3563
+ { command: "install [--scope <scope>] [--path <path>]", description: "Install the built CLI to a scope/path.", primary: true },
3564
+ { command: "doctor", description: "Diagnose the dist toolchain and install state.", primary: true },
3565
+ { command: "rebuild-agent", description: "Rebuild the agent runtime image, pruning stale images.", primary: true }
3566
+ ]
3567
+ },
3488
3568
  { name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
3489
- { name: "remote", summary: "Compatibility remote orchestration controls.", usage: ["rig remote <status|watch|pause|resume|...>"], commands: [{ command: "status", description: "Show remote state." }] },
3569
+ {
3570
+ name: "remote",
3571
+ summary: "Compatibility remote orchestration controls.",
3572
+ usage: ["rig remote <status|tasks|watch|pause|resume|continue|stop|refresh|add-iterations|remove-iterations|endpoint ...>"],
3573
+ commands: [
3574
+ { command: "status [--remote <alias>]", description: "Show the remote orchestration state.", primary: true },
3575
+ { command: "tasks [--remote <alias>]", description: "List the remote's tracked tasks.", primary: true },
3576
+ { command: "watch [--remote <alias>] [--seconds <n>] [--event <type>]", description: "Stream remote orchestration events.", primary: true },
3577
+ { command: "pause [--remote <alias>]", description: "Pause the running remote orchestration.", primary: true },
3578
+ { command: "resume [--remote <alias>] [--max-workers <n>] [--max-iterations <n>] [--direct-merge]", description: "Resume the remote with optional tuning.", primary: true },
3579
+ { command: "continue [--remote <alias>]", description: "Continue a paused remote orchestration.", primary: true },
3580
+ { command: "stop [--remote <alias>]", description: "Stop the remote orchestration.", primary: true },
3581
+ { command: "refresh [--remote <alias>]", description: "Refresh remote state.", primary: true },
3582
+ { command: "add-iterations [--count <n>] [--remote <alias>]", description: "Grant the remote more iterations.", primary: true },
3583
+ { command: "remove-iterations [--count <n>] [--remote <alias>]", description: "Reduce the remote's iteration budget.", primary: true },
3584
+ { command: "endpoint list", description: "List configured remote endpoints.", primary: true },
3585
+ { command: "endpoint add --alias <alias> --host <host> --port <n> [--token <token>]", description: "Register a remote endpoint.", primary: true },
3586
+ { command: "endpoint remove --alias <alias>", description: "Remove a remote endpoint.", primary: true },
3587
+ { command: "endpoint test [--alias <alias>]", description: "Test connectivity to a remote endpoint.", primary: true },
3588
+ { command: "endpoint doctor", description: "Diagnose remote endpoint configuration.", primary: true }
3589
+ ]
3590
+ },
3490
3591
  { name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
3491
3592
  { name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
3492
3593
  { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
@@ -4069,6 +4170,47 @@ var init_task = __esm(() => {
4069
4170
  init__connection_state();
4070
4171
  });
4071
4172
 
4173
+ // packages/cli/src/commands/_server-events.ts
4174
+ import { WsTransport } from "@rig/client";
4175
+ import { RIG_WS_CHANNELS } from "@rig/contracts";
4176
+ function buildRigWebSocketUrl(baseUrl, authToken) {
4177
+ const url = new URL(baseUrl);
4178
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
4179
+ if (authToken)
4180
+ url.searchParams.set("token", authToken);
4181
+ return url.toString();
4182
+ }
4183
+ async function connectRigServerEvents(projectRoot, handlers) {
4184
+ const { baseUrl, authToken } = await ensureServerForCli(projectRoot);
4185
+ const transport = new WsTransport(buildRigWebSocketUrl(baseUrl, authToken));
4186
+ const unsubscribers = [];
4187
+ if (handlers.onSnapshotInvalidated)
4188
+ unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.snapshotInvalidated, handlers.onSnapshotInvalidated));
4189
+ if (handlers.onRunLogAppended)
4190
+ unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.runLogAppended, handlers.onRunLogAppended));
4191
+ if (handlers.onEngineEvent)
4192
+ unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.event, handlers.onEngineEvent));
4193
+ let status = "connecting";
4194
+ unsubscribers.push(transport.subscribeState((state) => {
4195
+ status = state.status;
4196
+ handlers.onStatus?.(state.status);
4197
+ }));
4198
+ return {
4199
+ connected: () => status === "connected",
4200
+ close: () => {
4201
+ for (const unsubscribe of unsubscribers) {
4202
+ try {
4203
+ unsubscribe();
4204
+ } catch {}
4205
+ }
4206
+ transport.dispose();
4207
+ }
4208
+ };
4209
+ }
4210
+ var init__server_events = __esm(() => {
4211
+ init__server_client();
4212
+ });
4213
+
4072
4214
  // packages/cli/src/app/board.ts
4073
4215
  var exports_board = {};
4074
4216
  __export(exports_board, {
@@ -4907,7 +5049,24 @@ async function runOperatorBoard(context, options = {}) {
4907
5049
  tui.requestRender();
4908
5050
  }
4909
5051
  }, BOARD_TICK_MS);
5052
+ const live = { subscription: null };
5053
+ const refreshActiveView = () => {
5054
+ refresh({ quiet: true });
5055
+ if (view === "tasks")
5056
+ refreshTasks();
5057
+ if (view === "inbox")
5058
+ refreshInbox();
5059
+ };
5060
+ connectRigServerEvents(context.projectRoot, {
5061
+ onSnapshotInvalidated: () => refreshActiveView()
5062
+ }).then((subscription) => {
5063
+ live.subscription = subscription;
5064
+ }).catch(() => {
5065
+ live.subscription = null;
5066
+ });
4910
5067
  const refreshTimer = setInterval(() => {
5068
+ if (live.subscription?.connected())
5069
+ return;
4911
5070
  refresh();
4912
5071
  }, BOARD_REFRESH_MS);
4913
5072
  tui.start();
@@ -4922,6 +5081,7 @@ async function runOperatorBoard(context, options = {}) {
4922
5081
  });
4923
5082
  clearInterval(animation);
4924
5083
  clearInterval(refreshTimer);
5084
+ live.subscription?.close();
4925
5085
  return outcome;
4926
5086
  }
4927
5087
  async function runOperatorBoardLoop(context, attach, options = {}) {
@@ -4940,6 +5100,7 @@ var init_board = __esm(() => {
4940
5100
  init__help_catalog();
4941
5101
  init__server_client();
4942
5102
  init__authority_runs();
5103
+ init__server_events();
4943
5104
  init_inbox();
4944
5105
  init_task();
4945
5106
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.83",
3
+ "version": "0.0.6-alpha.85",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -27,15 +27,17 @@
27
27
  "@earendil-works/pi-coding-agent": "0.79.0",
28
28
  "@earendil-works/pi-tui": "^0.79.0",
29
29
  "@opentui/core": "^0.4.1",
30
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.83",
31
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.83",
32
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.83",
33
- "@rig/pi-rig": "npm:@h-rig/pi-rig@0.0.6-alpha.83",
34
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.83",
35
- "@rig/server": "npm:@h-rig/server@0.0.6-alpha.83",
36
- "@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.83",
30
+ "@opentui/react": "0.4.1",
31
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.85",
32
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.85",
33
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.85",
34
+ "@rig/pi-rig": "npm:@h-rig/pi-rig@0.0.6-alpha.85",
35
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.85",
36
+ "@rig/server": "npm:@h-rig/server@0.0.6-alpha.85",
37
+ "@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.85",
37
38
  "@xterm/headless": "^6.0.0",
38
39
  "effect": "4.0.0-beta.78",
39
- "picocolors": "^1.1.1"
40
+ "picocolors": "^1.1.1",
41
+ "react": "^19.2.0"
40
42
  }
41
43
  }