oasis_test_v2 2.2.43 → 2.2.44

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 (2) hide show
  1. package/dist/index.js +163 -129
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1509,8 +1509,8 @@ function trimRoundSummariesForReturn(summaries, recentRounds = DELEGATION_RETURN
1509
1509
  const cut = Math.max(0, summaries.length - keep);
1510
1510
  return summaries.map((summary, index2) => {
1511
1511
  if (index2 >= cut) return { round: summary.round, text: summary.text, truncated: false };
1512
- const firstLine2 = summary.text.split("\n").map((line) => line.trim()).find((line) => line.length > 0) ?? "";
1513
- return { round: summary.round, text: firstLine2, truncated: true };
1512
+ const firstLine3 = summary.text.split("\n").map((line) => line.trim()).find((line) => line.length > 0) ?? "";
1513
+ return { round: summary.round, text: firstLine3, truncated: true };
1514
1514
  });
1515
1515
  }
1516
1516
  function collectDelegationArtifacts(roundSummaries) {
@@ -3918,7 +3918,7 @@ var init_claude_code = __esm({
3918
3918
  const liveEventCbs = [];
3919
3919
  let eventSeq = 0;
3920
3920
  let lastResult;
3921
- const stderrTail = [];
3921
+ const stderrTail2 = [];
3922
3922
  const STDERR_MAX_LINES = 40;
3923
3923
  const STDERR_MAX_BYTES = 4e3;
3924
3924
  const usageAcc = newClaudeUsageAcc();
@@ -3991,11 +3991,11 @@ var init_claude_code = __esm({
3991
3991
  out.write(line + "\n");
3992
3992
  } catch {
3993
3993
  }
3994
- stderrTail.push(line);
3995
- while (stderrTail.length > STDERR_MAX_LINES) stderrTail.shift();
3996
- let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
3997
- while (total > STDERR_MAX_BYTES && stderrTail.length > 1) {
3998
- total -= stderrTail.shift().length + 1;
3994
+ stderrTail2.push(line);
3995
+ while (stderrTail2.length > STDERR_MAX_LINES) stderrTail2.shift();
3996
+ let total = stderrTail2.reduce((n, l) => n + l.length + 1, 0);
3997
+ while (total > STDERR_MAX_BYTES && stderrTail2.length > 1) {
3998
+ total -= stderrTail2.shift().length + 1;
3999
3999
  }
4000
4000
  });
4001
4001
  const callbacks = [];
@@ -4025,7 +4025,7 @@ var init_claude_code = __esm({
4025
4025
  if (exited) return;
4026
4026
  let reason = killReason ?? classifyExit(lastResult);
4027
4027
  const resultErrors = Array.isArray(lastResult?.errors) ? lastResult.errors.map(String) : [];
4028
- const resumeErrText = [stderrTail.join("\n"), String(lastResult?.result ?? ""), ...resultErrors].join("\n");
4028
+ const resumeErrText = [stderrTail2.join("\n"), String(lastResult?.result ?? ""), ...resultErrors].join("\n");
4029
4029
  if (!killReason && job.resumeRuntimeSession && reason !== "clean" && isSessionNotFoundError(resumeErrText)) {
4030
4030
  reason = "session-not-found";
4031
4031
  }
@@ -4059,7 +4059,7 @@ var init_claude_code = __esm({
4059
4059
  const composed = [subtype && `[${subtype}]`, body2].filter(Boolean).join(" ").trim();
4060
4060
  if (composed) errorParts.push(composed);
4061
4061
  }
4062
- if (stderrTail.length) errorParts.push(stderrTail.join("\n").trim());
4062
+ if (stderrTail2.length) errorParts.push(stderrTail2.join("\n").trim());
4063
4063
  const errorMessage = isError ? errorParts.filter(Boolean).join("\n---\n").slice(-4e3).trim() || void 0 : void 0;
4064
4064
  exited = {
4065
4065
  code: killReason ? null : code2,
@@ -5476,7 +5476,7 @@ async function runProtocolSession(job, cfg) {
5476
5476
  let eventSeq = 0;
5477
5477
  let runtimeSessionId;
5478
5478
  const pendingTurnMessages = [];
5479
- const stderrTail = [];
5479
+ const stderrTail2 = [];
5480
5480
  const finish = (info) => {
5481
5481
  if (exited) return;
5482
5482
  closing = true;
@@ -5563,8 +5563,8 @@ async function runProtocolSession(job, cfg) {
5563
5563
  child.stderr.on("data", (chunk) => {
5564
5564
  const text6 = chunk.toString("utf8");
5565
5565
  transcript.write(text6);
5566
- stderrTail.push(text6.trim());
5567
- while (stderrTail.length > 40) stderrTail.shift();
5566
+ stderrTail2.push(text6.trim());
5567
+ while (stderrTail2.length > 40) stderrTail2.shift();
5568
5568
  });
5569
5569
  const timer = setTimeout(() => {
5570
5570
  killReason ??= "timeout";
@@ -5584,7 +5584,7 @@ async function runProtocolSession(job, cfg) {
5584
5584
  const info = {
5585
5585
  code: killReason ? null : code2,
5586
5586
  reason,
5587
- ...reason === "error" && stderrTail.length ? { errorMessage: stderrTail.join("\n").slice(-4e3) } : {}
5587
+ ...reason === "error" && stderrTail2.length ? { errorMessage: stderrTail2.join("\n").slice(-4e3) } : {}
5588
5588
  };
5589
5589
  finish(!killReason && cfg.processExitInfo ? cfg.processExitInfo(info, state) : info);
5590
5590
  }
@@ -6287,8 +6287,8 @@ ${task}` : task;
6287
6287
  }
6288
6288
  if (method === "turn/completed") {
6289
6289
  const turn = record2(params?.turn);
6290
- const failure = typeof turn?.id === "string" ? state.errorsByTurn.get(turn.id) : void 0;
6291
- if (params?.threadId !== state.threadId || turn?.id !== state.turnId || turn?.status !== "completed" || turn.error || failure && !failure.willRetry) return [];
6290
+ const failure2 = typeof turn?.id === "string" ? state.errorsByTurn.get(turn.id) : void 0;
6291
+ if (params?.threadId !== state.threadId || turn?.id !== state.turnId || turn?.status !== "completed" || turn.error || failure2 && !failure2.willRetry) return [];
6292
6292
  return [{ ...base, itemId: "turn-end", itemType: "control", operation: "completed", payload: { code: "output_block_completed" } }];
6293
6293
  }
6294
6294
  return [];
@@ -6340,8 +6340,8 @@ ${task}` : task;
6340
6340
  if (params?.threadId !== state.threadId || !state.turnId || turn?.id !== state.turnId) return void 0;
6341
6341
  state.active = false;
6342
6342
  if (turn.status === "interrupted") return { code: null, reason: "cancelled" };
6343
- const failure = state.errorsByTurn.get(state.turnId);
6344
- const error2 = turn.error ?? (turn.status === "failed" || !failure?.willRetry ? failure?.error : void 0);
6343
+ const failure2 = state.errorsByTurn.get(state.turnId);
6344
+ const error2 = turn.error ?? (turn.status === "failed" || !failure2?.willRetry ? failure2?.error : void 0);
6345
6345
  if (turn.status === "completed" && !error2) return { code: 0, reason: "clean" };
6346
6346
  return { code: 1, reason: "error", errorMessage: codexTurnErrorMessage(error2) };
6347
6347
  },
@@ -6540,15 +6540,15 @@ ${task}` : task;
6540
6540
  for (const cb of telemetryCbs) cb(full);
6541
6541
  }
6542
6542
  };
6543
- const stderrTail = [];
6543
+ const stderrTail2 = [];
6544
6544
  const STDERR_MAX_LINES = 40;
6545
6545
  const STDERR_MAX_BYTES = 4e3;
6546
6546
  const pushStderrTail = (line) => {
6547
- stderrTail.push(line);
6548
- while (stderrTail.length > STDERR_MAX_LINES) stderrTail.shift();
6549
- let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
6550
- while (total > STDERR_MAX_BYTES && stderrTail.length > 1) {
6551
- total -= stderrTail.shift().length + 1;
6547
+ stderrTail2.push(line);
6548
+ while (stderrTail2.length > STDERR_MAX_LINES) stderrTail2.shift();
6549
+ let total = stderrTail2.reduce((n, l) => n + l.length + 1, 0);
6550
+ while (total > STDERR_MAX_BYTES && stderrTail2.length > 1) {
6551
+ total -= stderrTail2.shift().length + 1;
6552
6552
  }
6553
6553
  };
6554
6554
  const stdoutErrorLines = [];
@@ -6633,8 +6633,8 @@ ${task}` : task;
6633
6633
  const runtimeSessionId = telemetry.sessionId ?? resumeSessionId;
6634
6634
  const sawStreamError = streamErrorMessages.length > 0;
6635
6635
  const isError = !killReason && (code2 !== 0 || sawStreamError);
6636
- const errorMessage = isError ? [...streamErrorMessages, ...stdoutErrorLines, ...stderrTail].join("\n").trim().slice(-4e3) || void 0 : void 0;
6637
- const sessionNotFound = !killReason && isResume && isSessionNotFoundError([...streamErrorMessages, ...stdoutErrorLines, ...stderrTail].join("\n"));
6636
+ const errorMessage = isError ? [...streamErrorMessages, ...stdoutErrorLines, ...stderrTail2].join("\n").trim().slice(-4e3) || void 0 : void 0;
6637
+ const sessionNotFound = !killReason && isResume && isSessionNotFoundError([...streamErrorMessages, ...stdoutErrorLines, ...stderrTail2].join("\n"));
6638
6638
  const reason = killReason ? killReason : sessionNotFound ? "session-not-found" : sawStreamError ? "error" : code2 === 0 ? "clean" : "error";
6639
6639
  finish({
6640
6640
  code: killReason ? null : code2,
@@ -7187,10 +7187,10 @@ function parseArgsJSON(argsText) {
7187
7187
  return { text: t };
7188
7188
  }
7189
7189
  }
7190
- function composeAcpErrorMessage(rpcError, stderrTail) {
7190
+ function composeAcpErrorMessage(rpcError, stderrTail2) {
7191
7191
  const parts = [];
7192
7192
  if (rpcError && rpcError.trim()) parts.push(rpcError.trim());
7193
- if (stderrTail.length) parts.push(stderrTail.join("\n").trim());
7193
+ if (stderrTail2.length) parts.push(stderrTail2.join("\n").trim());
7194
7194
  const combined = parts.filter(Boolean).join("\n---\n").slice(-4e3).trim();
7195
7195
  return combined || void 0;
7196
7196
  }
@@ -7344,7 +7344,7 @@ ${note}` : note };
7344
7344
  killReason ??= "timeout";
7345
7345
  child.kill("SIGKILL");
7346
7346
  }, job.limits.wallClockMs);
7347
- const stderrTail = [];
7347
+ const stderrTail2 = [];
7348
7348
  const STDERR_MAX_LINES = 40;
7349
7349
  const STDERR_MAX_BYTES = 4e3;
7350
7350
  let turnMessage = "";
@@ -7359,11 +7359,11 @@ ${note}` : note };
7359
7359
  turnStderr.push(line);
7360
7360
  if (turnStderr.length > PROMPT_TURN_STDERR_MAX_LINES) turnStderr.shift();
7361
7361
  }
7362
- stderrTail.push(line);
7363
- while (stderrTail.length > STDERR_MAX_LINES) stderrTail.shift();
7364
- let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
7365
- while (total > STDERR_MAX_BYTES && stderrTail.length > 1) {
7366
- total -= stderrTail.shift().length + 1;
7362
+ stderrTail2.push(line);
7363
+ while (stderrTail2.length > STDERR_MAX_LINES) stderrTail2.shift();
7364
+ let total = stderrTail2.reduce((n, l) => n + l.length + 1, 0);
7365
+ while (total > STDERR_MAX_BYTES && stderrTail2.length > 1) {
7366
+ total -= stderrTail2.shift().length + 1;
7367
7367
  }
7368
7368
  });
7369
7369
  let lastRpcError;
@@ -7435,7 +7435,7 @@ ${note}` : note };
7435
7435
  });
7436
7436
  child.on("error", (err) => {
7437
7437
  clearTimeout(timer);
7438
- finish({ code: null, reason: "error", transcriptRef, errorMessage: composeAcpErrorMessage(err instanceof Error ? err.message : String(err), stderrTail) });
7438
+ finish({ code: null, reason: "error", transcriptRef, errorMessage: composeAcpErrorMessage(err instanceof Error ? err.message : String(err), stderrTail2) });
7439
7439
  });
7440
7440
  child.on("exit", (code2) => {
7441
7441
  clearTimeout(timer);
@@ -7445,7 +7445,7 @@ ${note}` : note };
7445
7445
  code: killReason ? null : code2,
7446
7446
  reason: killReason ?? (code2 === 0 ? "clean" : "error"),
7447
7447
  transcriptRef,
7448
- ...isError ? { errorMessage: composeAcpErrorMessage(lastRpcError, stderrTail) } : {}
7448
+ ...isError ? { errorMessage: composeAcpErrorMessage(lastRpcError, stderrTail2) } : {}
7449
7449
  });
7450
7450
  });
7451
7451
  });
@@ -7553,14 +7553,14 @@ ${task}` : task;
7553
7553
  inflightAppendBatch = [];
7554
7554
  }
7555
7555
  closingForExit = true;
7556
- let failure;
7556
+ let failure2;
7557
7557
  if (cfg.classifyPromptFailure) {
7558
7558
  await new Promise((r) => setTimeout(r, PROMPT_FAILURE_STDERR_SETTLE_MS));
7559
- failure = cfg.classifyPromptFailure({ message: turnMessage, stderrLines: [...turnStderr], result: promptResult });
7559
+ failure2 = cfg.classifyPromptFailure({ message: turnMessage, stderrLines: [...turnStderr], result: promptResult });
7560
7560
  }
7561
7561
  const usage = buildReportedUsage(client.usage, actualModel, cfg.inputTokensIncludeCacheRead === true);
7562
7562
  if (!exited) {
7563
- finish(failure ? { code: null, reason: failure.reason, errorMessage: failure.errorMessage, transcriptRef, usage, model: actualModel } : { code: 0, reason: "clean", transcriptRef, usage, model: actualModel });
7563
+ finish(failure2 ? { code: null, reason: failure2.reason, errorMessage: failure2.errorMessage, transcriptRef, usage, model: actualModel } : { code: 0, reason: "clean", transcriptRef, usage, model: actualModel });
7564
7564
  }
7565
7565
  child.kill("SIGTERM");
7566
7566
  } catch (err) {
@@ -7568,7 +7568,7 @@ ${task}` : task;
7568
7568
  if (!exited) {
7569
7569
  const reason = killReason ?? "error";
7570
7570
  const usage = buildReportedUsage(client.usage, actualModel, cfg.inputTokensIncludeCacheRead === true);
7571
- finish({ code: null, reason, transcriptRef, usage, model: actualModel, ...killReason ? {} : { errorMessage: composeAcpErrorMessage(lastRpcError, stderrTail) } });
7571
+ finish({ code: null, reason, transcriptRef, usage, model: actualModel, ...killReason ? {} : { errorMessage: composeAcpErrorMessage(lastRpcError, stderrTail2) } });
7572
7572
  }
7573
7573
  } finally {
7574
7574
  await readerDone;
@@ -7956,35 +7956,67 @@ var init_acp = __esm({
7956
7956
 
7957
7957
  // ../adapters/src/hermes/prompt-failure.ts
7958
7958
  function classifyHermesPromptFailure(turn) {
7959
- if (promptResultHasUsage(turn.result)) return void 0;
7960
- const failed = failureFromMessage(turn.message) ?? failureFromStderr(turn.stderrLines);
7961
- if (!failed) return void 0;
7962
- return {
7963
- reason: QUOTA_RE.test(failed.summary) ? "rate-limit" : "error",
7964
- errorMessage: `API call failed after ${failed.retries} retries: ${failed.summary}`
7965
- };
7959
+ const errors = mainAgentErrorRecords(turn.stderrLines);
7960
+ if (promptResultHasUsage(turn.result)) {
7961
+ const gaveUp = errors.filter((r) => API_GAVE_UP_RE.test(r));
7962
+ return gaveUp.length > 0 ? failure(clip(gaveUp.slice(-MAX_ERROR_RECORDS).join("\n"))) : void 0;
7963
+ }
7964
+ const failedSentence = FAILED_SENTENCE_RE.test(turn.message) ? firstLine(turn.message) : void 0;
7965
+ const silent = turn.message.trim() === "";
7966
+ if (errors.length === 0 && !failedSentence && !silent) return void 0;
7967
+ return failure(errors.length > 0 ? clip(errors.slice(-MAX_ERROR_RECORDS).join("\n")) : failedSentence ?? `hermes \u672C\u8F6E\u6CA1\u6709\u6B63\u5E38\u6536\u5C3E\uFF08\u54CD\u5E94\u4E0D\u5E26\u7528\u91CF\uFF09\uFF0C\u6CA1\u6709\u8F93\u51FA\uFF0Cstderr \u4E5F\u6CA1\u6709 ERROR \u65E5\u5FD7\u3002${stderrTail(turn.stderrLines)}`);
7966
7968
  }
7967
- function promptResultHasUsage(result) {
7968
- return typeof result === "object" && result !== null && result.usage != null;
7969
+ function failure(errorMessage) {
7970
+ return { reason: QUOTA_RE.test(errorMessage) ? "rate-limit" : "error", errorMessage };
7969
7971
  }
7970
- function failureFromMessage(message) {
7971
- const m2 = MESSAGE_RE.exec(message);
7972
- return m2 ? { retries: m2[1], summary: m2[2].trim() } : void 0;
7972
+ function promptResultHasUsage(result) {
7973
+ if (typeof result !== "object" || result === null) return false;
7974
+ return USAGE_KEYS.some((k2) => result[k2] != null);
7973
7975
  }
7974
- function failureFromStderr(lines) {
7975
- for (let i = lines.length - 1; i >= 0; i--) {
7976
- const m2 = STDERR_RE.exec(lines[i]);
7977
- if (m2) return { retries: m2[1], summary: m2[2].trim() };
7976
+ function mainAgentErrorRecords(lines) {
7977
+ const records = [];
7978
+ let current = null;
7979
+ const flush = () => {
7980
+ if (current) records.push(current.join("\n").trimEnd());
7981
+ current = null;
7982
+ };
7983
+ for (const line of lines) {
7984
+ const m2 = LOG_RECORD_RE.exec(line);
7985
+ if (m2) {
7986
+ flush();
7987
+ const [, level, text6] = m2;
7988
+ if ((level === "ERROR" || level === "CRITICAL") && !SUBAGENT_PREFIX_RE.test(text6)) current = [text6];
7989
+ } else if (current) {
7990
+ current.push(line);
7991
+ }
7978
7992
  }
7979
- return void 0;
7993
+ flush();
7994
+ return records.filter((r) => r.trim() !== "");
7995
+ }
7996
+ function firstLine(text6) {
7997
+ return text6.trim().split("\n")[0].trim();
7980
7998
  }
7981
- var QUOTA_RE, MESSAGE_RE, STDERR_RE;
7999
+ function clip(text6) {
8000
+ return text6.length > MAX_ERROR_CHARS ? `\u2026${text6.slice(-MAX_ERROR_CHARS)}` : text6;
8001
+ }
8002
+ function stderrTail(lines) {
8003
+ const tail = lines.filter((l) => l.trim() !== "").slice(-10).join("\n");
8004
+ return tail ? `
8005
+ stderr \u672B\u5C3E\uFF1A
8006
+ ${clip(tail)}` : "";
8007
+ }
8008
+ var QUOTA_RE, API_GAVE_UP_RE, FAILED_SENTENCE_RE, LOG_RECORD_RE, SUBAGENT_PREFIX_RE, MAX_ERROR_RECORDS, MAX_ERROR_CHARS, USAGE_KEYS;
7982
8009
  var init_prompt_failure = __esm({
7983
8010
  "../adapters/src/hermes/prompt-failure.ts"() {
7984
8011
  "use strict";
7985
8012
  QUOTA_RE = /\b429\b|rate.?limit|usage limit|quota|too many requests/i;
7986
- MESSAGE_RE = /^\s*API call failed after (\d+) retries: (.+)/;
7987
- STDERR_RE = /(?:^|:\s)API call failed after (\d+) retries\. (.+?)(?:\s\|\sprovider=.*)?$/;
8013
+ API_GAVE_UP_RE = /^(?:Non-retryable client error: |API call failed after \d+ retries\. )/;
8014
+ FAILED_SENTENCE_RE = /^\s*API call failed after \d+ retries: /;
8015
+ LOG_RECORD_RE = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[,.]\d+)?\s+\[([A-Z]+)\]\s+[\w.-]+:\s?(.*)$/;
8016
+ SUBAGENT_PREFIX_RE = /^\[subagent-\d+\]\s/;
8017
+ MAX_ERROR_RECORDS = 5;
8018
+ MAX_ERROR_CHARS = 4e3;
8019
+ USAGE_KEYS = ["usage", "token_usage", "tokenUsage", "tokens", "usageMetadata", "usage_metadata"];
7988
8020
  }
7989
8021
  });
7990
8022
 
@@ -8026,7 +8058,7 @@ var init_hermes = __esm({
8026
8058
  // skills.external_dirs 配成该 env → hermes 每 session 发现各自技能。见
8027
8059
  // packages/adapters/docs/modules/07-skills-delivery.md 与 connect-script.ts。
8028
8060
  injectSkillsDirEnv: "OASIS_HERMES_SKILLS_DIR",
8029
- // 重试用尽时 hermes 照样回 end_turn,只发一句「API call failed after N retries」——见 prompt-failure.ts。
8061
+ // hermes 的 ACP 层不转发失败:API 没成功照样回 end_turn,原因只在 stderr 的 ERROR 日志里——见 prompt-failure.ts。
8030
8062
  classifyPromptFailure: classifyHermesPromptFailure,
8031
8063
  ...this.opts.syncSkills ? { syncSkills: this.opts.syncSkills } : {}
8032
8064
  });
@@ -8662,17 +8694,17 @@ async function runStreamJson(job, cfg) {
8662
8694
  );
8663
8695
  let killReason = null;
8664
8696
  let seq = 0;
8665
- const stderrTail = [];
8697
+ const stderrTail2 = [];
8666
8698
  const stderrRl = readline4.createInterface({ input: child.stderr });
8667
8699
  stderrRl.on("line", (line) => {
8668
8700
  try {
8669
8701
  transcriptOut.write(line + "\n");
8670
8702
  } catch {
8671
8703
  }
8672
- stderrTail.push(line);
8673
- while (stderrTail.length > 40) stderrTail.shift();
8674
- let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
8675
- while (total > 4e3 && stderrTail.length > 1) total -= stderrTail.shift().length + 1;
8704
+ stderrTail2.push(line);
8705
+ while (stderrTail2.length > 40) stderrTail2.shift();
8706
+ let total = stderrTail2.reduce((n, l) => n + l.length + 1, 0);
8707
+ while (total > 4e3 && stderrTail2.length > 1) total -= stderrTail2.shift().length + 1;
8676
8708
  });
8677
8709
  const rl = readline4.createInterface({ input: child.stdout });
8678
8710
  rl.on("line", (line) => {
@@ -8698,7 +8730,7 @@ async function runStreamJson(job, cfg) {
8698
8730
  child.on("exit", (code2) => {
8699
8731
  clearTimeout(timer);
8700
8732
  const isError = !killReason && typeof code2 === "number" && code2 !== 0;
8701
- const errorMessage = isError ? stderrTail.join("\n").trim().slice(-4e3) || void 0 : void 0;
8733
+ const errorMessage = isError ? stderrTail2.join("\n").trim().slice(-4e3) || void 0 : void 0;
8702
8734
  finish({
8703
8735
  code: killReason ? null : code2,
8704
8736
  reason: killReason ?? (code2 === 0 ? "clean" : "error"),
@@ -8774,17 +8806,17 @@ async function runOneShotText(job, cfg) {
8774
8806
  const text6 = chunk.toString("utf8");
8775
8807
  for (const cb of outputCbs) cb(text6);
8776
8808
  });
8777
- const stderrTail = [];
8809
+ const stderrTail2 = [];
8778
8810
  const stderrRl = readline4.createInterface({ input: child.stderr });
8779
8811
  stderrRl.on("line", (line) => {
8780
8812
  try {
8781
8813
  transcriptOut.write(line + "\n");
8782
8814
  } catch {
8783
8815
  }
8784
- stderrTail.push(line);
8785
- while (stderrTail.length > 40) stderrTail.shift();
8786
- let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
8787
- while (total > 4e3 && stderrTail.length > 1) total -= stderrTail.shift().length + 1;
8816
+ stderrTail2.push(line);
8817
+ while (stderrTail2.length > 40) stderrTail2.shift();
8818
+ let total = stderrTail2.reduce((n, l) => n + l.length + 1, 0);
8819
+ while (total > 4e3 && stderrTail2.length > 1) total -= stderrTail2.shift().length + 1;
8788
8820
  });
8789
8821
  const killChild = () => {
8790
8822
  if (containerized) killContainerBestEffort(containerized.containerName, containerized.mode);
@@ -8801,7 +8833,7 @@ async function runOneShotText(job, cfg) {
8801
8833
  child.on("exit", (code2) => {
8802
8834
  clearTimeout(timer);
8803
8835
  const isError = !killReason && typeof code2 === "number" && code2 !== 0;
8804
- const errorMessage = isError ? stderrTail.join("\n").trim().slice(-4e3) || void 0 : void 0;
8836
+ const errorMessage = isError ? stderrTail2.join("\n").trim().slice(-4e3) || void 0 : void 0;
8805
8837
  finish({
8806
8838
  code: killReason ? null : code2,
8807
8839
  reason: killReason ?? (code2 === 0 ? "clean" : "error"),
@@ -187843,22 +187875,22 @@ var init_network_maintenance = __esm({
187843
187875
  });
187844
187876
  if (!saved.committed) throw new KnowledgeMaintenanceProcessingError(`\u77E5\u8BC6\u7F51\u7EDC\u4EFB\u52A1 ${taskKey} \u7ED3\u679C\u68C0\u67E5\u70B9\u63D0\u4EA4\u51B2\u7A81`, true);
187845
187877
  },
187846
- onTaskFailed: async (taskKey, failure) => {
187878
+ onTaskFailed: async (taskKey, failure2) => {
187847
187879
  const current = (await store.list(scope2, "maintenance_task")).find((task) => task.maintenanceRunId === run.id && task.taskKey === taskKey);
187848
187880
  if (!current || current.status === "succeeded") return;
187849
- const retryable = failure.kind === "runtime" && isRetryableKnowledgeMaintenanceError(failure.cause ?? new Error(failure.message));
187881
+ const retryable = failure2.kind === "runtime" && isRetryableKnowledgeMaintenanceError(failure2.cause ?? new Error(failure2.message));
187850
187882
  const now = this.iso();
187851
- const output = failure.rawOutput ? this.snapshot(ctx, "maintenance_task_output", stableJson2(failure.rawOutput), projectId2, run.spaceId, `snapshot:maintenance-task-output:${run.id}:${taskKey}:${current.retryCount}`) : void 0;
187883
+ const output = failure2.rawOutput ? this.snapshot(ctx, "maintenance_task_output", stableJson2(failure2.rawOutput), projectId2, run.spaceId, `snapshot:maintenance-task-output:${run.id}:${taskKey}:${current.retryCount}`) : void 0;
187852
187884
  const failed = {
187853
187885
  ...current,
187854
- ...failure.sessionId ? { sessionId: failure.sessionId } : {},
187886
+ ...failure2.sessionId ? { sessionId: failure2.sessionId } : {},
187855
187887
  status: retryable ? "failed_transient" : "failed_deterministic",
187856
187888
  ...output ? { outputSnapshotRef: output.ref, outputHash: output.contentHash } : {},
187857
187889
  validationStatus: "failed",
187858
- ...failure.validationError ? { validationError: failure.validationError } : {},
187859
- error: failure.message.slice(0, 2e3),
187890
+ ...failure2.validationError ? { validationError: failure2.validationError } : {},
187891
+ error: failure2.message.slice(0, 2e3),
187860
187892
  completedAt: now,
187861
- ...failure.kind === "deterministic" ? { validatedAt: now } : {},
187893
+ ...failure2.kind === "deterministic" ? { validatedAt: now } : {},
187862
187894
  updatedAt: now
187863
187895
  };
187864
187896
  const saved = await store.transact(scope2, {
@@ -188039,9 +188071,9 @@ var init_network_maintenance = __esm({
188039
188071
  if (!result.committed) throw new Error("\u7EF4\u62A4\u5206\u6790\u7ED3\u679C\u63D0\u4EA4\u51B2\u7A81");
188040
188072
  return ready;
188041
188073
  } catch (error2) {
188042
- const failure = maintenanceFailure(error2);
188074
+ const failure2 = maintenanceFailure(error2);
188043
188075
  const latestTasks = (await store.list(scope2, "maintenance_task")).filter((task) => task.maintenanceRunId === run.id);
188044
- const validationIssue = failure.retryable ? void 0 : validationIssueForFailure(error2, latestTasks);
188076
+ const validationIssue = failure2.retryable ? void 0 : validationIssueForFailure(error2, latestTasks);
188045
188077
  const repairTaskKeys = new Set(validationIssue?.taskKeys ?? []);
188046
188078
  const now = this.iso();
188047
188079
  const invalidatedTasks = latestTasks.flatMap((task) => {
@@ -188059,8 +188091,8 @@ var init_network_maintenance = __esm({
188059
188091
  const failed = {
188060
188092
  ...processing,
188061
188093
  status: "failed",
188062
- errorCode: failure.retryable ? "ANALYSIS_TRANSIENT_FAILED" : "ANALYSIS_OR_VALIDATION_FAILED",
188063
- error: failure.message.slice(0, 2e3),
188094
+ errorCode: failure2.retryable ? "ANALYSIS_TRANSIENT_FAILED" : "ANALYSIS_OR_VALIDATION_FAILED",
188095
+ error: failure2.message.slice(0, 2e3),
188064
188096
  ...validationIssue ? { validationIssues: [validationIssue] } : { validationIssues: void 0 },
188065
188097
  retryCount: processing.retryCount + 1,
188066
188098
  updatedAt: now
@@ -188077,7 +188109,7 @@ var init_network_maintenance = __esm({
188077
188109
  const latest = await store.get(scope2, "maintenance_run", run.id);
188078
188110
  if (latest && ["awaiting_review", "approved", "publishing", "active"].includes(latest.status)) return latest;
188079
188111
  }
188080
- throw failure;
188112
+ throw failure2;
188081
188113
  }
188082
188114
  }
188083
188115
  async validateAndMaterializeAnalysis(ctx, store, scope2, run, input, analysis, options = {}) {
@@ -188876,10 +188908,10 @@ var init_network_maintenance = __esm({
188876
188908
  run = activationRun;
188877
188909
  return await this.activateGeneration(ctx, store, scope2, run, generation, space, connection);
188878
188910
  } catch (error2) {
188879
- const failure = maintenanceFailure(error2);
188880
- const message = failure.message.slice(0, 2e3);
188911
+ const failure2 = maintenanceFailure(error2);
188912
+ const message = failure2.message.slice(0, 2e3);
188881
188913
  const activation = Boolean(run.stagedAt || run.activationStartedAt);
188882
- const errorCode = activation ? failure.retryable ? "GENERATION_ACTIVATION_TRANSIENT_FAILED" : "GENERATION_ACTIVATION_FAILED" : failure.retryable ? "GENERATION_TRANSIENT_FAILED" : "GENERATION_STAGE_FAILED";
188914
+ const errorCode = activation ? failure2.retryable ? "GENERATION_ACTIVATION_TRANSIENT_FAILED" : "GENERATION_ACTIVATION_FAILED" : failure2.retryable ? "GENERATION_TRANSIENT_FAILED" : "GENERATION_STAGE_FAILED";
188883
188915
  const failedRun = { ...run, status: "failed", errorCode, error: message, retryCount: run.retryCount + 1, updatedAt: this.iso() };
188884
188916
  const failedGeneration = { ...generation, status: "failed", failureCode: errorCode, error: message, updatedAt: this.iso() };
188885
188917
  const saved = await store.transact(scope2, {
@@ -188894,7 +188926,7 @@ var init_network_maintenance = __esm({
188894
188926
  const latest = await store.get(scope2, "maintenance_run", run.id);
188895
188927
  if (latest?.status === "active") return latest;
188896
188928
  }
188897
- throw failure;
188929
+ throw failure2;
188898
188930
  }
188899
188931
  }
188900
188932
  async activateGeneration(ctx, store, scope2, run, generation, space, connection) {
@@ -197921,7 +197953,7 @@ var init_knowledge2 = __esm({
197921
197953
  });
197922
197954
 
197923
197955
  // ../server/src/domains/delegations/parent-conversation.ts
197924
- function firstLine(content3) {
197956
+ function firstLine2(content3) {
197925
197957
  const line = content3.split("\n").map((s2) => s2.trim()).find((s2) => s2.length > 0);
197926
197958
  if (!line) return null;
197927
197959
  return line.length > FIRST_LINE_MAX ? `${line.slice(0, FIRST_LINE_MAX)}\u2026` : line;
@@ -197954,7 +197986,7 @@ function buildParentConversationSnapshot(messages, opts) {
197954
197986
  lines.push(`## \u66F4\u65E9\u7684 ${olderCount} \u8F6E\uFF08\u6BCF\u6761\u53EA\u7559\u9996\u884C\uFF09`, "");
197955
197987
  for (let i = 0; i < fullFrom; i++) {
197956
197988
  for (const m2 of turns[i]) {
197957
- const head = firstLine(m2.content);
197989
+ const head = firstLine2(m2.content);
197958
197990
  if (head) lines.push(`- **${ROLE_LABEL[m2.role]}**\uFF1A${head}`);
197959
197991
  }
197960
197992
  }
@@ -198300,8 +198332,8 @@ function roundRecorded(summaries, dispatchSeq) {
198300
198332
  return summaries.some((s2) => s2.dispatchSeq === void 0 ? s2.round === dispatchSeq + 1 : s2.dispatchSeq === dispatchSeq);
198301
198333
  }
198302
198334
  function taskHeadline(task) {
198303
- const firstLine2 = task.split("\n").map((s2) => s2.trim()).find((s2) => s2.length > 0) ?? "";
198304
- const sentence = firstLine2.split(/[。!?.!?]/)[0]?.trim() || firstLine2;
198335
+ const firstLine3 = task.split("\n").map((s2) => s2.trim()).find((s2) => s2.length > 0) ?? "";
198336
+ const sentence = firstLine3.split(/[。!?.!?]/)[0]?.trim() || firstLine3;
198305
198337
  return sentence.length > TITLE_TASK_CHARS ? sentence.slice(0, TITLE_TASK_CHARS) : sentence;
198306
198338
  }
198307
198339
  function actorSlug(actorId) {
@@ -224294,7 +224326,7 @@ var init_list_usage = __esm({
224294
224326
  });
224295
224327
 
224296
224328
  // ../server/src/domains/actors/activity.ts
224297
- function clip(text6) {
224329
+ function clip2(text6) {
224298
224330
  const s2 = typeof text6 === "string" ? text6.trim() : "";
224299
224331
  return s2.length > CLIP ? `${s2.slice(0, CLIP)}\u2026` : s2;
224300
224332
  }
@@ -224317,9 +224349,9 @@ function eventSummary(ev) {
224317
224349
  return { summary: `\u6539\u56FE${parts.length ? `\uFF1A${parts.join("\u3001")}` : ""}`, detail: p2.addNodes?.[0]?.title };
224318
224350
  }
224319
224351
  case "plan.update_spec":
224320
- return { summary: `\u6539\u4EFB\u52A1\u89C4\u683C${p2.title ? `\uFF1A${clip(p2.title)}` : ""}` };
224352
+ return { summary: `\u6539\u4EFB\u52A1\u89C4\u683C${p2.title ? `\uFF1A${clip2(p2.title)}` : ""}` };
224321
224353
  case "plan.add_node":
224322
- return { summary: `\u65B0\u5EFA\u8282\u70B9${p2.title ? `\uFF1A${clip(p2.title)}` : ""}` };
224354
+ return { summary: `\u65B0\u5EFA\u8282\u70B9${p2.title ? `\uFF1A${clip2(p2.title)}` : ""}` };
224323
224355
  case "plan.delete_node":
224324
224356
  return { summary: "\u5220\u9664\u8282\u70B9" };
224325
224357
  case "plan.add_edge":
@@ -224337,7 +224369,7 @@ function eventSummary(ev) {
224337
224369
  case "work.create":
224338
224370
  return { summary: "\u6D3E\u6D3B" };
224339
224371
  case "work.kill":
224340
- return { summary: `\u505C\u6D3E${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}` };
224372
+ return { summary: `\u505C\u6D3E${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}` };
224341
224373
  case "work.response":
224342
224374
  return { summary: p2.outcome === "failed" ? "\u4EA4\u7A3F\uFF08\u5931\u8D25\uFF09" : "\u4EA4\u7A3F" };
224343
224375
  case "work.timeout":
@@ -224349,41 +224381,41 @@ function eventSummary(ev) {
224349
224381
  case "review.create":
224350
224382
  return { summary: "\u5F00\u8BC4\u5BA1" };
224351
224383
  case "review.response":
224352
- return { summary: p2.verdict === "approve" ? "\u8BC4\u5BA1\u901A\u8FC7" : `\u8BC4\u5BA1\u6253\u56DE${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224384
+ return { summary: p2.verdict === "approve" ? "\u8BC4\u5BA1\u901A\u8FC7" : `\u8BC4\u5BA1\u6253\u56DE${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224353
224385
  case "review.kill":
224354
- return { summary: `\u505C\u8BC4\u5BA1${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}` };
224386
+ return { summary: `\u505C\u8BC4\u5BA1${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}` };
224355
224387
  case "review.timeout":
224356
224388
  return { summary: "\u8BC4\u5BA1\u8D85\u65F6" };
224357
224389
  case "issue.create": {
224358
224390
  switch (p2.issueKind) {
224359
224391
  case "gap":
224360
- return { summary: `\u62A5\u544A gap\uFF1A${clip(p2.body) || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}`, detail: ev.issueId ? `issueId=${ev.issueId}` : void 0 };
224392
+ return { summary: `\u62A5\u544A gap\uFF1A${clip2(p2.body) || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}`, detail: ev.issueId ? `issueId=${ev.issueId}` : void 0 };
224361
224393
  case "escalation":
224362
- return { summary: `\u4E0A\u62A5\u9700\u4EBA\u4ECB\u5165\uFF1A${clip(p2.body) || "\uFF08\u65E0\u539F\u56E0\uFF09"}` };
224394
+ return { summary: `\u4E0A\u62A5\u9700\u4EBA\u4ECB\u5165\uFF1A${clip2(p2.body) || "\uFF08\u65E0\u539F\u56E0\uFF09"}` };
224363
224395
  case "change_request":
224364
- return { summary: `\u53D8\u66F4\u8BF7\u6C42\uFF1A${clip(p2.body) || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}` };
224396
+ return { summary: `\u53D8\u66F4\u8BF7\u6C42\uFF1A${clip2(p2.body) || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}` };
224365
224397
  default:
224366
- return { summary: `\u6279\u6CE8\uFF1A${clip(p2.body) || "\uFF08\u7A7A\uFF09"}` };
224398
+ return { summary: `\u6279\u6CE8\uFF1A${clip2(p2.body) || "\uFF08\u7A7A\uFF09"}` };
224367
224399
  }
224368
224400
  }
224369
224401
  case "issue.reply":
224370
- return { summary: `\u56DE\u590D\u6279\u6CE8\uFF1A${clip(p2.body) || "\uFF08\u7A7A\uFF09"}` };
224402
+ return { summary: `\u56DE\u590D\u6279\u6CE8\uFF1A${clip2(p2.body) || "\uFF08\u7A7A\uFF09"}` };
224371
224403
  case "issue.resolve":
224372
- return { summary: `${p2.state === "resolved" ? "\u89E3\u9664" : "\u5173\u95ED"}${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224404
+ return { summary: `${p2.state === "resolved" ? "\u89E3\u9664" : "\u5173\u95ED"}${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224373
224405
  case "issue.resolution_proposed":
224374
- return { summary: `\u63D0\u51FA\u5904\u7F6E\u65B9\u6848\uFF1A${clip(p2.proposal) || "\uFF08\u65E0\uFF09"}` };
224406
+ return { summary: `\u63D0\u51FA\u5904\u7F6E\u65B9\u6848\uFF1A${clip2(p2.proposal) || "\uFF08\u65E0\uFF09"}` };
224375
224407
  case "issue.resolution_rejected":
224376
224408
  return { summary: "\u9A73\u56DE\u5904\u7F6E\u65B9\u6848" };
224377
224409
  case "workorder.created":
224378
- return { summary: `\u5EFA\u5DE5\u5355${p2.title ? `\uFF1A${clip(p2.title)}` : ""}` };
224410
+ return { summary: `\u5EFA\u5DE5\u5355${p2.title ? `\uFF1A${clip2(p2.title)}` : ""}` };
224379
224411
  case "workorder.meta_changed":
224380
224412
  return { summary: "\u4FEE\u6539\u5DE5\u5355\u4FE1\u606F" };
224381
224413
  case "workorder.root_set":
224382
224414
  return { summary: "\u8BBE\u5B9A\u6839\u8282\u70B9" };
224383
224415
  case "workorder.sealed":
224384
- return { summary: `\u5C01\u5B58${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224416
+ return { summary: `\u5C01\u5B58${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224385
224417
  case "workorder.paused":
224386
- return { summary: `\u6682\u505C\u6D3E\u53D1${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}` };
224418
+ return { summary: `\u6682\u505C\u6D3E\u53D1${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}` };
224387
224419
  case "workorder.resumed":
224388
224420
  return { summary: "\u6062\u590D\u6D3E\u53D1" };
224389
224421
  case "work.started":
@@ -224411,27 +224443,27 @@ function summarize3(kind, payload2) {
224411
224443
  switch (kind) {
224412
224444
  case "report_gap":
224413
224445
  return {
224414
- summary: `\u62A5\u544A gap\uFF1A${clip(p2.description) || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}`,
224446
+ summary: `\u62A5\u544A gap\uFF1A${clip2(p2.description) || "\uFF08\u65E0\u63CF\u8FF0\uFF09"}`,
224415
224447
  ...p2.gapId ? { detail: `gapId=${p2.gapId}${p2.part ? `\uFF0Cpart=${p2.part}` : ""}` } : {}
224416
224448
  };
224417
224449
  case "resolve_gap":
224418
- return { summary: `\u89E3\u9664 gap\uFF1A${clip(p2.note) || "\uFF08\u65E0\u8BF4\u660E\uFF09"}`, ...p2.gapId ? { detail: `gapId=${p2.gapId}` } : {} };
224450
+ return { summary: `\u89E3\u9664 gap\uFF1A${clip2(p2.note) || "\uFF08\u65E0\u8BF4\u660E\uFF09"}`, ...p2.gapId ? { detail: `gapId=${p2.gapId}` } : {} };
224419
224451
  case "escalate":
224420
- return { summary: `\u4E0A\u62A5\u9700\u4EBA\u4ECB\u5165\uFF1A${clip(p2.reason) || "\uFF08\u65E0\u539F\u56E0\uFF09"}` };
224452
+ return { summary: `\u4E0A\u62A5\u9700\u4EBA\u4ECB\u5165\uFF1A${clip2(p2.reason) || "\uFF08\u65E0\u539F\u56E0\uFF09"}` };
224421
224453
  case "resolve_escalation":
224422
- return { summary: `\u5173\u95ED\u4E0A\u62A5${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224454
+ return { summary: `\u5173\u95ED\u4E0A\u62A5${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224423
224455
  case "submit_review":
224424
- return { summary: `${p2.verdict === "approve" ? "\u8BC4\u5BA1\u901A\u8FC7" : "\u8BC4\u5BA1\u6253\u56DE"}${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224456
+ return { summary: `${p2.verdict === "approve" ? "\u8BC4\u5BA1\u901A\u8FC7" : "\u8BC4\u5BA1\u6253\u56DE"}${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224425
224457
  case "propose_revision":
224426
- return { summary: `\u63D0\u4EA4\u7248\u672C\uFF1A${clip(p2.reason) || "\uFF08\u65E0\u8BF4\u660E\uFF09"}` };
224458
+ return { summary: `\u63D0\u4EA4\u7248\u672C\uFF1A${clip2(p2.reason) || "\uFF08\u65E0\u8BF4\u660E\uFF09"}` };
224427
224459
  case "merge":
224428
224460
  return { summary: "\u5408\u5E76\u7248\u672C\u4E3A\u5F53\u524D" };
224429
224461
  case "conclude":
224430
- return { summary: `\u6536\u5C3E\uFF08\u91CC\u7A0B\u7891\uFF09${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224462
+ return { summary: `\u6536\u5C3E\uFF08\u91CC\u7A0B\u7891\uFF09${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224431
224463
  case "seal":
224432
- return { summary: `\u5C01\u5B58${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}${p2.note ? `\uFF1A${clip(p2.note)}` : ""}` };
224464
+ return { summary: `\u5C01\u5B58${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}${p2.note ? `\uFF1A${clip2(p2.note)}` : ""}` };
224433
224465
  case "annotate":
224434
- return { summary: `${p2.blocks ? "\u6253\u56DE\u6279\u6CE8\uFF08\u963B\u585E\uFF09" : "\u6279\u6CE8"}\uFF1A${clip(p2.body) || "\uFF08\u7A7A\uFF09"}` };
224466
+ return { summary: `${p2.blocks ? "\u6253\u56DE\u6279\u6CE8\uFF08\u963B\u585E\uFF09" : "\u6279\u6CE8"}\uFF1A${clip2(p2.body) || "\uFF08\u7A7A\uFF09"}` };
224435
224467
  case "resolve_annotation":
224436
224468
  return { summary: "\u89E3\u9664\u6279\u6CE8" };
224437
224469
  case "spawn_artifact":
@@ -224441,9 +224473,9 @@ function summarize3(kind, payload2) {
224441
224473
  case "assign_owner":
224442
224474
  return { summary: "\u53D8\u66F4\u8282\u70B9 owner" };
224443
224475
  case "propose_intervention":
224444
- return { summary: `\u8D77\u8349\u6539\u56FE\u63D0\u6848${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}` };
224476
+ return { summary: `\u8D77\u8349\u6539\u56FE\u63D0\u6848${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}` };
224445
224477
  case "reject_intervention":
224446
- return { summary: `\u9A73\u56DE\u6539\u56FE\u63D0\u6848${p2.reason ? `\uFF1A${clip(p2.reason)}` : ""}` };
224478
+ return { summary: `\u9A73\u56DE\u6539\u56FE\u63D0\u6848${p2.reason ? `\uFF1A${clip2(p2.reason)}` : ""}` };
224447
224479
  default:
224448
224480
  return { summary: kind };
224449
224481
  }
@@ -229487,8 +229519,8 @@ async function buildChatPreview(chatStore, sessionId, who) {
229487
229519
  const lastUser = [...msgs].reverse().find((m2) => m2.role === "user" && m2.content.trim().length > 0);
229488
229520
  const lastAsst = [...msgs].reverse().find((m2) => m2.role === "assistant" && m2.content.trim().length > 0);
229489
229521
  const lines = [];
229490
- if (lastUser) lines.push({ label: "\u4F60", text: clip2(lastUser.content) });
229491
- if (lastAsst) lines.push({ label: who, text: clip2(lastAsst.content) });
229522
+ if (lastUser) lines.push({ label: "\u4F60", text: clip3(lastUser.content) });
229523
+ if (lastAsst) lines.push({ label: who, text: clip3(lastAsst.content) });
229492
229524
  return lines.length ? { lines } : void 0;
229493
229525
  }
229494
229526
  async function buildChatInbox(chatStore, markers, me, resolveActor, excludeChildSessions) {
@@ -229522,14 +229554,14 @@ async function buildChatInbox(chatStore, markers, me, resolveActor, excludeChild
229522
229554
  }
229523
229555
  return out;
229524
229556
  }
229525
- var PREVIEW_MAX_CHARS, PREVIEW_FETCH_CAP, clip2;
229557
+ var PREVIEW_MAX_CHARS, PREVIEW_FETCH_CAP, clip3;
229526
229558
  var init_inbox_chat = __esm({
229527
229559
  "../server/src/domains/collab/inbox-chat.ts"() {
229528
229560
  "use strict";
229529
229561
  init_src();
229530
229562
  PREVIEW_MAX_CHARS = 200;
229531
229563
  PREVIEW_FETCH_CAP = 25;
229532
- clip2 = (s2) => {
229564
+ clip3 = (s2) => {
229533
229565
  const t = (s2 ?? "").trim();
229534
229566
  return t.length > PREVIEW_MAX_CHARS ? `${t.slice(0, PREVIEW_MAX_CHARS)}\u2026` : t;
229535
229567
  };
@@ -264268,7 +264300,9 @@ function buildChatExitError(info) {
264268
264300
  if (!detail && info.transcriptRef) detail = transcriptTail(info.transcriptRef);
264269
264301
  }
264270
264302
  const firstDetailLine = detail.split("\n").map((line) => line.trim()).find(Boolean) ?? "";
264271
- const summary = (info.reason ? SUMMARY_BY_REASON[info.reason] : void 0) ?? (firstDetailLine ? `\u5BF9\u8BDD\u5931\u8D25\uFF1A${firstDetailLine.slice(0, 200)}` : `\u5BF9\u8BDD\u5931\u8D25\uFF08${genericLine}\uFF09`);
264303
+ const firstErrorLine = info.errorMessage?.split("\n").map((line) => line.trim()).find(Boolean) ?? "";
264304
+ const fixed = info.reason ? SUMMARY_BY_REASON[info.reason] : void 0;
264305
+ const summary = fixed ? firstErrorLine && info.reason !== "cancelled" && info.reason !== "timeout" ? `${fixed}\uFF1A${firstErrorLine.slice(0, 200)}` : fixed : firstDetailLine ? `\u5BF9\u8BDD\u5931\u8D25\uFF1A${firstDetailLine.slice(0, 200)}` : `\u5BF9\u8BDD\u5931\u8D25\uFF08${genericLine}\uFF09`;
264272
264306
  const chatExit = {
264273
264307
  ...info.reason ? { reason: info.reason } : {},
264274
264308
  summary,
@@ -274822,9 +274856,9 @@ var GROUP_ORDER = [
274822
274856
  "\u5B58\u91CF\u7BA1\u7406"
274823
274857
  ];
274824
274858
  function indexSummary(description) {
274825
- const firstLine2 = description.split("\n")[0] ?? "";
274826
- const dot = firstLine2.indexOf("\u3002");
274827
- const head = dot >= 0 ? firstLine2.slice(0, dot + 1) : firstLine2;
274859
+ const firstLine3 = description.split("\n")[0] ?? "";
274860
+ const dot = firstLine3.indexOf("\u3002");
274861
+ const head = dot >= 0 ? firstLine3.slice(0, dot + 1) : firstLine3;
274828
274862
  return head.replace(/\*\*/g, "").trim();
274829
274863
  }
274830
274864
  function buildCommandIndex() {
@@ -278701,7 +278735,7 @@ function shimScript() {
278701
278735
  }
278702
278736
 
278703
278737
  // src/index.ts
278704
- var PKG_VERSION = true ? "2.2.43" : "dev";
278738
+ var PKG_VERSION = true ? "2.2.44" : "dev";
278705
278739
  var LOCAL_BIN = localBin();
278706
278740
  var NPM_PREFIX = npmPrefix();
278707
278741
  var INSTANCE = DEFAULT_INSTANCE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test_v2",
3
- "version": "2.2.43",
3
+ "version": "2.2.44",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"
@@ -26,6 +26,6 @@
26
26
  "node": ">=20"
27
27
  },
28
28
  "oasisRelease": {
29
- "sourceHead": "34968cfc5b0889a75157d9e05acecc3540285932"
29
+ "sourceHead": "91d9408678684a3e8cb17fdae1fdc0b7772cdcb4"
30
30
  }
31
31
  }