deepseeker-code 1.0.41 → 1.0.42

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/cli.mjs +295 -287
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -9,12 +9,88 @@ var __export = (target, all) => {
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
11
 
12
+ // src/updateCheck.ts
13
+ var updateCheck_exports = {};
14
+ __export(updateCheck_exports, {
15
+ getCachedLatestIfNewer: () => getCachedLatestIfNewer,
16
+ readLocalVersion: () => readLocalVersion,
17
+ refreshUpdateCache: () => refreshUpdateCache
18
+ });
19
+ import { readFileSync as readFileSync2, writeFileSync, mkdirSync } from "node:fs";
20
+ import path2 from "node:path";
21
+ import os2 from "os";
22
+ import { fileURLToPath } from "node:url";
23
+ var PKG_NAME, REGISTRY, CACHE_TTL_MS, FETCH_TIMEOUT_MS, cacheFile, readLocalVersion, parseSemver, compareVersion, readCache, writeCache, getCachedLatestIfNewer, refreshUpdateCache;
24
+ var init_updateCheck = __esm({
25
+ "src/updateCheck.ts"() {
26
+ "use strict";
27
+ PKG_NAME = "deepseeker-code";
28
+ REGISTRY = "https://registry.npmjs.org";
29
+ CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
30
+ FETCH_TIMEOUT_MS = 3e3;
31
+ cacheFile = () => path2.join(os2.homedir(), ".deepseeker-code", "update-check.json");
32
+ readLocalVersion = () => {
33
+ try {
34
+ const here = path2.dirname(fileURLToPath(import.meta.url));
35
+ return JSON.parse(readFileSync2(path2.join(here, "..", "package.json"), "utf8")).version ?? "0.0.0";
36
+ } catch {
37
+ return "0.0.0";
38
+ }
39
+ };
40
+ parseSemver = (v) => {
41
+ const m = String(v ?? "").match(/^(\d+)\.(\d+)\.(\d+)/);
42
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : [0, 0, 0];
43
+ };
44
+ compareVersion = (a, b) => {
45
+ const [a1, a2, a3] = parseSemver(a);
46
+ const [b1, b2, b3] = parseSemver(b);
47
+ return a1 - b1 || a2 - b2 || a3 - b3;
48
+ };
49
+ readCache = () => {
50
+ try {
51
+ const obj = JSON.parse(readFileSync2(cacheFile(), "utf8"));
52
+ return typeof obj.latestVersion === "string" && typeof obj.lastCheck === "number" ? obj : null;
53
+ } catch {
54
+ return null;
55
+ }
56
+ };
57
+ writeCache = (latestVersion) => {
58
+ try {
59
+ mkdirSync(path2.dirname(cacheFile()), { recursive: true });
60
+ writeFileSync(cacheFile(), JSON.stringify({ lastCheck: Date.now(), latestVersion }), "utf8");
61
+ } catch {
62
+ }
63
+ };
64
+ getCachedLatestIfNewer = (currentVersion) => {
65
+ const cache = readCache();
66
+ if (!cache) return null;
67
+ return compareVersion(cache.latestVersion, currentVersion) > 0 ? cache.latestVersion : null;
68
+ };
69
+ refreshUpdateCache = () => {
70
+ const cache = readCache();
71
+ if (cache && Date.now() - cache.lastCheck < CACHE_TTL_MS) return;
72
+ void (async () => {
73
+ try {
74
+ const res = await fetch(`${REGISTRY}/${PKG_NAME}/latest`, {
75
+ signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
76
+ });
77
+ if (!res.ok) return;
78
+ const info = await res.json();
79
+ if (info.version) writeCache(info.version);
80
+ } catch {
81
+ }
82
+ })();
83
+ };
84
+ }
85
+ });
86
+
12
87
  // src/strings.ts
13
88
  var VERSION, STRINGS, locale, getLocale, setLocale, S, LOCAL_COMMAND_NAMES;
14
89
  var init_strings = __esm({
15
90
  "src/strings.ts"() {
16
91
  "use strict";
17
- VERSION = "v1.0.0";
92
+ init_updateCheck();
93
+ VERSION = `v${readLocalVersion()}`;
18
94
  STRINGS = {
19
95
  zh: {
20
96
  brand: "DeepSeeker-Code",
@@ -317,15 +393,15 @@ __export(config_exports, {
317
393
  appConfig: () => appConfig,
318
394
  configSources: () => configSources
319
395
  });
320
- import path2 from "path";
321
- import os2 from "os";
322
- import { readFileSync as readFileSync2 } from "fs";
396
+ import path3 from "path";
397
+ import os3 from "os";
398
+ import { readFileSync as readFileSync3 } from "fs";
323
399
  import { createHash } from "crypto";
324
400
  var _DataDir, appConfig, ENV_SOURCES, configSources, ENGINE_OVERRIDE_VALIDATORS, ENGINE_OVERRIDE_KEYS, applyEngineOverrides;
325
401
  var init_config = __esm({
326
402
  "../core/src/config/index.ts"() {
327
403
  "use strict";
328
- _DataDir = process.env.DEEPSEEKER_CODE_DATA_DIR ? path2.resolve(process.env.DEEPSEEKER_CODE_DATA_DIR) : path2.join(os2.homedir(), ".deepseeker-code");
404
+ _DataDir = process.env.DEEPSEEKER_CODE_DATA_DIR ? path3.resolve(process.env.DEEPSEEKER_CODE_DATA_DIR) : path3.join(os3.homedir(), ".deepseeker-code");
329
405
  appConfig = {
330
406
  dataDir: _DataDir,
331
407
  maxReasoningRounds: 3,
@@ -352,8 +428,8 @@ var init_config = __esm({
352
428
  if (/^[a-z]:/i.test(cwd)) {
353
429
  cwd = cwd.charAt(0).toUpperCase() + cwd.slice(1);
354
430
  }
355
- const currentFolder = path2.basename(cwd);
356
- const parentFolder = path2.basename(path2.dirname(cwd));
431
+ const currentFolder = path3.basename(cwd);
432
+ const parentFolder = path3.basename(path3.dirname(cwd));
357
433
  const hash = createHash("sha256").update(cwd).digest("hex").slice(0, 8);
358
434
  return `${parentFolder}-${currentFolder}-${hash}`;
359
435
  })(),
@@ -451,15 +527,15 @@ var init_config = __esm({
451
527
  ENGINE_OVERRIDE_KEYS = Object.keys(ENGINE_OVERRIDE_VALIDATORS);
452
528
  applyEngineOverrides = (cfg) => {
453
529
  const paths = [
454
- { scope: "settings.global", configPath: path2.join(cfg.dataDir, "settings.json") },
530
+ { scope: "settings.global", configPath: path3.join(cfg.dataDir, "settings.json") },
455
531
  // 全局用户级
456
- { scope: "settings.project", configPath: path2.join(process.cwd(), ".deepseeker-code", "settings.json") }
532
+ { scope: "settings.project", configPath: path3.join(process.cwd(), ".deepseeker-code", "settings.json") }
457
533
  // 项目级(覆盖全局)
458
534
  ];
459
535
  for (const { scope, configPath } of paths) {
460
536
  let raw;
461
537
  try {
462
- raw = readFileSync2(configPath, "utf-8");
538
+ raw = readFileSync3(configPath, "utf-8");
463
539
  } catch {
464
540
  continue;
465
541
  }
@@ -596,7 +672,7 @@ ${body}`) return;
596
672
  });
597
673
 
598
674
  // src/prefs.ts
599
- import path3 from "path";
675
+ import path4 from "path";
600
676
  import fs2 from "fs/promises";
601
677
  var PREFS_FILE, readPrefs, readLocale, writePrefs, writeLocale;
602
678
  var init_prefs = __esm({
@@ -604,7 +680,7 @@ var init_prefs = __esm({
604
680
  "use strict";
605
681
  init_config();
606
682
  init_common();
607
- PREFS_FILE = path3.join(appConfig.dataDir, "prefs.json");
683
+ PREFS_FILE = path4.join(appConfig.dataDir, "prefs.json");
608
684
  readPrefs = async () => {
609
685
  const p = await readJSONFile(PREFS_FILE);
610
686
  return p && typeof p === "object" ? p : {};
@@ -625,7 +701,7 @@ var init_prefs = __esm({
625
701
  });
626
702
 
627
703
  // ../core/src/trust/index.ts
628
- import path4 from "path";
704
+ import path5 from "path";
629
705
  import fs3 from "fs/promises";
630
706
  var TRUSTED_FILE, normalizeDir, readTrustedDirs, isTrustedDir, trustDir, untrustDir;
631
707
  var init_trust = __esm({
@@ -633,9 +709,9 @@ var init_trust = __esm({
633
709
  "use strict";
634
710
  init_config();
635
711
  init_common();
636
- TRUSTED_FILE = path4.join(appConfig.dataDir, "trusted_dirs.json");
712
+ TRUSTED_FILE = path5.join(appConfig.dataDir, "trusted_dirs.json");
637
713
  normalizeDir = (dir) => {
638
- let d = path4.resolve(dir).replace(/\\/g, "/");
714
+ let d = path5.resolve(dir).replace(/\\/g, "/");
639
715
  if (/^[a-z]:/i.test(d)) d = d.charAt(0).toUpperCase() + d.slice(1);
640
716
  return d;
641
717
  };
@@ -978,7 +1054,7 @@ var init_replay = __esm({
978
1054
  });
979
1055
 
980
1056
  // ../core/src/llm/model.ts
981
- import { readFileSync as readFileSync3 } from "fs";
1057
+ import { readFileSync as readFileSync4 } from "fs";
982
1058
  var resolveInitialProvider, activeProvider, chatWithModelWithSummary, classifyToolRisk;
983
1059
  var init_model = __esm({
984
1060
  "../core/src/llm/model.ts"() {
@@ -993,7 +1069,7 @@ var init_model = __esm({
993
1069
  }
994
1070
  let raw;
995
1071
  try {
996
- raw = JSON.parse(readFileSync3(scriptPath, "utf-8"));
1072
+ raw = JSON.parse(readFileSync4(scriptPath, "utf-8"));
997
1073
  } catch (e) {
998
1074
  throw new Error(`\u56DE\u653E\u5267\u672C\u52A0\u8F7D\u5931\u8D25\uFF08${scriptPath}\uFF09: ${e?.message ?? e}`);
999
1075
  }
@@ -1113,7 +1189,7 @@ __export(store_exports, {
1113
1189
  writeStore: () => writeStore
1114
1190
  });
1115
1191
  import fs4 from "fs/promises";
1116
- import path5 from "path";
1192
+ import path6 from "path";
1117
1193
  async function getRollingState(sessionId) {
1118
1194
  const store = await readStore(sessionId);
1119
1195
  if (!store) {
@@ -1160,16 +1236,16 @@ var init_store = __esm({
1160
1236
  getSessionsDirPath = (mainSessionId) => {
1161
1237
  assertSafeSessionId(mainSessionId);
1162
1238
  const fileName = getFileName(mainSessionId);
1163
- return path5.join(appConfig.dataDir, "sessions", appConfig.userWorkspaceDir, fileName);
1239
+ return path6.join(appConfig.dataDir, "sessions", appConfig.userWorkspaceDir, fileName);
1164
1240
  };
1165
- getWorkspaceSessionsDir = () => path5.join(appConfig.dataDir, "sessions", appConfig.userWorkspaceDir);
1241
+ getWorkspaceSessionsDir = () => path6.join(appConfig.dataDir, "sessions", appConfig.userWorkspaceDir);
1166
1242
  getStatePath = (sessionId) => {
1167
1243
  assertSafeSessionId(sessionId);
1168
- return path5.join(getSessionsDirPath(sessionId), `${sessionId}.state.json`);
1244
+ return path6.join(getSessionsDirPath(sessionId), `${sessionId}.state.json`);
1169
1245
  };
1170
1246
  getTranscriptPath = (sessionId) => {
1171
1247
  assertSafeSessionId(sessionId);
1172
- return path5.join(getSessionsDirPath(sessionId), `${sessionId}.jsonl`);
1248
+ return path6.join(getSessionsDirPath(sessionId), `${sessionId}.jsonl`);
1173
1249
  };
1174
1250
  ensureSessionsDir = async (sessionId) => {
1175
1251
  await fs4.mkdir(getSessionsDirPath(sessionId), { recursive: true });
@@ -1179,7 +1255,7 @@ var init_store = __esm({
1179
1255
  migrateLegacyFiles = async (sessionId) => {
1180
1256
  assertSafeSessionId(sessionId);
1181
1257
  const dir = getSessionsDirPath(sessionId);
1182
- const legacy = path5.join(dir, `${sessionId}.json`);
1258
+ const legacy = path6.join(dir, `${sessionId}.json`);
1183
1259
  const transcriptPath = getTranscriptPath(sessionId);
1184
1260
  const statePath = getStatePath(sessionId);
1185
1261
  let legacyText;
@@ -1304,7 +1380,7 @@ var init_store = __esm({
1304
1380
  if (!entry.isDirectory()) continue;
1305
1381
  const sessionId = entry.name;
1306
1382
  if (!isSafeSessionId(sessionId)) continue;
1307
- const dirPath = path5.join(root, sessionId);
1383
+ const dirPath = path6.join(root, sessionId);
1308
1384
  const state = await readJSONFile(getStatePath(sessionId));
1309
1385
  let messageCount = 0;
1310
1386
  let preview = "";
@@ -1481,7 +1557,7 @@ var init_types = __esm({
1481
1557
 
1482
1558
  // ../core/src/hooks/shellExecutor.ts
1483
1559
  import { spawn } from "child_process";
1484
- import path6 from "path";
1560
+ import path7 from "path";
1485
1561
  var MAX_OUTPUT, DEFAULT_TIMEOUT_MS, HARD_TIMEOUT_CAP_MS, ENV_WHITELIST, truncate, MAX_STDIN_FIELD, capFieldStrings, extractFilePath, executeHookCommand;
1486
1562
  var init_shellExecutor = __esm({
1487
1563
  "../core/src/hooks/shellExecutor.ts"() {
@@ -1527,7 +1603,7 @@ var init_shellExecutor = __esm({
1527
1603
  if (typeof rel !== "string" || !rel.trim()) return void 0;
1528
1604
  const base = typeof p.cwd === "string" && p.cwd || process.env.WORKSPACE_ROOT || process.cwd();
1529
1605
  try {
1530
- return path6.resolve(base, rel);
1606
+ return path7.resolve(base, rel);
1531
1607
  } catch {
1532
1608
  return void 0;
1533
1609
  }
@@ -1732,7 +1808,7 @@ var init_hooks = __esm({
1732
1808
  });
1733
1809
 
1734
1810
  // ../core/src/agent/truncate.ts
1735
- import path7 from "path";
1811
+ import path8 from "path";
1736
1812
  function stripAnsi(text) {
1737
1813
  return text.replace(ANSI_ESCAPE, "");
1738
1814
  }
@@ -1771,10 +1847,10 @@ var init_truncate = __esm({
1771
1847
  if (!text) return text;
1772
1848
  const roots = /* @__PURE__ */ new Set();
1773
1849
  try {
1774
- roots.add(path7.resolve(appConfig.userWorkspaceDir));
1850
+ roots.add(path8.resolve(appConfig.userWorkspaceDir));
1775
1851
  for (const r of getFileAccessRoots()) {
1776
1852
  try {
1777
- roots.add(path7.resolve(r));
1853
+ roots.add(path8.resolve(r));
1778
1854
  } catch {
1779
1855
  }
1780
1856
  }
@@ -2041,7 +2117,7 @@ ${line}` : line;
2041
2117
 
2042
2118
  // ../core/src/tool/permissions.ts
2043
2119
  import fs6 from "fs/promises";
2044
- import path8 from "path";
2120
+ import path9 from "path";
2045
2121
  var PRIMARY_ARG, rules2, trustedProject, globCache, globToRegex, DANGER_COMMAND_TOOLS, compileRule, readPermissionConfig, toolNameMatches, ruleMatches, initPermissions, checkPermission, listPermissionRules, buildScopedAllowRule, resolveSettingsPath, addPermissionRule;
2046
2122
  var init_permissions = __esm({
2047
2123
  "../core/src/tool/permissions.ts"() {
@@ -2103,9 +2179,9 @@ var init_permissions = __esm({
2103
2179
  readPermissionConfig = async (includeProject) => {
2104
2180
  const merged = { allow: [], deny: [], ask: [] };
2105
2181
  const paths = [
2106
- path8.join(appConfig.dataDir, "settings.json"),
2182
+ path9.join(appConfig.dataDir, "settings.json"),
2107
2183
  // 全局用户级
2108
- ...includeProject ? [path8.join(process.cwd(), ".deepseeker-code", "settings.json")] : []
2184
+ ...includeProject ? [path9.join(process.cwd(), ".deepseeker-code", "settings.json")] : []
2109
2185
  // 项目级(叠加);未信任时省略
2110
2186
  ];
2111
2187
  for (const configPath of paths) {
@@ -2196,7 +2272,7 @@ var init_permissions = __esm({
2196
2272
  }
2197
2273
  return `${toolName}(${val})`;
2198
2274
  };
2199
- resolveSettingsPath = (scope) => scope === "global" ? path8.join(appConfig.dataDir, "settings.json") : path8.join(process.cwd(), ".deepseeker-code", "settings.json");
2275
+ resolveSettingsPath = (scope) => scope === "global" ? path9.join(appConfig.dataDir, "settings.json") : path9.join(process.cwd(), ".deepseeker-code", "settings.json");
2200
2276
  addPermissionRule = async (scope, kind, ruleStr) => {
2201
2277
  if (scope === "project" && !trustedProject) return false;
2202
2278
  const compiled = compileRule(ruleStr, `runtime:addPermissionRule(${scope})`, kind);
@@ -2208,7 +2284,7 @@ var init_permissions = __esm({
2208
2284
  const arr = Array.isArray(cfg.permissions[kind]) ? cfg.permissions[kind] : cfg.permissions[kind] = [];
2209
2285
  if (!arr.includes(ruleStr)) {
2210
2286
  arr.push(ruleStr);
2211
- await fs6.mkdir(path8.dirname(file), { recursive: true });
2287
+ await fs6.mkdir(path9.dirname(file), { recursive: true });
2212
2288
  await atomicWriteJSON(file, cfg);
2213
2289
  }
2214
2290
  if (!rules2[kind].some((r) => r.raw === compiled.raw)) rules2[kind].push(compiled);
@@ -2248,7 +2324,7 @@ var init_sessionRegistry = __esm({
2248
2324
  // ../core/src/tool/guard.ts
2249
2325
  import fs7 from "fs/promises";
2250
2326
  import fsSync from "fs";
2251
- import path9 from "path";
2327
+ import path10 from "path";
2252
2328
  import ignore from "ignore";
2253
2329
  import { AsyncLocalStorage } from "node:async_hooks";
2254
2330
  var WORKSPACE_ROOT, workspaceAls, getActiveWorkspaceRoot, runWithWorkspaceRoot, runWithSessionContext, BUILTIN_IGNORE_RULES, ignoreCache, ignoreBuilding, allowedRootsReal, getAllowedWorkspaceRoots, getContainingRoot, allowedBoundaryRoots, resolveSafePath, resolveReadablePath, assertWithinWorkspace, PROTECTED_WRITE_DIRS, COMMAND_ENV_DENYLIST, SENSITIVE_ENV_PATTERN, scrubCommandEnv, isProtectedWrite, scanIgnoreFilesRecursive, buildIgnoreEngine, getIgnoreForBase, initializeWorkspaceIgnore, checkIsPathIgnored, requestApproval;
@@ -2304,8 +2380,8 @@ var init_guard = __esm({
2304
2380
  getContainingRoot = (absPath) => {
2305
2381
  let best;
2306
2382
  for (const r of allowedBoundaryRoots()) {
2307
- const rel = path9.relative(r, absPath);
2308
- if (!rel.startsWith("..") && !path9.isAbsolute(rel)) {
2383
+ const rel = path10.relative(r, absPath);
2384
+ if (!rel.startsWith("..") && !path10.isAbsolute(rel)) {
2309
2385
  if (!best || r.length > best.length) best = r;
2310
2386
  }
2311
2387
  }
@@ -2322,16 +2398,16 @@ var init_guard = __esm({
2322
2398
  };
2323
2399
  resolveSafePath = (rel, base) => {
2324
2400
  const root = base ?? getActiveWorkspaceRoot();
2325
- const candidateAbsPath = path9.resolve(root, rel);
2401
+ const candidateAbsPath = path10.resolve(root, rel);
2326
2402
  let truePhysicalPath = candidateAbsPath;
2327
2403
  try {
2328
2404
  if (fsSync.existsSync(candidateAbsPath)) {
2329
2405
  truePhysicalPath = fsSync.realpathSync(candidateAbsPath);
2330
2406
  } else {
2331
- const parentDir = path9.dirname(candidateAbsPath);
2407
+ const parentDir = path10.dirname(candidateAbsPath);
2332
2408
  if (fsSync.existsSync(parentDir)) {
2333
2409
  const trueParentDir = fsSync.realpathSync(parentDir);
2334
- truePhysicalPath = path9.join(trueParentDir, path9.basename(candidateAbsPath));
2410
+ truePhysicalPath = path10.join(trueParentDir, path10.basename(candidateAbsPath));
2335
2411
  }
2336
2412
  }
2337
2413
  } catch (e) {
@@ -2345,8 +2421,8 @@ var init_guard = __esm({
2345
2421
  }
2346
2422
  })() : allowedBoundaryRoots();
2347
2423
  const escaped = boundaryRoots.every((r) => {
2348
- const rel0 = path9.relative(r, truePhysicalPath);
2349
- return rel0.startsWith("..") || path9.isAbsolute(rel0);
2424
+ const rel0 = path10.relative(r, truePhysicalPath);
2425
+ return rel0.startsWith("..") || path10.isAbsolute(rel0);
2350
2426
  });
2351
2427
  if (escaped) {
2352
2428
  throw new Error(`\u{1F6D1} [SECURITY ALERT] \u68C0\u6D4B\u5230\u6076\u610F\u7684\u7269\u7406\u8DEF\u5F84\u8DE8\u754C\u9003\u9038\uFF01\u62D2\u7EDD\u8BBF\u95EE\uFF1A${rel}`);
@@ -2355,12 +2431,12 @@ var init_guard = __esm({
2355
2431
  };
2356
2432
  resolveReadablePath = (rel) => {
2357
2433
  const root = getActiveWorkspaceRoot();
2358
- const absPath = path9.resolve(root, rel);
2434
+ const absPath = path10.resolve(root, rel);
2359
2435
  if (!fsSync.existsSync(absPath)) {
2360
- const rootName = path9.basename(root);
2436
+ const rootName = path10.basename(root);
2361
2437
  const firstSeg = rel.split(/[\\/]/)[0];
2362
2438
  if (rootName && firstSeg === rootName) {
2363
- const alt = path9.resolve(root, rel.slice(firstSeg.length + 1));
2439
+ const alt = path10.resolve(root, rel.slice(firstSeg.length + 1));
2364
2440
  if (fsSync.existsSync(alt)) return alt;
2365
2441
  }
2366
2442
  }
@@ -2373,9 +2449,9 @@ var init_guard = __esm({
2373
2449
  if (fsSync.existsSync(absPath)) {
2374
2450
  truePhysicalPath = fsSync.realpathSync(absPath);
2375
2451
  } else {
2376
- const parentDir = path9.dirname(absPath);
2452
+ const parentDir = path10.dirname(absPath);
2377
2453
  if (fsSync.existsSync(parentDir)) {
2378
- truePhysicalPath = path9.join(fsSync.realpathSync(parentDir), path9.basename(absPath));
2454
+ truePhysicalPath = path10.join(fsSync.realpathSync(parentDir), path10.basename(absPath));
2379
2455
  }
2380
2456
  }
2381
2457
  } catch (e) {
@@ -2389,8 +2465,8 @@ var init_guard = __esm({
2389
2465
  }
2390
2466
  })() : allowedBoundaryRoots();
2391
2467
  const escaped = boundaryRoots.every((r) => {
2392
- const rel0 = path9.relative(r, truePhysicalPath);
2393
- return rel0.startsWith("..") || path9.isAbsolute(rel0);
2468
+ const rel0 = path10.relative(r, truePhysicalPath);
2469
+ return rel0.startsWith("..") || path10.isAbsolute(rel0);
2394
2470
  });
2395
2471
  if (escaped) {
2396
2472
  throw new Error(`\u{1F6D1} [SECURITY ALERT] \u4E8C\u6B21\u56F4\u680F\u590D\u68C0\u53D1\u73B0\u8D8A\u754C\uFF08\u7591\u4F3C TOCTOU \u8F6F\u94FE\u63A5\u9003\u9038\uFF09\uFF1A${absPath}`);
@@ -2417,7 +2493,7 @@ var init_guard = __esm({
2417
2493
  if (!relOrAbs) return false;
2418
2494
  try {
2419
2495
  const base = cwd || process.env.WORKSPACE_ROOT || process.cwd();
2420
- const abs = path9.isAbsolute(relOrAbs) ? relOrAbs : path9.resolve(base, relOrAbs);
2496
+ const abs = path10.isAbsolute(relOrAbs) ? relOrAbs : path10.resolve(base, relOrAbs);
2421
2497
  const lower = abs.replace(/\\/g, "/").toLowerCase();
2422
2498
  return PROTECTED_WRITE_DIRS.some((d) => {
2423
2499
  const seg = ("/" + d).toLowerCase();
@@ -2432,9 +2508,9 @@ var init_guard = __esm({
2432
2508
  const entries = await fs7.readdir(dirPath, { withFileTypes: true });
2433
2509
  for (const entry of entries) {
2434
2510
  if (entry.isFile() && (entry.name === ".gitignore" || entry.name === ".agentignore")) {
2435
- const fullPath = path9.join(dirPath, entry.name);
2511
+ const fullPath = path10.join(dirPath, entry.name);
2436
2512
  const content = await fs7.readFile(fullPath, "utf-8");
2437
- const relDir = path9.relative(base, dirPath).replace(/\\/g, "/");
2513
+ const relDir = path10.relative(base, dirPath).replace(/\\/g, "/");
2438
2514
  const rules3 = content.split(/\r?\n/).map((line) => {
2439
2515
  const trimmed = line.trim();
2440
2516
  if (!trimmed || trimmed.startsWith("#")) return "";
@@ -2445,7 +2521,7 @@ var init_guard = __esm({
2445
2521
  }
2446
2522
  for (const entry of entries) {
2447
2523
  if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== ".git") {
2448
- await scanIgnoreFilesRecursive(path9.join(dirPath, entry.name), base, engine);
2524
+ await scanIgnoreFilesRecursive(path10.join(dirPath, entry.name), base, engine);
2449
2525
  }
2450
2526
  }
2451
2527
  } catch {
@@ -2516,7 +2592,7 @@ var init_guard = __esm({
2516
2592
  // ../core/src/tool/registry/background.ts
2517
2593
  import { spawn as spawn2, execFileSync } from "child_process";
2518
2594
  import fsSync2 from "fs";
2519
- import path10 from "path";
2595
+ import path11 from "path";
2520
2596
  function appendOutput(task, chunk) {
2521
2597
  task.outputBuffer += chunk;
2522
2598
  if (task.outputBuffer.length > MAX_BUFFER_CHARS) {
@@ -2541,7 +2617,7 @@ async function killTree(proc) {
2541
2617
  }
2542
2618
  }
2543
2619
  async function killBackgroundTasksUnder(dirPath) {
2544
- const norm = (p) => path10.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
2620
+ const norm = (p) => path11.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
2545
2621
  const target = norm(dirPath);
2546
2622
  let killed = 0;
2547
2623
  for (const task of registry.values()) {
@@ -2586,9 +2662,9 @@ var init_background = __esm({
2586
2662
  if (envShell && envShell.toLowerCase() !== "cmd") candidates.push(envShell);
2587
2663
  const gitExe = whereLines("git")[0];
2588
2664
  if (gitExe) {
2589
- const dir = path10.dirname(gitExe);
2590
- const root = path10.dirname(dir);
2591
- candidates.push(path10.join(root, "bin", "bash.exe"), path10.join(dir, "bash.exe"), path10.join(path10.dirname(root), "bin", "bash.exe"));
2665
+ const dir = path11.dirname(gitExe);
2666
+ const root = path11.dirname(dir);
2667
+ candidates.push(path11.join(root, "bin", "bash.exe"), path11.join(dir, "bash.exe"), path11.join(path11.dirname(root), "bin", "bash.exe"));
2592
2668
  }
2593
2669
  const bashHits = whereLines("bash").filter((p) => !/\\System32\\/i.test(p)).sort((a, b) => Number(/\\Git\\/i.test(b)) - Number(/\\Git\\/i.test(a)));
2594
2670
  candidates.push(...bashHits);
@@ -3331,13 +3407,13 @@ ${capped || JSON.stringify(result)}`;
3331
3407
 
3332
3408
  // ../core/src/tool/mcp/loader.ts
3333
3409
  import fs8 from "fs/promises";
3334
- import path11 from "path";
3410
+ import path12 from "path";
3335
3411
  import { homedir } from "os";
3336
3412
  function sanitize(s) {
3337
3413
  return s.replace(/[^a-zA-Z0-9_]/g, "_");
3338
3414
  }
3339
3415
  async function readMcpConfig() {
3340
- const configPath = process.env.MCP_CONFIG || path11.join(appConfig.dataDir, "mcp.json");
3416
+ const configPath = process.env.MCP_CONFIG || path12.join(appConfig.dataDir, "mcp.json");
3341
3417
  let raw;
3342
3418
  try {
3343
3419
  raw = await fs8.readFile(configPath, "utf-8");
@@ -4112,7 +4188,7 @@ ${AGENT_USAGE_HINT}`);
4112
4188
 
4113
4189
  // ../core/src/projectGuide/loader.ts
4114
4190
  import fs10 from "fs/promises";
4115
- import path12 from "path";
4191
+ import path13 from "path";
4116
4192
  var CANDIDATES, MAX_GUIDE_BYTES, cached, initProjectGuide, getProjectGuide;
4117
4193
  var init_loader2 = __esm({
4118
4194
  "../core/src/projectGuide/loader.ts"() {
@@ -4129,7 +4205,7 @@ var init_loader2 = __esm({
4129
4205
  try {
4130
4206
  for (const name of CANDIDATES) {
4131
4207
  try {
4132
- const raw = await fs10.readFile(path12.join(WORKSPACE_ROOT, name), "utf-8");
4208
+ const raw = await fs10.readFile(path13.join(WORKSPACE_ROOT, name), "utf-8");
4133
4209
  const body = raw.length > MAX_GUIDE_BYTES ? raw.slice(0, MAX_GUIDE_BYTES) + `
4134
4210
 
4135
4211
  \u2026[\u9879\u76EE\u6307\u5F15\u8D85 ${MAX_GUIDE_BYTES} \u5B57\u8282\u5DF2\u622A\u65AD\uFF0C\u5B8C\u6574\u5185\u5BB9\u53EF\u8C03\u7528 read_project_guide \u83B7\u53D6]` : raw;
@@ -4349,8 +4425,8 @@ var init_agent = __esm({
4349
4425
  });
4350
4426
 
4351
4427
  // ../core/src/tool/worktree/manager.ts
4352
- import path13 from "path";
4353
- import os3 from "os";
4428
+ import path14 from "path";
4429
+ import os4 from "os";
4354
4430
  import fs11 from "fs";
4355
4431
  var runMainGit, worktreeRootDir, worktreeDir, isNotARepoError, createWorktree, harvestDiff, runInWorktree, removeWorktree, sweepOrphanedWorktrees, disposeAllSessionWorktrees;
4356
4432
  var init_manager = __esm({
@@ -4362,8 +4438,8 @@ var init_manager = __esm({
4362
4438
  init_background();
4363
4439
  init_sessionRegistry();
4364
4440
  runMainGit = (args, maxBuffer = 1024 * 1024 * 5) => execFileSmart("git", args, { cwd: WORKSPACE_ROOT, maxBuffer });
4365
- worktreeRootDir = () => path13.join(os3.tmpdir(), "deepseeker-code-worktrees", appConfig.userWorkspaceDir);
4366
- worktreeDir = (sessionId, stepId) => path13.join(worktreeRootDir(), sessionId, stepId);
4441
+ worktreeRootDir = () => path14.join(os4.tmpdir(), "deepseeker-code-worktrees", appConfig.userWorkspaceDir);
4442
+ worktreeDir = (sessionId, stepId) => path14.join(worktreeRootDir(), sessionId, stepId);
4367
4443
  isNotARepoError = (e) => {
4368
4444
  const text = `${e?.message || ""} ${e?.stderr || ""}`.toLowerCase();
4369
4445
  return text.includes("not a git repository");
@@ -4374,7 +4450,7 @@ var init_manager = __esm({
4374
4450
  const wtPath = worktreeDir(sessionId, stepId);
4375
4451
  const shortId = sessionId.replace(/[^A-Za-z0-9-]/g, "").slice(0, 8) || "x";
4376
4452
  const branch = `dsc-wt-${shortId}-${stepId}`;
4377
- await fs11.promises.mkdir(path13.dirname(wtPath), { recursive: true });
4453
+ await fs11.promises.mkdir(path14.dirname(wtPath), { recursive: true });
4378
4454
  try {
4379
4455
  await runMainGit(["worktree", "add", "-b", branch, wtPath, "HEAD"]);
4380
4456
  } catch (e) {
@@ -4450,7 +4526,7 @@ var init_manager = __esm({
4450
4526
  }
4451
4527
  let swept = 0;
4452
4528
  for (const sessionIdDir of entries) {
4453
- const sessionPath = path13.join(root, sessionIdDir);
4529
+ const sessionPath = path14.join(root, sessionIdDir);
4454
4530
  let stepDirs;
4455
4531
  try {
4456
4532
  stepDirs = await fs11.promises.readdir(sessionPath);
@@ -4458,7 +4534,7 @@ var init_manager = __esm({
4458
4534
  continue;
4459
4535
  }
4460
4536
  for (const stepDir of stepDirs) {
4461
- const wtPath = path13.join(sessionPath, stepDir);
4537
+ const wtPath = path14.join(sessionPath, stepDir);
4462
4538
  try {
4463
4539
  await runMainGit(["worktree", "remove", "--force", wtPath]);
4464
4540
  } catch {
@@ -4739,7 +4815,7 @@ var init_workflow = __esm({
4739
4815
 
4740
4816
  // ../core/src/tool/tsHost.ts
4741
4817
  import fsSync3 from "fs";
4742
- import path14 from "path";
4818
+ import path15 from "path";
4743
4819
  var _ts, _tsTried, getTs, buildDefaultOptions, findTsConfigBounded, resolveTsConfig, createProjectHost, lsCache, getLanguageService, realpathNative, posToLineCol, lineColToPos;
4744
4820
  var init_tsHost = __esm({
4745
4821
  "../core/src/tool/tsHost.ts"() {
@@ -4772,16 +4848,16 @@ var init_tsHost = __esm({
4772
4848
  strict: false
4773
4849
  });
4774
4850
  findTsConfigBounded = (ts, absPath) => {
4775
- const root = path14.resolve(getContainingRoot(absPath));
4776
- let dir = path14.dirname(absPath);
4851
+ const root = path15.resolve(getContainingRoot(absPath));
4852
+ let dir = path15.dirname(absPath);
4777
4853
  while (true) {
4778
- const candidate = path14.join(dir, "tsconfig.json");
4854
+ const candidate = path15.join(dir, "tsconfig.json");
4779
4855
  try {
4780
4856
  if (fsSync3.existsSync(candidate)) return candidate;
4781
4857
  } catch {
4782
4858
  }
4783
- if (path14.resolve(dir) === root) break;
4784
- const parent = path14.dirname(dir);
4859
+ if (path15.resolve(dir) === root) break;
4860
+ const parent = path15.dirname(dir);
4785
4861
  if (parent === dir) break;
4786
4862
  dir = parent;
4787
4863
  }
@@ -4792,7 +4868,7 @@ var init_tsHost = __esm({
4792
4868
  if (!tsConfigPath) {
4793
4869
  return { options: buildDefaultOptions(ts), fileNames: [], projectRoot: getContainingRoot(absPath) };
4794
4870
  }
4795
- const basePath = path14.dirname(tsConfigPath);
4871
+ const basePath = path15.dirname(tsConfigPath);
4796
4872
  const raw = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
4797
4873
  if (raw.error) return { options: buildDefaultOptions(ts), fileNames: [], projectRoot: basePath };
4798
4874
  const parsed = ts.parseJsonConfigFileContent(raw.config, ts.sys, basePath);
@@ -4803,7 +4879,7 @@ var init_tsHost = __esm({
4803
4879
  const roots = /* @__PURE__ */ new Set();
4804
4880
  const caseSensitive = ts.sys.useCaseSensitiveFileNames;
4805
4881
  const canonical = (f) => caseSensitive ? f : f.toLowerCase();
4806
- const keyOf = (f) => canonical(path14.resolve(f)).replace(/\\/g, "/");
4882
+ const keyOf = (f) => canonical(path15.resolve(f)).replace(/\\/g, "/");
4807
4883
  rootFileNames.forEach((f) => roots.add(keyOf(f)));
4808
4884
  const fresh = (fileName) => {
4809
4885
  const key = keyOf(fileName);
@@ -4892,7 +4968,7 @@ var init_tsHost = __esm({
4892
4968
 
4893
4969
  // ../core/src/tool/registry/fs.ts
4894
4970
  import fs12 from "fs/promises";
4895
- import path15 from "path";
4971
+ import path16 from "path";
4896
4972
  import { createReadStream } from "fs";
4897
4973
  import * as readline from "readline";
4898
4974
  var isSensitiveReadTarget, stripReadFileLineNumbers, maskSecretsInContent, makeTmpPath, ATOMIC_TMP_RE, sweepStaleAtomicTmp, assertReadable, stripEdgeBlankLines, matchLineBlockWith, diagnoseOldStr, reindentToBase, alignIndentsByAnchor, applyOneEditToContent, fsTools;
@@ -4953,7 +5029,7 @@ var init_fs = __esm({
4953
5029
  return;
4954
5030
  }
4955
5031
  for (const e of entries) {
4956
- const full = path15.join(dir, e.name);
5032
+ const full = path16.join(dir, e.name);
4957
5033
  if (e.isDirectory()) {
4958
5034
  if (!skipDirs.has(e.name)) await walk(full);
4959
5035
  continue;
@@ -5227,8 +5303,8 @@ ${formattedCode}${hasMore ? `
5227
5303
  const entries = await fs12.readdir(currentPath, { withFileTypes: true });
5228
5304
  const validEntries = entries.filter((entry) => {
5229
5305
  if (entry.isSymbolicLink()) return false;
5230
- const fullPath = path15.join(currentPath, entry.name);
5231
- const relPath = path15.relative(getActiveWorkspaceRoot(), fullPath).replace(/\\/g, "/");
5306
+ const fullPath = path16.join(currentPath, entry.name);
5307
+ const relPath = path16.relative(getActiveWorkspaceRoot(), fullPath).replace(/\\/g, "/");
5232
5308
  return !checkIsPathIgnored(entry.isDirectory() ? `${relPath}/` : relPath);
5233
5309
  });
5234
5310
  let output = "";
@@ -5247,7 +5323,7 @@ ${formattedCode}${hasMore ? `
5247
5323
  `;
5248
5324
  if (entry.isDirectory()) {
5249
5325
  const nextPrefix = prefix + (isLast ? " " : "\u2502 ");
5250
- const fullPath = path15.join(currentPath, entry.name);
5326
+ const fullPath = path16.join(currentPath, entry.name);
5251
5327
  const subTree = await buildTreeText(fullPath, currentDepth + 1, nextPrefix);
5252
5328
  output += subTree;
5253
5329
  }
@@ -5361,7 +5437,7 @@ ${summaries.join("\n")}`;
5361
5437
  }
5362
5438
  const content = args.content ?? "";
5363
5439
  assertWithinWorkspace(absPath);
5364
- await fs12.mkdir(path15.dirname(absPath), { recursive: true });
5440
+ await fs12.mkdir(path16.dirname(absPath), { recursive: true });
5365
5441
  tmpPath = makeTmpPath(absPath);
5366
5442
  await fs12.writeFile(tmpPath, content, "utf-8");
5367
5443
  await fs12.rename(tmpPath, absPath);
@@ -5400,7 +5476,7 @@ ${summaries.join("\n")}`;
5400
5476
  }
5401
5477
  let rel = "";
5402
5478
  try {
5403
- rel = path15.relative(getActiveWorkspaceRoot(), resolveSafePath(cleanPath));
5479
+ rel = path16.relative(getActiveWorkspaceRoot(), resolveSafePath(cleanPath));
5404
5480
  } catch {
5405
5481
  }
5406
5482
  if (rel === "" || rel === "src") {
@@ -5421,8 +5497,8 @@ ${summaries.join("\n")}`;
5421
5497
  return `\u274C [\u5B89\u5168\u7194\u65AD]\uFF1A\u7981\u6B62\u901A\u8FC7\u672C\u5DE5\u5177\u76F4\u63A5\u6467\u6BC1\u9879\u76EE\u6839\u76EE\u5F55\u6216\u4F20\u5165\u7A7A\u8DEF\u5F84\uFF01`;
5422
5498
  }
5423
5499
  const absPath = resolveSafePath(cleanPath);
5424
- const rel = path15.relative(getActiveWorkspaceRoot(), absPath);
5425
- if (!rel || rel === "" || rel === "src" || rel.startsWith("..") || path15.isAbsolute(rel)) {
5500
+ const rel = path16.relative(getActiveWorkspaceRoot(), absPath);
5501
+ if (!rel || rel === "" || rel === "src" || rel.startsWith("..") || path16.isAbsolute(rel)) {
5426
5502
  return `\u274C [\u5B89\u5168\u7194\u65AD]\uFF1A\u62D2\u7EDD\u9500\u6BC1\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55 / src \u6E90\u7801\u6839 / \u8D8A\u754C\u8DEF\u5F84 [${cleanPath}]\uFF01`;
5427
5503
  }
5428
5504
  let stat;
@@ -5467,7 +5543,7 @@ ${summaries.join("\n")}`;
5467
5543
  try {
5468
5544
  const absPath = resolveSafePath(args.path);
5469
5545
  assertWithinWorkspace(absPath);
5470
- await fs12.mkdir(path15.dirname(absPath), { recursive: true });
5546
+ await fs12.mkdir(path16.dirname(absPath), { recursive: true });
5471
5547
  tmpPath = makeTmpPath(absPath);
5472
5548
  await fs12.writeFile(tmpPath, args.content, "utf-8");
5473
5549
  await fs12.rename(tmpPath, absPath);
@@ -5601,7 +5677,7 @@ ${summaries.join("\n")}`;
5601
5677
  }
5602
5678
  assertWithinWorkspace(srcAbs);
5603
5679
  assertWithinWorkspace(dstAbs);
5604
- await fs12.mkdir(path15.dirname(dstAbs), { recursive: true });
5680
+ await fs12.mkdir(path16.dirname(dstAbs), { recursive: true });
5605
5681
  await fs12.rename(srcAbs, dstAbs);
5606
5682
  return `\u2705 [\u79FB\u52A8\u6210\u529F]\uFF1A[${args.source}] \u2192 [${args.destination}]\u3002`;
5607
5683
  } catch (error) {
@@ -5616,7 +5692,7 @@ ${summaries.join("\n")}`;
5616
5692
 
5617
5693
  // ../core/src/tool/registry/search.ts
5618
5694
  import { rgPath } from "vscode-ripgrep";
5619
- import path16 from "path";
5695
+ import path17 from "path";
5620
5696
  import fs13 from "fs/promises";
5621
5697
  function escapeRegExp(string) {
5622
5698
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -5659,10 +5735,10 @@ var init_search = __esm({
5659
5735
  const resolveSearchRoot = () => {
5660
5736
  if (!args.path) return ctx?.cwd ?? getActiveWorkspaceRoot();
5661
5737
  const p = args.path.trim();
5662
- const looksLikeBareName = !path16.isAbsolute(p) && !p.includes("/") && !p.includes("\\");
5738
+ const looksLikeBareName = !path17.isAbsolute(p) && !p.includes("/") && !p.includes("\\");
5663
5739
  if (looksLikeBareName) {
5664
5740
  const hit = getAllowedWorkspaceRoots().find((r) => {
5665
- const bn = path16.basename(r);
5741
+ const bn = path17.basename(r);
5666
5742
  return bn === p || bn.toLowerCase() === p.toLowerCase();
5667
5743
  });
5668
5744
  if (hit) return hit;
@@ -5751,7 +5827,7 @@ var init_search = __esm({
5751
5827
  const GUIDE_CANDIDATES = ["CLAUDE.md", "AGENTS.md", "AGENT.md"];
5752
5828
  for (const name of GUIDE_CANDIDATES) {
5753
5829
  try {
5754
- const content = await fs13.readFile(path16.join(getActiveWorkspaceRoot(), name), "utf-8");
5830
+ const content = await fs13.readFile(path17.join(getActiveWorkspaceRoot(), name), "utf-8");
5755
5831
  return `[Project Guide via ${name}]
5756
5832
 
5757
5833
  ${content}`;
@@ -5984,7 +6060,7 @@ ${tail}`,
5984
6060
 
5985
6061
  // ../core/src/tool/registry/glob.ts
5986
6062
  import fs14 from "fs/promises";
5987
- import path17 from "path";
6063
+ import path18 from "path";
5988
6064
  var findMatchingBrace, splitTopLevel, globToRegex2, globTools;
5989
6065
  var init_glob = __esm({
5990
6066
  "../core/src/tool/registry/glob.ts"() {
@@ -6090,16 +6166,16 @@ var init_glob = __esm({
6090
6166
  if (scannedCount > MAX_SCAN_LIMIT) return;
6091
6167
  const entries = await fs14.readdir(dir, { withFileTypes: true });
6092
6168
  const validEntries = entries.filter((e) => {
6093
- const full = path17.join(dir, e.name);
6094
- const rel = path17.relative(activeRoot, full).replace(/\\/g, "/");
6169
+ const full = path18.join(dir, e.name);
6170
+ const rel = path18.relative(activeRoot, full).replace(/\\/g, "/");
6095
6171
  return !checkIsPathIgnored(e.isDirectory() ? `${rel}/` : rel);
6096
6172
  });
6097
6173
  for (const e of validEntries) {
6098
6174
  scannedCount++;
6099
6175
  if (scannedCount > MAX_SCAN_LIMIT) break;
6100
6176
  if (e.isSymbolicLink()) continue;
6101
- const full = path17.join(dir, e.name);
6102
- const rel = path17.relative(activeRoot, full).replace(/\\/g, "/");
6177
+ const full = path18.join(dir, e.name);
6178
+ const rel = path18.relative(activeRoot, full).replace(/\\/g, "/");
6103
6179
  if (e.isDirectory()) {
6104
6180
  if (cleanPattern.endsWith("/") && re.test(`${rel}/`)) {
6105
6181
  hits.push(`${rel}/`);
@@ -6316,7 +6392,7 @@ ${summary}`;
6316
6392
 
6317
6393
  // ../core/src/tool/registry/inspect_dependencies.ts
6318
6394
  import * as fs15 from "fs/promises";
6319
- import * as path18 from "path";
6395
+ import * as path19 from "path";
6320
6396
  var dependencyTools;
6321
6397
  var init_inspect_dependencies = __esm({
6322
6398
  "../core/src/tool/registry/inspect_dependencies.ts"() {
@@ -6337,7 +6413,7 @@ var init_inspect_dependencies = __esm({
6337
6413
  isSync: true,
6338
6414
  async execute() {
6339
6415
  try {
6340
- const pjsPath = path18.join(getActiveWorkspaceRoot(), "package.json");
6416
+ const pjsPath = path19.join(getActiveWorkspaceRoot(), "package.json");
6341
6417
  const raw = await fs15.readFile(pjsPath, "utf-8");
6342
6418
  const pjs = JSON.parse(raw);
6343
6419
  const result = {
@@ -6639,13 +6715,13 @@ async function safeFetchFollow(startUrl, baseHeaders, signals, allowPrivate = fa
6639
6715
  return res;
6640
6716
  }
6641
6717
  }
6642
- var FETCH_TIMEOUT_MS, SEARCH_TIMEOUT_MS, DEFAULT_MAX_CHARS, USER_AGENT, BROWSER_UA, TAVILY_ENDPOINT, formatHostBlockMessage, MAX_REDIRECTS, pinnedSsrfDispatcher, pinnedMetadataGuardDispatcher, readBodyCapped, webTools;
6718
+ var FETCH_TIMEOUT_MS2, SEARCH_TIMEOUT_MS, DEFAULT_MAX_CHARS, USER_AGENT, BROWSER_UA, TAVILY_ENDPOINT, formatHostBlockMessage, MAX_REDIRECTS, pinnedSsrfDispatcher, pinnedMetadataGuardDispatcher, readBodyCapped, webTools;
6643
6719
  var init_web = __esm({
6644
6720
  "../core/src/tool/registry/web.ts"() {
6645
6721
  "use strict";
6646
6722
  init_type();
6647
6723
  init_config();
6648
- FETCH_TIMEOUT_MS = 15e3;
6724
+ FETCH_TIMEOUT_MS2 = 15e3;
6649
6725
  SEARCH_TIMEOUT_MS = 2e4;
6650
6726
  DEFAULT_MAX_CHARS = 16e3;
6651
6727
  USER_AGENT = "DeepSeeker-Code-Agent/1.0 (+web_fetch tool)";
@@ -6775,7 +6851,7 @@ var init_web = __esm({
6775
6851
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
6776
6852
  return `\u274C [\u5B89\u5168\u7194\u65AD]\uFF1A\u4EC5\u5141\u8BB8 http/https \u534F\u8BAE\uFF0C\u62D2\u7EDD ${parsed.protocol}`;
6777
6853
  }
6778
- const signals = [AbortSignal.timeout(FETCH_TIMEOUT_MS)];
6854
+ const signals = [AbortSignal.timeout(FETCH_TIMEOUT_MS2)];
6779
6855
  if (ctx?.abortSignal) signals.push(ctx.abortSignal);
6780
6856
  try {
6781
6857
  const res = await safeFetchFollow(parsed.href, {
@@ -6812,7 +6888,7 @@ var init_web = __esm({
6812
6888
  ${body}${truncNote}`;
6813
6889
  } catch (error) {
6814
6890
  if (error?.name === "TimeoutError") {
6815
- return `\u274C [\u6293\u53D6\u8D85\u65F6]\uFF1A${FETCH_TIMEOUT_MS / 1e3}s \u5185\u672A\u54CD\u5E94\uFF1A${parsed.href}`;
6891
+ return `\u274C [\u6293\u53D6\u8D85\u65F6]\uFF1A${FETCH_TIMEOUT_MS2 / 1e3}s \u5185\u672A\u54CD\u5E94\uFF1A${parsed.href}`;
6816
6892
  }
6817
6893
  if (error?.name === "AbortError") {
6818
6894
  return `\u23F9\uFE0F [\u5DF2\u4E2D\u6B62]\uFF1A\u7528\u6237\u4E2D\u65AD\u4E86\u6293\u53D6\uFF1A${parsed.href}`;
@@ -6981,7 +7057,7 @@ var init_http = __esm({
6981
7057
 
6982
7058
  // ../core/src/tool/registry/typescript.ts
6983
7059
  import fs16 from "fs/promises";
6984
- import path19 from "path";
7060
+ import path20 from "path";
6985
7061
  var MAX_FILE_BYTES, toDisplayPath, precheck, MAX_DIAG_ENTRIES, MAX_DIAG_FILES, diagnoseOneFile, typescriptTools;
6986
7062
  var init_typescript = __esm({
6987
7063
  "../core/src/tool/registry/typescript.ts"() {
@@ -6992,8 +7068,8 @@ var init_typescript = __esm({
6992
7068
  init_fs();
6993
7069
  MAX_FILE_BYTES = 1024 * 1024;
6994
7070
  toDisplayPath = (wsRoot, abs) => {
6995
- const rel = path19.relative(wsRoot, abs);
6996
- if (rel && !rel.startsWith("..") && !path19.isAbsolute(rel)) return rel.replace(/\\/g, "/");
7071
+ const rel = path20.relative(wsRoot, abs);
7072
+ if (rel && !rel.startsWith("..") && !path20.isAbsolute(rel)) return rel.replace(/\\/g, "/");
6997
7073
  return abs.replace(/\\/g, "/").split("/").slice(-3).join("/");
6998
7074
  };
6999
7075
  precheck = async (displayPath, absPath) => {
@@ -7252,7 +7328,7 @@ var init_todo = __esm({
7252
7328
 
7253
7329
  // ../core/src/observability/traceCalculate.ts
7254
7330
  import fs17 from "fs/promises";
7255
- import path20 from "path";
7331
+ import path21 from "path";
7256
7332
  var getDirBytes, getTodayDateString;
7257
7333
  var init_traceCalculate = __esm({
7258
7334
  "../core/src/observability/traceCalculate.ts"() {
@@ -7269,7 +7345,7 @@ var init_traceCalculate = __esm({
7269
7345
  continue;
7270
7346
  }
7271
7347
  for (const e of entries) {
7272
- const p = path20.join(cur, e.name);
7348
+ const p = path21.join(cur, e.name);
7273
7349
  if (e.isDirectory()) {
7274
7350
  stack.push(p);
7275
7351
  } else {
@@ -7293,7 +7369,7 @@ var init_traceCalculate = __esm({
7293
7369
  });
7294
7370
 
7295
7371
  // ../core/src/tool/undo/store.ts
7296
- import path21 from "path";
7372
+ import path22 from "path";
7297
7373
  import fs18 from "fs/promises";
7298
7374
  var getUndoRootPath, getUndoClockPath, getUndoDirPath, getUndoBackupRoot, ensureUndoDir, getUndoIndexPath;
7299
7375
  var init_store2 = __esm({
@@ -7302,14 +7378,14 @@ var init_store2 = __esm({
7302
7378
  init_config();
7303
7379
  init_common();
7304
7380
  init_traceCalculate();
7305
- getUndoRootPath = () => path21.join(appConfig.dataDir, "undo");
7306
- getUndoClockPath = () => path21.join(getUndoRootPath(), "undo-cleanup-clock.json");
7381
+ getUndoRootPath = () => path22.join(appConfig.dataDir, "undo");
7382
+ getUndoClockPath = () => path22.join(getUndoRootPath(), "undo-cleanup-clock.json");
7307
7383
  getUndoDirPath = (mainSessionId) => {
7308
7384
  const rootId = getFileName(mainSessionId);
7309
7385
  assertSafeSessionId(rootId, "undoSessionId");
7310
- return path21.join(getUndoRootPath(), appConfig.userWorkspaceDir, rootId);
7386
+ return path22.join(getUndoRootPath(), appConfig.userWorkspaceDir, rootId);
7311
7387
  };
7312
- getUndoBackupRoot = (mainSessionId) => path21.join(getUndoDirPath(mainSessionId), "backups");
7388
+ getUndoBackupRoot = (mainSessionId) => path22.join(getUndoDirPath(mainSessionId), "backups");
7313
7389
  ensureUndoDir = async (mainSessionId) => {
7314
7390
  await fs18.mkdir(getUndoDirPath(mainSessionId), { recursive: true, mode: 448 });
7315
7391
  };
@@ -7321,14 +7397,14 @@ var init_store2 = __esm({
7321
7397
  const files = await fs18.readdir(dir);
7322
7398
  const existedFile = files.find((f) => f.endsWith(`__${rootId}.jsonl`));
7323
7399
  const fileName = existedFile ?? `undo-${getTodayDateString()}__${rootId}.jsonl`;
7324
- return path21.join(dir, fileName);
7400
+ return path22.join(dir, fileName);
7325
7401
  };
7326
7402
  }
7327
7403
  });
7328
7404
 
7329
7405
  // ../core/src/tool/undo/index.ts
7330
7406
  import fs19 from "fs/promises";
7331
- import path22 from "path";
7407
+ import path23 from "path";
7332
7408
  var undoLocks, withUndoLock, appendUndoRecord, readUndoIndex, markRestored;
7333
7409
  var init_undo = __esm({
7334
7410
  "../core/src/tool/undo/index.ts"() {
@@ -7378,7 +7454,7 @@ var init_undo = __esm({
7378
7454
  for (const f of files) {
7379
7455
  if (!f.startsWith("undo-") || !f.endsWith(".jsonl")) continue;
7380
7456
  try {
7381
- const raw = await fs19.readFile(path22.join(dir, f), "utf-8");
7457
+ const raw = await fs19.readFile(path23.join(dir, f), "utf-8");
7382
7458
  for (const line of raw.split("\n")) {
7383
7459
  const trimmed = line.trim();
7384
7460
  if (!trimmed) continue;
@@ -7409,7 +7485,7 @@ var init_undo = __esm({
7409
7485
  }
7410
7486
  for (const f of files) {
7411
7487
  if (!f.startsWith("undo-") || !f.endsWith(".jsonl")) continue;
7412
- const fp = path22.join(dir, f);
7488
+ const fp = path23.join(dir, f);
7413
7489
  let raw;
7414
7490
  try {
7415
7491
  raw = await fs19.readFile(fp, "utf-8");
@@ -7447,7 +7523,7 @@ var init_undo = __esm({
7447
7523
 
7448
7524
  // ../core/src/tool/undo/cleanup.ts
7449
7525
  import fs20 from "fs/promises";
7450
- import path23 from "path";
7526
+ import path24 from "path";
7451
7527
  async function maybeCleanupAfterUndoAppend(_sessionId) {
7452
7528
  if (cleanupInProgress) return;
7453
7529
  cleanupInProgress = true;
@@ -7473,7 +7549,7 @@ async function maybeCleanupAfterUndoAppend(_sessionId) {
7473
7549
  lastSizeCleanupAt = now;
7474
7550
  diskLastCleanupAt = now;
7475
7551
  const clockPath = getUndoClockPath();
7476
- await fs20.mkdir(path23.dirname(clockPath), { recursive: true });
7552
+ await fs20.mkdir(path24.dirname(clockPath), { recursive: true });
7477
7553
  await fs20.writeFile(clockPath, JSON.stringify({ lastCleanupAt: now, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), "utf-8");
7478
7554
  if (deleted > 0) console.log(`\u2728 [Undo\u8FD0\u7EF4] \u5171\u9500\u6BC1 ${deleted} \u4E2A undo \u8D44\u4EA7\uFF08\u7D22\u5F15 + \u5B64\u513F\u5185\u5BB9\uFF09\uFF0C\u78C1\u76D8\u6C34\u4F4D\u56DE\u843D\u3002`);
7479
7555
  } catch (e) {
@@ -7498,12 +7574,12 @@ async function cleanupOldUndoFiles() {
7498
7574
  const re = /^undo-(\d{4}-\d{2}-\d{2})__([\w-]+)\.jsonl$/;
7499
7575
  let deleted = 0;
7500
7576
  for (const rp of relativePaths) {
7501
- const fileName = path23.basename(rp);
7577
+ const fileName = path24.basename(rp);
7502
7578
  const m = fileName.match(re);
7503
7579
  if (!m) continue;
7504
7580
  const fileBornDay = /* @__PURE__ */ new Date(`${m[1]}T00:00:00`);
7505
7581
  if (fileBornDay >= cutoff) continue;
7506
- const fullPath = path23.join(dir, rp);
7582
+ const fullPath = path24.join(dir, rp);
7507
7583
  try {
7508
7584
  const st = await fs20.stat(fullPath);
7509
7585
  if (now - st.mtimeMs < ACTIVE_GRACE_MS) continue;
@@ -7525,10 +7601,10 @@ async function evictOldestForSize(targetBytes) {
7525
7601
  const re = /^undo-(\d{4}-\d{2}-\d{2})__([\w-]+)\.jsonl$/;
7526
7602
  const candidates = [];
7527
7603
  for (const rp of relativePaths) {
7528
- if (!re.test(path23.basename(rp))) continue;
7604
+ if (!re.test(path24.basename(rp))) continue;
7529
7605
  try {
7530
- const st = await fs20.stat(path23.join(dir, rp));
7531
- candidates.push({ mtime: st.mtimeMs, fullPath: path23.join(dir, rp), size: st.size });
7606
+ const st = await fs20.stat(path24.join(dir, rp));
7607
+ candidates.push({ mtime: st.mtimeMs, fullPath: path24.join(dir, rp), size: st.size });
7532
7608
  } catch {
7533
7609
  }
7534
7610
  }
@@ -7557,7 +7633,7 @@ async function gcOrphanBackups() {
7557
7633
  return 0;
7558
7634
  }
7559
7635
  for (const ws of workspaces) {
7560
- const wsDir = path23.join(root, ws);
7636
+ const wsDir = path24.join(root, ws);
7561
7637
  let stWs;
7562
7638
  try {
7563
7639
  stWs = await fs20.stat(wsDir);
@@ -7572,7 +7648,7 @@ async function gcOrphanBackups() {
7572
7648
  continue;
7573
7649
  }
7574
7650
  for (const sess of sessions2) {
7575
- const sessDir = path23.join(wsDir, sess);
7651
+ const sessDir = path24.join(wsDir, sess);
7576
7652
  const liveIds = /* @__PURE__ */ new Set();
7577
7653
  let files;
7578
7654
  try {
@@ -7583,7 +7659,7 @@ async function gcOrphanBackups() {
7583
7659
  for (const f of files) {
7584
7660
  if (!f.startsWith("undo-") || !f.endsWith(".jsonl")) continue;
7585
7661
  try {
7586
- const raw = await fs20.readFile(path23.join(sessDir, f), "utf-8");
7662
+ const raw = await fs20.readFile(path24.join(sessDir, f), "utf-8");
7587
7663
  for (const line of raw.split("\n")) {
7588
7664
  const t = line.trim();
7589
7665
  if (!t) continue;
@@ -7596,7 +7672,7 @@ async function gcOrphanBackups() {
7596
7672
  } catch {
7597
7673
  }
7598
7674
  }
7599
- const backupsDir = path23.join(sessDir, "backups");
7675
+ const backupsDir = path24.join(sessDir, "backups");
7600
7676
  let undoDirs;
7601
7677
  try {
7602
7678
  undoDirs = await fs20.readdir(backupsDir);
@@ -7606,7 +7682,7 @@ async function gcOrphanBackups() {
7606
7682
  for (const ud of undoDirs) {
7607
7683
  if (liveIds.has(ud)) continue;
7608
7684
  try {
7609
- await fs20.rm(path23.join(backupsDir, ud), { recursive: true, force: true });
7685
+ await fs20.rm(path24.join(backupsDir, ud), { recursive: true, force: true });
7610
7686
  deleted += 1;
7611
7687
  } catch {
7612
7688
  }
@@ -7649,7 +7725,7 @@ var init_cleanup = __esm({
7649
7725
  return 0;
7650
7726
  }
7651
7727
  for (const e of entries) {
7652
- const full = path23.join(dir, e.name);
7728
+ const full = path24.join(dir, e.name);
7653
7729
  if (e.isDirectory()) {
7654
7730
  total += await getDirBytesRecursive(full);
7655
7731
  } else if (e.isFile()) {
@@ -7666,7 +7742,7 @@ var init_cleanup = __esm({
7666
7742
 
7667
7743
  // ../core/src/tool/undo/backup.ts
7668
7744
  import fs21 from "fs/promises";
7669
- import path24 from "path";
7745
+ import path25 from "path";
7670
7746
  import crypto from "crypto";
7671
7747
  async function beforeMutationBackup(toolName, args, toolCallId, sessionId) {
7672
7748
  if (appConfig.undoEnabled === false) return null;
@@ -7681,7 +7757,7 @@ async function beforeMutationBackup(toolName, args, toolCallId, sessionId) {
7681
7757
  }
7682
7758
  await ensureUndoDir(sessionId);
7683
7759
  const undoId = createUUID();
7684
- const undoDir = path24.join(getUndoBackupRoot(sessionId), undoId);
7760
+ const undoDir = path25.join(getUndoBackupRoot(sessionId), undoId);
7685
7761
  const now = /* @__PURE__ */ new Date();
7686
7762
  const common = {
7687
7763
  undoId,
@@ -7731,7 +7807,7 @@ async function backupFileOverwrite(common, undoDir, args) {
7731
7807
  }
7732
7808
  const content = await fs21.readFile(absPath);
7733
7809
  await fs21.mkdir(undoDir, { recursive: true, mode: 448 });
7734
- const contentPath = path24.join(undoDir, "content");
7810
+ const contentPath = path25.join(undoDir, "content");
7735
7811
  await fs21.writeFile(contentPath, content, { mode: 384 });
7736
7812
  return {
7737
7813
  ...common,
@@ -7768,7 +7844,7 @@ async function backupDelete(common, undoDir, relativePath) {
7768
7844
  throw new Error(`\u76EE\u5F55 [${relativePath}] \u5185\u542B\u654F\u611F\u6587\u4EF6 ${sensitiveInTree.length} \u4E2A\uFF08\u5982 ${sensitiveInTree[0]}\uFF09\uFF0C\u6309\u7B56\u7565(undoBackupSensitive=deny)\u62D2\u7EDD\u5907\u4EFD\uFF0C\u5199\u5165\u5DF2\u963B\u65AD`);
7769
7845
  }
7770
7846
  }
7771
- const treeDest = path24.join(undoDir, "tree");
7847
+ const treeDest = path25.join(undoDir, "tree");
7772
7848
  const sensitiveSet = new Set(sensitiveInTree);
7773
7849
  await fs21.cp(absPath, treeDest, {
7774
7850
  recursive: true,
@@ -7776,7 +7852,7 @@ async function backupDelete(common, undoDir, relativePath) {
7776
7852
  preserveTimestamps: true,
7777
7853
  filter: (src) => {
7778
7854
  if (src === absPath) return true;
7779
- const relWithin = path24.relative(absPath, src).replace(/\\/g, "/");
7855
+ const relWithin = path25.relative(absPath, src).replace(/\\/g, "/");
7780
7856
  return !sensitiveSet.has(relWithin);
7781
7857
  }
7782
7858
  });
@@ -7793,7 +7869,7 @@ async function backupDelete(common, undoDir, relativePath) {
7793
7869
  throw new Error(`\u6587\u4EF6 [${relativePath}] \u4F53\u79EF\u7EA6 ${st.size} \u5B57\u8282\u8D85\u8FC7\u5355\u6B21\u5907\u4EFD\u4E0A\u9650 ${maxPerOp}\uFF0C\u5199\u5165\u5DF2\u963B\u65AD\uFF08\u9632\u5185\u5B58\u62D6\u57AE\uFF1B\u53EF\u8C03 undoMaxBytesPerOp\uFF09`);
7794
7870
  }
7795
7871
  const content = await fs21.readFile(absPath);
7796
- const contentPath = path24.join(undoDir, "content");
7872
+ const contentPath = path25.join(undoDir, "content");
7797
7873
  await fs21.writeFile(contentPath, content, { mode: 384 });
7798
7874
  return {
7799
7875
  ...common,
@@ -7845,8 +7921,8 @@ var init_backup = __esm({
7845
7921
  }
7846
7922
  entries.sort((a, b) => a.name.localeCompare(b.name));
7847
7923
  for (const e of entries) {
7848
- const full = path24.join(d, e.name);
7849
- const rel = path24.relative(dir, full).replace(/\\/g, "/");
7924
+ const full = path25.join(d, e.name);
7925
+ const rel = path25.relative(dir, full).replace(/\\/g, "/");
7850
7926
  if (e.isDirectory()) {
7851
7927
  h.update(`D ${rel}
7852
7928
  `);
@@ -7872,7 +7948,7 @@ var init_backup = __esm({
7872
7948
  return 0;
7873
7949
  }
7874
7950
  for (const e of entries) {
7875
- const full = path24.join(dir, e.name);
7951
+ const full = path25.join(dir, e.name);
7876
7952
  if (e.isDirectory()) total += await getDirTreeBytes(full);
7877
7953
  else if (e.isFile()) {
7878
7954
  try {
@@ -7893,11 +7969,11 @@ var init_backup = __esm({
7893
7969
  return;
7894
7970
  }
7895
7971
  for (const e of entries) {
7896
- const full = path24.join(d, e.name);
7972
+ const full = path25.join(d, e.name);
7897
7973
  if (e.isDirectory()) {
7898
7974
  await walk(full);
7899
7975
  } else if (e.isFile()) {
7900
- const relWithin = path24.relative(dir, full).replace(/\\/g, "/");
7976
+ const relWithin = path25.relative(dir, full).replace(/\\/g, "/");
7901
7977
  if (isSensitivePath(`${wsRelDir}/${relWithin}`)) found.push(relWithin);
7902
7978
  }
7903
7979
  }
@@ -7910,7 +7986,7 @@ var init_backup = __esm({
7910
7986
 
7911
7987
  // ../core/src/tool/undo/restore.ts
7912
7988
  import fs22 from "fs/promises";
7913
- import path25 from "path";
7989
+ import path26 from "path";
7914
7990
  import crypto2 from "crypto";
7915
7991
  async function doRestore(target, sessionId) {
7916
7992
  if (target.backupKind === "directory_tree") {
@@ -7968,16 +8044,16 @@ async function ensureReverseBackup(target, sessionId) {
7968
8044
  }
7969
8045
  }
7970
8046
  const reverseId = createUUID();
7971
- const reverseDir = path25.join(getUndoBackupRoot(sessionId), reverseId);
8047
+ const reverseDir = path26.join(getUndoBackupRoot(sessionId), reverseId);
7972
8048
  await fs22.mkdir(reverseDir, { recursive: true, mode: 448 });
7973
8049
  assertWithinWorkspace(absPath);
7974
8050
  const st = await fs22.stat(absPath);
7975
8051
  if (st.isDirectory()) {
7976
- const dest2 = path25.join(reverseDir, "tree");
8052
+ const dest2 = path26.join(reverseDir, "tree");
7977
8053
  await fs22.cp(absPath, dest2, { recursive: true, force: true, preserveTimestamps: true });
7978
8054
  return { reverseId, backupKind: "directory_tree", backupPath: dest2 };
7979
8055
  }
7980
- const dest = path25.join(reverseDir, "content");
8056
+ const dest = path26.join(reverseDir, "content");
7981
8057
  await fs22.writeFile(dest, await fs22.readFile(absPath));
7982
8058
  return { reverseId, backupKind: "file_content", backupPath: dest };
7983
8059
  }
@@ -7990,15 +8066,15 @@ async function dispatchRestore(r) {
7990
8066
  return `\u5DF2\u5220\u9664\u65B0\u5EFA\u6587\u4EF6 [${r.relativePath}]`;
7991
8067
  }
7992
8068
  case "file_content": {
7993
- await fs22.mkdir(path25.dirname(absPath), { recursive: true });
7994
- const backupAbs = path25.join(getUndoBackupRoot(r.sessionId), r.undoId, "content");
8069
+ await fs22.mkdir(path26.dirname(absPath), { recursive: true });
8070
+ const backupAbs = path26.join(getUndoBackupRoot(r.sessionId), r.undoId, "content");
7995
8071
  const content = await fs22.readFile(backupAbs);
7996
8072
  await fs22.writeFile(absPath, content);
7997
8073
  return `\u5DF2\u6062\u590D [${r.relativePath}] \u81F3\u5907\u4EFD\u524D\u5185\u5BB9\uFF08${r.fileSizeBefore ?? content.byteLength} \u5B57\u8282\uFF09`;
7998
8074
  }
7999
8075
  case "directory_tree": {
8000
- await fs22.mkdir(path25.dirname(absPath), { recursive: true });
8001
- const src = path25.join(getUndoBackupRoot(r.sessionId), r.undoId, "tree");
8076
+ await fs22.mkdir(path26.dirname(absPath), { recursive: true });
8077
+ const src = path26.join(getUndoBackupRoot(r.sessionId), r.undoId, "tree");
8002
8078
  await fs22.cp(src, absPath, { recursive: true, force: true, preserveTimestamps: true });
8003
8079
  return `\u5DF2\u6062\u590D\u76EE\u5F55\u6811 [${r.relativePath}]\uFF08\u7EA6 ${r.fileSizeBefore ?? 0} \u5B57\u8282\uFF09`;
8004
8080
  }
@@ -8482,7 +8558,7 @@ var init_frontmatter = __esm({
8482
8558
 
8483
8559
  // ../core/src/memory/loader.ts
8484
8560
  import fs24 from "fs/promises";
8485
- import path26 from "path";
8561
+ import path27 from "path";
8486
8562
  var GLOBAL_MEMORY_DIR, SOURCES, VALID_TYPES, parseMemoryAt, loadMemories, initMemories;
8487
8563
  var init_loader3 = __esm({
8488
8564
  "../core/src/memory/loader.ts"() {
@@ -8491,10 +8567,10 @@ var init_loader3 = __esm({
8491
8567
  init_frontmatter();
8492
8568
  init_registry6();
8493
8569
  init_registry2();
8494
- GLOBAL_MEMORY_DIR = path26.join(appConfig.dataDir, "memory");
8570
+ GLOBAL_MEMORY_DIR = path27.join(appConfig.dataDir, "memory");
8495
8571
  SOURCES = [
8496
8572
  { dir: GLOBAL_MEMORY_DIR, source: "global" },
8497
- { dir: path26.join(process.cwd(), ".deepseeker-code", "memory"), source: "project" }
8573
+ { dir: path27.join(process.cwd(), ".deepseeker-code", "memory"), source: "project" }
8498
8574
  ];
8499
8575
  VALID_TYPES = ["user", "feedback", "project", "reference"];
8500
8576
  parseMemoryAt = async (file, _dir, source) => {
@@ -8534,7 +8610,7 @@ var init_loader3 = __esm({
8534
8610
  clearMemories();
8535
8611
  const picked = await scanSources(
8536
8612
  filterSources(SOURCES, includeProject),
8537
- (e, dir) => e.isFile() && e.name.endsWith(".md") ? path26.join(dir, e.name) : void 0,
8613
+ (e, dir) => e.isFile() && e.name.endsWith(".md") ? path27.join(dir, e.name) : void 0,
8538
8614
  parseMemoryAt
8539
8615
  );
8540
8616
  for (const { item } of picked) registerMemory(item);
@@ -8553,7 +8629,7 @@ var init_loader3 = __esm({
8553
8629
 
8554
8630
  // ../core/src/tool/registry/memory.ts
8555
8631
  import fs25 from "fs/promises";
8556
- import path27 from "path";
8632
+ import path28 from "path";
8557
8633
  var MAX_BODY_BYTES, NAME_RE, VALID_TYPES2, memoryFilePath, sanitizeLine, buildMemoryMd, writeAndRegister, memoryTools;
8558
8634
  var init_memory = __esm({
8559
8635
  "../core/src/tool/registry/memory.ts"() {
@@ -8565,7 +8641,7 @@ var init_memory = __esm({
8565
8641
  MAX_BODY_BYTES = 64 * 1024;
8566
8642
  NAME_RE = /^[a-z0-9-]+$/;
8567
8643
  VALID_TYPES2 = ["user", "feedback", "project", "reference"];
8568
- memoryFilePath = (name, project) => project ? path27.join(process.cwd(), ".deepseeker-code", "memory", `${name}.md`) : path27.join(GLOBAL_MEMORY_DIR, `${name}.md`);
8644
+ memoryFilePath = (name, project) => project ? path28.join(process.cwd(), ".deepseeker-code", "memory", `${name}.md`) : path28.join(GLOBAL_MEMORY_DIR, `${name}.md`);
8569
8645
  sanitizeLine = (s) => String(s ?? "").replace(/[\r\n]+/g, " ").trim();
8570
8646
  buildMemoryMd = (name, description, type, body) => `---
8571
8647
  name: ${name}
@@ -8577,7 +8653,7 @@ ${body.trim()}
8577
8653
  `;
8578
8654
  writeAndRegister = async (name, description, type, body, project) => {
8579
8655
  const file = memoryFilePath(name, project);
8580
- await fs25.mkdir(path27.dirname(file), { recursive: true });
8656
+ await fs25.mkdir(path28.dirname(file), { recursive: true });
8581
8657
  const tmp = makeTmpPath(file);
8582
8658
  await fs25.writeFile(tmp, buildMemoryMd(name, description, type, body), "utf-8");
8583
8659
  await fs25.rename(tmp, file);
@@ -9117,7 +9193,7 @@ var init_backgroundTool = __esm({
9117
9193
  });
9118
9194
 
9119
9195
  // ../core/src/tool/autoPermission.ts
9120
- import path28 from "path";
9196
+ import path29 from "path";
9121
9197
  var AUTO_SCOPE, AUTO_DEFAULT_EXTRA, AUTO_AGGRESSIVE_EXTRA, isMcpTool, BUILTIN_AUTO_DENY, matchBuiltinDeny, COMMAND_DENY, matchCommandDeny, hasShellMetachars, READONLY_HEADS, hasWriteModifier, SENSITIVE_FILE_ARG_RE, hasSensitiveFileArg, isReadOnlyCommand, isWithinWorkspace, runAutoCheck;
9122
9198
  var init_autoPermission = __esm({
9123
9199
  "../core/src/tool/autoPermission.ts"() {
@@ -9252,9 +9328,9 @@ var init_autoPermission = __esm({
9252
9328
  isWithinWorkspace = (p, cwd) => {
9253
9329
  if (!p || !cwd) return false;
9254
9330
  try {
9255
- const abs = path28.isAbsolute(p) ? p : path28.resolve(cwd, p);
9256
- const rel = path28.relative(cwd, abs);
9257
- return rel === "" || !rel.startsWith("..") && !path28.isAbsolute(rel);
9331
+ const abs = path29.isAbsolute(p) ? p : path29.resolve(cwd, p);
9332
+ const rel = path29.relative(cwd, abs);
9333
+ return rel === "" || !rel.startsWith("..") && !path29.isAbsolute(rel);
9258
9334
  } catch {
9259
9335
  return false;
9260
9336
  }
@@ -10546,7 +10622,7 @@ var init_subagent = __esm({
10546
10622
 
10547
10623
  // ../core/src/hooks/loader.ts
10548
10624
  import fs27 from "fs/promises";
10549
- import path29 from "path";
10625
+ import path30 from "path";
10550
10626
  var readHooksConfig, appendValidated, validateRule, parseStdoutDecision, parseAgentDecision, compileRule2, loadHooks, initHooks;
10551
10627
  var init_loader4 = __esm({
10552
10628
  "../core/src/hooks/loader.ts"() {
@@ -10561,9 +10637,9 @@ var init_loader4 = __esm({
10561
10637
  readHooksConfig = async (includeProject) => {
10562
10638
  const merged = {};
10563
10639
  const paths = [
10564
- path29.join(appConfig.dataDir, "settings.json"),
10640
+ path30.join(appConfig.dataDir, "settings.json"),
10565
10641
  // 全局用户级
10566
- ...includeProject ? [path29.join(process.cwd(), ".deepseeker-code", "settings.json")] : []
10642
+ ...includeProject ? [path30.join(process.cwd(), ".deepseeker-code", "settings.json")] : []
10567
10643
  // 项目级(叠加);未信任时省略
10568
10644
  ];
10569
10645
  for (const configPath of paths) {
@@ -10900,8 +10976,8 @@ ${m.context}`;
10900
10976
 
10901
10977
  // ../core/src/skills/loader.ts
10902
10978
  import fs28 from "fs/promises";
10903
- import path30 from "path";
10904
- import { fileURLToPath } from "url";
10979
+ import path31 from "path";
10980
+ import { fileURLToPath as fileURLToPath2 } from "url";
10905
10981
  var BUILTIN_DIR, SOURCES2, MAX_SKILL_BODY_BYTES, splitList, parseSkillAt, loadSkills, initSkills;
10906
10982
  var init_loader5 = __esm({
10907
10983
  "../core/src/skills/loader.ts"() {
@@ -10911,11 +10987,11 @@ var init_loader5 = __esm({
10911
10987
  init_registry3();
10912
10988
  init_skill();
10913
10989
  init_registry2();
10914
- BUILTIN_DIR = path30.join(path30.dirname(fileURLToPath(import.meta.url)), "builtin");
10990
+ BUILTIN_DIR = path31.join(path31.dirname(fileURLToPath2(import.meta.url)), "builtin");
10915
10991
  SOURCES2 = [
10916
10992
  { dir: BUILTIN_DIR, source: "builtin" },
10917
- { dir: path30.join(appConfig.dataDir, "skills"), source: "global" },
10918
- { dir: path30.join(process.cwd(), ".deepseeker-code", "skills"), source: "project" }
10993
+ { dir: path31.join(appConfig.dataDir, "skills"), source: "global" },
10994
+ { dir: path31.join(process.cwd(), ".deepseeker-code", "skills"), source: "project" }
10919
10995
  ];
10920
10996
  MAX_SKILL_BODY_BYTES = 64 * 1024;
10921
10997
  splitList = (raw) => (raw ?? "").split(",").map((s) => s.trim()).filter(Boolean);
@@ -10961,7 +11037,7 @@ var init_loader5 = __esm({
10961
11037
  loadSkills = async (includeProject) => {
10962
11038
  const picked = await scanSources(
10963
11039
  filterSources(SOURCES2, includeProject),
10964
- (e, dir) => e.isDirectory() ? path30.join(dir, e.name, "SKILL.md") : void 0,
11040
+ (e, dir) => e.isDirectory() ? path31.join(dir, e.name, "SKILL.md") : void 0,
10965
11041
  parseSkillAt
10966
11042
  );
10967
11043
  for (const { item } of picked) registerSkill(item);
@@ -10993,8 +11069,8 @@ var init_loader5 = __esm({
10993
11069
 
10994
11070
  // ../core/src/agents/loader.ts
10995
11071
  import fs29 from "fs/promises";
10996
- import path31 from "path";
10997
- import { fileURLToPath as fileURLToPath2 } from "url";
11072
+ import path32 from "path";
11073
+ import { fileURLToPath as fileURLToPath3 } from "url";
10998
11074
  var BUILTIN_DIR2, SOURCES3, parseAgentAt, initAgents;
10999
11075
  var init_loader6 = __esm({
11000
11076
  "../core/src/agents/loader.ts"() {
@@ -11003,11 +11079,11 @@ var init_loader6 = __esm({
11003
11079
  init_frontmatter();
11004
11080
  init_registry4();
11005
11081
  init_registry2();
11006
- BUILTIN_DIR2 = path31.join(path31.dirname(fileURLToPath2(import.meta.url)), "builtin");
11082
+ BUILTIN_DIR2 = path32.join(path32.dirname(fileURLToPath3(import.meta.url)), "builtin");
11007
11083
  SOURCES3 = [
11008
11084
  { dir: BUILTIN_DIR2, source: "builtin" },
11009
- { dir: path31.join(appConfig.dataDir, "agents"), source: "global" },
11010
- { dir: path31.join(process.cwd(), ".deepseeker-code", "agents"), source: "project" }
11085
+ { dir: path32.join(appConfig.dataDir, "agents"), source: "global" },
11086
+ { dir: path32.join(process.cwd(), ".deepseeker-code", "agents"), source: "project" }
11011
11087
  ];
11012
11088
  parseAgentAt = async (file, dir, source) => {
11013
11089
  let raw;
@@ -11047,7 +11123,7 @@ var init_loader6 = __esm({
11047
11123
  const known = new Set(into.map((t) => t.function.name));
11048
11124
  const picked = await scanSources(
11049
11125
  filterSources(SOURCES3, includeProject),
11050
- (e, dir) => e.isFile() && e.name.endsWith(".agent.md") ? path31.join(dir, e.name) : void 0,
11126
+ (e, dir) => e.isFile() && e.name.endsWith(".agent.md") ? path32.join(dir, e.name) : void 0,
11051
11127
  parseAgentAt
11052
11128
  );
11053
11129
  for (const { item: m, file, source } of picked) {
@@ -11085,8 +11161,8 @@ var init_registry7 = __esm({
11085
11161
 
11086
11162
  // ../core/src/commands/loader.ts
11087
11163
  import fs30 from "fs/promises";
11088
- import path32 from "path";
11089
- import { fileURLToPath as fileURLToPath3 } from "url";
11164
+ import path33 from "path";
11165
+ import { fileURLToPath as fileURLToPath4 } from "url";
11090
11166
  var BUILTIN_DIR3, SOURCES4, MAX_COMMAND_BODY_BYTES, parseCommandAt, loadCommands, initCommands;
11091
11167
  var init_loader7 = __esm({
11092
11168
  "../core/src/commands/loader.ts"() {
@@ -11095,11 +11171,11 @@ var init_loader7 = __esm({
11095
11171
  init_frontmatter();
11096
11172
  init_registry7();
11097
11173
  init_registry2();
11098
- BUILTIN_DIR3 = path32.join(path32.dirname(fileURLToPath3(import.meta.url)), "builtin");
11174
+ BUILTIN_DIR3 = path33.join(path33.dirname(fileURLToPath4(import.meta.url)), "builtin");
11099
11175
  SOURCES4 = [
11100
11176
  { dir: BUILTIN_DIR3, source: "builtin" },
11101
- { dir: path32.join(appConfig.dataDir, "commands"), source: "global" },
11102
- { dir: path32.join(process.cwd(), ".deepseeker-code", "commands"), source: "project" }
11177
+ { dir: path33.join(appConfig.dataDir, "commands"), source: "global" },
11178
+ { dir: path33.join(process.cwd(), ".deepseeker-code", "commands"), source: "project" }
11103
11179
  ];
11104
11180
  MAX_COMMAND_BODY_BYTES = 64 * 1024;
11105
11181
  parseCommandAt = async (file, _dir, source) => {
@@ -11116,7 +11192,7 @@ var init_loader7 = __esm({
11116
11192
  }
11117
11193
  const name = parsed.frontmatter.name;
11118
11194
  const description = parsed.frontmatter.description;
11119
- const fallbackName = path32.basename(file, ".md");
11195
+ const fallbackName = path33.basename(file, ".md");
11120
11196
  const finalName = name || fallbackName;
11121
11197
  if (!description) {
11122
11198
  console.warn(`\u26A0\uFE0F [commands] \u7F3A\u5C11 description\uFF08${file}\uFF09\uFF0C\u5DF2\u8DF3\u8FC7`);
@@ -11142,7 +11218,7 @@ var init_loader7 = __esm({
11142
11218
  loadCommands = async (includeProject) => {
11143
11219
  const picked = await scanSources(
11144
11220
  filterSources(SOURCES4, includeProject),
11145
- (e, dir) => e.isFile() && e.name.endsWith(".md") ? path32.join(dir, e.name) : void 0,
11221
+ (e, dir) => e.isFile() && e.name.endsWith(".md") ? path33.join(dir, e.name) : void 0,
11146
11222
  parseCommandAt
11147
11223
  );
11148
11224
  for (const { item } of picked) registerCommand(item);
@@ -11161,8 +11237,8 @@ var init_loader7 = __esm({
11161
11237
 
11162
11238
  // ../core/src/outputStyles/loader.ts
11163
11239
  import fs31 from "fs/promises";
11164
- import path33 from "path";
11165
- import { fileURLToPath as fileURLToPath4 } from "url";
11240
+ import path34 from "path";
11241
+ import { fileURLToPath as fileURLToPath5 } from "url";
11166
11242
  var BUILTIN_DIR4, MAX_STYLE_BODY_BYTES, SOURCES5, parseStyleAt, loadOutputStyles, initOutputStyles;
11167
11243
  var init_loader8 = __esm({
11168
11244
  "../core/src/outputStyles/loader.ts"() {
@@ -11171,12 +11247,12 @@ var init_loader8 = __esm({
11171
11247
  init_frontmatter();
11172
11248
  init_registry5();
11173
11249
  init_registry2();
11174
- BUILTIN_DIR4 = path33.join(path33.dirname(fileURLToPath4(import.meta.url)), "builtin");
11250
+ BUILTIN_DIR4 = path34.join(path34.dirname(fileURLToPath5(import.meta.url)), "builtin");
11175
11251
  MAX_STYLE_BODY_BYTES = 64 * 1024;
11176
11252
  SOURCES5 = [
11177
11253
  { dir: BUILTIN_DIR4, source: "builtin" },
11178
- { dir: path33.join(appConfig.dataDir, "output-styles"), source: "global" },
11179
- { dir: path33.join(process.cwd(), ".deepseeker-code", "output-styles"), source: "project" }
11254
+ { dir: path34.join(appConfig.dataDir, "output-styles"), source: "global" },
11255
+ { dir: path34.join(process.cwd(), ".deepseeker-code", "output-styles"), source: "project" }
11180
11256
  ];
11181
11257
  parseStyleAt = async (file, _dir, source) => {
11182
11258
  let raw;
@@ -11213,7 +11289,7 @@ var init_loader8 = __esm({
11213
11289
  loadOutputStyles = async (includeProject) => {
11214
11290
  const picked = await scanSources(
11215
11291
  filterSources(SOURCES5, includeProject),
11216
- (e, dir) => e.isFile() && e.name.endsWith(".md") ? path33.join(dir, e.name) : void 0,
11292
+ (e, dir) => e.isFile() && e.name.endsWith(".md") ? path34.join(dir, e.name) : void 0,
11217
11293
  parseStyleAt
11218
11294
  );
11219
11295
  for (const { item } of picked) registerOutputStyle(item);
@@ -11295,7 +11371,7 @@ var init_bootstrap = __esm({
11295
11371
 
11296
11372
  // ../core/src/statusLine/config.ts
11297
11373
  import fs32 from "fs/promises";
11298
- import path34 from "path";
11374
+ import path35 from "path";
11299
11375
  var parseBlock, readStatusLineConfig;
11300
11376
  var init_config2 = __esm({
11301
11377
  "../core/src/statusLine/config.ts"() {
@@ -11311,9 +11387,9 @@ var init_config2 = __esm({
11311
11387
  };
11312
11388
  readStatusLineConfig = async (includeProject) => {
11313
11389
  const paths = [
11314
- path34.join(appConfig.dataDir, "settings.json"),
11390
+ path35.join(appConfig.dataDir, "settings.json"),
11315
11391
  // 全局用户级
11316
- ...includeProject ? [path34.join(process.cwd(), ".deepseeker-code", "settings.json")] : []
11392
+ ...includeProject ? [path35.join(process.cwd(), ".deepseeker-code", "settings.json")] : []
11317
11393
  // 项目级(覆盖);未信任时省略
11318
11394
  ];
11319
11395
  let result = null;
@@ -11341,8 +11417,8 @@ var init_config2 = __esm({
11341
11417
  // ../core/src/statusLine/runner.ts
11342
11418
  import { spawn as spawn5 } from "child_process";
11343
11419
  import fs33 from "fs";
11344
- import path35 from "path";
11345
- import { fileURLToPath as fileURLToPath5 } from "url";
11420
+ import path36 from "path";
11421
+ import { fileURLToPath as fileURLToPath6 } from "url";
11346
11422
  var STATUSLINE_TIMEOUT_MS, cachedVersion, runStatusLine;
11347
11423
  var init_runner = __esm({
11348
11424
  "../core/src/statusLine/runner.ts"() {
@@ -11350,11 +11426,11 @@ var init_runner = __esm({
11350
11426
  init_guard();
11351
11427
  STATUSLINE_TIMEOUT_MS = 3e3;
11352
11428
  try {
11353
- const here = path35.dirname(fileURLToPath5(import.meta.url));
11429
+ const here = path36.dirname(fileURLToPath6(import.meta.url));
11354
11430
  const candidates = [
11355
- path35.join(here, "../../../package.json"),
11431
+ path36.join(here, "../../../package.json"),
11356
11432
  // src/core/package.json
11357
- path35.join(here, "../../../../package.json")
11433
+ path36.join(here, "../../../../package.json")
11358
11434
  // 仓库根 package.json
11359
11435
  ];
11360
11436
  for (const p of candidates) {
@@ -11418,7 +11494,7 @@ var init_createModel = __esm({
11418
11494
  });
11419
11495
 
11420
11496
  // ../core/src/observability/store.ts
11421
- import path36 from "path";
11497
+ import path37 from "path";
11422
11498
  import fs34 from "fs/promises";
11423
11499
  var getTraceDirPath, getTracePath, tracePathCache, ensuredTraceDirs, ensureTraceDir, getGlobalClockPath, getTraceStorePath;
11424
11500
  var init_store3 = __esm({
@@ -11429,10 +11505,10 @@ var init_store3 = __esm({
11429
11505
  init_common();
11430
11506
  getTraceDirPath = (mainTraceId) => {
11431
11507
  assertSafeSessionId(mainTraceId, "traceId");
11432
- return path36.join(appConfig.dataDir, "trace", appConfig.userWorkspaceDir, getFileName(mainTraceId));
11508
+ return path37.join(appConfig.dataDir, "trace", appConfig.userWorkspaceDir, getFileName(mainTraceId));
11433
11509
  };
11434
11510
  getTracePath = () => {
11435
- return path36.join(appConfig.dataDir, "trace");
11511
+ return path37.join(appConfig.dataDir, "trace");
11436
11512
  };
11437
11513
  tracePathCache = /* @__PURE__ */ new Map();
11438
11514
  ensuredTraceDirs = /* @__PURE__ */ new Set();
@@ -11443,7 +11519,7 @@ var init_store3 = __esm({
11443
11519
  ensuredTraceDirs.add(dir);
11444
11520
  };
11445
11521
  getGlobalClockPath = () => {
11446
- return path36.join(getTracePath(), "trace-cleanup-clock.json");
11522
+ return path37.join(getTracePath(), "trace-cleanup-clock.json");
11447
11523
  };
11448
11524
  getTraceStorePath = async (mainTraceId) => {
11449
11525
  assertSafeSessionId(mainTraceId, "traceId");
@@ -11461,7 +11537,7 @@ var init_store3 = __esm({
11461
11537
  const todayStr = getTodayDateString();
11462
11538
  fileName = `trace-${todayStr}__${rootId}.jsonl`;
11463
11539
  }
11464
- const resolved = path36.join(dir, fileName);
11540
+ const resolved = path37.join(dir, fileName);
11465
11541
  tracePathCache.set(rootId, resolved);
11466
11542
  return resolved;
11467
11543
  };
@@ -11470,7 +11546,7 @@ var init_store3 = __esm({
11470
11546
 
11471
11547
  // ../core/src/observability/trace.ts
11472
11548
  import fs35 from "fs/promises";
11473
- import path37 from "path";
11549
+ import path38 from "path";
11474
11550
  async function emitTrace(base) {
11475
11551
  const event = {
11476
11552
  sessionId: base.sessionId,
@@ -11524,7 +11600,7 @@ async function maybeCleanupAfterAppend(sessionId) {
11524
11600
  lastSizeCleanupAt2 = now;
11525
11601
  diskLastCleanupAt2 = now;
11526
11602
  const clockPath = getGlobalClockPath();
11527
- await fs35.mkdir(path37.dirname(clockPath), { recursive: true });
11603
+ await fs35.mkdir(path38.dirname(clockPath), { recursive: true });
11528
11604
  await fs35.writeFile(clockPath, JSON.stringify({ lastCleanupAt: now, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), "utf-8");
11529
11605
  if (deletedCount > 0) {
11530
11606
  console.log(`\u2728 [Trace\u8FD0\u7EF4] \u5171\u9500\u6BC1 ${deletedCount} \u4E2A\u4F1A\u8BDD\u65E5\u5FD7\uFF08\u8F6F\u89C4\u5219\u8FC7\u671F\u6E05\u7406 + \u5BB9\u91CF\u786C\u9A71\u9010\uFF09\uFF0C\u78C1\u76D8\u6C34\u4F4D\u56DE\u843D\u3002`);
@@ -11551,12 +11627,12 @@ async function cleanupOldTraceFiles() {
11551
11627
  }
11552
11628
  const re = /^trace-(\d{4}-\d{2}-\d{2})__([\w-]+)\.jsonl$/;
11553
11629
  for (const relativePath of relativePaths) {
11554
- const fileName = path37.basename(relativePath);
11630
+ const fileName = path38.basename(relativePath);
11555
11631
  const m = fileName.match(re);
11556
11632
  if (!m) continue;
11557
11633
  const fileBornDay = /* @__PURE__ */ new Date(`${m[1]}T00:00:00`);
11558
11634
  if (fileBornDay >= cutoff) continue;
11559
- const fullPath = path37.join(dir, relativePath);
11635
+ const fullPath = path38.join(dir, relativePath);
11560
11636
  try {
11561
11637
  const st = await fs35.stat(fullPath);
11562
11638
  if (now - st.mtimeMs < ACTIVE_GRACE_MS2) continue;
@@ -11578,11 +11654,11 @@ async function evictOldestForSize2(targetBytes) {
11578
11654
  const re = /^trace-(\d{4}-\d{2}-\d{2})__([\w-]+)\.jsonl$/;
11579
11655
  const candidates = [];
11580
11656
  for (const relativePath of relativePaths) {
11581
- const fileName = path37.basename(relativePath);
11657
+ const fileName = path38.basename(relativePath);
11582
11658
  if (!re.test(fileName)) continue;
11583
11659
  try {
11584
- const st = await fs35.stat(path37.join(dir, relativePath));
11585
- candidates.push({ mtime: st.mtimeMs, fullPath: path37.join(dir, relativePath), size: st.size });
11660
+ const st = await fs35.stat(path38.join(dir, relativePath));
11661
+ candidates.push({ mtime: st.mtimeMs, fullPath: path38.join(dir, relativePath), size: st.size });
11586
11662
  } catch {
11587
11663
  }
11588
11664
  }
@@ -11769,7 +11845,7 @@ ${PLAN_MODE_AUTO_ENTER_HINT}
11769
11845
  });
11770
11846
 
11771
11847
  // ../core/src/serve/chatProcessing.ts
11772
- import path38 from "path";
11848
+ import path39 from "path";
11773
11849
  import fs36 from "fs";
11774
11850
  var handleUnifiedChat;
11775
11851
  var init_chatProcessing = __esm({
@@ -11827,14 +11903,14 @@ ${inject}`;
11827
11903
  activeReal = fs36.realpathSync(activeReal);
11828
11904
  } catch {
11829
11905
  }
11830
- const lines = roots.map((r) => `- ${path38.basename(r) || r}: ${r}${r === activeReal ? "\uFF08\u9ED8\u8BA4\u6839\uFF1A\u76F8\u5BF9\u8DEF\u5F84/\u547D\u4EE4\u57FA\u51C6\uFF09" : "\uFF08\u53EF\u76F4\u63A5\u8BFB\u5199\uFF09"}`);
11906
+ const lines = roots.map((r) => `- ${path39.basename(r) || r}: ${r}${r === activeReal ? "\uFF08\u9ED8\u8BA4\u6839\uFF1A\u76F8\u5BF9\u8DEF\u5F84/\u547D\u4EE4\u57FA\u51C6\uFF09" : "\uFF08\u53EF\u76F4\u63A5\u8BFB\u5199\uFF09"}`);
11831
11907
  sysPrompt = sysPrompt + `
11832
11908
 
11833
11909
  \u3010\u5DE5\u4F5C\u533A\uFF08\u591A\u9879\u76EE\uFF09\u3011
11834
11910
  \u65E0\u9700\u5207\u6362\u9879\u76EE\uFF0C\u4EE5\u4E0B\u6240\u6709\u6839\u90FD\u53EF\u76F4\u63A5\u7528\u7EDD\u5BF9\u8DEF\u5F84\u8BBF\u95EE\uFF1B\u8DE8\u9879\u76EE\u7528\u7EDD\u5BF9\u8DEF\u5F84\u6216\u76F8\u5BF9\u9ED8\u8BA4\u6839\u7684 ../<\u5144\u5F1F\u76EE\u5F55>:
11835
11911
  ${lines.join("\n")}
11836
- \u2605 \u8DEF\u5F84\u951A\u5B9A\u94C1\u5F8B\uFF1A\u5DE5\u5177\u7F3A\u7701\u53EA\u4F5C\u7528\u4E8E\u9ED8\u8BA4\u6839\uFF08${path38.basename(activeReal) || activeReal} = IDE \u5934\u90E8\u6240\u793A\u6839\uFF09\u3002\u5F53\u7528\u6237\u5728\u5BF9\u8BDD\u4E2D\u6307\u660E\u4E86\u67D0\u4E2A\u9879\u76EE\uFF08\u5982\u300C\u5728 A \u9879\u76EE\u300D\u300C\u6539\u524D\u7AEF\u7684 xxx\u300D\u300C\u641C\u540E\u7AEF\u300D\uFF09\uFF0C\u8BE5\u8F6E\u6240\u6709\u5E26 path \u53C2\u6570\u7684\u5DE5\u5177\u8C03\u7528\uFF08read_file / edit_file / search_grep / glob / list_dir / read_xlsx / read_docx \u7B49\uFF09\u5FC5\u987B\u628A\u5BF9\u5E94\u9879\u76EE\u6839\u4F5C\u4E3A path \u4F20\u5165\uFF08\u7EDD\u5BF9\u8DEF\u5F84\u3001../<\u5144\u5F1F\u76EE\u5F55>\u3001\u6216\u9879\u76EE\u76EE\u5F55\u540D\uFF09\uFF0C\u5426\u5219\u53EA\u4F1A\u8BFB\u5199/\u641C\u7D22\u9ED8\u8BA4\u6839\uFF0C\u4E0E\u7528\u6237\u610F\u56FE\u4E0D\u7B26\u3002
11837
- \u6CE8\u610F\uFF1A\u9879\u76EE\u7EA7\u914D\u7F6E\uFF08.deepseeker-code/\uFF09\u4EC5\u5728\u9ED8\u8BA4\u6839 ${path38.basename(activeReal) || activeReal} \u751F\u6548\u3002`;
11912
+ \u2605 \u8DEF\u5F84\u951A\u5B9A\u94C1\u5F8B\uFF1A\u5DE5\u5177\u7F3A\u7701\u53EA\u4F5C\u7528\u4E8E\u9ED8\u8BA4\u6839\uFF08${path39.basename(activeReal) || activeReal} = IDE \u5934\u90E8\u6240\u793A\u6839\uFF09\u3002\u5F53\u7528\u6237\u5728\u5BF9\u8BDD\u4E2D\u6307\u660E\u4E86\u67D0\u4E2A\u9879\u76EE\uFF08\u5982\u300C\u5728 A \u9879\u76EE\u300D\u300C\u6539\u524D\u7AEF\u7684 xxx\u300D\u300C\u641C\u540E\u7AEF\u300D\uFF09\uFF0C\u8BE5\u8F6E\u6240\u6709\u5E26 path \u53C2\u6570\u7684\u5DE5\u5177\u8C03\u7528\uFF08read_file / edit_file / search_grep / glob / list_dir / read_xlsx / read_docx \u7B49\uFF09\u5FC5\u987B\u628A\u5BF9\u5E94\u9879\u76EE\u6839\u4F5C\u4E3A path \u4F20\u5165\uFF08\u7EDD\u5BF9\u8DEF\u5F84\u3001../<\u5144\u5F1F\u76EE\u5F55>\u3001\u6216\u9879\u76EE\u76EE\u5F55\u540D\uFF09\uFF0C\u5426\u5219\u53EA\u4F1A\u8BFB\u5199/\u641C\u7D22\u9ED8\u8BA4\u6839\uFF0C\u4E0E\u7528\u6237\u610F\u56FE\u4E0D\u7B26\u3002
11913
+ \u6CE8\u610F\uFF1A\u9879\u76EE\u7EA7\u914D\u7F6E\uFF08.deepseeker-code/\uFF09\u4EC5\u5728\u9ED8\u8BA4\u6839 ${path39.basename(activeReal) || activeReal} \u751F\u6548\u3002`;
11838
11914
  }
11839
11915
  let replyText = "";
11840
11916
  try {
@@ -14412,81 +14488,6 @@ ${listText}`);
14412
14488
  }
14413
14489
  });
14414
14490
 
14415
- // src/updateCheck.ts
14416
- var updateCheck_exports = {};
14417
- __export(updateCheck_exports, {
14418
- getCachedLatestIfNewer: () => getCachedLatestIfNewer,
14419
- readLocalVersion: () => readLocalVersion,
14420
- refreshUpdateCache: () => refreshUpdateCache
14421
- });
14422
- import { readFileSync as readFileSync4, writeFileSync, mkdirSync } from "node:fs";
14423
- import path39 from "node:path";
14424
- import os4 from "os";
14425
- import { fileURLToPath as fileURLToPath6 } from "node:url";
14426
- var PKG_NAME, REGISTRY, CACHE_TTL_MS, FETCH_TIMEOUT_MS2, cacheFile, readLocalVersion, parseSemver, compareVersion, readCache, writeCache, getCachedLatestIfNewer, refreshUpdateCache;
14427
- var init_updateCheck = __esm({
14428
- "src/updateCheck.ts"() {
14429
- "use strict";
14430
- PKG_NAME = "deepseeker-code";
14431
- REGISTRY = "https://registry.npmjs.org";
14432
- CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
14433
- FETCH_TIMEOUT_MS2 = 3e3;
14434
- cacheFile = () => path39.join(os4.homedir(), ".deepseeker-code", "update-check.json");
14435
- readLocalVersion = () => {
14436
- try {
14437
- const here = path39.dirname(fileURLToPath6(import.meta.url));
14438
- return JSON.parse(readFileSync4(path39.join(here, "..", "package.json"), "utf8")).version ?? "0.0.0";
14439
- } catch {
14440
- return "0.0.0";
14441
- }
14442
- };
14443
- parseSemver = (v) => {
14444
- const m = String(v ?? "").match(/^(\d+)\.(\d+)\.(\d+)/);
14445
- return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : [0, 0, 0];
14446
- };
14447
- compareVersion = (a, b) => {
14448
- const [a1, a2, a3] = parseSemver(a);
14449
- const [b1, b2, b3] = parseSemver(b);
14450
- return a1 - b1 || a2 - b2 || a3 - b3;
14451
- };
14452
- readCache = () => {
14453
- try {
14454
- const obj = JSON.parse(readFileSync4(cacheFile(), "utf8"));
14455
- return typeof obj.latestVersion === "string" && typeof obj.lastCheck === "number" ? obj : null;
14456
- } catch {
14457
- return null;
14458
- }
14459
- };
14460
- writeCache = (latestVersion) => {
14461
- try {
14462
- mkdirSync(path39.dirname(cacheFile()), { recursive: true });
14463
- writeFileSync(cacheFile(), JSON.stringify({ lastCheck: Date.now(), latestVersion }), "utf8");
14464
- } catch {
14465
- }
14466
- };
14467
- getCachedLatestIfNewer = (currentVersion) => {
14468
- const cache = readCache();
14469
- if (!cache) return null;
14470
- return compareVersion(cache.latestVersion, currentVersion) > 0 ? cache.latestVersion : null;
14471
- };
14472
- refreshUpdateCache = () => {
14473
- const cache = readCache();
14474
- if (cache && Date.now() - cache.lastCheck < CACHE_TTL_MS) return;
14475
- void (async () => {
14476
- try {
14477
- const res = await fetch(`${REGISTRY}/${PKG_NAME}/latest`, {
14478
- signal: AbortSignal.timeout(FETCH_TIMEOUT_MS2)
14479
- });
14480
- if (!res.ok) return;
14481
- const info = await res.json();
14482
- if (info.version) writeCache(info.version);
14483
- } catch {
14484
- }
14485
- })();
14486
- };
14487
- }
14488
- });
14489
-
14490
14491
  // src/preload-config.ts
14491
14492
  import { readFileSync } from "node:fs";
14492
14493
  import path from "node:path";
@@ -14534,6 +14535,7 @@ applyConfigToEnv(loadConfigFile());
14534
14535
  // src/main.tsx
14535
14536
  init_strings();
14536
14537
  init_prefs();
14538
+ init_updateCheck();
14537
14539
  init_trust();
14538
14540
  import { render } from "ink";
14539
14541
  import os5 from "os";
@@ -14550,6 +14552,7 @@ var parseArgs = (argv) => {
14550
14552
  else if (a === "--continue" || a === "-c") out.continue = true;
14551
14553
  else if (a === "--trust") out.trust = true;
14552
14554
  else if (a === "--no-update-check") out.noUpdateCheck = true;
14555
+ else if (a === "--version" || a === "-v") out.version = true;
14553
14556
  }
14554
14557
  return out;
14555
14558
  };
@@ -14610,6 +14613,11 @@ var main = async () => {
14610
14613
  console.debug = silence;
14611
14614
  console.warn = silence;
14612
14615
  const args = parseArgs(process.argv.slice(2));
14616
+ if (args.version) {
14617
+ process.stdout.write(`deepseeker-code v${readLocalVersion()}
14618
+ `);
14619
+ process.exit(0);
14620
+ }
14613
14621
  if (!process.env.DEEP_SEEK_API_KEY) {
14614
14622
  console.error(S.noApiKey("DEEP_SEEK_API_KEY"));
14615
14623
  process.exit(1);