@conveno/cli 0.2.0-rc.11 → 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.
@@ -1,10 +1,10 @@
1
- import { A as completeLogin, F as dataPaths, G as fetchAccountStatus, It as resolveAcpProgram, K as findOnPath, Nt as requestDeviceCode, St as pollDeviceCode, Tt as readAccountTokens, d as SPAWN_TABLE, g as adapterNpxCommand, h as adapterInstallCommand, in as CLI_KINDS, k as compatStatus, kt as readSettings, m as acpOverrideVar, n as AccountError, rn as writeSettings, st as logoutAccount, vt as pinnedAdapter } from "./dist-qONHJRJk.js";
1
+ import { At as pinnedAdapter, Ht as readSettings, Kt as requestDeviceCode, Lt as readAccountTokens, N as compatStatus, Nt as planSpawn, P as completeLogin, Pt as pollDeviceCode, X as findOnPath, Y as fetchAccountStatus, Yt as resolveAcpProgram, _ as adapterInstallCommand, _n as CLI_KINDS, g as acpOverrideVar, gn as writeSettings, gt as logoutAccount, p as SPAWN_TABLE, r as AccountError, v as adapterNpxCommand, z as dataPaths } from "./dist-DnNuDzEA.js";
2
2
  import { a as fail, c as plural, d as warnBlock, i as errorBlock, l as seconds, n as cmd, o as localStamp, r as columns, s as plainError, t as closest, u as tilde } from "./fmt-C2SsP5Y0.js";
3
- import { a as parseFlags, n as COMMANDS } from "./args-C1eX8Ixk.js";
3
+ import { a as parseFlags, n as COMMANDS } from "./args-C4rVCVXx.js";
4
4
  import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
5
- import { t as daemonProblem } from "./daemonError-DraepwsB.js";
6
- import { basename, dirname, join } from "node:path";
7
- import { spawn } from "node:child_process";
5
+ import { t as daemonProblem } from "./daemonError-CjxG2yUl.js";
6
+ import { basename, dirname, isAbsolute, join } from "node:path";
7
+ import { execFile, spawn } from "node:child_process";
8
8
  import { access, chmod, mkdir, open, readFile, readdir, realpath, rename as rename$1, rm, rmdir, stat, writeFile } from "node:fs/promises";
9
9
  import { createHash, randomBytes } from "node:crypto";
10
10
  // src/account.ts
@@ -140,6 +140,8 @@ async function runAccount(ctx, argv, io = {}) {
140
140
  return accountFailure(ctx, e, "Could not read your account");
141
141
  }
142
142
  }
143
+ // src/version.ts
144
+ const VERSION = "0.2.0-rc.13";
143
145
  // src/daemon.ts
