@conveno/cli 0.2.0-rc.8 → 0.2.0

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.
Files changed (32) hide show
  1. package/README.md +3 -5
  2. package/dist/{acp-YHhVx0Ya.js → acp-BUddItzP.js} +39 -7
  3. package/dist/{agy-relay-BS2NeFlh.js → agy-relay-BZ3d_-FS.js} +4 -2
  4. package/dist/{args-CGL-AmNd.js → args-CtyKPZuN.js} +29 -8
  5. package/dist/bin.js +16 -2
  6. package/dist/daemon.js +4 -3139
  7. package/dist/{daemonError-DJ-P55nH.js → daemonError-CDgEtvy7.js} +1 -1
  8. package/dist/dist-BNhTPp5p.js +4509 -0
  9. package/dist/{dist-BRjg9CLd.js → dist-BOwFdixw.js} +23 -50
  10. package/dist/{dist-CcoTmwrf.js → dist-CFsDqevs.js} +94 -56
  11. package/dist/dist-CNdqmI3E.js +1065 -0
  12. package/dist/{dist-BBdba94T.js → dist-CSSvrcKr.js} +1752 -708
  13. package/dist/{dist-B6Sm0MRT.js → dist-D6Xoip5W.js} +203 -62
  14. package/dist/{dist-WTkKRM39.js → dist-DAVtixeC.js} +19 -5
  15. package/dist/dist-DTMnNySx.js +989 -0
  16. package/dist/hook-BA-tI6Oc.js +208 -0
  17. package/dist/hook-entry-BwzBtAnd.js +1346 -0
  18. package/dist/hook-entry-Cgt5ZH1s.js +1 -0
  19. package/dist/{main-DrzHsV5y.js → main-kKnLA7Hj.js} +58 -21
  20. package/dist/{pick-Bi1yJDh6.js → pick-BsMvXuDo.js} +1 -1
  21. package/dist/run-PQBzaHv1.js +8193 -0
  22. package/dist/{runtime-Db_YT5Xg.js → runtime-0FMqklYn.js} +233 -122
  23. package/dist/{uninstall-D9rW_j7H.js → uninstall-DcxkIDpk.js} +556 -82
  24. package/dist/{watch-BrTWYf3Y.js → watch-BIepRTXJ.js} +29 -7
  25. package/package.json +14 -15
  26. package/dist/dist-B1EVHdIM.js +0 -504
  27. package/dist/dist-BlWWt5gx.js +0 -624
  28. package/dist/dist-C6cMQ00I.js +0 -793
  29. package/dist/hook-DxjJDCjz.js +0 -94
  30. package/dist/hook-entry-CrpZz5QW.js +0 -1
  31. package/dist/hook-entry-pHJioNgN.js +0 -2494
  32. package/dist/run-C32oP2c_.js +0 -5550
@@ -1,34 +1,38 @@
1
- import { execFile } from "node:child_process";
1
+ import { execFile, spawnSync } from "node:child_process";
2
2
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { delimiter, join, win32 } from "node:path";
5
5
  import { createInterface } from "node:readline";
6
6
  import { fileURLToPath } from "node:url";
