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

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,7 +1,7 @@
1
1
  import { writeFileSync } from "node:fs";
2
- import { n as runAcpHostFromFile, r as stopRequestPath, t as killProcessTree } from "./dist-DOKVrSIw.js";
3
- import { It as spawnRecordPath, St as readSpawnRecord } from "./dist-D2hMvcZu.js";
4
- import { i as parseFlags, t as COMMANDS } from "./args-C7Agak9f.js";
2
+ import { n as runAcpHostFromFile, r as stopRequestPath, t as killProcessTree } from "./dist-BlWWt5gx.js";
3
+ import { It as spawnRecordPath, St as readSpawnRecord } from "./dist-BBdba94T.js";
4
+ import { a as parseFlags, n as COMMANDS } from "./args-CGL-AmNd.js";
5
5
  import { a as fail, n as cmd } from "./fmt-C2SsP5Y0.js";
6
6
  // src/acp.ts
7
7
  /** How long `conveno stop` waits for a worker to end by itself before it ends the process tree. */
@@ -1,6 +1,6 @@
1
1
  import { execFile } from "node:child_process";
2
- import { t as RELAY_SUBCOMMAND } from "./dist-D9Gu-mQm.js";
3
- import { Nt as runWaker } from "./dist-D2hMvcZu.js";
2
+ import { t as RELAY_SUBCOMMAND } from "./dist-B6Sm0MRT.js";
3
+ import { Nt as runWaker } from "./dist-BBdba94T.js";
4
4
  import { n as connectOpts } from "./ctx-tYftvhz_.js";
5
5
  // src/agy-relay.ts
