@moxt-ai/mobius 0.0.357 → 0.0.359

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 (69) hide show
  1. package/dist/cli.js +244 -190
  2. package/dist/cli.js.map +3 -3
  3. package/dist/engine/acp/adapter/adapter-registry.d.ts +1 -1
  4. package/dist/engine/acp/adapter/adapter-registry.d.ts.map +1 -1
  5. package/dist/engine/acp/adapter/adapter-registry.js +2 -1
  6. package/dist/engine/acp/adapter/adapter-registry.js.map +1 -1
  7. package/dist/engine/acp/adapter/claude/adapter.d.ts +8 -35
  8. package/dist/engine/acp/adapter/claude/adapter.d.ts.map +1 -1
  9. package/dist/engine/acp/adapter/claude/adapter.js +7 -6
  10. package/dist/engine/acp/adapter/claude/adapter.js.map +1 -1
  11. package/dist/engine/acp/adapter/codex/adapter.d.ts +8 -35
  12. package/dist/engine/acp/adapter/codex/adapter.d.ts.map +1 -1
  13. package/dist/engine/acp/adapter/codex/adapter.js +21 -9
  14. package/dist/engine/acp/adapter/codex/adapter.js.map +1 -1
  15. package/dist/engine/acp/adapter/live-sessions.d.ts +1 -1
  16. package/dist/engine/acp/adapter/live-sessions.d.ts.map +1 -1
  17. package/dist/engine/acp/adapter/live-sessions.js +1 -0
  18. package/dist/engine/acp/adapter/live-sessions.js.map +1 -1
  19. package/dist/engine/acp/adapter/native-session-lookup.d.ts +2 -2
  20. package/dist/engine/acp/adapter/native-session-lookup.d.ts.map +1 -1
  21. package/dist/engine/acp/adapter/native-session-lookup.js +4 -4
  22. package/dist/engine/acp/adapter/native-session-lookup.js.map +1 -1
  23. package/dist/engine/acp/adapter/pi/adapter.d.ts +8 -35
  24. package/dist/engine/acp/adapter/pi/adapter.d.ts.map +1 -1
  25. package/dist/engine/acp/adapter/pi/adapter.js +7 -6
  26. package/dist/engine/acp/adapter/pi/adapter.js.map +1 -1
  27. package/dist/engine/acp/adapter/query-processes.d.ts +10 -7
  28. package/dist/engine/acp/adapter/query-processes.d.ts.map +1 -1
  29. package/dist/engine/acp/adapter/query-processes.js +66 -79
  30. package/dist/engine/acp/adapter/query-processes.js.map +1 -1
  31. package/dist/engine/acp/adapter/query-session.d.ts +6 -4
  32. package/dist/engine/acp/adapter/query-session.d.ts.map +1 -1
  33. package/dist/engine/acp/adapter/query-session.js +37 -22
  34. package/dist/engine/acp/adapter/query-session.js.map +1 -1
  35. package/dist/engine/acp/adapter/registry.js +3 -3
  36. package/dist/engine/acp/adapter/registry.js.map +1 -1
  37. package/dist/engine/acp/adapter/session-events.d.ts +1 -0
  38. package/dist/engine/acp/adapter/session-events.d.ts.map +1 -1
  39. package/dist/engine/acp/adapter/session-events.js +3 -0
  40. package/dist/engine/acp/adapter/session-events.js.map +1 -1
  41. package/dist/engine/acp/harness/codex/agent.d.ts.map +1 -1
  42. package/dist/engine/acp/harness/codex/agent.js +14 -8
  43. package/dist/engine/acp/harness/codex/agent.js.map +1 -1
  44. package/dist/engine/acp/harness/codex/borrowed-agent.d.ts.map +1 -1
  45. package/dist/engine/acp/harness/codex/borrowed-agent.js +18 -5
  46. package/dist/engine/acp/harness/codex/borrowed-agent.js.map +1 -1
  47. package/dist/engine/acp/harness/codex/history.js +1 -1
  48. package/dist/engine/acp/harness/codex/history.js.map +1 -1
  49. package/dist/engine/acp/harness/codex/items.js +1 -1
  50. package/dist/engine/acp/harness/codex/owned-agent.d.ts.map +1 -1
  51. package/dist/engine/acp/harness/codex/owned-agent.js +3 -2
  52. package/dist/engine/acp/harness/codex/owned-agent.js.map +1 -1
  53. package/dist/engine/acp/native-history/preview-contract.d.ts +6 -13
  54. package/dist/engine/acp/native-history/preview-contract.d.ts.map +1 -1
  55. package/dist/engine/runtime/run.js +1 -1
  56. package/dist/engine/runtime/run.js.map +1 -1
  57. package/dist/engine/session/live/agent-session.d.ts +1 -1
  58. package/dist/engine/session/live/agent-session.d.ts.map +1 -1
  59. package/dist/engine/session/live/agent-session.js +2 -1
  60. package/dist/engine/session/live/agent-session.js.map +1 -1
  61. package/dist/engine/session/manager/session-manager.d.ts.map +1 -1
  62. package/dist/engine/session/manager/session-manager.js +14 -1
  63. package/dist/engine/session/manager/session-manager.js.map +1 -1
  64. package/dist/engine/session/native/native-session-browser.d.ts.map +1 -1
  65. package/dist/engine/session/native/native-session-browser.js +8 -8
  66. package/dist/engine/session/native/native-session-browser.js.map +1 -1
  67. package/dist/engine.js +241 -183
  68. package/dist/engine.js.map +4 -4
  69. package/package.json +2 -2
package/dist/engine.js CHANGED
@@ -69073,17 +69073,20 @@ var CodexBorrowedAcpAgent = class {
69073
69073
  this.#seen.set(key, text2);
69074
69074
  continue;
69075
69075
  }
69076
+ if (item.type === "plan" && turn.status === "inProgress") {
69077
+ continue;
69078
+ }
69076
69079
  const previous = this.#seen.get(key);
69077
- const value = item.type === "agentMessage" ? item.text : reasoningText(item) ?? JSON.stringify(item);
69080
+ const value = item.type === "agentMessage" || item.type === "plan" ? item.text : reasoningText(item) ?? JSON.stringify(item);
69078
69081
  this.#seen.set(key, value);
69079
69082
  if (baseline || value === previous) {
69080
69083
  continue;
69081
69084
  }
