@h-rig/cli 0.0.6-alpha.86 → 0.0.6-alpha.88

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 (80) hide show
  1. package/dist/bin/rig.js +287 -578
  2. package/dist/src/app-opentui/adapters/common.d.ts +3 -0
  3. package/dist/src/app-opentui/adapters/common.js +4 -0
  4. package/dist/src/app-opentui/adapters/family.js +31 -4
  5. package/dist/src/app-opentui/adapters/pi-attach.d.ts +7 -0
  6. package/dist/src/app-opentui/adapters/pi-attach.js +527 -473
  7. package/dist/src/app-opentui/adapters/tasks.js +82 -468
  8. package/dist/src/app-opentui/bootstrap.js +287 -578
  9. package/dist/src/app-opentui/command-palette.js +1 -0
  10. package/dist/src/app-opentui/drone.js +1 -0
  11. package/dist/src/app-opentui/index.js +127 -446
  12. package/dist/src/app-opentui/keymap.js +2 -387
  13. package/dist/src/app-opentui/list-search.d.ts +5 -1
  14. package/dist/src/app-opentui/list-search.js +2 -2
  15. package/dist/src/app-opentui/pi-host-child.js +31 -4
  16. package/dist/src/app-opentui/pi-pty-host.d.ts +14 -64
  17. package/dist/src/app-opentui/pi-pty-host.js +3 -397
  18. package/dist/src/app-opentui/react/App.js +107 -433
  19. package/dist/src/app-opentui/react/Backdrop.js +1 -0
  20. package/dist/src/app-opentui/react/ChromeHost.js +34 -410
  21. package/dist/src/app-opentui/react/SceneFrameView.js +55 -5
  22. package/dist/src/app-opentui/react/launch.js +171 -472
  23. package/dist/src/app-opentui/react/syntax.js +1 -0
  24. package/dist/src/app-opentui/registry.js +99 -487
  25. package/dist/src/app-opentui/render/graphics.js +1 -0
  26. package/dist/src/app-opentui/render/hover.d.ts +11 -0
  27. package/dist/src/app-opentui/render/hover.js +34 -0
  28. package/dist/src/app-opentui/render/native-host.js +1 -0
  29. package/dist/src/app-opentui/render/panels.js +50 -3
  30. package/dist/src/app-opentui/render/preloader.js +1 -0
  31. package/dist/src/app-opentui/render/scene.js +1 -0
  32. package/dist/src/app-opentui/render/terminal-handoff.d.ts +16 -0
  33. package/dist/src/app-opentui/render/terminal-handoff.js +14 -0
  34. package/dist/src/app-opentui/render/text.d.ts +13 -0
  35. package/dist/src/app-opentui/render/text.js +54 -5
  36. package/dist/src/app-opentui/render/type-bar.js +1 -0
  37. package/dist/src/app-opentui/runtime.js +127 -446
  38. package/dist/src/app-opentui/scenes/command.js +1 -0
  39. package/dist/src/app-opentui/scenes/doctor.js +1 -0
  40. package/dist/src/app-opentui/scenes/error.js +1 -0
  41. package/dist/src/app-opentui/scenes/family-domains/agent.js +1 -0
  42. package/dist/src/app-opentui/scenes/family-domains/browser.js +1 -0
  43. package/dist/src/app-opentui/scenes/family-domains/dist.js +1 -0
  44. package/dist/src/app-opentui/scenes/family-domains/git.js +1 -0
  45. package/dist/src/app-opentui/scenes/family-domains/github.js +1 -0
  46. package/dist/src/app-opentui/scenes/family-domains/harness.js +1 -0
  47. package/dist/src/app-opentui/scenes/family-domains/index.js +1 -0
  48. package/dist/src/app-opentui/scenes/family-domains/kit.js +1 -0
  49. package/dist/src/app-opentui/scenes/family-domains/profile.js +1 -0
  50. package/dist/src/app-opentui/scenes/family-domains/queue.js +1 -0
  51. package/dist/src/app-opentui/scenes/family-domains/remote.js +1 -0
  52. package/dist/src/app-opentui/scenes/family-domains/review.js +1 -0
  53. package/dist/src/app-opentui/scenes/family-domains/setup.js +1 -0
  54. package/dist/src/app-opentui/scenes/family-domains/stats.js +1 -0
  55. package/dist/src/app-opentui/scenes/family.js +1 -0
  56. package/dist/src/app-opentui/scenes/fleet.js +3 -5
  57. package/dist/src/app-opentui/scenes/handoff.js +1 -0
  58. package/dist/src/app-opentui/scenes/help.js +1 -0
  59. package/dist/src/app-opentui/scenes/inbox.js +1 -0
  60. package/dist/src/app-opentui/scenes/init.js +1 -0
  61. package/dist/src/app-opentui/scenes/inspect.js +1 -0
  62. package/dist/src/app-opentui/scenes/main.js +1 -0
  63. package/dist/src/app-opentui/scenes/pi.js +1 -0
  64. package/dist/src/app-opentui/scenes/plugin.js +1 -0
  65. package/dist/src/app-opentui/scenes/repo.js +1 -0
  66. package/dist/src/app-opentui/scenes/run-detail.js +1 -0
  67. package/dist/src/app-opentui/scenes/server.js +1 -0
  68. package/dist/src/app-opentui/scenes/tasks.js +3 -5
  69. package/dist/src/app-opentui/scenes/workspace.js +1 -0
  70. package/dist/src/app-opentui/selectable.js +1 -0
  71. package/dist/src/app-opentui/theme.d.ts +1 -0
  72. package/dist/src/app-opentui/theme.js +1 -0
  73. package/dist/src/commands/_operator-view.js +31 -4
  74. package/dist/src/commands/_pi-frontend.d.ts +25 -0
  75. package/dist/src/commands/_pi-frontend.js +32 -4
  76. package/dist/src/commands/run.js +31 -4
  77. package/dist/src/commands/task.js +31 -4
  78. package/dist/src/commands.js +31 -4
  79. package/dist/src/index.js +31 -4
  80. package/package.json +8 -8
