@conveno/cli 0.1.1-rc.1 → 0.1.1-rc.2

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 CHANGED
@@ -34,6 +34,7 @@ Then open two CLI sessions, for example Claude Code and Codex. In one, ask it to
34
34
  | `conveno init` | Add the Conveno MCP server and hooks to each detected CLI. |
35
35
  | `conveno uninstall` | Undo every install that has not been undone. |
36
36
  | `conveno status` | Online sessions grouped by repo, with the orchestrator marked. `--all` includes offline ones. |
37
+ | `conveno forget [<name\|pattern>...] [--offline] [--older-than <duration>] [--dry-run] [--yes]` | Remove offline sessions from the list, for example the leftovers of deleted test repos. A name is exact or a pattern where `*` matches any run of characters (quote it: `'conveno-real-*'`). `--offline` with no name means every offline session, and `--older-than 30m`, `24h` or `7d` keeps only those last seen that long ago. It lists what it will remove and asks; `--yes` skips the question, and without a terminal it exits 2 unless `--yes` is given. `--dry-run` lists and changes nothing. A running session that matches is listed as skipped and never removed. Forgetting deletes the queued messages of the session; messages it sent stay with the receivers. The daemon also forgets offline sessions whose folder has been missing for 5 minutes and that have no unread messages. |
37
38
  | `conveno doctor` | Check each CLI and the daemon, and say how to fix what is wrong. |
38
39
  | `conveno daemon start\|stop\|status` | Control the local daemon. It also starts when a CLI opens the Conveno MCP server, and exits when no session has been online for a while. |
39
40
 
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as resolveWindowsCommand, C as pendingHookContext, D as readCommandLine, E as readAncestry, F as CLI_KINDS, G as SessionId, H as PROTOCOL_VERSION, J as encodeFrame, K as createLineDecoder, P as validateRename, T as proofsMatch, U as RpcErrorCode, V as MessageId, W as RpcResponse, X as isSocketPathTooLong, Y as ipcMethods, at as socketPathTooLongMessage, b as newAuthNonce, c as clientProof, d as dataPaths, f as detectRepo, h as formatInbox, l as daemonProof, n as HEARTBEAT_INTERVAL_MS, o as baseName, q as defaultSocketPath, r as NOT_FROM_USER_NOTICE, t as ConvenoError, u as dataDir, w as planSpawn, x as parseCliVersion, z as EventPayload } from "./dist-Do8KKOnN.js";
2
+ import { B as EventPayload, D as readAncestry, E as proofsMatch, F as validateRename, G as RpcResponse, H as MessageId, I as CLI_KINDS, J as createLineDecoder, K as SessionId, O as readCommandLine, Q as isSocketPathTooLong, S as parseCliVersion, T as planSpawn, U as PROTOCOL_VERSION, W as RpcErrorCode, X as encodeFrame, Y as defaultSocketPath, Z as ipcMethods, c as clientProof, d as dataPaths, f as detectRepo, h as formatInbox, j as resolveWindowsCommand, l as daemonProof, n as HEARTBEAT_INTERVAL_MS, o as baseName, q as SessionNamePattern, r as NOT_FROM_USER_NOTICE, st as socketPathTooLongMessage, t as ConvenoError, u as dataDir, w as pendingHookContext, x as newAuthNonce } from "./dist-C_wVdDv5.js";
3
3
  import { parseArgs } from "node:util";
4
4
  import { access, chmod, mkdir, open, readFile, readdir, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
5
5
  import { execFile, spawn } from "node:child_process";
@@ -153,6 +153,39 @@ const COMMANDS = [
153
153
  help: "Also list offline sessions"
154
154
  } }
155
155
  },
156
+ {
157
+ name: "forget",
158
+ usage: "conveno forget [<name|pattern>...] [options]",
159
+ summary: "Remove offline sessions from the list",
160
+ flags: {
161
+ offline: {
162
+ type: "boolean",
163
+ help: "Every offline session, when no name is given"
164
+ },
165
+ "older-than": {
166
+ type: "string",
167
+ value: "<duration>",
168
+ help: "Only sessions last seen this long ago, such as 30m, 24h or 7d"
169
+ },
170
+ "dry-run": {
171
+ type: "boolean",
172
+ help: "List the sessions and change nothing"
173
+ },
174
+ yes: {
175
+ type: "boolean",
176
+ short: "y",
177
+ help: "Forget without asking"
178
+ }
179
+ },
180
+ notes: [
181
+ "A name is an exact session name or a pattern where * matches any run of characters.",
182
+ "Quote a pattern so the shell leaves it alone: conveno forget 'conveno-real-*'.",
183
+ "Only offline sessions are forgotten. A running session is listed as skipped.",
184
+ "Forgetting deletes the queued messages of the session. Messages it sent stay with the receivers.",
185
+ "Without a terminal it needs --yes, and exits 2 without it."
186
+ ],
187
+ positionals: true
188
+ },
156
189
  {
157
190
  name: "doctor",
158
191
  usage: "conveno doctor",
@@ -284,6 +317,7 @@ const CLIENT_METHODS = [
284
317
  "session.rename",
285
318
  "session.setStatus",
286
319
  "session.byHost",
320
+ "session.forget",
287
321
  "daemon.shutdown",
288
322
  "session.list",
289
323
  "orchestrator.claim",
@@ -906,6 +940,12 @@ async function runDaemon(ctx, argv) {
906
940
  });
907
941
  }
908
942
  // src/doctor.ts
943
+ /** What the plan says about one part: nothing to do, an addition, or an update to what is there. */
944
+ function partState(changes, component) {
945
+ const mine = changes.filter((c) => c.component === component);
946
+ if (mine.length === 0) return "ok";
947
+ return mine.some((c) => c.kind === "add") ? "missing" : "outdated";
948
+ }
909
949
  /** Time allowed for the one process-table query. */
910
950
  const ANCESTRY_TIMEOUT_MS = 5e3;
911
951
  const tierWord = (t) => t === "next_turn" ? "next turn" : t;
@@ -929,21 +969,18 @@ async function inspect(ctx, adapter) {
929
969
  const hasHooks = adapter.deliveryTier !== "inbox";
930
970
  try {
931
971
  const changes = await adapter.plan(env);
932
- const text = changes.map((c) => c.description);
933
- const hooksMissing = text.some((d) => /hook/i.test(d));
934
- const mcpMissing = text.some((d) => /mcp/i.test(d)) || changes.length > 0 && !hooksMissing;
935
972
  return {
936
973
  adapter,
937
974
  detection,
938
- mcp: !mcpMissing,
939
- hooks: hasHooks ? !hooksMissing : null
975
+ mcp: partState(changes, "mcp"),
976
+ hooks: hasHooks ? partState(changes, "hooks") : null
940
977
  };
941
978
  } catch (e) {
942
979
  return {
943
980
  adapter,
944
981
  detection,
945
- mcp: false,
946
- hooks: hasHooks ? false : null,
982
+ mcp: "missing",
983
+ hooks: hasHooks ? "missing" : null,
947
984
  planError: plainError$1(e)
948
985
  };
949
986
  }
@@ -1003,7 +1040,7 @@ async function runDoctor(ctx, argv = []) {
1003
1040
  q("TIER"),
1004
1041
  q("NOTE")
1005
1042
  ]];