69082
- if (item.type === "agentMessage" || reasoningText(item) !== null) {
69085
+ if (item.type === "agentMessage" || item.type === "plan" || reasoningText(item) !== null) {
69083
69086
  const text2 = previous !== void 0 && value.startsWith(previous) ? value.slice(previous.length) : value;
69084
69087
  if (text2.length > 0) {
69085
69088
  await this.#emit({
69086
- sessionUpdate: item.type === "agentMessage" ? "agent_message_chunk" : "agent_thought_chunk",
69089
+ sessionUpdate: item.type === "reasoning" ? "agent_thought_chunk" : "agent_message_chunk",
69087
69090
  messageId: item.id,
69088
69091
  content: { type: "text", text: text2 }
69089
69092
  });
@@ -69128,6 +69131,7 @@ var CodexBorrowedAcpAgent = class {
69128
69131
  content,
69129
69132
  clientId: randomUUID7(),
69130
69133
  completion: Promise.withResolvers(),
69134
+ settled: Promise.withResolvers(),
69131
69135
  input: { kind: "awaiting" }
69132
69136
  };
69133
69137
  this.#pending = pending;
@@ -69165,7 +69169,6 @@ var CodexBorrowedAcpAgent = class {
69165
69169
  throw cause;
69166
69170
  } finally {
69167
69171
  signal.removeEventListener("abort", abort);
69168
- this.#pending = null;
69169
69172
  if (outcome === "cancelled") {
69170
69173
  try {
69171
69174
  await this.#removeQueuedInput(pending.clientId);
@@ -69173,6 +69176,8 @@ var CodexBorrowedAcpAgent = class {
69173
69176
  console.error("The cancelled Codex queued input could not be removed", cause);
69174
69177
  }
69175
69178
  }
69179
+ this.#pending = null;
69180
+ pending.settled.resolve();
69176
69181
  }
69177
69182
  };
69178
69183
  #removeQueuedInput = async (clientId) => {
@@ -69232,7 +69237,11 @@ var CodexBorrowedAcpAgent = class {
69232
69237
  );
69233
69238
  };
69234
69239
  cancel = async () => {
69235
- this.#pending?.completion.resolve({ stopReason: "cancelled" });
69240
+ const pending = this.#pending;
69241
+ if (pending !== null) {
69242
+ pending.completion.resolve({ stopReason: "cancelled" });
69243
+ await pending.settled.promise;
69244
+ }
69236
69245
  };
69237
69246
  close = async () => {
69238
69247
  this.#lifecycle = { kind: "closed" };
@@ -69852,7 +69861,7 @@ var CodexOwnedAcpAgent = class {
69852
69861
  }
69853
69862
  return;
69854
69863
  }
69855
- if (item.type === "agentMessage") {
69864
+ if (item.type === "agentMessage" || item.type === "plan") {
69856
69865
  if (method === "item/started") {
69857
69866
  this.#agentMessages.set(item.id, "started");
69858
69867
  return;
@@ -70270,7 +70279,7 @@ async function replayCodexHistory(client2, threadId, emit, signal) {
70270
70279
  });
70271
70280
  }
70272
70281
  }