7
- import { n as antigravityAdapter } from "./dist-B6Sm0MRT.js";
8
- import { a as opencodeAdapter, c as claudeAdapter, o as cursorAdapter, r as readAllStdin, s as copilotAdapter } from "./hook-entry-pHJioNgN.js";
9
- import { t as codexAdapter } from "./dist-B1EVHdIM.js";
10
- import { t as grokAdapter } from "./dist-CcoTmwrf.js";
11
- import { t as createTheme } from "./dist-BRjg9CLd.js";
12
- import { n as connect$1 } from "./dist-WTkKRM39.js";
13
- import { C as claimSpawnRecord, Ct as realSpawnDeps, Dn as _enum, F as detectRepo, K as formatInbox, Kt as validateRename, Lt as spawnSession, Mn as number, On as array, Pn as string, Xt as CLI_KINDS, _ as attachAcpSession, b as baseName, ct as parsePs1ShimTarget, f as SpawnError, in as OWNER_SESSION_ID, j as dataDir, jt as resolveWindowsCommand, kn as boolean, o as HEARTBEAT_INTERVAL_MS, pt as planSpawn, r as ConvenoError, rn as MessageId, s as NOT_FROM_USER_NOTICE, sn as RpcErrorCode, st as parseCmdShimTarget, u as SPAWN_CLIS, un as SessionId, vt as readAncestry, yt as readCommandLine } from "./dist-BBdba94T.js";
14
- import "./dist-C6cMQ00I.js";
7
+ import { t as createTheme } from "./dist-BOwFdixw.js";
8
+ import { n as connect } from "./dist-DAVtixeC.js";
9
+ import { $t as readModelMenus, A as baseName, An as validateRename, At as needsQuoting, Bt as pendingTurn, Cr as number, D as attachAcpSession, Ft as parseCmdShimTarget, G as dataDir, Gt as planSpawn, It as parsePs1ShimTarget, K as dataPaths, Kn as MessageId, L as cliDescriptor, N as claimSpawnRecord, Tr as string, Vt as pidAlive, Xt as readAncestry, Y as detectRepo, Zn as RpcErrorCode, Zt as readCommandLine, a as ConvenoError, bn as spawnSession, br as boolean, bt as launcherPath, c as NOT_FROM_USER_NOTICE, dn as resolveWindowsCommand, f as SPAWN_CLIS, m as SpawnError, mt as isAntigravityApp, rn as realSpawnDeps, s as HEARTBEAT_INTERVAL_MS, st as formatInbox, tr as SessionId, vr as _enum, xt as launcherText, yr as array, zn as CLI_KINDS } from "./dist-CSSvrcKr.js";
10
+ import { t as defaultIsAlive } from "./dist-BNhTPp5p.js";
15
11
  import { access } from "node:fs/promises";
16
12
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
13
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
- // ../daemon/dist/server--RKl3u3P.js
19
- /** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
20
- function defaultIsAlive(pid) {
21
- try {
22
- process.kill(pid, 0);
23
- return true;
24
- } catch (e) {
25
- return e.code === "EPERM";
14
+ import { a as adapterList, r as readAllStdin } from "./hook-entry-BwzBtAnd.js";
15
+ // ../mcp/dist/index.js
16
+ const SERVER_VERSION = "0.2.0";
17
+ const MENU_NAMES_MAX = 12;
18
+ /**
19
+ * One sentence for the spawn_session description: the models and efforts each CLI offered the
20
+ * last time a worker of it started. Empty when none are remembered.
21
+ */
22
+ function modelMenuNote(menus) {
23
+ const parts = [];
24
+ const cap = (xs) => {
25
+ const names = xs.slice(0, MENU_NAMES_MAX).map((x) => x.value);
26
+ return xs.length > MENU_NAMES_MAX ? `${names.join(", ")}, ...` : names.join(", ");
27
+ };
28
+ for (const cli of CLI_KINDS) {
29
+ const m = menus[cli];
30
+ if (!m || m.models.length === 0 && m.efforts.length === 0) continue;
31
+ const efforts = m.efforts.length > 0 ? ` (effort: ${cap(m.efforts)})` : "";
32
+ parts.push(`${cli}: ${cap(m.models)}${efforts}`);
26
33
  }
34
+ return parts.length > 0 ? ` Models offered last time: ${parts.join("; ")}.` : "";
27
35
  }
