@moxt-ai/mobius 0.0.117 → 0.0.119

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 (38) hide show
  1. package/dist/acp/codex/agent.d.ts +1 -0
  2. package/dist/acp/codex/agent.d.ts.map +1 -1
  3. package/dist/acp/codex/agent.js +29 -2
  4. package/dist/acp/codex/agent.js.map +1 -1
  5. package/dist/acp/codex/app-server-protocol.d.ts +6 -0
  6. package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
  7. package/dist/acp/codex/app-server-protocol.js +6 -0
  8. package/dist/acp/codex/app-server-protocol.js.map +1 -1
  9. package/dist/acp/in-process/acp-endpoint.d.ts +2 -0
  10. package/dist/acp/in-process/acp-endpoint.d.ts.map +1 -1
  11. package/dist/acp/process-session.d.ts +8 -1
  12. package/dist/acp/process-session.d.ts.map +1 -1
  13. package/dist/acp/process-session.js +12 -0
  14. package/dist/acp/process-session.js.map +1 -1
  15. package/dist/acp/session-manager.d.ts.map +1 -1
  16. package/dist/acp/session-manager.js +1 -1
  17. package/dist/acp/session-manager.js.map +1 -1
  18. package/dist/artifacts/local-file-streamer.d.ts +1 -1
  19. package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
  20. package/dist/artifacts/local-file-streamer.js +10 -6
  21. package/dist/artifacts/local-file-streamer.js.map +1 -1
  22. package/dist/cli.js +120 -49
  23. package/dist/cli.js.map +3 -3
  24. package/dist/index.js +105 -34
  25. package/dist/index.js.map +3 -3
  26. package/dist/native-sessions/codex-history.d.ts +8 -1
  27. package/dist/native-sessions/codex-history.d.ts.map +1 -1
  28. package/dist/native-sessions/codex-history.js +8 -2
  29. package/dist/native-sessions/codex-history.js.map +1 -1
  30. package/dist/native-sessions/live-history-page.d.ts.map +1 -1
  31. package/dist/native-sessions/live-history-page.js +15 -1
  32. package/dist/native-sessions/live-history-page.js.map +1 -1
  33. package/dist/run-daemon.d.ts.map +1 -1
  34. package/dist/run-daemon.js +3 -3
  35. package/dist/run-daemon.js.map +1 -1
  36. package/dist/runtime.js +109 -38
  37. package/dist/runtime.js.map +3 -3
  38. package/package.json +1 -1
package/dist/runtime.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/runtime.ts
8
8
  import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
9
- import { resolve as resolve7 } from "node:path";
9
+ import { resolve as resolve8 } from "node:path";
10
10
 
11
11
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
12
12
  var external_exports = {};
@@ -5034,7 +5034,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5034
5034
  var NONE = 0;
5035
5035
  var ASSUMED = 1;
5036
5036
  var PROVEN = 2;