144
146
  async function lockPid(ctx) {
145
147
  try {
@@ -276,6 +278,29 @@ async function stopDaemonIfRunning(ctx) {
276
278
  }
277
279
  return stopDaemon(ctx, true);
278
280
  }
281
+ /**
282
+ * For the commands a person runs (`conveno`, `conveno setup`): when a daemon is running from a
283
+ * different version than this CLI (an upgrade left the old one up), stop it so the next connect
284
+ * starts this version's. Says nothing itself; the returned line is for the setup details. Never
285
+ * starts a daemon, and never throws. MCP servers and hooks must not call this: an old MCP would
286
+ * take the daemon back to its own version.
287
+ */
288
+ async function replaceStaleDaemon(ctx) {
289
+ let running;
290
+ try {
291
+ const c = await ctx.connect(connectOpts(ctx, false));
292
+ running = c.daemonVersion;
293
+ await c.close().catch(() => void 0);
294
+ } catch {
295
+ return null;
296
+ }
297
+ if (running === void 0 || running === "0.2.0-rc.13") return null;
298
+ return await stopDaemon({
299
+ ...ctx,
300
+ out: () => void 0,
301
+ err: () => void 0
302
+ }, true).catch(() => 1) === 0 ? `Restarted the background service: it was ${running}, now ${VERSION}.` : `The background service is still ${running} (this is ${VERSION}). Run conveno daemon stop.`;
303
+ }
279
304
  const SUBCOMMANDS = [
280
305
  "start",
281
306
  "stop",
@@ -762,6 +787,90 @@ ${missing.map((m) => ` ${pinnedAdapter(m.pkg) ?? m.pkg}\n`).join("")}`);
762
787
  printManual(ctx, missing);
763
788
  }
764
789
  }
790
+ function realWarmRunner(ctx) {
791
+ return { run: (file, args, timeoutMs) => {
792
+ const plan = planSpawn(file, args);
793
+ return new Promise((resolve) => {
794
+ execFile(plan.file, plan.args, {
795
+ timeout: timeoutMs,
796
+ windowsHide: true,
797
+ env: {
798
+ ...ctx.env,
799
+ npm_config_update_notifier: "false"
800
+ },
801
+ maxBuffer: 16777216,
802
+ ...plan.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
803
+ }, (err) => {
804
+ if (!err) return resolve(0);
805
+ const code = err.code;
806
+ resolve(typeof code === "number" ? code : null);
807
+ });
808
+ });
809
+ } };
810
+ }
811
+ /**
812
+ * The pinned `<pkg>@<version>` of every adapter these tools need that is not on PATH (nor
813
+ * overridden), when the person allowed on-demand adapters. Empty otherwise.
814
+ */
815
+ function adaptersToWarm(ctx, clis) {
816
+ if (!(readSettings(dataPaths(ctx.platform, ctx.dataDir).settings).acpAdapterNpx === true)) return [];
817
+ const out = [];
818
+ for (const cli of clis) {
819
+ const acp = SPAWN_TABLE[cli]?.acp;
820
+ if (!acp?.adapterPackage) continue;
821
+ const found = resolveAcpProgram(cli, acp, {
822
+ env: ctx.env,
823
+ which: (n) => findOnPath(n, ctx.env, ctx.platform),
824
+ npxConsent: false
825
+ });
826
+ const pinned = pinnedAdapter(acp.adapterPackage);
827
+ if (!found.ok && pinned && !out.includes(pinned)) out.push(pinned);
828
+ }
829
+ return out;
830
+ }
831
+ /**
832
+ * Download the adapters now. `onStart` is called once, before the first download, and only when
833
+ * there is something to download. Never throws.
834
+ */
835
+ async function warmAcpAdapters(ctx, clis, opts = {}) {
836
+ const packages = adaptersToWarm(ctx, clis);
837
+ if (packages.length === 0) return { status: "none" };
838
+ opts.onStart?.();
839
+ const runner = opts.runner ?? ctx.warmRunner ?? realWarmRunner(ctx);
840
+ const failed = [];
841
+ for (const pkg of packages) {
842
+ const args = [
843
+ "exec",
844
+ "--yes",
845
+ `--package=${pkg}`,
846
+ "--",
847
+ "node",
848
+ "-e",
849
+ "0"
850
+ ];
851
+ opts.onLine?.(`$ npm ${args.join(" ")}`);
852
+ let code = null;
853
+ try {
854
+ code = await runner.run("npm", args, opts.timeoutMs ?? 3e5);
855
+ } catch {
856
+ code = null;
857
+ }
858
+ if (code !== 0) {
859
+ failed.push(pkg);
860
+ opts.onLine?.(`Could not fetch ${pkg} now (${code === null ? "no answer" : `exit ${code}`}).`);
861
+ } else opts.onLine?.(`${pkg} is ready.`);
862
+ }
863
+ if (failed.length === 0) return {
864
+ status: "ready",
865
+ packages
866
+ };
867
+ return {
868
+ status: "failed",
869
+ packages,
870
+ failed,
871
+ reason: "It will download the first time a worker starts."
872
+ };
873
+ }
765
874
  // src/diff.ts
766
875
  const splitLines = (s) => {
767
876
  if (s === "") return [];
@@ -1188,6 +1297,54 @@ async function markRestored(ctx, found) {
1188
1297
  };
1189
1298
  await writeFile(join(found.dir, MANIFEST_NAME), `${JSON.stringify(done, null, 2)}\n`, { mode: 384 });
1190
1299
  }
1300
+ // src/tools.ts
1301
+ /**
1302
+ * The settings file, or undefined when its path is not a real path on this machine. A test that
1303
+ * fakes another platform builds paths with that platform's separators; writing there would land
1304
+ * in the working directory, so nothing is read or written.
1305
+ */
1306
+ function settingsFile(ctx) {
1307
+ const path = dataPaths(ctx.platform, ctx.dataDir).settings;
1308
+ return isAbsolute(path) ? path : void 0;
1309
+ }
1310
+ /** The tools that already have Conveno's setup, whether or not their program is on PATH now. */
1311
+ async function connectedTools(ctx) {
1312
+ const env = adapterEnv(ctx);
1313
+ const out = [];
1314
+ for (const adapter of ctx.adapters) try {
1315
+ if (!(await adapter.plan(env)).some((c) => c.component === "mcp" && c.kind === "add")) out.push(adapter.cli);
1316
+ } catch {}
1317
+ return out;
1318
+ }
1319
+ /**
1320
+ * The saved choice. Installs from before the choice was saved have none: it is then taken, once,
1321
+ * from the tools that already have Conveno's setup and saved. Nothing saved and nothing set up
1322
+ * gives an empty list (the first setup has not happened).
1323
+ */
1324
+ async function chosenTools(ctx) {
1325
+ const path = settingsFile(ctx);
1326
+ const known = new Set(ctx.adapters.map((a) => a.cli));
1327
+ const saved = path ? readSettings(path).tools : void 0;
1328
+ if (saved) return saved.filter((c) => known.has(c));
1329
+ const derived = await connectedTools(ctx);
1330
+ if (path && derived.length > 0) try {
1331
+ writeSettings(path, { tools: derived });
1332
+ } catch {}
1333
+ return derived;
1334
+ }
1335
+ /**
1336
+ * Save the choice, after the setup worked. The lead must be one of the chosen tools: a new one is
1337
+ * kept, the earlier one stays while it is still chosen, and a lead that was dropped is cleared.
1338
+ */
1339
+ function saveChoice(ctx, tools, lead) {
1340
+ const path = settingsFile(ctx);
1341
+ if (!path) return;
1342
+ const next = lead ?? readSettings(path).leadCli;
1343
+ writeSettings(path, {
1344
+ tools: [...new Set(tools)],
1345
+ leadCli: next && tools.includes(next) ? next : null
1346
+ });
1347
+ }
1191
1348
  // src/init.ts
1192
1349
  const CODEX_NOTE = "Codex asks you to approve Conveno once: run /hooks inside Codex.";
1193
1350
  /** Detect every adapter. A detection that throws counts as not installed. */
@@ -1230,6 +1387,24 @@ function parseCliList(raw, ctx) {
1230
1387
  }
1231
1388
  return out;
1232
1389
  }
1390
+ /**
1391
+ * The tools to set up: `--cli` when given (it becomes the saved choice), else the saved choice.
1392
+ * With neither there is nothing to go on, so the caller must ask for `--cli`.
1393
+ */
1394
+ async function toolsToSet(ctx, raw) {
1395
+ if (raw !== void 0) {
1396
+ const list = parseCliList(raw, ctx);
1397
+ return Array.isArray(list) ? {
1398
+ adapters: list,
1399
+ explicit: true
1400
+ } : list;
1401
+ }
1402
+ const saved = await chosenTools(ctx);
1403
+ return {
1404
+ adapters: ctx.adapters.filter((a) => saved.includes(a.cli)),
1405
+ explicit: false
1406
+ };
1407
+ }
1233
1408
  function printDetections(ctx, found) {
1234
1409
  const t = ctx.theme;
1235
1410
  ctx.out(`${t.bold("Looking for AI tools on this machine")}\n`);
@@ -1481,6 +1656,21 @@ async function runInit(ctx, argv, name = "init") {
1481
1656
  ref: "e_usage"
1482
1657
  });
1483
1658
  }
1659
+ if (typeof lead === "string") {
1660
+ const rawCli = early?.values.cli;
1661
+ const picked = await toolsToSet(ctx, typeof rawCli === "string" ? rawCli : void 0);
1662
+ if ("adapters" in picked && !picked.adapters.some((a) => a.cli === lead)) return fail(ctx, {
1663
+ what: `${lead} is not one of the chosen AI tools, so it can't lead`,
1664
+ detail: [`Chosen: ${picked.adapters.map((a) => a.cli).join(", ") || "none"}.`],
1665
+ fix: `Pass ${cmd(ctx.theme, `--cli ${lead}`)} too, or pick a lead from the list above.`,
1666
+ exit: 2,
1667
+ ref: "e_usage"
1668
+ });
1669
+ }
1670
+ if (early?.values["dry-run"] !== true) {
1671
+ const restarted = await replaceStaleDaemon(ctx);
1672
+ if (restarted) ctx.out(`${ctx.theme.status("info")} ${restarted}\n`);
1673
+ }
1484
1674
  const outcome = {};