28
- `${OWNER_SESSION_ID}`;
29
- SessionId.parse("0".repeat(26));
30
- // ../mcp/dist/index.js
31
- const SERVER_VERSION = "0.2.0-rc.8";
32
36
  const ok = (text) => ({ content: [{
33
37
  type: "text",
34
38
  text
@@ -106,6 +110,8 @@ function whoamiText(s) {
106
110
  }
107
111
  /** The daemon no longer knows this session (restart, pruned, name taken). Recipient errors do not match. */
108
112
  const isSessionGone = (err) => err instanceof ConvenoError && err.code === RpcErrorCode.NotFound && /No session with id|not registered|Register the session again/.test(err.message);
113
+ /** The daemon retired this session: it will not take heartbeats from it again. */
114
+ const isSessionEnded = (err) => err instanceof ConvenoError && err.code === RpcErrorCode.NotFound && err.message.includes("has ended and will not come back");
109
115
  const SESSION_LOST_TEXT = "Conveno lost this session and could not restore it automatically. Tell the user that Conveno is not available in this session right now; restarting the CLI session reconnects it.";
110
116
  /**
111
117
  * Sent in the `instructions` field of the initialize result. MCP clients put it in the model's
@@ -134,31 +140,28 @@ function createServer(opts) {
134
140
  version: SERVER_VERSION
135
141
  }, { instructions: SERVER_INSTRUCTIONS });
136
142
  const spawnDataDir = opts.dataDir ?? dataDir(process.platform, process.env, homedir());
143
+ const menuNote = modelMenuNote(readModelMenus(dataPaths(process.platform, spawnDataDir).workerModels));
137
144
  let registering;
138
145
  let timer;
139
146
  let shutting;
140
147
  /** This server acts as a session an ACP host registered, and leaves its lifecycle to the host. */
141
148
  let attached = false;
142
149
  /**
143
- * OpenCode 2.x serves several sessions from one MCP process. Each OpenCode session that calls a
144
- * tool gets its own Conveno session; the first one takes over the session this process
145
- * registered at start, the others register fresh and heartbeat on their own.
150
+ * The id Conveno acts as. It starts as the session this process registered, and changes to the
151
+ * surviving session when `session.bind` merges this process's session into the one that already
152
+ * holds its conversation (Codex runs one MCP server per thread, so a thread the window already
153
+ * has may be registered a second time). Heartbeats, tool calls and unregister all use it.
146
154
  */
147
- const byOpencode = /* @__PURE__ */ new Map();
148
- const extraBeats = /* @__PURE__ */ new Map();
149
- let baseOwner;
150
- /** Stop an extra session's heartbeat and forget it, so a closed OpenCode session goes offline. */
151
- const release = (ocId, id) => {
152
- const beat = extraBeats.get(id);
153
- if (beat) clearInterval(beat);
154
- extraBeats.delete(id);
155
- byOpencode.delete(ocId);
156
- };
157
- const register = async (extra = false, ocId) => {
155
+ let actingId;
156
+ /** The conversation this process last bound, so a tool call binds only when it changes. */
157
+ let boundConversation;
158
+ let binding = Promise.resolve();
159
+ const isAlive = opts.isAlive ?? pidAlive;
160
+ const parentGone = () => opts.parentPid !== void 0 && !isAlive(opts.parentPid);
161
+ const register = async () => {
158
162
  const repo = await detectRepo(cwd, { exists: pathExists });
159
- const cliVersion = process.env.CONVENO_CLI_VERSION?.trim().slice(0, 64);
160
- const { hostPid, hostPids } = await host;
161
- const record = extra ? void 0 : claimSpawnRecord(spawnDataDir, cli, hostPids);
163
+ const { hostPid, hostPids, variant } = await host;
164
+ const record = claimSpawnRecord(spawnDataDir, cli, hostPids);
162
165
  if (record?.acp) {
163
166
  attached = true;
164
167
  return attachAcpSession(client, spawnDataDir, record);
@@ -170,36 +173,73 @@ function createServer(opts) {
170
173
  pid: process.pid,
171
174
  ...hostPid !== void 0 ? { hostPid } : {},
172
175
  ...hostPids.length > 0 ? { hostPids: hostPids.slice(0, 8) } : {},
173
- ...cliVersion ? { cliVersion } : {},
176
+ ...variant ? { variant } : {},
174
177
  ...repo.root ? { repo: { root: repo.root } } : {},
175
178
  ...spawnedBy.success ? { spawnedBy: spawnedBy.data } : {},
176
179
  ...record ? { spawned: true } : {}
177
180
  };
178
- const res = await (record ? client["session.register"]({
181
+ let session = (await (record ? client["session.register"]({
179
182
  ...params,
180
183
  name: record.name
181
184
  }).catch((err) => {
182
185
  if (err instanceof ConvenoError && err.code === RpcErrorCode.Conflict) return client["session.register"](params);
183
186
  throw err;
184
- }) : client["session.register"](params));
185
- const id = res.session.id;
187
+ }) : client["session.register"](params))).session;
188
+ actingId = session.id;
189
+ boundConversation = session.nativeId;
186
190
  const claudeId = cli === "claude" ? process.env.CLAUDE_CODE_SESSION_ID?.trim() : void 0;
187
- if (!extra && claudeId) await client["session.setNative"]({
188
- sessionId: id,
189
- nativeId: claudeId
190
- }).catch(() => {});
191
+ if (claudeId && session.nativeId === void 0) {
192
+ const bound = await bindTo(claudeId, session);
193
+ if (bound) session = bound;
194
+ if (await pendingTurn(spawnDataDir, "claude-pending-turn").take(claudeId)) await client["turn.start"]({ sessionId: session.id }).catch(() => {});
195
+ }
191
196
  const beat = setInterval(() => {
192
- client["session.heartbeat"]({ sessionId: id }).catch((err) => {
193
- if (extra && ocId !== void 0 && isSessionGone(err)) release(ocId, id);
197
+ if (!actingId) return;
198
+ if (parentGone()) {
199
+ shutdown().then(() => opts.onExit?.());
200
+ return;
201
+ }
202
+ client["session.heartbeat"]({
203
+ sessionId: actingId,
204
+ pid: process.pid
205
+ }).catch((err) => {
206
+ if (isSessionEnded(err)) {
207
+ if (timer) clearInterval(timer);
208
+ timer = void 0;
209
+ opts.onExit?.();
210
+ return;
211
+ }
212
+ if (!isSessionGone(err)) return;
213
+ forgetSession();
214
+ ensure().catch(() => {});
194
215
  });
195
216
  }, HEARTBEAT_INTERVAL_MS);
196
217
  beat.unref();
197
- if (extra) extraBeats.set(id, beat);
198
- else {
199
- if (timer) clearInterval(timer);
200
- timer = beat;
218
+ if (timer) clearInterval(timer);
219
+ timer = beat;
220
+ return session;
221
+ };
222
+ /**
223
+ * Bind this process's session to a conversation. The daemon may answer with another session, the
224
+ * one that already holds it; this process acts as that one from then on. Best effort: without
225
+ * the answer the session stays as it is.
226
+ */
227
+ const bindTo = async (conversation, me) => {
228
+ try {
229
+ const { session } = await client["session.bind"]({
230
+ cli,
231
+ nativeId: conversation,
232
+ sessionId: me.id,
233
+ pid: process.pid,
234
+ turnStart: true
235
+ });
236
+ if (!session) return void 0;
237
+ boundConversation = conversation;
238
+ actingId = session.id;
239
+ return session;
240
+ } catch {
241
+ return;
201
242
  }
202
- return res.session;
203
243
  };
204
244
  const ensure = () => {
205
245
  if (!registering) {
@@ -211,20 +251,15 @@ function createServer(opts) {
211
251
  }
212
252
  return registering;
213
253
  };
214
- /** Forget a dead session so the next ensure() registers again. Only drops `dead`, not a newer one. */
215
- const forget = (dead) => {
216
- if (registering === dead) registering = void 0;
217
- };
218
254
  const shutdown = () => {
219
255
  shutting ??= (async () => {
220
256
  if (timer) clearInterval(timer);
221
257
  timer = void 0;
222
258
  const s = await registering?.catch(() => void 0);
223
- if (s && !attached) await client["session.unregister"]({ sessionId: s.id }).catch(() => void 0);
224
- for (const beat of extraBeats.values()) clearInterval(beat);
225
- extraBeats.clear();
226
- const others = await Promise.all([...byOpencode.values()].map((p) => p.catch(() => void 0)));
227
- for (const o of others) if (o && o.id !== s?.id) await client["session.unregister"]({ sessionId: o.id }).catch(() => void 0);
259
+ if (s && !attached) await client["session.unregister"]({
260
+ sessionId: actingId ?? s.id,
261
+ pid: process.pid
262
+ }).catch(() => void 0);
228
263
  })();
229
264
  return shutting;
230
265
  };
@@ -239,44 +274,38 @@ function createServer(opts) {
239
274
  await closeTransport();
240
275
  await shutdown();
241
276
  };
242
- /** The Conveno session for an OpenCode session id; without one, this process's own session. */
243
- const sessionFor = (ocId) => {
244
- if (!ocId) return ensure();
245
- let p = byOpencode.get(ocId);
246
- if (!p) {
247
- const takeBase = baseOwner === void 0;
248
- if (takeBase) baseOwner = ocId;
249
- const made = (takeBase ? ensure() : register(true, ocId)).then(async (s) => {
250
- await client["session.setNative"]({
251
- sessionId: s.id,
252
- nativeId: ocId
253
- });
254
- return s;
255
- });
256
- p = made;
257
- byOpencode.set(ocId, made);
258
- made.catch(() => {
259
- if (byOpencode.get(ocId) === made) byOpencode.delete(ocId);
260
- if (takeBase && baseOwner === ocId) baseOwner = void 0;
261
- });
262
- }
263
- return p;
277
+ /**
278
+ * The session a tool call acts as. A call that names its conversation (`_meta`) is a turn start
279
+ * in it: when it differs from the one this process last bound, the window's session moves to it
280
+ * (and a session of another process that already holds it takes this one over).
281
+ */
282
+ const sessionFor = async (conversation) => {
283
+ const me = await ensure();
284
+ if (!conversation || attached || conversation === boundConversation) return me;
285
+ const turn = binding.then(async () => {
286
+ const current = await ensure();
287
+ if (conversation === boundConversation) return current;
288
+ const bound = await bindTo(conversation, current);
289
+ if (bound) registering = Promise.resolve(bound);
290
+ return bound ?? current;
291
+ });
292
+ binding = turn.catch(() => void 0);
293
+ return turn;
264
294
  };
265
295
  /** Drop a dead session so the next call registers again. */
266
- const forgetFor = (ocId, dead) => {
267
- if (!ocId) {
268
- forget(dead);
269
- return;
270
- }
271
- if (byOpencode.get(ocId) === dead) byOpencode.delete(ocId);
272
- if (baseOwner === ocId) {
273
- baseOwner = void 0;
274
- registering = void 0;
275
- }
296
+ const forgetSession = () => {
297
+ registering = void 0;
298
+ boundConversation = void 0;
299
+ actingId = void 0;
276
300
  };
277
- /** OpenCode puts the calling session's id in the request's `_meta`. */
278
- const opencodeId = (extra) => {
279
- const v = extra?._meta?.["ai.opencode/sessionID"];
301
+ /**
302
+ * The conversation a tool call comes from, in the request's `_meta` key the CLI's descriptor
303
+ * names (`conversationMetaKey`): Codex `threadId`, OpenCode `ai.opencode/sessionID`.
304
+ */
305
+ const conversationOf = (extra) => {
306
+ const meta = extra?._meta;
307
+ const key = cliDescriptor(cli)?.conversationMetaKey;
308
+ const v = key === void 0 ? void 0 : meta?.[key];
280
309
  return typeof v === "string" && v.length > 0 && v.length <= 256 ? v : void 0;
281
310
  };
282
311
  /**
@@ -287,16 +316,15 @@ function createServer(opts) {
287
316
  const tool = (body) => async (...given) => {
288
317
  const extra = given.length > 1 ? given[given.length - 1] : void 0;
289
318
  const args = given.length > 1 ? given[0] : {};
290
- const oc = opencodeId(extra ?? given[0]);
291
- const first = sessionFor(oc);
319
+ const conversation = conversationOf(extra ?? given[0]);
292
320
  try {
293
- return ok(await body(await first, args));
321
+ return ok(await body(await sessionFor(conversation), args));
294
322
  } catch (err) {
295
323
  if (!isSessionGone(err)) return fail(err);
296
- forgetFor(oc, first);
324
+ forgetSession();
297
325
  }
298
326
  try {
299
- return ok(await body(await sessionFor(oc), args));
327
+ return ok(await body(await sessionFor(conversation), args));
300
328
  } catch (err) {
301
329
  return isSessionGone(err) ? fail(/* @__PURE__ */ new Error(SESSION_LOST_TEXT)) : fail(err);
302
330
  }
@@ -366,6 +394,24 @@ function createServer(opts) {
366
394
  const plural = (n, one, many) => n === 1 ? one : many;
367
395
  return [`Acknowledged ${res.acked} ${plural(res.acked, "message", "messages")}.`, unknown > 0 ? `${unknown} ${plural(unknown, "id was", "ids were")} not found.` : ""].filter(Boolean).join(" ");
368
396
  }));
397
+ mcp.registerTool("answer_permission", {
398
+ description: "Answer a worker's permission request (sent to you as a 'wants to run' notice).",
399
+ inputSchema: {
400
+ request: string().min(1).max(64).describe("The request id from the notice."),
401
+ answer: _enum([
402
+ "allow",
403
+ "always",
404
+ "deny"
405
+ ]).describe("allow: this once. always: also for the same call later. deny.")
406
+ }
407
+ }, tool(async (me, a) => {
408
+ await client["permission.answer"]({
409
+ sessionId: me.id,
410
+ requestId: a.request,
411
+ answer: a.answer === "allow" ? "allow_once" : a.answer === "always" ? "allow_always" : "deny"
412
+ });
413
+ return `Answered request ${a.request}: ${a.answer}.`;
414
+ }));
369
415
  mcp.registerTool("rename", {
370
416
  description: "Change this session's name. Use it when the user wants a name others can remember, such as `api-worker`.",
371
417
  inputSchema: { name: string().min(1).describe("New name: 1 to 64 characters of lowercase letters, digits, '.', '_', '@' or '-'.") }
@@ -392,7 +438,10 @@ function createServer(opts) {
392
438
  return a.text === "" ? "Status cleared." : "Status set.";
393
439
  }));
394
440
  const becomeLead = tool(async (me) => {
395
- const res = await client["orchestrator.claim"]({ sessionId: me.id });
441
+ const res = await client["orchestrator.claim"]({
442
+ sessionId: me.id,
443
+ via: "tool"
444
+ });
396
445
  if (!res.previous) return "You are now the lead. There was no previous holder.";
397
446
  const { sessions } = await client["session.list"]({ includeOffline: true });
398
447
  return `You are now the lead. Previous holder: ${sessions.find((s) => s.id === res.previous)?.name ?? res.previous}.`;
@@ -426,14 +475,20 @@ function createServer(opts) {
426
475
  return `Handed off to ${res.deliveredTo.name} (message id ${res.message.id}). ${DELIVERY_NOTE[res.delivery] ?? ""}`.trimEnd();
427
476
  }));
428
477
  mcp.registerTool("spawn_session", {
429
- description: "Start a new worker session of a coding CLI with a first task, and return its name once it registers. It runs in the background and keeps running: each message you send becomes its next prompt, and it reports back the same way. Set window to open it in a visible terminal instead. The new session is yours to direct: message it by name with send. Only the listed CLIs can be started, and only inside the user's home folder.",
478
+ description: "Start a new worker session of a coding CLI with a first task, and return its name once it registers. It runs in the background and keeps running: each message you send becomes its next prompt, and it reports back the same way. Set window to open it in a visible terminal instead. The new session is yours to direct: message it by name with send. Only the listed CLIs can be started, and only inside the user's home folder." + menuNote,
430
479
  inputSchema: {
431
480
  cli: _enum(SPAWN_CLIS).describe("Which CLI to start."),
432
481
  cwd: string().min(1).optional().describe("Folder to work in, inside the home folder. Default: this session's folder."),
433
482
  name: string().min(1).optional().describe("Session name: lowercase letters, digits, '.', '_', '@' or '-'."),
434
483
  task: string().min(1).optional().describe("The first task for the new session."),
435
484
  window: boolean().optional().describe("Open it in a visible terminal window instead of the background."),
436
- allow: array(string().min(1)).max(32).optional().describe("Optional. By default the worker has full access in its folder; limit it to these tool kinds, such as read, search, or execute:npm test*. Not for window workers.")
485
+ access: _enum([
486
+ "read",
487
+ "edit",
488
+ "full"
489
+ ]).optional().describe("Optional. What the worker may do without asking: read (look only), edit (also change files) or full (everything; the default unless the user changed it). Not for window workers."),
490
+ model: string().max(200).optional().describe("Optional. The model, by the CLI's own name. Omit to use the user's default for that CLI, else the CLI's own default."),
491
+ effort: string().max(200).optional().describe("Optional. The effort or reasoning level, by the CLI's own name. Omit to use the user's default for that CLI, else the CLI's own default.")
437
492
  }
438
493
  }, tool(async (me, a) => {
439
494
  const deps = opts.spawnDeps ?? realSpawnDeps({
@@ -452,7 +507,9 @@ function createServer(opts) {
452
507
  name: a.name,
453
508
  task: a.task,
454
509
  window: a.window ?? false,
455
- allow: a.allow,
510
+ access: a.access,
511
+ model: a.model,
512
+ effort: a.effort,
456
513
  requester: me,
457
514
  confineToHome: true,
458
515
  timeoutMs: 45e3
@@ -478,9 +535,10 @@ async function runStdio(opts) {
478
535
  launcherPaths: process.argv[1] ? [process.argv[1]] : []
479
536
  }).then((a) => ({
480
537
  hostPid: a.hostPid,
481
- hostPids: a.pids
538
+ hostPids: a.pids,
539
+ variant: opts.cli === "antigravity" && isAntigravityApp(a.entries) ? "app" : void 0
482
540
  }));
483
- const client = await connect$1({
541
+ const client = await connect({
484
542
  kind: "mcp",
485
543
  autoStart: true,
486
544
  ...opts.daemonEntry ? { daemonEntry: opts.daemonEntry } : {}
@@ -489,7 +547,9 @@ async function runStdio(opts) {
489
547
  cli: opts.cli,
490
548
  client,
491
549
  host,
492
- cwd: process.cwd()
550
+ cwd: process.cwd(),
551
+ ...process.ppid > 1 ? { parentPid: process.ppid } : {},
552
+ onExit: () => void stop().then(() => process.exit(0))
493
553
  });
494
554
  let stopping;
495
555
  const stop = () => {
@@ -564,6 +624,13 @@ function windowsConvenoIsThisInstall(env, binPath, io = defaultShimIo) {
564
624
  const shim = found && /\.(cmd|bat)$/i.test(found) ? found : findPs1(env, io);
565
625
  return shim !== void 0 && shimPointsAt(shim, binPath, io);
566
626
  }
627
+ /** Windows: is there a `conveno.cmd` next to the `conveno` shim PATH finds. */
628
+ function windowsCmdShimOnPath(env, io = defaultShimIo) {
629
+ const found = resolveWindowsCommand("conveno", env, io.isFile);
630
+ if (found && /\.(cmd|bat)$/i.test(found)) return true;
631
+ const ps1 = findPs1(env, io);
632
+ return ps1 !== void 0 && io.isFile(win32.join(win32.dirname(ps1), "conveno.cmd"));
633
+ }
567
634
  // src/runtime.ts
568
635
  /**
569
636
  * Path of the daemon's entry script: `daemon.js`, built next to `bin.js` in this package's dist.
@@ -602,6 +669,56 @@ function pathConvenoIsThisInstall(env, binPath, platform, shimIo) {
602
669
  function convenoCommand(env, platform, binPath = cliBinPath(), nodePath = process.execPath, shimIo) {
603
670
  return pathConvenoIsThisInstall(env, binPath, platform, shimIo) ? ["conveno"] : [nodePath, binPath];
604
671
  }
672
+ /** The 8.3 short form of a Windows path, or the path itself when it cannot be read. */
673
+ function windowsShortPath(path, run = (c) => spawnSync("cmd", [
674
+ "/d",
675
+ "/c",
676
+ c
677
+ ], {
678
+ encoding: "utf8",
679
+ windowsHide: true,
680
+ windowsVerbatimArguments: true
681
+ }).stdout ?? "", exists = existsSync) {
682
+ let head = path;
683
+ const tail = [];
684
+ while (!exists(head)) {
685
+ const up = win32.dirname(head);
686
+ if (up === head) return path;
687
+ tail.unshift(win32.basename(head));
688
+ head = up;
689
+ }
690
+ try {
691
+ const short = run(`for %I in ("${head}") do @echo %~sI`).trim();
692
+ return short ? win32.join(short, ...tail) : path;
693
+ } catch {
694
+ return path;
695
+ }
696
+ }
697
+ const isAscii = (s) => /^[\x20-\x7e]*$/.test(s);
698
+ /** The launcher script for this install, and how the PATH `conveno` relates to it. */
699
+ function convenoLauncher(env, platform, dir, binPath = cliBinPath(), nodePath = process.execPath, shimIo, home = homedir(), shortPath = windowsShortPath) {
700
+ const onPath = pathConvenoIsThisInstall(env, binPath, platform, shimIo);
701
+ const win = platform === "win32";
702
+ const plain = (p) => !needsQuoting(win ? p.replace(/\\/g, "/") : p);
703
+ let path = launcherPath(platform, dir, home);
704
+ if (win && !plain(path)) path = shortPath(path);
705
+ let node = nodePath;
706
+ let bin = binPath;
707
+ let ascii = true;
708
+ if (win) {
709
+ const short = (p) => isAscii(p) ? p : shortPath(p);
710
+ node = short(node);
711
+ bin = short(bin);
712
+ ascii = isAscii(node) && isAscii(bin);
713
+ }
714
+ return {
715
+ path,
716
+ ...!plain(path) || !ascii ? { spaced: true } : {},
717
+ text: launcherText(platform, node, bin),
718
+ onPath,
719
+ cmdShim: platform === "win32" && onPath && windowsCmdShimOnPath(env, shimIo)
720
+ };
721
+ }
605
722
  function exec(cmd, args) {
606
723
  const plan = planSpawn(cmd, args);
607
724
  return new Promise((resolve, reject) => {
@@ -667,26 +784,20 @@ function createRuntimeCtx() {
667
784
  const platform = process.platform;
668
785
  const theme = createTheme();
669
786
  const daemonEntry = resolveDaemonEntry();
787
+ const dir = dataDir(platform, env, home);
670
788
  return {
671
789
  home,
672
790
  platform,
673
791
  cwd: process.cwd(),
674
792
  env,
675
- dataDir: dataDir(platform, env, home),
793
+ dataDir: dir,
676
794
  ...daemonEntry ? { daemonEntry } : {},
677
795
  conveno: {
678
796
  command: convenoCommand(env, platform),
679
- bin: cliBinPath()
797
+ bin: cliBinPath(),
798
+ launcher: convenoLauncher(env, platform, dir, void 0, void 0, void 0, home)
680
799
  },
681
- adapters: [
682
- claudeAdapter,
683
- codexAdapter,
684
- opencodeAdapter,
685
- cursorAdapter,
686
- copilotAdapter,
687
- antigravityAdapter,
688
- grokAdapter
689
- ],
800
+ adapters: adapterList(),
690
801
  spawnRunner: [process.execPath, cliBinPath()],
691
802
  exec,
692
803
  theme,
@@ -697,7 +808,7 @@ function createRuntimeCtx() {
697
808
  prompt: (q) => promptLine(theme, q),
698
809
  now: () => /* @__PURE__ */ new Date(),
699
810
  readStdin: readAllStdin,
700
- connect: connect$1,
811
+ connect,
701
812
  ancestry: (timeoutMs) => readAncestry({
702
813
  timeoutMs,
703
814
  launcherPaths: process.argv[1] ? [process.argv[1]] : []
@@ -710,4 +821,4 @@ function createRuntimeCtx() {
710
821
  hookTimeoutMs: 2e3
711
822
  };
712
823
  }
713
- export { ask, cliBinPath, convenoCommand, createRuntimeCtx, pathConvenoIsThisInstall, promptLine, resolveDaemonEntry };
824
+ export { ask, convenoCommand, convenoLauncher, createRuntimeCtx, resolveDaemonEntry, windowsShortPath };