@conveno/cli 0.2.0-rc.12 → 0.2.0-rc.13
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/{acp-CIzgcCp9.js → acp-Bs6XS61j.js} +3 -3
- package/dist/{agy-relay-Y9o-Pw9U.js → agy-relay-BJLRYbFp.js} +2 -2
- package/dist/{args-C1eX8Ixk.js → args-C4rVCVXx.js} +3 -1
- package/dist/bin.js +16 -2
- package/dist/daemon.js +130 -6
- package/dist/{daemonError-0KnkgIRo.js → daemonError-CjxG2yUl.js} +1 -1
- package/dist/{dist-DF0nL8wE.js → dist-B14ldKRS.js} +3 -2
- package/dist/{dist-4iJnF07i.js → dist-BkhKEexU.js} +90 -21
- package/dist/{dist-BjATai4T.js → dist-C9Z1EMlM.js} +26 -5
- package/dist/{dist-B3YYLzKS.js → dist-Ca3P7aN-.js} +9 -1
- package/dist/{dist-DeN0jR3I.js → dist-CoRBNycn.js} +1 -1
- package/dist/{dist-Du1hwaux.js → dist-D4sb5RQD.js} +37 -1
- package/dist/{dist-CRj_cuHc.js → dist-DnNuDzEA.js} +112 -14
- package/dist/{hook-ByduyOom.js → hook-C60hXJdg.js} +46 -12
- package/dist/{hook-entry-DWa1oppt.js → hook-entry-WlJSM5aD.js} +9 -9
- package/dist/hook-entry-jOfjq-0A.js +1 -0
- package/dist/{main-WIfawg60.js → main-I2RMN7XN.js} +54 -15
- package/dist/{pick-BmZuv9yQ.js → pick-Colav8Wm.js} +1 -1
- package/dist/{run-Df6vFm9n.js → run-BuDbmxx_.js} +164 -28
- package/dist/{runtime-BKPod_ZQ.js → runtime-CPmrhPFJ.js} +37 -14
- package/dist/{uninstall-MaS5t1CK.js → uninstall-812XZDTG.js} +132 -8
- package/dist/{watch-CPkilo9L.js → watch-DXbOOc20.js} +4 -4
- package/package.json +13 -13
- package/dist/hook-entry-ajdMBSpY.js +0 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
import { a as parseFlags, i as commandHelp, n as COMMANDS, r as COMMAND_NAMES, t as ALL_COMMAND_NAMES } from "./args-
|
|
4
|
-
import { t as daemonProblem } from "./daemonError-
|
|
1
|
+
import { Qt as runLaunchFile, Wt as realSpawnDeps, _n as CLI_KINDS, f as SPAWN_CLIS, m as SpawnError, n as ACP_TOOL_KINDS, p as SPAWN_TABLE, rn as spawnSession, z as dataPaths } from "./dist-DnNuDzEA.js";
|
|
2
|
+
import { A as runAccount, C as runDevices, E as runDaemon, M as runLogout, O as VERSION, i as runDoctor, j as runLogin, m as runSetup, p as runInit, t as runUninstall, w as runRelay } from "./uninstall-812XZDTG.js";
|
|
3
|
+
import { a as parseFlags, i as commandHelp, n as COMMANDS, r as COMMAND_NAMES, t as ALL_COMMAND_NAMES } from "./args-C4rVCVXx.js";
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-CjxG2yUl.js";
|
|
5
5
|
import { chmod, mkdir, writeFile } from "node:fs/promises";
|
|
6
6
|
import { join, resolve } from "node:path";
|
|
7
7
|
import { a as fail, c as plural, d as warnBlock, n as cmd, r as columns, s as plainError, t as closest, u as tilde } from "./fmt-C2SsP5Y0.js";
|
|
8
|
-
import { t as runHook } from "./hook-
|
|
8
|
+
import { t as runHook } from "./hook-C60hXJdg.js";
|
|
9
9
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
10
|
-
import { t as findSession } from "./pick-
|
|
10
|
+
import { t as findSession } from "./pick-Colav8Wm.js";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
|
-
// src/version.ts
|
|
13
|
-
const VERSION = "0.2.0-rc.12";
|
|
14
12
|
// src/errorLog.ts
|
|
15
13
|
/** The message of an unexpected error, as it is. Not the softened text `plainError` gives. */
|
|
16
14
|
function rawMessage(e) {
|
|
@@ -240,6 +238,47 @@ function readTaskFile(ctx, path) {
|
|
|
240
238
|
});
|
|
241
239
|
}
|
|
242
240
|
}
|
|
241
|
+
/** Is this word the start of an allow pattern: a tool kind or `*`, then maybe `:<title glob>`? */
|
|
242
|
+
const isAllowItem = (word) => {
|
|
243
|
+
const kind = word.split(":")[0]?.trim() ?? "";
|
|
244
|
+
return kind === "*" || ACP_TOOL_KINDS.includes(kind);
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Fold every way of writing `--allow` into one `--allow=<a,b,c>`: comma separated, space separated
|
|
248
|
+
* (`--allow read search`, which is what PowerShell's shim turns `--allow read,search` into), and
|
|
249
|
+
* repeated. Words after `--allow` are taken as more patterns only while they look like one, so a
|
|
250
|
+
* CLI name or another flag ends the list. Nothing is changed when `--allow` is not used.
|
|
251
|
+
*/
|
|
252
|
+
function normalizeAllowArgs(argv) {
|
|
253
|
+
const rest = [];
|
|
254
|
+
const allow = [];
|
|
255
|
+
let used = false;
|
|
256
|
+
for (let i = 0; i < argv.length; i++) {
|
|
257
|
+
const a = argv[i];
|
|
258
|
+
if (a === "--") {
|
|
259
|
+
rest.push(...argv.slice(i));
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
if (a.startsWith("--allow=")) {
|
|
263
|
+
used = true;
|
|
264
|
+
allow.push(a.slice(8));
|
|
265
|
+
} else if (a === "--allow") {
|
|
266
|
+
used = true;
|
|
267
|
+
const value = argv[i + 1];
|
|
268
|
+
if (value === void 0) {
|
|
269
|
+
rest.push(a);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
allow.push(value);
|
|
273
|
+
i++;
|
|
274
|
+
while (i + 1 < argv.length && isAllowItem(argv[i + 1]) && !argv[i + 1]?.startsWith("-")) {
|
|
275
|
+
allow.push(argv[i + 1]);
|
|
276
|
+
i++;
|
|
277
|
+
}
|
|
278
|
+
} else rest.push(a);
|
|
279
|
+
}
|
|
280
|
+
return used ? [...rest, `--allow=${allow.join(",")}`] : argv;
|
|
281
|
+
}
|
|
243
282
|
/**
|
|
244
283
|
* `conveno spawn <cli> ...`: start a worker session of any CLI with a first task, and print the
|
|
245
284
|
* name it registers under.
|
|
@@ -248,7 +287,7 @@ async function runSpawn(ctx, argv) {
|
|
|
248
287
|
const t = ctx.theme;
|
|
249
288
|
const spec = COMMANDS.find((c) => c.name === "spawn");
|
|
250
289
|
if (!spec) return 2;
|
|
251
|
-
const parsed = parseFlags(ctx, spec, argv);
|
|
290
|
+
const parsed = parseFlags(ctx, spec, normalizeAllowArgs(argv));
|
|
252
291
|
if (typeof parsed === "number") return parsed;
|
|
253
292
|
const help = `Run ${cmd(t, "conveno spawn --help")} to see the options.`;
|
|
254
293
|
const [cli, ...extra] = parsed.positionals;
|
|
@@ -431,7 +470,7 @@ function renderSessions(ctx, sessions) {
|
|
|
431
470
|
const tags = [...s.isOrchestrator ? [t.paint("entry", "lead")] : [], ...s.spawned || s.spawnedBy ? [q("spawned")] : []];
|
|
432
471
|
return [
|
|
433
472
|
`${st.glyph} ${t.bold(s.name)}${tags.length > 0 ? ` ${tags.join(" ")}` : ""}`,
|
|
434
|
-
toolName(s.cli),
|
|
473
|
+
s.variant === "app" ? "Antigravity app" : toolName(s.cli),
|
|
435
474
|
st.word,
|
|
436
475
|
...waiting ? [s.unreadCount ? String(s.unreadCount) : q("none")] : [],
|
|
437
476
|
...doing ? [s.statusText ?? ""] : []
|
|
@@ -572,11 +611,11 @@ async function dispatch(name, rest, ctx) {
|
|
|
572
611
|
case "rename": return runRename(ctx, rest);
|
|
573
612
|
case "lead": return runLead(ctx, rest);
|
|
574
613
|
case "spawn": return runSpawn(ctx, rest);
|
|
575
|
-
case "acp-host": return (await import("./acp-
|
|
576
|
-
case "stop": return (await import("./acp-
|
|
614
|
+
case "acp-host": return (await import("./acp-Bs6XS61j.js")).runAcpHostCmd(ctx, rest);
|
|
615
|
+
case "stop": return (await import("./acp-Bs6XS61j.js")).runStop(ctx, rest);
|
|
577
616
|
case "spawn-run": return runSpawnRun(ctx, rest);
|
|
578
|
-
case "agy-relay": return (await import("./agy-relay-
|
|
579
|
-
case "watch": return (await import("./watch-
|
|
617
|
+
case "agy-relay": return (await import("./agy-relay-BJLRYbFp.js")).runAgyRelay(ctx, rest);
|
|
618
|
+
case "watch": return (await import("./watch-DXbOOc20.js")).runWatch(ctx, rest);
|
|
580
619
|
case "devices": return runDevices(ctx, rest);
|
|
581
620
|
case "relay": return runRelay(ctx, rest);
|
|
582
621
|
case "doctor": return runDoctor(ctx, rest);
|
|
@@ -615,7 +654,7 @@ function opensApp(env, tty = {
|
|
|
615
654
|
async function main(argv, ctx) {
|
|
616
655
|
const [command, ...rest] = argv;
|
|
617
656
|
if (command === void 0 && opensApp(ctx.env)) try {
|
|
618
|
-
return await (await import("./run-
|
|
657
|
+
return await (await import("./run-BuDbmxx_.js")).runTui(ctx);
|
|
619
658
|
} catch (e) {
|
|
620
659
|
ctx.err(`The app could not start (${rawMessage(e)}). Showing the help instead.\n`);
|
|
621
660
|
ctx.out(helpText(ctx));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Box, Text, render, useApp, useInput, useStdin, useStdout } from "ink";
|
|
2
2
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
3
|
-
import { t as
|
|
3
|
+
import { D as stopDaemonIfRunning, N as showCode$1, S as PAIR_TIMEOUT_MS, T as replaceStaleDaemon, _ as saveChoice, a as applyOptions, b as unifiedDiff, c as collectPlans, d as refreshManifest, f as renewedApprovals, g as connectedTools, h as chosenTools, k as openInBrowser, l as detectAll, n as inspect, o as approvalWrites, r as partState, s as approvedBySetup, t as runUninstall, u as pendingOptions, v as StaleError, x as warmAcpAdapters, y as applyChanges } from "./uninstall-812XZDTG.js";
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-CjxG2yUl.js";
|
|
4
5
|
import { a as fail, n as cmd, s as plainError, u as tilde } from "./fmt-C2SsP5Y0.js";
|
|
5
6
|
import { createContext, useContext, useEffect, useImperativeHandle, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import { A as showCode$1, E as openInBrowser, T as stopDaemonIfRunning, _ as saveChoice, a as applyOptions, b as unifiedDiff, c as collectPlans, d as refreshManifest, f as renewedApprovals, g as connectedTools, h as chosenTools, l as detectAll, n as inspect, o as approvalWrites, r as partState, s as approvedBySetup, t as runUninstall, u as pendingOptions, v as StaleError, x as PAIR_TIMEOUT_MS, y as applyChanges } from "./uninstall-MaS5t1CK.js";
|
|
7
|
+
import { Ht as readSettings, Kt as requestDeviceCode, Lt as readAccountTokens, N as compatStatus, Nt as planSpawn, P as completeLogin, Pt as pollDeviceCode, Ut as readSpawnRecord, V as defaultProcessIo, Vt as readProcessList, Wt as realSpawnDeps, X as findOnPath, Y as fetchAccountStatus, gn as writeSettings, gt as logoutAccount, jn as SESSION_NAME_PATTERN, nn as spawnRecordPath, r as AccountError, rn as spawnSession, z as dataPaths } from "./dist-DnNuDzEA.js";
|
|
8
8
|
import { i as tokens, n as detectColorLevel, r as detectUnicode } from "./dist-BRjg9CLd.js";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { readFileSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -12,7 +12,7 @@ import { Readable } from "node:stream";
|
|
|
12
12
|
import { basename, posix, win32 } from "node:path";
|
|
13
13
|
import { spawn } from "node:child_process";
|
|
14
14
|
import { homedir } from "node:os";
|
|
15
|
-
import { r as stopRequestPath, t as killProcessTree } from "./dist-
|
|
15
|
+
import { r as stopRequestPath, t as killProcessTree } from "./dist-BkhKEexU.js";
|
|
16
16
|
// src/tui/home/deps.ts
|
|
17
17
|
/**
|
|
18
18
|
* What home does outside the store: sign in and out, and take Conveno away. Real in the app, fake
|
|
@@ -1158,6 +1158,8 @@ const TOOL_NAMES$1 = {
|
|
|
1158
1158
|
};
|
|
1159
1159
|
/** "Claude Code" for `claude`. An unknown id shows as it is. */
|
|
1160
1160
|
const toolName$1 = (cli) => TOOL_NAMES$1[cli] ?? cli;
|
|
1161
|
+
/** The tool a session runs in: "Antigravity app" for the desktop app, else `toolName`. */
|
|
1162
|
+
const sessionTool = (s) => s.variant === "app" && s.cli === "antigravity" ? "Antigravity app" : toolName$1(s.cli);
|
|
1161
1163
|
/** The session's own name without the computer it runs on (`laptop:api-fix` is `api-fix`). */
|
|
1162
1164
|
function shortName(name) {
|
|
1163
1165
|
const i = name.indexOf(":");
|
|
@@ -1168,7 +1170,7 @@ function shortName(name) {
|
|
|
1168
1170
|
* the same tool (`Codex (api-fix)`).
|
|
1169
1171
|
*/
|
|
1170
1172
|
function sessionLabel(s, all) {
|
|
1171
|
-
const tool =
|
|
1173
|
+
const tool = sessionTool(s);
|
|
1172
1174
|
return all.some((o) => o.id !== s.id && o.cli === s.cli) ? `${tool} (${shortName(s.name)})` : tool;
|
|
1173
1175
|
}
|
|
1174
1176
|
// src/tui/home/hooks.ts
|
|
@@ -1554,7 +1556,7 @@ function Card({ session, lead, selected, width, onSelect }) {
|
|
|
1554
1556
|
}) : /* @__PURE__ */ jsx(Text, { children: " " }), /* @__PURE__ */ jsx(Text, {
|
|
1555
1557
|
...strong(k),
|
|
1556
1558
|
...k.ink,
|
|
1557
|
-
children: cut(
|
|
1559
|
+
children: cut(sessionTool(session), inner - 2, k.ascii)
|
|
1558
1560
|
})]
|
|
1559
1561
|
}),
|
|
1560
1562
|
/* @__PURE__ */ jsx(Text, {
|
|
@@ -2120,6 +2122,10 @@ const MENU_ITEMS = [
|
|
|
2120
2122
|
id: "rename",
|
|
2121
2123
|
label: "Rename"
|
|
2122
2124
|
},
|
|
2125
|
+
{
|
|
2126
|
+
id: "remove",
|
|
2127
|
+
label: "Remove this session"
|
|
2128
|
+
},
|
|
2123
2129
|
{
|
|
2124
2130
|
id: "setup",
|
|
2125
2131
|
label: "Set up tools"
|
|
@@ -2256,6 +2262,7 @@ function Help({ onClose }) {
|
|
|
2256
2262
|
["m or enter", "send a message to the one you picked"],
|
|
2257
2263
|
["l", "put it in charge"],
|
|
2258
2264
|
["r", "rename it"],
|
|
2265
|
+
["x", "take it off the list"],
|
|
2259
2266
|
["f", "fix a tool that needs it"],
|
|
2260
2267
|
["ctrl+p or /", "the menu"],
|
|
2261
2268
|
["?", "this list"],
|
|
@@ -2491,6 +2498,26 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2491
2498
|
say(reasonOf(e), "error");
|
|
2492
2499
|
}
|
|
2493
2500
|
};
|
|
2501
|
+
const startRemove = () => {
|
|
2502
|
+
const who = target();
|
|
2503
|
+
if (!who) return;
|
|
2504
|
+
if (who.remote) {
|
|
2505
|
+
say("That one's on another computer. Remove it there.", "warn");
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
setMode("remove");
|
|
2509
|
+
};
|
|
2510
|
+
const remove = async () => {
|
|
2511
|
+
const who = sel;
|
|
2512
|
+
setMode("board");
|
|
2513
|
+
if (!who) return;
|
|
2514
|
+
try {
|
|
2515
|
+
await actions.remove(who.id);
|
|
2516
|
+
say(`Removed ${who.name}.`);
|
|
2517
|
+
} catch (e) {
|
|
2518
|
+
say(reasonOf(e, "That did not work."), "error");
|
|
2519
|
+
}
|
|
2520
|
+
};
|
|
2494
2521
|
const startFix = () => {
|
|
2495
2522
|
if (problems.length === 0) {
|
|
2496
2523
|
say("Everything is in order.", "info");
|
|
@@ -2504,6 +2531,7 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2504
2531
|
if (id === "send") startMessage();
|
|
2505
2532
|
else if (id === "lead") makeLead();
|
|
2506
2533
|
else if (id === "rename") startRename();
|
|
2534
|
+
else if (id === "remove") startRemove();
|
|
2507
2535
|
else if (id === "setup") onSetup();
|
|
2508
2536
|
else if (id === "computers" || id === "account" || id === "uninstall") setMode(id);
|
|
2509
2537
|
else if (id === "quit") onQuit();
|
|
@@ -2531,11 +2559,16 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2531
2559
|
if (key.return || input === "m") return startMessage();
|
|
2532
2560
|
if (input === "l") return void makeLead();
|
|
2533
2561
|
if (input === "r") return startRename();
|
|
2562
|
+
if (input === "x") return startRemove();
|
|
2534
2563
|
if (input === "f") return startFix();
|
|
2535
2564
|
if (input === "/") return setMode("menu");
|
|
2536
2565
|
if (input === "?") return setMode("help");
|
|
2537
2566
|
if (input === "q") return onQuit();
|
|
2538
2567
|
}, { isActive: mode === "board" });
|
|
2568
|
+
useInput((input, key) => {
|
|
2569
|
+
if (input === "y" || input === "Y") remove();
|
|
2570
|
+
else if (input === "n" || input === "N" || key.escape || key.return) setMode("board");
|
|
2571
|
+
}, { isActive: mode === "remove" });
|
|
2539
2572
|
useWheel(boardRef, (d) => move(selIdx + d), { isActive: mode === "board" });
|
|
2540
2573
|
const back = () => setMode("board");
|
|
2541
2574
|
if (mode === "menu") return /* @__PURE__ */ jsx(Menu, {
|
|
@@ -2578,7 +2611,8 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2578
2611
|
const hint = !lead && !empty;
|
|
2579
2612
|
const entries = state.activity;
|
|
2580
2613
|
let act = Math.min(ACTIVITY_LINES, Math.max(1, entries.length));
|
|
2581
|
-
const
|
|
2614
|
+
const asking = mode === "remove";
|
|
2615
|
+
const fixed = 2 + (problems.length > 0 ? 2 : 0) + 1 + (typing || asking ? 1 : 0) + 1 + 1 + (hint ? 1 : 0);
|
|
2582
2616
|
const need = lead && modeFor(columns) === "compact" ? 11 : 5;
|
|
2583
2617
|
while (act > 1 && rows - fixed - act < need) act -= 1;
|
|
2584
2618
|
const budget = Math.max(5, rows - fixed - act);
|
|
@@ -2723,6 +2757,11 @@ function Home({ store, deps, size, onSetup, onQuit }) {
|
|
|
2723
2757
|
})
|
|
2724
2758
|
]
|
|
2725
2759
|
}),
|
|
2760
|
+
mode === "remove" && sel ? /* @__PURE__ */ jsx(Text, {
|
|
2761
|
+
wrap: "truncate",
|
|
2762
|
+
...tint(k.c.warn),
|
|
2763
|
+
children: cut(`Remove ${sel.name} from the list? Its unread messages go too. y/n`, width, k.ascii)
|
|
2764
|
+
}) : null,
|
|
2726
2765
|
typing && sel ? /* @__PURE__ */ jsxs(Box, { children: [
|
|
2727
2766
|
/* @__PURE__ */ jsx(Text, {
|
|
2728
2767
|
wrap: "truncate",
|
|
@@ -3880,6 +3919,7 @@ async function changeTool(ctx, cli, fixId, failed, io) {
|
|
|
3880
3919
|
for (const p of done.problems) io.line(p);
|
|
3881
3920
|
return {
|
|
3882
3921
|
ok: true,
|
|
3922
|
+
changed: files.length > 0,
|
|
3883
3923
|
...files.length === 0 ? { note: "already connected" } : {},
|
|
3884
3924
|
...done.approved === void 0 ? {} : { approved: done.approved }
|
|
3885
3925
|
};
|
|
@@ -3904,23 +3944,56 @@ const PROCESS_NAMES = {
|
|
|
3904
3944
|
antigravity: "agy",
|
|
3905
3945
|
grok: "grok"
|
|
3906
3946
|
};
|
|
3907
|
-
/**
|
|
3908
|
-
|
|
3947
|
+
/** Words in a command line that mark a background server, helper or protocol process, not a window. */
|
|
3948
|
+
const SERVER_ARGS = /(?:^|\s)(?:app-server|serve|daemon|mcp|acp|--managed-daemon|--service)(?=\s|$)/i;
|
|
3949
|
+
/**
|
|
3950
|
+
* The program name and the rest of a command line: `"C:\Program Files\x\codex.exe" app-server`
|
|
3951
|
+
* gives { name: "codex", args: "app-server" }. Lowercase, without folders or `.exe`.
|
|
3952
|
+
*/
|
|
3953
|
+
function splitCommand(command) {
|
|
3954
|
+
const line = command.trim();
|
|
3955
|
+
let exe;
|
|
3956
|
+
let rest;
|
|
3957
|
+
const quoted = /^"([^"]*)"\s*(.*)$/.exec(line);
|
|
3958
|
+
if (quoted) {
|
|
3959
|
+
exe = quoted[1] ?? "";
|
|
3960
|
+
rest = quoted[2] ?? "";
|
|
3961
|
+
} else {
|
|
3962
|
+
const m = /^(.*?\.exe)(?:\s+(.*))?$/i.exec(line) ?? /^(\S+)(?:\s+(.*))?$/.exec(line);
|
|
3963
|
+
exe = m?.[1] ?? "";
|
|
3964
|
+
rest = m?.[2] ?? "";
|
|
3965
|
+
}
|
|
3966
|
+
const name = basename(exe.replaceAll("\\", "/")).replace(/\.exe$/i, "").toLowerCase();
|
|
3967
|
+
return name === "" ? void 0 : {
|
|
3968
|
+
name,
|
|
3969
|
+
args: rest
|
|
3970
|
+
};
|
|
3971
|
+
}
|
|
3972
|
+
/**
|
|
3973
|
+
* Which of `clis` have a window-like process running: a process of that name whose command line
|
|
3974
|
+
* is not a server, daemon, helper or protocol process (`codex app-server --managed-daemon`,
|
|
3975
|
+
* `opencode serve --service`). Those outlive every window, so they say nothing about whether the
|
|
3976
|
+
* tool is open.
|
|
3977
|
+
*/
|
|
3978
|
+
function openTools(processes, clis) {
|
|
3979
|
+
const open = /* @__PURE__ */ new Set();
|
|
3980
|
+
for (const p of processes) {
|
|
3981
|
+
if (p.command === void 0) continue;
|
|
3982
|
+
const parts = splitCommand(p.command);
|
|
3983
|
+
if (parts && !SERVER_ARGS.test(parts.args)) open.add(parts.name);
|
|
3984
|
+
}
|
|
3985
|
+
return clis.filter((c) => open.has(PROCESS_NAMES[c]));
|
|
3986
|
+
}
|
|
3987
|
+
async function runningTools(ctx, clis) {
|
|
3909
3988
|
try {
|
|
3910
|
-
const
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
"-A",
|
|
3917
|
-
"-o",
|
|
3918
|
-
"comm="
|
|
3919
|
-
]));
|
|
3920
|
-
if (r.code !== 0) return /* @__PURE__ */ new Set();
|
|
3921
|
-
return new Set(r.stdout.split(/\r?\n/).map((l) => win ? (l.split("\",\"")[0] ?? "").replace(/^"/, "") : l.trim()).filter(Boolean).map((n) => basename(n.replaceAll("\\", "/")).replace(/\.exe$/i, "").toLowerCase()));
|
|
3989
|
+
const io = ctx.processIo ?? {
|
|
3990
|
+
...defaultProcessIo,
|
|
3991
|
+
platform: ctx.platform
|
|
3992
|
+
};
|
|
3993
|
+
const list = await readProcessList(io);
|
|
3994
|
+
return list ? openTools(list, clis) : [];
|
|
3922
3995
|
} catch {
|
|
3923
|
-
return
|
|
3996
|
+
return [];
|
|
3924
3997
|
}
|
|
3925
3998
|
}
|
|
3926
3999
|
const SIGN_IN_FAILED = "Couldn't sign you in. You can try again any time with conveno login.";
|
|
@@ -3968,8 +4041,13 @@ function createOnboardingDeps(ctx) {
|
|
|
3968
4041
|
}
|
|
3969
4042
|
},
|
|
3970
4043
|
running: async (clis) => {
|
|
3971
|
-
|
|
3972
|
-
|
|
4044
|
+
return runningTools(ctx, clis);
|
|
4045
|
+
},
|
|
4046
|
+
prepareWorkers: async (clis, io) => {
|
|
4047
|
+
return (await warmAcpAdapters(ctx, clis, {
|
|
4048
|
+
onStart: io.start,
|
|
4049
|
+
onLine: io.line
|
|
4050
|
+
}).catch(() => void 0))?.status === "ready";
|
|
3973
4051
|
}
|
|
3974
4052
|
};
|
|
3975
4053
|
}
|
|
@@ -4276,6 +4354,7 @@ function reduce(s, a) {
|
|
|
4276
4354
|
return {
|
|
4277
4355
|
...rest,
|
|
4278
4356
|
...a.result.approved === void 0 ? {} : { approved: a.result.approved },
|
|
4357
|
+
...a.result.changed === void 0 ? {} : { changed: a.result.changed },
|
|
4279
4358
|
state: "done",
|
|
4280
4359
|
note: a.result.note ?? (r.kind === "remove" ? "removed" : r.installedNow ? "installed and connected" : "connected")
|
|
4281
4360
|
};
|
|
@@ -4362,6 +4441,27 @@ function reduce(s, a) {
|
|
|
4362
4441
|
...s,
|
|
4363
4442
|
runningTools: a.clis
|
|
4364
4443
|
};
|
|
4444
|
+
case "workersStart": return {
|
|
4445
|
+
...s,
|
|
4446
|
+
workers: {
|
|
4447
|
+
state: "working",
|
|
4448
|
+
log: []
|
|
4449
|
+
}
|
|
4450
|
+
};
|
|
4451
|
+
case "workersLine": return s.workers ? {
|
|
4452
|
+
...s,
|
|
4453
|
+
workers: {
|
|
4454
|
+
...s.workers,
|
|
4455
|
+
log: [...s.workers.log, a.line]
|
|
4456
|
+
}
|
|
4457
|
+
} : s;
|
|
4458
|
+
case "workersDone": return s.workers ? {
|
|
4459
|
+
...s,
|
|
4460
|
+
workers: {
|
|
4461
|
+
...s.workers,
|
|
4462
|
+
state: a.ready ? "done" : "skipped"
|
|
4463
|
+
}
|
|
4464
|
+
} : s;
|
|
4365
4465
|
}
|
|
4366
4466
|
}
|
|
4367
4467
|
/** Show question `index` again, forgetting the answers from there on. */
|
|
@@ -4631,10 +4731,12 @@ function detailLines(rows, width, ascii) {
|
|
|
4631
4731
|
}
|
|
4632
4732
|
return out;
|
|
4633
4733
|
}
|
|
4634
|
-
function DetailsPanel({ rows }) {
|
|
4734
|
+
function DetailsPanel({ rows, workers }) {
|
|
4635
4735
|
const { ascii, c } = useTheme();
|
|
4636
4736
|
const width = useFrameWidth();
|
|
4637
|
-
const
|
|
4737
|
+
const inner = Math.max(10, width - 4);
|
|
4738
|
+
const lines = detailLines(rows, inner, ascii);
|
|
4739
|
+
if (workers.length > 0) lines.push("Getting workers ready", ...workers.map((l) => ` ${cut(l, inner - 2, ascii)}`));
|
|
4638
4740
|
return /* @__PURE__ */ jsx(Panel, {
|
|
4639
4741
|
title: "Details",
|
|
4640
4742
|
width,
|
|
@@ -4679,11 +4781,20 @@ function WorkingStep({ s }) {
|
|
|
4679
4781
|
state: r.state,
|
|
4680
4782
|
...r.note ? { note: w(r.note) } : {}
|
|
4681
4783
|
})) }),
|
|
4784
|
+
s.workers ? /* @__PURE__ */ jsx(Steps, { rows: [{
|
|
4785
|
+
id: "workers",
|
|
4786
|
+
label: "Getting workers ready",
|
|
4787
|
+
state: s.workers.state,
|
|
4788
|
+
...s.workers.state === "done" ? { note: "ready" } : s.workers.state === "skipped" ? { note: "they will download on first use" } : {}
|
|
4789
|
+
}] }) : null,
|
|
4682
4790
|
failed.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Gap, {}), failed.map((r) => /* @__PURE__ */ jsx(Line, {
|
|
4683
4791
|
tone: "error",
|
|
4684
4792
|
children: r.reason ?? "Something went wrong."
|
|
4685
4793
|
}, r.cli))] }) : null,
|
|
4686
|
-
s.showDetails ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(DetailsPanel, {
|
|
4794
|
+
s.showDetails ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Gap, {}), /* @__PURE__ */ jsx(DetailsPanel, {
|
|
4795
|
+
rows: s.rows,
|
|
4796
|
+
workers: s.workers?.log ?? []
|
|
4797
|
+
})] }) : null
|
|
4687
4798
|
]
|
|
4688
4799
|
});
|
|
4689
4800
|
}
|
|
@@ -4750,7 +4861,7 @@ function firstRunApprovals(s) {
|
|
|
4750
4861
|
});
|
|
4751
4862
|
}
|
|
4752
4863
|
function FinishStep({ s }) {
|
|
4753
|
-
const open = connectedRows(s).filter((r) => s.runningTools.includes(r.cli));
|
|
4864
|
+
const open = connectedRows(s).filter((r) => r.changed !== false && s.runningTools.includes(r.cli));
|
|
4754
4865
|
const any = connectedRows(s).length > 0;
|
|
4755
4866
|
const approvals = firstRunApprovals(s);
|
|
4756
4867
|
return /* @__PURE__ */ jsxs(Frame, {
|
|
@@ -4897,6 +5008,25 @@ function Onboarding({ deps, start, onDone }) {
|
|
|
4897
5008
|
}
|
|
4898
5009
|
})();
|
|
4899
5010
|
}, [s.step, s.rows]);
|
|
5011
|
+
const warmed = useRef(false);
|
|
5012
|
+
useEffect(() => {
|
|
5013
|
+
if (s.step !== "working" || warmed.current) return;
|
|
5014
|
+
warmed.current = true;
|
|
5015
|
+
const clis = s.rows.filter((r) => r.kind === "setup" && r.state !== "skipped").map((r) => r.cli);
|
|
5016
|
+
if (clis.length === 0) return;
|
|
5017
|
+
depsRef.current.prepareWorkers(clis, {
|
|
5018
|
+
start: () => live.current && dispatch({ type: "workersStart" }),
|
|
5019
|
+
line: (line) => live.current && dispatch({
|
|
5020
|
+
type: "workersLine",
|
|
5021
|
+
line
|
|
5022
|
+
})
|
|
5023
|
+
}).catch(() => false).then((ready) => {
|
|
5024
|
+
if (live.current) dispatch({
|
|
5025
|
+
type: "workersDone",
|
|
5026
|
+
ready
|
|
5027
|
+
});
|
|
5028
|
+
});
|
|
5029
|
+
}, [s.step, s.rows]);
|
|
4900
5030
|
useEffect(() => {
|
|
4901
5031
|
if (s.step !== "finish") return;
|
|
4902
5032
|
const clis = connectedRows(s).map((r) => r.cli);
|
|
@@ -5423,6 +5553,10 @@ async function createStore(ctx, opts = {}) {
|
|
|
5423
5553
|
});
|
|
5424
5554
|
set({ sessions: upsert(state.sessions, res.session) });
|
|
5425
5555
|
},
|
|
5556
|
+
async remove(sessionId) {
|
|
5557
|
+
await live()["session.remove"]({ sessionId });
|
|
5558
|
+
set({ sessions: state.sessions.filter((s) => s.id !== sessionId) });
|
|
5559
|
+
},
|
|
5426
5560
|
async spawn(p) {
|
|
5427
5561
|
const c = live();
|
|
5428
5562
|
const runner = ctx.spawnRunner ?? [process.execPath, process.argv[1] ?? "conveno"];
|
|
@@ -5526,6 +5660,7 @@ async function createStore(ctx, opts = {}) {
|
|
|
5526
5660
|
/** `start: "setup"` opens the onboarding at the tool list; otherwise it picks onboarding or home. */
|
|
5527
5661
|
async function runTui(ctx, opts = {}) {
|
|
5528
5662
|
let first;
|
|
5663
|
+
const restarted = await replaceStaleDaemon(ctx);
|
|
5529
5664
|
try {
|
|
5530
5665
|
first = await ctx.connect(connectOpts(ctx, true));
|
|
5531
5666
|
} catch (e) {
|
|
@@ -5576,6 +5711,7 @@ async function runTui(ctx, opts = {}) {
|
|
|
5576
5711
|
input.dispose();
|
|
5577
5712
|
await store.close();
|
|
5578
5713
|
if (farewell) ctx.out(`${farewell}\n`);
|
|
5714
|
+
if (restarted) ctx.out(`${restarted}\n`);
|
|
5579
5715
|
}
|
|
5580
5716
|
}
|
|
5581
5717
|
export { runTui };
|
|
@@ -4,18 +4,18 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { delimiter, join, win32 } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { n as antigravityAdapter } from "./dist-
|
|
8
|
-
import { a as opencodeAdapter, o as claudeAdapter, r as readAllStdin } from "./hook-entry-
|
|
9
|
-
import { t as codexAdapter } from "./dist-
|
|
10
|
-
import { t as grokAdapter } from "./dist-
|
|
7
|
+
import { n as antigravityAdapter } from "./dist-D4sb5RQD.js";
|
|
8
|
+
import { a as opencodeAdapter, o as claudeAdapter, r as readAllStdin } from "./hook-entry-WlJSM5aD.js";
|
|
9
|
+
import { t as codexAdapter } from "./dist-C9Z1EMlM.js";
|
|
10
|
+
import { t as grokAdapter } from "./dist-B14ldKRS.js";
|
|
11
11
|
import { t as createTheme } from "./dist-BRjg9CLd.js";
|
|
12
|
-
import { n as connect$1 } from "./dist-
|
|
13
|
-
import {
|
|
14
|
-
import "./dist-
|
|
12
|
+
import { n as connect$1 } from "./dist-Ca3P7aN-.js";
|
|
13
|
+
import { $ as formatInbox, C as attachAcpSession, E as baseName, H as detectRepo, Mn as SessionId, Nt as planSpawn, On as RpcErrorCode, Ot as pendingTurn, R as dataDir, Rt as readAncestry, Tn as OWNER_SESSION_ID, Tt as parsePs1ShimTarget, Wt as realSpawnDeps, Xn as array, Yn as _enum, Zn as boolean, Zt as resolveWindowsCommand, _n as CLI_KINDS, a as ConvenoError, c as HEARTBEAT_INTERVAL_MS, er as number, f as SPAWN_CLIS, k as claimSpawnRecord, kt as pidAlive, l as NOT_FROM_USER_NOTICE, m as SpawnError, mt as launcherText, nr as string, pn as validateRename, pt as launcherPath, rn as spawnSession, st as isAntigravityApp, vt as needsQuoting, wn as MessageId, wt as parseCmdShimTarget, zt as readCommandLine } from "./dist-DnNuDzEA.js";
|
|
14
|
+
import "./dist-CoRBNycn.js";
|
|
15
15
|
import { access } from "node:fs/promises";
|
|
16
16
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
-
// ../daemon/dist/server-
|
|
18
|
+
// ../daemon/dist/server-D8Ib1txr.js
|
|
19
19
|
/** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
|
|
20
20
|
function defaultIsAlive(pid) {
|
|
21
21
|
try {
|
|
@@ -28,7 +28,7 @@ function defaultIsAlive(pid) {
|
|
|
28
28
|
`${OWNER_SESSION_ID}`;
|
|
29
29
|
SessionId.parse("0".repeat(26));
|
|
30
30
|
// ../mcp/dist/index.js
|
|
31
|
-
const SERVER_VERSION = "0.2.0-rc.
|
|
31
|
+
const SERVER_VERSION = "0.2.0-rc.13";
|
|
32
32
|
const ok = (text) => ({ content: [{
|
|
33
33
|
type: "text",
|
|
34
34
|
text
|
|
@@ -106,6 +106,8 @@ function whoamiText(s) {
|
|
|
106
106
|
}
|
|
107
107
|
/** The daemon no longer knows this session (restart, pruned, name taken). Recipient errors do not match. */
|
|
108
108
|
const isSessionGone = (err) => err instanceof ConvenoError && err.code === RpcErrorCode.NotFound && /No session with id|not registered|Register the session again/.test(err.message);
|
|
109
|
+
/** The daemon retired this session: it will not take heartbeats from it again. */
|
|
110
|
+
const isSessionEnded = (err) => err instanceof ConvenoError && err.code === RpcErrorCode.NotFound && err.message.includes("has ended and will not come back");
|
|
109
111
|
const SESSION_LOST_TEXT = "Conveno lost this session and could not restore it automatically. Tell the user that Conveno is not available in this session right now; restarting the CLI session reconnects it.";
|
|
110
112
|
/**
|
|
111
113
|
* Sent in the `instructions` field of the initialize result. MCP clients put it in the model's
|
|
@@ -149,10 +151,12 @@ function createServer(opts) {
|
|
|
149
151
|
/** The conversation this process last bound, so a tool call binds only when it changes. */
|
|
150
152
|
let boundConversation;
|
|
151
153
|
let binding = Promise.resolve();
|
|
154
|
+
const isAlive = opts.isAlive ?? pidAlive;
|
|
155
|
+
const parentGone = () => opts.parentPid !== void 0 && !isAlive(opts.parentPid);
|
|
152
156
|
const register = async () => {
|
|
153
157
|
const repo = await detectRepo(cwd, { exists: pathExists });
|
|
154
158
|
const cliVersion = process.env.CONVENO_CLI_VERSION?.trim().slice(0, 64);
|
|
155
|
-
const { hostPid, hostPids } = await host;
|
|
159
|
+
const { hostPid, hostPids, variant } = await host;
|
|
156
160
|
const record = claimSpawnRecord(spawnDataDir, cli, hostPids);
|
|
157
161
|
if (record?.acp) {
|
|
158
162
|
attached = true;
|
|
@@ -166,6 +170,7 @@ function createServer(opts) {
|
|
|
166
170
|
...hostPid !== void 0 ? { hostPid } : {},
|
|
167
171
|
...hostPids.length > 0 ? { hostPids: hostPids.slice(0, 8) } : {},
|
|
168
172
|
...cliVersion ? { cliVersion } : {},
|
|
173
|
+
...variant ? { variant } : {},
|
|
169
174
|
...repo.root ? { repo: { root: repo.root } } : {},
|
|
170
175
|
...spawnedBy.success ? { spawnedBy: spawnedBy.data } : {},
|
|
171
176
|
...record ? { spawned: true } : {}
|
|
@@ -186,10 +191,25 @@ function createServer(opts) {
|
|
|
186
191
|
if (await pendingTurn(spawnDataDir, "claude-pending-turn").take(claudeId)) await client["turn.start"]({ sessionId: session.id }).catch(() => {});
|
|
187
192
|
}
|
|
188
193
|
const beat = setInterval(() => {
|
|
189
|
-
if (actingId)
|
|
194
|
+
if (!actingId) return;
|
|
195
|
+
if (parentGone()) {
|
|
196
|
+
shutdown().then(() => opts.onExit?.());
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
client["session.heartbeat"]({
|
|
190
200
|
sessionId: actingId,
|
|
191
201
|
pid: process.pid
|
|
192
|
-
}).catch(() => {
|
|
202
|
+
}).catch((err) => {
|
|
203
|
+
if (isSessionEnded(err)) {
|
|
204
|
+
if (timer) clearInterval(timer);
|
|
205
|
+
timer = void 0;
|
|
206
|
+
opts.onExit?.();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!isSessionGone(err)) return;
|
|
210
|
+
forgetSession();
|
|
211
|
+
ensure().catch(() => {});
|
|
212
|
+
});
|
|
193
213
|
}, HEARTBEAT_INTERVAL_MS);
|
|
194
214
|
beat.unref();
|
|
195
215
|
if (timer) clearInterval(timer);
|
|
@@ -483,7 +503,8 @@ async function runStdio(opts) {
|
|
|
483
503
|
launcherPaths: process.argv[1] ? [process.argv[1]] : []
|
|
484
504
|
}).then((a) => ({
|
|
485
505
|
hostPid: a.hostPid,
|
|
486
|
-
hostPids: a.pids
|
|
506
|
+
hostPids: a.pids,
|
|
507
|
+
variant: opts.cli === "antigravity" && isAntigravityApp(a.entries) ? "app" : void 0
|
|
487
508
|
}));
|
|
488
509
|
const client = await connect$1({
|
|
489
510
|
kind: "mcp",
|
|
@@ -494,7 +515,9 @@ async function runStdio(opts) {
|
|
|
494
515
|
cli: opts.cli,
|
|
495
516
|
client,
|
|
496
517
|
host,
|
|
497
|
-
cwd: process.cwd()
|
|
518
|
+
cwd: process.cwd(),
|
|
519
|
+
...process.ppid > 1 ? { parentPid: process.ppid } : {},
|
|
520
|
+
onExit: () => void stop().then(() => process.exit(0))
|
|
498
521
|
});
|
|
499
522
|
let stopping;
|
|
500
523
|
const stop = () => {
|