@conveno/cli 0.2.0-rc.15 → 0.2.0-rc.16

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,5 +1,5 @@
1
- import { n as connect } from "./dist-C59LTq60.js";
2
- import { $ as formatContinuation, Pn as RpcErrorCode, Rn as SessionId, g as accessAllows, hn as updateSpawnRecord, i as ConvenoError, ln as takeAcpLaunchFile, wn as CliKind } from "./dist-ZL7d4_97.js";
1
+ import { n as connect } from "./dist-Ch3ohbIk.js";
2
+ import { Bt as planProgram, Hn as RpcErrorCode, Kn as SessionId, Mn as CliKind, Sn as updateSpawnRecord, Tt as modelLabel, _ as accessAllows, c as NPX_SETUP_TIMEOUT_MS, et as findModelOption, f as SPAWN_TABLE, gn as takeAcpLaunchFile, i as ConvenoError, in as resolveAcpProgram, kn as writeModelMenu, nt as formatContinuation, tt as findOnPath, wt as menuFromConfigOptions } from "./dist-DnWOZkAu.js";
3
3
  import { randomBytes } from "node:crypto";
4
4
  import { existsSync, rmSync } from "node:fs";
5
5
  import { Readable, Writable } from "node:stream";
@@ -205,10 +205,10 @@ var ToolTracker = class {
205
205
  return u.sessionUpdate === "tool_call" ? next.title ?? next.kind ?? "tool" : void 0;
206
206
  }
207
207
  };
208
- const HOST_VERSION = "0.2.0-rc.15";
208
+ const HOST_VERSION = "0.2.0-rc.16";
209
209
  /** A stop request file: `conveno stop` writes it next to the spawn record. */
210
210
  const stopRequestPath = (recordPath) => recordPath.replace(/\.json$/, ".stop");