70273
- } else if (item.type === "agentMessage") {
70282
+ } else if (item.type === "agentMessage" || item.type === "plan") {
70274
70283
  await emit(agentMessageUpdate(item.id, item.text));
70275
70284
  } else if (item.type === "reasoning") {
70276
70285
  const text2 = reasoningText(item);
@@ -70933,16 +70942,19 @@ var CodexAcpAgent = class {
70933
70942
  */
70934
70943
  close = () => {
70935
70944
  if (this.#closePromise === null) {
70936
- this.#appServer.detach();
70937
70945
  this.#closePromise = (async () => {
70938
- await this.#sessionAgent.close();
70939
- const child = this.#appServer.child();
70940
70946
  try {
70941
- const captured = await captureProcessTree(child);
70942
- await stopProcessTree(child, captured);
70947
+ await this.#sessionAgent.close();
70943
70948
  } finally {
70944
- this.#connection?.close();
70945
- this.#onBackgroundActivity?.("none");
70949
+ this.#appServer.detach();
70950
+ const child = this.#appServer.child();
70951
+ try {
70952
+ const captured = await captureProcessTree(child);
70953
+ await stopProcessTree(child, captured);
70954
+ } finally {
70955
+ this.#connection?.close();
70956
+ this.#onBackgroundActivity?.("none");
70957
+ }
70946
70958
  }
70947
70959
  })();
70948
70960
  }
@@ -75835,6 +75847,7 @@ var AdapterRegistry = class {
75835
75847
  resolve = (agent) => {
75836
75848
  const existing = this.#adapters.get(agent.id);
75837
75849
  if (existing !== void 0) {
75850
+ existing.refreshAgent(agent);
75838
75851
  return existing;
75839
75852
  }
75840
75853
  const adapter = this.#resolve(agent, this.#dependencies);
@@ -76370,6 +76383,9 @@ var AdapterSessionConnection = class {
76370
76383
  get connection() {
76371
76384
  return this.#connection.connection;
76372
76385
  }
76386
+ get termination() {
76387
+ return this.#connection.termination;
76388
+ }
76373
76389
  initialize = (signal) => this.#connection.initialize(signal);
76374
76390
  agentSettingsModelEffort = () => this.#connection.agentSettingsModelEffort();
76375
76391
  race = (operation, exitMessage, signal) => this.#connection.race(operation, exitMessage, signal);
@@ -76483,6 +76499,7 @@ var AcpLiveSessions = class {
76483
76499
  "ACP agent exited while cancelling a prompt",
76484
76500
  bounded
76485
76501
  );
76502
+ return "retained";
76486
76503
  };
76487
76504
  closeSession = async (target, signal) => {
76488
76505
  const session = this.#find(target);
@@ -76694,7 +76711,7 @@ var lookupSchema = external_exports.object({
76694
76711
  maximumEntries: external_exports.number().int().positive().nullable()
76695
76712
  })
76696
76713
  });
76697
- async function findNativeSession(list, query, nativeSessionId, budget) {
76714
+ async function findNativeSession(list, cwd, nativeSessionId, budget, signal) {
76698
76715
  const decoded = lookupSchema.safeParse({ nativeSessionId, budget });
76699
76716
  if (!decoded.success) {
76700
76717
  throw new AcpExecutionError(
@@ -76708,9 +76725,9 @@ async function findNativeSession(list, query, nativeSessionId, budget) {
76708
76725
  let inspected = 0;
76709
76726
  const visited = /* @__PURE__ */ new Set();
76710
76727
  for (let pageNumber = 0; pageNumber < limits.maximumPages; pageNumber += 1) {
76711
- query.signal.throwIfAborted();
76712
- const page = await list(query, cursor);
76713
- query.signal.throwIfAborted();
76728
+ signal.throwIfAborted();
76729
+ const page = await list(cwd, cursor, signal);
76730
+ signal.throwIfAborted();
76714
76731
  inspected += page.sessions.length;
76715
76732
  const found = page.sessions.find((session) => session.sessionId === decoded.data.nativeSessionId);
76716
76733
  if (found !== void 0) {
@@ -76732,6 +76749,9 @@ async function findNativeSession(list, query, nativeSessionId, budget) {
76732
76749
  throw new AcpExecutionError("The native session was not found", {}, "native_session_not_found");
76733
76750
  }
76734
76751
 
76752
+ // src/engine/acp/adapter/query-processes.ts
76753
+ import { randomUUID as randomUUID14 } from "node:crypto";
76754
+
76735
76755
  // src/engine/session/history/session-event-store.ts
76736
76756
  import { randomUUID as randomUUID13 } from "node:crypto";
76737
76757
 
@@ -77440,45 +77460,51 @@ async function initializeAgentConnection(connection, agentId, verifiedVersion, s
77440
77460
 
77441
77461
  // src/engine/acp/adapter/query-session.ts
77442
77462
  var AcpQuerySession = class _AcpQuerySession {
77443
- #options;
77463
+ #cwd;
77464
+ #sessionId;
77444
77465
  #events;
77445
77466
  #connection;
77467
+ #lifecycle = { kind: "open" };
77446
77468
  #capabilities = unsupportedSessionCapabilities();
77447
77469
  #configOptions = [];
77448
- constructor(options, events, connector) {
77449
- this.#options = options;
77470
+ constructor(agent, cwd, sessionId, events, connector) {
77471
+ this.#cwd = cwd;
77472
+ this.#sessionId = sessionId;
77450
77473
  this.#events = events;
77451
77474
  this.#connection = connector.connectQuerySession({
77452
- agent: options.agent,
77453
- cwd: options.cwd,
77454
- sessionId: () => options.sessionId,
77475
+ agent,
77476
+ cwd,
77477
+ sessionId: () => sessionId,
77455
77478
  configOptions: () => this.#configOptions,
77456
77479
  onEvent: async (event) => {
77457
- this.#events.append(options.sessionId, { type: "acp", payload: event.payload });
77480
+ this.#events.append(sessionId, { type: "acp", payload: event.payload });
77458
77481
  if (event.kind === "configuration") {
77459
77482
  this.#configOptions = event.configOptions;
77460
77483
  }
77461
77484
  }
77462
77485
  });
77486
+ void this.#connection.termination.then(() => {
77487
+ this.#lifecycle = { kind: "terminated" };
77488
+ });
77463
77489
  }
77464
- static start = async (options, events, connector) => {
77490
+ static start = async (agent, cwd, sessionId, events, connector, signal) => {
77465
77491
  for (let attempt = 1; attempt <= 2; attempt += 1) {
77466
- await validateAgentRuntime(options.agent, options.signal);
77467
- const runtime = new _AcpQuerySession(options, events, connector);
77492
+ await validateAgentRuntime(agent, signal);
77493
+ const runtime = new _AcpQuerySession(agent, cwd, sessionId, events, connector);
77468
77494
  try {
77469
77495
  const initialized = await initializeAgentConnection(
77470
77496
  runtime.#connection,
77471
- options.agent.id,
77472
- options.agent.agentVersion,
77473
- options.signal
77497
+ agent.id,
77498
+ agent.agentVersion,
77499
+ signal
77474
77500
  );
77475
77501
  runtime.#capabilities = initialized.capabilities;
77476
77502
  return runtime;
77477
77503
  } catch (error62) {
77478
77504
  await runtime.closeProcess();
77479
- options.signal.throwIfAborted();
77505
+ signal.throwIfAborted();
77480
77506
  if (error62 instanceof RetryableAcpInitializationError && attempt === 1) {
77481
- console.warn(`[${options.agent.id}-acp] ACP agent initialization failed; retrying once`);
77507
+ console.warn(`[${agent.id}-acp] ACP agent initialization failed; retrying once`);
77482
77508
  continue;
77483
77509
  }
77484
77510
  if (error62 instanceof AcpExecutionError) {
@@ -77490,7 +77516,18 @@ var AcpQuerySession = class _AcpQuerySession {
77490
77516
  throw new AcpExecutionError("ACP agent initialization failed");
77491
77517
  };
77492
77518
  capabilities = () => this.#capabilities;
77493
- belongsTo = (agentId, cwd, directories) => this.#options.agent.id === agentId && this.#options.cwd === cwd && arraysEqual(this.#options.additionalDirectories, directories);
77519
+ hasTerminated = () => {
77520
+ switch (this.#lifecycle.kind) {
77521
+ case "open":
77522
+ return false;
77523
+ case "terminated":
77524
+ return true;
77525
+ default: {
77526
+ const unreachable3 = this.#lifecycle;
77527
+ return unreachable3;
77528
+ }
77529
+ }
77530
+ };
77494
77531
  listNativeSessions = async (cursor, signal) => {
77495
77532
  if (!this.#capabilities.listSessions) {
77496
77533
  throw new AcpExecutionError(
@@ -77516,7 +77553,7 @@ var AcpQuerySession = class _AcpQuerySession {
77516
77553
  }
77517
77554
  return decoded.data;
77518
77555
  };
77519
- previewEvents = async (nativeSessionId, eventLimit, signal) => {
77556
+ previewEvents = async (nativeSessionId, eventLimit, additionalDirectories, signal) => {
77520
77557
  if (!this.#capabilities.loadSession) {
77521
77558
  throw new AcpExecutionError(
77522
77559
  "This Agent restores context but does not provide message history.",
@@ -77524,14 +77561,14 @@ var AcpQuerySession = class _AcpQuerySession {
77524
77561
  "native_history_unsupported"
77525
77562
  );
77526
77563
  }
77527
- this.#events.reset(this.#options.sessionId);
77564
+ this.#events.reset(this.#sessionId);
77528
77565
  this.#connection.events.select(nativeSessionId);
77529
77566
  await this.#connection.race(
77530
77567
  this.#connection.connection.agent.request(
77531
77568
  methods12.agent.session.load,
77532
77569
  {
77533
- additionalDirectories: [...this.#options.additionalDirectories],
77534
- cwd: this.#options.cwd,
77570
+ additionalDirectories: [...additionalDirectories],
77571
+ cwd: this.#cwd,
77535
77572
  mcpServers: [],
77536
77573
  sessionId: nativeSessionId
77537
77574
  },
@@ -77542,125 +77579,105 @@ var AcpQuerySession = class _AcpQuerySession {
77542
77579
  );
77543
77580
  await this.#connection.events.drained();
77544
77581
  signal.throwIfAborted();
77545
- return this.#events.page(this.#options.sessionId, eventLimit, null);
77582
+ return this.#events.page(this.#sessionId, eventLimit, null);
77546
77583
  };
77547
77584
  closeProcess = async () => await this.#connection.closeProcess();
77585
+ discardEvents = () => this.#events.remove(this.#sessionId);
77548
77586
  };
77549
77587
 
77550
77588
  // src/engine/acp/adapter/query-processes.ts
77551
77589
  var AgentQueryProcesses = class {
77552
77590
  #eventPreviewsBySession = /* @__PURE__ */ new Map();
77553
- #processesByQuery;
77591
+ #processesByAgent = /* @__PURE__ */ new Map();
77592
+ #agent;
77554
77593
  #processes;
77555
77594
  #store = new MemorySessionEventStore();
77556
77595
  #connector;
77557
- constructor(processes, connector) {
77596
+ constructor(agent, processes, connector) {
77597
+ this.#agent = agent;
77558
77598
  this.#processes = processes;
77559
77599
  this.#connector = connector;
77560
- this.#processesByQuery = new RetainedAgentProcesses({
77561
- touch: processes.touch,
77562
- changed: processes.notifyChanged
77563
- });
77564
77600
  }
77565
- retire = async (sessionId, runtime) => {
77566
- const retained = this.#processesByQuery.detach(sessionId, runtime);
77567
- if (retained) {
77568
- this.#store.remove(sessionId);
77601
+ refreshAgent = (agent) => {
77602
+ this.#agent = agent;
77603
+ };
77604
+ retire = async (readers, cwd, runtime) => {
77605
+ readers.detach(cwd, runtime);
77606
+ try {
77607
+ await this.#processes.retire(runtime, () => runtime.closeProcess());
77608
+ } finally {
77609
+ runtime.discardEvents();
77569
77610
  }
77570
- await this.#processes.retire(runtime, () => runtime.closeProcess());
77571
77611
  };
77572
- async #startRetained(options) {
77573
- const runtime = await this.#processes.startRetained(
77574
- options.signal,
77575
- () => AcpQuerySession.start(options, this.#store, this.#connector),
77576
- {
77577
- isBusy: () => this.#processesByQuery.isBusy(options.sessionId),
77578
- retire: (runtime2) => this.retire(options.sessionId, runtime2),
77579
- retireIdle: (runtime2) => this.retire(options.sessionId, runtime2)
77580
- }
77581
- );
77582
- this.#processesByQuery.retain(options.sessionId, runtime);
77583
- return runtime;
77584
- }
77585
- async #startPreparation(options) {
77586
- return await this.#processesByQuery.prepare(options.sessionId, async () => {
77587
- return await this.#startRetained(options);
77588
- });
77589
- }
77590
- async #replacePreparation(existing, options) {
77591
- return await this.#processesByQuery.prepare(options.sessionId, async () => {
77592
- await this.retire(options.sessionId, existing);
77593
- return await this.#startRetained(options);
77594
- });
77595
- }
77596
- #prepare = async (options) => {
77597
- const pending = this.#processesByQuery.pending(options.sessionId);
77612
+ async #ensure(agent, readers, cwd, signal) {
77613
+ signal.throwIfAborted();
77614
+ const pending = readers.pending(cwd);
77598
77615
  if (pending !== void 0) {
77599
- const runtime2 = await waitForSharedOperation(pending, options.signal);
77600
- if (runtime2.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
77601
- this.#processesByQuery.touch(options.sessionId, runtime2);
77602
- return runtime2.capabilities();
77603
- }
77604
- return await this.#prepare(options);
77616
+ return await waitForSharedOperation(pending, signal);
77605
77617
  }
77606
- const existing = this.#processesByQuery.get(options.sessionId);
77607
- if (existing !== void 0) {
77608
- if (existing.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
77609
- this.#processesByQuery.touch(options.sessionId, existing);
77610
- return existing.capabilities();
77611
- }
77612
- const runtime2 = await this.#replacePreparation(existing, options);
77613
- return runtime2.capabilities();
77614
- }
77615
- const runtime = await this.#startPreparation(options);
77616
- return runtime.capabilities();
77617
- };
77618
- async #ensure(options) {
77619
- const existing = this.#processesByQuery.get(options.sessionId);
77620
- if (existing !== void 0) {
77621
- if (!existing.belongsTo(options.agent.id, options.cwd, options.additionalDirectories)) {
77622
- throw new AcpExecutionError(
77623
- "The agent or workspace cannot change after a conversation has started",
77624
- {},
77625
- "session_identity_mismatch"
77626
- );
77627
- }
77628
- this.#processesByQuery.touch(options.sessionId, existing);
77618
+ const existing = readers.get(cwd);
77619
+ if (existing !== void 0 && !existing.hasTerminated()) {
77620
+ readers.touch(cwd, existing);
77629
77621
  return existing;
77630
77622
  }
77631
- await this.#prepare(options);
77632
- const started = this.#processesByQuery.get(options.sessionId);
77633
- if (started === void 0) {
77634
- throw new AcpExecutionError("ACP native session browser did not start");
77635
- }
77636
- return started;
77623
+ return await readers.prepare(cwd, async () => {
77624
+ if (existing !== void 0) {
77625
+ await this.retire(readers, cwd, existing);
77626
+ }
77627
+ const readerId = randomUUID14();
77628
+ const runtime = await this.#processes.startRetained(
77629
+ signal,
77630
+ () => AcpQuerySession.start(agent, cwd, readerId, this.#store, this.#connector, signal),
77631
+ {
77632
+ isBusy: () => readers.isBusy(cwd),
77633
+ retire: (runtime2) => this.retire(readers, cwd, runtime2),
77634
+ retireIdle: (runtime2) => this.retire(readers, cwd, runtime2)
77635
+ }
77636
+ );
77637
+ readers.retain(cwd, runtime);
77638
+ return runtime;
77639
+ });
77637
77640
  }
77638
- #use = async (options, operation) => await this.#processesByQuery.use(options.sessionId, async () => await operation(await this.#ensure(options)));
77639
- capabilities = async (query) => await this.#prepare(query);
77640
- listNativeSessions = async (query, cursor) => await this.#use(query, async (runtime) => await runtime.listNativeSessions(cursor, query.signal));
77641
- previewSessionEvents = async (options, request) => {
77642
- const { nativeSessionId, eventLimit, cursor } = request;
77641
+ #use = async (cwd, signal, operation) => {
77642
+ const agent = this.#agent;
77643
+ let readers = this.#processesByAgent.get(agent);
77644
+ if (readers === void 0) {
77645
+ readers = new RetainedAgentProcesses({
77646
+ touch: this.#processes.touch,
77647
+ changed: this.#processes.notifyChanged
77648
+ });
77649
+ this.#processesByAgent.set(agent, readers);
77650
+ }
77651
+ const current = readers;
77652
+ return await current.use(cwd, async () => await operation(await this.#ensure(agent, current, cwd, signal)));
77653
+ };
77654
+ capabilities = async (cwd, signal) => await this.#use(cwd, signal, async (runtime) => runtime.capabilities());
77655
+ listNativeSessions = async (cwd, cursor, signal) => await this.#use(cwd, signal, async (runtime) => await runtime.listNativeSessions(cursor, signal));
77656
+ previewSessionEvents = async (cwd, additionalDirectories, request, signal) => {
77657
+ signal.throwIfAborted();
77658
+ const agent = this.#agent;
77659
+ const { nativeSessionId, eventLimit, cursor, sessionId } = request;
77643
77660
  if (cursor !== null) {
77644
- const preview = this.#eventPreviewsBySession.get(options.sessionId);
77661
+ const preview = this.#eventPreviewsBySession.get(sessionId);
77645
77662
  if (preview === void 0 || preview.nativeSessionId !== nativeSessionId) {
77646
77663
  throw new Error("The native event cursor is invalid");
77647
77664
  }
77648
- return preview.store.page(options.sessionId, eventLimit, cursor);
77665
+ return preview.store.page(sessionId, eventLimit, cursor);
77649
77666
  }
77650
77667
  const store = new MemorySessionEventStore();
77651
- const previous = this.#eventPreviewsBySession.get(options.sessionId);
77668
+ const previous = this.#eventPreviewsBySession.get(sessionId);
77652
77669
  previous?.store.close();
77653
- this.#eventPreviewsBySession.set(options.sessionId, { nativeSessionId, store });
77670
+ this.#eventPreviewsBySession.set(sessionId, { nativeSessionId, store });
77654
77671
  try {
77655
77672
  return await this.#processes.runTransient(
77656
- options.signal,
77657
- async () => await AcpQuerySession.start(options, store, this.#connector),
77658
- async (runtime) => await runtime.previewEvents(nativeSessionId, eventLimit, options.signal),
77673
+ signal,
77674
+ async () => await AcpQuerySession.start(agent, cwd, sessionId, store, this.#connector, signal),
77675
+ async (runtime) => await runtime.previewEvents(nativeSessionId, eventLimit, additionalDirectories, signal),
77659
77676
  async (runtime) => await runtime.closeProcess()
77660
77677
  );
77661
77678
  } catch (error62) {
77662
- if (this.#eventPreviewsBySession.get(options.sessionId)?.store === store) {
77663
- this.#eventPreviewsBySession.delete(options.sessionId);
77679
+ if (this.#eventPreviewsBySession.get(sessionId)?.store === store) {
77680
+ this.#eventPreviewsBySession.delete(sessionId);
77664
77681
  }
77665
77682
  store.close();
77666
77683
  throw error62;
@@ -77668,8 +77685,11 @@ var AgentQueryProcesses = class {
77668
77685
  };
77669
77686
  close = async () => {
77670
77687
  await Promise.all(
77671
- this.#processesByQuery.entries().map(async ([id, runtime]) => await this.retire(id, runtime))
77688
+ [...this.#processesByAgent.values()].flatMap(
77689
+ (readers) => readers.entries().map(async ([cwd, runtime]) => await this.retire(readers, cwd, runtime))
77690
+ )
77672
77691
  );
77692
+ this.#processesByAgent.clear();
77673
77693
  for (const preview of this.#eventPreviewsBySession.values()) {
77674
77694
  preview.store.close();
77675
77695
  }
@@ -77683,12 +77703,13 @@ var ClaudeAdapter = class {
77683
77703
  #queryProcesses;
77684
77704
  #connector;
77685
77705
  #liveSessions;
77686
- constructor(dependencies) {
77706
+ constructor(agent, dependencies) {
77687
77707
  this.#connector = new AcpSessionConnector(dependencies.contentExternalizer);
77688
77708
  this.#liveSessions = new AcpLiveSessions(dependencies.contentExternalizer);
77689
- this.#queryProcesses = new AgentQueryProcesses(dependencies.processes, this.#connector);
77709
+ this.#queryProcesses = new AgentQueryProcesses(agent, dependencies.processes, this.#connector);
77690
77710
  }
77691
- getCapabilities = async (query) => await this.#queryProcesses.capabilities(query);
77711
+ refreshAgent = (agent) => this.#queryProcesses.refreshAgent(agent);
77712
+ getCapabilities = (cwd, signal) => this.#queryProcesses.capabilities(cwd, signal);
77692
77713
  connectSession = (options) => this.#liveSessions.connectSession(options);
77693
77714
  cancel = (...args) => this.#liveSessions.cancel(...args);
77694
77715
  closeSession = (...args) => this.#liveSessions.closeSession(...args);
@@ -77696,9 +77717,9 @@ var ClaudeAdapter = class {
77696
77717
  steer = (...args) => this.#liveSessions.steer(...args);
77697
77718
  renameSession = (...args) => this.#liveSessions.renameSession(...args);
77698
77719
  configureSession = (...args) => this.#liveSessions.configureSession(...args);
77699
- listSessions = async (query, cursor) => await this.#queryProcesses.listNativeSessions(query, cursor);
77700
- findSession = (query, nativeSessionId, budget) => findNativeSession(this.listSessions, query, nativeSessionId, budget);
77701
- readSessionHistory = async (query, request) => await this.#queryProcesses.previewSessionEvents(query, request);
77720
+ listSessions = (cwd, cursor, signal) => this.#queryProcesses.listNativeSessions(cwd, cursor, signal);
77721
+ findSession = (cwd, nativeSessionId, budget, signal) => findNativeSession(this.listSessions, cwd, nativeSessionId, budget, signal);
77722
+ readSessionHistory = (cwd, additionalDirectories, request, signal) => this.#queryProcesses.previewSessionEvents(cwd, additionalDirectories, request, signal);
77702
77723
  close = async () => await runCleanup(
77703
77724
  () => this.#queryProcesses.close(),
77704
77725
  () => this.#liveSessions.close()
@@ -83003,13 +83024,15 @@ function fitCodexToolEvent(event) {
83003
83024
 
83004
83025
  // src/engine/acp/adapter/codex/adapter.ts
83005
83026
  var CodexAdapter = class {
83027
+ #agent;
83006
83028
  #queryProcesses;
83007
83029
  #connector;
83008
83030
  #liveSessions;
83009
83031
  #dependencies;
83010
83032
  #contentExternalizer;
83011
83033
  #previewCache = null;
83012
- constructor(dependencies) {
83034
+ constructor(agent, dependencies) {
83035
+ this.#agent = agent;
83013
83036
  this.#dependencies = dependencies;
83014
83037
  this.#contentExternalizer = {
83015
83038
  update: async (sessionId, update, signal) => {
@@ -83021,18 +83044,25 @@ var CodexAdapter = class {
83021
83044
  };
83022
83045
  this.#connector = new AcpSessionConnector(this.#contentExternalizer, fitCodexToolEvent);
83023
83046
  this.#liveSessions = new AcpLiveSessions(this.#contentExternalizer, fitCodexToolEvent);
83024
- this.#queryProcesses = new AgentQueryProcesses(dependencies.processes, this.#connector);
83047
+ this.#queryProcesses = new AgentQueryProcesses(agent, dependencies.processes, this.#connector);
83025
83048
  }
83026
- getCapabilities = async (query) => await this.#queryProcesses.capabilities(query);
83049
+ refreshAgent = (agent) => {
83050
+ this.#agent = agent;
83051
+ this.#queryProcesses.refreshAgent(agent);
83052
+ };
83053
+ getCapabilities = (cwd, signal) => this.#queryProcesses.capabilities(cwd, signal);
83027
83054
  connectSession = (options) => this.#liveSessions.connectSession(options);
83028
- cancel = (...args) => this.#liveSessions.cancel(...args);
83055
+ cancel = async (target, signal) => {
83056
+ await this.#liveSessions.closeSession(target, signal);
83057
+ return "closed";
83058
+ };
83029
83059
  closeSession = (...args) => this.#liveSessions.closeSession(...args);
83030
83060
  prompt = (...args) => this.#liveSessions.prompt(...args);
83031
83061
  steer = (...args) => this.#liveSessions.steer(...args);
83032
83062
  renameSession = (...args) => this.#liveSessions.renameSession(...args);
83033
83063
  configureSession = (...args) => this.#liveSessions.configureSession(...args);
83034
- listSessions = async (query, cursor) => await this.#queryProcesses.listNativeSessions(query, cursor);
83035
- findSession = (query, nativeSessionId, budget) => findNativeSession(this.listSessions, query, nativeSessionId, budget);
83064
+ listSessions = (cwd, cursor, signal) => this.#queryProcesses.listNativeSessions(cwd, cursor, signal);
83065
+ findSession = (cwd, nativeSessionId, budget, signal) => findNativeSession(this.listSessions, cwd, nativeSessionId, budget, signal);
83036
83066
  close = async () => {
83037
83067
  await runCleanup(
83038
83068
  () => this.#queryProcesses.close(),
@@ -83040,9 +83070,9 @@ var CodexAdapter = class {
83040
83070
  () => this.#previewCache?.close()
83041
83071
  );
83042
83072
  };
83043
- readSessionHistory = async (query, request) => {
83044
- const { agent, cwd } = query;
83045
- const signal = AbortSignal.any([query.signal, AbortSignal.timeout(6e4)]);
83073
+ readSessionHistory = async (cwd, _additionalDirectories, request, cancellation) => {
83074
+ const agent = this.#agent;
83075
+ const signal = AbortSignal.any([cancellation, AbortSignal.timeout(6e4)]);
83046
83076
  const { sessionId } = request;
83047
83077
  signal.throwIfAborted();
83048
83078
  nativeSessionIdSchema.parse(request.nativeSessionId);
@@ -83118,12 +83148,13 @@ var PiAdapter = class {
83118
83148
  #queryProcesses;
83119
83149
  #connector;
83120
83150
  #liveSessions;
83121
- constructor(dependencies) {
83151
+ constructor(agent, dependencies) {
83122
83152
  this.#connector = new AcpSessionConnector(dependencies.contentExternalizer);
83123
83153
  this.#liveSessions = new AcpLiveSessions(dependencies.contentExternalizer);
83124
- this.#queryProcesses = new AgentQueryProcesses(dependencies.processes, this.#connector);
83154
+ this.#queryProcesses = new AgentQueryProcesses(agent, dependencies.processes, this.#connector);
83125
83155
  }
83126
- getCapabilities = async (query) => await this.#queryProcesses.capabilities(query);
83156
+ refreshAgent = (agent) => this.#queryProcesses.refreshAgent(agent);
83157
+ getCapabilities = (cwd, signal) => this.#queryProcesses.capabilities(cwd, signal);
83127
83158
  connectSession = (options) => this.#liveSessions.connectSession(options);
83128
83159
  cancel = (...args) => this.#liveSessions.cancel(...args);
83129
83160
  closeSession = (...args) => this.#liveSessions.closeSession(...args);
@@ -83131,9 +83162,9 @@ var PiAdapter = class {
83131
83162
  steer = (...args) => this.#liveSessions.steer(...args);
83132
83163
  renameSession = (...args) => this.#liveSessions.renameSession(...args);
83133
83164
  configureSession = (...args) => this.#liveSessions.configureSession(...args);
83134
- listSessions = async (query, cursor) => await this.#queryProcesses.listNativeSessions(query, cursor);
83135
- findSession = (query, nativeSessionId, budget) => findNativeSession(this.listSessions, query, nativeSessionId, budget);
83136
- readSessionHistory = async (query, request) => await this.#queryProcesses.previewSessionEvents(query, request);
83165
+ listSessions = (cwd, cursor, signal) => this.#queryProcesses.listNativeSessions(cwd, cursor, signal);
83166
+ findSession = (cwd, nativeSessionId, budget, signal) => findNativeSession(this.listSessions, cwd, nativeSessionId, budget, signal);
83167
+ readSessionHistory = (cwd, additionalDirectories, request, signal) => this.#queryProcesses.previewSessionEvents(cwd, additionalDirectories, request, signal);
83137
83168
  close = async () => await runCleanup(
83138
83169
  () => this.#queryProcesses.close(),
83139
83170
  () => this.#liveSessions.close()
@@ -83144,11 +83175,11 @@ var PiAdapter = class {
83144
83175
  var harnessAdapters = (agent, dependencies) => {
83145
83176
  switch (agent.id) {
83146
83177
  case "codex":
83147
- return new CodexAdapter(dependencies);
83178
+ return new CodexAdapter(agent, dependencies);
83148
83179
  case "claude":
83149
- return new ClaudeAdapter(dependencies);
83180
+ return new ClaudeAdapter(agent, dependencies);
83150
83181
  case "pi":
83151
- return new PiAdapter(dependencies);
83182
+ return new PiAdapter(agent, dependencies);
83152
83183
  default:
83153
83184
  throw new AcpExecutionError(
83154
83185
  `Agent "${agent.id}" has no registered harness adapter.`,
@@ -86156,8 +86187,9 @@ var AgentSession = class _AgentSession {
86156
86187
  await this.#interactions.cancelPendingInteractions();
86157
86188
  signal.throwIfAborted();
86158
86189
  if (this.#turn.running) {
86159
- await this.#adapter.cancel(this.#target(), signal);
86190
+ return await this.#adapter.cancel(this.#target(), signal);
86160
86191
  }
86192
+ return "retained";
86161
86193
  };
86162
86194
  respondPermission = async (options) => {
86163
86195
  await this.#interactions.respondPermission(options);
@@ -86798,7 +86830,18 @@ var SessionManager2 = class {
86798
86830
  await this.#executions.cancel(sessionId, async () => {
86799
86831
  const runtime = this.#executionProcesses.get(sessionId);
86800
86832
  if (runtime !== void 0) {
86801
- await runtime.cancel(signal2);
86833
+ const outcome = await runtime.cancel(signal2);
86834
+ switch (outcome) {
86835
+ case "retained":
86836
+ break;
86837
+ case "closed":
86838
+ await this.#stopSessionProcess(sessionId, runtime);
86839
+ break;
86840
+ default: {
86841
+ const unreachable3 = outcome;
86842
+ throw new AcpExecutionError("Unexpected cancellation outcome", { cause: unreachable3 });
86843
+ }
86844
+ }
86802
86845
  }
86803
86846
  });
86804
86847
  });
@@ -87164,7 +87207,7 @@ var SessionManager2 = class {
87164
87207
  };
87165
87208
 
87166
87209
  // src/engine/session/native/native-session-browser.ts
87167
- import { randomUUID as randomUUID14 } from "node:crypto";
87210
+ import { randomUUID as randomUUID15 } from "node:crypto";
87168
87211
 
87169
87212
  // src/engine/session/workspace/local-authorization-error.ts
87170
87213
  var LocalAuthorizationError = class extends OperationError {
@@ -87223,12 +87266,17 @@ var NativeSessionService = class {
87223
87266
  (scoped) => this.#sessions.withNativeSessionOperation(
87224
87267
  scoped,
87225
87268
  nativeSessionId,
87226
- (target) => target.adapter.readSessionHistory(target, {
87227
- nativeSessionId,
87228
- eventLimit,
87229
- cursor,
87230
- sessionId: target.sessionId
87231
- })
87269
+ (target) => target.adapter.readSessionHistory(
87270
+ target.cwd,
87271
+ target.additionalDirectories,
87272
+ {
87273
+ nativeSessionId,
87274
+ eventLimit,
87275
+ cursor,
87276
+ sessionId: target.sessionId
87277
+ },
87278
+ target.signal
87279
+ )
87232
87280
  )
87233
87281
  );
87234
87282
  #execute = async (command, signal) => {
@@ -87259,7 +87307,7 @@ var NativeSessionService = class {
87259
87307
  queuedCancellation: "before-start"
87260
87308
  };
87261
87309
  }
87262
- const capabilities = await options.adapter.getCapabilities(options);
87310
+ const capabilities = await options.adapter.getCapabilities(cwd, signal);
87263
87311
  if (!capabilities.listSessions) {
87264
87312
  throw new AcpExecutionError(
87265
87313
  "This Agent does not support native session listing",
@@ -87274,7 +87322,7 @@ var NativeSessionService = class {
87274
87322
  if (authorized === null) {
87275
87323
  return null;
87276
87324
  }
87277
- const entryId = decodeIdentifier(randomUUID14());
87325
+ const entryId = decodeIdentifier(randomUUID15());
87278
87326
  if (this.#entries.size >= 5e3) {
87279
87327
  this.#entries.clear();
87280
87328
  }
@@ -87313,7 +87361,7 @@ var NativeSessionService = class {
87313
87361
  }
87314
87362
  cursor = known.cursor;
87315
87363
  }
87316
- const page = await options.adapter.listSessions(options, cursor);
87364
+ const page = await options.adapter.listSessions(cwd, cursor, signal);
87317
87365
  const entries = [];
87318
87366
  for (const info of page.sessions) {
87319
87367
  const entry = await register(info);
@@ -87330,7 +87378,7 @@ var NativeSessionService = class {
87330
87378
  "invalid_native_session_response"
87331
87379
  );
87332
87380
  }
87333
- nextCursor = decodeIdentifier(randomUUID14());
87381
+ nextCursor = decodeIdentifier(randomUUID15());
87334
87382
  if (this.#cursors.size >= 500) {
87335
87383
  this.#cursors.clear();
87336
87384
  }
@@ -87348,10 +87396,15 @@ var NativeSessionService = class {
87348
87396
  };
87349
87397
  }
87350
87398
  if (command.action === "find") {
87351
- const found = await options.adapter.findSession(options, command.nativeSessionId, {
87352
- maximumPages: 500,
87353
- maximumEntries: 500
87354
- });
87399
+ const found = await options.adapter.findSession(
87400
+ cwd,
87401
+ command.nativeSessionId,
87402
+ {
87403
+ maximumPages: 500,
87404
+ maximumEntries: 500
87405
+ },
87406
+ signal
87407
+ );
87355
87408
  const entry = await register(found);
87356
87409
  if (entry !== null) {
87357
87410
  return { ...envelope2, action: "find", entry };
@@ -87489,10 +87542,15 @@ var NativeSessionService = class {
87489
87542
  }
87490
87543
  };
87491
87544
  resolveTarget = async (command, options, selected) => {
87492
- const info = await options.adapter.findSession(options, selected.nativeSessionId, {
87493
- maximumPages: 100,
87494
- maximumEntries: null
87495
- }).catch((cause) => {
87545
+ const info = await options.adapter.findSession(
87546
+ options.cwd,
87547
+ selected.nativeSessionId,
87548
+ {
87549
+ maximumPages: 100,
87550
+ maximumEntries: null
87551
+ },
87552
+ options.signal
87553
+ ).catch((cause) => {
87496
87554
  options.signal.throwIfAborted();
87497
87555
  if (cause instanceof AcpExecutionError && cause.code === "native_session_not_found") {
87498
87556
  throw new AcpExecutionError(
@@ -87761,7 +87819,7 @@ async function settleAbandonedTurn(projection, operations, cancellation) {
87761
87819
  }
87762
87820
 
87763
87821
  // src/engine/session/turn/execution-receipts.ts
87764
- import { createHash as createHash7, randomUUID as randomUUID15 } from "node:crypto";
87822
+ import { createHash as createHash7, randomUUID as randomUUID16 } from "node:crypto";
87765
87823
  var MAX_TERMINAL_RECEIPTS = 1024;
87766
87824
  var ExecutionReceipts = class {
87767
87825
  #executions = /* @__PURE__ */ new Map();
@@ -87902,7 +87960,7 @@ var ExecutionReceipts = class {
87902
87960
  ).digest("hex");
87903
87961
  this.#save(commandId, {
87904
87962
  admissionOrder: this.#nextAdmissionOrder(),
87905
- attemptId: randomUUID15(),
87963
+ attemptId: randomUUID16(),
87906
87964
  commandHash,
87907
87965
  sessionId,
87908
87966
  started: false,
@@ -87984,7 +88042,7 @@ var ExecutionReceipts = class {
87984
88042
  if (identity2 !== void 0) {
87985
88043
  return identity2.sessionId === sessionId && identity2.commandHash === commandHash ? { kind: "expired" } : { kind: "conflict" };
87986
88044
  }
87987
- const attemptId = randomUUID15();
88045
+ const attemptId = randomUUID16();
87988
88046
  this.#save(commandId, {
87989
88047
  admissionOrder: this.#nextAdmissionOrder(),
87990
88048
  attemptId,
@@ -88111,7 +88169,7 @@ var RuntimeTurnActivity = class {
88111
88169
  };
88112
88170
 
88113
88171
  // src/engine/session/turn/active-turn.ts
88114
- import { randomUUID as randomUUID16 } from "node:crypto";
88172
+ import { randomUUID as randomUUID17 } from "node:crypto";
88115
88173
  var ActiveRuntimeTurn = class {
88116
88174
  attemptId;
88117
88175
  command;
@@ -88121,7 +88179,7 @@ var ActiveRuntimeTurn = class {
88121
88179
  #dispatch;
88122
88180
  #sequence = 0;
88123
88181
  #interaction = null;
88124
- #epoch = decodeIdentifier(randomUUID16());
88182
+ #epoch = decodeIdentifier(randomUUID17());
88125
88183
  constructor(command, attemptId) {
88126
88184
  this.attemptId = attemptId;
88127
88185
  this.command = command;
@@ -88687,11 +88745,11 @@ import { extname as extname2, join as join29 } from "node:path";
88687
88745
  import { pathToFileURL as pathToFileURL3 } from "node:url";
88688
88746
 
88689
88747
  // src/engine/storage/files/scratch-directory.ts
88690
- import { randomUUID as randomUUID17 } from "node:crypto";
88748
+ import { randomUUID as randomUUID18 } from "node:crypto";
88691
88749
  import { lstat as lstat4, mkdir as mkdir5, readdir as readdir6, readFile as readFile6, realpath as realpath7, rename as rename4, rm as rm3, stat as stat6, utimes, writeFile as writeFile2 } from "node:fs/promises";
88692
88750
  import { dirname as dirname11, join as join28 } from "node:path";
88693
88751
  async function atomicWrite(path7, bytes, signal) {
88694
- const temporary = `${path7}.${randomUUID17()}.tmp`;
88752
+ const temporary = `${path7}.${randomUUID18()}.tmp`;
88695
88753
  try {
88696
88754
  await writeFile2(temporary, bytes, { mode: 384, signal });
88697
88755
  signal.throwIfAborted();
@@ -88703,7 +88761,7 @@ async function atomicWrite(path7, bytes, signal) {
88703
88761
  var ScratchDirectory = class {
88704
88762
  #root;
88705
88763
  constructor(parent) {
88706
- this.#root = join28(parent, randomUUID17());
88764
+ this.#root = join28(parent, randomUUID18());
88707
88765
  }
88708
88766
  /** Refreshes this directory's lease and removes sibling directories whose lease is older than `leaseMilliseconds`. */
88709
88767
  refreshLease = async (leaseMilliseconds) => {
@@ -90709,7 +90767,7 @@ function createNativeSessionCommands(context) {
90709
90767
  }
90710
90768
 
90711
90769
  // src/engine/session/prompt/apply-session-configuration.ts
90712
- import { randomUUID as randomUUID18 } from "node:crypto";
90770
+ import { randomUUID as randomUUID19 } from "node:crypto";
90713
90771
  function invalidSessionConfiguration(message) {
90714
90772
  return new AcpExecutionError(message, {}, "invalid_session_configuration");
90715
90773
  }
@@ -90847,7 +90905,7 @@ async function applySessionConfigurationSelection(sessions, options, selection,
90847
90905
  booleanValue: selection.booleanValue,
90848
90906
  configId: selection.configId,
90849
90907
  cwd,
90850
- requestId: `cfg_${randomUUID18()}`,
90908
+ requestId: `cfg_${randomUUID19()}`,
90851
90909
  sessionId,
90852
90910
  signal,
90853
90911
  value: selection.value,
@@ -91137,7 +91195,7 @@ var sessionPromptCommand = {
91137
91195
  // package.json
91138
91196
  var package_default = {
91139
91197
  name: "@moxt-ai/mobius",
91140
- version: "0.0.357",
91198
+ version: "0.0.359",
91141
91199
  description: "Mobius CLI for pairing and running local AI agent services.",
91142
91200
  type: "module",
91143
91201
  bin: {
@@ -92409,7 +92467,7 @@ async function runRuntime(config2, parentSignal, timer = systemTimer, options =
92409
92467
  const catalogAgent = await resolveCatalogAgent(config2, agentId, resolveSignal);
92410
92468
  const environment = sessionId === void 0 ? void 0 : config2.sessionEnvironment?.({ sessionId, agentId });
92411
92469
  const agent = environment === void 0 ? catalogAgent : catalogAgent.withEnvironment({ ...catalogAgent.environment, ...environment });
92412
- return { agent, adapter: adapters.resolve(agent) };
92470
+ return { agent, adapter: adapters.resolve(catalogAgent) };
92413
92471
  };
92414
92472
  const layer = buildSessionLayer({
92415
92473
  processes,