@rynx-ai/runtime 0.1.11-beta.15 → 0.1.11-beta.16
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/runner/child.js +19 -2
- package/dist/terminal/tmux.d.ts +2 -0
- package/dist/terminal/tmux.js +7 -3
- package/package.json +2 -2
package/dist/runner/child.js
CHANGED
|
@@ -2,10 +2,17 @@ import { TerminalRegistry } from "../terminal/registry.js";
|
|
|
2
2
|
import { toWireError } from "./protocol.js";
|
|
3
3
|
const TRAEX_STARTUP_WATCH_MS = 20_000;
|
|
4
4
|
const TRAEX_STARTUP_POLL_MS = 100;
|
|
5
|
+
const TRAEX_AUTHORIZATION_POLL_MS = 500;
|
|
6
|
+
const TRAEX_AUTHORIZATION_WAIT_MS = 15 * 60_000;
|
|
5
7
|
const TRAEX_PROMPT_RETRY_MS = 500;
|
|
6
8
|
function normalizeTraexPane(pane) {
|
|
7
9
|
return pane.toLowerCase().replace(/\s+/g, " ").trim();
|
|
8
10
|
}
|
|
11
|
+
function isTraexAuthorizationPending(pane) {
|
|
12
|
+
return pane.includes("waiting for authorization") &&
|
|
13
|
+
pane.includes("open this link in your browser") &&
|
|
14
|
+
pane.includes("press esc to cancel");
|
|
15
|
+
}
|
|
9
16
|
function isTerminalProtocolResponse(input) {
|
|
10
17
|
// xterm answers terminal queries through the same onData channel as real
|
|
11
18
|
// keystrokes. CSI carries device/focus/position reports; OSC carries color
|
|
@@ -320,7 +327,9 @@ export class RunnerSession {
|
|
|
320
327
|
];
|
|
321
328
|
let activePromptId;
|
|
322
329
|
let lastDismissedAt = 0;
|
|
323
|
-
const
|
|
330
|
+
const startedAt = Date.now();
|
|
331
|
+
let deadline = startedAt + TRAEX_STARTUP_WATCH_MS;
|
|
332
|
+
const authorizationDeadline = startedAt + TRAEX_AUTHORIZATION_WAIT_MS;
|
|
324
333
|
const terminalId = `${localThreadId}-main`;
|
|
325
334
|
while (!this.shuttingDown &&
|
|
326
335
|
Date.now() < deadline &&
|
|
@@ -331,6 +340,14 @@ export class RunnerSession {
|
|
|
331
340
|
const pane = normalizeTraexPane(terminal.capturePane());
|
|
332
341
|
const prompt = prompts.find((candidate) => candidate.matches(pane));
|
|
333
342
|
const now = Date.now();
|
|
343
|
+
const authorizationPending = isTraexAuthorizationPending(pane);
|
|
344
|
+
// Human device authorization routinely takes longer than the normal
|
|
345
|
+
// startup-modal window. Keep watching while that known screen remains,
|
|
346
|
+
// then preserve a full window for welcome/migration/hooks after sign-in.
|
|
347
|
+
// The separate cap prevents an abandoned auth screen from polling forever.
|
|
348
|
+
if (authorizationPending && now < authorizationDeadline) {
|
|
349
|
+
deadline = now + TRAEX_STARTUP_WATCH_MS;
|
|
350
|
+
}
|
|
334
351
|
if (!prompt) {
|
|
335
352
|
activePromptId = undefined;
|
|
336
353
|
}
|
|
@@ -341,7 +358,7 @@ export class RunnerSession {
|
|
|
341
358
|
lastDismissedAt = now;
|
|
342
359
|
}
|
|
343
360
|
await new Promise((resolve) => {
|
|
344
|
-
const timer = setTimeout(resolve, TRAEX_STARTUP_POLL_MS);
|
|
361
|
+
const timer = setTimeout(resolve, authorizationPending ? TRAEX_AUTHORIZATION_POLL_MS : TRAEX_STARTUP_POLL_MS);
|
|
345
362
|
timer.unref();
|
|
346
363
|
});
|
|
347
364
|
}
|
package/dist/terminal/tmux.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export interface TmuxTerminalOptions {
|
|
|
43
43
|
/** Injectable for tests; defaults to the real `tmux` binary path. */
|
|
44
44
|
tmuxBin?: string;
|
|
45
45
|
}
|
|
46
|
+
/** Resolve the exact tmux executable selected by the current Rynx distribution. */
|
|
47
|
+
export declare function resolveTmuxBin(explicit?: string, env?: NodeJS.ProcessEnv): string;
|
|
46
48
|
/** Deterministic private socket owned by one terminal name. Parent-side
|
|
47
49
|
* shutdown uses the same mapping when the runner child is too wedged to clean
|
|
48
50
|
* up its own tmux server. */
|
package/dist/terminal/tmux.js
CHANGED
|
@@ -26,6 +26,10 @@ const DEFAULT_ROWS = 24;
|
|
|
26
26
|
* wheel-scroll (tmux copy-mode, enabled by `mouse on`) reaches as far back as
|
|
27
27
|
* the terminal shows. Mirrors reference implementation's `TerminalEnvSpec.scrollback`. */
|
|
28
28
|
const DEFAULT_SCROLLBACK = 20000;
|
|
29
|
+
/** Resolve the exact tmux executable selected by the current Rynx distribution. */
|
|
30
|
+
export function resolveTmuxBin(explicit, env = process.env) {
|
|
31
|
+
return explicit ?? (env.RYNX_TMUX_BIN?.trim() || "tmux");
|
|
32
|
+
}
|
|
29
33
|
/** Deterministic private socket owned by one terminal name. Parent-side
|
|
30
34
|
* shutdown uses the same mapping when the runner child is too wedged to clean
|
|
31
35
|
* up its own tmux server. */
|
|
@@ -36,7 +40,7 @@ export function tmuxSocketPath(name) {
|
|
|
36
40
|
/** Kill one private tmux server and verify it no longer answers. Missing
|
|
37
41
|
* sockets are already stopped; an existing socket with an unusable tmux
|
|
38
42
|
* command is unproven and returns false. */
|
|
39
|
-
export function terminateTmuxServer(name, tmuxBin =
|
|
43
|
+
export function terminateTmuxServer(name, tmuxBin = resolveTmuxBin()) {
|
|
40
44
|
const socketPath = tmuxSocketPath(name);
|
|
41
45
|
if (!existsSync(socketPath))
|
|
42
46
|
return true;
|
|
@@ -79,7 +83,7 @@ export function terminateTmuxServer(name, tmuxBin = "tmux") {
|
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
/** Is a usable `tmux` on PATH? Cheap probe for the capability gate. */
|
|
82
|
-
export function isTmuxAvailable(tmuxBin =
|
|
86
|
+
export function isTmuxAvailable(tmuxBin = resolveTmuxBin()) {
|
|
83
87
|
try {
|
|
84
88
|
execFileSync(tmuxBin, ["-V"], { stdio: "ignore" });
|
|
85
89
|
return true;
|
|
@@ -120,7 +124,7 @@ export class TmuxTerminal {
|
|
|
120
124
|
this.env = withUtf8Locale(opts.env ?? process.env);
|
|
121
125
|
this.cols = opts.cols ?? DEFAULT_COLS;
|
|
122
126
|
this.rows = opts.rows ?? DEFAULT_ROWS;
|
|
123
|
-
this.tmuxBin = opts.tmuxBin
|
|
127
|
+
this.tmuxBin = resolveTmuxBin(opts.tmuxBin);
|
|
124
128
|
this.injectedSpawn = opts.ptySpawn;
|
|
125
129
|
const dir = join(tmpdir(), "rynx-term");
|
|
126
130
|
mkdirSync(dir, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rynx-ai/runtime",
|
|
3
|
-
"version": "0.1.11-beta.
|
|
3
|
+
"version": "0.1.11-beta.16",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/rynx-ai/rynx.git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"node-pty": "1.2.0-beta.15",
|
|
28
28
|
"ws": "^8.21.0",
|
|
29
|
-
"@rynx-ai/core": "0.1.11-beta.
|
|
29
|
+
"@rynx-ai/core": "0.1.11-beta.16"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/ws": "^8.18.1"
|