6
6
  /**
@@ -1,67 +1,93 @@
1
1
  import { parseArgs } from "node:util";
2
2
  import { a as fail, n as cmd, t as closest } from "./fmt-C2SsP5Y0.js";
3
+ // src/args.ts
4
+ const SETUP_FLAGS = {
5
+ yes: {
6
+ type: "boolean",
7
+ short: "y",
8
+ help: "Apply without asking"
9
+ },
10
+ "dry-run": {
11
+ type: "boolean",
12
+ help: "Show the changes and write nothing"
13
+ },
14
+ cli: {
15
+ type: "string",
16
+ value: "<list>",
17
+ help: "Only these AI tools, separated by commas or spaces, such as claude,codex"
18
+ },
19
+ accept: {
20
+ type: "string",
21
+ value: "<ids>",
22
+ help: "Say yes to these extras without asking, such as copilot-idle-wake"
23
+ },
24
+ "acp-adapters": {
25
+ type: "boolean",
26
+ help: "Let ACP workers fetch the Codex and Claude adapters with npx, without asking"
27
+ },
28
+ "no-acp-adapters": {
29
+ type: "boolean",
30
+ help: "Do not let ACP workers fetch adapters; print how to install them"
31
+ }
32
+ };
3
33
  const COMMANDS = [
4
34
  {
5
- name: "init",
6
- usage: "conveno init [--yes] [--dry-run] [--cli <list>] [--acp-adapters | --no-acp-adapters]",
7
- summary: "Set up every supported CLI that is installed",
35
+ name: "setup",
36
+ usage: "conveno setup [--yes] [--dry-run] [--cli <list>] [--lead <cli>]",
37
+ summary: "Connect Conveno to your AI tools",
8
38
  flags: {
9
- yes: {
10
- type: "boolean",
11
- short: "y",
12
- help: "Apply without asking"
13
- },
14
- "dry-run": {
15
- type: "boolean",
16
- help: "Show the changes and write nothing"
17
- },
18
- cli: {
19
- type: "string",
20
- value: "<list>",
21
- help: "Only these CLIs, separated by commas or spaces, such as claude,codex"
22
- },
23
- accept: {
39
+ ...SETUP_FLAGS,
40
+ lead: {
24
41
  type: "string",
25
- value: "<ids>",
26
- help: "Say yes to these optional setups without asking, such as copilot-idle-wake"
27
- },
28
- "acp-adapters": {
29
- type: "boolean",
30
- help: "Let ACP workers fetch the Codex and Claude adapters with npx, without asking"
31
- },
32
- "no-acp-adapters": {
33
- type: "boolean",
34
- help: "Do not let ACP workers fetch adapters; print how to install them"
42
+ value: "<cli>",
43
+ help: "The AI tool that should lead when it starts, such as claude"
35
44
  }
36
45
  },
37
46
  notes: [
38
- "init shows every file it will change, with a diff, and asks first.",
47
+ "In a terminal, setup walks you through it. With --yes, or without a terminal, it applies the changes without a walk-through.",
48
+ "Setup shows every file it will change and asks first. Without a terminal it needs --yes, and exits 2 without it.",
49
+ "Extras, such as Copilot idle wake (it turns on Copilot's experimental mode), are asked as yes/no, default no. --yes answers no; pass --accept <id> to say yes.",
50
+ "Undo any time with conveno uninstall."
51
+ ]
52
+ },
53
+ {
54
+ name: "init",
55
+ usage: "conveno init [--yes] [--dry-run] [--cli <list>] [--acp-adapters | --no-acp-adapters]",
56
+ summary: "Set up every supported AI tool that is installed",
57
+ flags: SETUP_FLAGS,
58
+ notes: [
59
+ "init is the older name for setup. It shows every file it will change, with a diff, and asks first.",
39
60
  "Without a terminal it needs --yes, and exits 2 without it.",
40
61
  "Optional setups, such as Copilot idle wake (it turns on Copilot's experimental mode), are asked as yes/no, default no. --yes answers no; pass --accept <id> to say yes.",
41
62
  "When Codex or Claude Code is installed without its ACP adapter, init asks once whether npx may fetch it (third-party npm packages, pinned versions). The answer is kept; the two adapter flags change it."
42
- ]
63
+ ],
64
+ hidden: true
43
65
  },
44
66
  {
45
67
  name: "uninstall",
46
68
  usage: "conveno uninstall [--yes]",
47
- summary: "Undo what init changed",
69
+ summary: "Remove Conveno from your AI tools",
48
70
  flags: { yes: {
49
71
  type: "boolean",
50
72
  short: "y",
51
- help: "Restore without asking"
73
+ help: "Go ahead without asking"
52
74
  } },
53
- notes: ["Files that still match what init wrote are restored byte for byte.", "Files you or the CLI edited since lose only Conveno's own entries."]
75
+ notes: [
76
+ "Stops Conveno's background service first, then puts your AI tools back the way they were.",
77
+ "Files that are still as setup left them are restored exactly.",
78
+ "Files you or the AI tool changed since lose only Conveno's own entries."
79
+ ]
54
80
  },
55
81
  {
56
82
  name: "status",
57
83
  usage: "conveno status",
58
- summary: "List online sessions by repo",
84
+ summary: "See which AI sessions are running",
59
85
  flags: {}
60
86
  },
61
87
  {
62
88
  name: "send",
63
89
  usage: "conveno send <to> <text...> [--urgent]",
64
- summary: "Send a message to a session as you",
90
+ summary: "Send a message to a running session",
65
91
  flags: { urgent: {
66
92
  type: "boolean",
67
93
  help: "Mark the message urgent"
@@ -79,7 +105,8 @@ const COMMANDS = [
79
105
  summary: "Give an online session a new name",
80
106
  flags: {},
81
107
  notes: ["<session> is a name or id. Names use lowercase letters, digits and . _ @ -."],
82
- positionals: true
108
+ positionals: true,
109
+ hidden: true
83
110
  },
84
111
  {
85
112
  name: "lead",
@@ -94,7 +121,8 @@ const COMMANDS = [
94
121
  "<session> is a name or id. The old lead is told.",
95
122
  "--clear leaves no lead."
96
123
  ],
97
- positionals: true
124
+ positionals: true,
125
+ hidden: true
98
126
  },
99
127
  {
100
128
  name: "spawn",
@@ -146,7 +174,8 @@ const COMMANDS = [
146
174
  "Without a terminal of your own it needs --yes, and exits 2 without it.",
147
175
  "At most 8 spawned sessions run at once; CONVENO_SPAWN_MAX changes that."
148
176
  ],
149
- positionals: true
177
+ positionals: true,
178
+ hidden: true
150
179
  },
151
180
  {
152
181
  name: "stop",
@@ -154,7 +183,8 @@ const COMMANDS = [
154
183
  summary: "Stop a background worker",
155
184
  flags: {},
156
185
  notes: ["A background worker cancels its current turn, stops its CLI and tells the session that spawned it.", "A worker in a terminal window is yours to close."],
157
- positionals: true
186
+ positionals: true,
187
+ hidden: true
158
188
  },
159
189
  {
160
190
  name: "devices",
@@ -174,14 +204,16 @@ const COMMANDS = [
174
204
  "reset forgets this device's list after you reset your devices on the account page.",
175
205
  "Needs a Conveno Pro login on both devices."
176
206
  ],
177
- positionals: true
207
+ positionals: true,
208
+ hidden: true
178
209
  },
179
210
  {
180
211
  name: "relay",
181
212
  usage: "conveno relay status",
182
213
  summary: "Show the relay connection",
183
214
  flags: {},
184
- positionals: true
215
+ positionals: true,
216
+ hidden: true
185
217
  },
186
218
  {
187
219
  name: "doctor",
@@ -190,8 +222,9 @@ const COMMANDS = [
190
222
  flags: { cli: {
191
223
  type: "string",
192
224
  value: "<list>",
193
- help: "Only these CLIs, separated by commas or spaces, such as claude,codex"
194
- } }
225
+ help: "Only these AI tools, separated by commas or spaces, such as claude,codex"
226
+ } },
227
+ hidden: true
195
228
  },
196
229
  {
197
230
  name: "login",
@@ -205,19 +238,22 @@ const COMMANDS = [
205
238
  "login shows a code and a link. Approve the code in your browser and the terminal signs in.",
206
239
  "The account is only for Conveno Pro. Everything on this machine works without one.",
207
240
  "The tokens are kept in the data dir, in account.json, readable by you only."
208
- ]
241
+ ],
242
+ hidden: true
209
243
  },
210
244
  {
211
245
  name: "logout",
212
246
  usage: "conveno logout",
213
247
  summary: "Sign out and delete the saved tokens",
214
- flags: {}
248
+ flags: {},
249
+ hidden: true
215
250
  },
216
251
  {
217
252
  name: "account",
218
253
  usage: "conveno account",
219
254
  summary: "Show your plan and trial",
220
- flags: {}
255
+ flags: {},
256
+ hidden: true
221
257
  },
222
258
  {
223
259
  name: "daemon",
@@ -235,17 +271,21 @@ const COMMANDS = [
235
271
  type: "string",
236
272
  value: "<cli>",
237
273
  help: "The CLI that starts it, such as claude"
238
- } }
274
+ } },
275
+ hidden: true
239
276
  },
240
277
  {
241
278
  name: "hook",
242
279
  usage: "conveno hook <cli> <event>",
243
280
  summary: "Hook entry (CLIs launch this)",
244
281
  flags: {},
245
- positionals: true
282
+ positionals: true,
283
+ hidden: true
246
284
  }
247
285
  ];
248
286
  const COMMAND_NAMES = COMMANDS.filter((c) => !c.hidden).map((c) => c.name);
287
+ /** Every command that works, shown in help or not. Used for "Did you mean". */
288
+ const ALL_COMMAND_NAMES = COMMANDS.map((c) => c.name);
249
289
  /** `conveno <command> --help`. */