1485
1675
  const code = await initSetup(ctx, argv, outcome, name);
1486
1676
  if (code !== 0) return code;
@@ -1498,6 +1688,10 @@ async function runInit(ctx, argv, name = "init") {
1498
1688
  flag: values["acp-adapters"] === true ? true : values["no-acp-adapters"] === true ? false : void 0,
1499
1689
  yes: values.yes === true
1500
1690
  });
1691
+ const t = ctx.theme;
1692
+ const warmed = await warmAcpAdapters(ctx, outcome.offer.map((a) => a.cli), { onStart: () => ctx.out(`${t.status("info")} Getting workers ready (the first download can take a minute).\n`) }).catch(() => void 0);
1693
+ if (warmed?.status === "ready") ctx.out(`${t.status("ok")} Workers are ready.\n`);
1694
+ else if (warmed?.status === "failed") ctx.out(`${t.status("info")} Couldn't get workers ready now. They download the first time one starts.\n`);
1501
1695
  return 0;
1502
1696
  }
1503
1697
  async function initSetup(ctx, argv, outcome, name) {
@@ -1514,11 +1708,19 @@ async function initSetup(ctx, argv, outcome, name) {
1514
1708
  exit: 2,
1515
1709
  ref: "e_usage"
1516
1710
  });
1517
- const chosen = parseCliList(typeof values.cli === "string" ? values.cli : void 0, ctx);
1518
- if (!Array.isArray(chosen)) return fail(ctx, {
1519
- what: chosen.message,
1711
+ const picked = await toolsToSet(ctx, typeof values.cli === "string" ? values.cli : void 0);
1712
+ if (!("adapters" in picked)) return fail(ctx, {
1713
+ what: picked.message,
1520
1714
  fix: `Pass ${cmd(t, cliListExample(ctx))} or leave it out.`,
1521
- ...chosen.suggestion ? { didYouMean: chosen.suggestion } : {},
1715
+ ...picked.suggestion ? { didYouMean: picked.suggestion } : {},
1716
+ exit: 2,
1717
+ ref: "e_usage"
1718
+ });
1719
+ const chosen = picked.adapters;
1720
+ if (chosen.length === 0) return fail(ctx, {
1721
+ what: "No AI tools are chosen yet",
1722
+ detail: [`Choices: ${ctx.adapters.map((a) => a.cli).join(", ")}.`],
1723
+ fix: `Pass ${cmd(t, cliListExample(ctx))}, or run ${cmd(t, "conveno setup")} in a terminal to pick.`,
1522
1724
  exit: 2,
1523
1725
  ref: "e_usage"
1524
1726
  });
@@ -1575,7 +1777,10 @@ async function initSetup(ctx, argv, outcome, name) {
1575
1777
  }
1576
1778
  if (items.length === 0 && extras.length === 0) {
1577
1779
  ctx.out(`${t.status("ok")} Conveno is already set up for ${installed.map((f) => f.adapter.cli).join(", ")}. Nothing to change.\n`);
1578
- if (!dryRun) await approveTools(ctx, installed, accepted, /* @__PURE__ */ new Set());
1780
+ if (!dryRun) {
1781
+ await approveTools(ctx, installed, accepted, /* @__PURE__ */ new Set());
1782
+ if (picked.explicit) saveChoice(ctx, installed.map((f) => f.adapter.cli));
1783
+ }
1579
1784
  outcome.offer = installed.map((f) => f.adapter);
1580
1785
  return 0;
1581
1786
  }
@@ -1610,6 +1815,7 @@ async function initSetup(ctx, argv, outcome, name) {
1610
1815
  ctx.out(" Restart open sessions so they pick up Conveno.\n");
1611
1816
  const approved = await approveTools(ctx, installed, applying, new Set(byCli.keys()), result.applied.backupDir);
1612
1817
  if (byCli.has("codex") && !approved.has("codex")) ctx.out(`${t.status("info")} ${CODEX_NOTE}\n`);
1818
+ if (picked.explicit) saveChoice(ctx, installed.map((f) => f.adapter.cli));
1613
1819
  ctx.out(` Next: ${cmd(t, "conveno status")} lists your sessions.\n`);
1614
1820
  outcome.offer = installed.map((f) => f.adapter);
1615
1821
  return 0;
@@ -1649,7 +1855,7 @@ async function runSetup(ctx, argv) {
1649
1855
  const parsed = parseFlags(ctx, spec, argv);
1650
1856
  if (typeof parsed === "number") return parsed;
1651
1857
  const v = parsed.values;
1652
- if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-CtGfzzwB.js")).runTui(ctx, { start: "setup" });
1858
+ if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-BuDbmxx_.js")).runTui(ctx, { start: "setup" });
1653
1859
  return runInit(ctx, argv, "setup");
1654
1860
  }
1655
1861
  // src/doctor.ts
@@ -1730,44 +1936,35 @@ async function inspect(ctx, adapter) {
1730
1936
  }
1731
1937
  }
1732
1938
  /**
1733
- * A note for a CLI outside the tested range. Older than the minimum is a problem. Past the tested
1734
- * major or minor version is a warning. A patch release ahead gets only the short table note: CLIs
1735
- * like Claude Code ship patches almost daily, and they rarely change config or hook formats.
1939
+ * A warning for a CLI older than a known-broken floor: a version that lacks something Conveno
1940
+ * needs. Nothing else is flagged: a newer or untested version gets no warning, and doctor never
1941
+ * exits 1 for a version.
1736
1942
  */
1737
1943
  function versionBlock(t, adapter, version, status) {
1944
+ if (status.kind !== "older") return void 0;
1738
1945
  const name = adapter.displayName;
1739
- if (status.kind === "older") return {
1740
- problem: true,
1741
- text: errorBlock(t, {
1742
- what: `${name} ${version} is older than Conveno supports`,
1743
- detail: [`Conveno needs ${name} ${status.minimum} or newer.`],
1744
- fix: `Upgrade ${name}, then run ${cmd(t, "conveno doctor")} again.`,
1745
- exit: 1,
1746
- ref: "e_cli_old"
1747
- })
1748
- };
1749
- if (status.kind === "newer" && status.minor) return {
1750
- problem: false,
1751
- text: warnBlock(t, `${name} ${version} is newer than the ${status.verified} Conveno was tested with.`, "Nothing to do unless messages stop arriving. Please report it at https://github.com/0xPixelNinja/conveno/issues if something breaks.", "CLI vendors change config and hook formats often. A nightly check tests the newest releases and raises the tested version when they pass.")
1752
- };
1946
+ return warnBlock(t, `${name} ${version} is older than ${status.minimum}, which Conveno needs.`, `Upgrade ${name}, then run ${cmd(t, "conveno doctor")} again.`, `Some features need ${name} ${status.minimum} or newer. Conveno still works with what this version supports.`);
1753
1947
  }
1754
1948
  async function runDoctor(ctx, argv = []) {
1755
1949
  const t = ctx.theme;
1756
1950
  const spec = COMMANDS.find((c) => c.name === "doctor");
1757
1951
  let adapters = ctx.adapters;
1952
+ let chosen;
1758
1953
  if (spec) {
1759
1954
  const parsed = parseFlags(ctx, spec, argv);
1760
1955
  if (typeof parsed === "number") return parsed;
1761
- const chosen = parseCliList(typeof parsed.values.cli === "string" ? parsed.values.cli : void 0, ctx);
1762
- if (!Array.isArray(chosen)) return fail(ctx, {
1763
- what: chosen.message,
1956
+ const picked = parseCliList(typeof parsed.values.cli === "string" ? parsed.values.cli : void 0, ctx);
1957
+ if (!Array.isArray(picked)) return fail(ctx, {
1958
+ what: picked.message,
1764
1959
  fix: `Pass ${cmd(t, cliListExample(ctx))} or leave it out.`,
1765
- ...chosen.suggestion ? { didYouMean: chosen.suggestion } : {},
1960
+ ...picked.suggestion ? { didYouMean: picked.suggestion } : {},
1766
1961
  exit: 2,
1767
1962
  ref: "e_usage"
1768
1963
  });
1769
- adapters = chosen;
1964
+ adapters = picked;
1965
+ if (typeof parsed.values.cli === "string") chosen = new Set(picked.map((a) => a.cli));
1770
1966
  }
1967
+ chosen ??= new Set(await chosenTools(ctx));
1771
1968
  let ok = 0;
1772
1969
  let warnings = 0;
1773
1970
  let problems = 0;
@@ -1777,8 +1974,15 @@ async function runDoctor(ctx, argv = []) {
1777
1974
  const client = await ctx.connect(connectOpts(ctx, false));
1778
1975
  try {
1779
1976
  const { sessions } = await client["session.list"]({});
1780
- daemonLine = [` ${t.status("ok")} daemon`, `running, ${plural(sessions.length, "session")}`];
1781
- ok++;
1977
+ const running = client.daemonVersion;
1978
+ if (running !== void 0 && running !== "0.2.0-rc.13") {
1979
+ daemonLine = [` ${t.status("warn")} daemon`, `running ${running}, this is ${VERSION}`];
1980
+ warnings++;
1981
+ notes.push(warnBlock(t, "Conveno's background service is from an older version.", `Run ${cmd(t, "conveno")} to restart it, or ${cmd(t, "conveno daemon stop")} and open your AI tools again.`, `The service running now is ${running}; this install is ${VERSION}. ${cmd(t, "conveno")} and ${cmd(t, "conveno setup")} restart it for you.`));
1982
+ } else {
1983
+ daemonLine = [` ${t.status("ok")} daemon`, `running, ${plural(sessions.length, "session")}`];
1984
+ ok++;
1985
+ }
1782
1986
  } finally {
1783
1987
  await client.close().catch(() => void 0);
1784
1988
  }
@@ -1831,14 +2035,25 @@ async function runDoctor(ctx, argv = []) {
1831
2035
  ]);
1832
2036
  continue;
1833
2037
  }
2038
+ if (!chosen.has(adapter.cli) && !(r.mcp === "ok" && (r.hooks === null || r.hooks === "ok"))) {
2039
+ table.push([
2040
+ ` ${t.glyph("offline")} ${adapter.cli}`,
2041
+ adapter.displayName,
2042
+ detection.version ?? "",
2043
+ "",
2044
+ "",
2045
+ "",
2046
+ q("not set up (not chosen)")
2047
+ ]);
2048
+ continue;
2049
+ }
1834
2050
  const good = r.mcp === "ok" && (r.hooks === null || r.hooks === "ok") && !r.planError;
1835
2051
  const compat = compatStatus(adapter.cli, detection.version, ctx.compat);
1836
2052
  const tiers = activeTiers(r);
1837
2053
  let note = tiers.includes("idle wake") ? "wakes idle sessions" : tiers.includes("end of turn") ? "wakes at the end of a turn, no idle wake" : tiers.includes("next turn") ? "delivered at the next prompt" : "read through the inbox tool";
1838
2054
  if (!good) note = r.planError ? "config could not be read" : r.mcp === "outdated" || r.hooks === "outdated" ? "needs an update" : "not fully configured";
1839
- if (compat.kind === "older") note = `older than the minimum ${compat.minimum}`;
1840
- else if (compat.kind === "newer" && good) note = `newer than tested (${compat.verified})`;
1841
- const glyph = compat.kind === "older" ? t.status("error") : good && !(compat.kind === "newer" && compat.minor) ? t.status("ok") : t.status("warn");
2055
+ if (compat.kind === "older") note = `older than ${compat.minimum}, which Conveno needs`;
2056
+ const glyph = good && compat.kind !== "older" ? t.status("ok") : t.status("warn");
1842
2057
  table.push([
1843
2058
  ` ${glyph} ${adapter.cli}`,
1844
2059
  adapter.displayName,
@@ -1859,7 +2074,7 @@ async function runDoctor(ctx, argv = []) {
1859
2074
  ref: "e_config"
1860
2075
  }));
1861
2076
  } else if (good) {
1862
- if (compat.kind !== "older" && !(compat.kind === "newer" && compat.minor)) ok++;
2077
+ if (compat.kind !== "older") ok++;
1863
2078
  } else {
1864
2079
  warnings++;
1865
2080
  const named = [["the MCP server", r.mcp], ["the hooks", r.hooks]];
@@ -1871,9 +2086,8 @@ async function runDoctor(ctx, argv = []) {
1871
2086
  }
1872
2087
  const versionNote = versionBlock(t, adapter, detection.version, compat);
1873
2088
  if (versionNote) {
1874
- notes.push(versionNote.text);
1875
- if (versionNote.problem) problems++;
1876
- else warnings++;
2089
+ notes.push(versionNote);
2090
+ warnings++;
1877
2091
  }
1878
2092
  }
1879
2093
  ctx.out(`${columns(table).join("\n")}\n`);
@@ -2012,6 +2226,8 @@ async function runUninstall(ctx, argv) {
2012
2226
  return 1;
2013
2227
  }
2014
2228
  if (items.length === 0) {
2229
+ const stopped = await stopDaemonIfRunning(ctx);
2230
+ if (stopped !== 0) return stopped;
2015
2231
  ctx.out(`${t.status("ok")} Nothing to remove. No Conveno entries were found in any supported CLI.\n`);
2016
2232
  return 0;
2017
2233
  }
@@ -2029,4 +2245,4 @@ async function runUninstall(ctx, argv) {
2029
2245
  ctx.out(" Removed the Conveno entries. Restart open sessions to drop Conveno.\n");
2030
2246
  return 0;
2031
2247
  }
2032
- export { openInBrowser as C, showCode as D, runLogout as E, stopDaemonIfRunning as S, runLogin as T, unifiedDiff as _, applyOptions as a, runRelay as b, collectPlans as c, refreshManifest as d, renewedApprovals as f, applyChanges as g, StaleError as h, runDoctor as i, detectAll as l, runSetup as m, inspect as n, approvalWrites as o, runInit as p, partState as r, approvedBySetup as s, runUninstall as t, pendingOptions as u, PAIR_TIMEOUT_MS as v, runAccount as w, runDaemon as x, runDevices as y };
2248
+ export { runAccount as A, runDevices as C, stopDaemonIfRunning as D, runDaemon as E, runLogout as M, showCode as N, VERSION as O, PAIR_TIMEOUT_MS as S, replaceStaleDaemon as T, saveChoice as _, applyOptions as a, unifiedDiff as b, collectPlans as c, refreshManifest as d, renewedApprovals as f, connectedTools as g, chosenTools as h, runDoctor as i, runLogin as j, openInBrowser as k, detectAll as l, runSetup as m, inspect as n, approvalWrites as o, runInit as p, partState as r, approvedBySetup as s, runUninstall as t, pendingOptions as u, StaleError as v, runRelay as w, warmAcpAdapters as x, applyChanges as y };
@@ -1,8 +1,8 @@
1
- import { n as isOneShotGrok } from "./dist-Y0JDSJP_.js";
2
- import { $ as isFromOwner, Bt as runWaker, Ht as senderOf, Mt as renderBody } from "./dist-qONHJRJk.js";
1
+ import { n as isOneShotGrok } from "./dist-B14ldKRS.js";
2
+ import { $t as runWaker, Gt as renderBody, ct as isFromOwner, tn as senderOf } from "./dist-DnNuDzEA.js";
3
3
  import { n as connectOpts } from "./ctx-tYftvhz_.js";
4
- import { t as daemonProblem } from "./daemonError-DraepwsB.js";
5
- import { t as findSession } from "./pick-B-axJvgf.js";
4
+ import { t as daemonProblem } from "./daemonError-CjxG2yUl.js";
5
+ import { t as findSession } from "./pick-Colav8Wm.js";
6
6
  // src/watch.ts
7
7
  const CONNECT_MAX_RETRY_MS = 3e4;
8
8
  const CONNECT_GIVE_UP_MS = 3e5;
@@ -80,7 +80,27 @@ function watchLines(messages, orchestrator) {
80
80
  }
81
81
  /** The one line a watcher prints in a one-shot run. The rules file tells the agent not to restart it. */
82
82
  const ONE_SHOT_TEXT = "[conveno] watch ended: this Grok run is one-shot (grok -p), so nothing wakes it. Do not start the watcher again.";
83
- const USAGE = "[conveno] watch needs a session name. The conveno whoami tool gives it.";
83
+ const USAGE = "[conveno] watch needs a session name, and may take --conversation <id>. The conveno whoami tool gives the name.";
84
+ /** The conversation id the agent was asked to pass: plain characters, short. */
85
+ const CONVERSATION = /^[A-Za-z0-9_.:-]{1,128}$/;
86
+ /**
87
+ * `<session name> [--conversation <id>]`. The id is the Grok conversation the watcher serves: once
88
+ * the window's session moves to another conversation the daemon calls the watcher superseded.
89
+ * Null for anything else.
90
+ */
91
+ function parseWatchArgs(argv) {
92
+ const [name, ...rest] = argv;
93
+ if (!name || name.startsWith("--")) return null;
94
+ if (rest.length === 0) return { name };
95
+ const [flag, value] = rest;
96
+ let id;
97
+ if (flag?.startsWith("--conversation=") && rest.length === 1) id = flag.slice(15);
98
+ else if (flag === "--conversation" && rest.length === 2) id = value;
99
+ return id !== void 0 && CONVERSATION.test(id) ? {
100
+ name,
101
+ conversation: id
102
+ } : null;
103
+ }
84
104
  /** Reasons the waker stops that are not a failure of the watcher. */
85
105
  const CLEAN_STOPS = /* @__PURE__ */ new Set([
86
106
  "aborted",
@@ -101,11 +121,12 @@ const STOP_TEXT = {
101
121
  * nothing but `[conveno]` lines, on stdout, because Grok reads the monitor's stdout.
102
122
  */
103
123
  async function runWatch(ctx, argv, deps = {}) {
104
- const [name, ...extra] = argv;
105
- if (!name || extra.length > 0) {
124
+ const args = parseWatchArgs(argv);
125
+ if (!args) {
106
126
  ctx.out(`${USAGE}\n`);
107
127
  return 2;
108
128
  }
129
+ const { name, conversation } = args;
109
130
  const ancestry = await ctx.ancestry(2e3).catch(() => void 0);
110
131
  const host = ancestry?.entries.find((e) => e.pid === ancestry.hostPid);
111
132
  if (isOneShotGrok(host?.command)) {
@@ -135,6 +156,7 @@ async function runWatch(ctx, argv, deps = {}) {
135
156
  client,
136
157
  sessionId: session.id,
137
158
  signal: controller.signal,
159
+ ...conversation === void 0 ? {} : { nativeId: conversation },
138
160
  inject: async (_text, messages, batch) => {
139
161
  const lines = watchLines(messages, batch?.orchestrator ?? null);
140
162
  if (lines.length === 0) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conveno/cli",
3
- "version": "0.2.0-rc.11",
3
+ "version": "0.2.0-rc.13",
4
4
  "description": "Connect AI coding CLI sessions so they can message each other.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -52,18 +52,18 @@
52
52
  "zod": "4.6.7"
53
53
  },
54
54
  "devDependencies": {
55
- "@conveno/acp": "0.2.0-rc.11",
56
- "@conveno/adapter-antigravity": "0.2.0-rc.11",
57
- "@conveno/adapter-claude": "0.2.0-rc.11",
58
- "@conveno/adapter-codex": "0.2.0-rc.11",
59
- "@conveno/adapter-grok": "0.2.0-rc.11",
60
- "@conveno/adapter-opencode": "0.2.0-rc.11",
61
- "@conveno/brand": "0.2.0-rc.11",
62
- "@conveno/client": "0.2.0-rc.11",
63
- "@conveno/core": "0.2.0-rc.11",
64
- "@conveno/daemon": "0.2.0-rc.11",
65
- "@conveno/mcp": "0.2.0-rc.11",
66
- "@conveno/protocol": "0.2.0-rc.11",
55
+ "@conveno/acp": "0.2.0-rc.13",
56
+ "@conveno/adapter-antigravity": "0.2.0-rc.13",
57
+ "@conveno/adapter-claude": "0.2.0-rc.13",
58
+ "@conveno/adapter-codex": "0.2.0-rc.13",
59
+ "@conveno/adapter-grok": "0.2.0-rc.13",
60
+ "@conveno/adapter-opencode": "0.2.0-rc.13",
61
+ "@conveno/brand": "0.2.0-rc.13",
62
+ "@conveno/client": "0.2.0-rc.13",
63
+ "@conveno/core": "0.2.0-rc.13",
64
+ "@conveno/daemon": "0.2.0-rc.13",
65
+ "@conveno/mcp": "0.2.0-rc.13",
66
+ "@conveno/protocol": "0.2.0-rc.13",
67
67
  "@types/react": "19.3.0",
68
68
  "ink-testing-library": "4.0.0"
69
69
  },
@@ -1 +0,0 @@
1
- export { i as runHookEntry } from "./hook-entry-BYvXWDJv.js";