@h-rig/cli 0.0.6-alpha.87 → 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.
- package/dist/bin/rig.js +210 -562
- package/dist/src/app-opentui/adapters/common.d.ts +3 -0
- package/dist/src/app-opentui/adapters/common.js +4 -0
- package/dist/src/app-opentui/adapters/family.js +31 -4
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +7 -0
- package/dist/src/app-opentui/adapters/pi-attach.js +527 -473
- package/dist/src/app-opentui/adapters/tasks.js +82 -468
- package/dist/src/app-opentui/bootstrap.js +210 -562
- package/dist/src/app-opentui/index.js +68 -441
- package/dist/src/app-opentui/keymap.js +2 -387
- package/dist/src/app-opentui/pi-host-child.js +31 -4
- package/dist/src/app-opentui/pi-pty-host.d.ts +14 -64
- package/dist/src/app-opentui/pi-pty-host.js +3 -397
- package/dist/src/app-opentui/react/App.js +42 -427
- package/dist/src/app-opentui/react/ChromeHost.js +28 -411
- package/dist/src/app-opentui/react/launch.js +106 -466
- package/dist/src/app-opentui/registry.js +96 -482
- package/dist/src/app-opentui/render/terminal-handoff.d.ts +16 -0
- package/dist/src/app-opentui/render/terminal-handoff.js +14 -0
- package/dist/src/app-opentui/runtime.js +68 -441
- package/dist/src/commands/_operator-view.js +31 -4
- package/dist/src/commands/_pi-frontend.d.ts +25 -0
- package/dist/src/commands/_pi-frontend.js +32 -4
- package/dist/src/commands/run.js +31 -4
- package/dist/src/commands/task.js +31 -4
- package/dist/src/commands.js +31 -4
- package/dist/src/index.js +31 -4
- 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
|
-
|
|
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
|
-
|
|
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>>;
|