250
290
  function commandHelp(ctx, spec) {
251
291
  const t = ctx.theme;
@@ -318,4 +358,4 @@ function parseFlags(ctx, spec, argv) {
318
358
  });
319
359
  }
320
360
  }
321
- export { parseFlags as i, COMMAND_NAMES as n, commandHelp as r, COMMANDS as t };
361
+ export { parseFlags as a, commandHelp as i, COMMANDS as n, COMMAND_NAMES as r, ALL_COMMAND_NAMES as t };
package/dist/bin.js CHANGED
@@ -26,9 +26,9 @@ for (const stream of [process.stdout, process.stderr]) stream.on("error", (err)
26
26
  });
27
27
  try {
28
28
  let code;
29
- if (isHook) code = await (await import("./hook-entry-CgiSN-Oj.js")).runHookEntry(argv.slice(1));
29
+ if (isHook) code = await (await import("./hook-entry-CrpZz5QW.js")).runHookEntry(argv.slice(1));
30
30
  else {
31
- const [{ main }, { createRuntimeCtx }] = await Promise.all([import("./main-seh-HPZO.js"), import("./runtime-Bnjh9BQ8.js")]);
31
+ const [{ main }, { createRuntimeCtx }] = await Promise.all([import("./main-DrzHsV5y.js"), import("./runtime-Db_YT5Xg.js")]);
32
32
  code = await main(argv, createRuntimeCtx());
33
33
  }
34
34
  if (isHook) process.exit(code);
package/dist/daemon.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { homedir, hostname, userInfo } from "node:os";
3
- import { t as codexAdapter } from "./dist-DOGlDbRb.js";
4
- import { $ as jwtClaim, $t as EVENT_NAMES, A as daemonProof, At as resolveRecipient, B as evaluateLiveness, Cn as safeParse, Et as requeueEntries, F as detectRepo, G as formatHookContext, Ht as takeWithinChars, J as holderAfterDeparture, Kt as validateRename, M as dataPaths, N as decideAutoContinue, O as createWmiWalker, P as defaultProcessIo, Q as isOnline, Qt as DeviceId, R as effectiveHolder, S as claimOrchestrator, Sn as parseRelayFrame, T as clientProof, Tn as socketPathTooLongMessage, Ut as tooManyUnreadMessage, Vt as takeWithinBytes, W as formatContinuation, Wt as turnHops, _n as makeResult, _t as readAccountTokens, an as PROTOCOL_VERSION, b as baseName, bn as newSessionId, bt as readInbox, dn as defaultSocketPath, fn as encodeFrame, gn as makeEventNotification, hn as makeError, ht as proofsMatch, in as OWNER_SESSION_ID, j as dataDir, k as currentAccessToken, l as RESPONSE_BUDGET_BYTES, ln as SessionId, lt as pendingForInjection, mn as isSocketPathTooLong, n as AccountError, nn as Message, nt as markDelivered, on as RelayPayload, p as ackEntries, pt as planSpawn, q as generateSessionName, r as ConvenoError, rt as newAuthNonce, sn as RpcErrorCode, un as createLineDecoder, v as autoCandidates, vn as newDeviceId, vt as readAncestry, w as clearOrchestrator, wn as sanitizeLine, x as bindAccountDevice, xn as parseIpcRequest, y as autoLimitsFromEnv, yn as newMessageId, zt as statusAfterLiveness } from "./dist-D2hMvcZu.js";
3
+ import { t as codexAdapter } from "./dist-B1EVHdIM.js";
4
+ import { $ as jwtClaim, $t as EVENT_NAMES, A as daemonProof, At as resolveRecipient, B as evaluateLiveness, Cn as parseRelayFrame, En as socketPathTooLongMessage, Et as requeueEntries, F as detectRepo, G as formatHookContext, Ht as takeWithinChars, J as holderAfterDeparture, Kt as validateRename, M as dataPaths, N as decideAutoContinue, O as createWmiWalker, P as defaultProcessIo, Q as isOnline, Qt as DeviceId, R as effectiveHolder, S as claimOrchestrator, Sn as parseIpcRequest, T as clientProof, Tn as sanitizeLine, Ut as tooManyUnreadMessage, Vt as takeWithinBytes, W as formatContinuation, Wt as turnHops, _n as makeEventNotification, _t as readAccountTokens, an as PROTOCOL_VERSION, b as baseName, bn as newMessageId, bt as readInbox, dn as createLineDecoder, fn as defaultSocketPath, gn as makeError, hn as isSocketPathTooLong, ht as proofsMatch, in as OWNER_SESSION_ID, j as dataDir, k as currentAccessToken, l as RESPONSE_BUDGET_BYTES, lt as pendingForInjection, n as AccountError, nn as Message, nt as markDelivered, on as RelayPayload, p as ackEntries, pn as encodeFrame, pt as planSpawn, q as generateSessionName, r as ConvenoError, rt as newAuthNonce, sn as RpcErrorCode, un as SessionId, v as autoCandidates, vn as makeResult, vt as readAncestry, w as clearOrchestrator, wn as safeParse, x as bindAccountDevice, xn as newSessionId, xt as readSettings, y as autoLimitsFromEnv, yn as newDeviceId, zt as statusAfterLiveness } from "./dist-BBdba94T.js";
5
5
  import { randomBytes } from "node:crypto";
6
6
  import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
7
7
  import { connect, createServer } from "node:net";
8
8
  import { dirname, join, posix, win32 } from "node:path";
9
- import { _ as sasMatches, a as JoinerPairing, b as signRelayHello, c as decodePairMessage, d as forkPoint, f as generateIdentity, g as publicRecord, h as parseIdentity, i as InviterPairing, l as deviceFingerprint, m as openEnvelope, n as ENVELOPE_MAX_AGE_MS, o as appendRevoke, p as headMatches, r as ENVELOPE_MAX_FUTURE_MS, s as chainHead, t as CryptoError, u as encodePairMessage, v as sealEnvelope, x as verifyChain, y as serializeIdentity } from "./dist-iFaY42Bs.js";
9
+ import { _ as sasMatches, a as JoinerPairing, b as signRelayHello, c as decodePairMessage, d as forkPoint, f as generateIdentity, g as publicRecord, h as parseIdentity, i as InviterPairing, l as deviceFingerprint, m as openEnvelope, n as ENVELOPE_MAX_AGE_MS, o as appendRevoke, p as headMatches, r as ENVELOPE_MAX_FUTURE_MS, s as chainHead, t as CryptoError, u as encodePairMessage, v as sealEnvelope, x as verifyChain, y as serializeIdentity } from "./dist-C6cMQ00I.js";
10
10
  import { execFileSync } from "node:child_process";
11
11
  import { DatabaseSync } from "node:sqlite";
12
12
  // ../daemon/src/lifecycle.ts
@@ -1944,7 +1944,7 @@ var Store = class {
1944
1944
  }
1945
1945
  };
