@h-rig/cli 0.0.6-alpha.82 → 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 (206) hide show
  1. package/dist/bin/build-rig-binaries.js +40 -8
  2. package/dist/bin/rig.js +23402 -14577
  3. package/dist/src/app/board.js +217 -41
  4. package/dist/src/app-opentui/adapters/command.d.ts +2 -0
  5. package/dist/src/app-opentui/adapters/command.js +329 -0
  6. package/dist/src/app-opentui/adapters/common.js +2 -2
  7. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
  8. package/dist/src/app-opentui/adapters/doctor.js +64 -39
  9. package/dist/src/app-opentui/adapters/family.d.ts +62 -0
  10. package/dist/src/app-opentui/adapters/family.js +14305 -0
  11. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
  12. package/dist/src/app-opentui/adapters/fleet.js +90 -60
  13. package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
  14. package/dist/src/app-opentui/adapters/inbox.js +137 -78
  15. package/dist/src/app-opentui/adapters/init.d.ts +0 -2
  16. package/dist/src/app-opentui/adapters/init.js +85 -47
  17. package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
  18. package/dist/src/app-opentui/adapters/inspect.js +1024 -0
  19. package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
  20. package/dist/src/app-opentui/adapters/pi-attach.js +442 -125
  21. package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
  22. package/dist/src/app-opentui/adapters/pi.js +363 -0
  23. package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
  24. package/dist/src/app-opentui/adapters/plugin.js +544 -0
  25. package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
  26. package/dist/src/app-opentui/adapters/repo.js +186 -0
  27. package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
  28. package/dist/src/app-opentui/adapters/run-detail.js +180 -63
  29. package/dist/src/app-opentui/adapters/server.d.ts +10 -2
  30. package/dist/src/app-opentui/adapters/server.js +191 -45
  31. package/dist/src/app-opentui/adapters/tasks.d.ts +11 -2
  32. package/dist/src/app-opentui/adapters/tasks.js +1123 -143
  33. package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
  34. package/dist/src/app-opentui/adapters/workspace.js +333 -0
  35. package/dist/src/app-opentui/autocomplete.d.ts +20 -0
  36. package/dist/src/app-opentui/autocomplete.js +576 -0
  37. package/dist/src/app-opentui/bootstrap.d.ts +1 -6
  38. package/dist/src/app-opentui/bootstrap.js +25252 -16474
  39. package/dist/src/app-opentui/command-palette.d.ts +3 -0
  40. package/dist/src/app-opentui/command-palette.js +1010 -0
  41. package/dist/src/app-opentui/command-pty-host.d.ts +62 -0
  42. package/dist/src/app-opentui/command-pty-host.js +248 -0
  43. package/dist/src/app-opentui/drone.js +8 -6
  44. package/dist/src/app-opentui/events.js +1 -1
  45. package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
  46. package/dist/src/app-opentui/fleet-stats.js +114 -0
  47. package/dist/src/app-opentui/focus-manager.d.ts +14 -0
  48. package/dist/src/app-opentui/focus-manager.js +24 -0
  49. package/dist/src/app-opentui/index.js +5431 -2797
  50. package/dist/src/app-opentui/intent.js +179 -50
  51. package/dist/src/app-opentui/keymap.d.ts +21 -0
  52. package/dist/src/app-opentui/keymap.js +1748 -0
  53. package/dist/src/app-opentui/launch-routing.d.ts +16 -0
  54. package/dist/src/app-opentui/launch-routing.js +55 -0
  55. package/dist/src/app-opentui/layout.d.ts +7 -0
  56. package/dist/src/app-opentui/layout.js +13 -6
  57. package/dist/src/app-opentui/list-search.d.ts +24 -0
  58. package/dist/src/app-opentui/list-search.js +88 -1
  59. package/dist/src/app-opentui/pi-host-child.js +99 -17
  60. package/dist/src/app-opentui/pi-pty-host.d.ts +14 -0
  61. package/dist/src/app-opentui/pi-pty-host.js +30 -14
  62. package/dist/src/app-opentui/react/App.d.ts +9 -0
  63. package/dist/src/app-opentui/react/App.js +5144 -0
  64. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  65. package/dist/src/app-opentui/react/Backdrop.js +1834 -0
  66. package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
  67. package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
  68. package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
  69. package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
  70. package/dist/src/app-opentui/react/context.d.ts +17 -0
  71. package/dist/src/app-opentui/react/context.js +37 -0
  72. package/dist/src/app-opentui/react/launch.d.ts +2 -0
  73. package/dist/src/app-opentui/react/launch.js +5743 -0
  74. package/dist/src/app-opentui/react/nav.d.ts +18 -0
  75. package/dist/src/app-opentui/react/nav.js +54 -0
  76. package/dist/src/app-opentui/react/scroll.d.ts +12 -0
  77. package/dist/src/app-opentui/react/scroll.js +21 -0
  78. package/dist/src/app-opentui/react/syntax.d.ts +2 -0
  79. package/dist/src/app-opentui/react/syntax.js +64 -0
  80. package/dist/src/app-opentui/registry.js +20428 -4828
  81. package/dist/src/app-opentui/render/ascii-fleet.d.ts +15 -0
  82. package/dist/src/app-opentui/render/ascii-fleet.js +82 -0
  83. package/dist/src/app-opentui/render/constants.d.ts +31 -0
  84. package/dist/src/app-opentui/render/constants.js +66 -0
  85. package/dist/src/app-opentui/render/graphics.d.ts +2 -1
  86. package/dist/src/app-opentui/render/graphics.js +228 -46
  87. package/dist/src/app-opentui/render/image-visual-layer-worker.js +469 -930
  88. package/dist/src/app-opentui/render/image-visual-layer.d.ts +25 -10
  89. package/dist/src/app-opentui/render/image-visual-layer.js +448 -329
  90. package/dist/src/app-opentui/render/native-host.d.ts +37 -0
  91. package/dist/src/app-opentui/render/native-host.js +179 -0
  92. package/dist/src/app-opentui/render/panel-layout.d.ts +38 -0
  93. package/dist/src/app-opentui/render/panel-layout.js +48 -0
  94. package/dist/src/app-opentui/render/panels.d.ts +2 -0
  95. package/dist/src/app-opentui/render/panels.js +78 -38
  96. package/dist/src/app-opentui/render/preloader.d.ts +10 -0
  97. package/dist/src/app-opentui/render/preloader.js +165 -0
  98. package/dist/src/app-opentui/render/scene.d.ts +53 -1
  99. package/dist/src/app-opentui/render/scene.js +195 -6
  100. package/dist/src/app-opentui/render/text.d.ts +7 -1
  101. package/dist/src/app-opentui/render/text.js +15 -8
  102. package/dist/src/app-opentui/render/type-bar.d.ts +2 -1
  103. package/dist/src/app-opentui/render/type-bar.js +113 -39
  104. package/dist/src/app-opentui/runtime-resources.d.ts +16 -0
  105. package/dist/src/app-opentui/runtime-resources.js +62 -0
  106. package/dist/src/app-opentui/runtime.d.ts +44 -1
  107. package/dist/src/app-opentui/runtime.js +5415 -2738
  108. package/dist/src/app-opentui/scenes/command.d.ts +3 -0
  109. package/dist/src/app-opentui/scenes/command.js +117 -0
  110. package/dist/src/app-opentui/scenes/doctor.d.ts +2 -1
  111. package/dist/src/app-opentui/scenes/doctor.js +221 -17
  112. package/dist/src/app-opentui/scenes/error.js +60 -20
  113. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
  114. package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
  115. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
  116. package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
  117. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
  118. package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
  119. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
  120. package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
  121. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
  122. package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
  123. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
  124. package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
  125. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
  126. package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
  127. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
  128. package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
  129. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
  130. package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
  131. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
  132. package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
  133. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
  134. package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
  135. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
  136. package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
  137. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
  138. package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
  139. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
  140. package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
  141. package/dist/src/app-opentui/scenes/family.d.ts +3 -0
  142. package/dist/src/app-opentui/scenes/family.js +2144 -0
  143. package/dist/src/app-opentui/scenes/fleet.js +552 -43
  144. package/dist/src/app-opentui/scenes/handoff.js +342 -35
  145. package/dist/src/app-opentui/scenes/help.js +640 -56
  146. package/dist/src/app-opentui/scenes/inbox.d.ts +2 -1
  147. package/dist/src/app-opentui/scenes/inbox.js +329 -21
  148. package/dist/src/app-opentui/scenes/init.d.ts +2 -1
  149. package/dist/src/app-opentui/scenes/init.js +120 -34
  150. package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
  151. package/dist/src/app-opentui/scenes/inspect.js +793 -0
  152. package/dist/src/app-opentui/scenes/main.d.ts +2 -1
  153. package/dist/src/app-opentui/scenes/main.js +264 -29
  154. package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
  155. package/dist/src/app-opentui/scenes/pi.js +508 -0
  156. package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
  157. package/dist/src/app-opentui/scenes/plugin.js +486 -0
  158. package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
  159. package/dist/src/app-opentui/scenes/repo.js +424 -0
  160. package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -1
  161. package/dist/src/app-opentui/scenes/run-detail.js +362 -35
  162. package/dist/src/app-opentui/scenes/server.d.ts +2 -1
  163. package/dist/src/app-opentui/scenes/server.js +243 -26
  164. package/dist/src/app-opentui/scenes/tasks.js +518 -41
  165. package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
  166. package/dist/src/app-opentui/scenes/workspace.js +426 -0
  167. package/dist/src/app-opentui/selectable.d.ts +19 -0
  168. package/dist/src/app-opentui/selectable.js +79 -0
  169. package/dist/src/app-opentui/state.js +129 -36
  170. package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
  171. package/dist/src/app-opentui/surface-catalog.js +540 -0
  172. package/dist/src/app-opentui/terminal-capabilities.d.ts +7 -0
  173. package/dist/src/app-opentui/terminal-capabilities.js +15 -0
  174. package/dist/src/app-opentui/theme.d.ts +28 -6
  175. package/dist/src/app-opentui/theme.js +61 -8
  176. package/dist/src/app-opentui/types.d.ts +130 -5
  177. package/dist/src/commands/_authority-runs.d.ts +1 -1
  178. package/dist/src/commands/_authority-runs.js +2 -12
  179. package/dist/src/commands/_doctor-checks.js +62 -13
  180. package/dist/src/commands/_help-catalog.js +95 -15
  181. package/dist/src/commands/_operator-view.js +97 -15
  182. package/dist/src/commands/_pi-frontend.d.ts +2 -0
  183. package/dist/src/commands/_pi-frontend.js +97 -13
  184. package/dist/src/commands/_preflight.js +64 -14
  185. package/dist/src/commands/_server-client.js +82 -18
  186. package/dist/src/commands/_server-events.d.ts +26 -0
  187. package/dist/src/commands/_server-events.js +310 -0
  188. package/dist/src/commands/_snapshot-upload.js +62 -13
  189. package/dist/src/commands/agent.js +2 -12
  190. package/dist/src/commands/connect.js +7 -1
  191. package/dist/src/commands/doctor.js +62 -13
  192. package/dist/src/commands/github.js +144 -23
  193. package/dist/src/commands/inbox.js +62 -13
  194. package/dist/src/commands/init.js +82 -18
  195. package/dist/src/commands/inspect.js +62 -13
  196. package/dist/src/commands/run.js +100 -15
  197. package/dist/src/commands/server.js +71 -26
  198. package/dist/src/commands/setup.js +62 -13
  199. package/dist/src/commands/stats.js +157 -28
  200. package/dist/src/commands/task-run-driver.js +64 -25
  201. package/dist/src/commands/task.js +196 -43
  202. package/dist/src/commands.js +419 -123
  203. package/dist/src/index.js +426 -130
  204. package/package.json +11 -10
  205. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +0 -2
  206. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +0 -1484