@@ -47,6 +47,9 @@ export declare function captureConsole<T>(fn: () => Promise<T> | T): Promise<{
47
47
  output: readonly string[];
48
48
  }>;
49
49
  export declare function releaseRendererForExternalTui(ctx: AppAdapterContext): Promise<void>;
50
+ /** Re-take the terminal after an external TUI (native Pi) exits — resumes the
51
+ * suspended OpenTUI renderer so the shell repaints and input flows again. */
52
+ export declare function resumeRendererAfterExternalTui(ctx: AppAdapterContext): Promise<void>;
50
53
  export declare function arrayFromPayload(value: unknown): Record<string, unknown>[];
51
54
  export declare function stringField(record: Record<string, unknown>, keys: readonly string[], fallback?: string): string;
52
55
  export declare function compactRecord(record: Record<string, unknown>, keys: readonly string[]): Record<string, unknown>;
@@ -95,6 +95,9 @@ async function releaseRendererForExternalTui(ctx) {
95
95
  await renderer.destroy();
96
96
  }
97
97
  }
98
+ async function resumeRendererAfterExternalTui(ctx) {
99
+ await ctx.renderer?.resume?.();
100
+ }
98
101
  function arrayFromPayload(value) {
99
102
  if (Array.isArray(value)) {
100
103
  return value.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry)));
@@ -132,6 +135,7 @@ function payloadString(intent, key) {
132
135
  export {
133
136
  stringField,
134
137
  runtimeOf,
138
+ resumeRendererAfterExternalTui,
135
139
  releaseRendererForExternalTui,
136
140
  projectRootOf,
137
141
  payloadString,
@@ -8745,6 +8745,29 @@ function installRigPiTheme() {
8745
8745
  }
8746
8746
  } catch {}
8747
8747
  }
8748
+ async function runWithProcessExitGuard(body) {
8749
+ const realExit = process.exit;
8750
+ let exitCode = 0;
8751
+ let signalQuit = () => {};
8752
+ const quit = new Promise((resolve22) => {
8753
+ signalQuit = resolve22;
8754
+ });
8755
+ const guardedExit = (code) => {
8756
+ exitCode = typeof code === "number" ? code : 0;
8757
+ signalQuit();
8758
+ return;
8759
+ };
8760
+ process.exit = guardedExit;
8761
+ try {
8762
+ await Promise.race([Promise.resolve().then(body), quit]);
8763
+ } finally {
8764
+ process.exit = realExit;
8765
+ }
8766
+ return exitCode;
8767
+ }
8768
+ function runPiMainReturningOnQuit(args, options) {
8769
+ return runWithProcessExitGuard(() => runPiMain(args, options));
8770
+ }
8748
8771
  async function attachRunBundledPiFrontend(context, input) {
8749
8772
  const tempSessionDir = mkdtempSync(join3(tmpdir(), "rig-pi-frontend-sessions-"));
8750
8773
  const { server, sessionFileArg } = await withSpinner(`Opening Pi console for run ${input.runId}\u2026`, () => prepareOperatorConsole(context, input.runId, tempSessionDir), { outputMode: context.outputMode });
@@ -8760,16 +8783,20 @@ async function attachRunBundledPiFrontend(context, input) {
8760
8783
  };
8761
8784
  let detached = false;
8762
8785
  try {
8763
- await runPiMain([
8786
+ const piArgs = [
8764
8787
  "--offline",
8765
8788
  "--no-extensions",
8766
8789
  "--no-skills",
8767
8790
  "--no-prompt-templates",
8768
8791
  "--no-context-files",
8769
8792
  ...sessionFileArg
8770
- ], {
8771
- extensionFactories: [piRigExtensionFactory]
8772
- });
8793
+ ];
8794
+ const piOptions = { extensionFactories: [piRigExtensionFactory] };
8795
+ if (input.returnOnQuit) {
8796
+ await runPiMainReturningOnQuit(piArgs, piOptions);
8797
+ } else {
8798
+ await runPiMain(piArgs, piOptions);
8799
+ }
8773
8800
  detached = true;
8774
8801
  } finally {
8775
8802
  restoreEnv();
@@ -22,4 +22,11 @@ export type PiAttachHandoffState = {
22
22
  readonly failureReason?: string;
23
23
  };
24
24
  export declare function preparePiAttachHandoff(ctx: AppAdapterContext, runId: string): Promise<PiAttachHandoffState>;
25
+ /** Attach the operator to a worker's Pi session by EJECTING from the OpenTUI
26
+ * shell: suspend the renderer (release the real TTY), run STOCK upstream Pi +
27
+ * the pi-rig extension natively on the terminal — no `@xterm/headless`, no
28
+ * Bun-PTY mirror — then resume the shell and drop back on the runs board when
29
+ * Pi quits or the operator detaches. This is the same native path `rig run
30
+ * attach` uses on the CLI (`commands/_pi-frontend.ts:attachRunBundledPiFrontend`);
31
+ * the OpenTUI shell now just hands it the terminal and takes it back. */
25
32
  export declare function attachRunWithBundledPi(ctx: AppAdapterContext, runId: string): Promise<Record<string, unknown>>;