1946
1946
  // ../daemon/src/server.ts
1947
- const DAEMON_VERSION = "0.2.0-rc.7";
1947
+ const DAEMON_VERSION = "0.2.0-rc.8";
1948
1948
  /** A connection that has not finished the handshake by then is closed. */
1949
1949
  const AUTH_TIMEOUT_MS = 5e3;
1950
1950
  /** Unread messages one session may hold. */
@@ -1987,6 +1987,7 @@ var Daemon = class {
1987
1987
  processIo;
1988
1988
  platform;
1989
1989
  wakers;
1990
+ settingsPath;
1990
1991
  conns = /* @__PURE__ */ new Set();
1991
1992
  /** Reaches the owner's other devices; set by startDaemon unless disabled. */
1992
1993
  relay;
@@ -2019,7 +2020,7 @@ var Daemon = class {
2019
2020
  startedMs;
2020
2021
  /** When each session went offline, for the removal grace. In memory only. */
2021
2022
  offlineSince = /* @__PURE__ */ new Map();
2022
- constructor(store, token, now, isAlive, idleExitMs, requestIdleExit, requestShutdown, log, authTimeoutMs = AUTH_TIMEOUT_MS, autoLimits = autoLimitsFromEnv({}), processIo = defaultProcessIo, platform = process.platform, wakers = {}) {
2023
+ constructor(store, token, now, isAlive, idleExitMs, requestIdleExit, requestShutdown, log, authTimeoutMs = AUTH_TIMEOUT_MS, autoLimits = autoLimitsFromEnv({}), processIo = defaultProcessIo, platform = process.platform, wakers = {}, settingsPath) {
2023
2024
  this.store = store;
2024
2025
  this.token = token;
2025
2026
  this.now = now;
@@ -2033,6 +2034,7 @@ var Daemon = class {
2033
2034
  this.processIo = processIo;
2034
2035
  this.platform = platform;
2035
2036
  this.wakers = wakers;
2037
+ this.settingsPath = settingsPath;
2036
2038
  this.deviceId = store.deviceId();
2037
2039
  this.startedMs = now().getTime();
2038
2040
  this.idleSince = this.startedMs;
@@ -2263,7 +2265,18 @@ var Daemon = class {
2263
2265
  return r;
2264
2266
  });
2265
2267
  this.emitSession(row.id, "registered");
2266
- return { session: this.view(row) };
2268
+ this.claimPreferredLead(row);
2269
+ return { session: this.view(this.store.getSession(row.id) ?? row) };
2270
+ }
2271
+ /**
2272
+ * The saved preferred lead CLI takes the lead when it registers and nobody online leads. The
2273
+ * settings are read on each register, so a change needs no restart. It is the normal claim.
2274
+ */
2275
+ claimPreferredLead(row) {
2276
+ if (this.settingsPath === void 0) return;
2277
+ if (readSettings(this.settingsPath).leadCli !== row.cli) return;
2278
+ if (this.orchestratorNow() !== null) return;
2279
+ this.claim(row.id);
2267
2280
  }
2268
2281
  async registerAsync(p) {
2269
2282
  return this.register(p, await this.detect(p));
@@ -3047,7 +3060,7 @@ async function startDaemon(opts) {
3047
3060
  close().then(() => opts.onIdleExit?.());
3048
3061
  }, () => {
3049
3062
  close().then(() => opts.onShutdown?.());
3050
- }, daemonLog, opts.authTimeoutMs ?? 5e3, opts.autoLimits ?? autoLimitsFromEnv(process.env), processIo, opts.platform, opts.wakers ?? {});
3063
+ }, daemonLog, opts.authTimeoutMs ?? 5e3, opts.autoLimits ?? autoLimitsFromEnv(process.env), processIo, opts.platform, opts.wakers ?? {}, paths.settings);
3051
3064
  daemon.removeAllOffline();
3052
3065
  const srv = createServer((socket) => daemon.attach(socket));
3053
3066
  server = srv;
@@ -1,4 +1,4 @@
1
- import { t as ClientError } from "./dist-ftx5RNCp.js";
1
+ import { t as ClientError } from "./dist-WTkKRM39.js";
2
2
  import { n as cmd, s as plainError } from "./fmt-C2SsP5Y0.js";
3
3
  // src/daemonError.ts
4
4
  /**
@@ -2,7 +2,7 @@ import { execFile } from "node:child_process";
2
2
  import { readFileSync, statSync } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
5
- import { Rt as startTurnContext, U as findOnPath, ft as planProgram, it as ownSession, ot as parseCliVersion, ut as pendingHookContext, z as endTurnContinuation } from "./dist-D2hMvcZu.js";
5
+ import { Rt as startTurnContext, U as findOnPath, ft as planProgram, it as ownSession, ot as parseCliVersion, ut as pendingHookContext, z as endTurnContinuation } from "./dist-BBdba94T.js";
6
6
  import { n as cs, t as Za } from "./toml-patch-DGzVRdd1.js";
7
7
  // ../adapters/codex/dist/index.js
8
8
  const SERVER_NAME = "conveno";
@@ -1,6 +1,6 @@
1
1
  import { readFile, readdir } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
- import { I as dropFromList, L as editJson, Pt as sameJson, V as existedBefore, Z as isObject, et as loadJson, it as ownSession, j as dataDir, ot as parseCliVersion, ut as pendingHookContext, z as endTurnContinuation } from "./dist-D2hMvcZu.js";
3
+ import { I as dropFromList, L as editJson, Pt as sameJson, V as existedBefore, Z as isObject, et as loadJson, it as ownSession, j as dataDir, ot as parseCliVersion, ut as pendingHookContext, z as endTurnContinuation } from "./dist-BBdba94T.js";
4
4
  // ../adapters/antigravity/dist/index.js
5
5
  const SERVER_NAME = "conveno";
6
6
  /** The name of our entry in hooks.json. Antigravity keys hooks by an arbitrary name. */
@@ -7645,10 +7645,10 @@ async function ownSession(ctx, opts = {}) {
7645
7645
  return session;
7646
7646
  }
7647
7647
  const budget = (opts) => opts.maxChars === void 0 ? {} : { maxChars: opts.maxChars };
7648
- /** Past `opts.deadline`, or else the hook runner's own (`HookContext.deadline`). */
7648
+ /** Past `opts.deadline` or the hook runner's own (`HookContext.deadline`), whichever is first. */
7649
7649
  const late = (ctx, opts) => {
7650
- const d = opts.deadline ?? ctx.deadline;
7651
- return d !== void 0 && Date.now() > d;
7650
+ const d = Math.min(opts.deadline ?? 1e400, ctx.deadline ?? 1e400);
7651
+ return Date.now() > d;
7652
7652
  };
7653
7653
  /** `message.deliver` for `session`, framed for a hook; null when nothing or too late. */
7654
7654
  async function deliverFramed(ctx, session, opts) {
@@ -8764,7 +8764,10 @@ function readSettings(path) {
8764
8764
  const v = JSON.parse(readFileSync(path, "utf8"));
8765
8765
  if (typeof v !== "object" || v === null) return {};
8766
8766
  const o = v;
8767
- return { ...typeof o.acpAdapterNpx === "boolean" ? { acpAdapterNpx: o.acpAdapterNpx } : {} };
8767
+ return {
8768
+ ...typeof o.acpAdapterNpx === "boolean" ? { acpAdapterNpx: o.acpAdapterNpx } : {},
8769
+ ...typeof o.leadCli === "string" && CLI_KINDS.includes(o.leadCli) ? { leadCli: o.leadCli } : {}
8770
+ };
8768
8771
  } catch {
8769
8772
  return {};
8770
8773
  }
@@ -9417,7 +9420,7 @@ const SPAWN_TABLE = {
9417
9420
  args: [],
9418
9421
  adapterPackage: "@agentclientprotocol/claude-agent-acp",
9419
9422
  fullAccessMode: "bypassPermissions",
9420
- note: "Claude Code has no ACP server of its own. The third-party npm package @agentclientprotocol/claude-agent-acp provides one and uses the Claude Code sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
9423
+ note: "Claude Code has no ACP server of its own. The ACP project's npm package @agentclientprotocol/claude-agent-acp provides one and uses the Claude Code sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
9421
9424
  docs: ["https://github.com/agentclientprotocol/claude-agent-acp (Apache-2.0, maintained by the ACP project)", "https://www.npmjs.com/package/@agentclientprotocol/claude-agent-acp (bin claude-agent-acp)"]
9422
9425
  }
9423
9426
  },
@@ -9431,7 +9434,7 @@ const SPAWN_TABLE = {
9431
9434
  args: [],
9432
9435
  adapterPackage: "@agentclientprotocol/codex-acp",
9433
9436
  fullAccessMode: "agent-full-access",
9434
- note: "Codex has no ACP server of its own. The third-party npm package @agentclientprotocol/codex-acp provides one and uses the Codex sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
9437
+ note: "Codex has no ACP server of its own. The ACP project's npm package @agentclientprotocol/codex-acp provides one and uses the Codex sign-in. Run conveno init to let Conveno fetch it with npx, or install it yourself.",
9435
9438
  docs: [
9436
9439
  "https://github.com/agentclientprotocol/codex-acp (Apache-2.0, built on the Codex app server)",
9437
9440
  "https://www.npmjs.com/package/@agentclientprotocol/codex-acp (bin codex-acp)",
@@ -9951,4 +9954,4 @@ async function waitForRegistration(deps, w) {
9951
9954
  await deps.sleep(250);
9952
9955
  }
9953
9956
  }
9954
- export { jwtClaim as $, EVENT_NAMES as $t, daemonProof as A, literal as An, resolveRecipient as At, evaluateLiveness as B, takeAcpLaunchFile as Bt, claimSpawnRecord as C, safeParse as Cn, realSpawnDeps as Ct, completeLogin as D, array as Dn, requeueMessages as Dt, compatStatus as E, _enum as En, requeueEntries as Et, detectRepo as F, senderOf as Ft, formatHookContext as G, updateSpawnRecord as Gt, fetchAccountStatus as H, takeWithinChars as Ht, dropFromList as I, spawnRecordPath as It, holderAfterDeparture as J, waitForWorkBatch as Jt, formatInbox as K, validateRename as Kt, editJson as L, spawnSession as Lt, dataPaths as M, object as Mn, runLaunchFile as Mt, decideAutoContinue as N, string as Nn, runWaker as Nt, createWmiWalker as O, boolean as On, requeueOwnMessages as Ot, defaultProcessIo as P, sameJson as Pt, isOnline as Q, DeviceId as Qt, effectiveHolder as R, startTurnContext as Rt, claimOrchestrator as S, parseRelayFrame as Sn, readSpawnRecord as St, clientProof as T, socketPathTooLongMessage as Tn, requestDeviceCode as Tt, findOnPath as U, tooManyUnreadMessage as Ut, existedBefore as V, takeWithinBytes as Vt, formatContinuation as W, turnHops as Wt, isFromOwner as X, CLI_KINDS as Xt, isAllowed as Y, writeSettings as Yt, isObject as Z, CliKind as Zt, attachAcpSession as _, makeResult as _n, readAccountTokens as _t, FROM_USER_NOTICE as a, PROTOCOL_VERSION as an, parseAllowPatterns as at, baseName as b, newSessionId as bn, readInbox as bt, ORCHESTRATOR_TASK_NOTICE as c, RpcResponse as cn, parsePs1ShimTarget as ct, SPAWN_TABLE as d, defaultSocketPath as dn, pinnedAdapter as dt, EVENT_NOTIFICATION_METHOD as en, loadJson as et, SpawnError as f, encodeFrame as fn, planProgram as ft, adapterNpxCommand as g, makeEventNotification as gn, putInList as gt, adapterInstallCommand as h, makeError as hn, proofsMatch as ht, DEFAULT_ALLOW_RULES as i, OWNER_SESSION_ID as in, ownSession as it, dataDir as j, number as jn, resolveWindowsCommand as jt, currentAccessToken as k, discriminatedUnion as kn, resolveAcpProgram as kt, RESPONSE_BUDGET_BYTES as l, SessionId as ln, pendingForInjection as lt, acpOverrideVar as m, isSocketPathTooLong as mn, pollDeviceCode as mt, AccountError as n, Message as nn, markDelivered as nt, HEARTBEAT_INTERVAL_MS as o, RelayPayload as on, parseCliVersion as ot, ackEntries as p, ipcMethods as pn, planSpawn as pt, generateSessionName as q, waitForWork as qt, ConvenoError as r, MessageId as rn, newAuthNonce as rt, NOT_FROM_USER_NOTICE as s, RpcErrorCode as sn, parseCmdShimTarget as st, ACCOUNT_API as t, EventPayload as tn, logoutAccount as tt, SPAWN_CLIS as u, createLineDecoder as un, pendingHookContext as ut, autoCandidates as v, newDeviceId as vn, readAncestry as vt, clearOrchestrator as w, sanitizeLine as wn, renderBody as wt, bindAccountDevice as x, parseIpcRequest as xn, readSettings as xt, autoLimitsFromEnv as y, newMessageId as yn, readCommandLine as yt, endTurnContinuation as z, statusAfterLiveness as zt };
9957
+ export { jwtClaim as $, EVENT_NAMES as $t, daemonProof as A, discriminatedUnion as An, resolveRecipient as At, evaluateLiveness as B, takeAcpLaunchFile as Bt, claimSpawnRecord as C, parseRelayFrame as Cn, realSpawnDeps as Ct, completeLogin as D, _enum as Dn, requeueMessages as Dt, compatStatus as E, socketPathTooLongMessage as En, requeueEntries as Et, detectRepo as F, senderOf as Ft, formatHookContext as G, updateSpawnRecord as Gt, fetchAccountStatus as H, takeWithinChars as Ht, dropFromList as I, spawnRecordPath as It, holderAfterDeparture as J, waitForWorkBatch as Jt, formatInbox as K, validateRename as Kt, editJson as L, spawnSession as Lt, dataPaths as M, number as Mn, runLaunchFile as Mt, decideAutoContinue as N, object as Nn, runWaker as Nt, createWmiWalker as O, array as On, requeueOwnMessages as Ot, defaultProcessIo as P, string as Pn, sameJson as Pt, isOnline as Q, DeviceId as Qt, effectiveHolder as R, startTurnContext as Rt, claimOrchestrator as S, parseIpcRequest as Sn, readSpawnRecord as St, clientProof as T, sanitizeLine as Tn, requestDeviceCode as Tt, findOnPath as U, tooManyUnreadMessage as Ut, existedBefore as V, takeWithinBytes as Vt, formatContinuation as W, turnHops as Wt, isFromOwner as X, CLI_KINDS as Xt, isAllowed as Y, writeSettings as Yt, isObject as Z, CliKind as Zt, attachAcpSession as _, makeEventNotification as _n, readAccountTokens as _t, FROM_USER_NOTICE as a, PROTOCOL_VERSION as an, parseAllowPatterns as at, baseName as b, newMessageId as bn, readInbox as bt, ORCHESTRATOR_TASK_NOTICE as c, RpcResponse as cn, parsePs1ShimTarget as ct, SPAWN_TABLE as d, createLineDecoder as dn, pinnedAdapter as dt, EVENT_NOTIFICATION_METHOD as en, loadJson as et, SpawnError as f, defaultSocketPath as fn, planProgram as ft, adapterNpxCommand as g, makeError as gn, putInList as gt, adapterInstallCommand as h, isSocketPathTooLong as hn, proofsMatch as ht, DEFAULT_ALLOW_RULES as i, OWNER_SESSION_ID as in, ownSession as it, dataDir as j, literal as jn, resolveWindowsCommand as jt, currentAccessToken as k, boolean as kn, resolveAcpProgram as kt, RESPONSE_BUDGET_BYTES as l, SESSION_NAME_PATTERN as ln, pendingForInjection as lt, acpOverrideVar as m, ipcMethods as mn, pollDeviceCode as mt, AccountError as n, Message as nn, markDelivered as nt, HEARTBEAT_INTERVAL_MS as o, RelayPayload as on, parseCliVersion as ot, ackEntries as p, encodeFrame as pn, planSpawn as pt, generateSessionName as q, waitForWork as qt, ConvenoError as r, MessageId as rn, newAuthNonce as rt, NOT_FROM_USER_NOTICE as s, RpcErrorCode as sn, parseCmdShimTarget as st, ACCOUNT_API as t, EventPayload as tn, logoutAccount as tt, SPAWN_CLIS as u, SessionId as un, pendingHookContext as ut, autoCandidates as v, makeResult as vn, readAncestry as vt, clearOrchestrator as w, safeParse as wn, renderBody as wt, bindAccountDevice as x, newSessionId as xn, readSettings as xt, autoLimitsFromEnv as y, newDeviceId as yn, readCommandLine as yt, endTurnContinuation as z, statusAfterLiveness as zt };
@@ -1,5 +1,5 @@
1
- import { n as connect } from "./dist-ftx5RNCp.js";
2
- import { Bt as takeAcpLaunchFile, Gt as updateSpawnRecord, W as formatContinuation, Y as isAllowed, Zt as CliKind, at as parseAllowPatterns, i as DEFAULT_ALLOW_RULES, ln as SessionId, r as ConvenoError, sn as RpcErrorCode } from "./dist-D2hMvcZu.js";
1
+ import { n as connect } from "./dist-WTkKRM39.js";
2
+ import { Bt as takeAcpLaunchFile, Gt as updateSpawnRecord, W as formatContinuation, Y as isAllowed, Zt as CliKind, at as parseAllowPatterns, i as DEFAULT_ALLOW_RULES, r as ConvenoError, sn as RpcErrorCode, un as SessionId } from "./dist-BBdba94T.js";
3
3
  import { randomBytes } from "node:crypto";
4
4
  import { existsSync, rmSync } from "node:fs";
5
5
  import { Readable, Writable } from "node:stream";
@@ -71,7 +71,7 @@ var ToolTracker = class {
71
71
  return u.sessionUpdate === "tool_call" ? next.title ?? next.kind ?? "tool" : void 0;
72
72
  }
73
73
  };
74
- const HOST_VERSION = "0.2.0-rc.7";
74
+ const HOST_VERSION = "0.2.0-rc.8";
75
75
  /** A stop request file: `conveno stop` writes it next to the spawn record. */
76
76
  const stopRequestPath = (recordPath) => recordPath.replace(/\.json$/, ".stop");
77
77
  function withTimeout(p, ms, what) {
@@ -2,7 +2,7 @@ import { randomBytes as randomBytes$1 } from "@noble/ciphers/utils.js";
2
2
  import { equalBytes } from "@noble/curves/utils.js";
3
3
  import { sha256 } from "@noble/hashes/sha2.js";
4
4
  import { bytesToHex, concatBytes, utf8ToBytes } from "@noble/hashes/utils.js";
5
- import { An as literal, Dn as array, En as _enum, Mn as object, Nn as string, Qt as DeviceId, jn as number, kn as discriminatedUnion } from "./dist-D2hMvcZu.js";
5
+ import { An as discriminatedUnion, Dn as _enum, Mn as number, Nn as object, On as array, Pn as string, Qt as DeviceId, jn as literal } from "./dist-BBdba94T.js";
6
6
  import { ed25519, x25519 } from "@noble/curves/ed25519.js";
7
7
  import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
8
8
  import { expand, extract } from "@noble/hashes/hkdf.js";
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
- import { I as dropFromList, L as editJson, P as defaultProcessIo, Pt as sameJson, V as existedBefore, Z as isObject, a as FROM_USER_NOTICE, c as ORCHESTRATOR_TASK_NOTICE, et as loadJson, gt as putInList, it as ownSession, j as dataDir, ot as parseCliVersion, s as NOT_FROM_USER_NOTICE, ut as pendingHookContext, yt as readCommandLine, z as endTurnContinuation } from "./dist-D2hMvcZu.js";
4
+ import { I as dropFromList, L as editJson, P as defaultProcessIo, Pt as sameJson, V as existedBefore, Z as isObject, a as FROM_USER_NOTICE, c as ORCHESTRATOR_TASK_NOTICE, et as loadJson, gt as putInList, it as ownSession, j as dataDir, ot as parseCliVersion, s as NOT_FROM_USER_NOTICE, ut as pendingHookContext, yt as readCommandLine, z as endTurnContinuation } from "./dist-BBdba94T.js";
5
5
  import { n as cs, t as Za } from "./toml-patch-DGzVRdd1.js";
6
6
  // ../adapters/grok/dist/index.js
7
7
  const SERVER_NAME = "conveno";
@@ -3,7 +3,7 @@ import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
3
3
  import { createConnection } from "node:net";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
- import { A as daemonProof, M as dataPaths, T as clientProof, Tn as socketPathTooLongMessage, an as PROTOCOL_VERSION, cn as RpcResponse, dn as defaultSocketPath, fn as encodeFrame, ht as proofsMatch, j as dataDir, mn as isSocketPathTooLong, pn as ipcMethods, r as ConvenoError, rt as newAuthNonce, sn as RpcErrorCode, tn as EventPayload, un as createLineDecoder } from "./dist-D2hMvcZu.js";
6
+ import { A as daemonProof, En as socketPathTooLongMessage, M as dataPaths, T as clientProof, an as PROTOCOL_VERSION, cn as RpcResponse, dn as createLineDecoder, fn as defaultSocketPath, hn as isSocketPathTooLong, ht as proofsMatch, j as dataDir, mn as ipcMethods, pn as encodeFrame, r as ConvenoError, rt as newAuthNonce, sn as RpcErrorCode, tn as EventPayload } from "./dist-BBdba94T.js";
7
7
  // ../client/dist/index.js
8
8
  const DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
9
9
  const DEFAULT_START_TIMEOUT_MS = 1e4;
@@ -40,6 +40,8 @@ async function findHostPid(ctx, client, cli, local) {
40
40
  * the message on stderr (Claude Code's `asyncRewake`). They stop on their own when the host CLI
41
41
  * exits, the session goes offline, or a newer listener replaces them.
42
42
  */
43
+ /** After a timeout, the hook gets this many more timeouts' worth of time to finish recording. */
44
+ const FINISH_GRACE_FACTOR = 2;
43
45
  /** How long before the hook's timeout its messages count as too late to print. */
44
46
  const DEADLINE_MARGIN_MS = 300;
45
47
  async function runHook(ctx, argv) {
@@ -78,6 +80,7 @@ async function runHook(ctx, argv) {
78
80
  let code = 0;
79
81
  try {
80
82
  const out = await Promise.race([work, timeout]);
83
+ if (out === NOTHING && !listener) await Promise.race([work.catch(() => void 0), new Promise((r) => setTimeout(r, ctx.hookTimeoutMs * FINISH_GRACE_FACTOR))]);
81
84
  if (out.stdout) ctx.out(out.stdout.endsWith("\n") ? out.stdout : `${out.stdout}\n`);
82
85
  if (listener && out.stderr) ctx.err(out.stderr.endsWith("\n") ? out.stderr : `${out.stderr}\n`);
83
86
  if (listener) code = out.exitCode;
@@ -0,0 +1 @@
1
+ export { i as runHookEntry } from "./hook-entry-pHJioNgN.js";
@@ -1,13 +1,13 @@
1
1
  import { homedir } from "node:os";
2
- import { n as antigravityAdapter } from "./dist-D9Gu-mQm.js";
2
+ import { n as antigravityAdapter } from "./dist-B6Sm0MRT.js";
3
3
  import { isAbsolute, join } from "node:path";
4
- import { Dt as requeueMessages, I as dropFromList, Jt as waitForWorkBatch, L as editJson$1, Ot as requeueOwnMessages, Pt as sameJson$1, Rt as startTurnContext, V as existedBefore, Z as isObject$1, et as loadJson$1, gt as putInList, it as ownSession, j as dataDir, ot as parseCliVersion, qt as waitForWork, ut as pendingHookContext, vt as readAncestry, z as endTurnContinuation } from "./dist-D2hMvcZu.js";
4
+ import { Dt as requeueMessages, I as dropFromList, Jt as waitForWorkBatch, L as editJson$1, Ot as requeueOwnMessages, Pt as sameJson$1, Rt as startTurnContext, V as existedBefore, Z as isObject$1, et as loadJson$1, gt as putInList, it as ownSession, j as dataDir, ot as parseCliVersion, qt as waitForWork, ut as pendingHookContext, vt as readAncestry, z as endTurnContinuation } from "./dist-BBdba94T.js";
5
5
  import { readFile } from "node:fs/promises";
6
6
  import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
7
- import { t as codexAdapter } from "./dist-DOGlDbRb.js";
8
- import { t as grokAdapter } from "./dist-Dd31Fg0h.js";
9
- import { n as connect } from "./dist-ftx5RNCp.js";
10
- import { t as runHook } from "./hook-CQeSn-w4.js";
7
+ import { t as codexAdapter } from "./dist-B1EVHdIM.js";
8
+ import { t as grokAdapter } from "./dist-CcoTmwrf.js";
9
+ import { n as connect } from "./dist-WTkKRM39.js";
10
+ import { t as runHook } from "./hook-DxjJDCjz.js";
11
11
  // ../adapters/claude/dist/index.js
12
12
  const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
13
13
  /** Read a JSON object file. Missing or blank files give `{}`; anything else that is not a JSON object throws. */
@@ -2412,9 +2412,13 @@ async function sessionName(ctx) {
2412
2412
  return null;
2413
2413
  }
2414
2414
  }
2415
- /** Only the plugin delivers, on 1.x and 2.x alike; it adds nothing to a prompt the user types. */
2415
+ /**
2416
+ * Only the plugin delivers, on 1.x and 2.4+ alike; it adds nothing to a prompt the user types.
2417
+ * 2.0 to 2.3 are not supported (`opencodeDoctorNotes`), so doctor claims no waking for them.
2418
+ */
2416
2419
  function delivery(detection) {
2417
- const supported = detection.version !== void 0 && parseVersion(detection.version) !== void 0;
2420
+ const v = detection.version === void 0 ? void 0 : parseVersion(detection.version);
2421
+ const supported = v !== void 0 && (!isV2OrLater(v) || atLeast(v, V2_SUPPORTED));
2418
2422
  return {
2419
2423
  nextTurn: false,
2420
2424
  endOfTurn: supported,