@@ -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." }] }
@@ -564,17 +644,21 @@ function cleanToken(value) {
564
644
  const trimmed = value?.trim();
565
645
  return trimmed ? trimmed : null;
566
646
  }
567
- function readPrivateRemoteSessionToken(projectRoot) {
647
+ function readRemoteAuthState(projectRoot) {
568
648
  const path = resolve2(projectRoot, ".rig", "state", "github-auth.json");
569
649
  if (!existsSync2(path))
570
650
  return null;
571
651
  try {
572
652
  const parsed = JSON.parse(readFileSync2(path, "utf8"));
573
- return cleanToken(typeof parsed.apiSessionToken === "string" ? parsed.apiSessionToken : typeof parsed.sessionToken === "string" ? parsed.sessionToken : undefined);
653
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
574
654
  } catch {
575
655
  return null;
576
656
  }
577
657
  }
658
+ function readPrivateRemoteSessionToken(projectRoot) {
659
+ const parsed = readRemoteAuthState(projectRoot);
660
+ return parsed ? cleanToken(typeof parsed.apiSessionToken === "string" ? parsed.apiSessionToken : typeof parsed.sessionToken === "string" ? parsed.sessionToken : undefined) : null;
661
+ }
578
662
  function readGitHubBearerTokenForRemote(projectRoot) {
579
663
  const scopedKey = resolve2(projectRoot);
580
664
  if (scopedGitHubBearerTokens.has(scopedKey))
@@ -585,15 +669,25 @@ function readGitHubBearerTokenForRemote(projectRoot) {
585
669
  return cleanToken(process.env.RIG_SERVER_AUTH_TOKEN) ?? cleanToken(process.env.RIG_REMOTE_AUTH_TOKEN);
586
670
  }
587
671
  function readStoredGitHubAuthToken(projectRoot) {
588
- const path = resolve2(projectRoot, ".rig", "state", "github-auth.json");
589
- if (!existsSync2(path))
672
+ const parsed = readRemoteAuthState(projectRoot);
673
+ return parsed ? cleanToken(typeof parsed.token === "string" ? parsed.token : undefined) : null;
674
+ }
675
+ function inferRemoteServerProjectRootFromAuthState(projectRoot) {
676
+ const repo = readRepoConnection(projectRoot);
677
+ const slug = repo?.project?.trim();
678
+ if (!slug || !/^[^/]+\/[^/]+$/.test(slug))
590
679
  return null;
591
- try {
592
- const parsed = JSON.parse(readFileSync2(path, "utf8"));
593
- return cleanToken(typeof parsed.token === "string" ? parsed.token : undefined);
594
- } catch {
680
+ const auth = readRemoteAuthState(projectRoot);
681
+ const authUpdatedAt = typeof auth?.updatedAt === "string" ? Date.parse(auth.updatedAt) : Number.NaN;
682
+ const repoLinkedAt = typeof repo?.linkedAt === "string" ? Date.parse(repo.linkedAt) : Number.NaN;
683
+ if (Number.isFinite(authUpdatedAt) && Number.isFinite(repoLinkedAt) && authUpdatedAt + 1000 < repoLinkedAt)
595
684
  return null;
596
- }
685
+ const checkoutBaseDir = typeof auth?.checkoutBaseDir === "string" && auth.checkoutBaseDir.trim() ? auth.checkoutBaseDir.trim() : null;
686
+ if (!checkoutBaseDir)
687
+ return null;
688
+ const inferred = `${checkoutBaseDir.replace(/\/+$/, "")}/${slug}`;
689
+ writeRepoServerProjectRoot(projectRoot, inferred);
690
+ return inferred;
597
691
  }
598
692
  function readLocalConnectionFallbackToken(projectRoot) {
599
693
  return readGitHubBearerTokenForRemote(projectRoot) ?? cleanToken(process.env.RIG_GITHUB_TOKEN) ?? readStoredGitHubAuthToken(projectRoot);
@@ -604,7 +698,7 @@ async function ensureServerForCli(projectRoot) {
604
698
  if (selected?.connection.kind === "remote") {
605
699
  reportServerPhase(`Connecting to ${selected.alias}\u2026`);
606
700
  const authToken = readGitHubBearerTokenForRemote(projectRoot);
607
- const serverProjectRoot = selected.serverProjectRoot ?? await backfillRemoteServerProjectRoot(projectRoot, selected.connection.baseUrl, authToken);
701
+ const serverProjectRoot = selected.serverProjectRoot ?? inferRemoteServerProjectRootFromAuthState(projectRoot) ?? await backfillRemoteServerProjectRoot(projectRoot, selected.connection.baseUrl, authToken);
608
702
  return {
609
703
  baseUrl: selected.connection.baseUrl,
610
704
  authToken,
@@ -633,7 +727,10 @@ async function backfillRemoteServerProjectRoot(projectRoot, baseUrl, authToken)
633
727
  if (!slug)
634
728
  return null;
635
729
  try {
636
- const response = await fetch(`${baseUrl}/api/projects/${encodeURIComponent(slug)}`, {
730
+ const url = new URL(`${baseUrl}/api/projects/${encodeURIComponent(slug)}`);
731
+ if (authToken && queryAuthFallbackEnabled())
732
+ url.searchParams.set("rt", authToken);
733
+ const response = await fetch(url, {
637
734
  headers: mergeHeaders(undefined, authToken)
638
735
  });
639
736
  if (!response.ok)
@@ -660,10 +757,23 @@ function appendTaskFilterParams(url, filters) {
660
757
  if (filters.limit !== undefined)
661
758
  url.searchParams.set("limit", String(filters.limit));
662
759
  }
760
+ function mergeCookie(existing, name, value) {
761
+ const encoded = `${name}=${encodeURIComponent(value)}`;
762
+ if (!existing?.trim())
763
+ return encoded;
764
+ const parts = existing.split(";").map((part) => part.trim()).filter((part) => part && !part.startsWith(`${name}=`));
765
+ return [...parts, encoded].join("; ");
766
+ }
767
+ function queryAuthFallbackEnabled(env = process.env) {
768
+ return env.RIG_ENABLE_QUERY_AUTH_FALLBACK === "1" || env.RIG_QUERY_AUTH_FALLBACK === "1";
769
+ }
663
770
  function mergeHeaders(headers, authToken) {
664
771
  const merged = new Headers(headers);
665
772
  if (authToken) {
666
- merged.set("authorization", `Bearer ${authToken}`);
773
+ const bearer = `Bearer ${authToken}`;
774
+ merged.set("authorization", bearer);
775
+ merged.set("x-auth", bearer);
776
+ merged.set("cookie", mergeCookie(merged.get("cookie"), "rig_auth", authToken));
667
777
  }
668
778
  return merged;
669
779
  }
@@ -724,15 +834,34 @@ async function buildServerFailureContext(projectRoot, server) {
724
834
  hint: "Check the selected server with `rig server status`, or switch with `rig server use <alias|local>`."
725
835
  };
726
836
  }
837
+ function isLoopbackRemoteBaseUrl(baseUrl) {
838
+ try {
839
+ const host = new URL(baseUrl).hostname.toLowerCase();
840
+ return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]";
841
+ } catch {
842
+ return false;
843
+ }
844
+ }
845
+ function canUseRemoteWithoutProjectRoot(pathname) {
846
+ return pathname === "/health" || pathname === "/api/health" || pathname === "/api/server/status" || pathname === "/api/server/project-root" || pathname.startsWith("/api/github/auth/") || pathname === "/api/projects" || pathname.startsWith("/api/projects/");
847
+ }
727
848
  async function requestServerJson(context, pathname, init = {}) {
728
849
  const server = await ensureServerForCli(context.projectRoot);
850
+ const requestUrl = new URL(`${server.baseUrl}${pathname}`);
851
+ if (server.connectionKind === "remote" && !server.serverProjectRoot && !canUseRemoteWithoutProjectRoot(requestUrl.pathname) && (server.authToken || !isLoopbackRemoteBaseUrl(server.baseUrl))) {
852
+ const repo = readRepoConnection(context.projectRoot);
853
+ throw new CliError(`Remote server is selected for ${repo?.project ?? "this repo"}, but this checkout has no server-host project root link.`, 1, { hint: "Run `rig init --repair` or `rig init --yes --repo owner/repo --server remote` to repair the remote project link before task/run commands." });
854
+ }
729
855
  const headers = mergeHeaders(init.headers, server.authToken);
730
856
  if (server.serverProjectRoot)
731
857
  headers.set("x-rig-project-root", server.serverProjectRoot);
858
+ if (server.connectionKind === "remote" && server.authToken && queryAuthFallbackEnabled()) {
859
+ requestUrl.searchParams.set("rt", server.authToken);
860
+ }
732
861
  reportServerPhase(`${(init.method ?? "GET").toUpperCase()} ${pathname.split("?")[0]}\u2026`);
733
862
  let response;
734
863
  try {
735
- response = await fetch(`${server.baseUrl}${pathname}`, {
864
+ response = await fetch(requestUrl, {
736
865
  ...init,
737
866
  headers
738
867
  });
@@ -852,18 +981,46 @@ import {
852
981
  import { resolveMonorepoRoot } from "@rig/runtime/control-plane/native/utils";
853
982
 
854
983
  // packages/cli/src/commands/_authority-runs.ts
855
- function normalizeRuntimeAdapter(value) {
856
- const normalized = value?.trim().toLowerCase();
857
- if (!normalized) {
858
- return "pi";
859
- }
860
- if (normalized === "codex" || normalized === "codex-cli" || normalized === "codex-app-server" || normalized === "gpt-codex") {
861
- return "codex";
862
- }
863
- if (normalized === "pi" || normalized === "rig-pi" || normalized === "@rig/pi") {
864
- return "pi";
865
- }
866
- 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
+ };
867
1024
  }
868
1025
 
869
1026
  // packages/cli/src/app/drone-ui.ts
@@ -924,9 +1081,10 @@ import { ensureProjectMainFreshBeforeRun } from "@rig/runtime/control-plane/proj
924
1081
  // packages/cli/src/commands/_pi-frontend.ts
925
1082
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
926
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"]);
927
1085
 
928
1086
  // packages/cli/src/commands/_operator-view.ts
929
- 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"]);
930
1088
 
931
1089
  // packages/cli/src/commands/task.ts
932
1090
  import { buildPluginHostContext } from "@rig/runtime/control-plane/plugin-host-context";
@@ -1782,7 +1940,24 @@ async function runOperatorBoard(context, options = {}) {
1782
1940
  tui.requestRender();
1783
1941
  }
1784
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
+ });
1785
1958
  const refreshTimer = setInterval(() => {
1959
+ if (live.subscription?.connected())
1960
+ return;
1786
1961
  refresh();
1787
1962
  }, BOARD_REFRESH_MS);
1788
1963
  tui.start();
@@ -1797,6 +1972,7 @@ async function runOperatorBoard(context, options = {}) {
1797
1972
  });
1798
1973
  clearInterval(animation);
1799
1974
  clearInterval(refreshTimer);
1975
+ live.subscription?.close();
1800
1976
  return outcome;
1801
1977
  }
1802
1978
  async function runOperatorBoardLoop(context, attach, options = {}) {
@@ -0,0 +1,2 @@
1
+ import type { AppAdapterContext } from "./common";
2
+ export declare function runCommandInAppPty(ctx: AppAdapterContext, argv: readonly string[]): Promise<void>;