5037
- function isRecursive(inst, stack, resolve8) {
5037
+ function isRecursive(inst, stack, resolve9) {
5038
5038
  const cached2 = recursive.get(inst);
5039
5039
  if (cached2 !== void 0)
5040
5040
  return cached2 ? PROVEN : NONE;
@@ -5044,7 +5044,7 @@ function isRecursive(inst, stack, resolve8) {
5044
5044
  let result = NONE;
5045
5045
  const check2 = (child) => {
5046
5046
  if (result !== PROVEN && child?._zod) {
5047
- const answer = isRecursive(child, stack, resolve8);
5047
+ const answer = isRecursive(child, stack, resolve9);
5048
5048
  if (answer > result)
5049
5049
  result = answer;
5050
5050
  }
@@ -5055,7 +5055,7 @@ function isRecursive(inst, stack, resolve8) {
5055
5055
  const desc2 = Object.getOwnPropertyDescriptor(sh, key);
5056
5056
  if (spread && !desc2.enumerable)
5057
5057
  continue;
5058
- const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve8) : NONE;
5058
+ const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
5059
5059
  if (child > answer)
5060
5060
  answer = child;
5061
5061
  }
@@ -5119,7 +5119,7 @@ function isRecursive(inst, stack, resolve8) {
5119
5119
  break;
5120
5120
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5121
5121
  case "lazy": {
5122
- const inner = def._cachedInner ?? (resolve8 ? inst._zod.innerType : void 0);
5122
+ const inner = def._cachedInner ?? (resolve9 ? inst._zod.innerType : void 0);
5123
5123
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
5124
5124
  break;
5125
5125
  }
@@ -22997,6 +22997,12 @@ var requestUserInputParamsSchema = external_exports.object({
22997
22997
  threadId: boundedText(256),
22998
22998
  turnId: boundedText(256)
22999
22999
  });
23000
+ var reasoningTextDeltaParamsSchema = external_exports.object({
23001
+ delta: boundedText(1e5),
23002
+ itemId: boundedText(256),
23003
+ threadId: boundedText(256),
23004
+ turnId: boundedText(256)
23005
+ });
23000
23006
  var mcpElicitationParamsSchema = external_exports.object({
23001
23007
  message: boundedText(4096),
23002
23008
  mode: external_exports.enum(["form", "url"]).or(external_exports.string()),
@@ -23732,7 +23738,9 @@ var CodexAcpAgent = class {
23732
23738
  // rather than break every turn.
23733
23739
  #collaborationModeSupported = null;
23734
23740
  #selection;
23741
+ #streamedReasoningItemIds = /* @__PURE__ */ new Set();
23735
23742
  #turn = null;
23743
+ #nativeTurnId = null;
23736
23744
  #updateTail = Promise.resolve();
23737
23745
  constructor(options) {
23738
23746
  this.#selection = {
@@ -23871,6 +23879,7 @@ var CodexAcpAgent = class {
23871
23879
  }
23872
23880
  /** The ACP agent app Mobius connects its own ACP client to, in-process. */
23873
23881
  app = () => this.#app;
23882
+ nativeTurnId = () => this.#nativeTurnId;
23874
23883
  /** Starts the app-server, performs its handshake, and reads the model catalog Codex offers. */
23875
23884
  initialize = async (signal) => {
23876
23885
  await this.#appServer.initialize(signal);
@@ -24142,6 +24151,7 @@ var CodexAcpAgent = class {
24142
24151
  const decoded = turnNotificationSchema.safeParse(params);
24143
24152
  if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null) {
24144
24153
  this.#turn.turn.id = decoded.data.turn.id;
24154
+ this.#nativeTurnId = decoded.data.turn.id;
24145
24155
  }
24146
24156
  return;
24147
24157
  }
@@ -24188,6 +24198,20 @@ var CodexAcpAgent = class {
24188
24198
  }
24189
24199
  return;
24190
24200
  }
24201
+ if (method === "item/reasoning/summaryTextDelta" || method === "item/reasoning/textDelta") {
24202
+ const decoded = reasoningTextDeltaParamsSchema.safeParse(params);
24203
+ if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null && decoded.data.turnId === this.#turn.turn.id && decoded.data.delta.length > 0) {
24204
+ this.#streamedReasoningItemIds.add(decoded.data.itemId);
24205
+ await this.#enqueue(async () => {
24206
+ await this.#emit({
24207
+ content: { text: decoded.data.delta, type: "text" },
24208
+ messageId: decoded.data.itemId,
24209
+ sessionUpdate: "agent_thought_chunk"
24210
+ });
24211
+ });
24212
+ }
24213
+ return;
24214
+ }
24191
24215
  if (method !== "item/started" && method !== "item/completed") {
24192
24216
  return;
24193
24217
  }
@@ -24211,7 +24235,8 @@ var CodexAcpAgent = class {
24211
24235
  }
24212
24236
  const reasoning = reasoningText(item);
24213
24237
  if (reasoning !== null) {
24214
- if (method === "item/completed" && reasoning.length > 0) {
24238
+ const streamed = method === "item/completed" && this.#streamedReasoningItemIds.delete(item.id);
24239
+ if (method === "item/completed" && reasoning.length > 0 && !streamed) {
24215
24240
  await this.#enqueue(async () => {
24216
24241
  await this.#emit({
24217
24242
  content: { text: reasoning, type: "text" },
@@ -24358,7 +24383,9 @@ var CodexAcpAgent = class {
24358
24383
  };
24359
24384
  signal.addEventListener("abort", aborted2, { once: true });
24360
24385
  const turn = { completion, turn: { id: "" } };
24386
+ this.#streamedReasoningItemIds.clear();
24361
24387
  this.#turn = turn;
24388
+ this.#nativeTurnId = null;
24362
24389
  try {
24363
24390
  const selection = this.#selection;
24364
24391
  const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
@@ -24399,12 +24426,14 @@ var CodexAcpAgent = class {
24399
24426
  );
24400
24427
  if (this.#turn === turn) {
24401
24428
  turn.turn.id = started.id;
24429
+ this.#nativeTurnId = started.id;
24402
24430
  }
24403
24431
  return await completion.promise;
24404
24432
  } finally {
24405
24433
  signal.removeEventListener("abort", aborted2);
24406
24434
  if (this.#turn === turn) {
24407
24435
  this.#turn = null;
24436
+ this.#streamedReasoningItemIds.clear();
24408
24437
  }
24409
24438
  }
24410
24439
  };
@@ -33857,7 +33886,7 @@ function createWritableAcpStream(output2) {
33857
33886
  if (outputFailure !== void 0) {
33858
33887
  return Promise.reject(outputFailure);
33859
33888
  }
33860
- return new Promise((resolve8, reject) => {
33889
+ return new Promise((resolve9, reject) => {
33861
33890
  pendingWriteFailures.add(reject);
33862
33891
  output2.write(chunk, (error62) => {
33863
33892
  pendingWriteFailures.delete(reject);
@@ -33870,7 +33899,7 @@ function createWritableAcpStream(output2) {
33870
33899
  reject(outputFailure);
33871
33900
  return;
33872
33901
  }
33873
- resolve8();
33902
+ resolve9();
33874
33903
  });
33875
33904
  });
33876
33905
  }
@@ -33914,6 +33943,7 @@ var AcpProcessSession = class _AcpProcessSession {
33914
33943
  #configOptions = [];
33915
33944
  #nativeSessionId = "";
33916
33945
  #prompted = false;
33946
+ #nativePrompt = null;
33917
33947
  #replay = {
33918
33948
  kind: "idle"
33919
33949
  };
@@ -33965,12 +33995,12 @@ var AcpProcessSession = class _AcpProcessSession {
33965
33995
  stderr.on("data", (chunk) => {
33966
33996
  process.stderr.write(`[${agent.id}-acp] ${chunk}`);
33967
33997
  });
33968
- this.#termination = new Promise((resolve8) => {
33998
+ this.#termination = new Promise((resolve9) => {
33969
33999
  child.once("error", (cause) => {
33970
- resolve8({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
34000
+ resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
33971
34001
  });
33972
34002
  child.once("exit", (code, signal) => {
33973
- resolve8({
34003
+ resolve9({
33974
34004
  kind: "failed",
33975
34005
  error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
33976
34006
  });
@@ -34571,6 +34601,11 @@ var AcpProcessSession = class _AcpProcessSession {
34571
34601
  }
34572
34602
  return prompt;
34573
34603
  };
34604
+ nativeHistoryTurn = () => {
34605
+ const prompt = this.#nativePrompt;
34606
+ const nativeTurnId = this.#inProcessAgent?.nativeTurnId?.() ?? null;
34607
+ return prompt === null || nativeTurnId === null || nativeTurnId === prompt.previousTurnId ? null : { commandId: prompt.commandId, nativeTurnId };
34608
+ };
34574
34609
  prompt = async (options) => {
34575
34610
  if (this.#turn.running) {
34576
34611
  throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
@@ -34599,6 +34634,10 @@ var AcpProcessSession = class _AcpProcessSession {
34599
34634
  this.prepareAgentContent
34600
34635
  );
34601
34636
  this.#turn = running;
34637
+ this.#nativePrompt = {
34638
+ commandId: options.commandId,
34639
+ previousTurnId: this.#inProcessAgent?.nativeTurnId?.() ?? null
34640
+ };
34602
34641
  try {
34603
34642
  const response = await this.race(
34604
34643
  this.#connection.agent.request(
@@ -36040,7 +36079,11 @@ var AcpSessionManager = class {
36040
36079
  const runtime = await this.ensureSession(options);
36041
36080
  const stored = this.#store.read(options.sessionId);
36042
36081
  if (stored instanceof FoundAcpStoredSession && this.#nativeHistoryReader !== null) {
36043
- const history = await this.#nativeHistoryReader.read(options, stored.session.nativeSessionId);
36082
+ const history = await this.#nativeHistoryReader.read(
36083
+ options,
36084
+ stored.session.nativeSessionId,
36085
+ runtime.nativeHistoryTurn
36086
+ );
36044
36087
  if (history !== null) {
36045
36088
  return history;
36046
36089
  }
@@ -36682,8 +36725,19 @@ function paginateLiveSessionHistory(history, activeTurn, sessionId, cursor, limi
36682
36725
  truncated: activeTurn.truncated || activeText.length !== activeTurn.text.length
36683
36726
  };
36684
36727
  }
36728
+ const activeUserIndex = history.coveredCommandIds.includes(activeTurn.commandId) ? history.messages.findLastIndex((message) => message.role === "user") : -1;
36729
+ if (activeUserIndex >= 0) {
36730
+ history = {
36731
+ ...history,
36732
+ coveredCommandIds: history.coveredCommandIds.filter((id) => id !== activeTurn.commandId),
36733
+ coveredMessageIds: history.coveredMessageIds.filter(
36734
+ (id) => id !== `${activeTurn.commandId}:user` && id !== `${activeTurn.commandId}:agent`
36735
+ ),
36736
+ messages: history.messages.slice(0, activeUserIndex + 1)
36737
+ };
36738
+ }
36685
36739
  const latestNativeMessage = history.messages.at(-1);
36686
- const activeMessages = latestNativeMessage?.role === "user" && latestNativeMessage.text === activeTurn.prompt ? completeActiveMessages.slice(1) : completeActiveMessages;
36740
+ const activeMessages = activeUserIndex >= 0 || latestNativeMessage?.role === "user" && latestNativeMessage.text === activeTurn.prompt ? completeActiveMessages.slice(1) : completeActiveMessages;
36687
36741
  let historicalMessageCount = 0;
36688
36742
  let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT - activeText.length - activeMessageOverhead - activeStructuredCharacters - (activeMessages.length === completeActiveMessages.length ? activeTurn.prompt.length : 0);
36689
36743
  const historicalMessageLimit = Math.max(0, limit - activeMessages.length);
@@ -38776,7 +38830,7 @@ var FixedInstallationExecutor = class {
38776
38830
  // src/artifacts/local-file-streamer.ts
38777
38831
  import { createReadStream as createReadStream2 } from "node:fs";
38778
38832
  import { realpath as realpath7, stat as stat6 } from "node:fs/promises";
38779
- import { basename as basename4, isAbsolute as isAbsolute9, normalize as normalize3 } from "node:path";
38833
+ import { basename as basename4, isAbsolute as isAbsolute9, normalize as normalize3, resolve as resolve5 } from "node:path";
38780
38834
  import { fileURLToPath as fileURLToPath2 } from "node:url";
38781
38835
  var CHUNK_BYTES = 192 * 1024;
38782
38836
  function requestedPath(value) {
@@ -38793,9 +38847,13 @@ function requestedPath(value) {
38793
38847
  }
38794
38848
  return value;
38795
38849
  }
38796
- async function resolveFile(value, signal) {
38797
- const requested = requestedPath(value);
38798
- if (requested === null || !isAbsolute9(requested) || normalize3(requested) !== requested) {
38850
+ async function resolveFile(value, workingDirectory, signal) {
38851
+ const path2 = requestedPath(value);
38852
+ if (path2 === null || !isAbsolute9(path2) && workingDirectory === null) {
38853
+ return null;
38854
+ }
38855
+ const requested = workingDirectory === null ? path2 : resolve5(workingDirectory, path2);
38856
+ if (!isAbsolute9(requested) || isAbsolute9(path2) && normalize3(path2) !== path2) {
38799
38857
  return null;
38800
38858
  }
38801
38859
  try {
@@ -38807,8 +38865,8 @@ async function resolveFile(value, signal) {
38807
38865
  return null;
38808
38866
  }
38809
38867
  }
38810
- async function streamLocalFile(command, send2, signal) {
38811
- const target = await resolveFile(command.path, signal);
38868
+ async function streamLocalFile(command, send2, signal, workingDirectory) {
38869
+ const target = await resolveFile(command.path, workingDirectory, signal);
38812
38870
  if (target === null) {
38813
38871
  throw new Error("The local file is unavailable");
38814
38872
  }
@@ -39342,6 +39400,7 @@ var threadSchema = external_exports.object({
39342
39400
  var turnsSchema = external_exports.object({
39343
39401
  data: external_exports.array(
39344
39402
  external_exports.object({
39403
+ id: external_exports.string().min(1),
39345
39404
  error: external_exports.unknown().nullish(),
39346
39405
  items: external_exports.array(external_exports.unknown()).max(1e5)
39347
39406
  })
@@ -39404,6 +39463,8 @@ function messageSize(message) {
39404
39463
  }
39405
39464
  function decodeHistory(thread, value, options) {
39406
39465
  const page = turnsSchema.parse(value);
39466
+ const nativeTurn = options.nativeTurn?.();
39467
+ const coveredCommandIds = nativeTurn != null && page.data[0]?.id === nativeTurn.nativeTurnId ? [nativeTurn.commandId] : [];
39407
39468
  const messages = [];
39408
39469
  let characters = 0;
39409
39470
  let truncated = page.nextCursor != null;
@@ -39547,7 +39608,7 @@ function decodeHistory(thread, value, options) {
39547
39608
  status: "available",
39548
39609
  messages,
39549
39610
  truncated,
39550
- coveredCommandIds: [],
39611
+ coveredCommandIds,
39551
39612
  coveredMessageIds: []
39552
39613
  }
39553
39614
  };
@@ -39747,7 +39808,10 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
39747
39808
  }
39748
39809
  }
39749
39810
  var readCodexHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "messages" });
39750
- var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "rich" });
39811
+ var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTurn) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, {
39812
+ detail: "rich",
39813
+ ...nativeTurn === void 0 ? {} : { nativeTurn }
39814
+ });
39751
39815
 
39752
39816
  // src/native-sessions/handle-native-requests.ts
39753
39817
  import { WebSocket as WebSocket5 } from "undici";
@@ -39787,13 +39851,13 @@ function createNativeSessionRequestHandler(dependencies) {
39787
39851
  operationSignal.throwIfAborted();
39788
39852
  const skipPrevious = command.action === "active-turn";
39789
39853
  if (previous.length > 0 && !skipPrevious) {
39790
- await new Promise((resolve8, reject) => {
39854
+ await new Promise((resolve9, reject) => {
39791
39855
  const onAbort = () => reject(operationSignal.reason);
39792
39856
  operationSignal.addEventListener("abort", onAbort, { once: true });
39793
39857
  void Promise.all(previous.map((request) => request.completion)).then(
39794
39858
  () => {
39795
39859
  operationSignal.removeEventListener("abort", onAbort);
39796
- resolve8();
39860
+ resolve9();
39797
39861
  },
39798
39862
  (error62) => {
39799
39863
  operationSignal.removeEventListener("abort", onAbort);
@@ -40372,7 +40436,7 @@ var RelayConnectionError = class extends Error {
40372
40436
  };
40373
40437
  function connectRelay(url2, signal) {
40374
40438
  signal.throwIfAborted();
40375
- return new Promise((resolve8, reject) => {
40439
+ return new Promise((resolve9, reject) => {
40376
40440
  const endpoint = new URL(url2);
40377
40441
  const headers = runtimeAuthorization(endpoint);
40378
40442
  endpoint.searchParams.delete("token");
@@ -40439,7 +40503,7 @@ function connectRelay(url2, signal) {
40439
40503
  }
40440
40504
  finished = true;
40441
40505
  cleanup();
40442
- resolve8(socket);
40506
+ resolve9(socket);
40443
40507
  };
40444
40508
  function onTimeout() {
40445
40509
  fail(
@@ -40864,12 +40928,12 @@ function waitForRelayRetry(signal, timer) {
40864
40928
  if (signal.aborted) {
40865
40929
  return Promise.resolve();
40866
40930
  }
40867
- return new Promise((resolve8) => {
40931
+ return new Promise((resolve9) => {
40868
40932
  const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
40869
40933
  function finish() {
40870
40934
  retry.cancel();
40871
40935
  signal.removeEventListener("abort", finish);
40872
- resolve8();
40936
+ resolve9();
40873
40937
  }
40874
40938
  signal.addEventListener("abort", finish, { once: true });
40875
40939
  });
@@ -40960,7 +41024,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40960
41024
  installationObserver.connect(socket);
40961
41025
  onConnected();
40962
41026
  try {
40963
- await new Promise((resolve8, reject) => {
41027
+ await new Promise((resolve9, reject) => {
40964
41028
  let finished = false;
40965
41029
  const cleanup = () => {
40966
41030
  connectionLiveness.close();
@@ -40978,7 +41042,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40978
41042
  }
40979
41043
  finished = true;
40980
41044
  cleanup();
40981
- resolve8();
41045
+ resolve9();
40982
41046
  };
40983
41047
  const rejectConnection = (failure2) => {
40984
41048
  if (finished) {
@@ -41001,7 +41065,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41001
41065
  };
41002
41066
  const waitForTurnCompletion = (turn, waitSignal) => {
41003
41067
  waitSignal.throwIfAborted();
41004
- return new Promise((resolve9, reject2) => {
41068
+ return new Promise((resolve10, reject2) => {
41005
41069
  let settled = false;
41006
41070
  const finish = (result) => {
41007
41071
  if (settled) {
@@ -41010,7 +41074,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41010
41074
  settled = true;
41011
41075
  waitSignal.removeEventListener("abort", onAbort);
41012
41076
  if (result.kind === "completed") {
41013
- resolve9();
41077
+ resolve10();
41014
41078
  } else {
41015
41079
  reject2(result.error);
41016
41080
  }
@@ -41166,7 +41230,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41166
41230
  void streamLocalFile(
41167
41231
  command2,
41168
41232
  (message2) => send(socket, message2),
41169
- connectionController.signal
41233
+ connectionController.signal,
41234
+ sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
41170
41235
  ).catch((error62) => {
41171
41236
  if (socket.readyState !== WebSocket8.OPEN || connectionController.signal.aborted) {
41172
41237
  return;
@@ -41398,7 +41463,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
41398
41463
  new DaemonAcpObserver(recordSessionEvent),
41399
41464
  sessionStore,
41400
41465
  {
41401
- read: async (options2, nativeSessionId) => options2.agent.id === "codex" ? (await readCodexFullHistory(options2.agent, options2.cwd, nativeSessionId, options2.signal)).history : null
41466
+ read: async (options2, nativeSessionId, nativeTurn) => options2.agent.id === "codex" ? (await readCodexFullHistory(
41467
+ options2.agent,
41468
+ options2.cwd,
41469
+ nativeSessionId,
41470
+ options2.signal,
41471
+ nativeTurn
41472
+ )).history : null
41402
41473
  },
41403
41474
  "native"
41404
41475
  );
@@ -41561,13 +41632,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
41561
41632
  // src/pairing/pair-local-machine.ts
41562
41633
  import { mkdir as mkdir5, realpath as realpath9, stat as stat8 } from "node:fs/promises";
41563
41634
  import { hostname as hostname3 } from "node:os";
41564
- import { basename as basename6, resolve as resolve6 } from "node:path";
41635
+ import { basename as basename6, resolve as resolve7 } from "node:path";
41565
41636
  import { fetch as fetch4 } from "undici";
41566
41637
 
41567
41638
  // src/storage/runtime-installation-store.ts
41568
41639
  import { createHash as createHash6, randomUUID as randomUUID7 } from "node:crypto";
41569
41640
  import { mkdir as mkdir4, open as open5, readdir as readdir3, rename as rename3, unlink, writeFile as writeFile3 } from "node:fs/promises";
41570
- import { dirname as dirname5, join as join18, resolve as resolve5 } from "node:path";
41641
+ import { dirname as dirname5, join as join18, resolve as resolve6 } from "node:path";
41571
41642
  var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
41572
41643
  var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
41573
41644
  var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
@@ -41842,7 +41913,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
41842
41913
  static open = async (options, signal) => {
41843
41914
  signal.throwIfAborted();
41844
41915
  const applicationId = validateApplicationId(options.applicationId);
41845
- const rootDirectory = resolve5(options.stateDirectory);
41916
+ const rootDirectory = resolve6(options.stateDirectory);
41846
41917
  const applicationDirectory = join18(rootDirectory, "installations", applicationId);
41847
41918
  try {
41848
41919
  await mkdir4(applicationDirectory, { mode: 448, recursive: true });
@@ -42126,7 +42197,7 @@ function validatePairingId(value) {
42126
42197
  return value;
42127
42198
  }
42128
42199
  async function resolveDefaultWorkspace2(path2) {
42129
- const requestedWorkspace = resolve6(path2);
42200
+ const requestedWorkspace = resolve7(path2);
42130
42201
  try {
42131
42202
  await mkdir5(requestedWorkspace, { recursive: true, mode: 448 });
42132
42203
  const defaultWorkspace = await realpath9(requestedWorkspace);
@@ -42362,7 +42433,7 @@ function loadMobiusRuntimeConnection(environment = process.env) {
42362
42433
  });
42363
42434
  }
42364
42435
  async function resolveWorkspace(path2) {
42365
- const requested = resolve7(path2);
42436
+ const requested = resolve8(path2);
42366
42437
  try {
42367
42438
  await mkdir6(requested, { recursive: true, mode: 448 });
42368
42439
  const resolved = await realpath10(requested);