@conveno/cli 0.2.0-rc.11 → 0.2.0-rc.12
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/README.md +1 -1
- package/dist/{acp-BOSDOzU7.js → acp-CIzgcCp9.js} +2 -2
- package/dist/{agy-relay-BUo9uRng.js → agy-relay-Y9o-Pw9U.js} +3 -2
- package/dist/bin.js +2 -2
- package/dist/daemon.js +213 -16
- package/dist/{daemonError-DraepwsB.js → daemonError-0KnkgIRo.js} +1 -1
- package/dist/{dist-Rdj5ogAX.js → dist-4iJnF07i.js} +3 -3
- package/dist/{dist-n6XMTlyN.js → dist-B3YYLzKS.js} +2 -1
- package/dist/{dist-DEjU_KXC.js → dist-BjATai4T.js} +15 -16
- package/dist/{dist-qONHJRJk.js → dist-CRj_cuHc.js} +183 -31
- package/dist/{dist-Y0JDSJP_.js → dist-DF0nL8wE.js} +48 -7
- package/dist/{dist-Dg2IY9OA.js → dist-DeN0jR3I.js} +1 -1
- package/dist/{dist-KWlFKO7H.js → dist-Du1hwaux.js} +20 -13
- package/dist/{hook-CDF1A8AY.js → hook-ByduyOom.js} +62 -2
- package/dist/{hook-entry-BYvXWDJv.js → hook-entry-DWa1oppt.js} +99 -76
- package/dist/hook-entry-ajdMBSpY.js +1 -0
- package/dist/{main-EqfI0btx.js → main-WIfawg60.js} +11 -11
- package/dist/{pick-B-axJvgf.js → pick-BmZuv9yQ.js} +1 -1
- package/dist/{run-CtGfzzwB.js → run-Df6vFm9n.js} +63 -50
- package/dist/{runtime-BDNmkbsS.js → runtime-BKPod_ZQ.js} +93 -88
- package/dist/{uninstall-Blt-KHI5.js → uninstall-MaS5t1CK.js} +131 -39
- package/dist/{watch-CuZ7jPVd.js → watch-CPkilo9L.js} +29 -7
- package/package.json +13 -13
- package/dist/hook-entry-D2CAJsq-.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as requestDeviceCode, It as readSettings, J as fetchAccountStatus, M as compatStatus, Mt as readAccountTokens, N as completeLogin, R as dataPaths, Tt as pinnedAdapter, Ut as resolveAcpProgram, Y as findOnPath, _ as adapterNpxCommand, dn as CLI_KINDS, f as SPAWN_TABLE, ft as logoutAccount, g as adapterInstallCommand, h as acpOverrideVar, kt as pollDeviceCode, n as AccountError, un as writeSettings } from "./dist-CRj_cuHc.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
3
|
import { a as parseFlags, n as COMMANDS } from "./args-C1eX8Ixk.js";
|
|
4
4
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
5
|
-
import { t as daemonProblem } from "./daemonError-
|
|
6
|
-
import { basename, dirname, join } from "node:path";
|
|
5
|
+
import { t as daemonProblem } from "./daemonError-0KnkgIRo.js";
|
|
6
|
+
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
7
7
|
import { 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";
|
|
@@ -1188,6 +1188,54 @@ async function markRestored(ctx, found) {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
await writeFile(join(found.dir, MANIFEST_NAME), `${JSON.stringify(done, null, 2)}\n`, { mode: 384 });
|
|
1190
1190
|
}
|
|
1191
|
+
// src/tools.ts
|
|
1192
|
+
/**
|
|
1193
|
+
* The settings file, or undefined when its path is not a real path on this machine. A test that
|
|
1194
|
+
* fakes another platform builds paths with that platform's separators; writing there would land
|
|
1195
|
+
* in the working directory, so nothing is read or written.
|
|
1196
|
+
*/
|
|
1197
|
+
function settingsFile(ctx) {
|
|
1198
|
+
const path = dataPaths(ctx.platform, ctx.dataDir).settings;
|
|
1199
|
+
return isAbsolute(path) ? path : void 0;
|
|
1200
|
+
}
|
|
1201
|
+
/** The tools that already have Conveno's setup, whether or not their program is on PATH now. */
|
|
1202
|
+
async function connectedTools(ctx) {
|
|
1203
|
+
const env = adapterEnv(ctx);
|
|
1204
|
+
const out = [];
|
|
1205
|
+
for (const adapter of ctx.adapters) try {
|
|
1206
|
+
if (!(await adapter.plan(env)).some((c) => c.component === "mcp" && c.kind === "add")) out.push(adapter.cli);
|
|
1207
|
+
} catch {}
|
|
1208
|
+
return out;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* The saved choice. Installs from before the choice was saved have none: it is then taken, once,
|
|
1212
|
+
* from the tools that already have Conveno's setup and saved. Nothing saved and nothing set up
|
|
1213
|
+
* gives an empty list (the first setup has not happened).
|
|
1214
|
+
*/
|
|
1215
|
+
async function chosenTools(ctx) {
|
|
1216
|
+
const path = settingsFile(ctx);
|
|
1217
|
+
const known = new Set(ctx.adapters.map((a) => a.cli));
|
|
1218
|
+
const saved = path ? readSettings(path).tools : void 0;
|
|
1219
|
+
if (saved) return saved.filter((c) => known.has(c));
|
|
1220
|
+
const derived = await connectedTools(ctx);
|
|
1221
|
+
if (path && derived.length > 0) try {
|
|
1222
|
+
writeSettings(path, { tools: derived });
|
|
1223
|
+
} catch {}
|
|
1224
|
+
return derived;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Save the choice, after the setup worked. The lead must be one of the chosen tools: a new one is
|
|
1228
|
+
* kept, the earlier one stays while it is still chosen, and a lead that was dropped is cleared.
|
|
1229
|
+
*/
|
|
1230
|
+
function saveChoice(ctx, tools, lead) {
|
|
1231
|
+
const path = settingsFile(ctx);
|
|
1232
|
+
if (!path) return;
|
|
1233
|
+
const next = lead ?? readSettings(path).leadCli;
|
|
1234
|
+
writeSettings(path, {
|
|
1235
|
+
tools: [...new Set(tools)],
|
|
1236
|
+
leadCli: next && tools.includes(next) ? next : null
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1191
1239
|
// src/init.ts
|
|
1192
1240
|
const CODEX_NOTE = "Codex asks you to approve Conveno once: run /hooks inside Codex.";
|
|
1193
1241
|
/** Detect every adapter. A detection that throws counts as not installed. */
|
|
@@ -1230,6 +1278,24 @@ function parseCliList(raw, ctx) {
|
|
|
1230
1278
|
}
|
|
1231
1279
|
return out;
|
|
1232
1280
|
}
|
|
1281
|
+
/**
|
|
1282
|
+
* The tools to set up: `--cli` when given (it becomes the saved choice), else the saved choice.
|
|
1283
|
+
* With neither there is nothing to go on, so the caller must ask for `--cli`.
|
|
1284
|
+
*/
|
|
1285
|
+
async function toolsToSet(ctx, raw) {
|
|
1286
|
+
if (raw !== void 0) {
|
|
1287
|
+
const list = parseCliList(raw, ctx);
|
|
1288
|
+
return Array.isArray(list) ? {
|
|
1289
|
+
adapters: list,
|
|
1290
|
+
explicit: true
|
|
1291
|
+
} : list;
|
|
1292
|
+
}
|
|
1293
|
+
const saved = await chosenTools(ctx);
|
|
1294
|
+
return {
|
|
1295
|
+
adapters: ctx.adapters.filter((a) => saved.includes(a.cli)),
|
|
1296
|
+
explicit: false
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1233
1299
|
function printDetections(ctx, found) {
|
|
1234
1300
|
const t = ctx.theme;
|
|
1235
1301
|
ctx.out(`${t.bold("Looking for AI tools on this machine")}\n`);
|
|
@@ -1481,6 +1547,17 @@ async function runInit(ctx, argv, name = "init") {
|
|
|
1481
1547
|
ref: "e_usage"
|
|
1482
1548
|
});
|
|
1483
1549
|
}
|
|
1550
|
+
if (typeof lead === "string") {
|
|
1551
|
+
const rawCli = early?.values.cli;
|
|
1552
|
+
const picked = await toolsToSet(ctx, typeof rawCli === "string" ? rawCli : void 0);
|
|
1553
|
+
if ("adapters" in picked && !picked.adapters.some((a) => a.cli === lead)) return fail(ctx, {
|
|
1554
|
+
what: `${lead} is not one of the chosen AI tools, so it can't lead`,
|
|
1555
|
+
detail: [`Chosen: ${picked.adapters.map((a) => a.cli).join(", ") || "none"}.`],
|
|
1556
|
+
fix: `Pass ${cmd(ctx.theme, `--cli ${lead}`)} too, or pick a lead from the list above.`,
|
|
1557
|
+
exit: 2,
|
|
1558
|
+
ref: "e_usage"
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1484
1561
|
const outcome = {};
|
|
1485
1562
|
const code = await initSetup(ctx, argv, outcome, name);
|
|
1486
1563
|
if (code !== 0) return code;
|
|
@@ -1514,11 +1591,19 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1514
1591
|
exit: 2,
|
|
1515
1592
|
ref: "e_usage"
|
|
1516
1593
|
});
|
|
1517
|
-
const
|
|
1518
|
-
if (!
|
|
1519
|
-
what:
|
|
1594
|
+
const picked = await toolsToSet(ctx, typeof values.cli === "string" ? values.cli : void 0);
|
|
1595
|
+
if (!("adapters" in picked)) return fail(ctx, {
|
|
1596
|
+
what: picked.message,
|
|
1520
1597
|
fix: `Pass ${cmd(t, cliListExample(ctx))} or leave it out.`,
|
|
1521
|
-
...
|
|
1598
|
+
...picked.suggestion ? { didYouMean: picked.suggestion } : {},
|
|
1599
|
+
exit: 2,
|
|
1600
|
+
ref: "e_usage"
|
|
1601
|
+
});
|
|
1602
|
+
const chosen = picked.adapters;
|
|
1603
|
+
if (chosen.length === 0) return fail(ctx, {
|
|
1604
|
+
what: "No AI tools are chosen yet",
|
|
1605
|
+
detail: [`Choices: ${ctx.adapters.map((a) => a.cli).join(", ")}.`],
|
|
1606
|
+
fix: `Pass ${cmd(t, cliListExample(ctx))}, or run ${cmd(t, "conveno setup")} in a terminal to pick.`,
|
|
1522
1607
|
exit: 2,
|
|
1523
1608
|
ref: "e_usage"
|
|
1524
1609
|
});
|
|
@@ -1575,7 +1660,10 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1575
1660
|
}
|
|
1576
1661
|
if (items.length === 0 && extras.length === 0) {
|
|
1577
1662
|
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)
|
|
1663
|
+
if (!dryRun) {
|
|
1664
|
+
await approveTools(ctx, installed, accepted, /* @__PURE__ */ new Set());
|
|
1665
|
+
if (picked.explicit) saveChoice(ctx, installed.map((f) => f.adapter.cli));
|
|
1666
|
+
}
|
|
1579
1667
|
outcome.offer = installed.map((f) => f.adapter);
|
|
1580
1668
|
return 0;
|
|
1581
1669
|
}
|
|
@@ -1610,6 +1698,7 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1610
1698
|
ctx.out(" Restart open sessions so they pick up Conveno.\n");
|
|
1611
1699
|
const approved = await approveTools(ctx, installed, applying, new Set(byCli.keys()), result.applied.backupDir);
|
|
1612
1700
|
if (byCli.has("codex") && !approved.has("codex")) ctx.out(`${t.status("info")} ${CODEX_NOTE}\n`);
|
|
1701
|
+
if (picked.explicit) saveChoice(ctx, installed.map((f) => f.adapter.cli));
|
|
1613
1702
|
ctx.out(` Next: ${cmd(t, "conveno status")} lists your sessions.\n`);
|
|
1614
1703
|
outcome.offer = installed.map((f) => f.adapter);
|
|
1615
1704
|
return 0;
|
|
@@ -1649,7 +1738,7 @@ async function runSetup(ctx, argv) {
|
|
|
1649
1738
|
const parsed = parseFlags(ctx, spec, argv);
|
|
1650
1739
|
if (typeof parsed === "number") return parsed;
|
|
1651
1740
|
const v = parsed.values;
|
|
1652
|
-
if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-
|
|
1741
|
+
if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-Df6vFm9n.js")).runTui(ctx, { start: "setup" });
|
|
1653
1742
|
return runInit(ctx, argv, "setup");
|
|
1654
1743
|
}
|
|
1655
1744
|
// src/doctor.ts
|
|
@@ -1730,44 +1819,35 @@ async function inspect(ctx, adapter) {
|
|
|
1730
1819
|
}
|
|
1731
1820
|
}
|
|
1732
1821
|
/**
|
|
1733
|
-
* A
|
|
1734
|
-
*
|
|
1735
|
-
*
|
|
1822
|
+
* A warning for a CLI older than a known-broken floor: a version that lacks something Conveno
|
|
1823
|
+
* needs. Nothing else is flagged: a newer or untested version gets no warning, and doctor never
|
|
1824
|
+
* exits 1 for a version.
|
|
1736
1825
|
*/
|
|
1737
1826
|
function versionBlock(t, adapter, version, status) {
|
|
1827
|
+
if (status.kind !== "older") return void 0;
|
|
1738
1828
|
const name = adapter.displayName;
|
|
1739
|
-
|
|
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
|
-
};
|
|
1829
|
+
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
1830
|
}
|
|
1754
1831
|
async function runDoctor(ctx, argv = []) {
|
|
1755
1832
|
const t = ctx.theme;
|
|
1756
1833
|
const spec = COMMANDS.find((c) => c.name === "doctor");
|
|
1757
1834
|
let adapters = ctx.adapters;
|
|
1835
|
+
let chosen;
|
|
1758
1836
|
if (spec) {
|
|
1759
1837
|
const parsed = parseFlags(ctx, spec, argv);
|
|
1760
1838
|
if (typeof parsed === "number") return parsed;
|
|
1761
|
-
const
|
|
1762
|
-
if (!Array.isArray(
|
|
1763
|
-
what:
|
|
1839
|
+
const picked = parseCliList(typeof parsed.values.cli === "string" ? parsed.values.cli : void 0, ctx);
|
|
1840
|
+
if (!Array.isArray(picked)) return fail(ctx, {
|
|
1841
|
+
what: picked.message,
|
|
1764
1842
|
fix: `Pass ${cmd(t, cliListExample(ctx))} or leave it out.`,
|
|
1765
|
-
...
|
|
1843
|
+
...picked.suggestion ? { didYouMean: picked.suggestion } : {},
|
|
1766
1844
|
exit: 2,
|
|
1767
1845
|
ref: "e_usage"
|
|
1768
1846
|
});
|
|
1769
|
-
adapters =
|
|
1847
|
+
adapters = picked;
|
|
1848
|
+
if (typeof parsed.values.cli === "string") chosen = new Set(picked.map((a) => a.cli));
|
|
1770
1849
|
}
|
|
1850
|
+
chosen ??= new Set(await chosenTools(ctx));
|
|
1771
1851
|
let ok = 0;
|
|
1772
1852
|
let warnings = 0;
|
|
1773
1853
|
let problems = 0;
|
|
@@ -1831,14 +1911,25 @@ async function runDoctor(ctx, argv = []) {
|
|
|
1831
1911
|
]);
|
|
1832
1912
|
continue;
|
|
1833
1913
|
}
|
|
1914
|
+
if (!chosen.has(adapter.cli) && !(r.mcp === "ok" && (r.hooks === null || r.hooks === "ok"))) {
|
|
1915
|
+
table.push([
|
|
1916
|
+
` ${t.glyph("offline")} ${adapter.cli}`,
|
|
1917
|
+
adapter.displayName,
|
|
1918
|
+
detection.version ?? "",
|
|
1919
|
+
"",
|
|
1920
|
+
"",
|
|
1921
|
+
"",
|
|
1922
|
+
q("not set up (not chosen)")
|
|
1923
|
+
]);
|
|
1924
|
+
continue;
|
|
1925
|
+
}
|
|
1834
1926
|
const good = r.mcp === "ok" && (r.hooks === null || r.hooks === "ok") && !r.planError;
|
|
1835
1927
|
const compat = compatStatus(adapter.cli, detection.version, ctx.compat);
|
|
1836
1928
|
const tiers = activeTiers(r);
|
|
1837
1929
|
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
1930
|
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
|
|
1840
|
-
|
|
1841
|
-
const glyph = compat.kind === "older" ? t.status("error") : good && !(compat.kind === "newer" && compat.minor) ? t.status("ok") : t.status("warn");
|
|
1931
|
+
if (compat.kind === "older") note = `older than ${compat.minimum}, which Conveno needs`;
|
|
1932
|
+
const glyph = good && compat.kind !== "older" ? t.status("ok") : t.status("warn");
|
|
1842
1933
|
table.push([
|
|
1843
1934
|
` ${glyph} ${adapter.cli}`,
|
|
1844
1935
|
adapter.displayName,
|
|
@@ -1859,7 +1950,7 @@ async function runDoctor(ctx, argv = []) {
|
|
|
1859
1950
|
ref: "e_config"
|
|
1860
1951
|
}));
|
|
1861
1952
|
} else if (good) {
|
|
1862
|
-
if (compat.kind !== "older"
|
|
1953
|
+
if (compat.kind !== "older") ok++;
|
|
1863
1954
|
} else {
|
|
1864
1955
|
warnings++;
|
|
1865
1956
|
const named = [["the MCP server", r.mcp], ["the hooks", r.hooks]];
|
|
@@ -1871,9 +1962,8 @@ async function runDoctor(ctx, argv = []) {
|
|
|
1871
1962
|
}
|
|
1872
1963
|
const versionNote = versionBlock(t, adapter, detection.version, compat);
|
|
1873
1964
|
if (versionNote) {
|
|
1874
|
-
notes.push(versionNote
|
|
1875
|
-
|
|
1876
|
-
else warnings++;
|
|
1965
|
+
notes.push(versionNote);
|
|
1966
|
+
warnings++;
|
|
1877
1967
|
}
|
|
1878
1968
|
}
|
|
1879
1969
|
ctx.out(`${columns(table).join("\n")}\n`);
|
|
@@ -2012,6 +2102,8 @@ async function runUninstall(ctx, argv) {
|
|
|
2012
2102
|
return 1;
|
|
2013
2103
|
}
|
|
2014
2104
|
if (items.length === 0) {
|
|
2105
|
+
const stopped = await stopDaemonIfRunning(ctx);
|
|
2106
|
+
if (stopped !== 0) return stopped;
|
|
2015
2107
|
ctx.out(`${t.status("ok")} Nothing to remove. No Conveno entries were found in any supported CLI.\n`);
|
|
2016
2108
|
return 0;
|
|
2017
2109
|
}
|
|
@@ -2029,4 +2121,4 @@ async function runUninstall(ctx, argv) {
|
|
|
2029
2121
|
ctx.out(" Removed the Conveno entries. Restart open sessions to drop Conveno.\n");
|
|
2030
2122
|
return 0;
|
|
2031
2123
|
}
|
|
2032
|
-
export {
|
|
2124
|
+
export { showCode as A, runRelay as C, runAccount as D, openInBrowser as E, runLogin as O, runDevices as S, stopDaemonIfRunning 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, runLogout 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, runDaemon as w, PAIR_TIMEOUT_MS as x, applyChanges as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as isOneShotGrok } from "./dist-
|
|
2
|
-
import {
|
|
1
|
+
import { n as isOneShotGrok } from "./dist-DF0nL8wE.js";
|
|
2
|
+
import { Yt as senderOf, it as isFromOwner, qt as runWaker, zt as renderBody } from "./dist-CRj_cuHc.js";
|
|
3
3
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
4
|
-
import { t as daemonProblem } from "./daemonError-
|
|
5
|
-
import { t as findSession } from "./pick-
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-0KnkgIRo.js";
|
|
5
|
+
import { t as findSession } from "./pick-BmZuv9yQ.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
|
|
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
|
|
105
|
-
if (!
|
|
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.
|
|
3
|
+
"version": "0.2.0-rc.12",
|
|
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.
|
|
56
|
-
"@conveno/adapter-antigravity": "0.2.0-rc.
|
|
57
|
-
"@conveno/adapter-claude": "0.2.0-rc.
|
|
58
|
-
"@conveno/adapter-codex": "0.2.0-rc.
|
|
59
|
-
"@conveno/adapter-grok": "0.2.0-rc.
|
|
60
|
-
"@conveno/adapter-opencode": "0.2.0-rc.
|
|
61
|
-
"@conveno/brand": "0.2.0-rc.
|
|
62
|
-
"@conveno/client": "0.2.0-rc.
|
|
63
|
-
"@conveno/core": "0.2.0-rc.
|
|
64
|
-
"@conveno/daemon": "0.2.0-rc.
|
|
65
|
-
"@conveno/mcp": "0.2.0-rc.
|
|
66
|
-
"@conveno/protocol": "0.2.0-rc.
|
|
55
|
+
"@conveno/acp": "0.2.0-rc.12",
|
|
56
|
+
"@conveno/adapter-antigravity": "0.2.0-rc.12",
|
|
57
|
+
"@conveno/adapter-claude": "0.2.0-rc.12",
|
|
58
|
+
"@conveno/adapter-codex": "0.2.0-rc.12",
|
|
59
|
+
"@conveno/adapter-grok": "0.2.0-rc.12",
|
|
60
|
+
"@conveno/adapter-opencode": "0.2.0-rc.12",
|
|
61
|
+
"@conveno/brand": "0.2.0-rc.12",
|
|
62
|
+
"@conveno/client": "0.2.0-rc.12",
|
|
63
|
+
"@conveno/core": "0.2.0-rc.12",
|
|
64
|
+
"@conveno/daemon": "0.2.0-rc.12",
|
|
65
|
+
"@conveno/mcp": "0.2.0-rc.12",
|
|
66
|
+
"@conveno/protocol": "0.2.0-rc.12",
|
|
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";
|