1006
- const yesNo = (v) => v === null ? q("n/a") : v ? "yes" : t.paint("warn", "not configured");
1043
+ const yesNo = (v) => v === null ? q("n/a") : v === "ok" ? "yes" : t.paint("warn", v === "missing" ? "not configured" : "needs update");
1007
1044
  for (const r of rows) {
1008
1045
  const { adapter, detection } = r;
1009
1046
  if (!detection.installed) {
@@ -1018,9 +1055,9 @@ async function runDoctor(ctx, argv = []) {
1018
1055
  ]);
1019
1056
  continue;
1020
1057
  }
1021
- const good = r.mcp === true && r.hooks !== false && !r.planError;
1058
+ const good = r.mcp === "ok" && (r.hooks === null || r.hooks === "ok") && !r.planError;
1022
1059
  let note = adapter.deliveryTier === "next_turn" ? "delivered at the next prompt" : "read through the inbox tool";
1023
- if (!good) note = r.planError ? "config could not be read" : "not fully configured";
1060
+ if (!good) note = r.planError ? "config could not be read" : r.mcp === "outdated" || r.hooks === "outdated" ? "needs an update" : "not fully configured";
1024
1061
  table.push([
1025
1062
  ` ${good ? t.status("ok") : t.status("warn")} ${adapter.cli}`,
1026
1063
  adapter.displayName,
@@ -1042,8 +1079,12 @@ async function runDoctor(ctx, argv = []) {
1042
1079
  } else if (good) ok++;
1043
1080
  else {
1044
1081
  warnings++;
1045
- const missing = [r.mcp === false ? "the MCP server" : "", r.hooks === false ? "the hooks" : ""].filter(Boolean).join(" and ");
1046
- notes.push(warnBlock(t, `${adapter.displayName} is missing ${missing}.`, `Run ${cmd(t, "conveno init")}, then restart open ${adapter.displayName} sessions.`));
1082
+ const named = [["the MCP server", r.mcp], ["the hooks", r.hooks]];
1083
+ const list = (state) => named.filter(([, s]) => s === state).map(([n]) => n).join(" and ");
1084
+ const missing = list("missing");
1085
+ const outdated = list("outdated");
1086
+ const fix = `Run ${cmd(t, "conveno init")}, then restart open ${adapter.displayName} sessions.`;
1087
+ notes.push(missing && outdated ? warnBlock(t, `${adapter.displayName} is missing ${missing} and needs an update to ${outdated}.`, fix) : missing ? warnBlock(t, `${adapter.displayName} is missing ${missing}.`, fix) : warnBlock(t, `${adapter.displayName} needs an update.`, fix, `Conveno's setup for ${outdated} is from an older version. ${cmd(t, "conveno init")} shows exactly which lines change.`));
1047
1088
  }
1048
1089
  }
1049
1090
  ctx.out(`${columns(table).join("\n")}\n`);
@@ -1056,7 +1097,7 @@ async function runDoctor(ctx, argv = []) {
1056
1097
  return problems > 0 ? 1 : 0;
1057
1098
  }
1058
1099
  // src/version.ts
1059
- const VERSION = "0.1.1-rc.1";
1100
+ const VERSION = "0.1.1-rc.2";
1060
1101
  // src/errorLog.ts
1061
1102
  /** The message of an unexpected error, as it is. Not the softened text `plainError` gives. */
1062
1103
  function rawMessage(e) {
@@ -1095,6 +1136,247 @@ async function writeErrorLog(ctx, argv, e) {
1095
1136
  return;
1096
1137
  }
1097
1138
  }
1139
+ // src/status.ts
1140
+ const CLI_SHORT = {
1141
+ claude: "cl",
1142
+ codex: "cx",
1143
+ opencode: "oc",
1144
+ antigravity: "ag",
1145
+ cursor: "cu",
1146
+ copilot: "cp"
1147
+ };
1148
+ const pad2 = (n) => String(n).padStart(2, "0");
1149
+ /** Local `HH:MM:SS`, with the date in front when it is not today. */
1150
+ function stamp(iso, now) {
1151
+ const d = new Date(iso);
1152
+ const time = `${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`;
1153
+ const day = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
1154
+ return day === `${now.getFullYear()}-${pad2(now.getMonth() + 1)}-${pad2(now.getDate())}` ? time : `${day} ${time}`;
1155
+ }
1156
+ function tierText(theme, tier) {
1157
+ switch (tier) {
1158
+ case "live": return theme.paint("entry", "live");
1159
+ case "next_turn": return "next turn";
1160
+ case "acp": return "ACP";
1161
+ case "inbox": return theme.paint("quiet", "inbox");
1162
+ }
1163
+ }
1164
+ function stateCell(theme, s) {
1165
+ if (s.status === "offline") return {
1166
+ glyph: theme.status("offline"),
1167
+ word: "offline"
1168
+ };
1169
+ if (s.status === "waiting_on_question") return {
1170
+ glyph: theme.status("waiting"),
1171
+ word: "waiting"
1172
+ };
1173
+ if (s.isOrchestrator) return {
1174
+ glyph: theme.status("orchestrator"),
1175
+ word: s.status
1176
+ };
1177
+ if (s.status === "busy") return {
1178
+ glyph: theme.glyph("busy"),
1179
+ word: "busy"
1180
+ };
1181
+ return {
1182
+ glyph: theme.status("idle"),
1183
+ word: "idle"
1184
+ };
1185
+ }
1186
+ /** Sessions grouped by repository, the way brand/components/terminal.md lays them out. */
1187
+ function renderSessions(ctx, sessions) {
1188
+ const t = ctx.theme;
1189
+ const now = ctx.now();
1190
+ const groups = /* @__PURE__ */ new Map();
1191
+ for (const s of sessions) {
1192
+ const key = s.repo?.root ?? s.cwd;
1193
+ groups.set(key, [...groups.get(key) ?? [], s]);
1194
+ }
1195
+ const blocks = [];
1196
+ for (const key of [...groups.keys()].sort()) {
1197
+ const list = (groups.get(key) ?? []).sort((a, b) => a.name.localeCompare(b.name));
1198
+ const q = (w) => t.paint("quiet", w);
1199
+ const [headLine, ...rowLines] = columns([[
1200
+ ` ${q("SESSION")}`,
1201
+ q("CLI"),
1202
+ q("TIER"),
1203
+ q("STATE"),
1204
+ q("LAST SEEN")
1205
+ ], ...list.map((s) => {
1206
+ const st = stateCell(t, s);
1207
+ return [
1208
+ `${st.glyph} ${t.bold(s.name)}`,
1209
+ CLI_SHORT[s.cli] ?? s.cli,
1210
+ tierText(t, s.deliveryTier),
1211
+ st.word,
1212
+ t.paint("quiet", stamp(s.lastSeenAt, now)),
1213
+ ...s.isOrchestrator ? [t.paint("entry", "orchestrator")] : []
1214
+ ];
1215
+ })]);
1216
+ blocks.push([
1217
+ ` ${t.bold(tilde(key, ctx.home))}`,
1218
+ ` ${headLine}`,
1219
+ ...rowLines.map((l) => ` ${l}`)
1220
+ ].join("\n"));
1221
+ }
1222
+ return blocks.join("\n\n");
1223
+ }
1224
+ async function runStatus(ctx, argv = []) {
1225
+ const t = ctx.theme;
1226
+ const spec = COMMANDS.find((c) => c.name === "status");
1227
+ let all = false;
1228
+ if (spec) {
1229
+ const parsed = parseFlags(ctx, spec, argv);
1230
+ if (typeof parsed === "number") return parsed;
1231
+ all = parsed.values.all === true;
1232
+ }
1233
+ let client;
1234
+ try {
1235
+ client = await ctx.connect(connectOpts(ctx, false));
1236
+ } catch (e) {
1237
+ const problem = daemonProblem(t, e);
1238
+ ctx.err(problem.notRunning ? warnBlock(t, "The Conveno daemon is not running.", `Run ${cmd(t, "conveno daemon start")}, or open a supported CLI after ${cmd(t, "conveno init")}.`, "Sessions are listed by the daemon, and nothing is listening on its socket.") : warnBlock(t, "The Conveno daemon cannot be reached.", problem.fix, problem.why));
1239
+ return 0;
1240
+ }
1241
+ try {
1242
+ const everyone = (await client["session.list"]({ includeOffline: true })).sessions;
1243
+ const sessions = all ? everyone : everyone.filter((s) => s.status !== "offline");
1244
+ const hidden = everyone.length - sessions.length;
1245
+ const repos = new Set(sessions.map((s) => s.repo?.root ?? s.cwd)).size;
1246
+ const hint = hidden > 0 ? `${hidden} offline hidden, ${cmd(t, "conveno status --all")} shows them` : "";
1247
+ ctx.out(`daemon up ${t.status("bullet")} relay: off (local only) ${t.status("bullet")} ${plural(sessions.length, "session")}\n`);
1248
+ if (sessions.length === 0) {
1249
+ ctx.out(hidden > 0 ? `\nNo sessions online. ${hint}.\n` : `\nNo sessions yet. Open a supported CLI after ${cmd(t, "conveno init")} and it appears here.\n`);
1250
+ return 0;
1251
+ }
1252
+ ctx.out(`\n${renderSessions(ctx, sessions)}\n\n`);
1253
+ ctx.out(`${plural(sessions.length, "session")} in ${plural(repos, "repo")}${hint ? ` ${t.status("bullet")} ${hint}` : ""}\n`);
1254
+ return 0;
1255
+ } finally {
1256
+ await client.close().catch(() => void 0);
1257
+ }
1258
+ }
1259
+ // src/forget.ts
1260
+ const UNIT_MS = {
1261
+ m: 6e4,
1262
+ h: 36e5,
1263
+ d: 864e5
1264
+ };
1265
+ /** `30m`, `24h` or `7d` as milliseconds, or undefined when the text is anything else. */
1266
+ function parseDuration(text) {
1267
+ const m = /^(\d{1,6})([mhd])$/.exec(text);
1268
+ if (!m) return void 0;
1269
+ const ms = Number(m[1]) * UNIT_MS[m[2]];
1270
+ return ms > 0 ? ms : void 0;
1271
+ }
1272
+ /** Rebuild the command line the user typed, for the "run it again with --yes" hint. */
1273
+ function rerunLine(names, flags) {
1274
+ return [
1275
+ "conveno forget",
1276
+ ...names.map((n) => n.includes("*") ? `'${n}'` : n),
1277
+ ...flags.offline ? ["--offline"] : [],
1278
+ ...flags.olderThan ? ["--older-than", flags.olderThan] : []
1279
+ ].join(" ");
1280
+ }
1281
+ async function runForget(ctx, argv) {
1282
+ const t = ctx.theme;
1283
+ const spec = COMMANDS.find((c) => c.name === "forget");
1284
+ if (!spec) return 2;
1285
+ const parsed = parseFlags(ctx, spec, argv);
1286
+ if (typeof parsed === "number") return parsed;
1287
+ const names = parsed.positionals;
1288
+ const offline = parsed.values.offline === true;
1289
+ const olderThan = typeof parsed.values["older-than"] === "string" ? parsed.values["older-than"] : void 0;
1290
+ const dryRun = parsed.values["dry-run"] === true;
1291
+ const yes = parsed.values.yes === true;
1292
+ const help = `Run ${cmd(t, "conveno forget --help")} to see the options.`;
1293
+ for (const n of names) if (!SessionNamePattern.safeParse(n).success) return fail$1(ctx, {
1294
+ what: `"${n}" is not a session name or pattern`,
1295
+ detail: ["Names use lowercase letters, digits and \".\", \"_\", \"@\" or \"-\". A \"*\" matches any run of characters."],
1296
+ fix: `Run ${cmd(t, "conveno status --all")} to see the names.`,
1297
+ exit: 2,
1298
+ ref: "e_usage"
1299
+ });
1300
+ let olderThanMs;
1301
+ if (olderThan !== void 0) {
1302
+ olderThanMs = parseDuration(olderThan);
1303
+ if (olderThanMs === void 0) return fail$1(ctx, {
1304
+ what: `"${olderThan}" is not a duration`,
1305
+ detail: ["Use a whole number and a unit: 30m for minutes, 24h for hours, 7d for days."],
1306
+ fix: help,
1307
+ exit: 2,
1308
+ ref: "e_usage"
1309
+ });
1310
+ }
1311
+ if (names.length === 0 && !offline && olderThanMs === void 0) return fail$1(ctx, {
1312
+ what: "conveno forget needs to know which sessions to forget",
1313
+ detail: ["Name them, or pass --offline for every offline session."],
1314
+ fix: `For example ${cmd(t, "conveno forget 'conveno-real-*'")} or ${cmd(t, "conveno forget --offline --older-than 7d")}.`,
1315
+ exit: 2,
1316
+ ref: "e_usage"
1317
+ });
1318
+ let client;
1319
+ try {
1320
+ client = await ctx.connect(connectOpts(ctx, false));
1321
+ } catch (e) {
1322
+ const problem = daemonProblem(t, e);
1323
+ return fail$1(ctx, {
1324
+ what: problem.notRunning ? "The Conveno daemon is not running" : "The Conveno daemon cannot be reached",
1325
+ detail: [problem.notRunning ? "Sessions live in the daemon, so there is nothing to forget until it runs." : problem.why],
1326
+ fix: problem.notRunning ? `Run ${cmd(t, "conveno daemon start")}.` : problem.fix,
1327
+ exit: 1,
1328
+ ref: "e_daemon"
1329
+ });
1330
+ }
1331
+ try {
1332
+ const selector = {
1333
+ ...names.length > 0 ? { names } : {},
1334
+ ...names.length === 0 || olderThanMs !== void 0 ? { olderThanMs: olderThanMs ?? 0 } : {}
1335
+ };
1336
+ const preview = await client["session.forget"]({
1337
+ ...selector,
1338
+ dryRun: true
1339
+ });
1340
+ const ids = new Set(preview.forgotten.map((s) => s.id));
1341
+ const picked = (await client["session.list"]({ includeOffline: true })).sessions.filter((s) => ids.has(s.id));
1342
+ if (preview.skippedOnline.length > 0) {
1343
+ ctx.out(`${t.status("warn")} ${t.bold(`Skipped ${plural(preview.skippedOnline.length, "online session")}`)}\n`);
1344
+ ctx.out(`${columns(preview.skippedOnline.map((s) => [` ${t.status("idle")} ${t.bold(s.name)}`, t.paint("quiet", "online, a running session is never forgotten")])).join("\n")}\n\n`);
1345
+ }
1346
+ if (picked.length === 0) {
1347
+ ctx.out(`${t.status("info")} Nothing to forget. ${t.paint("quiet", `${cmd(t, "conveno status --all")} lists the offline sessions.`)}\n`);
1348
+ return 0;
1349
+ }
1350
+ ctx.out(`${t.bold(dryRun ? `Would forget ${plural(picked.length, "session")}` : `Will forget ${plural(picked.length, "session")}`)}\n\n`);
1351
+ ctx.out(`${renderSessions(ctx, picked)}\n\n`);
1352
+ ctx.out(` ${t.paint("quiet", "Their queued messages are deleted too. Messages they sent stay with the receivers.")}\n\n`);
1353
+ if (dryRun) {
1354
+ ctx.out(`${t.status("info")} Dry run. Nothing was changed.\n`);
1355
+ return 0;
1356
+ }
1357
+ if (!yes) {
1358
+ if (!ctx.interactive) return fail$1(ctx, {
1359
+ what: "Needs a terminal to confirm",
1360
+ detail: ["No sessions were forgotten."],
1361
+ fix: `Run ${cmd(t, `${rerunLine(names, {
1362
+ offline,
1363
+ ...olderThan ? { olderThan } : {}
1364
+ })} --yes`)} to forget the sessions listed above.`,
1365
+ exit: 2,
1366
+ ref: "e_no_tty"
1367
+ });
1368
+ if (!await ctx.confirm(`Forget ${plural(picked.length, "session")}?`, false)) {
1369
+ ctx.out(`${t.status("info")} Nothing was changed.\n`);
1370
+ return 0;
1371
+ }
1372
+ }
1373
+ const done = await client["session.forget"]({ ids: [...ids] });
1374
+ ctx.out(`${t.status("ok")} ${t.bold("Done.")} Forgot ${plural(done.forgotten.length, "session")}.\n`);
1375
+ return 0;
1376
+ } finally {
1377
+ await client.close().catch(() => void 0);
1378
+ }
1379
+ }
1098
1380
  // src/hook.ts
1099
1381
  /**
1100
1382
  * Time allowed for the one process-table query behind the host pid. It runs beside reading
@@ -1745,126 +2027,6 @@ async function runInit(ctx, argv) {
1745
2027
  ctx.out(` Next: ${cmd(t, "conveno status")} lists your sessions.\n`);
1746
2028
  return 0;
1747
2029
  }
1748
- // src/status.ts
1749
- const CLI_SHORT = {
1750
- claude: "cl",
1751
- codex: "cx",
1752
- opencode: "oc",
1753
- antigravity: "ag",
1754
- cursor: "cu",
1755
- copilot: "cp"
1756
- };
1757
- const pad2 = (n) => String(n).padStart(2, "0");
1758
- /** Local `HH:MM:SS`, with the date in front when it is not today. */
1759
- function stamp(iso, now) {
1760
- const d = new Date(iso);
1761
- const time = `${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`;
1762
- const day = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
1763
- return day === `${now.getFullYear()}-${pad2(now.getMonth() + 1)}-${pad2(now.getDate())}` ? time : `${day} ${time}`;
1764
- }
1765
- function tierText(theme, tier) {
1766
- switch (tier) {
1767
- case "live": return theme.paint("entry", "live");
1768
- case "next_turn": return "next turn";
1769
- case "acp": return "ACP";
1770
- case "inbox": return theme.paint("quiet", "inbox");
1771
- }
1772
- }
1773
- function stateCell(theme, s) {
1774
- if (s.status === "offline") return {
1775
- glyph: theme.status("offline"),
1776
- word: "offline"
1777
- };
1778
- if (s.status === "waiting_on_question") return {
1779
- glyph: theme.status("waiting"),
1780
- word: "waiting"
1781
- };
1782
- if (s.isOrchestrator) return {
1783
- glyph: theme.status("orchestrator"),
1784
- word: s.status
1785
- };
1786
- if (s.status === "busy") return {
1787
- glyph: theme.glyph("busy"),
1788
- word: "busy"
1789
- };
1790
- return {
1791
- glyph: theme.status("idle"),
1792
- word: "idle"
1793
- };
1794
- }
1795
- /** Sessions grouped by repository, the way brand/components/terminal.md lays them out. */
1796
- function renderSessions(ctx, sessions) {
1797
- const t = ctx.theme;
1798
- const now = ctx.now();
1799
- const groups = /* @__PURE__ */ new Map();
1800
- for (const s of sessions) {
1801
- const key = s.repo?.root ?? s.cwd;
1802
- groups.set(key, [...groups.get(key) ?? [], s]);
1803
- }
1804
- const blocks = [];
1805
- for (const key of [...groups.keys()].sort()) {
1806
- const list = (groups.get(key) ?? []).sort((a, b) => a.name.localeCompare(b.name));
1807
- const q = (w) => t.paint("quiet", w);
1808
- const [headLine, ...rowLines] = columns([[
1809
- ` ${q("SESSION")}`,
1810
- q("CLI"),
1811
- q("TIER"),
1812
- q("STATE"),
1813
- q("LAST SEEN")
1814
- ], ...list.map((s) => {
1815
- const st = stateCell(t, s);
1816
- return [
1817
- `${st.glyph} ${t.bold(s.name)}`,
1818
- CLI_SHORT[s.cli] ?? s.cli,
1819
- tierText(t, s.deliveryTier),
1820
- st.word,
1821
- t.paint("quiet", stamp(s.lastSeenAt, now)),
1822
- ...s.isOrchestrator ? [t.paint("entry", "orchestrator")] : []
1823
- ];
1824
- })]);
1825
- blocks.push([
1826
- ` ${t.bold(tilde(key, ctx.home))}`,
1827
- ` ${headLine}`,
1828
- ...rowLines.map((l) => ` ${l}`)
1829
- ].join("\n"));
1830
- }
1831
- return blocks.join("\n\n");
1832
- }
1833
- async function runStatus(ctx, argv = []) {
1834
- const t = ctx.theme;
1835
- const spec = COMMANDS.find((c) => c.name === "status");
1836
- let all = false;
1837
- if (spec) {
1838
- const parsed = parseFlags(ctx, spec, argv);
1839
- if (typeof parsed === "number") return parsed;
1840
- all = parsed.values.all === true;
1841
- }
1842
- let client;
1843
- try {
1844
- client = await ctx.connect(connectOpts(ctx, false));
1845
- } catch (e) {
1846
- const problem = daemonProblem(t, e);
1847
- ctx.err(problem.notRunning ? warnBlock(t, "The Conveno daemon is not running.", `Run ${cmd(t, "conveno daemon start")}, or open a supported CLI after ${cmd(t, "conveno init")}.`, "Sessions are listed by the daemon, and nothing is listening on its socket.") : warnBlock(t, "The Conveno daemon cannot be reached.", problem.fix, problem.why));
1848
- return 0;
1849
- }
1850
- try {
1851
- const everyone = (await client["session.list"]({ includeOffline: true })).sessions;
1852
- const sessions = all ? everyone : everyone.filter((s) => s.status !== "offline");
1853
- const hidden = everyone.length - sessions.length;
1854
- const repos = new Set(sessions.map((s) => s.repo?.root ?? s.cwd)).size;
1855
- const hint = hidden > 0 ? `${hidden} offline hidden, ${cmd(t, "conveno status --all")} shows them` : "";
1856
- ctx.out(`daemon up ${t.status("bullet")} relay: off (local only) ${t.status("bullet")} ${plural(sessions.length, "session")}\n`);
1857
- if (sessions.length === 0) {
1858
- ctx.out(hidden > 0 ? `\nNo sessions online. ${hint}.\n` : `\nNo sessions yet. Open a supported CLI after ${cmd(t, "conveno init")} and it appears here.\n`);
1859
- return 0;
1860
- }
1861
- ctx.out(`\n${renderSessions(ctx, sessions)}\n\n`);
1862
- ctx.out(`${plural(sessions.length, "session")} in ${plural(repos, "repo")}${hint ? ` ${t.status("bullet")} ${hint}` : ""}\n`);
1863
- return 0;
1864
- } finally {
1865
- await client.close().catch(() => void 0);
1866
- }
1867
- }
1868
2030
  // src/uninstall.ts
1869
2031
  const NOTE = {
1870
2032
  restore: "restored byte for byte",
@@ -2043,6 +2205,7 @@ async function dispatch(command, rest, ctx) {
2043
2205
  case "init": return runInit(ctx, rest);
2044
2206
  case "uninstall": return runUninstall(ctx, rest);
2045
2207
  case "status": return runStatus(ctx, rest);
2208
+ case "forget": return runForget(ctx, rest);
2046
2209
  case "doctor": return runDoctor(ctx, rest);
2047
2210
  case "daemon": return runDaemon(ctx, rest);
2048
2211
  case "mcp": return runMcp(ctx, rest);
@@ -2266,6 +2429,8 @@ async function plan$1(env) {
2266
2429
  value: want
2267
2430
  }]);
2268
2431
  changes.push({
2432
+ component: "mcp",
2433
+ kind: servers["conveno"] === void 0 ? "add" : "update",
2269
2434
  path: p.mcp,
2270
2435
  before: mcpFile.raw,
2271
2436
  after,
@@ -2292,7 +2457,10 @@ async function plan$1(env) {
2292
2457
  command: hookCommand$1(env, e),
2293
2458
  timeout: 5
2294
2459
  }] }];
