@conveno/cli 0.2.0-rc.7 → 0.2.0-rc.9

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,11 +1,11 @@
1
- import { D as completeLogin, E as compatStatus, H as fetchAccountStatus, M as dataPaths, Tt as requestDeviceCode, U as findOnPath, Xt as CLI_KINDS, Yt as writeSettings, _t as readAccountTokens, d as SPAWN_TABLE, dt as pinnedAdapter, g as adapterNpxCommand, h as adapterInstallCommand, kt as resolveAcpProgram, m as acpOverrideVar, mt as pollDeviceCode, n as AccountError, tt as logoutAccount, xt as readSettings } from "./dist-D2hMvcZu.js";
1
+ import { A as completeLogin, F as dataPaths, G as fetchAccountStatus, K as findOnPath, Lt as resolveAcpProgram, Nt as requestDeviceCode, St as pollDeviceCode, Tt as readAccountTokens, an as CLI_KINDS, d as SPAWN_TABLE, g as adapterNpxCommand, h as adapterInstallCommand, in as writeSettings, k as compatStatus, kt as readSettings, m as acpOverrideVar, n as AccountError, st as logoutAccount, vt as pinnedAdapter } from "./dist-STNJjbNH.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 { i as parseFlags, t as COMMANDS } from "./args-C7Agak9f.js";
3
+ import { a as parseFlags, n as COMMANDS } from "./args-B3Cj2Ie4.js";
4
4
  import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
5
- import { t as daemonProblem } from "./daemonError-DNAKEyRT.js";
5
+ import { t as daemonProblem } from "./daemonError-C05GqdhQ.js";
6
6
  import { basename, dirname, join } from "node:path";
7
7
  import { spawn } from "node:child_process";