211
- function withTimeout(p, ms, what) {
211
+ function withTimeout$1(p, ms, what) {
212
212
  return new Promise((resolve, reject) => {
213
213
  const t = setTimeout(() => reject(/* @__PURE__ */ new Error(`${what} did not answer within ${Math.round(ms / 1e3)} s.`)), ms);
214
214
  p.then((v) => {
@@ -220,11 +220,11 @@ function withTimeout(p, ms, what) {
220
220
  });
221
221
  });
222
222
  }
223
- const errText = (e) => e instanceof Error ? e.message : String(e);
223
+ const errText$1 = (e) => e instanceof Error ? e.message : String(e);
224
224
  /** A JSON-RPC error's own words: an agent that throws gets "Internal error" with the text in `data.details`. */
225
225
  const requestReason = (e) => {
226
226
  const details = e?.data?.details;
227
- return typeof details === "string" && details.trim() !== "" ? details.trim() : errText(e);
227
+ return typeof details === "string" && details.trim() !== "" ? details.trim() : errText$1(e);
228
228
  };
229
229
  const describeStop = (r) => {
230
230
  switch (r.kind) {
@@ -249,6 +249,8 @@ var AcpHost = class {
249
249
  policy;
250
250
  tools = new ToolTracker();
251
251
  sessionId;
252
+ /** The model label, sent again with each heartbeat so a restarted daemon still shows it. */
253
+ modelLabel;
252
254
  acpSessionId;
253
255
  conn;
254
256
  agent;
@@ -260,12 +262,16 @@ var AcpHost = class {
260
262
  /** The status line after a failed prompt, kept until the next prompt starts. */
261
263
  failedText;
262
264
  denials = [];
263
- /** A denied call of a worker nobody spawned, shown until the next turn starts. */
265
+ /** The last denied call, shown on the row until the next turn starts. */
264
266
  deniedText;
265
267
  /** The worker called Conveno's `send` (or `handoff`) in the turn that is running. */
266
268
  sentThisTurn = false;
267
269
  /** The daemon's `lastSentAt` of this session when the turn began. */
268
270
  sentAtTurnStart;
271
+ /** The messages the next turn's prompt hands over; undefined for the first task. */
272
+ answering;
273
+ /** When the newest message from a session that the running turn hands over was sent. */
274
+ askedAt;
269
275
  /** Status updates go out one after another, so a late one cannot overwrite a newer one. */
270
276
  statusChain = Promise.resolve();
271
277
  lastStatus;
@@ -311,7 +317,7 @@ var AcpHost = class {
311
317
  } catch (e) {
312
318
  if (!this.stopping) this.stop({
313
319
  kind: "failed",
314
- detail: errText(e)
320
+ detail: errText$1(e)
315
321
  });
316
322
  } finally {
317
323
  process.off("SIGTERM", onSignal);
@@ -350,7 +356,7 @@ var AcpHost = class {
350
356
  const app = client({ name: "conveno" }).onNotification(methods.client.session.update, ({ params }) => this.onUpdate(params)).onRequest(methods.client.session.requestPermission, ({ params }) => this.onPermission(params));
351
357
  this.conn = app.connect(ndJsonStream(Writable.toWeb(agent.stdin), Readable.toWeb(agent.stdout)));
352
358
  const conn = this.conn;
353
- const init = await this.untilStopped(withTimeout(conn.agent.request(methods.agent.initialize, {
359
+ const init = await this.untilStopped(withTimeout$1(conn.agent.request(methods.agent.initialize, {
354
360
  protocolVersion: PROTOCOL_VERSION,
355
361
  clientCapabilities: {
356
362
  fs: {
@@ -366,7 +372,7 @@ var AcpHost = class {
366
372
  }), timeout, "initialize"));
367
373
  const agentVersion = init.agentInfo?.version?.trim().slice(0, 64);
368
374
  this.log(`initialize: protocol ${init.protocolVersion}, agent ${init.agentInfo?.name ?? "unknown"} ${agentVersion ?? ""}`);
369
- const created = await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.new, {
375
+ const created = await this.untilStopped(withTimeout$1(conn.agent.request(methods.agent.session.new, {
370
376
  cwd: spec.cwd,
371
377
  mcpServers: spec.mcp ? [{
372
378
  name: "conveno",
@@ -378,18 +384,19 @@ var AcpHost = class {
378
384
  this.acpSessionId = created.sessionId;
379
385
  this.log(`session/new: ${created.sessionId}`);
380
386
  const mode = spec.mode;
381
- if (mode && created.modes?.availableModes.some((m) => m.id === mode)) await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.setMode, {
387
+ if (mode && created.modes?.availableModes.some((m) => m.id === mode)) await this.untilStopped(withTimeout$1(conn.agent.request(methods.agent.session.setMode, {
382
388
  sessionId: created.sessionId,
383
389
  modeId: mode
384
- }), timeout, "session/set_mode")).then(() => this.log(`mode: ${mode}`), (e) => this.log(`could not set mode ${mode}: ${errText(e)}`));
390
+ }), timeout, "session/set_mode")).then(() => this.log(`mode: ${mode}`), (e) => this.log(`could not set mode ${mode}: ${errText$1(e)}`));
385
391
  else if (mode) {
386
392
  const configId = modeConfigId(created.configOptions, mode);
387
- if (configId) await this.untilStopped(withTimeout(conn.agent.request(methods.agent.session.setConfigOption, {
393
+ if (configId) await this.untilStopped(withTimeout$1(conn.agent.request(methods.agent.session.setConfigOption, {
388
394
  sessionId: created.sessionId,
389
395
  configId,
390
396
  value: mode
391
- }), timeout, "session/set_config_option")).then(() => this.log(`mode: ${mode} (config option ${configId})`), (e) => this.log(`could not set mode ${mode}: ${errText(e)}`));
397
+ }), timeout, "session/set_config_option")).then(() => this.log(`mode: ${mode} (config option ${configId})`), (e) => this.log(`could not set mode ${mode}: ${errText$1(e)}`));
392
398
  }
399
+ const modelState = await this.applyModel(conn, created.sessionId, created.configOptions, timeout);
393
400
  const spawnedBy = SessionId.safeParse(spec.spawnedBy);
394
401
  const { session } = await this.client["session.register"]({
395
402
  name: spec.name,
@@ -400,21 +407,75 @@ var AcpHost = class {
400
407
  spawned: true,
401
408
  acp: true,
402
409
  ...spawnedBy.success ? { spawnedBy: spawnedBy.data } : {},
403
- ...agentVersion ? { cliVersion: agentVersion } : {}
410
+ ...agentVersion ? { cliVersion: agentVersion } : {},
411
+ ...modelState.label ? { model: modelState.label.slice(0, 200) } : {}
404
412
  });
405
413
  this.sessionId = session.id;
414
+ this.modelLabel = modelState.label?.slice(0, 200);
406
415
  await this.client["session.setNative"]({
407
416
  sessionId: session.id,
408
417
  nativeId: created.sessionId.slice(0, 256)
409
- }).catch((e) => this.log(`could not record the ACP session id: ${errText(e)}`));
418
+ }).catch((e) => this.log(`could not record the ACP session id: ${errText$1(e)}`));
410
419
  updateSpawnRecord(spec.record, {
411
420
  pid: process.pid,
412
421
  sessionId: session.id,
413
422
  agentPid: agent.pid
414
423
  });
415
424
  this.log(`registered as ${session.name} (${session.id})`);
425
+ for (const note of modelState.notes) await this.tell(`[conveno] Worker ${spec.name}: ${note}`);
416
426
  this.every(this.deps.heartbeatMs ?? 15e3, () => this.heartbeat());
417
427
  }
428
+ /**
429
+ * Set the worker's model, then its effort (the effort list can change with the model), through
430
+ * the CLI's session config options. Never fails the worker: a name the CLI does not offer or an
431
+ * error keeps the CLI's default and leaves a note for the spawner.
432
+ */
433
+ async applyModel(conn, sessionId, initial, timeout) {
434
+ const { spec } = this;
435
+ let options = initial;
436
+ const notes = [];
437
+ const set = async (kind, want) => {
438
+ if (!want) return;
439
+ const opt = findModelOption(options, kind);
440
+ if (!opt) {
441
+ this.log(`${kind}: '${want}' not offered; ${spec.cli} has no ${kind} choice here`);
442
+ notes.push(`${kind} '${want}' is not offered by ${spec.cli}: it has no ${kind} choice here.`);
443
+ return;
444
+ }
445
+ if (!opt.values.some((v) => v.value === want)) {
446
+ const names = opt.values.map((v) => v.value);
447
+ const offered = names.slice(0, 20).join(", ") + (names.length > 20 ? ` and ${names.length - 20} more` : "");
448
+ this.log(`${kind}: '${want}' not offered${opt.current ? `; using ${opt.current}` : ""}. Offered: ${offered}`);
449
+ notes.push(`${kind} '${want}' is not offered by ${spec.cli}${opt.current ? `; it uses ${opt.current}` : ""}. Offered: ${offered}.`);
450
+ return;
451
+ }
452
+ try {
453
+ const r = await this.untilStopped(withTimeout$1(conn.agent.request(methods.agent.session.setConfigOption, {
454
+ sessionId,
455
+ configId: opt.id,
456
+ value: want
457
+ }), timeout, "session/set_config_option"));
458
+ if (Array.isArray(r?.configOptions) && r.configOptions.length > 0) options = r.configOptions;
459
+ } catch (e) {
460
+ this.log(`could not set ${kind} ${want}: ${errText$1(e)}`);
461
+ notes.push(`${kind} '${want}' could not be set on ${spec.cli}; it keeps its default.`);
462
+ }
463
+ };
464
+ await set("model", spec.model);
465
+ await set("effort", spec.effort);
466
+ const m = findModelOption(options, "model");
467
+ const e = findModelOption(options, "effort");
468
+ const label = modelLabel({
469
+ ...m?.current ? { model: m.current } : {},
470
+ ...e?.current ? { effort: e.current } : {}
471
+ });
472
+ if (label) this.log(`model: ${label}`);
473
+ if (spec.modelMenuPath && m) writeModelMenu(spec.modelMenuPath, CliKind.parse(spec.cli), menuFromConfigOptions(options, (/* @__PURE__ */ new Date()).toISOString()));
474
+ return {
475
+ label,
476
+ notes
477
+ };
478
+ }
418
479
  async loop() {
419
480
  let next = this.spec.task ?? null;
420
481
  if (next === null) await this.status("idle", null);
@@ -432,6 +493,7 @@ var AcpHost = class {
432
493
  sessionId: this.me,
433
494
  allowContinue: true
434
495
  });
496
+ this.answering = r.messages;
435
497
  const next = formatContinuation(r.messages, r.orchestrator, r.remaining) || null;
436
498
  if (next === null) await this.status(void 0, this.failedText ?? this.deniedText ?? null);
437
499
  return next;
@@ -439,11 +501,11 @@ var AcpHost = class {
439
501
  if (e instanceof ConvenoError && e.code === RpcErrorCode.NotFound) {
440
502
  this.stop({
441
503
  kind: "session-gone",
442
- detail: errText(e)
504
+ detail: errText$1(e)
443
505
  });
444
506
  return null;
445
507
  }
446
- this.log(`turn.end failed: ${errText(e)}`);
508
+ this.log(`turn.end failed: ${errText$1(e)}`);
447
509
  await this.status("idle", this.failedText ?? this.deniedText ?? null);
448
510
  return null;
449
511
  }
@@ -461,6 +523,8 @@ var AcpHost = class {
461
523
  this.denials = [];
462
524
  this.deniedText = void 0;
463
525
  this.sentThisTurn = false;
526
+ this.askedAt = (this.answering ?? []).filter((m) => m.kind !== "system").map((m) => m.createdAt).sort().at(-1);
527
+ this.answering = void 0;
464
528
  this.sentAtTurnStart = await this.lastSentAt();
465
529
  await this.status("busy", null);
466
530
  const turn = conn.agent.request(methods.agent.session.prompt, {
@@ -514,7 +578,10 @@ var AcpHost = class {
514
578
  sessionId: id,
515
579
  listenerId
516
580
  });
517
- if (r.messages.length > 0) return formatContinuation(r.messages, r.orchestrator, r.remaining);
581
+ if (r.messages.length > 0) {
582
+ this.answering = r.messages;
583
+ return formatContinuation(r.messages, r.orchestrator, r.remaining);
584
+ }
518
585
  if (r.superseded) {
519
586
  this.log("turn.wake: superseded; listening again");
520
587
  return null;
@@ -538,11 +605,11 @@ var AcpHost = class {
538
605
  if (e instanceof ConvenoError && e.code === RpcErrorCode.NotFound) {
539
606
  this.stop({
540
607
  kind: "session-gone",
541
- detail: errText(e)
608
+ detail: errText$1(e)
542
609
  });
543
610
  return null;
544
611
  }
545
- this.log(`waiting for work failed: ${errText(e)}`);
612
+ this.log(`waiting for work failed: ${errText$1(e)}`);
546
613
  await new Promise((r) => setTimeout(r, Math.min(pollMs, 5e3)).unref());
547
614
  return null;
548
615
  } finally {
@@ -581,10 +648,8 @@ var AcpHost = class {
581
648
  if (!decision.allowed) {
582
649
  const what = `${title ?? "a tool call"} (${kind ?? "other"})`;
583
650
  this.denials.push(`${what}: ${decision.why ?? "it was not allowed"}`);
584
- if (!this.spec.spawnedBy) {
585
- this.deniedText = `denied: ${title ?? what}`;
586
- this.status(void 0, this.deniedText);
587
- }
651
+ this.deniedText = `denied: ${title ?? what}`;
652
+ this.status(void 0, this.deniedText);
588
653
  }
589
654
  return { outcome: decision.outcome };
590
655
  }
@@ -606,16 +671,24 @@ var AcpHost = class {
606
671
  this.statusChain = done;
607
672
  await done;
608
673
  }
609
- /** When the daemon last saw this session send a message; undefined if never, or unknown. */
610
- async lastSentAt() {
674
+ /** This session as the daemon has it now; undefined when unknown. */
675
+ async self() {
611
676
  if (!this.sessionId) return void 0;
612
677
  try {
613
678
  const { sessions } = await this.client["session.list"]({ includeOffline: true });
614
- return sessions.find((x) => x.id === this.sessionId)?.lastSentAt;
679
+ return sessions.find((x) => x.id === this.sessionId);
615
680
  } catch {
616
681
  return;
617
682
  }
618
683
  }
684
+ /** When the daemon last saw this session send a message; undefined if never, or unknown. */
685
+ async lastSentAt() {
686
+ return (await this.self())?.lastSentAt;
687
+ }
688
+ /** How a notice names this worker: by its name now, which a rename may have changed. */
689
+ async who() {
690
+ return `[conveno] Worker ${(await this.self())?.name ?? this.spec.name} (${this.spec.cli}, over ACP)`;
691
+ }
619
692
  /** Show that the worker waits for its spawner's answer; null puts the usual status back. */
620
693
  async waitingFor(title) {
621
694
  await this.status(void 0, title === null ? this.deniedText ?? this.lastStatus ?? null : `waiting for permission: ${title}`);
@@ -623,11 +696,14 @@ var AcpHost = class {
623
696
  async heartbeat() {
624
697
  if (!this.sessionId) return;
625
698
  try {
626
- await this.client["session.heartbeat"]({ sessionId: this.sessionId });
699
+ await this.client["session.heartbeat"]({
700
+ sessionId: this.sessionId,
701
+ ...this.modelLabel ? { model: this.modelLabel } : {}
702
+ });
627
703
  } catch (e) {
628
704
  if (e instanceof ConvenoError && e.code === RpcErrorCode.NotFound) this.stop({
629
705
  kind: "session-gone",
630
- detail: errText(e)
706
+ detail: errText$1(e)
631
707
  });
632
708
  }
633
709
  }
@@ -650,7 +726,7 @@ var AcpHost = class {
650
726
  await this.status("idle", this.failedText);
651
727
  if (reason === this.lastPromptFailure) return;
652
728
  this.lastPromptFailure = reason;
653
- await this.tell(`[conveno] Worker ${this.spec.name} (${this.spec.cli}, over ACP) could not run a prompt: ${reason}. It keeps running and takes the next message.`);
729
+ await this.tell(`${await this.who()} could not run a prompt: ${reason}. It keeps running and takes the next message.`);
654
730
  }
655
731
  /** Remember that the worker sent something this turn. Only Conveno's own send tools count. */
656
732
  noteConvenoCall(call) {
@@ -668,9 +744,14 @@ var AcpHost = class {
668
744
  this.denials = [];
669
745
  if (!this.spec.spawnedBy) return;
670
746
  let silent = finished && !this.sentThisTurn;
671
- if (silent && await this.lastSentAt() !== this.sentAtTurnStart) silent = false;
747
+ if (silent) {
748
+ const sent = await this.lastSentAt();
749
+ const askedAt = this.askedAt;
750
+ if (sent !== this.sentAtTurnStart) silent = false;
751
+ else if (sent !== void 0 && askedAt !== void 0 && sent >= askedAt) silent = false;
752
+ }
672
753
  if (denials.length === 0 && !silent) return;
673
- const who = `[conveno] Worker ${this.spec.name} (${this.spec.cli}, over ACP)`;
754
+ const who = await this.who();
674
755
  const lines = [];
675
756
  if (silent) lines.push(`${who} finished its turn without replying.`);
676
757
  if (denials.length > 0) {
@@ -690,7 +771,7 @@ var AcpHost = class {
690
771
  kind: "text",
691
772
  body: { text }
692
773
  }).catch((e) => {
693
- this.log(`could not message the spawner: ${errText(e)}`);
774
+ this.log(`could not message the spawner: ${errText$1(e)}`);
694
775
  });
695
776
  }
696
777
  every(ms, fn) {
@@ -731,7 +812,7 @@ var AcpHost = class {
731
812
  }
732
813
  if (this.sessionId) {
733
814
  const why = describeStop(reason);
734
- if (reason.kind !== "session-gone") await this.tell(`[conveno] Worker ${this.spec.name} (${this.spec.cli}, over ACP) stopped: ${why}. Its session is now offline.`);
815
+ if (reason.kind !== "session-gone") await this.tell(`${await this.who()} stopped: ${why}. Its session is now offline.`);
735
816
  await this.client["session.unregister"]({ sessionId: this.sessionId }).catch(() => void 0);
736
817
  }
737
818
  rmSync(this.spec.record, { force: true });
@@ -831,6 +912,124 @@ function startAgentProcess(opts) {
831
912
  });
832
913
  });
833
914
  }
915
+ /** An agent that throws gets "Internal error" from the SDK, with its own words in `data.details`. */
916
+ const errText = (e) => {
917
+ const details = e?.data?.details;
918
+ if (typeof details === "string" && details.trim() !== "") return details.trim();
919
+ return e instanceof Error ? e.message : String(e);
920
+ };
921
+ function withTimeout(p, ms, what) {
922
+ let timer;
923
+ const late = new Promise((_, reject) => {
924
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${what} timed out after ${ms / 1e3}s.`)), ms);
925
+ });
926
+ return Promise.race([p, late]).finally(() => clearTimeout(timer));
927
+ }
928
+ /**
929
+ * Start `cli`'s ACP server, read the models and efforts it offers, and stop it (with everything it
930
+ * started). Never throws: a failure comes back as a message fit to show.
931
+ */
932
+ async function probeModelMenu(opts) {
933
+ const platform = opts.platform;
934
+ const spec = SPAWN_TABLE[opts.cli]?.acp;
935
+ let launch;
936
+ let timeout = opts.timeoutMs ?? 6e4;
937
+ if (opts.command) launch = {
938
+ file: opts.command.file,
939
+ args: opts.command.args
940
+ };
941
+ else {
942
+ if (!spec) return {
943
+ ok: false,
944
+ message: `${opts.cli} cannot run in the background.`
945
+ };
946
+ const res = resolveAcpProgram(opts.cli, spec, {
947
+ env: opts.env,
948
+ which: opts.which ?? ((name) => findOnPath(name, opts.env, platform)),
949
+ npxConsent: opts.npxConsent
950
+ });
951
+ if (!res.ok) return {
952
+ ok: false,
953
+ message: res.reason === "no-npx" ? `${opts.cli} needs npx to start, and npx was not found. Install Node.js.` : `${opts.cli} is not installed for background workers. Run conveno init to set it up.`
954
+ };
955
+ if (res.run.source.startsWith("npx:") && opts.timeoutMs === void 0) timeout = NPX_SETUP_TIMEOUT_MS;
956
+ launch = planProgram(res.run.program, [...res.run.args, ...spec.args], {
957
+ platform,
958
+ env: opts.env
959
+ });
960
+ }
961
+ const CANCELLED = "Cancelled.";
962
+ if (opts.signal?.aborted) return {
963
+ ok: false,
964
+ message: CANCELLED
965
+ };
966
+ let agent;
967
+ let onAbort;
968
+ const cancelled = new Promise((_, reject) => {
969
+ onAbort = () => {
970
+ agent?.killTree();
971
+ reject(/* @__PURE__ */ new Error(CANCELLED));
972
+ };
973
+ opts.signal?.addEventListener("abort", onAbort, { once: true });
974
+ });
975
+ cancelled.catch(() => void 0);
976
+ try {
977
+ agent = await startAgentProcess({
978
+ file: launch.file,
979
+ args: launch.args,
980
+ cwd: opts.home,
981
+ env: opts.env,
982
+ platform,
983
+ stderr: new Writable({ write: (_c, _e, done) => done() }),
984
+ ...launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
985
+ });
986
+ if (opts.signal?.aborted) return {
987
+ ok: false,
988
+ message: CANCELLED
989
+ };
990
+ const gone = agent.exited.then(({ code, signal }) => {
991
+ throw new Error(`${opts.cli} stopped before it answered (${signal ?? `exit ${code}`}).`);
992
+ });
993
+ gone.catch(() => void 0);
994
+ const conn = client({ name: "conveno" }).connect(ndJsonStream(Writable.toWeb(agent.stdin), Readable.toWeb(agent.stdout)));
995
+ const step = (p, what) => Promise.race([
996
+ withTimeout(p, timeout, what),
997
+ gone,
998
+ cancelled
999
+ ]);
1000
+ await step(conn.agent.request(methods.agent.initialize, {
1001
+ protocolVersion: PROTOCOL_VERSION,
1002
+ clientCapabilities: {
1003
+ fs: {
1004
+ readTextFile: false,
1005
+ writeTextFile: false
1006
+ },
1007
+ terminal: false
1008
+ },
1009
+ clientInfo: {
1010
+ name: "conveno",
1011
+ version: "probe"
1012
+ }
1013
+ }), "initialize");
1014
+ const created = await step(conn.agent.request(methods.agent.session.new, {
1015
+ cwd: opts.home,
1016
+ mcpServers: []
1017
+ }), "session/new");
1018
+ const at = (opts.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
1019
+ return {
1020
+ ok: true,
1021
+ menu: menuFromConfigOptions(created.configOptions, at)
1022
+ };
1023
+ } catch (e) {
1024
+ return {
1025
+ ok: false,
1026
+ message: opts.signal?.aborted ? CANCELLED : errText(e)
1027
+ };
1028
+ } finally {
1029
+ if (onAbort) opts.signal?.removeEventListener("abort", onAbort);
1030
+ agent?.killTree();
1031
+ }
1032
+ }
834
1033
  /**
835
1034
  * `conveno acp-host <launch file>`: read and delete the launch file, connect to the daemon and
836
1035
  * drive the worker until it stops. Returns the exit code.
@@ -858,4 +1057,4 @@ async function runAcpHostFromFile(path, opts = {}) {
858
1057
  await client.close().catch(() => void 0);
859
1058
  }
860
1059
  }
861
- export { runAcpHostFromFile as n, stopRequestPath as r, killProcessTree as t };
1060
+ export { stopRequestPath as i, probeModelMenu as n, runAcpHostFromFile as r, killProcessTree as t };