2460
+ const installed = HOOK_EVENTS$1.some((e) => groupsOf(hooks, e).some((g) => isObject(g) && Array.isArray(g.hooks) && g.hooks.some((h) => isObject(h) && isOurHookCommand(h.command))));
2295
2461
  changes.push({
2462
+ component: "hooks",
2463
+ kind: installed ? "update" : "add",
2296
2464
  path: p.settings,
2297
2465
  before: setFile.raw,
2298
2466
  after: editJson(setFile, missing.map((e) => ({
@@ -2309,6 +2477,8 @@ async function uninstallPlan$1(env) {
2309
2477
  const changes = [];
2310
2478
  const mcpFile = await loadJson(p.mcp);
2311
2479
  if ("conveno" in mcpObject(mcpFile.value, p.mcp)) changes.push({
2480
+ component: "mcp",
2481
+ kind: "remove",
2312
2482
  path: p.mcp,
2313
2483
  before: mcpFile.raw,
2314
2484
  after: editJson(mcpFile, [{
@@ -2346,6 +2516,8 @@ async function uninstallPlan$1(env) {
2346
2516
  value: void 0
2347
2517
  });
2348
2518
  changes.push({
2519
+ component: "hooks",
2520
+ kind: "remove",
2349
2521
  path: p.settings,
2350
2522
  before: setFile.raw,
2351
2523
  after: editJson(setFile, edits),
@@ -2553,6 +2725,8 @@ async function planHooks(env) {
2553
2725
  }
2554
2726
  if (!changed) return [];
2555
2727
  return [{
2728
+ component: "hooks",
2729
+ kind: HOOK_EVENTS.some((event) => asArray(hooks[event]).some((g) => handlersOf(g).some((h) => isOurs(asObject(h).command, event)))) ? "update" : "add",
2556
2730
  path,
2557
2731
  before,
2558
2732
  after: json({
@@ -2585,6 +2759,8 @@ async function uninstallHooks(env) {
2585
2759
  hooks: next
2586
2760
  } : rest;
2587
2761
  return [{
2762
+ component: "hooks",
2763
+ kind: "remove",
2588
2764
  path,
2589
2765
  before,
2590
2766
  after: json(after),
@@ -2613,6 +2789,8 @@ async function planMcp(env) {
2613
2789
  const spec = serverSpec(env, existing);
2614
2790
  if (matchesSpec(existing, spec)) return [];
2615
2791
  return [{
2792
+ component: "mcp",
2793
+ kind: existing ? "update" : "add",
2616
2794
  path,
2617
2795
  before,
2618
2796
  after: addServer(path, before ?? "", spec),
@@ -2624,6 +2802,8 @@ async function uninstallMcp(env) {
2624
2802
  const before = await readIfExists(path);
2625
2803
  if (before === null || !serverOf(parseToml(path, before))) return [];
2626
2804
  return [{
2805
+ component: "mcp",
2806
+ kind: "remove",
2627
2807
  path,
2628
2808
  before,
2629
2809
  after: removeServer(path, before),
@@ -2837,14 +3017,18 @@ async function plan(env) {
2837
3017
  const config = parseConfig(file);
2838
3018
  const shape = await chooseShape(env, config);
2839
3019
  const want = serverEntry(env, shape);
2840
- if (sameEntry(shape === "v1" ? v1Entry(config) : servers(config)?.[SERVER_NAME], want)) return [];
3020
+ const current = shape === "v1" ? v1Entry(config) : servers(config)?.[SERVER_NAME];
3021
+ if (sameEntry(current, want)) return [];
2841
3022
  let text = file.text === null || file.text.trim() === "" ? "{}\n" : file.text;
2842
3023
  const otherShape = shape === "v1" ? "v2" : "v1";
2843
- if ((otherShape === "v1" ? v1Entry(config) : servers(config)?.[SERVER_NAME]) !== void 0) text = applyEdits(text, modify(text, pathFor(otherShape), void 0, { formattingOptions: FORMAT }));
3024
+ const other = otherShape === "v1" ? v1Entry(config) : servers(config)?.[SERVER_NAME];
3025
+ if (other !== void 0) text = applyEdits(text, modify(text, pathFor(otherShape), void 0, { formattingOptions: FORMAT }));
2844
3026
  let after = applyEdits(text, modify(text, pathFor(shape), want, { formattingOptions: FORMAT }));
2845
3027
  if (!after.endsWith("\n")) after += "\n";
2846
3028
  const where = shape === "v1" ? `mcp.${SERVER_NAME}` : `mcp.servers.${SERVER_NAME}`;
2847
3029
  return [{
3030
+ component: "mcp",
3031
+ kind: current !== void 0 || other !== void 0 ? "update" : "add",
2848
3032
  path: file.path,
2849
3033
  before: file.text,
2850
3034
  after,
@@ -2867,6 +3051,8 @@ async function uninstallPlan(env) {
2867
3051
  }
2868
3052
  if (removed.length === 0) return [];
2869
3053
  return [{
3054
+ component: "mcp",
3055
+ kind: "remove",
2870
3056
  path: file.path,
2871
3057
  before: file.text,
2872
3058
  after: text,
@@ -3617,7 +3803,7 @@ function createTheme(opts = {}) {
3617
3803
  spinner
3618
3804
  };
3619
3805
  }
3620
- // ../daemon/dist/server-SkmEbdMw.js
3806
+ // ../daemon/dist/server-3CuE-17P.js
3621
3807
  /** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
3622
3808
  function defaultIsAlive(pid) {
3623
3809
  try {
@@ -3629,7 +3815,7 @@ function defaultIsAlive(pid) {
3629
3815
  }
3630
3816
  SessionId.parse("0".repeat(26));
3631
3817
  // ../mcp/dist/index.js
3632
- const SERVER_VERSION = "0.1.1-rc.1";
3818
+ const SERVER_VERSION = "0.1.1-rc.2";
3633
3819
  const ok = (text) => ({ content: [{
3634
3820
  type: "text",
3635
3821
  text
package/dist/daemon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { homedir } from "node:os";
3
- import { $ as makeResult, B as Message, G as SessionId, H as PROTOCOL_VERSION, I as DeviceId, J as encodeFrame, K as createLineDecoder, L as EVENT_NAMES, M as takeWithinBytes, N as tooManyUnreadMessage, O as readInbox, P as validateRename, Q as makeEventNotification, S as pendingForInjection, T as proofsMatch, U as RpcErrorCode, X as isSocketPathTooLong, Z as makeError, _ as holderAfterDeparture, a as ackEntries, at as socketPathTooLongMessage, b as newAuthNonce, c as clientProof, d as dataPaths, et as newDeviceId, f as detectRepo, g as generateSessionName, i as RESPONSE_BUDGET_BYTES, it as sanitizeLine, j as statusAfterLiveness, k as resolveRecipient, l as daemonProof, m as evaluateLiveness, nt as newSessionId, o as baseName, p as effectiveHolder, q as defaultSocketPath, rt as parseIpcRequest, s as claimOrchestrator, t as ConvenoError, tt as newMessageId, u as dataDir, v as isOnline, y as markDelivered } from "./dist-Do8KKOnN.js";
3
+ import { $ as makeError, A as resolveRecipient, C as pendingForInjection, E as proofsMatch, F as validateRename, J as createLineDecoder, K as SessionId, L as DeviceId, M as statusAfterLiveness, N as takeWithinBytes, P as tooManyUnreadMessage, Q as isSocketPathTooLong, R as EVENT_NAMES, U as PROTOCOL_VERSION, V as Message, W as RpcErrorCode, X as encodeFrame, Y as defaultSocketPath, _ as holderAfterDeparture, a as ackEntries, at as parseIpcRequest, b as nameMatchesPattern, c as clientProof, d as dataPaths, et as makeEventNotification, f as detectRepo, g as generateSessionName, i as RESPONSE_BUDGET_BYTES, it as newSessionId, k as readInbox, l as daemonProof, m as evaluateLiveness, nt as newDeviceId, o as baseName, ot as sanitizeLine, p as effectiveHolder, rt as newMessageId, s as claimOrchestrator, st as socketPathTooLongMessage, t as ConvenoError, tt as makeResult, u as dataDir, v as isOnline, x as newAuthNonce, y as markDelivered } from "./dist-C_wVdDv5.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { connect, createServer } from "node:net";
@@ -419,7 +419,7 @@ var Store = class {
419
419
  }
420
420
  };
421
421
  // ../daemon/src/server.ts
422
- const DAEMON_VERSION = "0.1.1-rc.1";
422
+ const DAEMON_VERSION = "0.1.1-rc.2";
423
423
  /** A connection that has not finished the handshake by then is closed. */
424
424
  const AUTH_TIMEOUT_MS = 5e3;
425
425
  /** Unread messages one session may hold. */
@@ -458,11 +458,12 @@ var Daemon = class {
458
458
  requestShutdown;
459
459
  log;
460
460
  authTimeoutMs;
461
+ pathExists;
461
462
  conns = /* @__PURE__ */ new Set();
462
463
  deviceId;
463
464
  idleSince;
464
465
  startedMs;
465
- constructor(store, token, now, isAlive, idleExitMs, requestIdleExit, requestShutdown, log, authTimeoutMs = AUTH_TIMEOUT_MS) {
466
+ constructor(store, token, now, isAlive, idleExitMs, requestIdleExit, requestShutdown, log, authTimeoutMs = AUTH_TIMEOUT_MS, pathExists = existsSync) {
466
467
  this.store = store;
467
468
  this.token = token;
468
469
  this.now = now;
@@ -472,6 +473,7 @@ var Daemon = class {
472
473
  this.requestShutdown = requestShutdown;
473
474
  this.log = log;
474
475
  this.authTimeoutMs = authTimeoutMs;
476
+ this.pathExists = pathExists;
475
477
  this.deviceId = store.deviceId();
476
478
  this.startedMs = now().getTime();
477
479
  this.idleSince = this.startedMs;
@@ -557,6 +559,7 @@ var Daemon = class {
557
559
  case "session.setStatus": return this.setStatus(req.params);
558
560
  case "session.list": return this.list(req.params);
559
561
  case "session.byHost": return this.byHost(req.params.pid);
562
+ case "session.forget": return this.forget(req.params);
560
563
  case "daemon.shutdown": return { ok: true };
561
564
  case "orchestrator.claim": return this.claim(req.params.sessionId);
562
565
  case "message.send": return this.sendMessage(req.params);
@@ -744,6 +747,53 @@ var Daemon = class {
744
747
  const only = holders.length === 1 ? holders[0] : void 0;
745
748
  return { session: only ? this.view(only) : null };
746
749
  }
750
+ /**
751
+ * Remove offline sessions on the owner's request. Selection: with `ids` or `names` the
752
+ * candidates are the sessions matching either; with neither, every session. `olderThanMs` then
753
+ * keeps only sessions last seen at least that long ago. Online candidates are never removed:
754
+ * those picked by `ids` or `names` come back in `skippedOnline`, and with `olderThanMs` alone
755
+ * they are ignored, since the caller asked for offline sessions. A removed session takes its
756
+ * mailbox with it, in one transaction.
757
+ */
758
+ forget(p) {
759
+ const nowMs = this.now().getTime();
760
+ const explicit = p.ids !== void 0 || p.names !== void 0;
761
+ const ids = new Set(p.ids ?? []);
762
+ const names = p.names ?? [];
763
+ const matched = this.store.allSessions().filter((r) => {
764
+ if (explicit && !ids.has(r.id) && !names.some((n) => nameMatchesPattern(n, r.name))) return false;
765
+ return p.olderThanMs === void 0 || nowMs - Date.parse(r.lastSeenAt) >= p.olderThanMs;
766
+ });
767
+ const brief = (r) => ({
768
+ id: r.id,
769
+ name: r.name
770
+ });
771
+ const offline = matched.filter((r) => r.status === "offline");
772
+ const skippedOnline = explicit ? matched.filter((r) => r.status !== "offline") : [];
773
+ if (!p.dryRun) this.forgetRows(offline);
774
+ return {
775
+ forgotten: offline.map(brief),
776
+ skippedOnline: skippedOnline.map(brief)
777
+ };
778
+ }
779
+ forgetRows(rows) {
780
+ if (rows.length === 0) return;
781
+ this.store.tx(() => {
782
+ for (const r of rows) this.store.deleteSession(r.id);
783
+ });
784
+ }
785
+ /**
786
+ * An offline session whose working folder (or repository root) has been missing for
787
+ * PRUNE_MISSING_FOLDER_AFTER_MS is forgotten. One with unread messages is left to the unread
788
+ * rule, so queued mail is never dropped early. One whose host process still runs is kept,
789
+ * because it can come back with a heartbeat.
790
+ */
791
+ workspaceGone(row, nowMs) {
792
+ if (nowMs - Date.parse(row.lastSeenAt) < 3e5) return false;
793
+ if (this.store.unreadCount(row.id) > 0) return false;
794
+ if (row.hostPid !== void 0 && this.isAlive(row.hostPid)) return false;
795
+ return !this.pathExists(row.cwd) || row.repoRoot !== void 0 && !this.pathExists(row.repoRoot);
796
+ }
747
797
  claim(sessionId) {
748
798
  this.requireSession(sessionId);
749
799
  const rows = this.store.allSessions();
@@ -877,6 +927,7 @@ var Daemon = class {
877
927
  * 2. Replaced by a newer live session with the same name, CLI and repo: delete after
878
928
  * PRUNE_SUPERSEDED_AFTER_MS.
879
929
  * 3. Otherwise delete after PRUNE_OFFLINE_AFTER_MS.
930
+ * Besides these rules, `workspaceGone` forgets an offline session whose folder has been gone a while.
880
931
  */
881
932
  shouldPrune(row, all, nowMs) {
882
933
  const offlineMs = nowMs - Date.parse(row.lastSeenAt);
@@ -890,7 +941,7 @@ var Daemon = class {
890
941
  const rows = this.store.allSessions();
891
942
  for (const row of rows) {
892
943
  if (row.status === "offline") {
893
- if (this.shouldPrune(row, rows, nowMs)) this.store.tx(() => this.store.deleteSession(row.id));
944
+ if (this.shouldPrune(row, rows, nowMs) || this.workspaceGone(row, nowMs)) this.forgetRows([row]);
894
945
  continue;
895
946
  }
896
947
  const lastSeenMs = Math.max(Date.parse(row.lastSeenAt), this.startedMs);
@@ -929,7 +980,7 @@ async function startDaemon(opts) {
929
980
  close().then(() => opts.onIdleExit?.());
930
981
  }, () => {
931
982
  close().then(() => opts.onShutdown?.());
932
- }, createDaemonLog(paths.daemonLog, { now }), opts.authTimeoutMs ?? 5e3);
983
+ }, createDaemonLog(paths.daemonLog, { now }), opts.authTimeoutMs ?? 5e3, opts.pathExists ?? existsSync);
933
984
  const srv = createServer((socket) => daemon.attach(socket));
934
985
  server = srv;
935
986
  await new Promise((resolve, reject) => {
@@ -164,6 +164,11 @@ const isReservedSessionName = (n) => RESERVED_SESSION_NAMES.includes(n);
164
164
  */
165
165
  const SessionNameInput = z.string().regex(SESSION_NAME_PATTERN, "invalid session name");
166
166
  /**
167
+ * A session name or a simple glob over names: the name characters plus `*`, which matches any run
168
+ * of characters (including none). Used by `session.forget`.
169
+ */
170
+ const SessionNamePattern = z.string().regex(/^[a-z0-9._@*-]{1,64}$/, "invalid session name pattern");
171
+ /**
167
172
  * Human-readable session name, unique per account. Reserved names are refused. ULIDs are
168
173
  * uppercase, names are lowercase, so ids and names never collide.
169
174
  */
@@ -437,6 +442,20 @@ const ListParams = z.object({
437
442
  cli: CliKind.optional(),
438
443
  includeOffline: z.boolean().default(false)
439
444
  });
445
+ const ForgetParams = z.object({
446
+ /** Sessions to forget, by id. */
447
+ ids: z.array(SessionId).min(1).max(100).optional(),
448
+ /** Exact names or `*` globs. A name or id selector is joined with `ids` by OR. */
449
+ names: z.array(SessionNamePattern).min(1).max(100).optional(),
450
+ /** Only sessions last seen at least this long ago. With no `ids` or `names`, every offline session this old. */
451
+ olderThanMs: z.number().int().min(0).optional(),
452
+ /** Report what would be forgotten and change nothing. */
453
+ dryRun: z.boolean().default(false)
454
+ }).refine((p) => p.ids !== void 0 || p.names !== void 0 || p.olderThanMs !== void 0, { message: "provide ids, names and/or olderThanMs" });
455
+ const ForgottenSession = z.object({
456
+ id: SessionId,
457
+ name: SessionName
458
+ });
440
459
  const sendShape = {
441
460
  ...sid,
442
461
  to: messageEnvelopeShape.to,
@@ -557,6 +576,13 @@ const ipcMethods = {
557
576
  params: z.object({ pid: z.number().int().positive() }),
558
577
  result: z.object({ session: Session.nullable() })
559
578
  },
579
+ "session.forget": {
580
+ params: ForgetParams,
581
+ result: z.object({
582
+ forgotten: z.array(ForgottenSession),
583
+ skippedOnline: z.array(ForgottenSession)
584
+ })
585
+ },
560
586
  "daemon.shutdown": {
561
587
  params: z.object({}),
562
588
  result: z.object({ ok: z.literal(true) })
@@ -1062,6 +1088,15 @@ function validateRename(sessionId, requested, sessions) {
1062
1088
  if (sessions.find((s) => s.id !== sessionId && isOnline(s) && s.name === requested)) throw new ConvenoError(RpcErrorCode.Conflict, `The name "${requested}" is already used by an active session. Pick a different name.`);
1063
1089
  return parsed.data;
1064
1090
  }
1091
+ /**
1092
+ * Does a session name match a pattern? A pattern is an exact name, or a simple glob where `*`
1093
+ * matches any run of characters, including none. Nothing else is special, and the dot is literal.
1094
+ */
1095
+ function nameMatchesPattern(pattern, name) {
1096
+ if (!pattern.includes("*")) return pattern === name;
1097
+ const source = pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join(".*");
1098
+ return new RegExp(`^${source}$`).test(name);
1099
+ }
1065
1100
  /** The current holder, treating an offline or unknown holder as nobody. */
1066
1101
  function effectiveHolder(holder, sessions) {
1067
1102
  if (holder === null) return null;
@@ -1467,4 +1502,4 @@ async function detectRepo(cwd, fs) {
1467
1502
  basename: baseName(cwd)
1468
1503
  };
1469
1504
  }
1470
- export { makeResult as $, resolveWindowsCommand as A, Message as B, pendingHookContext as C, readCommandLine as D, readAncestry as E, CLI_KINDS as F, SessionId as G, PROTOCOL_VERSION as H, DeviceId as I, encodeFrame as J, createLineDecoder as K, EVENT_NAMES as L, takeWithinBytes as M, tooManyUnreadMessage as N, readInbox as O, validateRename as P, makeEventNotification as Q, EVENT_NOTIFICATION_METHOD as R, pendingForInjection as S, proofsMatch as T, RpcErrorCode as U, MessageId as V, RpcResponse as W, isSocketPathTooLong as X, ipcMethods as Y, makeError as Z, holderAfterDeparture as _, ackEntries as a, socketPathTooLongMessage as at, newAuthNonce as b, clientProof as c, dataPaths as d, newDeviceId as et, detectRepo as f, generateSessionName as g, formatInbox as h, RESPONSE_BUDGET_BYTES as i, sanitizeLine as it, statusAfterLiveness as j, resolveRecipient as k, daemonProof as l, evaluateLiveness as m, HEARTBEAT_INTERVAL_MS as n, newSessionId as nt, baseName as o, effectiveHolder as p, defaultSocketPath as q, NOT_FROM_USER_NOTICE as r, parseIpcRequest as rt, claimOrchestrator as s, ConvenoError as t, newMessageId as tt, dataDir as u, isOnline as v, planSpawn as w, parseCliVersion as x, markDelivered as y, EventPayload as z };
1505
+ export { makeError as $, resolveRecipient as A, EventPayload as B, pendingForInjection as C, readAncestry as D, proofsMatch as E, validateRename as F, RpcResponse as G, MessageId as H, CLI_KINDS as I, createLineDecoder as J, SessionId as K, DeviceId as L, statusAfterLiveness as M, takeWithinBytes as N, readCommandLine as O, tooManyUnreadMessage as P, isSocketPathTooLong as Q, EVENT_NAMES as R, parseCliVersion as S, planSpawn as T, PROTOCOL_VERSION as U, Message as V, RpcErrorCode as W, encodeFrame as X, defaultSocketPath as Y, ipcMethods as Z, holderAfterDeparture as _, ackEntries as a, parseIpcRequest as at, nameMatchesPattern as b, clientProof as c, dataPaths as d, makeEventNotification as et, detectRepo as f, generateSessionName as g, formatInbox as h, RESPONSE_BUDGET_BYTES as i, newSessionId as it, resolveWindowsCommand as j, readInbox as k, daemonProof as l, evaluateLiveness as m, HEARTBEAT_INTERVAL_MS as n, newDeviceId as nt, baseName as o, sanitizeLine as ot, effectiveHolder as p, SessionNamePattern as q, NOT_FROM_USER_NOTICE as r, newMessageId as rt, claimOrchestrator as s, socketPathTooLongMessage as st, ConvenoError as t, makeResult as tt, dataDir as u, isOnline as v, pendingHookContext as w, newAuthNonce as x, markDelivered as y, EVENT_NOTIFICATION_METHOD as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conveno/cli",
3
- "version": "0.1.1-rc.1",
3
+ "version": "0.1.1-rc.2",
4
4
  "description": "Connect AI coding CLI sessions so they can message each other.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -46,15 +46,15 @@
46
46
  "zod": "4.6.7"
47
47
  },
48
48
  "devDependencies": {
49
- "@conveno/adapter-claude": "0.1.1-rc.1",
50
- "@conveno/adapter-codex": "0.1.1-rc.1",
51
- "@conveno/adapter-opencode": "0.1.1-rc.1",
52
- "@conveno/brand": "0.1.1-rc.1",
53
- "@conveno/client": "0.1.1-rc.1",
54
- "@conveno/core": "0.1.1-rc.1",
55
- "@conveno/daemon": "0.1.1-rc.1",
56
- "@conveno/mcp": "0.1.1-rc.1",
57
- "@conveno/protocol": "0.1.1-rc.1"
49
+ "@conveno/adapter-claude": "0.1.1-rc.2",
50
+ "@conveno/adapter-codex": "0.1.1-rc.2",
51
+ "@conveno/adapter-opencode": "0.1.1-rc.2",
52
+ "@conveno/brand": "0.1.1-rc.2",
53
+ "@conveno/client": "0.1.1-rc.2",
54
+ "@conveno/core": "0.1.1-rc.2",
55
+ "@conveno/daemon": "0.1.1-rc.2",
56
+ "@conveno/mcp": "0.1.1-rc.2",
57
+ "@conveno/protocol": "0.1.1-rc.2"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown",