@moxt-ai/mobius 0.0.133 → 0.0.135

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.
@@ -58,6 +58,19 @@ export declare class DaemonTurnRegistry {
58
58
  truncated: boolean;
59
59
  epoch: string;
60
60
  interaction: Readonly<{
61
+ commandId: string;
62
+ interactionId: string;
63
+ kind: "session.permission.requested";
64
+ options: readonly Readonly<{
65
+ kind: "allow_always" | "allow_once" | "reject_always" | "reject_once";
66
+ name: string;
67
+ optionId: string;
68
+ }>[];
69
+ sessionId: string;
70
+ title: string;
71
+ toolCallId: string;
72
+ toolKind: string;
73
+ }> | Readonly<{
61
74
  accepted: boolean;
62
75
  commandId: string;
63
76
  elicitationId: string;
@@ -89,19 +102,6 @@ export declare class DaemonTurnRegistry {
89
102
  mode: "form" | "url";
90
103
  sessionId: string;
91
104
  url: string;
92
- }> | Readonly<{
93
- commandId: string;
94
- interactionId: string;
95
- kind: "session.permission.requested";
96
- options: readonly Readonly<{
97
- kind: "allow_always" | "allow_once" | "reject_always" | "reject_once";
98
- name: string;
99
- optionId: string;
100
- }>[];
101
- sessionId: string;
102
- title: string;
103
- toolCallId: string;
104
- toolKind: string;
105
105
  }> | null;
106
106
  sequence: number;
107
107
  state: "running";
package/dist/index.js CHANGED
@@ -5068,9 +5068,9 @@ function isRecursive(inst, stack, resolve9) {
5068
5068
  return PROVEN;
5069
5069
  stack.add(inst);
5070
5070
  let result = NONE;
5071
- const check2 = (child) => {
5072
- if (result !== PROVEN && child?._zod) {
5073
- const answer = isRecursive(child, stack, resolve9);
5071
+ const check2 = (child2) => {
5072
+ if (result !== PROVEN && child2?._zod) {
5073
+ const answer = isRecursive(child2, stack, resolve9);
5074
5074
  if (answer > result)
5075
5075
  result = answer;
5076
5076
  }
@@ -5081,9 +5081,9 @@ function isRecursive(inst, stack, resolve9) {
5081
5081
  const desc2 = Object.getOwnPropertyDescriptor(sh, key);
5082
5082
  if (spread && !desc2.enumerable)
5083
5083
  continue;
5084
- const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
5085
- if (child > answer)
5086
- answer = child;
5084
+ const child2 = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
5085
+ if (child2 > answer)
5086
+ answer = child2;
5087
5087
  }
5088
5088
  return answer;
5089
5089
  };
@@ -20462,7 +20462,7 @@ var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
20462
20462
  var MAX_PROMPT_LENGTH = 1e4;
20463
20463
  var MAX_PROMPT_ATTACHMENT_LENGTH = 6e6;
20464
20464
  var MAX_EVENT_TEXT_LENGTH = 1e5;
20465
- var ACTIVITY_TYPES = /* @__PURE__ */ new Set(["plan", "progress", "reasoning", "tool"]);
20465
+ var ACTIVITY_TYPES = /* @__PURE__ */ new Set(["notice", "plan", "progress", "reasoning", "tool"]);
20466
20466
  var NARRATION_ACTIVITY_TYPES = /* @__PURE__ */ new Set(["progress", "reasoning"]);
20467
20467
  var ACTIVITY_STATUSES = /* @__PURE__ */ new Set(["pending", "running", "completed", "failed"]);
20468
20468
  var TOOL_KINDS = /* @__PURE__ */ new Set([
@@ -21572,8 +21572,8 @@ function hasTrueChildField(value, childKey, fieldKey) {
21572
21572
  if (!isRecord2(value)) {
21573
21573
  return false;
21574
21574
  }
21575
- const child = Reflect.get(value, childKey);
21576
- return isRecord2(child) && Reflect.get(child, fieldKey) === true;
21575
+ const child2 = Reflect.get(value, childKey);
21576
+ return isRecord2(child2) && Reflect.get(child2, fieldKey) === true;
21577
21577
  }
21578
21578
  function unsupportedSessionCapabilities() {
21579
21579
  return Object.freeze({
@@ -21885,17 +21885,17 @@ function mergeProcessTrees(captured, current) {
21885
21885
  }
21886
21886
  return [...processes.values()];
21887
21887
  }
21888
- async function captureProcessTree(child) {
21889
- if (process.platform === "win32" || child.pid === void 0) {
21888
+ async function captureProcessTree(child2) {
21889
+ if (process.platform === "win32" || child2.pid === void 0) {
21890
21890
  return [];
21891
21891
  }
21892
21892
  if (process.platform === "linux") {
21893
21893
  const procfsEntries = readLinuxProcessTableSynchronously();
21894
21894
  if (procfsEntries.length > 0) {
21895
- return selectProcessTree(procfsEntries, child.pid);
21895
+ return selectProcessTree(procfsEntries, child2.pid);
21896
21896
  }
21897
21897
  }
21898
- return selectProcessTree(await readProcessTable(), child.pid);
21898
+ return selectProcessTree(await readProcessTable(), child2.pid);
21899
21899
  }
21900
21900
  function signalCapturedProcessGroups(processes, rootProcessId, signal) {
21901
21901
  const processIds = new Set(processes.map((identity2) => identity2.processId));
@@ -21952,63 +21952,63 @@ async function waitForCapturedProcessesExit(processes, rootProcessId) {
21952
21952
  }
21953
21953
  return processIds.every((processId) => !processExists(processId));
21954
21954
  }
21955
- function terminateProcess(child) {
21956
- if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) {
21955
+ function terminateProcess(child2) {
21956
+ if (child2.exitCode !== null || child2.signalCode !== null || child2.pid === void 0) {
21957
21957
  return;
21958
21958
  }
21959
21959
  if (process.platform !== "win32") {
21960
21960
  try {
21961
- process.kill(-child.pid, "SIGTERM");
21961
+ process.kill(-child2.pid, "SIGTERM");
21962
21962
  return;
21963
21963
  } catch {
21964
21964
  }
21965
21965
  }
21966
- child.kill("SIGTERM");
21966
+ child2.kill("SIGTERM");
21967
21967
  }
21968
- function forceTerminateProcess(child) {
21969
- if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) {
21968
+ function forceTerminateProcess(child2) {
21969
+ if (child2.exitCode !== null || child2.signalCode !== null || child2.pid === void 0) {
21970
21970
  return;
21971
21971
  }
21972
21972
  if (process.platform !== "win32") {
21973
21973
  try {
21974
- process.kill(-child.pid, "SIGKILL");
21974
+ process.kill(-child2.pid, "SIGKILL");
21975
21975
  return;
21976
21976
  } catch {
21977
21977
  }
21978
21978
  }
21979
- child.kill("SIGKILL");
21979
+ child2.kill("SIGKILL");
21980
21980
  }
21981
- async function stopProcessTree(child, capturedProcesses = []) {
21982
- const childProcessId = child.pid;
21981
+ async function stopProcessTree(child2, capturedProcesses = []) {
21982
+ const childProcessId = child2.pid;
21983
21983
  if (childProcessId === void 0) {
21984
21984
  return;
21985
21985
  }
21986
- const childExited = child.exitCode !== null || child.signalCode !== null;
21987
- const processes = mergeProcessTrees(capturedProcesses, await captureProcessTree(child));
21986
+ const childExited = child2.exitCode !== null || child2.signalCode !== null;
21987
+ const processes = mergeProcessTrees(capturedProcesses, await captureProcessTree(child2));
21988
21988
  if (childExited && processes.length === 0) {
21989
21989
  return;
21990
21990
  }
21991
21991
  signalCapturedProcessGroups(processes, childProcessId, GRACEFUL_STOP_SIGNAL);
21992
- terminateProcess(child);
21992
+ terminateProcess(child2);
21993
21993
  const [exitedAfterTermination, descendantsExitedAfterTermination] = await Promise.all([
21994
- waitForProcessExit(child, PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS),
21994
+ waitForProcessExit(child2, PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS),
21995
21995
  waitForCapturedProcessesExit(processes, childProcessId)
21996
21996
  ]);
21997
21997
  if (exitedAfterTermination && descendantsExitedAfterTermination) {
21998
21998
  return;
21999
21999
  }
22000
22000
  signalCapturedProcessGroups(processes, childProcessId, FORCED_STOP_SIGNAL);
22001
- forceTerminateProcess(child);
22001
+ forceTerminateProcess(child2);
22002
22002
  const [exitedAfterForce, descendantsExitedAfterForce] = await Promise.all([
22003
- waitForProcessExit(child, PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS),
22003
+ waitForProcessExit(child2, PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS),
22004
22004
  waitForCapturedProcessesExit(processes, childProcessId)
22005
22005
  ]);
22006
22006
  if (!exitedAfterForce || !descendantsExitedAfterForce) {
22007
22007
  throw new ProcessExecutionError("process_termination_timeout", "The executable process could not be stopped");
22008
22008
  }
22009
22009
  }
22010
- function waitForProcessExit(child, timeoutMilliseconds) {
22011
- if (child.exitCode !== null || child.signalCode !== null) {
22010
+ function waitForProcessExit(child2, timeoutMilliseconds) {
22011
+ if (child2.exitCode !== null || child2.signalCode !== null) {
22012
22012
  return Promise.resolve(true);
22013
22013
  }
22014
22014
  return new Promise((resolveExit) => {
@@ -22019,13 +22019,13 @@ function waitForProcessExit(child, timeoutMilliseconds) {
22019
22019
  }
22020
22020
  settled = true;
22021
22021
  clearTimeout(timeout);
22022
- child.removeListener("exit", handleExit);
22022
+ child2.removeListener("exit", handleExit);
22023
22023
  resolveExit(exited);
22024
22024
  };
22025
22025
  const handleExit = () => finish(true);
22026
22026
  const timeout = setTimeout(() => finish(false), timeoutMilliseconds);
22027
- child.once("exit", handleExit);
22028
- if (child.exitCode !== null || child.signalCode !== null) {
22027
+ child2.once("exit", handleExit);
22028
+ if (child2.exitCode !== null || child2.signalCode !== null) {
22029
22029
  finish(true);
22030
22030
  }
22031
22031
  });
@@ -22033,7 +22033,7 @@ function waitForProcessExit(child, timeoutMilliseconds) {
22033
22033
  async function runBoundedProcess(options) {
22034
22034
  options.signal.throwIfAborted();
22035
22035
  const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
22036
- const child = spawn(options.command, [...options.arguments], {
22036
+ const child2 = spawn(options.command, [...options.arguments], {
22037
22037
  cwd: options.cwd,
22038
22038
  detached: process.platform !== "win32",
22039
22039
  env: { ...options.environment },
@@ -22056,7 +22056,7 @@ async function runBoundedProcess(options) {
22056
22056
  interruptionFailure = failure2;
22057
22057
  const stop = async () => {
22058
22058
  try {
22059
- await stopProcessTree(child);
22059
+ await stopProcessTree(child2);
22060
22060
  } catch (error62) {
22061
22061
  interruptionCleanupFailure = error62 instanceof ProcessExecutionError ? error62 : new ProcessExecutionError(
22062
22062
  "process_termination_failed",
@@ -22095,8 +22095,8 @@ async function runBoundedProcess(options) {
22095
22095
  interrupt(failure2);
22096
22096
  }
22097
22097
  };
22098
- child.stdout?.on("data", collectStdout);
22099
- child.stderr?.on("data", collectStderr);
22098
+ child2.stdout?.on("data", collectStdout);
22099
+ child2.stderr?.on("data", collectStderr);
22100
22100
  const timeout = setTimeout(() => {
22101
22101
  interrupt(new ProcessExecutionError("process_timeout", "The executable probe timed out"));
22102
22102
  }, options.timeoutMilliseconds);
@@ -22111,8 +22111,8 @@ async function runBoundedProcess(options) {
22111
22111
  }
22112
22112
  try {
22113
22113
  const exit = new Promise((resolveExit, rejectExit) => {
22114
- child.once("error", rejectExit);
22115
- child.once("exit", (code) => resolveExit(code ?? 1));
22114
+ child2.once("error", rejectExit);
22115
+ child2.once("exit", (code) => resolveExit(code ?? 1));
22116
22116
  });
22117
22117
  const exitCode = await Promise.race([exit, interrupted.promise.then(() => -1)]);
22118
22118
  if (interruptionCleanupFailure !== null) {
@@ -22135,12 +22135,12 @@ async function runBoundedProcess(options) {
22135
22135
  } finally {
22136
22136
  clearTimeout(timeout);
22137
22137
  options.signal.removeEventListener("abort", abort);
22138
- child.stdout?.removeListener("data", collectStdout);
22139
- child.stderr?.removeListener("data", collectStderr);
22138
+ child2.stdout?.removeListener("data", collectStdout);
22139
+ child2.stderr?.removeListener("data", collectStderr);
22140
22140
  if (stopping) {
22141
22141
  await interrupted.promise;
22142
22142
  } else {
22143
- await stopProcessTree(child);
22143
+ await stopProcessTree(child2);
22144
22144
  }
22145
22145
  }
22146
22146
  }
@@ -23184,19 +23184,19 @@ var AgentConnection = class {
23184
23184
  this.connection = createAcpClient(client2).connect(inProcess.app());
23185
23185
  return;
23186
23186
  }
23187
- const child = spawn2(agent.adapterPath, [...agent.arguments], {
23187
+ const child2 = spawn2(agent.adapterPath, [...agent.arguments], {
23188
23188
  cwd,
23189
23189
  detached: process.platform !== "win32",
23190
23190
  env: { ...process.env, ...agent.environment },
23191
23191
  shell: false,
23192
23192
  stdio: ["pipe", "pipe", "pipe"]
23193
23193
  });
23194
- this.#process = { kind: "child", child };
23195
- const stdin = child.stdin;
23196
- const stdout = child.stdout;
23197
- const stderr = child.stderr;
23194
+ this.#process = { kind: "child", child: child2 };
23195
+ const stdin = child2.stdin;
23196
+ const stdout = child2.stdout;
23197
+ const stderr = child2.stderr;
23198
23198
  if (stdin === null || stdout === null || stderr === null) {
23199
- child.kill("SIGKILL");
23199
+ child2.kill("SIGKILL");
23200
23200
  throw new AcpExecutionError("ACP process streams are unavailable");
23201
23201
  }
23202
23202
  stderr.setEncoding("utf8");
@@ -23204,10 +23204,10 @@ var AgentConnection = class {
23204
23204
  process.stderr.write(`[${agent.id}-acp] ${chunk}`);
23205
23205
  });
23206
23206
  this.termination = new Promise((resolve9) => {
23207
- child.once("error", (cause) => {
23207
+ child2.once("error", (cause) => {
23208
23208
  resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
23209
23209
  });
23210
- child.once("exit", (code, signal) => {
23210
+ child2.once("exit", (code, signal) => {
23211
23211
  resolve9({
23212
23212
  kind: "failed",
23213
23213
  error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
@@ -23342,6 +23342,7 @@ var AcpActivityTracker = class {
23342
23342
  #activities = /* @__PURE__ */ new Map();
23343
23343
  #identities = /* @__PURE__ */ new Map();
23344
23344
  #narrations = /* @__PURE__ */ new Map();
23345
+ #noticeRevisions = /* @__PURE__ */ new Map();
23345
23346
  #onActivity;
23346
23347
  #onNarration;
23347
23348
  #prepareContent;
@@ -23377,6 +23378,30 @@ var AcpActivityTracker = class {
23377
23378
  await this.#onNarration(new AcpActivityNarration(identity2.id, activityType, identity2.sequence, text2));
23378
23379
  }
23379
23380
  };
23381
+ recordNotice = async (id, revision, severity, text2) => {
23382
+ const key = `notice:${id}`;
23383
+ if ((this.#noticeRevisions.get(key) ?? 0) >= revision) {
23384
+ return;
23385
+ }
23386
+ await this.finishNarrative();
23387
+ this.#noticeRevisions.set(key, revision);
23388
+ const identity2 = this.#identity(key);
23389
+ await this.#record(
23390
+ key,
23391
+ new AcpActivity(
23392
+ identity2.id,
23393
+ "notice",
23394
+ "",
23395
+ [],
23396
+ "",
23397
+ truncate(text2, AGENT_ACTIVITY_DETAIL_LIMIT),
23398
+ identity2.sequence,
23399
+ severity === "error" ? "failed" : "completed",
23400
+ severity === "error" ? "Agent error" : "Agent warning",
23401
+ ""
23402
+ )
23403
+ );
23404
+ };
23380
23405
  #narrativeSnapshot = (identity2, activityType, output2, status) => new AcpActivity(
23381
23406
  identity2.id,
23382
23407
  activityType,
@@ -23939,6 +23964,63 @@ var AcpAgentSettingsSnapshot = class {
23939
23964
  }
23940
23965
  };
23941
23966
 
23967
+ // src/acp/session-failure.ts
23968
+ var CATEGORIES = /* @__PURE__ */ new Set([
23969
+ "access",
23970
+ "connection",
23971
+ "limit",
23972
+ "request",
23973
+ "service",
23974
+ "unknown"
23975
+ ]);
23976
+ function isCategory(value) {
23977
+ return typeof value === "string" && CATEGORIES.has(value);
23978
+ }
23979
+ function child(value, key) {
23980
+ return isRecord4(value) ? value[key] : void 0;
23981
+ }
23982
+ function readAcpSessionFailure(value) {
23983
+ const meta3 = child(value, "_meta");
23984
+ const jetbrains = child(meta3, "jetbrains");
23985
+ const air = child(jetbrains, "air");
23986
+ const failure2 = child(air, "sessionFailure");
23987
+ if (!isRecord4(air) || !Number.isInteger(air["version"]) || Number(air["version"]) < 1 || !isRecord4(failure2)) {
23988
+ return null;
23989
+ }
23990
+ const id = failure2["id"];
23991
+ const revision = failure2["revision"];
23992
+ const category = failure2["category"];
23993
+ const severity = failure2["severity"];
23994
+ const title2 = failure2["title"];
23995
+ if (typeof id !== "string" || id.length === 0 || id.length > 512 || !Number.isInteger(revision) || Number(revision) < 1 || !isCategory(category) || severity !== "warning" && severity !== "error" || typeof title2 !== "string" || title2.length === 0) {
23996
+ return null;
23997
+ }
23998
+ return {
23999
+ category,
24000
+ id,
24001
+ revision: Number(revision),
24002
+ severity,
24003
+ title: truncate2(title2, 4096)
24004
+ };
24005
+ }
24006
+ function sessionFailureMeta(failure2) {
24007
+ return {
24008
+ jetbrains: {
24009
+ air: {
24010
+ version: 1,
24011
+ sessionFailure: {
24012
+ actions: [],
24013
+ category: failure2.category,
24014
+ id: failure2.id,
24015
+ revision: failure2.revision,
24016
+ severity: failure2.severity,
24017
+ title: failure2.title
24018
+ }
24019
+ }
24020
+ }
24021
+ };
24022
+ }
24023
+
23942
24024
  // src/acp/session-history.ts
23943
24025
  var HISTORY_ACTIVITY_FIELD_LIMIT = 1e5;
23944
24026
  var HISTORY_ACTIVITY_LIMIT = 100;
@@ -30542,6 +30624,9 @@ var AgentSession = class _AgentSession {
30542
30624
  methods3.agent.initialize,
30543
30625
  {
30544
30626
  clientCapabilities: {
30627
+ _meta: {
30628
+ jetbrains: { air: { capabilities: ["sessionFailure"], version: 1 } }
30629
+ },
30545
30630
  elicitation: { form: {}, url: {} },
30546
30631
  plan: {},
30547
30632
  session: { configOptions: { boolean: {} } }
@@ -30975,6 +31060,10 @@ var AgentSession = class _AgentSession {
30975
31060
  "acp_invalid_prompt_response"
30976
31061
  );
30977
31062
  }
31063
+ const failure2 = readAcpSessionFailure(response);
31064
+ if (failure2 !== null) {
31065
+ await running.activities.recordNotice(failure2.id, failure2.revision, failure2.severity, failure2.title);
31066
+ }
30978
31067
  if (result.usage != null || result._meta?.quota !== void 0) {
30979
31068
  await this.#getObserver().onUsage({
30980
31069
  _meta: result._meta ?? null,
@@ -31158,6 +31247,10 @@ var AgentSession = class _AgentSession {
31158
31247
  return;
31159
31248
  }
31160
31249
  if (update.sessionUpdate === "session_info_update") {
31250
+ const failure2 = readAcpSessionFailure(update);
31251
+ if (failure2 !== null && this.#turn.running) {
31252
+ await this.#turn.activities.recordNotice(failure2.id, failure2.revision, failure2.severity, failure2.title);
31253
+ }
31161
31254
  if (Object.hasOwn(update, "title")) {
31162
31255
  this.#sessionTitle = truncate2(update.title ?? "", 500);
31163
31256
  }
@@ -31745,7 +31838,7 @@ var AgentRuntimeManager = class {
31745
31838
  } finally {
31746
31839
  if (retained && this.#sessionIdentity === "native") {
31747
31840
  const stored = this.#store.read(sessionId);
31748
- if (stored instanceof FoundAcpStoredSession && isNativeChatSessionId(stored.session.agentId, sessionId)) {
31841
+ if (stored instanceof FoundAcpStoredSession && stored.session.nativeSessionId === sessionId && isNativeChatSessionId(stored.session.agentId, sessionId)) {
31749
31842
  this.#store.remove(sessionId);
31750
31843
  }
31751
31844
  }
@@ -33043,6 +33136,12 @@ var turnNotificationSchema = external_exports.object({
33043
33136
  threadId: boundedText(256),
33044
33137
  turn: turnSchema
33045
33138
  });
33139
+ var errorNotificationSchema = external_exports.object({
33140
+ error: external_exports.object({ message: boundedText(4096) }),
33141
+ threadId: boundedText(256),
33142
+ turnId: boundedText(256),
33143
+ willRetry: external_exports.boolean()
33144
+ });
33046
33145
  var commandApprovalParamsSchema = external_exports.object({
33047
33146
  command: external_exports.string().nullish(),
33048
33147
  commandActions: external_exports.array(external_exports.unknown()).max(1e3).nullish(),
@@ -34052,6 +34151,7 @@ var CodexAcpAgent = class {
34052
34151
  #nativeSessionId = "";
34053
34152
  #streamedReasoningItemIds = /* @__PURE__ */ new Set();
34054
34153
  #streamedAgentMessageItemIds = /* @__PURE__ */ new Set();
34154
+ #noticeRevisions = /* @__PURE__ */ new Map();
34055
34155
  #turn = null;
34056
34156
  #nativeTurnId = null;
34057
34157
  #updateTail = Promise.resolve();
@@ -34204,10 +34304,10 @@ var CodexAcpAgent = class {
34204
34304
  if (this.#closePromise === null) {
34205
34305
  this.#appServer.detach();
34206
34306
  this.#closePromise = (async () => {
34207
- const child = this.#appServer.child();
34307
+ const child2 = this.#appServer.child();
34208
34308
  try {
34209
- const captured = await captureProcessTree(child);
34210
- await stopProcessTree(child, captured);
34309
+ const captured = await captureProcessTree(child2);
34310
+ await stopProcessTree(child2, captured);
34211
34311
  } finally {
34212
34312
  this.#connection?.close();
34213
34313
  }
@@ -34297,6 +34397,27 @@ var CodexAcpAgent = class {
34297
34397
  await pending;
34298
34398
  };
34299
34399
  #onNotification = async (method, params) => {
34400
+ if (method === "error") {
34401
+ const decoded = errorNotificationSchema.safeParse(params);
34402
+ if (decoded.success && decoded.data.willRetry && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null && decoded.data.turnId === this.#turn.turn.id) {
34403
+ const id = `codex:${decoded.data.turnId}:error`;
34404
+ const revision = (this.#noticeRevisions.get(id) ?? 0) + 1;
34405
+ this.#noticeRevisions.set(id, revision);
34406
+ await this.#enqueue(async () => {
34407
+ await this.#emit({
34408
+ _meta: sessionFailureMeta({
34409
+ category: "service",
34410
+ id,
34411
+ revision,
34412
+ severity: "warning",
34413
+ title: decoded.data.error.message
34414
+ }),
34415
+ sessionUpdate: "session_info_update"
34416
+ });
34417
+ });
34418
+ }
34419
+ return;
34420
+ }
34300
34421
  if (method === "turn/started") {
34301
34422
  const decoded = turnNotificationSchema.safeParse(params);
34302
34423
  if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null) {
@@ -35927,7 +36048,7 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
35927
36048
  signal.removeEventListener("abort", abort);
35928
36049
  }
35929
36050
  }
35930
- const child = spawn4(agent.adapterPath, [...agent.arguments], {
36051
+ const child2 = spawn4(agent.adapterPath, [...agent.arguments], {
35931
36052
  cwd: defaultWorkspace,
35932
36053
  detached: process.platform !== "win32",
35933
36054
  env: { ...environment, ...agent.environment },
@@ -35936,17 +36057,17 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
35936
36057
  });
35937
36058
  const processExit = new Promise((_resolve, reject) => {
35938
36059
  const rejectExit = () => reject(new Error("ACP adapter exited during initialization"));
35939
- child.once("error", reject);
35940
- child.once("exit", rejectExit);
35941
- if (child.exitCode !== null || child.signalCode !== null) {
36060
+ child2.once("error", reject);
36061
+ child2.once("exit", rejectExit);
36062
+ if (child2.exitCode !== null || child2.signalCode !== null) {
35942
36063
  rejectExit();
35943
36064
  }
35944
36065
  });
35945
- const stdin = child.stdin;
35946
- const stdout = child.stdout;
35947
- const stderr = child.stderr;
36066
+ const stdin = child2.stdin;
36067
+ const stdout = child2.stdout;
36068
+ const stderr = child2.stderr;
35948
36069
  if (stdin === null || stdout === null || stderr === null) {
35949
- await stopProcessTree(child);
36070
+ await stopProcessTree(child2);
35950
36071
  throw new AgentProbeError("acp_incompatible", "ACP adapter streams are unavailable");
35951
36072
  }
35952
36073
  let stderrBytes = 0;
@@ -35998,11 +36119,11 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
35998
36119
  } finally {
35999
36120
  clearTimeout(timeout);
36000
36121
  signal.removeEventListener("abort", abort);
36001
- const capturedProcesses = await captureProcessTree(child);
36122
+ const capturedProcesses = await captureProcessTree(child2);
36002
36123
  connection.close();
36003
36124
  stdin.end();
36004
36125
  stderr.removeListener("data", consumeStderr);
36005
- await stopProcessTree(child, capturedProcesses);
36126
+ await stopProcessTree(child2, capturedProcesses);
36006
36127
  }
36007
36128
  }
36008
36129
 
@@ -37980,16 +38101,16 @@ var WorkspaceDirectoryService = class {
37980
38101
  const children = await readdir3(target, { withFileTypes: true });
37981
38102
  signal.throwIfAborted();
37982
38103
  const entries = [];
37983
- for (const child of children) {
38104
+ for (const child2 of children) {
37984
38105
  if (entries.length === 500) {
37985
38106
  break;
37986
38107
  }
37987
- if (child.isFile() || child.isBlockDevice() || child.isCharacterDevice() || child.isFIFO() || child.isSocket()) {
38108
+ if (child2.isFile() || child2.isBlockDevice() || child2.isCharacterDevice() || child2.isFIFO() || child2.isSocket()) {
37988
38109
  continue;
37989
38110
  }
37990
38111
  try {
37991
- const path2 = await this.resolvePath(join16(target, child.name), signal);
37992
- entries.push({ directoryId: encodePath(path2), name: child.name });
38112
+ const path2 = await this.resolvePath(join16(target, child2.name), signal);
38113
+ entries.push({ directoryId: encodePath(path2), name: child2.name });
37993
38114
  } catch (cause) {
37994
38115
  signal.throwIfAborted();
37995
38116
  if (!(cause instanceof LocalAuthorizationError)) {
@@ -39008,7 +39129,7 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
39008
39129
  );
39009
39130
  }
39010
39131
  signal.throwIfAborted();
39011
- const child = spawn5(agent.agentIdentity.realPath, ["app-server"], {
39132
+ const child2 = spawn5(agent.agentIdentity.realPath, ["app-server"], {
39012
39133
  cwd,
39013
39134
  env: { ...process.env, ...agent.environment },
39014
39135
  detached: process.platform !== "win32",
@@ -39028,7 +39149,7 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
39028
39149
  )
39029
39150
  );
39030
39151
  const send2 = (message) => {
39031
- child.stdin.write(`${JSON.stringify(message)}
39152
+ child2.stdin.write(`${JSON.stringify(message)}
39032
39153
  `);
39033
39154
  };
39034
39155
  const onData = (chunk) => {
@@ -39158,11 +39279,11 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
39158
39279
  () => fail(new AcpExecutionError("Reading saved Codex history timed out.", {}, "native_history_timeout")),
39159
39280
  options.detail === "rich" ? 6e4 : 15e3
39160
39281
  );
39161
- child.stdout.setEncoding("utf8");
39162
- child.stdout.on("data", onData);
39163
- child.stdin.on("error", fail);
39164
- child.on("error", fail);
39165
- child.on("exit", onExit);
39282
+ child2.stdout.setEncoding("utf8");
39283
+ child2.stdout.on("data", onData);
39284
+ child2.stdin.on("error", fail);
39285
+ child2.on("error", fail);
39286
+ child2.on("exit", onExit);
39166
39287
  signal.addEventListener("abort", abort, { once: true });
39167
39288
  try {
39168
39289
  if (signal.aborted) {
@@ -39182,13 +39303,13 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
39182
39303
  } finally {
39183
39304
  clearTimeout(timeout);
39184
39305
  signal.removeEventListener("abort", abort);
39185
- child.stdout.removeListener("data", onData);
39186
- if (child.pid !== void 0) {
39187
- await stopProcessTree(child);
39306
+ child2.stdout.removeListener("data", onData);
39307
+ if (child2.pid !== void 0) {
39308
+ await stopProcessTree(child2);
39188
39309
  }
39189
- child.stdin.removeListener("error", fail);
39190
- child.removeListener("error", fail);
39191
- child.removeListener("exit", onExit);
39310
+ child2.stdin.removeListener("error", fail);
39311
+ child2.removeListener("error", fail);
39312
+ child2.removeListener("exit", onExit);
39192
39313
  }
39193
39314
  }
39194
39315
  var readCodexHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "messages" });