8
- import { chmod, mkdir, open, readFile, readdir, realpath, rename as rename$1, rm, rmdir, stat, writeFile } from "node:fs/promises";
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
11
11
  const accountIo = (ctx, io) => ({
@@ -140,6 +140,193 @@ async function runAccount(ctx, argv, io = {}) {
140
140
  return accountFailure(ctx, e, "Could not read your account");
141
141
  }
142
142
  }
143
+ // src/daemon.ts
144
+ async function lockPid(ctx) {
145
+ try {
146
+ const raw = await readFile(dataPaths(ctx.platform, ctx.dataDir).lock, "utf8");
147
+ const pid = JSON.parse(raw).pid;
148
+ return typeof pid === "number" && Number.isInteger(pid) && pid > 0 ? pid : null;
149
+ } catch {
150
+ return null;
151
+ }
152
+ }
153
+ const sleep$1 = (ms) => new Promise((r) => setTimeout(r, ms));
154
+ /** Does something on the socket answer the Conveno handshake? */
155
+ async function reachable(ctx) {
156
+ try {
157
+ await (await ctx.connect(connectOpts(ctx, false))).close().catch(() => void 0);
158
+ return true;
159
+ } catch {
160
+ return false;
161
+ }
162
+ }
163
+ const lockExists = (ctx) => access(dataPaths(ctx.platform, ctx.dataDir).lock).then(() => true, () => false);
164
+ /** Poll until `done()` holds or `ms` pass. Returns whether it held. */
165
+ async function waitFor(done, ms) {
166
+ const deadline = Date.now() + ms;
167
+ for (;;) {
168
+ if (await done()) return true;
169
+ if (Date.now() >= deadline) return false;
170
+ await sleep$1(50);
171
+ }
172
+ }
173
+ const norm = (text) => text.replaceAll("\\", "/").toLowerCase();
174
+ /**
175
+ * Does this command line belong to the Conveno daemon? It must run the daemon's entry script: the
176
+ * one this install resolved, any installed `@conveno/cli`'s `daemon.js`, or the `bin.js` of the
177
+ * `@conveno/daemon` package that releases before 0.1.1 started.
178
+ */
179
+ function isConvenoDaemonCommand(commandLine, daemonEntry) {
180
+ const line = norm(commandLine);
181
+ if (daemonEntry !== void 0 && line.includes(norm(daemonEntry))) return true;
182
+ return /@conveno\/cli\/(?:[^ ]+\/)?daemon\.js|@conveno\/daemon\/(?:[^ ]+\/)?bin\.js/.test(line);
183
+ }
184
+ const STOP_FIX = (t) => `then run ${cmd(t, "conveno daemon status")}`;
185
+ /**
186
+ * `conveno daemon stop`. The normal path asks the daemon to shut itself down over the control
187
+ * channel (`daemon.shutdown`), the way Docker and pm2 do. That needs no signal and no external
188
+ * tool, so it works for a normal user in a Windows SSH session. Only when the daemon does not answer,
189
+ * and its lock pid is verified to be the daemon, is the process ended directly.
190
+ */
191
+ async function stopDaemon(ctx, plain = false) {
192
+ const t = ctx.theme;
193
+ const lock = dataPaths(ctx.platform, ctx.dataDir).lock;
194
+ const pid = await lockPid(ctx);
195
+ const named = pid === null ? "" : ` (pid ${pid})`;
196
+ let client;
197
+ try {
198
+ client = await ctx.connect(connectOpts(ctx, false));
199
+ } catch {
200
+ client = void 0;
201
+ }
202
+ if (client) {
203
+ try {
204
+ await client["daemon.shutdown"]({});
205
+ } catch (e) {
206
+ await client.close().catch(() => void 0);
207
+ return fail(ctx, {
208
+ what: `The background service${named} did not accept the stop request`,
209
+ detail: [plainError(e)],
210
+ fix: `${pid === null ? "Stop the process that owns the daemon socket yourself" : `Stop pid ${pid} yourself`}, ${STOP_FIX(t)}.`,
211
+ exit: 1,
212
+ ref: "e_daemon_stop"
213
+ });
214
+ }
215
+ await client.close().catch(() => void 0);
216
+ if (!await waitFor(async () => !await reachable(ctx) && !await lockExists(ctx) && (pid === null || !ctx.isAlive(pid)), ctx.stopTimeoutMs)) return fail(ctx, {
217
+ what: `The background service${named} is still running after ${Math.round(ctx.stopTimeoutMs / 1e3)}s`,
218
+ detail: ["It accepted the stop request, but its process, socket or lock file is still there."],
219
+ fix: `${pid === null ? "Stop the process that owns the daemon socket yourself" : `Stop pid ${pid} yourself`}, ${STOP_FIX(t)}.`,
220
+ exit: 1,
221
+ ref: "e_daemon_stop"
222
+ });
223
+ ctx.out(`${t.status("ok")} Stopped ${plain ? "Conveno's background service" : "the daemon"}${named}.\n`);
224
+ return 0;
225
+ }
226
+ if (pid === null) {
227
+ ctx.out(`${t.status("info")} Conveno's background service is not running. Nothing to stop.\n`);
228
+ return 0;
229
+ }
230
+ const stale = async () => {
231
+ await rm(lock, { force: true }).catch(() => void 0);
232
+ ctx.out(`${t.status("info")} Nothing answered as the Conveno daemon, so no process was stopped. Removed the stale lock file (it named pid ${pid}).\n`);
233
+ return 0;
234
+ };
235
+ if (!ctx.isAlive(pid)) return stale();
236
+ const commandLine = await ctx.commandLineOf(pid);
237
+ if (commandLine === null) return fail(ctx, {
238
+ what: `The background service did not answer, and pid ${pid} could not be checked`,
239
+ detail: ["Conveno could not read that process's command line, so it cannot tell whether it is the daemon. It stopped nothing."],
240
+ fix: `If pid ${pid} is the Conveno daemon, end it yourself (Task Manager on Windows, \`kill ${pid}\` elsewhere), ${STOP_FIX(t)}.`,
241
+ exit: 1,
242
+ ref: "e_daemon_lock"
243
+ });
244
+ if (!isConvenoDaemonCommand(commandLine, ctx.daemonEntry)) return stale();
245
+ try {
246
+ ctx.kill(pid);
247
+ } catch (e) {
248
+ return fail(ctx, {
249
+ what: `Could not stop the daemon (pid ${pid})`,
250
+ detail: [plainError(e)],
251
+ fix: `Stop that process yourself, ${STOP_FIX(t)}.`,
252
+ exit: 1,
253
+ ref: "e_daemon_stop"
254
+ });
255
+ }
256
+ if (!await waitFor(() => !ctx.isAlive(pid), ctx.stopTimeoutMs)) return fail(ctx, {
257
+ what: `The background service (pid ${pid}) is still running after ${Math.round(ctx.stopTimeoutMs / 1e3)}s`,
258
+ detail: ["It did not answer, was ended, and has not exited."],
259
+ fix: `Stop that process yourself, ${STOP_FIX(t)}.`,
260
+ exit: 1,
261
+ ref: "e_daemon_stop"
262
+ });
263
+ await rm(lock, { force: true }).catch(() => void 0);
264
+ ctx.out(`${t.status("ok")} Stopped ${plain ? "Conveno's background service" : "the daemon"} (pid ${pid}). It was not answering, so it was ended directly.\n`);
265
+ return 0;
266
+ }
267
+ /**
268
+ * Stop the daemon if one is running, and say nothing when none is. Used before `conveno uninstall`
269
+ * changes any file, because a running daemon keeps files open (on Windows that blocks removing them).
270
+ * Returns 0 when nothing is left running, else the exit code of the failed stop.
271
+ */
272
+ async function stopDaemonIfRunning(ctx) {
273
+ if (!await reachable(ctx)) {
274
+ const pid = await lockPid(ctx);
275
+ if (pid === null || !ctx.isAlive(pid)) return 0;
276
+ }
277
+ return stopDaemon(ctx, true);
278
+ }
279
+ const SUBCOMMANDS = [
280
+ "start",
281
+ "stop",
282
+ "status"
283
+ ];
284
+ async function runDaemon(ctx, argv) {
285
+ const t = ctx.theme;
286
+ const sub = argv[0];
287
+ if (sub === "start") {
288
+ try {
289
+ await (await ctx.connect(connectOpts(ctx, true))).close().catch(() => void 0);
290
+ } catch (e) {
291
+ const problem = daemonProblem(t, e);
292
+ return fail(ctx, {
293
+ what: "The Conveno daemon did not start",
294
+ detail: [problem.why],
295
+ fix: problem.notRunning ? `Run ${cmd(t, "conveno doctor")} to check the install, then try again.` : problem.fix,
296
+ exit: 1,
297
+ ref: "e_daemon_start"
298
+ });
299
+ }
300
+ const pid = await lockPid(ctx);
301
+ ctx.out(`${t.status("ok")} Daemon running${pid ? `, pid ${pid}` : ""}.\n`);
302
+ return 0;
303
+ }
304
+ if (sub === "status") {
305
+ const pid = await lockPid(ctx);
306
+ try {
307
+ await (await ctx.connect(connectOpts(ctx, false))).close().catch(() => void 0);
308
+ ctx.out(`${t.status("ok")} daemon running${pid ? `, pid ${pid}` : ""}\n`);
309
+ return 0;
310
+ } catch (e) {
311
+ const problem = daemonProblem(t, e);
312
+ if (problem.notRunning) ctx.out(`${t.glyph("offline")} daemon not running\n`);
313
+ else {
314
+ ctx.out(`${t.status("error")} daemon cannot be reached\n`);
315
+ ctx.err(warnBlock(t, "Conveno's background service cannot be reached.", problem.fix, problem.why));
316
+ }
317
+ return 1;
318
+ }
319
+ }
320
+ if (sub === "stop") return stopDaemon(ctx);
321
+ const suggestion = sub ? closest(sub, SUBCOMMANDS) : void 0;
322
+ return fail(ctx, {
323
+ what: sub ? `Unknown daemon command "${sub}"` : "conveno daemon needs a command",
324
+ fix: `Run ${cmd(t, "conveno daemon start")}, ${cmd(t, "conveno daemon stop")} or ${cmd(t, "conveno daemon status")}.`,
325
+ ...suggestion ? { didYouMean: `Did you mean ${suggestion}?` } : {},
326
+ exit: 2,
327
+ ref: "e_usage"
328
+ });
329
+ }
143
330
  const PAIR_TIMEOUT_MS = 3e5;
144
331
  /**
145
332
  * Run `run` with a daemon client. Commands that change something start the daemon when needed;
@@ -777,14 +964,14 @@ const realIo = {
777
964
  * compare it with the plan just before writing, and `applyChanges` restores every file from its
778
965
  * backup if any write fails. No temp file exists on this path, so none can be left behind.
779
966
  */
780
- async function writeAtomic(path, data, io = realIo) {
967
+ async function writeAtomic(path, data, io = realIo, wantMode) {
781
968
  const target = await io.realpath(path).catch(() => path);
782
969
  await io.mkdir(dirname(target));
783
970
  if (io.platform === "win32") {
784
971
  await io.overwrite(target, data);
785
972
  return;
786
973
  }
787
- const mode = await io.mode(target);
974
+ const mode = wantMode ?? await io.mode(target);
788
975
  const tmp = join(dirname(target), `.${basename(target)}.conveno-${randomBytes(6).toString("hex")}.tmp`);
789
976
  try {
790
977
  await io.writeFile(tmp, data, mode ?? 420);
@@ -848,7 +1035,8 @@ async function applyChanges(ctx, items, opts = {}) {
848
1035
  path: change.path,
849
1036
  backup,
850
1037
  description: change.description,
851
- ...change.deleteFile ? {} : { afterSha256: sha256(change.after) }
1038
+ ...change.deleteFile ? {} : { afterSha256: sha256(change.after) },
1039
+ ...change.pruneEmptyDir === void 0 ? {} : { pruneEmptyDir: change.pruneEmptyDir }
852
1040
  });
853
1041
  }
854
1042
  const manifest = {
@@ -881,12 +1069,8 @@ async function applyChanges(ctx, items, opts = {}) {
881
1069
  await currentIfUnchanged(change);
882
1070
  if (change.deleteFile) {
883
1071
  await io.rm(change.path);
884
- let dir = dirname(change.path);
885
- for (let n = change.pruneEmptyDir === true ? 1 : change.pruneEmptyDir ?? 0; n > 0; n--) {
886
- if (!await rmdir(dir).then(() => true, () => false)) break;
887
- dir = dirname(dir);
888
- }
889
- } else await writeAtomic(change.path, change.after, io);
1072
+ if (change.pruneEmptyDir !== void 0) await pruneEmptyDirs(change.path, change.pruneEmptyDir);
1073
+ } else await writeAtomic(change.path, change.after, io, change.mode);
890
1074
  }
891
1075
  how.push({
892
1076
  cli,
@@ -979,12 +1163,22 @@ async function previewRestore(manifests) {
979
1163
  }
980
1164
  return rows;
981
1165
  }
1166
+ /** Remove up to `levels` empty folders above `file`, stopping at the first one with anything in it. */
1167
+ async function pruneEmptyDirs(file, levels) {
1168
+ let dir = dirname(file);
1169
+ for (let n = levels === true ? 1 : levels; n > 0; n--) {
1170
+ if (!await rmdir(dir).then(() => true, () => false)) break;
1171
+ dir = dirname(dir);
1172
+ }
1173
+ }
982
1174
  /** Restore one file as init found it, when it still matches. Returns the action taken. */
983
1175
  async function restoreEntry(dir, entry) {
984
1176
  const bytes = await readBytes(entry.path);
985
1177
  const action = actionFor(entry, bytes === null ? null : sha256(bytes));
986
- if (action === "remove") await rm(entry.path, { force: true });
987
- else if (action === "restore" && entry.backup !== null) await writeAtomic(entry.path, await readFile(join(dir, entry.backup)));
1178
+ if (action === "remove") {
1179
+ await rm(entry.path, { force: true });
1180
+ if (entry.pruneEmptyDir !== void 0) await pruneEmptyDirs(entry.path, entry.pruneEmptyDir);
1181
+ } else if (action === "restore" && entry.backup !== null) await writeAtomic(entry.path, await readFile(join(dir, entry.backup)));
988
1182
  return action;
989
1183
  }
990
1184
  async function markRestored(ctx, found) {
@@ -995,8 +1189,8 @@ async function markRestored(ctx, found) {
995
1189
  await writeFile(join(found.dir, MANIFEST_NAME), `${JSON.stringify(done, null, 2)}\n`, { mode: 384 });
996
1190
  }
997
1191
  // src/init.ts
998
- const CODEX_NOTE = "Codex asks you to trust new hooks once: run /hooks inside Codex.";
999
- const CURSOR_NOTE = "Cursor CLI can ask to approve the Conveno MCP server when you start it in your home folder. Approve it once there with: cursor-agent mcp enable conveno";
1192
+ const CODEX_NOTE = "Codex asks you to approve Conveno once: run /hooks inside Codex.";
1193
+ const CURSOR_NOTE = "Cursor can ask you to approve Conveno when you start it in your home folder. Approve it once there with: cursor-agent mcp enable conveno";
1000
1194
  /** Detect every adapter. A detection that throws counts as not installed. */
1001
1195
  async function detectAll(ctx, adapters = ctx.adapters) {
1002
1196
  const env = adapterEnv(ctx);
@@ -1039,7 +1233,7 @@ function parseCliList(raw, ctx) {
1039
1233
  }
1040
1234
  function printDetections(ctx, found) {
1041
1235
  const t = ctx.theme;
1042
- ctx.out(`${t.bold("Looking for AI coding CLIs on this machine")}\n`);
1236
+ ctx.out(`${t.bold("Looking for AI tools on this machine")}\n`);
1043
1237
  const rows = found.map(({ adapter, detection }) => detection.installed ? [
1044
1238
  ` ${t.status("ok")} ${adapter.cli}`,
1045
1239
  adapter.displayName,
@@ -1054,11 +1248,14 @@ async function collectPlans(ctx, found, which, baseline, accept = []) {
1054
1248
  const items = [];
1055
1249
  const failures = [];
1056
1250
  for (const { adapter, detection } of found) try {
1057
- for (const change of await (which === "plan" ? adapter.plan(env, { accept }) : adapter.uninstallPlan(env, baseline))) items.push({
1058
- cli: adapter.cli,
1059
- installed: detection.installed,
1060
- change
1061
- });
1251
+ for (const change of await (which === "plan" ? adapter.plan(env, { accept }) : adapter.uninstallPlan(env, baseline))) {
1252
+ if (items.some((i) => i.change.path === change.path && i.change.after === change.after)) continue;
1253
+ items.push({
1254
+ cli: adapter.cli,
1255
+ installed: detection.installed,
1256
+ change
1257
+ });
1258
+ }
1062
1259
  } catch (e) {
1063
1260
  failures.push({
1064
1261
  cli: adapter.cli,
@@ -1090,8 +1287,10 @@ const staleFailure = (ctx, e, rerun) => fail(ctx, {
1090
1287
  async function confirmAndApply(ctx, items, opts) {
1091
1288
  const t = ctx.theme;
1092
1289
  const files = new Set(items.map((i) => i.change.path)).size;
1093
- ctx.out(`${t.bold(`Conveno will change ${plural(files, "file")}.`)} Nothing else is touched.\n\n`);
1290
+ const notes = opts.notes ?? [];
1291
+ ctx.out(`${t.bold(`Conveno will change ${plural(files, "file")}.`)}${notes.length > 0 ? "" : " Nothing else is touched."}\n\n`);
1094
1292
  presentChanges(ctx, items);
1293
+ for (const n of notes) ctx.out(` ${n}\n\n`);
1095
1294
  const paths = dataPaths(ctx.platform, ctx.dataDir);
1096
1295
  ctx.out(` ${t.paint("quiet", `Backups go to ${tilde(paths.backups, ctx.home)}/<timestamp>/`)}\n`);
1097
1296
  ctx.out(` ${t.paint("quiet", "Undo any time with:")} ${cmd(t, "conveno uninstall")}\n\n`);
@@ -1108,8 +1307,12 @@ async function confirmAndApply(ctx, items, opts) {
1108
1307
  return { exit: 0 };
1109
1308
  }
1110
1309
  }
1310
+ if (opts.beforeApply) {
1311
+ const code = await opts.beforeApply();
1312
+ if (code !== 0) return { exit: code };
1313
+ }
1111
1314
  try {
1112
- return { applied: await applyChanges(ctx, items, opts.markRestored ? { markRestored: true } : {}) };
1315
+ return { applied: await applyChanges(ctx, [...items, ...opts.backups ?? []], opts.markRestored ? { markRestored: true } : {}) };
1113
1316
  } catch (e) {
1114
1317
  if (e instanceof StaleError) return { exit: staleFailure(ctx, e, opts.rerun) };
1115
1318
  if (e instanceof ApplyError && !e.rolledBack) return { exit: fail(ctx, {
@@ -1128,30 +1331,167 @@ async function confirmAndApply(ctx, items, opts) {
1128
1331
  }) };
1129
1332
  }
1130
1333
  }
1131
- /** Every optional question for these CLIs that is not yet turned on. `enabled` throwing counts as on: nothing to offer. */
1334
+ /**
1335
+ * Every optional question for these CLIs that is not yet turned on. `enabled` throwing counts as
1336
+ * on: nothing to offer. So does an option the tool cannot take (`available` false).
1337
+ */
1132
1338
  async function pendingOptions(ctx, adapters) {
1133
1339
  const env = adapterEnv(ctx);
1134
1340
  const out = [];
1135
1341
  for (const a of adapters) for (const o of a.optional ?? []) {
1342
+ if (o.available && !await o.available(env).catch(() => false)) continue;
1136
1343
  if (await o.enabled(env).catch(() => true)) continue;
1137
1344
  out.push({
1138
1345
  cli: a.cli,
1139
1346
  id: o.id,
1140
- question: o.question
1347
+ question: o.question,
1348
+ defaultYes: o.defaultYes === true
1141
1349
  });
1142
1350
  }
1143
1351
  return out;
1144
1352
  }
1353
+ /**
1354
+ * Run the follow-up step of the options answered yes, for options that are not file edits (they
1355
+ * have `apply`). Each failure comes back as one friendly line and never stops the setup.
1356
+ */
1357
+ async function applyOptions(ctx, adapters, accepted) {
1358
+ const env = adapterEnv(ctx);
1359
+ const yes = new Set(accepted);
1360
+ const done = [];
1361
+ const problems = [];
1362
+ for (const a of adapters) for (const o of a.optional ?? []) {
1363
+ if (!yes.has(o.id) || !o.apply) continue;
1364
+ try {
1365
+ const r = await o.apply(env);
1366
+ if (r.ok) done.push({
1367
+ cli: a.cli,
1368
+ id: o.id
1369
+ });
1370
+ else problems.push(r.message);
1371
+ } catch {
1372
+ problems.push(`Couldn't finish setting up ${a.displayName}.`);
1373
+ }
1374
+ }
1375
+ return {
1376
+ done,
1377
+ problems
1378
+ };
1379
+ }
1380
+ /**
1381
+ * Whether setup has taken care of a tool's first-run approvals: true when every approval option it
1382
+ * has is in place. Undefined when the tool has none, so its note is unchanged.
1383
+ */
1384
+ async function approvedBySetup(ctx, adapter) {
1385
+ const env = adapterEnv(ctx);
1386
+ const approvals = (adapter.optional ?? []).filter((o) => o.approval === true);
1387
+ if (approvals.length === 0) return void 0;
1388
+ for (const o of approvals) if (!await o.enabled(env).catch(() => false)) return false;
1389
+ return true;
1390
+ }
1391
+ /**
1392
+ * Approval options that are already on for a tool this run changes. Codex calls a hook it has
1393
+ * trusted "modified" once its command changes (a moved `conveno`), so the approval is given again.
1394
+ */
1395
+ async function renewedApprovals(ctx, adapters, items) {
1396
+ const env = adapterEnv(ctx);
1397
+ const ids = [];
1398
+ for (const a of adapters) {
1399
+ if (!items.some((i) => i.cli === a.cli)) continue;
1400
+ for (const o of a.optional ?? []) {
1401
+ if (o.approval !== true || !o.apply) continue;
1402
+ if (o.available && !await o.available(env).catch(() => false)) continue;
1403
+ if (await o.enabled(env).catch(() => false)) ids.push(o.id);
1404
+ }
1405
+ }
1406
+ return ids;
1407
+ }
1408
+ /**
1409
+ * What the options answered yes write outside the plan: a line for each, and the files as
1410
+ * no-change entries so they are backed up with the rest (a file the plan already changes is not
1411
+ * listed twice, and a file that does not exist has nothing to back up).
1412
+ */
1413
+ async function approvalWrites(ctx, adapters, ids, items) {
1414
+ const env = adapterEnv(ctx);
1415
+ const notes = [];
1416
+ const backups = [];
1417
+ for (const a of adapters) for (const o of a.optional ?? []) {
1418
+ if (!ids.has(o.id) || !o.applyWrites) continue;
1419
+ const w = o.applyWrites(env);
1420
+ notes.push(w.note);
1421
+ for (const path of w.paths) {
1422
+ if ([...items, ...backups].some((i) => i.change.path === path)) continue;
1423
+ const text = await readFile(path, "utf8").catch(() => null);
1424
+ if (text === null) continue;
1425
+ backups.push({
1426
+ cli: a.cli,
1427
+ installed: true,
1428
+ change: {
1429
+ component: "hooks",
1430
+ kind: "update",
1431
+ path,
1432
+ before: text,
1433
+ after: text,
1434
+ description: `${a.displayName} approval of Conveno's hooks, written by ${a.displayName}.`
1435
+ }
1436
+ });
1437
+ }
1438
+ }
1439
+ return {
1440
+ notes,
1441
+ backups
1442
+ };
1443
+ }
1444
+ /**
1445
+ * After a tool wrote its own approval into a backed-up file, record the file as it is now, so
1446
+ * `conveno uninstall` still sees it as the one setup left and can restore the backup.
1447
+ */
1448
+ async function refreshManifest(backupDir, paths) {
1449
+ const file = join(backupDir, "manifest.json");
1450
+ try {
1451
+ const manifest = JSON.parse(await readFile(file, "utf8"));
1452
+ let changed = false;
1453
+ for (const e of manifest.entries) {
1454
+ if (!paths.includes(e.path)) continue;
1455
+ const now = await readFile(e.path).catch(() => null);
1456
+ if (now === null) continue;
1457
+ e.afterSha256 = sha256(now);
1458
+ changed = true;
1459
+ }
1460
+ if (changed) await writeFile(file, `${JSON.stringify(manifest, null, 2)}\n`, { mode: 384 });
1461
+ } catch {}
1462
+ }
1145
1463
  /** The changes `with` has that `base` does not: a different file, or the same file with other text. */
1146
1464
  function extraChanges(base, withOpt) {
1147
1465
  const had = new Set(base.map((i) => `${i.change.path}\0${i.change.after}\0${i.change.kind}`));
1148
1466
  return withOpt.filter((i) => !had.has(`${i.change.path}\0${i.change.after}\0${i.change.kind}`));
1149
1467
  }
1150
- async function runInit(ctx, argv) {
1468
+ /** `conveno setup` and its older name `conveno init`. Both end here. */
1469
+ async function runInit(ctx, argv, name = "init") {
1470
+ const first = COMMANDS.find((c) => c.name === name);
1471
+ const early = first ? parseFlags(ctx, first, argv) : void 0;
1472
+ if (typeof early === "number") return early;
1473
+ const lead = early?.values.lead;
1474
+ if (typeof lead === "string" && !CLI_KINDS.includes(lead)) {
1475
+ const suggestion = closest(lead, [...CLI_KINDS]);
1476
+ return fail(ctx, {
1477
+ what: `Unknown AI tool "${lead}" for --lead`,
1478
+ detail: [`Known AI tools: ${CLI_KINDS.join(", ")}.`],
1479
+ fix: `Pass ${cmd(ctx.theme, `--lead ${CLI_KINDS[0]}`)} or leave it out.`,
1480
+ ...suggestion ? { didYouMean: `Did you mean ${suggestion}?` } : {},
1481
+ exit: 2,
1482
+ ref: "e_usage"
1483
+ });
1484
+ }
1151
1485
  const outcome = {};
1152
- const code = await initSetup(ctx, argv, outcome);
1153
- if (code !== 0 || !outcome.offer) return code;
1154
- const spec = COMMANDS.find((c) => c.name === "init");
1486
+ const code = await initSetup(ctx, argv, outcome, name);
1487
+ if (code !== 0) return code;
1488
+ if (typeof lead === "string" && early?.values["dry-run"] !== true) {
1489
+ writeSettings(dataPaths(ctx.platform, ctx.dataDir).settings, { leadCli: lead });
1490
+ const shown = ctx.adapters.find((a) => a.cli === lead)?.displayName ?? lead;
1491
+ ctx.out(`${ctx.theme.status("ok")} ${shown} will lead when it starts and nobody else leads.\n`);
1492
+ }
1493
+ if (!outcome.offer) return code;
1494
+ const spec = COMMANDS.find((c) => c.name === name);
1155
1495
  const parsed = spec ? parseFlags(ctx, spec, argv) : void 0;
1156
1496
  const values = typeof parsed === "object" ? parsed.values : {};
1157
1497
  await offerAcpAdapters(ctx, {
@@ -1161,17 +1501,17 @@ async function runInit(ctx, argv) {
1161
1501
  });
1162
1502
  return 0;
1163
1503
  }
1164
- async function initSetup(ctx, argv, outcome) {
1504
+ async function initSetup(ctx, argv, outcome, name) {
1165
1505
  const t = ctx.theme;
1166
1506
  const started = ctx.now();
1167
- const spec = COMMANDS.find((c) => c.name === "init");
1507
+ const spec = COMMANDS.find((c) => c.name === name);
1168
1508
  if (!spec) return 2;
1169
1509
  const parsed = parseFlags(ctx, spec, argv);
1170
1510
  if (typeof parsed === "number") return parsed;
1171
1511
  const values = parsed.values;
1172
1512
  if (values["acp-adapters"] === true && values["no-acp-adapters"] === true) return fail(ctx, {
1173
1513
  what: "Use --acp-adapters or --no-acp-adapters, not both",
1174
- fix: `Run ${cmd(t, "conveno init --help")} to see the options.`,
1514
+ fix: `Run ${cmd(t, `conveno ${name} --help`)} to see the options.`,
1175
1515
  exit: 2,
1176
1516
  ref: "e_usage"
1177
1517
  });
@@ -1187,9 +1527,9 @@ async function initSetup(ctx, argv, outcome) {
1187
1527
  printDetections(ctx, found);
1188
1528
  const installed = found.filter((f) => f.detection.installed);
1189
1529
  if (installed.length === 0) return fail(ctx, {
1190
- what: "No supported AI coding CLI was found",
1530
+ what: "No supported AI tool was found",
1191
1531
  detail: [`Looked for ${chosen.map((a) => a.displayName).join(", ")} on PATH.`],
1192
- fix: "Install one of them, then run conveno init again.",
1532
+ fix: `Install one of them, then run conveno ${name} again.`,
1193
1533
  exit: 1,
1194
1534
  ref: "e_no_cli"
1195
1535
  });
@@ -1201,7 +1541,7 @@ async function initSetup(ctx, argv, outcome) {
1201
1541
  if (!known.has(id)) return fail(ctx, {
1202
1542
  what: `Unknown option "${id}" for --accept`,
1203
1543
  detail: [known.size > 0 ? `Known: ${[...known].join(", ")}.` : "There are none."],
1204
- fix: `Run ${cmd(t, "conveno init --help")} to see the options.`,
1544
+ fix: `Run ${cmd(t, `conveno ${name} --help`)} to see the options.`,
1205
1545
  exit: 2,
1206
1546
  ref: "e_usage"
1207
1547
  });
@@ -1212,14 +1552,19 @@ async function initSetup(ctx, argv, outcome) {
1212
1552
  const dryRun = Boolean(values["dry-run"]);
1213
1553
  for (const o of pending) {
1214
1554
  if (accepted.has(o.id)) continue;
1215
- if (dryRun || values.yes === true || !ctx.interactive) continue;
1216
- if (await ctx.confirm(o.question, false)) accepted.add(o.id);
1555
+ if (dryRun || values.yes === true || !ctx.interactive) {
1556
+ if (acceptRaw === void 0 && o.defaultYes) accepted.add(o.id);
1557
+ continue;
1558
+ }
1559
+ if (await ctx.confirm(o.question, o.defaultYes)) accepted.add(o.id);
1217
1560
  }
1218
1561
  const { items, failures } = await collectPlans(ctx, installed, "plan", void 0, [...accepted]);
1219
1562
  if (failures.length > 0) {
1220
- reportFailures(ctx, failures, "conveno init --cli <others>");
1563
+ reportFailures(ctx, failures, `conveno ${name} --cli <others>`);
1221
1564
  return 1;
1222
1565
  }
1566
+ const adapters = installed.map((f) => f.adapter);
1567
+ const applying = /* @__PURE__ */ new Set([...accepted, ...dryRun ? [] : await renewedApprovals(ctx, adapters, items)]);
1223
1568
  const extras = [];
1224
1569
  if (dryRun) for (const o of pending) {
1225
1570
  if (accepted.has(o.id)) continue;
@@ -1231,39 +1576,84 @@ async function initSetup(ctx, argv, outcome) {
1231
1576
  }
1232
1577
  if (items.length === 0 && extras.length === 0) {
1233
1578
  ctx.out(`${t.status("ok")} Conveno is already set up for ${installed.map((f) => f.adapter.cli).join(", ")}. Nothing to change.\n`);
1579
+ if (!dryRun) await approveTools(ctx, installed, accepted, /* @__PURE__ */ new Set());
1234
1580
  outcome.offer = installed.map((f) => f.adapter);
1235
1581
  return 0;
1236
1582
  }
1237
1583
  if (dryRun) {
1238
1584
  const files = new Set(items.map((i) => i.change.path)).size;
1239
- ctx.out(`${t.bold(`Conveno would change ${plural(files, "file")}.`)} Nothing else is touched.\n\n`);
1585
+ const { notes } = await approvalWrites(ctx, installed.map((f) => f.adapter), applying, items);
1586
+ ctx.out(`${t.bold(`Conveno would change ${plural(files, "file")}.`)}${notes.length > 0 ? "" : " Nothing else is touched."}\n\n`);
1240
1587
  presentChanges(ctx, items);
1588
+ for (const n of notes) ctx.out(` ${n}\n\n`);
1241
1589
  for (const x of extras) {
1242
1590
  ctx.out(`${t.bold(x.option.question)}\n ${t.paint("quiet", `Not turned on. With --accept ${x.option.id} Conveno would also change:`)}\n\n`);
1243
1591
  presentChanges(ctx, x.items);
1244
1592
  }
1245
- ctx.out(`${t.status("info")} Dry run: nothing was written. Run ${cmd(t, "conveno init")} to apply.\n`);
1593
+ ctx.out(`${t.status("info")} Dry run: nothing was written. Run ${cmd(t, `conveno ${name}`)} to apply.\n`);
1246
1594
  return 0;
1247
1595
  }
1596
+ const writes = await approvalWrites(ctx, adapters, applying, items);
1248
1597
  const result = await confirmAndApply(ctx, items, {
1249
1598
  yes: values.yes === true,
1250
1599
  verb: "Apply",
1251
- rerun: "conveno init"
1600
+ rerun: `conveno ${name}`,
1601
+ notes: writes.notes,
1602
+ backups: writes.backups
1252
1603
  });
1253
1604
  if ("exit" in result) return result.exit;
1254
1605
  const byCli = /* @__PURE__ */ new Map();
1255
1606
  for (const h of result.applied.how) byCli.set(h.cli, [...byCli.get(h.cli) ?? [], h.via]);
1256
- const rows = [...byCli].map(([cli, vias]) => [` ${t.status("ok")} ${cli}`, vias.every((v) => v === "command") ? "configured with the CLI's own command" : "configured"]);
1607
+ const rows = [...byCli].map(([cli, vias]) => [` ${t.status("ok")} ${cli}`, vias.every((v) => v === "command") ? "set up with its own command" : "configured"]);
1257
1608
  ctx.out(`${columns(rows).join("\n")}\n\n`);
1258
1609
  ctx.out(`${t.status("ok")} ${t.bold("Done.")} ${seconds(started, ctx.now())}\n`);
1259
1610
  ctx.out(` Backups are in ${tilde(result.applied.backupDir, ctx.home)}.\n`);
1260
1611
  ctx.out(" Restart open sessions so they pick up Conveno.\n");
1261
- if (byCli.has("codex")) ctx.out(`${t.status("info")} ${CODEX_NOTE}\n`);
1612
+ const approved = await approveTools(ctx, installed, applying, new Set(byCli.keys()), result.applied.backupDir);
1613
+ if (byCli.has("codex") && !approved.has("codex")) ctx.out(`${t.status("info")} ${CODEX_NOTE}\n`);
1262
1614
  if (byCli.has("cursor")) ctx.out(`${t.status("info")} ${CURSOR_NOTE}\n`);
1263
1615
  ctx.out(` Next: ${cmd(t, "conveno status")} lists your sessions.\n`);
1264
1616
  outcome.offer = installed.map((f) => f.adapter);
1265
1617
  return 0;
1266
1618
  }
1619
+ /**
1620
+ * Runs the follow-up of the options answered yes and says what it did. Returns the tools whose
1621
+ * first-run approvals are now in place among `touched`, so their note is left out.
1622
+ */
1623
+ async function approveTools(ctx, installed, accepted, touched, backupDir) {
1624
+ const t = ctx.theme;
1625
+ const adapters = installed.map((f) => f.adapter);
1626
+ const { done, problems } = await applyOptions(ctx, adapters, accepted);
1627
+ if (backupDir && done.length > 0) {
1628
+ const env = adapterEnv(ctx);
1629
+ const ids = new Set(done.map((d) => d.id));
1630
+ await refreshManifest(backupDir, adapters.flatMap((a) => (a.optional ?? []).flatMap((o) => ids.has(o.id) && o.applyWrites ? o.applyWrites(env).paths : [])));
1631
+ }
1632
+ for (const d of done) {
1633
+ const name = adapters.find((a) => a.cli === d.cli)?.displayName ?? d.cli;
1634
+ ctx.out(`${t.status("ok")} Approved Conveno in ${name}.\n`);
1635
+ }
1636
+ for (const p of problems) ctx.out(`${t.status("info")} ${p}\n`);
1637
+ const approved = /* @__PURE__ */ new Set();
1638
+ for (const a of adapters) {
1639
+ if (!touched.has(a.cli)) continue;
1640
+ if (await approvedBySetup(ctx, a) === true) approved.add(a.cli);
1641
+ }
1642
+ return approved;
1643
+ }
1644
+ /**
1645
+ * `conveno setup`. In a terminal with no --yes it opens the onboarding in the app. Anywhere else
1646
+ * it does what `conveno init` does, and also saves --lead.
1647
+ */
1648
+ async function runSetup(ctx, argv) {
1649
+ const spec = COMMANDS.find((c) => c.name === "setup");
1650
+ if (!spec) return 2;
1651
+ const parsed = parseFlags(ctx, spec, argv);
1652
+ if (typeof parsed === "number") return parsed;
1653
+ const v = parsed.values;
1654
+ if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-BPtFUGtu.js")).runTui(ctx, { start: "setup" });
1655
+ return runInit(ctx, argv, "setup");
1656
+ }
1267
1657
  // src/doctor.ts
1268
1658
  /** What the plan says about one part: nothing to do, an addition, or an update to what is there. */
1269
1659
  function partState(changes, component) {
@@ -1312,9 +1702,10 @@ async function inspect(ctx, adapter) {
1312
1702
  };
1313
1703
  const hasHooks = adapter.deliveryTier !== "inbox" || hasAny(adapter.delivery?.(detection));
1314
1704
  let idleWake;
1315
- if (adapter.optional && adapter.optional.length > 0) {
1705
+ const wakeOptions = (adapter.optional ?? []).filter((o) => o.approval !== true);
1706
+ if (wakeOptions.length > 0) {
1316
1707
  idleWake = true;
1317
- for (const o of adapter.optional) if (!await o.enabled(env).catch(() => false)) idleWake = false;
1708
+ for (const o of wakeOptions) if (!await o.enabled(env).catch(() => false)) idleWake = false;
1318
1709
  }
1319
1710
  const adapterNotes = await adapter.doctorNotes?.(env).catch(() => []);
1320
1711
  try {
@@ -1498,4 +1889,146 @@ async function runDoctor(ctx, argv = []) {
1498
1889
  ctx.out(`\n${ok} ok, ${plural(warnings, "warning")}, ${plural(problems, "problem")}\n`);
1499
1890
  return problems > 0 ? 1 : 0;
1500
1891
  }
1501
- export { runLogout as C, runLogin as S, PAIR_TIMEOUT_MS as _, detectAll as a, openInBrowser as b, runInit as c, applyChanges as d, listManifests as f, unifiedDiff as g, restoreEntry as h, confirmAndApply as i, staleFailure as l, previewRestore as m, runDoctor as n, pendingOptions as o, markRestored as p, collectPlans as r, reportFailures as s, inspect as t, StaleError as u, runDevices as v, runAccount as x, runRelay as y };
1892
+ // src/uninstall.ts
1893
+ const NOTE = {
1894
+ restore: "restored byte for byte",
1895
+ remove: "removed, it did not exist before",
1896
+ edit: "edited since setup, so only Conveno's entries are removed",
1897
+ gone: "already gone, left as it is"
1898
+ };
1899
+ /** The "asked once" markers the Grok and Antigravity Stop hooks keep in the data folder. */
1900
+ async function removeAskedMarkers(ctx) {
1901
+ for (const folder of ["grok-watch-asked", "agy-relay-asked"]) await rm(join(ctx.dataDir, folder), {
1902
+ recursive: true,
1903
+ force: true
1904
+ }).catch(() => void 0);
1905
+ }
1906
+ /**
1907
+ * The files as init found them, from the backups: their text, or null when they did not exist. A
1908
+ * backup that cannot be read leaves its file out, and the adapter then treats what it finds as
1909
+ * Conveno's own.
1910
+ */
1911
+ async function baselineOf(dir, entries) {
1912
+ const out = /* @__PURE__ */ new Map();
1913
+ for (const e of entries) if (e.backup === null) out.set(e.path, null);
1914
+ else try {
1915
+ out.set(e.path, await readFile(join(dir, e.backup), "utf8"));
1916
+ } catch {}
1917
+ return out;
1918
+ }
1919
+ /** Remove Conveno's own entries from files that changed since init, through each adapter. */
1920
+ async function removeOwnEntries(ctx, dir, entries) {
1921
+ if (entries.length === 0) return {
1922
+ edited: [],
1923
+ failures: []
1924
+ };
1925
+ const clis = new Set(entries.map((e) => e.cli));
1926
+ const { items, failures } = await collectPlans(ctx, (await detectAll(ctx)).filter((f) => clis.has(f.adapter.cli)), "uninstallPlan", await baselineOf(dir, entries));
1927
+ const wanted = new Set(entries.map((e) => e.path));
1928
+ const mine = items.filter((i) => wanted.has(i.change.path));
1929
+ if (mine.length > 0) await applyChanges(ctx, mine, { markRestored: true });
1930
+ return {
1931
+ edited: mine.map((i) => i.change.path),
1932
+ failures
1933
+ };
1934
+ }
1935
+ async function restoreAll(ctx, manifests) {
1936
+ const restored = [];
1937
+ const edited = [];
1938
+ const untouched = [];
1939
+ for (const found of manifests) {
1940
+ const needEdit = [];
1941
+ for (const entry of found.manifest.entries) {
1942
+ const action = await restoreEntry(found.dir, entry);
1943
+ if (action === "edit") needEdit.push(entry);
1944
+ else if (action === "gone") untouched.push(entry.path);
1945
+ else restored.push(entry.path);
1946
+ }
1947
+ const r = await removeOwnEntries(ctx, found.dir, needEdit);
1948
+ if (r.failures.length > 0) {
1949
+ reportFailures(ctx, r.failures, "conveno uninstall");
1950
+ throw new Error("A config file could not be read, so it was left as it is.");
1951
+ }
1952
+ edited.push(...r.edited);
1953
+ for (const e of needEdit) if (!r.edited.includes(e.path)) untouched.push(e.path);
1954
+ await markRestored(ctx, found);
1955
+ }
1956
+ return {
1957
+ restored,
1958
+ edited,
1959
+ untouched
1960
+ };
1961
+ }
1962
+ async function runUninstall(ctx, argv) {
1963
+ const t = ctx.theme;
1964
+ const started = ctx.now();
1965
+ const spec = COMMANDS.find((c) => c.name === "uninstall");
1966
+ if (!spec) return 2;
1967
+ const parsed = parseFlags(ctx, spec, argv);
1968
+ if (typeof parsed === "number") return parsed;
1969
+ const yes = parsed.values.yes === true;
1970
+ const manifests = await listManifests(ctx).catch(() => []);
1971
+ if (manifests.length > 0) {
1972
+ const rows = await previewRestore(manifests);
1973
+ const made = manifests.map((m) => localStamp(m.manifest.createdAt));
1974
+ ctx.out(`${t.bold(`Conveno will undo ${plural(manifests.length, "install")}`)}, made ${made.join(", ")} (local time).\n\n`);
1975
+ ctx.out(`${columns(rows.map((r) => [` ${tilde(r.entry.path, ctx.home)}`, t.paint("quiet", NOTE[r.action])])).join("\n")}\n\n`);
1976
+ if (!yes) {
1977
+ if (!ctx.interactive) return fail(ctx, {
1978
+ what: "Needs a terminal to confirm",
1979
+ detail: ["No files were changed."],
1980
+ fix: `Run ${cmd(t, "conveno uninstall --yes")} to undo the changes listed above.`,
1981
+ exit: 2,
1982
+ ref: "e_no_tty"
1983
+ });
1984
+ if (!await ctx.confirm("Undo these changes?", false)) {
1985
+ ctx.out(`${t.status("info")} Nothing was changed.\n`);
1986
+ return 0;
1987
+ }
1988
+ }
1989
+ const stopped = await stopDaemonIfRunning(ctx);
1990
+ if (stopped !== 0) return stopped;
1991
+ let result;
1992
+ try {
1993
+ result = await restoreAll(ctx, manifests);
1994
+ } catch (e) {
1995
+ if (e instanceof StaleError) return staleFailure(ctx, e, "conveno uninstall");
1996
+ return fail(ctx, {
1997
+ what: "Could not restore a file",
1998
+ detail: [plainError(e), `The backups are still in ${tilde(manifests[0]?.dir ?? ctx.dataDir, ctx.home)} and the other backup folders next to it.`],
1999
+ fix: "Fix the problem above, then run conveno uninstall again.",
2000
+ exit: 1,
2001
+ ref: "e_restore"
2002
+ });
2003
+ }
2004
+ await removeAskedMarkers(ctx);
2005
+ ctx.out(`${t.status("ok")} ${t.bold("Done.")} ${seconds(started, ctx.now())}\n`);
2006
+ ctx.out(` Restored ${plural(result.restored.length, "file")} to how they were before setup.\n`);
2007
+ if (result.edited.length > 0) ctx.out(` Edited, not restored, because they changed since setup: ${result.edited.map((p) => tilde(p, ctx.home)).join(", ")}. Only Conveno's entries were removed.\n`);
2008
+ ctx.out(" Restart open sessions to drop Conveno.\n");
2009
+ return 0;
2010
+ }
2011
+ const { items, failures } = await collectPlans(ctx, await detectAll(ctx), "uninstallPlan");
2012
+ if (failures.length > 0) {
2013
+ reportFailures(ctx, failures, "conveno uninstall");
2014
+ return 1;
2015
+ }
2016
+ if (items.length === 0) {
2017
+ ctx.out(`${t.status("ok")} Nothing to remove. No Conveno entries were found in any supported CLI.\n`);
2018
+ return 0;
2019
+ }
2020
+ ctx.out(`${t.status("info")} No install backup found, so Conveno will remove only its own entries.\n\n`);
2021
+ const result = await confirmAndApply(ctx, items, {
2022
+ yes,
2023
+ verb: "Remove",
2024
+ rerun: "conveno uninstall",
2025
+ markRestored: true,
2026
+ beforeApply: () => stopDaemonIfRunning(ctx)
2027
+ });
2028
+ if ("exit" in result) return result.exit;
2029
+ await removeAskedMarkers(ctx);
2030
+ ctx.out(`${t.status("ok")} ${t.bold("Done.")} ${seconds(started, ctx.now())}\n`);
2031
+ ctx.out(" Removed the Conveno entries. Restart open sessions to drop Conveno.\n");
2032
+ return 0;
2033
+ }
2034
+ 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 };