toc-ocra 0.3.19 → 0.3.21

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.
package/dist/cli/cli.mjs CHANGED
@@ -4579,7 +4579,7 @@ import { createHash as createHash5 } from "node:crypto";
4579
4579
  import { existsSync as existsSync8, mkdtempSync, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
4580
4580
  import { tmpdir as tmpdir4 } from "node:os";
4581
4581
  import { createRequire } from "node:module";
4582
- import { dirname as dirname11, join as join24, resolve as resolve9 } from "node:path";
4582
+ import { dirname as dirname11, join as join25, resolve as resolve9 } from "node:path";
4583
4583
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
4584
4584
 
4585
4585
  // src/config.ts
@@ -25535,7 +25535,7 @@ function codexCatalogArgs() {
25535
25535
 
25536
25536
  // src/providers/model-catalog.ts
25537
25537
  import { spawn as spawn5 } from "node:child_process";
25538
- import { readFile as readFile3 } from "node:fs/promises";
25538
+ import { readdir, readFile as readFile3 } from "node:fs/promises";
25539
25539
  import { homedir as homedir7 } from "node:os";
25540
25540
  import { isAbsolute as isAbsolute2, join as join10, resolve as resolve3 } from "node:path";
25541
25541
 
@@ -25668,9 +25668,40 @@ var CLAUDE_REASONING_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
25668
25668
  var CLAUDE_BUILTIN_MODELS = [
25669
25669
  { id: "opus", name: "Opus" },
25670
25670
  { id: "sonnet", name: "Sonnet" },
25671
- { id: "haiku", name: "Haiku" }
25671
+ { id: "haiku", name: "Haiku" },
25672
+ { id: "fable", name: "Fable" }
25672
25673
  ];
25673
- function parseClaudeModelCatalog(settings, environment = process.env, fetchedAt = (/* @__PURE__ */ new Date()).toISOString()) {
25674
+ function parseClaudeCachedModels(cache) {
25675
+ const listed = objectValue(objectValue(objectValue(cache).catalog).config).models;
25676
+ if (!Array.isArray(listed)) return [];
25677
+ const entries = [];
25678
+ const seen = /* @__PURE__ */ new Set();
25679
+ for (const raw of listed) {
25680
+ const model = objectValue(raw);
25681
+ const id = stringValue(model.id);
25682
+ if (!id || model.disabled === true || seen.has(id)) continue;
25683
+ seen.add(id);
25684
+ const runtime = objectValue(model.runtime);
25685
+ const efforts = Array.isArray(runtime.effort_levels) ? runtime.effort_levels.filter((value) => typeof value === "string" && value.trim() !== "") : [];
25686
+ const name = stringValue(model.name);
25687
+ const description = stringValue(model.description);
25688
+ const defaultEffort = stringValue(runtime.default_effort);
25689
+ const section = stringValue(model.section);
25690
+ entries.push({
25691
+ ...section && { section },
25692
+ entry: {
25693
+ id,
25694
+ name: name ?? id,
25695
+ ...description && { description },
25696
+ ...defaultEffort && efforts.includes(defaultEffort) && { default_reasoning_effort: defaultEffort },
25697
+ supported_reasoning_efforts: efforts
25698
+ }
25699
+ });
25700
+ }
25701
+ const main2 = entries.filter((item) => item.section === "main");
25702
+ return (main2.length ? main2 : entries).map((item) => item.entry);
25703
+ }
25704
+ function parseClaudeModelCatalog(settings, environment = process.env, fetchedAt = (/* @__PURE__ */ new Date()).toISOString(), cachedModels = []) {
25674
25705
  const source = objectValue(settings);
25675
25706
  const mergedEnv = { ...objectValue(source.env), ...environment };
25676
25707
  const models2 = /* @__PURE__ */ new Map();
@@ -25694,8 +25725,18 @@ function parseClaudeModelCatalog(settings, environment = process.env, fetchedAt
25694
25725
  }
25695
25726
  const defaultModel = stringValue(mergedEnv.ANTHROPIC_MODEL) ?? stringValue(source.model);
25696
25727
  if (models2.size === 0) {
25697
- if (defaultModel) addModel(defaultModel);
25698
- for (const model of CLAUDE_BUILTIN_MODELS) addModel(model.id, model.name);
25728
+ if (cachedModels.length) {
25729
+ for (const model of cachedModels) if (!models2.has(model.id)) models2.set(model.id, model);
25730
+ if (defaultModel && !models2.has(defaultModel)) {
25731
+ const rest = [...models2.values()];
25732
+ models2.clear();
25733
+ addModel(defaultModel);
25734
+ for (const model of rest) models2.set(model.id, model);
25735
+ }
25736
+ } else {
25737
+ if (defaultModel) addModel(defaultModel);
25738
+ for (const model of CLAUDE_BUILTIN_MODELS) addModel(model.id, model.name);
25739
+ }
25699
25740
  }
25700
25741
  return {
25701
25742
  agent_type: "claude",
@@ -25721,7 +25762,23 @@ async function readClaudeModelCatalog() {
25721
25762
  throw new Error("Claude \u672C\u673A settings.json \u4E0D\u662F\u6709\u6548 JSON");
25722
25763
  }
25723
25764
  }
25724
- return parseClaudeModelCatalog(settings);
25765
+ return parseClaudeModelCatalog(settings, process.env, (/* @__PURE__ */ new Date()).toISOString(), await readClaudeCachedModels(home));
25766
+ }
25767
+ async function readClaudeCachedModels(home) {
25768
+ const dir = join10(home, "cache", "model-catalog");
25769
+ const names = await readdir(dir).catch(() => []);
25770
+ let newest;
25771
+ for (const name of names) {
25772
+ if (!name.endsWith(".json")) continue;
25773
+ try {
25774
+ const cache = JSON.parse(await readFile3(join10(dir, name), "utf8"));
25775
+ const models2 = parseClaudeCachedModels(cache);
25776
+ const fetchedAt = Number(objectValue(cache).fetchedAt) || 0;
25777
+ if (models2.length && (!newest || fetchedAt > newest.fetchedAt)) newest = { fetchedAt, models: models2 };
25778
+ } catch {
25779
+ }
25780
+ }
25781
+ return newest?.models ?? [];
25725
25782
  }
25726
25783
  function configValue(content, key) {
25727
25784
  const match = content.match(new RegExp(`^\\s*${key}\\s*=\\s*["']([^"']+)["']\\s*(?:#.*)?$`, "m"));
@@ -26028,7 +26085,7 @@ async function readOpencodeModelCatalog() {
26028
26085
  }
26029
26086
  var TEN_MINUTES = 10 * 60 * 1e3;
26030
26087
  var MODEL_SOURCES = {
26031
- claude: { read: readClaudeModelCatalog, watchFiles: () => [join10(claudeHome(), "settings.json")] },
26088
+ claude: { read: readClaudeModelCatalog, watchFiles: () => [join10(claudeHome(), "settings.json"), join10(claudeHome(), "cache", "model-catalog")] },
26032
26089
  codex: {
26033
26090
  read: readCodexModelCatalog,
26034
26091
  watchFiles: () => {
@@ -26053,7 +26110,11 @@ var GEMINI_FAILURE_RULES = [
26053
26110
  { kind: "sessionMissing", pattern: /session[^\n]{0,60}(?:not found|does not exist)|no session found|invalid session/i },
26054
26111
  { kind: "notSignedIn", pattern: /api key is missing|not configured|login required|please (?:log|sign) ?in/i }
26055
26112
  ];
26056
- var GEMINI_ACP_DIALECT = { failureRules: GEMINI_FAILURE_RULES };
26113
+ var GEMINI_ACP_DIALECT = {
26114
+ failureRules: GEMINI_FAILURE_RULES,
26115
+ failureKind: ({ code: code2 }) => code2 === 401 ? "notSignedIn" : code2 === 429 ? "rateLimited" : void 0,
26116
+ linksFileMentions: true
26117
+ };
26057
26118
 
26058
26119
  // src/acp/acp-dialects/acp-dialect.ts
26059
26120
  var record2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -26156,7 +26217,7 @@ function classifySpawnError(error62, context) {
26156
26217
  }
26157
26218
 
26158
26219
  // src/providers/cli/kiro-session-log.ts
26159
- import { open as open2, readdir, readFile as readFile4, stat as stat2 } from "node:fs/promises";
26220
+ import { open as open2, readdir as readdir2, readFile as readFile4, stat as stat2 } from "node:fs/promises";
26160
26221
  import { homedir as homedir8 } from "node:os";
26161
26222
  import { join as join11 } from "node:path";
26162
26223
  var SHELL_TOOLS = /* @__PURE__ */ new Set(["shell", "execute_bash", "bash"]);
@@ -26189,7 +26250,7 @@ var KiroSessionLog = class {
26189
26250
  * in the same folder) leave it unknown.
26190
26251
  */
26191
26252
  async findFreshLog() {
26192
- const names = await readdir(this.directory).catch(() => []);
26253
+ const names = await readdir2(this.directory).catch(() => []);
26193
26254
  const found = [];
26194
26255
  for (const name of names) {
26195
26256
  if (!name.endsWith(".json")) continue;
@@ -26711,8 +26772,11 @@ var KIMI_LAUNCH_SPEC = {
26711
26772
  var GEMINI_LAUNCH_SPEC = {
26712
26773
  agent: "gemini",
26713
26774
  headless: "acp",
26714
- // Below full access Gemini asks before editing or running anything.
26715
- args: ({ access, model }) => ["--acp", ...access === "bypassPermissions" ? ["--yolo"] : ["--approval-mode", "default"], ...model ? ["--model", model] : []],
26775
+ // The shared ACP driver enforces each turn's permission level.
26776
+ args: ({ model }) => ["--acp", "--approval-mode", "default", ...model ? ["--model", model] : []],
26777
+ env: { NO_BROWSER: "true" },
26778
+ // Earlier releases can replay session history after `session/load` has answered.
26779
+ minimumVersions: ["0.68.0"],
26716
26780
  launchApplies: { model: true },
26717
26781
  dialect: GEMINI_ACP_DIALECT,
26718
26782
  modelDiscovery: { kind: "reader", source: MODEL_SOURCES.gemini }
@@ -28800,7 +28864,8 @@ function createAcpProvider(row) {
28800
28864
  return { display: [runLog.event(`\u539F\u4F1A\u8BDD ${missing} \u5DF2\u4E0D\u5B58\u5728\uFF0C\u672C\u8F6E\u6539\u4E3A\u5F00\u59CB\u65B0\u4F1A\u8BDD`)] };
28801
28865
  }
28802
28866
  }
28803
- return fail2(text3, code2 === AUTH_REQUIRED ? "notSignedIn" : void 0);
28867
+ const failureKind = code2 === AUTH_REQUIRED ? "notSignedIn" : message.error ? dialect.failureKind?.(message.error) : void 0;
28868
+ return fail2(text3, failureKind);
28804
28869
  };
28805
28870
  const onResponse = (message) => {
28806
28871
  const phase = typeof message.id === "number" ? phases.get(message.id) : void 0;
@@ -28826,7 +28891,7 @@ function createAcpProvider(row) {
28826
28891
  return { display: [runLog.event(`\u65E0\u6CD5\u8BBE\u7F6E${label}\uFF1A${text3.slice(0, 200)}`), ...nextSetting()] };
28827
28892
  }
28828
28893
  default:
28829
- return fail2(text3, message.error.code === AUTH_REQUIRED ? "notSignedIn" : void 0);
28894
+ return fail2(text3, message.error.code === AUTH_REQUIRED ? "notSignedIn" : dialect.failureKind?.(message.error));
28830
28895
  }
28831
28896
  }
28832
28897
  switch (phase) {
@@ -29029,6 +29094,82 @@ var opencodeProvider = {
29029
29094
  }
29030
29095
  };
29031
29096
 
29097
+ // src/providers/claude-quota.ts
29098
+ import { execFile as execFile5 } from "node:child_process";
29099
+ import { readFile as readFile5 } from "node:fs/promises";
29100
+ import { homedir as homedir10 } from "node:os";
29101
+ import { join as join16 } from "node:path";
29102
+ import { promisify as promisify3 } from "node:util";
29103
+ var execFileAsync3 = promisify3(execFile5);
29104
+ var CLAUDE_USAGE_URL = "https://api.anthropic.com/api/oauth/usage";
29105
+ var WINDOWS = [
29106
+ { key: "five_hour", label: "5 \u5C0F\u65F6\u989D\u5EA6", seconds: 5 * 3600 },
29107
+ { key: "seven_day", label: "\u6BCF\u5468\u989D\u5EA6", seconds: 7 * 86400 },
29108
+ { key: "seven_day_opus", label: "Opus \xB7 \u6BCF\u5468\u989D\u5EA6", seconds: 7 * 86400 },
29109
+ { key: "seven_day_sonnet", label: "Sonnet \xB7 \u6BCF\u5468\u989D\u5EA6", seconds: 7 * 86400 }
29110
+ ];
29111
+ function objectValue2(value) {
29112
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
29113
+ }
29114
+ function resetSeconds(value) {
29115
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return Math.floor(value > 1e10 ? value / 1e3 : value);
29116
+ if (typeof value === "string" && value.trim()) {
29117
+ const parsed = Date.parse(value);
29118
+ if (Number.isFinite(parsed)) return Math.floor(parsed / 1e3);
29119
+ }
29120
+ return 0;
29121
+ }
29122
+ function parseClaudeQuota(body) {
29123
+ const source = objectValue2(body);
29124
+ const windows = [];
29125
+ for (const { key, label, seconds } of WINDOWS) {
29126
+ const raw = source[key];
29127
+ if (!raw || typeof raw !== "object") continue;
29128
+ const window = objectValue2(raw);
29129
+ const utilization = Number(window.utilization);
29130
+ windows.push({
29131
+ key: `claude:${key}`,
29132
+ label,
29133
+ resets_at: resetSeconds(window.resets_at),
29134
+ window_seconds: seconds,
29135
+ ...window.utilization !== null && Number.isFinite(utilization) && utilization >= 0 ? { used_percent: Math.min(100, Math.round(utilization * 100) / 100) } : {}
29136
+ });
29137
+ }
29138
+ return windows;
29139
+ }
29140
+ var claudeHome2 = () => process.env.CLAUDE_CONFIG_DIR?.trim() || join16(homedir10(), ".claude");
29141
+ function tokenFrom(content) {
29142
+ try {
29143
+ const token = objectValue2(objectValue2(JSON.parse(content)).claudeAiOauth).accessToken;
29144
+ return typeof token === "string" && token.trim() ? token.trim() : void 0;
29145
+ } catch {
29146
+ return void 0;
29147
+ }
29148
+ }
29149
+ async function readClaudeAccessToken() {
29150
+ const fromEnv = process.env.CLAUDE_CODE_OAUTH_TOKEN?.trim();
29151
+ if (fromEnv) return fromEnv;
29152
+ const fromFile = tokenFrom(await readFile5(join16(claudeHome2(), ".credentials.json"), "utf8").catch(() => ""));
29153
+ if (fromFile) return fromFile;
29154
+ if (process.platform !== "darwin") return void 0;
29155
+ const { stdout } = await execFileAsync3("security", ["find-generic-password", "-s", "Claude Code-credentials", "-w"], { timeout: 1e4 }).catch(() => ({ stdout: "" }));
29156
+ return tokenFrom(String(stdout).trim());
29157
+ }
29158
+ async function readClaudeQuotaWindows() {
29159
+ const token = await readClaudeAccessToken();
29160
+ if (!token) throw new Error("Claude Code \u672A\u4F7F\u7528 Claude \u8D26\u53F7\u767B\u5F55\uFF08API Key \u65B9\u5F0F\u6CA1\u6709\u5957\u9910\u989D\u5EA6\uFF09\uFF0C\u8BF7\u5728\u672C\u673A\u8FD0\u884C claude \u5E76 /login");
29161
+ const response = await fetch(CLAUDE_USAGE_URL, {
29162
+ headers: { authorization: `Bearer ${token}`, "anthropic-beta": "oauth-2025-04-20", accept: "application/json" },
29163
+ redirect: "error",
29164
+ signal: AbortSignal.timeout(15e3)
29165
+ });
29166
+ if (response.status === 401 || response.status === 403) throw new Error("Claude Code \u767B\u5F55\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5728\u672C\u673A\u8FD0\u884C\u4E00\u6B21 claude \u5237\u65B0\u767B\u5F55\u540E\u518D\u8BD5");
29167
+ if (!response.ok) throw new Error(`Claude \u989D\u5EA6\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25 (${response.status})`);
29168
+ const windows = parseClaudeQuota(await response.json());
29169
+ if (!windows.length) throw new Error("Claude \u6CA1\u6709\u8FD4\u56DE\u6709\u6548\u7684\u989D\u5EA6\u7A97\u53E3");
29170
+ return windows;
29171
+ }
29172
+
29032
29173
  // src/providers/codex-quota.ts
29033
29174
  import { spawn as spawn8 } from "node:child_process";
29034
29175
  import { createInterface as createInterface4 } from "node:readline";
@@ -29127,10 +29268,10 @@ async function readCodexQuotaWindows() {
29127
29268
  }
29128
29269
 
29129
29270
  // src/providers/kiro-quota.ts
29130
- import { execFile as execFile5 } from "node:child_process";
29271
+ import { execFile as execFile6 } from "node:child_process";
29131
29272
  import { tmpdir as tmpdir2 } from "node:os";
29132
- import { promisify as promisify3, stripVTControlCharacters } from "node:util";
29133
- var execFileAsync3 = promisify3(execFile5);
29273
+ import { promisify as promisify4, stripVTControlCharacters } from "node:util";
29274
+ var execFileAsync4 = promisify4(execFile6);
29134
29275
  var amount = (value) => Number(value.replace(/,/g, ""));
29135
29276
  var rounded = (value) => Math.round(value * 100) / 100;
29136
29277
  function parseKiroQuota(stdout, now = /* @__PURE__ */ new Date()) {
@@ -29190,7 +29331,7 @@ async function readKiroQuotaWindows() {
29190
29331
  const launch = launchCli({ spec: requireCliSpec("kiro"), args: ["chat", "--no-interactive", "/usage"] });
29191
29332
  await requireKiroAuthentication(launch.env);
29192
29333
  try {
29193
- const { stdout, stderr } = await execFileAsync3(launch.executable, launch.args, { env: launch.env, cwd: tmpdir2(), timeout: 3e4, maxBuffer: 1024 * 1024, windowsHide: true });
29334
+ const { stdout, stderr } = await execFileAsync4(launch.executable, launch.args, { env: launch.env, cwd: tmpdir2(), timeout: 3e4, maxBuffer: 1024 * 1024, windowsHide: true });
29194
29335
  return parseKiroQuota(`${stdout}
29195
29336
  ${stderr}`);
29196
29337
  } catch (error62) {
@@ -29203,7 +29344,7 @@ ${stderr}`);
29203
29344
  var ALL_LEVELS = ["read-only", "acceptEdits", "bypassPermissions"];
29204
29345
  var NATIVE = {
29205
29346
  codex: { headless: codexProvider, chat: codexChatProvider, models: MODEL_SOURCES.codex, quota: readCodexQuotaWindows, runSettings: { permissionModes: ALL_LEVELS, plan: "prompt", fast: true } },
29206
- claude: { headless: claudeProvider, chat: (_request, attachments) => claudeChatProvider(attachments), models: MODEL_SOURCES.claude, runSettings: { permissionModes: ALL_LEVELS, plan: "native", fast: true } }
29347
+ claude: { headless: claudeProvider, chat: (_request, attachments) => claudeChatProvider(attachments), models: MODEL_SOURCES.claude, quota: readClaudeQuotaWindows, runSettings: { permissionModes: ALL_LEVELS, plan: "native", fast: true } }
29207
29348
  };
29208
29349
  var ACP_EXTRAS = {
29209
29350
  kiro: { quota: readKiroQuotaWindows, legacy: { headless: kiroProvider, restrictedPermission: true, runSettings: { permissionModes: ["read-only", "bypassPermissions"], plan: "prompt" } } },
@@ -29390,12 +29531,12 @@ var cliDetection = new CliDetectionService();
29390
29531
  // src/smoke/cli-smoke.ts
29391
29532
  import { mkdtemp as mkdtemp2, realpath as realpath3, rm as rm5 } from "node:fs/promises";
29392
29533
  import { tmpdir as tmpdir3 } from "node:os";
29393
- import { join as join20 } from "node:path";
29534
+ import { join as join21 } from "node:path";
29394
29535
 
29395
29536
  // src/runs/run-supervisor.ts
29396
29537
  import { spawn as spawn11 } from "node:child_process";
29397
29538
  import { mkdir as mkdir7, realpath as realpath2, stat as stat5, writeFile as writeFile7 } from "node:fs/promises";
29398
- import { basename as basename2, isAbsolute as isAbsolute4, join as join19, relative as relative2, resolve as resolve5 } from "node:path";
29539
+ import { basename as basename2, isAbsolute as isAbsolute4, join as join20, relative as relative2, resolve as resolve5 } from "node:path";
29399
29540
  import { createInterface as createInterface6 } from "node:readline";
29400
29541
 
29401
29542
  // src/providers/chat/index.ts
@@ -29764,19 +29905,19 @@ async function forkCodexThread(options) {
29764
29905
 
29765
29906
  // src/runs/run-recorder.ts
29766
29907
  import { appendFileSync, mkdirSync as mkdirSync2 } from "node:fs";
29767
- import { homedir as homedir10 } from "node:os";
29768
- import { join as join16 } from "node:path";
29908
+ import { homedir as homedir11 } from "node:os";
29909
+ import { join as join17 } from "node:path";
29769
29910
  var RunRecorder = class _RunRecorder {
29770
29911
  constructor(path) {
29771
29912
  this.path = path;
29772
29913
  }
29773
29914
  path;
29774
- home = homedir10();
29915
+ home = homedir11();
29775
29916
  static fromEnvironment(runId, meta3) {
29776
29917
  const directory = process.env.TOC_OCRA_RECORD_DIR?.trim();
29777
29918
  if (!directory) return void 0;
29778
29919
  mkdirSync2(directory, { recursive: true });
29779
- const recorder = new _RunRecorder(join16(directory, `${String(meta3.agent ?? "cli")}-${runId}.jsonl`));
29920
+ const recorder = new _RunRecorder(join17(directory, `${String(meta3.agent ?? "cli")}-${runId}.jsonl`));
29780
29921
  recorder.write({ meta: meta3 });
29781
29922
  return recorder;
29782
29923
  }
@@ -29791,8 +29932,8 @@ var RunRecorder = class _RunRecorder {
29791
29932
  };
29792
29933
 
29793
29934
  // src/runs/run-transcript.ts
29794
- import { chmod as chmod4, mkdir as mkdir5, readdir as readdir2, readFile as readFile5, rename as rename5, stat as stat3, unlink, writeFile as writeFile5 } from "node:fs/promises";
29795
- import { join as join17 } from "node:path";
29935
+ import { chmod as chmod4, mkdir as mkdir5, readdir as readdir3, readFile as readFile6, rename as rename5, stat as stat3, unlink, writeFile as writeFile5 } from "node:fs/promises";
29936
+ import { join as join18 } from "node:path";
29796
29937
  var MAX_TRANSCRIPT_ITEMS = 5e3;
29797
29938
  var MAX_TRANSCRIPT_TEXT = 2e5;
29798
29939
  var MAX_TRANSCRIPT_LINES = 2e4;
@@ -30057,7 +30198,7 @@ function transcriptFileName(runId) {
30057
30198
  var TranscriptStore = class {
30058
30199
  constructor(dataDir2, logger, env = process.env) {
30059
30200
  this.logger = logger;
30060
- this.directory = dataDir2 ? join17(dataDir2, "transcripts") : "";
30201
+ this.directory = dataDir2 ? join18(dataDir2, "transcripts") : "";
30061
30202
  this.enabled = Boolean(dataDir2) && transcriptsOnDisk(env);
30062
30203
  }
30063
30204
  logger;
@@ -30112,7 +30253,7 @@ var TranscriptStore = class {
30112
30253
  await this.writes.get(runId);
30113
30254
  let text3;
30114
30255
  try {
30115
- text3 = await readFile5(join17(this.directory, name), "utf8");
30256
+ text3 = await readFile6(join18(this.directory, name), "utf8");
30116
30257
  } catch (error62) {
30117
30258
  if (errorCode(error62) !== "ENOENT") this.logger.warn("run-transcript-read-failed", { runId, error: errorMessage(error62) });
30118
30259
  return void 0;
@@ -30177,7 +30318,7 @@ var TranscriptStore = class {
30177
30318
  transcript.dirty = false;
30178
30319
  const body = JSON.stringify(transcript.toFile());
30179
30320
  await this.ensureDirectory();
30180
- const file2 = join17(this.directory, name);
30321
+ const file2 = join18(this.directory, name);
30181
30322
  const temporary = `${file2}.${process.pid}.tmp`;
30182
30323
  await writeFile5(temporary, body, { mode: 384 });
30183
30324
  await rename5(temporary, file2);
@@ -30206,7 +30347,7 @@ var TranscriptStore = class {
30206
30347
  async pruneOnce() {
30207
30348
  let names;
30208
30349
  try {
30209
- names = await readdir2(this.directory);
30350
+ names = await readdir3(this.directory);
30210
30351
  } catch (error62) {
30211
30352
  if (errorCode(error62) === "ENOENT") return;
30212
30353
  throw error62;
@@ -30214,7 +30355,7 @@ var TranscriptStore = class {
30214
30355
  const now = Date.now();
30215
30356
  const files = [];
30216
30357
  for (const name of names) {
30217
- const path = join17(this.directory, name);
30358
+ const path = join18(this.directory, name);
30218
30359
  if (name.endsWith(".tmp")) {
30219
30360
  const info2 = await stat3(path).catch(() => void 0);
30220
30361
  if (info2?.isFile() && now - info2.mtimeMs > STALE_TEMPORARY_MS) await unlink(path).catch(() => void 0);
@@ -30264,7 +30405,7 @@ function errorMessage(error62) {
30264
30405
  import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
30265
30406
  import { constants as constants2 } from "node:fs";
30266
30407
  import { lstat, mkdir as mkdir6, open as open3, realpath, rename as rename6, rm as rm4, writeFile as writeFile6 } from "node:fs/promises";
30267
- import { basename, isAbsolute as isAbsolute3, join as join18, relative } from "node:path";
30408
+ import { basename, isAbsolute as isAbsolute3, join as join19, relative } from "node:path";
30268
30409
  function within(root2, path) {
30269
30410
  const segment = relative(root2, path);
30270
30411
  return segment === "" || !segment.startsWith("..") && !isAbsolute3(segment);
@@ -30272,7 +30413,7 @@ function within(root2, path) {
30272
30413
  async function attachmentDirectory(workdir, messageId) {
30273
30414
  let directory = workdir;
30274
30415
  for (const segment of [".echo", "attachments", `message-${encodeURIComponent(messageId).slice(0, 180)}`]) {
30275
- directory = join18(directory, segment);
30416
+ directory = join19(directory, segment);
30276
30417
  await mkdir6(directory, { mode: 448 }).catch((error62) => {
30277
30418
  if (error62.code !== "EEXIST") throw error62;
30278
30419
  });
@@ -30280,7 +30421,7 @@ async function attachmentDirectory(workdir, messageId) {
30280
30421
  if (metadata.isSymbolicLink() || !metadata.isDirectory() || !within(workdir, await realpath(directory))) {
30281
30422
  throw new Error("\u9644\u4EF6\u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E CLI \u5DE5\u4F5C\u76EE\u5F55\u5185\uFF0C\u4E14\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");
30282
30423
  }
30283
- if (segment === ".echo") await writeFile6(join18(directory, ".gitignore"), "*\n", { flag: "wx", mode: 384 }).catch((error62) => {
30424
+ if (segment === ".echo") await writeFile6(join19(directory, ".gitignore"), "*\n", { flag: "wx", mode: 384 }).catch((error62) => {
30284
30425
  if (error62.code !== "EEXIST") throw error62;
30285
30426
  });
30286
30427
  }
@@ -30317,9 +30458,9 @@ async function prepareTaskAttachments(payload, workdir, download, signal2) {
30317
30458
  const characters = Array.from(basename(file2.name.replace(/\\/g, "/")).replace(/[^\p{L}\p{N}._-]/gu, "_").replace(/\.+$/u, ""));
30318
30459
  while (Buffer.byteLength(characters.join("")) > 160) characters.shift();
30319
30460
  const name = characters.join("") || "attachment";
30320
- const path = join18(directory, `${file2.file_id}-${name}`);
30461
+ const path = join19(directory, `${file2.file_id}-${name}`);
30321
30462
  if (!await matches(path, file2.size, file2.sha256, signal2)) {
30322
- const temporary = join18(directory, `.download-${file2.file_id}-${randomUUID2()}.part`);
30463
+ const temporary = join19(directory, `.download-${file2.file_id}-${randomUUID2()}.part`);
30323
30464
  try {
30324
30465
  await download(payload.run_id, file2.file_id, temporary, file2.size, file2.sha256, signal2);
30325
30466
  signal2.throwIfAborted();
@@ -30434,7 +30575,7 @@ var ChatEventForwarder = class {
30434
30575
 
30435
30576
  // src/acp/chat-session.ts
30436
30577
  import { randomUUID as randomUUID3 } from "node:crypto";
30437
- import { readFile as readFile6, stat as stat4 } from "node:fs/promises";
30578
+ import { readFile as readFile7, stat as stat4 } from "node:fs/promises";
30438
30579
  import { extname } from "node:path";
30439
30580
  import { pathToFileURL } from "node:url";
30440
30581
 
@@ -31042,12 +31183,12 @@ var AcpChatSession = class {
31042
31183
  if (file2.kind === "image" && mimeType && connection.imagePrompts) {
31043
31184
  const size = await stat4(file2.path).then((info) => info.size).catch(() => 0);
31044
31185
  if (size > 0 && size <= MAX_IMAGE_BYTES) {
31045
- blocks.push({ type: "image", mimeType, data: (await readFile6(file2.path)).toString("base64") });
31186
+ blocks.push({ type: "image", mimeType, data: (await readFile7(file2.path)).toString("base64") });
31046
31187
  continue;
31047
31188
  }
31048
31189
  }
31049
31190
  blocks.push({ type: "resource_link", uri: pathToFileURL(file2.path).href, name: file2.name });
31050
- notes.push(`\u9644\u4EF6\u6587\u4EF6\uFF1A${file2.name}
31191
+ notes.push(this.spec.dialect?.linksFileMentions ? `@${file2.path}` : `\u9644\u4EF6\u6587\u4EF6\uFF1A${file2.name}
31051
31192
  \u672C\u673A\u8DEF\u5F84\uFF1A${file2.path}`);
31052
31193
  }
31053
31194
  const text3 = [request.prompt, ...notes].filter(Boolean).join("\n\n");
@@ -31211,6 +31352,8 @@ var AcpChatSession = class {
31211
31352
  const text3 = detail ?? rpcErrorText(error62);
31212
31353
  const context = { label: this.spec.cli.label, ...this.spec.cli.installHint ? { installHint: this.spec.cli.installHint } : {} };
31213
31354
  if (/ACP 进程无法启动/.test(text3)) return classifySpawnError(text3, context);
31355
+ const statusFailure = error62 instanceof JsonRpcError ? this.spec.dialect?.failureKind?.({ code: error62.code, message: error62.message, data: error62.data }) : void 0;
31356
+ if (statusFailure) return cliFailure(statusFailure, { ...context, detail: text3 });
31214
31357
  if (error62 instanceof JsonRpcError && error62.code === -32e3) return cliFailure("notSignedIn", { ...context, detail: text3 });
31215
31358
  const stderr = this.connection?.process.stderrTail() ?? [];
31216
31359
  const known = classifyCliOutput([text3, ...stderr], this.spec.dialect?.failureRules, context);
@@ -31384,7 +31527,7 @@ var AcpChatHost = class {
31384
31527
  };
31385
31528
 
31386
31529
  // src/memory/providers.ts
31387
- import { execFile as execFile6 } from "node:child_process";
31530
+ import { execFile as execFile7 } from "node:child_process";
31388
31531
  var MemoryCreateInputSchema = external_exports.object({
31389
31532
  id: external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/),
31390
31533
  name: external_exports.string().trim().min(1).max(200),
@@ -31406,7 +31549,7 @@ var runNmem = (args) => {
31406
31549
  const env = providerEnvironment();
31407
31550
  const launch = resolveExecutable("nmem", args, env, process.env.TOC_OCRA_NMEM_PATH);
31408
31551
  return new Promise((resolve10) => {
31409
- execFile6(launch.executable, launch.args, { env: launch.env, timeout: COMMAND_TIMEOUT_MS, maxBuffer: MAX_OUTPUT_BYTES, windowsHide: true }, (error62, stdout) => {
31552
+ execFile7(launch.executable, launch.args, { env: launch.env, timeout: COMMAND_TIMEOUT_MS, maxBuffer: MAX_OUTPUT_BYTES, windowsHide: true }, (error62, stdout) => {
31410
31553
  if (!error62) {
31411
31554
  resolve10({ stdout: String(stdout) });
31412
31555
  return;
@@ -32384,12 +32527,12 @@ ${PLAN_MODE_PREFIX}` : payload.prompt;
32384
32527
  async prepareChatAttachments(payload) {
32385
32528
  if (!payload.attachments?.length) return [];
32386
32529
  if (!this.reporter.chatMedia) throw new Error("\u9644\u4EF6\u8F6C\u53D1\u672A\u914D\u7F6E");
32387
- const directory = join19(this.config.dataDir, "chat-media", encodeURIComponent(payload.chat_session_id ?? payload.run_id));
32530
+ const directory = join20(this.config.dataDir, "chat-media", encodeURIComponent(payload.chat_session_id ?? payload.run_id));
32388
32531
  await mkdir7(directory, { recursive: true, mode: 448 });
32389
32532
  const files = [];
32390
32533
  for (const attachment of payload.attachments) {
32391
32534
  const name = basename2(attachment.name).replace(/[^\p{L}\p{N}._-]/gu, "_").slice(-120) || "attachment";
32392
- const path = join19(directory, `${encodeURIComponent(attachment.media_id)}-${name}`);
32535
+ const path = join20(directory, `${encodeURIComponent(attachment.media_id)}-${name}`);
32393
32536
  const existing = await stat5(path).catch(() => void 0);
32394
32537
  if (!existing?.isFile()) {
32395
32538
  const data = await this.reporter.chatMedia(payload.run_id, attachment.media_id);
@@ -32590,7 +32733,7 @@ var silent = { debug() {
32590
32733
  async function runCliSmoke(options = {}) {
32591
32734
  const detection = await cliDetection.detect(true);
32592
32735
  const ids = options.only?.length ? options.only.map((id) => catalogEntry(id)?.id ?? id) : CLI_CATALOG.filter((entry) => entry.headless && detection.detectedIds.includes(entry.id)).map((entry) => entry.id);
32593
- const root2 = await realpath3(await mkdtemp2(join20(tmpdir3(), "toc-ocra-smoke-")));
32736
+ const root2 = await realpath3(await mkdtemp2(join21(tmpdir3(), "toc-ocra-smoke-")));
32594
32737
  const finished = /* @__PURE__ */ new Map();
32595
32738
  const config2 = { allowedRoots: [root2], maxConcurrentRuns: 0, maxRunSeconds: options.timeoutSeconds ?? 300, dataDir: root2 };
32596
32739
  const supervisor = new RunSupervisor(config2, silent, {
@@ -32667,7 +32810,7 @@ import { dirname as dirname10, resolve as resolve8 } from "node:path";
32667
32810
  import { fileURLToPath as fileURLToPath2 } from "node:url";
32668
32811
 
32669
32812
  // src/health/server.ts
32670
- import { readFile as readFile7 } from "node:fs/promises";
32813
+ import { readFile as readFile8 } from "node:fs/promises";
32671
32814
  import { createServer } from "node:http";
32672
32815
  var ControlError = class extends Error {
32673
32816
  constructor(status, message, code2 = "bad_request") {
@@ -32848,7 +32991,7 @@ var HealthServer = class {
32848
32991
  }
32849
32992
  async recentEvents() {
32850
32993
  try {
32851
- const raw = await readFile7(this.logFile, "utf8");
32994
+ const raw = await readFile8(this.logFile, "utf8");
32852
32995
  return raw.trim().split("\n").slice(-60).flatMap((line) => {
32853
32996
  try {
32854
32997
  const parsed = JSON.parse(line);
@@ -33025,7 +33168,7 @@ function createDiagnosticLogger(filePath, options = {}) {
33025
33168
 
33026
33169
  // src/runtime/agent-runtime.ts
33027
33170
  import { randomUUID as randomUUID4 } from "node:crypto";
33028
- import { join as join23 } from "node:path";
33171
+ import { join as join24 } from "node:path";
33029
33172
 
33030
33173
  // src/exec/script-runner.ts
33031
33174
  import { spawn as spawn12 } from "node:child_process";
@@ -33196,16 +33339,16 @@ async function readCLIQuotaReport(agentType) {
33196
33339
  }
33197
33340
 
33198
33341
  // src/providers/tb-switch-control.ts
33199
- import { readFile as readFile8 } from "node:fs/promises";
33200
- import { homedir as homedir11 } from "node:os";
33201
- import { join as join21 } from "node:path";
33342
+ import { readFile as readFile9 } from "node:fs/promises";
33343
+ import { homedir as homedir12 } from "node:os";
33344
+ import { join as join22 } from "node:path";
33202
33345
  function dataDir() {
33203
- return process.env.TB_SWITCH_HOME?.trim() || join21(homedir11(), ".tb-switch");
33346
+ return process.env.TB_SWITCH_HOME?.trim() || join22(homedir12(), ".tb-switch");
33204
33347
  }
33205
33348
  async function readLocalService() {
33206
33349
  let discovery;
33207
33350
  try {
33208
- discovery = JSON.parse(await readFile8(join21(dataDir(), "api.json"), "utf8"));
33351
+ discovery = JSON.parse(await readFile9(join22(dataDir(), "api.json"), "utf8"));
33209
33352
  } catch {
33210
33353
  throw new Error("\u8FD9\u53F0\u8BBE\u5907\u4E0A\u7684 TB Switch \u670D\u52A1\u672A\u8FD0\u884C\uFF0C\u8BF7\u6253\u5F00\u684C\u9762\u7AEF\u63D2\u4EF6\u540E\u91CD\u8BD5\u3002");
33211
33354
  }
@@ -33221,7 +33364,7 @@ async function readLocalService() {
33221
33364
  }
33222
33365
  let token = process.env.TB_SWITCH_API_TOKEN?.trim() ?? "";
33223
33366
  try {
33224
- token = (await readFile8(join21(dataDir(), "api-token"), "utf8")).trim();
33367
+ token = (await readFile9(join22(dataDir(), "api-token"), "utf8")).trim();
33225
33368
  } catch {
33226
33369
  }
33227
33370
  if (!token) throw new Error("\u65E0\u6CD5\u8BFB\u53D6 TB Switch \u672C\u673A\u670D\u52A1\u51ED\u636E\uFF0C\u8BF7\u91CD\u542F\u684C\u9762\u7AEF\u63D2\u4EF6\u540E\u91CD\u8BD5\u3002");
@@ -33311,7 +33454,7 @@ async function controlTbSwitch(payload) {
33311
33454
  }
33312
33455
 
33313
33456
  // src/runs/orphan-registry.ts
33314
- import { mkdir as mkdir8, readFile as readFile9, rename as rename7, writeFile as writeFile8 } from "node:fs/promises";
33457
+ import { mkdir as mkdir8, readFile as readFile10, rename as rename7, writeFile as writeFile8 } from "node:fs/promises";
33315
33458
  import { basename as basename3, dirname as dirname8 } from "node:path";
33316
33459
  var OrphanRegistry = class {
33317
33460
  constructor(file2) {
@@ -33340,7 +33483,7 @@ var OrphanRegistry = class {
33340
33483
  async reapPrevious() {
33341
33484
  let previous = [];
33342
33485
  try {
33343
- previous = JSON.parse(await readFile9(this.file, "utf8"));
33486
+ previous = JSON.parse(await readFile10(this.file, "utf8"));
33344
33487
  } catch {
33345
33488
  return [];
33346
33489
  }
@@ -33492,17 +33635,17 @@ var GatewayClient = class {
33492
33635
  };
33493
33636
 
33494
33637
  // src/workspace/directory-browser.ts
33495
- import { mkdir as mkdir9, readdir as readdir3, realpath as realpath4, stat as stat7 } from "node:fs/promises";
33496
- import { homedir as homedir12 } from "node:os";
33638
+ import { mkdir as mkdir9, readdir as readdir4, realpath as realpath4, stat as stat7 } from "node:fs/promises";
33639
+ import { homedir as homedir13 } from "node:os";
33497
33640
  import { dirname as dirname9, isAbsolute as isAbsolute5, parse as parse3, resolve as resolve6 } from "node:path";
33498
33641
  var MAX_ENTRIES = 1e3;
33499
33642
  async function listDirectory(requested, allowedRoots) {
33500
- const raw = requested.trim().replace(/^~(?=$|[\\/])/, homedir12()) || homedir12();
33643
+ const raw = requested.trim().replace(/^~(?=$|[\\/])/, homedir13()) || homedir13();
33501
33644
  const directory = await realpath4(resolve6(raw)).catch(() => {
33502
33645
  throw new Error(`\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A${requested}`);
33503
33646
  });
33504
33647
  if (!(await stat7(directory)).isDirectory()) throw new Error("\u8FD9\u4E0D\u662F\u4E00\u4E2A\u76EE\u5F55");
33505
- const entries = await readdir3(directory, { withFileTypes: true }).catch((error62) => {
33648
+ const entries = await readdir4(directory, { withFileTypes: true }).catch((error62) => {
33506
33649
  throw new Error(error62.code === "EACCES" || error62.code === "EPERM" ? "\u6CA1\u6709\u6743\u9650\u8BFB\u53D6\u8FD9\u4E2A\u76EE\u5F55" : error62.message);
33507
33650
  });
33508
33651
  const byName = (a, b) => a.name.localeCompare(b.name, void 0, { sensitivity: "base", numeric: true });
@@ -33515,8 +33658,8 @@ async function listDirectory(requested, allowedRoots) {
33515
33658
  else if (entry.isFile()) files.push(item);
33516
33659
  }
33517
33660
  const parent = dirname9(directory);
33518
- const places = [{ label: "\u4E3B\u76EE\u5F55", path: homedir12() }];
33519
- for (const root2 of allowedRoots) if (root2 !== homedir12()) places.push({ label: "\u5141\u8BB8\u7684\u76EE\u5F55", path: root2 });
33661
+ const places = [{ label: "\u4E3B\u76EE\u5F55", path: homedir13() }];
33662
+ for (const root2 of allowedRoots) if (root2 !== homedir13()) places.push({ label: "\u5141\u8BB8\u7684\u76EE\u5F55", path: root2 });
33520
33663
  places.push({ label: "\u6839\u76EE\u5F55", path: process.platform === "win32" ? parse3(directory).root : "/" });
33521
33664
  return {
33522
33665
  path: directory,
@@ -33554,7 +33697,7 @@ async function createDirectory(parentRequested, name) {
33554
33697
  // src/workspace/workspace-manager.ts
33555
33698
  import { spawn as spawn13 } from "node:child_process";
33556
33699
  import { opendir, realpath as realpath5, stat as stat8 } from "node:fs/promises";
33557
- import { homedir as homedir13 } from "node:os";
33700
+ import { homedir as homedir14 } from "node:os";
33558
33701
  import { isAbsolute as isAbsolute6, relative as relative3, resolve as resolve7 } from "node:path";
33559
33702
  var MAX_NODES = 2e3;
33560
33703
  var MAX_DIRECTORY_ENTRIES = 12e3;
@@ -33590,7 +33733,7 @@ var WorkspaceManager = class {
33590
33733
  return { root_path: rootPath, nodes, truncated: nodes.length >= MAX_NODES, duration_ms: Date.now() - startedAt };
33591
33734
  }
33592
33735
  validateRootPath(value) {
33593
- const raw = value.trim().replace(/^~(?=$|[\\/])/, homedir13());
33736
+ const raw = value.trim().replace(/^~(?=$|[\\/])/, homedir14());
33594
33737
  const root2 = resolve7(raw);
33595
33738
  if (!isAbsolute6(raw)) throw new Error("\u6839\u76EE\u5F55\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84");
33596
33739
  if (relative3(root2, resolve7(root2, "..")) === "") throw new Error("\u4E0D\u80FD\u628A\u6587\u4EF6\u7CFB\u7EDF\u6839\u76EE\u5F55\u4F5C\u4E3A\u76EE\u5F55\u6839");
@@ -33930,7 +34073,7 @@ var AgentRuntime = class {
33930
34073
  }
33931
34074
  };
33932
34075
  this.workspaces = new WorkspaceManager(config2, this.logger);
33933
- this.orphans = new OrphanRegistry(join23(config2.dataDir, "active-runs.json"));
34076
+ this.orphans = new OrphanRegistry(join24(config2.dataDir, "active-runs.json"));
33934
34077
  this.runs = new RunSupervisor(config2, this.logger, reporter, this.orphans);
33935
34078
  }
33936
34079
  config;
@@ -34703,7 +34846,7 @@ async function runService(options = {}) {
34703
34846
  }
34704
34847
 
34705
34848
  // src/index.ts
34706
- var { currentInstallation, installShared, ensureIdle, compareVersions: compareVersions2 } = createRequire(import.meta.url)(join24(agentPackageRoot(), "scripts", "installation.cjs"));
34849
+ var { currentInstallation, installShared, ensureIdle, compareVersions: compareVersions2 } = createRequire(import.meta.url)(join25(agentPackageRoot(), "scripts", "installation.cjs"));
34707
34850
  async function run() {
34708
34851
  try {
34709
34852
  await runService();
@@ -34830,7 +34973,7 @@ async function update(args) {
34830
34973
  if (customConfig) process.env.TOC_OCRA_CONFIG = resolve9(customConfig);
34831
34974
  await ensureIdle();
34832
34975
  const npmPath = resolveCliCommand("npm");
34833
- const temporary = mkdtempSync(join24(tmpdir4(), "toc-ocra-update-"));
34976
+ const temporary = mkdtempSync(join25(tmpdir4(), "toc-ocra-update-"));
34834
34977
  try {
34835
34978
  const metadataResponse = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}`, { headers: { accept: "application/json", "cache-control": "no-cache" }, signal: AbortSignal.timeout(15e3) });
34836
34979
  if (!metadataResponse.ok) throw new Error("\u65E0\u6CD5\u8BFB\u53D6 npm \u6700\u65B0\u7248\u672C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");
@@ -34857,7 +35000,7 @@ async function update(args) {
34857
35000
  }
34858
35001
  const archive = Buffer.concat(chunks);
34859
35002
  if (`sha512-${createHash5("sha512").update(archive).digest("base64")}` !== dist.integrity) throw new Error("\u8BBE\u5907\u4EE3\u7406\u5B89\u88C5\u5305\u6821\u9A8C\u5931\u8D25\uFF0C\u5DF2\u505C\u6B62\u5347\u7EA7");
34860
- const archivePath = join24(temporary, "toc-ocra.tgz");
35003
+ const archivePath = join25(temporary, "toc-ocra.tgz");
34861
35004
  writeFileSync3(archivePath, archive, { mode: 384 });
34862
35005
  const npm = directLaunch2(npmPath, ["install", "--prefix", temporary, "--ignore-scripts", "--omit=dev", "--no-package-lock", "--no-audit", "--no-fund", "--prefer-online", "--registry=https://registry.npmjs.org", archivePath]);
34863
35006
  const install = spawnSync(npm.executable, npm.args, { stdio: "inherit", shell: false, windowsHide: true });
@@ -34867,7 +35010,7 @@ async function update(args) {
34867
35010
  return;
34868
35011
  }
34869
35012
  const previousVersion = agentVersion();
34870
- const current = await installShared(join24(temporary, "node_modules", PACKAGE_NAME), { startService: existsSync8(defaultConfigPath()) });
35013
+ const current = await installShared(join25(temporary, "node_modules", PACKAGE_NAME), { startService: existsSync8(defaultConfigPath()) });
34871
35014
  if (current.version === previousVersion) process.stdout.write(`toc-ocra \u5DF2\u662F\u6700\u65B0\u7248\u672C ${current.version}
34872
35015
  `);
34873
35016
  else process.stdout.write(`toc-ocra \u5DF2\u5347\u7EA7\u5230 ${current.version}\uFF0C\u7EC8\u7AEF\u4E0E Echo \u63D2\u4EF6\u5171\u7528\u6B64\u7248\u672C
@@ -34895,7 +35038,7 @@ async function main() {
34895
35038
  const selected = !shared || compareVersions2(agentVersion(), shared.version) > 0 ? await installShared(root2) : shared;
34896
35039
  const same = (a, b) => process.platform === "win32" ? resolve9(a).toLowerCase() === resolve9(b).toLowerCase() : resolve9(a) === resolve9(b);
34897
35040
  if (!same(selected.root, root2)) {
34898
- await import(pathToFileURL2(join24(selected.root, "dist", "cli", "cli.mjs")).href);
35041
+ await import(pathToFileURL2(join25(selected.root, "dist", "cli", "cli.mjs")).href);
34899
35042
  return;
34900
35043
  }
34901
35044
  }