@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.
Files changed (163) hide show
  1. package/dist/bin/rig.js +22085 -14618
  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 +24296 -16919
  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 +5144 -0
  52. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  53. package/dist/src/app-opentui/react/Backdrop.js +1834 -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 +5743 -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
@@ -384,30 +384,62 @@ var PRIMARY_GROUPS = [
384
384
  }
385
385
  ];
386
386
  var ADVANCED_GROUPS = [
387
- { name: "setup", summary: "Bootstrap/check local setup.", usage: ["rig setup <bootstrap|check|preflight>"], commands: [{ command: "bootstrap|check|preflight", description: "Setup helpers." }] },
388
- { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
387
+ {
388
+ name: "setup",
389
+ summary: "Bootstrap/check local setup.",
390
+ usage: ["rig setup <bootstrap|check|preflight>"],
391
+ commands: [
392
+ { command: "bootstrap", description: "Bootstrap local setup dependencies.", primary: true },
393
+ { command: "check", description: "Check local setup state (toolchain, deps, config).", primary: true },
394
+ { command: "preflight", description: "Run preflight checks before a run.", primary: true }
395
+ ]
396
+ },
397
+ {
398
+ name: "profile",
399
+ summary: "Runtime profile/model defaults.",
400
+ usage: ["rig profile <show|set>"],
401
+ commands: [
402
+ { command: "show", description: "Show the active execution profile.", primary: true },
403
+ { command: "set [--model <model>] [--runtime <runtime>] [--plugin <plugin>]", description: "Set model/runtime/plugin profile defaults.", primary: true }
404
+ ]
405
+ },
389
406
  {
390
407
  name: "review",
391
408
  summary: "Inspect or change completion review gate policy.",
392
409
  usage: ["rig review <show|set>"],
393
410
  commands: [
394
411
  { command: "show", description: "Show current review gate settings." },
395
- { command: "set <off|advisory|required> [--provider greptile]", description: "Change review strictness/provider." }
412
+ { command: "set <off|advisory|required> [--provider <provider>]", description: "Change review strictness/provider (e.g. --provider greptile)." }
396
413
  ],
397
414
  examples: ["rig review show", "rig review set required --provider greptile"],
398
415
  next: ["Use `rig inbox approvals` for blocked run handoffs."]
399
416
  },
400
417
  {
401
418
  name: "browser",
402
- summary: "Browser/app diagnostics for browser-required tasks.",
403
- usage: ["rig browser <help|explain|demo|app|hp-next> [options]"],
419
+ summary: "Browser workstation actions for browser-required tasks: launch, check, CDP probe, profile reset, and app-specific smokes.",
420
+ usage: ["rig browser <help|explain|demo|hp-next|cdp-probe|profile-persistence|profile-lock-check|smoke-test> [options]"],
404
421
  commands: [
405
- { command: "help", description: "Rich browser command help (canonical: `rig browser help`)." },
406
- { command: "explain", description: "Explain the browser-required task contract." },
407
- { command: "demo", description: "Run browser demo flows against a local page." },
408
- { command: "app", description: "Launch the Rig Browser workstation app." },
409
- { command: "hp-next <dev|check|e2e|reset>", description: "Drive the hp-next browser test harness." }
410
- ]
422
+ { command: "help", description: "Rich browser command help (canonical: `rig browser help`).", primary: true },
423
+ { command: "explain", description: "Explain the browser-required task contract and runtime helper commands.", primary: true },
424
+ { 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 },
425
+ { command: "hp-next dev", description: "Start hp-next Rig Browser in dev/watch mode.", primary: true },
426
+ { command: "hp-next start", description: "Build/start the hp-next browser workstation without watch mode.", primary: true },
427
+ { command: "hp-next check", description: "Validate the hp-next CDP endpoint on the configured port.", primary: true },
428
+ { command: "hp-next e2e", description: "Run hp-next browser e2e smoke checks through Rig Browser.", primary: true },
429
+ { command: "hp-next reset", description: "Reset the hp-next browser profile when stale browser state is suspected.", primary: true },
430
+ { command: "cdp-probe", description: "Run an isolated CDP attach/evaluate/layout probe." },
431
+ { command: "profile-persistence", description: "Verify a named browser profile persists browser state." },
432
+ { command: "profile-lock-check", description: "Verify concurrent launches reject the same profile." },
433
+ { command: "smoke-test", description: "Run the browser package smoke test." }
434
+ ],
435
+ examples: [
436
+ "rig browser help",
437
+ "rig browser hp-next check",
438
+ "rig browser hp-next e2e",
439
+ "rig browser cdp-probe",
440
+ "rig browser profile-lock-check"
441
+ ],
442
+ next: ["Inside a task run, use rig-browser-launch, rig-browser-check, and rig-browser-attach-info from the worker PATH."]
411
443
  },
412
444
  {
413
445
  name: "pi",
@@ -422,12 +454,60 @@ var ADVANCED_GROUPS = [
422
454
  examples: ["rig pi search subagents", "rig pi add pi-subagents", "rig pi list"],
423
455
  next: ["Config-managed extensions: declare `runtime: { pi: { packages: [...] } }` in rig.config.ts \u2014 workers pick them up automatically."]
424
456
  },
425
- { name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
426
- { name: "agent", summary: "Runtime agent workspace helpers.", usage: ["rig agent <list|prepare|run|cleanup>"], commands: [{ command: "list", description: "List prepared agents." }] },
457
+ {
458
+ name: "queue",
459
+ summary: "Run task queues locally.",
460
+ usage: ["rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]"],
461
+ commands: [
462
+ { 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 }
463
+ ]
464
+ },
465
+ {
466
+ name: "agent",
467
+ summary: "Runtime agent workspace helpers.",
468
+ usage: ["rig agent <list|prepare|run|cleanup>"],
469
+ commands: [
470
+ { command: "list", description: "List prepared agent runtimes.", primary: true },
471
+ { command: "prepare [--id <id>] [--mode <mode>] [--task <task>]", description: "Prepare an isolated agent runtime workspace.", primary: true },
472
+ { command: "run [--id <id>] [--mode <mode>] [--task <task>] [--skip-project-sync]", description: "Prepare (if needed) and run an agent in its workspace.", primary: true },
473
+ { command: "cleanup [--all] [--id <id>]", description: "Remove prepared agent workspaces.", primary: true }
474
+ ]
475
+ },
427
476
  { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
428
- { name: "dist", summary: "Build/install packaged Rig CLI.", usage: ["rig dist <build|install|doctor>"], commands: [{ command: "build", description: "Build distribution." }] },
477
+ {
478
+ name: "dist",
479
+ summary: "Build/install packaged Rig CLI.",
480
+ usage: ["rig dist <build|install|doctor|rebuild-agent>"],
481
+ commands: [
482
+ { command: "build [--output-dir <dir>]", description: "Build the distributable Rig CLI.", primary: true },
483
+ { command: "install [--scope <scope>] [--path <path>]", description: "Install the built CLI to a scope/path.", primary: true },
484
+ { command: "doctor", description: "Diagnose the dist toolchain and install state.", primary: true },
485
+ { command: "rebuild-agent", description: "Rebuild the agent runtime image, pruning stale images.", primary: true }
486
+ ]
487
+ },
429
488
  { name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
430
- { name: "remote", summary: "Compatibility remote orchestration controls.", usage: ["rig remote <status|watch|pause|resume|...>"], commands: [{ command: "status", description: "Show remote state." }] },
489
+ {
490
+ name: "remote",
491
+ summary: "Compatibility remote orchestration controls.",
492
+ usage: ["rig remote <status|tasks|watch|pause|resume|continue|stop|refresh|add-iterations|remove-iterations|endpoint ...>"],
493
+ commands: [
494
+ { command: "status [--remote <alias>]", description: "Show the remote orchestration state.", primary: true },
495
+ { command: "tasks [--remote <alias>]", description: "List the remote's tracked tasks.", primary: true },
496
+ { command: "watch [--remote <alias>] [--seconds <n>] [--event <type>]", description: "Stream remote orchestration events.", primary: true },
497
+ { command: "pause [--remote <alias>]", description: "Pause the running remote orchestration.", primary: true },
498
+ { command: "resume [--remote <alias>] [--max-workers <n>] [--max-iterations <n>] [--direct-merge]", description: "Resume the remote with optional tuning.", primary: true },
499
+ { command: "continue [--remote <alias>]", description: "Continue a paused remote orchestration.", primary: true },
500
+ { command: "stop [--remote <alias>]", description: "Stop the remote orchestration.", primary: true },
501
+ { command: "refresh [--remote <alias>]", description: "Refresh remote state.", primary: true },
502
+ { command: "add-iterations [--count <n>] [--remote <alias>]", description: "Grant the remote more iterations.", primary: true },
503
+ { command: "remove-iterations [--count <n>] [--remote <alias>]", description: "Reduce the remote's iteration budget.", primary: true },
504
+ { command: "endpoint list", description: "List configured remote endpoints.", primary: true },
505
+ { command: "endpoint add --alias <alias> --host <host> --port <n> [--token <token>]", description: "Register a remote endpoint.", primary: true },
506
+ { command: "endpoint remove --alias <alias>", description: "Remove a remote endpoint.", primary: true },
507
+ { command: "endpoint test [--alias <alias>]", description: "Test connectivity to a remote endpoint.", primary: true },
508
+ { command: "endpoint doctor", description: "Diagnose remote endpoint configuration.", primary: true }
509
+ ]
510
+ },
431
511
  { name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
432
512
  { name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
433
513
  { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
@@ -901,18 +981,46 @@ import {
901
981
  import { resolveMonorepoRoot } from "@rig/runtime/control-plane/native/utils";
902
982
 
903
983
  // packages/cli/src/commands/_authority-runs.ts
904
- function normalizeRuntimeAdapter(value) {
905
- const normalized = value?.trim().toLowerCase();
906
- if (!normalized) {
907
- return "pi";
908
- }
909
- if (normalized === "codex" || normalized === "codex-cli" || normalized === "codex-app-server" || normalized === "gpt-codex") {
910
- return "codex";
911
- }
912
- if (normalized === "pi" || normalized === "rig-pi" || normalized === "@rig/pi") {
913
- return "pi";
914
- }
915
- return "claude-code";
984
+ function normalizeRuntimeAdapter(_value) {
985
+ return "pi";
986
+ }
987
+
988
+ // packages/cli/src/commands/_server-events.ts
989
+ import { WsTransport } from "@rig/client";
990
+ import { RIG_WS_CHANNELS } from "@rig/contracts";
991
+ function buildRigWebSocketUrl(baseUrl, authToken) {
992
+ const url = new URL(baseUrl);
993
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
994
+ if (authToken)
995
+ url.searchParams.set("token", authToken);
996
+ return url.toString();
997
+ }
998
+ async function connectRigServerEvents(projectRoot, handlers) {
999
+ const { baseUrl, authToken } = await ensureServerForCli(projectRoot);
1000
+ const transport = new WsTransport(buildRigWebSocketUrl(baseUrl, authToken));
1001
+ const unsubscribers = [];
1002
+ if (handlers.onSnapshotInvalidated)
1003
+ unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.snapshotInvalidated, handlers.onSnapshotInvalidated));
1004
+ if (handlers.onRunLogAppended)
1005
+ unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.runLogAppended, handlers.onRunLogAppended));
1006
+ if (handlers.onEngineEvent)
1007
+ unsubscribers.push(transport.subscribe(RIG_WS_CHANNELS.event, handlers.onEngineEvent));
1008
+ let status = "connecting";
1009
+ unsubscribers.push(transport.subscribeState((state) => {
1010
+ status = state.status;
1011
+ handlers.onStatus?.(state.status);
1012
+ }));
1013
+ return {
1014
+ connected: () => status === "connected",
1015
+ close: () => {
1016
+ for (const unsubscribe of unsubscribers) {
1017
+ try {
1018
+ unsubscribe();
1019
+ } catch {}
1020
+ }
1021
+ transport.dispose();
1022
+ }
1023
+ };
916
1024
  }
917
1025
 
918
1026
  // packages/cli/src/app/drone-ui.ts
@@ -973,9 +1081,10 @@ import { ensureProjectMainFreshBeforeRun } from "@rig/runtime/control-plane/proj
973
1081
  // packages/cli/src/commands/_pi-frontend.ts
974
1082
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
975
1083
  import createPiRigExtension from "@rig/pi-rig";
1084
+ var TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
976
1085
 
977
1086
  // packages/cli/src/commands/_operator-view.ts
978
- var TERMINAL_RUN_STATUSES = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
1087
+ var TERMINAL_RUN_STATUSES2 = new Set(["completed", "failed", "stopped", "cancelled", "canceled", "closed", "merged", "needs_attention", "needs-attention"]);
979
1088
 
980
1089
  // packages/cli/src/commands/task.ts
981
1090
  import { buildPluginHostContext } from "@rig/runtime/control-plane/plugin-host-context";
@@ -1831,7 +1940,24 @@ async function runOperatorBoard(context, options = {}) {
1831
1940
  tui.requestRender();
1832
1941
  }
1833
1942
  }, BOARD_TICK_MS);
1943
+ const live = { subscription: null };
1944
+ const refreshActiveView = () => {
1945
+ refresh({ quiet: true });
1946
+ if (view === "tasks")
1947
+ refreshTasks();
1948
+ if (view === "inbox")
1949
+ refreshInbox();
1950
+ };
1951
+ connectRigServerEvents(context.projectRoot, {
1952
+ onSnapshotInvalidated: () => refreshActiveView()
1953
+ }).then((subscription) => {
1954
+ live.subscription = subscription;
1955
+ }).catch(() => {
1956
+ live.subscription = null;
1957
+ });
1834
1958
  const refreshTimer = setInterval(() => {
1959
+ if (live.subscription?.connected())
1960
+ return;
1835
1961
  refresh();
1836
1962
  }, BOARD_REFRESH_MS);
1837
1963
  tui.start();
@@ -1846,6 +1972,7 @@ async function runOperatorBoard(context, options = {}) {
1846
1972
  });
1847
1973
  clearInterval(animation);
1848
1974
  clearInterval(refreshTimer);
1975
+ live.subscription?.close();
1849
1976
  return outcome;
1850
1977
  }
1851
1978
  async function runOperatorBoardLoop(context, attach, options = {}) {
@@ -1,6 +1,4 @@
1
- import type { AppAdapter } from "../types";
2
1
  import { type AppAdapterContext } from "./common";
3
- export declare function createDoctorAdapter(): AppAdapter;
4
2
  export type AppDoctorCheck = {
5
3
  readonly id: string;
6
4
  readonly label: string;
@@ -735,15 +735,6 @@ var init__doctor_checks = __esm(() => {
735
735
  });
736
736
 
737
737
  // packages/cli/src/app-opentui/adapters/common.ts
738
- function adapterContextFromRuntime(runtime, renderer) {
739
- return {
740
- projectRoot: runtime.getState().projectRoot,
741
- renderer,
742
- ensureRuntime: () => runtime.getRunnerContext(),
743
- emit: (event) => runtime.emit(event),
744
- getState: () => runtime.getState()
745
- };
746
- }
747
738
  function projectRootOf(ctx) {
748
739
  const root = ctx.rig?.projectRoot ?? ctx.projectRoot ?? ctx.getState().projectRoot;
749
740
  if (typeof root === "string" && root.trim())
@@ -784,20 +775,6 @@ function patchData(ctx, data) {
784
775
  }
785
776
 
786
777
  // packages/cli/src/app-opentui/adapters/doctor.ts
787
- function createDoctorAdapter() {
788
- return {
789
- id: "doctor",
790
- async handleIntent(runtime, intent) {
791
- if (intent.scene !== "doctor" && intent.action.kind !== "doctor-run")
792
- return false;
793
- if (intent.action.kind === "doctor-run" || intent.action.kind === "refresh" || intent.action.kind === "navigate") {
794
- await runDoctorChecksForApp(adapterContextFromRuntime(runtime));
795
- return true;
796
- }
797
- return false;
798
- }
799
- };
800
- }
801
778
  async function runDoctorChecksForApp(ctx) {
802
779
  const label = "Running doctor";
803
780
  emitStarted(ctx, label);
@@ -824,6 +801,5 @@ async function runDoctorChecksForApp(ctx) {
824
801
  }
825
802
  }
826
803
  export {
827
- runDoctorChecksForApp,
828
- createDoctorAdapter
804
+ runDoctorChecksForApp
829
805
  };
@@ -0,0 +1,62 @@
1
+ import type { AppIntent } from "../types";
2
+ import { type AppAdapterContext } from "./common";
3
+ /** A subcommand's flag/option/positional adapted into a typed UI field. */
4
+ export type AppFamilyField = {
5
+ readonly kind: "flag";
6
+ readonly name: string;
7
+ readonly token: string;
8
+ } | {
9
+ readonly kind: "value";
10
+ readonly name: string;
11
+ readonly token: string;
12
+ readonly placeholder: string;
13
+ readonly required: boolean;
14
+ } | {
15
+ readonly kind: "select";
16
+ readonly name: string;
17
+ readonly token: string;
18
+ readonly choices: readonly string[];
19
+ readonly required: boolean;
20
+ } | {
21
+ readonly kind: "positional";
22
+ readonly name: string;
23
+ readonly placeholder: string;
24
+ readonly required: boolean;
25
+ readonly repeatable: boolean;
26
+ };
27
+ /** A catalog subcommand parsed into its base words + adapted fields. */
28
+ export type AppFamilySubcommand = {
29
+ readonly id: string;
30
+ readonly template: string;
31
+ readonly description: string;
32
+ /** The words before the first placeholder/flag — the command's verb path. */
33
+ readonly base: readonly string[];
34
+ readonly fields: readonly AppFamilyField[];
35
+ /** No fields at all → safe to run directly with one Enter. */
36
+ readonly direct: boolean;
37
+ readonly primary: boolean;
38
+ };
39
+ export type AppFamilySnapshot = {
40
+ readonly family: string;
41
+ readonly summary: string;
42
+ readonly usage: readonly string[];
43
+ readonly subcommands: readonly AppFamilySubcommand[];
44
+ /** Captured live state from the family's safe list/status subcommand. */
45
+ readonly state: {
46
+ readonly subcommand: readonly string[] | null;
47
+ readonly ran: boolean;
48
+ readonly ok: boolean;
49
+ readonly lines: readonly string[];
50
+ readonly details: Record<string, unknown> | null;
51
+ };
52
+ readonly refreshedAt: number;
53
+ };
54
+ /** In-progress form: which subcommand is open and the value/flag selections. */
55
+ export type AppFamilyForm = {
56
+ readonly family: string;
57
+ readonly subId: string | null;
58
+ /** flag/positional/value name → set value. Flags store "on"; cleared = unset. */
59
+ readonly values: Record<string, string>;
60
+ };
61
+ export declare function familyCatalog(family: string): AppFamilySnapshot["subcommands"];
62
+ export declare function refreshFamily(ctx: AppAdapterContext, intent?: AppIntent): Promise<AppFamilySnapshot>;