jinzd-ai-cli 0.4.258 → 0.4.259

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 (31) hide show
  1. package/dist/{batch-B42DJMDJ.js → batch-74P2FQWX.js} +2 -2
  2. package/dist/{chunk-3ERLNXT2.js → chunk-3EWST6SE.js} +3 -3
  3. package/dist/{chunk-BIXQHN77.js → chunk-3KYUE2MD.js} +1 -1
  4. package/dist/{chunk-QJXUJFYD.js → chunk-4RPJQJBI.js} +68 -48
  5. package/dist/{chunk-I7LBWY7E.js → chunk-4TDVLTX2.js} +1 -1
  6. package/dist/{chunk-BWZT74E3.js → chunk-7DVIAK6J.js} +2 -2
  7. package/dist/{chunk-WLSK55ED.js → chunk-BWJYDG3C.js} +1 -1
  8. package/dist/{chunk-S5YGYXAE.js → chunk-DLOOIAAD.js} +1 -1
  9. package/dist/{chunk-HT5LC2PL.js → chunk-FGONEVTP.js} +1 -1
  10. package/dist/{chunk-XYNZVGUH.js → chunk-G65I4DXP.js} +1 -1
  11. package/dist/{chunk-BEER3VEB.js → chunk-KXAVUZKH.js} +1 -1
  12. package/dist/{chunk-PNQS67JC.js → chunk-PSH5O44I.js} +1 -1
  13. package/dist/{chunk-GWXWAQVM.js → chunk-V5FB72RK.js} +1 -1
  14. package/dist/{chunk-GVLUGPIX.js → chunk-ZZ5WTHKY.js} +3 -3
  15. package/dist/{ci-MMXYIHYY.js → ci-6BANR65W.js} +4 -4
  16. package/dist/{ci-format-FG53M5V2.js → ci-format-2OVEQK6O.js} +2 -2
  17. package/dist/{constants-WROFKV3K.js → constants-DKZEF3CE.js} +1 -1
  18. package/dist/{doctor-cli-USQ4HX7A.js → doctor-cli-6MHA7Q7M.js} +4 -4
  19. package/dist/electron-server.js +117 -99
  20. package/dist/{hub-MWEDYMK6.js → hub-L7RSDS4J.js} +1 -1
  21. package/dist/index.js +19 -19
  22. package/dist/{persistent-memory-PAHA4R7U.js → persistent-memory-I4JV3CME.js} +2 -2
  23. package/dist/{persistent-memory-ZHYBVUGR.js → persistent-memory-WBR2DALU.js} +2 -2
  24. package/dist/{pr-4P7XC2RK.js → pr-UNCWDVN3.js} +4 -4
  25. package/dist/{run-tests-WWJHCLFZ.js → run-tests-HFT5RUXF.js} +2 -2
  26. package/dist/{run-tests-Y6CBCPFF.js → run-tests-XBODGDFO.js} +2 -2
  27. package/dist/{server-JDKLBBVN.js → server-ILKG2672.js} +17 -17
  28. package/dist/{server-IMKKKH57.js → server-RNBKZ6TP.js} +5 -5
  29. package/dist/{task-orchestrator-F534G7LG.js → task-orchestrator-GXP5HNBZ.js} +5 -5
  30. package/dist/{usage-P4ORZDPV.js → usage-KCPH75KI.js} +2 -2
  31. package/package.json +1 -1
@@ -34,14 +34,14 @@ import {
34
34
  touchMemoryReferences,
35
35
  updateMemoryApproval,
36
36
  updateMemoryEntry
37
- } from "./chunk-BEER3VEB.js";
37
+ } from "./chunk-KXAVUZKH.js";
38
38
  import {
39
39
  redactJson,
40
40
  scanString
41
41
  } from "./chunk-YVTASHS5.js";
42
42
  import {
43
43
  runTestsTool
44
- } from "./chunk-GWXWAQVM.js";
44
+ } from "./chunk-V5FB72RK.js";
45
45
  import {
46
46
  AGENTIC_BEHAVIOR_GUIDELINE,
47
47
  APP_NAME,
@@ -73,7 +73,7 @@ import {
73
73
  SUBAGENT_MAX_ROUNDS_LIMIT,
74
74
  VERSION,
75
75
  buildUserIdentityPrompt
76
- } from "./chunk-S5YGYXAE.js";
76
+ } from "./chunk-DLOOIAAD.js";
77
77
  import {
78
78
  hasSemanticIndex,
79
79
  semanticSearch
@@ -92,7 +92,7 @@ import express from "express";
92
92
  import { createServer } from "http";
93
93
  import { WebSocketServer } from "ws";
94
94
  import { join as join25, dirname as dirname10, resolve as resolve10, relative as relative6, sep as sep4 } from "path";
95
- import { existsSync as existsSync30, readFileSync as readFileSync23, readdirSync as readdirSync15, statSync as statSync13, realpathSync as realpathSync3 } from "fs";
95
+ import { existsSync as existsSync30, readFileSync as readFileSync24, readdirSync as readdirSync15, statSync as statSync14, realpathSync as realpathSync3 } from "fs";
96
96
  import { networkInterfaces } from "os";
97
97
 
98
98
  // src/config/config-manager.ts
@@ -6098,7 +6098,7 @@ ${content}`;
6098
6098
  };
6099
6099
 
6100
6100
  // src/tools/builtin/write-file.ts
6101
- import { appendFileSync, mkdirSync as mkdirSync6 } from "fs";
6101
+ import { appendFileSync, mkdirSync as mkdirSync6, readFileSync as readFileSync10, statSync as statSync4 } from "fs";
6102
6102
  import { dirname as dirname5 } from "path";
6103
6103
 
6104
6104
  // src/tools/executor.ts
@@ -6156,6 +6156,37 @@ async function runSafePhases(phase, execute, results, logTag = "executor") {
6156
6156
  return Date.now() - t0;
6157
6157
  }
6158
6158
 
6159
+ // src/tools/arg-aliases.ts
6160
+ function pickArg(args, canonical, aliases) {
6161
+ if (args[canonical] !== void 0 && args[canonical] !== null) return args[canonical];
6162
+ for (const alias of aliases) {
6163
+ if (args[alias] !== void 0 && args[alias] !== null) return args[alias];
6164
+ }
6165
+ return void 0;
6166
+ }
6167
+ var OLD_STR_ALIASES = ["old_string", "oldStr", "oldString", "old_text", "search"];
6168
+ var NEW_STR_ALIASES = ["new_string", "newStr", "newString", "new_text", "replace"];
6169
+ var CONTENT_ALIASES = ["file_text", "text", "contents", "data"];
6170
+ var INSERT_LINE_ALIASES = ["insert_line", "line", "after_line"];
6171
+ var INSERT_CONTENT_ALIASES = ["content", "new_str", "text"];
6172
+ function normalizeReplaceArgs(raw) {
6173
+ const oldStr = pickArg(raw, "old_str", OLD_STR_ALIASES);
6174
+ if (oldStr === void 0) return void 0;
6175
+ return { old_str: oldStr, new_str: pickArg(raw, "new_str", NEW_STR_ALIASES) };
6176
+ }
6177
+ function resolveWriteFileArgs(args) {
6178
+ return {
6179
+ path: String(pickArg(args, "path", ["file"]) ?? ""),
6180
+ content: String(pickArg(args, "content", CONTENT_ALIASES) ?? ""),
6181
+ append: String(args["append"] ?? "false").toLowerCase() === "true"
6182
+ };
6183
+ }
6184
+ function describeReceivedKeys(args) {
6185
+ const keys = Object.keys(args).filter((k) => args[k] !== void 0);
6186
+ if (keys.length === 0) return " (no arguments received)";
6187
+ return ` Received keys: ${keys.join(", ")}.`;
6188
+ }
6189
+
6159
6190
  // src/tools/diff-utils.ts
6160
6191
  import chalk from "chalk";
6161
6192
  function renderDiff(oldText, newText, opts = {}) {
@@ -7624,8 +7655,7 @@ var ToolExecutor = class {
7624
7655
  */
7625
7656
  printDiffPreview(call) {
7626
7657
  if (call.name === "write_file") {
7627
- const filePath = String(call.arguments["path"] ?? "");
7628
- const newContent = String(call.arguments["content"] ?? "");
7658
+ const { path: filePath, content: chunk, append } = resolveWriteFileArgs(call.arguments);
7629
7659
  if (!filePath) return;
7630
7660
  if (existsSync11(filePath)) {
7631
7661
  let oldContent;
@@ -7634,16 +7664,17 @@ var ToolExecutor = class {
7634
7664
  } catch {
7635
7665
  return;
7636
7666
  }
7667
+ const newContent = append ? oldContent + chunk : chunk;
7637
7668
  if (oldContent === newContent) {
7638
7669
  console.log(theme.dim(" (file content unchanged)"));
7639
7670
  return;
7640
7671
  }
7641
7672
  const diff = renderDiff(oldContent, newContent, { filePath, contextLines: 3 });
7642
- console.log(theme.dim(" \u2500\u2500 diff preview \u2500\u2500"));
7673
+ console.log(theme.dim(append ? " \u2500\u2500 append preview \u2500\u2500" : " \u2500\u2500 diff preview \u2500\u2500"));
7643
7674
  console.log(diff);
7644
7675
  console.log();
7645
7676
  } else {
7646
- const lines = newContent.split("\n");
7677
+ const lines = chunk.split("\n");
7647
7678
  const preview = lines.slice(0, 20).map((l) => theme.success(`+ ${l}`)).join("\n");
7648
7679
  const more = lines.length > 20 ? theme.dim(`
7649
7680
  ... (+${lines.length - 20} more lines)`) : "";
@@ -7864,31 +7895,10 @@ var subAgentGuard = {
7864
7895
  active: false
7865
7896
  };
7866
7897
 
7867
- // src/tools/arg-aliases.ts
7868
- function pickArg(args, canonical, aliases) {
7869
- if (args[canonical] !== void 0 && args[canonical] !== null) return args[canonical];
7870
- for (const alias of aliases) {
7871
- if (args[alias] !== void 0 && args[alias] !== null) return args[alias];
7872
- }
7873
- return void 0;
7874
- }
7875
- var OLD_STR_ALIASES = ["old_string", "oldStr", "oldString", "old_text", "search"];
7876
- var NEW_STR_ALIASES = ["new_string", "newStr", "newString", "new_text", "replace"];
7877
- var CONTENT_ALIASES = ["file_text", "text", "contents", "data"];
7878
- var INSERT_LINE_ALIASES = ["insert_line", "line", "after_line"];
7879
- var INSERT_CONTENT_ALIASES = ["content", "new_str", "text"];
7880
- function normalizeReplaceArgs(raw) {
7881
- const oldStr = pickArg(raw, "old_str", OLD_STR_ALIASES);
7882
- if (oldStr === void 0) return void 0;
7883
- return { old_str: oldStr, new_str: pickArg(raw, "new_str", NEW_STR_ALIASES) };
7884
- }
7885
- function describeReceivedKeys(args) {
7886
- const keys = Object.keys(args).filter((k) => args[k] !== void 0);
7887
- if (keys.length === 0) return " (no arguments received)";
7888
- return ` Received keys: ${keys.join(", ")}.`;
7889
- }
7890
-
7891
7898
  // src/tools/builtin/write-file.ts
7899
+ function countFileLines(filePath) {
7900
+ return readFileSync10(filePath, "utf-8").split("\n").length;
7901
+ }
7892
7902
  var writeFileTool = {
7893
7903
  definition: {
7894
7904
  name: "write_file",
@@ -7956,12 +7966,21 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
7956
7966
  } catch {
7957
7967
  }
7958
7968
  })();
7969
+ if (appendMode) {
7970
+ let total = "";
7971
+ try {
7972
+ const st = statSync4(filePath);
7973
+ total = `; file now ${countFileLines(filePath)} lines, ${st.size} bytes`;
7974
+ } catch {
7975
+ }
7976
+ return `File appended: ${filePath} (+${lines} lines, +${bytes} bytes${total})`;
7977
+ }
7959
7978
  return `File ${mode}: ${filePath} (${lines} lines, ${bytes} bytes)`;
7960
7979
  }
7961
7980
  };
7962
7981
 
7963
7982
  // src/tools/builtin/edit-file.ts
7964
- import { readFileSync as readFileSync10, existsSync as existsSync12 } from "fs";
7983
+ import { readFileSync as readFileSync11, existsSync as existsSync12 } from "fs";
7965
7984
 
7966
7985
  // src/tools/builtin/patch-apply.ts
7967
7986
  function parseUnifiedDiff(patch) {
@@ -8337,7 +8356,7 @@ Note: Path can be absolute or relative to cwd.`,
8337
8356
  `Refused: sub-agents cannot edit sensitive paths \u2014 ${verdict.reason}. If this is genuinely needed, ask the parent agent to perform the edit so the user can approve it.`
8338
8357
  );
8339
8358
  }
8340
- const original = readFileSync10(filePath, encoding);
8359
+ const original = readFileSync11(filePath, encoding);
8341
8360
  if (args["patch"] !== void 0) {
8342
8361
  const patchText = String(args["patch"] ?? "");
8343
8362
  const stopOnError = args["stop_on_error"] !== false;
@@ -8506,7 +8525,7 @@ function truncatePreview(str, maxLen = 80) {
8506
8525
  }
8507
8526
 
8508
8527
  // src/tools/builtin/list-dir.ts
8509
- import { readdirSync as readdirSync4, statSync as statSync4, existsSync as existsSync13 } from "fs";
8528
+ import { readdirSync as readdirSync4, statSync as statSync5, existsSync as existsSync13 } from "fs";
8510
8529
  import { join as join7, basename as basename4 } from "path";
8511
8530
  var listDirTool = {
8512
8531
  definition: {
@@ -8591,7 +8610,7 @@ function listRecursive(basePath, indent, recursive, lines) {
8591
8610
  }
8592
8611
  } else {
8593
8612
  try {
8594
- const stat = statSync4(join7(basePath, entry.name));
8613
+ const stat = statSync5(join7(basePath, entry.name));
8595
8614
  const size = formatSize(stat.size);
8596
8615
  lines.push(`${indent}\u{1F4C4} ${entry.name} (${size})`);
8597
8616
  } catch {
@@ -8607,7 +8626,7 @@ function formatSize(bytes) {
8607
8626
  }
8608
8627
 
8609
8628
  // src/tools/builtin/grep-files.ts
8610
- import { readdirSync as readdirSync5, readFileSync as readFileSync11, statSync as statSync5, existsSync as existsSync14 } from "fs";
8629
+ import { readdirSync as readdirSync5, readFileSync as readFileSync12, statSync as statSync6, existsSync as existsSync14 } from "fs";
8611
8630
  import { readFile } from "fs/promises";
8612
8631
  import { join as join8, relative } from "path";
8613
8632
  var grepFilesTool = {
@@ -8673,7 +8692,7 @@ Supports regex. Automatically skips node_modules, dist, .git directories.`,
8673
8692
  regex = new RegExp(escaped, ignoreCase ? "gi" : "g");
8674
8693
  }
8675
8694
  const results = [];
8676
- const stat = statSync5(rootPath);
8695
+ const stat = statSync6(rootPath);
8677
8696
  if (stat.isFile()) {
8678
8697
  searchInFile(rootPath, rootPath, regex, contextLines, maxResults, results);
8679
8698
  } else {
@@ -8760,7 +8779,7 @@ function collectFilePaths(rootPath, filePattern, maxFiles) {
8760
8779
  if (filePattern && !matchesFilePattern(entry.name, filePattern)) continue;
8761
8780
  const fullPath = join8(dirPath, entry.name);
8762
8781
  try {
8763
- if (statSync5(fullPath).size > 1e6) continue;
8782
+ if (statSync6(fullPath).size > 1e6) continue;
8764
8783
  } catch {
8765
8784
  continue;
8766
8785
  }
@@ -8806,14 +8825,14 @@ async function searchInFileAsync(fullPath, displayPath2, regex, contextLines, ma
8806
8825
  }
8807
8826
  function searchInFile(fullPath, displayPath2, regex, contextLines, maxResults, results) {
8808
8827
  try {
8809
- const stat = statSync5(fullPath);
8828
+ const stat = statSync6(fullPath);
8810
8829
  if (stat.size > 1e6) return;
8811
8830
  } catch {
8812
8831
  return;
8813
8832
  }
8814
8833
  let content;
8815
8834
  try {
8816
- content = readFileSync11(fullPath, "utf-8");
8835
+ content = readFileSync12(fullPath, "utf-8");
8817
8836
  } catch {
8818
8837
  return;
8819
8838
  }
@@ -8844,7 +8863,7 @@ function searchInFile(fullPath, displayPath2, regex, contextLines, maxResults, r
8844
8863
  }
8845
8864
 
8846
8865
  // src/tools/builtin/glob-files.ts
8847
- import { readdirSync as readdirSync6, statSync as statSync6, existsSync as existsSync15 } from "fs";
8866
+ import { readdirSync as readdirSync6, statSync as statSync7, existsSync as existsSync15 } from "fs";
8848
8867
  import { join as join9, relative as relative2, basename as basename5 } from "path";
8849
8868
  var globFilesTool = {
8850
8869
  definition: {
@@ -8963,7 +8982,7 @@ function collectMatchingFiles(dirPath, rootPath, regex, results, maxResults) {
8963
8982
  const relPath = relative2(rootPath, fullPath).replace(/\\/g, "/");
8964
8983
  if (regex.test(relPath) || regex.test(basename5(relPath))) {
8965
8984
  try {
8966
- const stat = statSync6(fullPath);
8985
+ const stat = statSync7(fullPath);
8967
8986
  results.push({ relPath, absPath: fullPath, mtime: stat.mtimeMs });
8968
8987
  } catch {
8969
8988
  results.push({ relPath, absPath: fullPath, mtime: 0 });
@@ -10149,12 +10168,12 @@ function formatResults2(query, data, _requested) {
10149
10168
  }
10150
10169
 
10151
10170
  // src/agents/agent-config.ts
10152
- import { existsSync as existsSync17, readdirSync as readdirSync8, readFileSync as readFileSync13 } from "fs";
10171
+ import { existsSync as existsSync17, readdirSync as readdirSync8, readFileSync as readFileSync14 } from "fs";
10153
10172
  import { join as join12 } from "path";
10154
10173
  import { homedir as homedir6 } from "os";
10155
10174
 
10156
10175
  // src/plugins/plugin-manager.ts
10157
- import { existsSync as existsSync16, mkdirSync as mkdirSync8, readdirSync as readdirSync7, readFileSync as readFileSync12, realpathSync as realpathSync2, cpSync, rmSync, statSync as statSync7 } from "fs";
10176
+ import { existsSync as existsSync16, mkdirSync as mkdirSync8, readdirSync as readdirSync7, readFileSync as readFileSync13, realpathSync as realpathSync2, cpSync, rmSync, statSync as statSync8 } from "fs";
10158
10177
  import { basename as basename6, dirname as dirname7, join as join11, relative as relative3, resolve as resolve6, sep as sep3 } from "path";
10159
10178
  import { createHash as createHash2 } from "crypto";
10160
10179
  import { z as z2 } from "zod";
@@ -10227,7 +10246,7 @@ function loadState(configDir) {
10227
10246
  const file = statePath(configDir);
10228
10247
  if (!existsSync16(file)) return { version: 2, plugins: [] };
10229
10248
  try {
10230
- const parsed = JSON.parse(readFileSync12(file, "utf-8"));
10249
+ const parsed = JSON.parse(readFileSync13(file, "utf-8"));
10231
10250
  const rawPlugins = Array.isArray(parsed.plugins) ? parsed.plugins : [];
10232
10251
  return { version: 2, plugins: rawPlugins.map((p) => migrateEntry(p)) };
10233
10252
  } catch {
@@ -10318,7 +10337,7 @@ function hashPluginContent(pluginDir, manifest) {
10318
10337
  const sorted = [...assetRels].sort();
10319
10338
  const hasher = createHash2("sha256");
10320
10339
  const manifestPath = join11(resolvedDir, MANIFEST_RELATIVE);
10321
- hasher.update(normalizeForHash(readFileSync12(manifestPath)));
10340
+ hasher.update(normalizeForHash(readFileSync13(manifestPath)));
10322
10341
  for (const rel of sorted) {
10323
10342
  const abs = resolve6(resolvedDir, rel);
10324
10343
  if (!abs.startsWith(resolvedDir + sep3)) {
@@ -10331,14 +10350,14 @@ function hashPluginContent(pluginDir, manifest) {
10331
10350
  continue;
10332
10351
  }
10333
10352
  try {
10334
- if (statSync7(realPath).isDirectory()) continue;
10353
+ if (statSync8(realPath).isDirectory()) continue;
10335
10354
  } catch {
10336
10355
  continue;
10337
10356
  }
10338
10357
  if (!realPath.startsWith(resolvedDir + sep3)) {
10339
10358
  throw new Error(`plugin asset symlink escapes plugin dir: ${rel} \u2192 ${realPath}`);
10340
10359
  }
10341
- hasher.update(normalizeForHash(readFileSync12(abs)));
10360
+ hasher.update(normalizeForHash(readFileSync13(abs)));
10342
10361
  }
10343
10362
  return hasher.digest("hex");
10344
10363
  }
@@ -10346,11 +10365,11 @@ function effectiveHash(entry) {
10346
10365
  return entry.contentHash ?? entry.hash ?? "";
10347
10366
  }
10348
10367
  function readPluginManifest(manifestPath) {
10349
- return PluginManifestSchema.parse(JSON.parse(readFileSync12(manifestPath, "utf-8")));
10368
+ return PluginManifestSchema.parse(JSON.parse(readFileSync13(manifestPath, "utf-8")));
10350
10369
  }
10351
10370
  function findPluginSourceDir(inputPath) {
10352
10371
  const abs = resolve6(inputPath);
10353
- const direct = statSync7(abs).isDirectory() ? abs : dirname7(abs);
10372
+ const direct = statSync8(abs).isDirectory() ? abs : dirname7(abs);
10354
10373
  if (existsSync16(pluginManifestPath(direct))) return direct;
10355
10374
  const nested = join11(direct, ".aicli-plugin");
10356
10375
  if (existsSync16(join11(nested, "plugin.json"))) return direct;
@@ -10425,7 +10444,7 @@ function listInstalledPlugins(configDir) {
10425
10444
  for (const entry of readdirSync7(root)) {
10426
10445
  const dir = join11(root, entry);
10427
10446
  try {
10428
- if (!statSync7(dir).isDirectory()) continue;
10447
+ if (!statSync8(dir).isDirectory()) continue;
10429
10448
  } catch {
10430
10449
  continue;
10431
10450
  }
@@ -10470,7 +10489,7 @@ function uniqueDirs(plugin, rels) {
10470
10489
  for (const rel of rels) {
10471
10490
  const abs = resolve6(plugin.dir, rel);
10472
10491
  if (!abs.startsWith(resolve6(plugin.dir))) continue;
10473
- if (existsSync16(abs)) dirs.add(statSync7(abs).isDirectory() ? abs : dirname7(abs));
10492
+ if (existsSync16(abs)) dirs.add(statSync8(abs).isDirectory() ? abs : dirname7(abs));
10474
10493
  }
10475
10494
  return [...dirs];
10476
10495
  }
@@ -10639,7 +10658,7 @@ function loadAgentDir(dir, source) {
10639
10658
  if (!file.endsWith(".json")) continue;
10640
10659
  const path3 = join12(dir, file);
10641
10660
  try {
10642
- const parsed = JSON.parse(readFileSync13(path3, "utf-8"));
10661
+ const parsed = JSON.parse(readFileSync14(path3, "utf-8"));
10643
10662
  const cfg = parseAgentConfig(parsed, source, path3);
10644
10663
  if (cfg) out.push(cfg);
10645
10664
  } catch {
@@ -11639,7 +11658,7 @@ ${commitOutput.trim()}`;
11639
11658
  };
11640
11659
 
11641
11660
  // src/tools/builtin/notebook-edit.ts
11642
- import { readFileSync as readFileSync14, existsSync as existsSync19 } from "fs";
11661
+ import { readFileSync as readFileSync15, existsSync as existsSync19 } from "fs";
11643
11662
  import { writeFile } from "fs/promises";
11644
11663
  import { resolve as resolve7, extname as extname2 } from "path";
11645
11664
  var notebookEditTool = {
@@ -11697,7 +11716,7 @@ var notebookEditTool = {
11697
11716
  if (!existsSync19(absPath)) {
11698
11717
  throw new ToolError("notebook_edit", `Notebook not found: ${filePath}`);
11699
11718
  }
11700
- const raw = readFileSync14(absPath, "utf-8");
11719
+ const raw = readFileSync15(absPath, "utf-8");
11701
11720
  const nb = parseNotebook(raw);
11702
11721
  const cellIdx0 = cellIndexRaw - 1;
11703
11722
  undoStack.push(absPath, `notebook_edit (${action}): ${filePath}`);
@@ -12866,11 +12885,11 @@ var McpManager = class {
12866
12885
  };
12867
12886
 
12868
12887
  // src/skills/manager.ts
12869
- import { existsSync as existsSync21, readdirSync as readdirSync10, mkdirSync as mkdirSync10, statSync as statSync8 } from "fs";
12888
+ import { existsSync as existsSync21, readdirSync as readdirSync10, mkdirSync as mkdirSync10, statSync as statSync9 } from "fs";
12870
12889
  import { join as join16 } from "path";
12871
12890
 
12872
12891
  // src/skills/types.ts
12873
- import { readFileSync as readFileSync15 } from "fs";
12892
+ import { readFileSync as readFileSync16 } from "fs";
12874
12893
  import { basename as basename7 } from "path";
12875
12894
  function parseSimpleYaml(yaml) {
12876
12895
  const result = {};
@@ -12892,7 +12911,7 @@ function parseYamlArray(value) {
12892
12911
  function parseSkillFile(filePath) {
12893
12912
  let raw;
12894
12913
  try {
12895
- raw = readFileSync15(filePath, "utf-8");
12914
+ raw = readFileSync16(filePath, "utf-8");
12896
12915
  } catch {
12897
12916
  return null;
12898
12917
  }
@@ -12962,7 +12981,7 @@ var SkillManager = class {
12962
12981
  filePath = fullPath;
12963
12982
  } else {
12964
12983
  try {
12965
- if (statSync8(fullPath).isDirectory()) {
12984
+ if (statSync9(fullPath).isDirectory()) {
12966
12985
  const skillMd = join16(fullPath, "SKILL.md");
12967
12986
  if (existsSync21(skillMd)) filePath = skillMd;
12968
12987
  else continue;
@@ -13023,7 +13042,7 @@ var SkillManager = class {
13023
13042
  // src/web/tool-executor-web.ts
13024
13043
  import { randomUUID as randomUUID2 } from "crypto";
13025
13044
  import { tmpdir as tmpdir2 } from "os";
13026
- import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
13045
+ import { existsSync as existsSync22, readFileSync as readFileSync17 } from "fs";
13027
13046
  var ToolExecutorWeb = class _ToolExecutorWeb {
13028
13047
  constructor(registry, ws) {
13029
13048
  this.registry = registry;
@@ -13162,18 +13181,17 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13162
13181
  }
13163
13182
  getDiffPreview(call) {
13164
13183
  if (call.name === "write_file") {
13165
- const filePath = String(call.arguments["path"] ?? "");
13166
- const newContent = String(call.arguments["content"] ?? "");
13184
+ const { path: filePath, content: chunk, append } = resolveWriteFileArgs(call.arguments);
13167
13185
  if (filePath && existsSync22(filePath)) {
13168
13186
  try {
13169
- const old = readFileSync16(filePath, "utf-8");
13170
- return renderDiff(old, newContent, { filePath });
13187
+ const old = readFileSync17(filePath, "utf-8");
13188
+ return renderDiff(old, append ? old + chunk : chunk, { filePath });
13171
13189
  } catch {
13172
13190
  }
13173
13191
  }
13174
- const lines = newContent.split("\n").slice(0, 20);
13175
- return lines.map((l) => `+ ${l}`).join("\n") + (newContent.split("\n").length > 20 ? `
13176
- ... (+${newContent.split("\n").length - 20} more lines)` : "");
13192
+ const lines = chunk.split("\n").slice(0, 20);
13193
+ return lines.map((l) => `+ ${l}`).join("\n") + (chunk.split("\n").length > 20 ? `
13194
+ ... (+${chunk.split("\n").length - 20} more lines)` : "");
13177
13195
  }
13178
13196
  if (call.name === "edit_file") {
13179
13197
  const oldStr = String(call.arguments["old_str"] ?? "");
@@ -13479,7 +13497,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13479
13497
  };
13480
13498
 
13481
13499
  // src/repl/dev-state.ts
13482
- import { existsSync as existsSync23, readFileSync as readFileSync17, unlinkSync as unlinkSync5, mkdirSync as mkdirSync11 } from "fs";
13500
+ import { existsSync as existsSync23, readFileSync as readFileSync18, unlinkSync as unlinkSync5, mkdirSync as mkdirSync11 } from "fs";
13483
13501
  import { join as join17 } from "path";
13484
13502
  import { homedir as homedir8 } from "os";
13485
13503
  function getDevStatePath() {
@@ -13488,7 +13506,7 @@ function getDevStatePath() {
13488
13506
  function loadDevState() {
13489
13507
  const path3 = getDevStatePath();
13490
13508
  if (!existsSync23(path3)) return null;
13491
- const content = readFileSync17(path3, "utf-8").trim();
13509
+ const content = readFileSync18(path3, "utf-8").trim();
13492
13510
  return content || null;
13493
13511
  }
13494
13512
 
@@ -13754,7 +13772,7 @@ function autoTrimSessionIfNeeded(session, sizeLimit = SESSION_SIZE_LIMIT) {
13754
13772
  }
13755
13773
 
13756
13774
  // src/core/context-files.ts
13757
- import { existsSync as existsSync24, readFileSync as readFileSync18 } from "fs";
13775
+ import { existsSync as existsSync24, readFileSync as readFileSync19 } from "fs";
13758
13776
  import { join as join18, relative as relative4, resolve as resolve8 } from "path";
13759
13777
  function uniqueNonEmpty(values) {
13760
13778
  const seen = /* @__PURE__ */ new Set();
@@ -13785,7 +13803,7 @@ function readContextFile(level, filePath, cwd, maxBytes) {
13785
13803
  const name = filePath.split(/[\\/]/).pop() ?? filePath;
13786
13804
  const shown = displayPath(filePath, cwd);
13787
13805
  try {
13788
- const raw = readFileSync18(filePath);
13806
+ const raw = readFileSync19(filePath);
13789
13807
  const byteCount = raw.byteLength;
13790
13808
  if (byteCount === 0) {
13791
13809
  return {
@@ -13915,7 +13933,7 @@ import { mkdirSync as mkdirSync14, createWriteStream as createWriteStream2 } fro
13915
13933
  import { dirname as dirname9 } from "path";
13916
13934
 
13917
13935
  // src/repl/commands/project-init.ts
13918
- import { existsSync as existsSync25, readFileSync as readFileSync19, readdirSync as readdirSync11, statSync as statSync9 } from "fs";
13936
+ import { existsSync as existsSync25, readFileSync as readFileSync20, readdirSync as readdirSync11, statSync as statSync10 } from "fs";
13919
13937
  import { join as join19 } from "path";
13920
13938
  var SCAN_SKIP_DIRS = /* @__PURE__ */ new Set([
13921
13939
  "node_modules",
@@ -13960,11 +13978,11 @@ function scanDirTree(dir, maxDepth = 2, maxEntries = 80) {
13960
13978
  const sorted = filtered.sort((a, b) => {
13961
13979
  let aIsDir = false, bIsDir = false;
13962
13980
  try {
13963
- aIsDir = statSync9(join19(d, a)).isDirectory();
13981
+ aIsDir = statSync10(join19(d, a)).isDirectory();
13964
13982
  } catch {
13965
13983
  }
13966
13984
  try {
13967
- bIsDir = statSync9(join19(d, b)).isDirectory();
13985
+ bIsDir = statSync10(join19(d, b)).isDirectory();
13968
13986
  } catch {
13969
13987
  }
13970
13988
  if (aIsDir !== bIsDir) return aIsDir ? -1 : 1;
@@ -13977,7 +13995,7 @@ function scanDirTree(dir, maxDepth = 2, maxEntries = 80) {
13977
13995
  const connector = isLast ? "+-- " : "|-- ";
13978
13996
  let isDir;
13979
13997
  try {
13980
- isDir = statSync9(fullPath).isDirectory();
13998
+ isDir = statSync10(fullPath).isDirectory();
13981
13999
  } catch {
13982
14000
  continue;
13983
14001
  }
@@ -14026,7 +14044,7 @@ function scanProject(cwd) {
14026
14044
  info.type = "node";
14027
14045
  info.language = check("tsconfig.json") ? "TypeScript" : "JavaScript";
14028
14046
  try {
14029
- const pkg = JSON.parse(readFileSync19(join19(cwd, "package.json"), "utf-8"));
14047
+ const pkg = JSON.parse(readFileSync20(join19(cwd, "package.json"), "utf-8"));
14030
14048
  const scripts = pkg.scripts ?? {};
14031
14049
  info.buildCommand = scripts.build ? "npm run build" : void 0;
14032
14050
  info.testCommand = scripts.test ? "npm test" : void 0;
@@ -14801,7 +14819,7 @@ async function handlePlan(args, ctx) {
14801
14819
  }
14802
14820
 
14803
14821
  // src/web/commands/_shared.ts
14804
- import { existsSync as existsSync28, readFileSync as readFileSync21, writeFileSync as writeFileSync3, mkdirSync as mkdirSync13, readdirSync as readdirSync13, statSync as statSync12, createWriteStream } from "fs";
14822
+ import { existsSync as existsSync28, readFileSync as readFileSync22, writeFileSync as writeFileSync3, mkdirSync as mkdirSync13, readdirSync as readdirSync13, statSync as statSync13, createWriteStream } from "fs";
14805
14823
  import { join as join23, resolve as resolve9, dirname as dirname8 } from "path";
14806
14824
 
14807
14825
  // src/cli/review-prompts.ts
@@ -14874,7 +14892,7 @@ function readGitDiff(options = {}) {
14874
14892
  }
14875
14893
 
14876
14894
  // src/diagnostics/doctor-report.ts
14877
- import { existsSync as existsSync27, statSync as statSync11 } from "fs";
14895
+ import { existsSync as existsSync27, statSync as statSync12 } from "fs";
14878
14896
  import { join as join22 } from "path";
14879
14897
  import { arch as arch2, platform as platform7, release as release2 } from "os";
14880
14898
 
@@ -14883,8 +14901,8 @@ import {
14883
14901
  existsSync as existsSync26,
14884
14902
  mkdirSync as mkdirSync12,
14885
14903
  readdirSync as readdirSync12,
14886
- readFileSync as readFileSync20,
14887
- statSync as statSync10,
14904
+ readFileSync as readFileSync21,
14905
+ statSync as statSync11,
14888
14906
  unlinkSync as unlinkSync6,
14889
14907
  writeFileSync as writeFileSync2
14890
14908
  } from "fs";
@@ -14913,8 +14931,8 @@ function listRecentCrashes(limit = 10, configDir) {
14913
14931
  if (!name.startsWith(CRASH_LOG_PREFIX) || !name.endsWith(".log")) continue;
14914
14932
  const full = join21(dir, name);
14915
14933
  try {
14916
- const st = statSync10(full);
14917
- const head = readFileSync20(full, "utf-8").split("\n").slice(0, 20);
14934
+ const st = statSync11(full);
14935
+ const head = readFileSync21(full, "utf-8").split("\n").slice(0, 20);
14918
14936
  const tsLine = head.find((l) => l.startsWith("timestamp:"));
14919
14937
  const kindLine = head.find((l) => l.startsWith("kind:"));
14920
14938
  const msgIdx = head.findIndex((l) => l.trim() === "## message");
@@ -14954,7 +14972,7 @@ function getConfigDirUsage(configDir) {
14954
14972
  }
14955
14973
  function dirSize(path3) {
14956
14974
  try {
14957
- const st = statSync10(path3);
14975
+ const st = statSync11(path3);
14958
14976
  if (st.isFile()) return st.size;
14959
14977
  if (!st.isDirectory()) return 0;
14960
14978
  let sum = 0;
@@ -14973,7 +14991,7 @@ function checkFile(label, path3) {
14973
14991
  let sizeBytes = null;
14974
14992
  if (exists) {
14975
14993
  try {
14976
- sizeBytes = statSync11(path3).size;
14994
+ sizeBytes = statSync12(path3).size;
14977
14995
  } catch {
14978
14996
  }
14979
14997
  }
@@ -15295,7 +15313,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
15295
15313
  Cost: ${formatCost(cost)}` : "";
15296
15314
  let memoryLine = "";
15297
15315
  try {
15298
- const { countPendingMemories } = await import("./persistent-memory-PAHA4R7U.js");
15316
+ const { countPendingMemories } = await import("./persistent-memory-I4JV3CME.js");
15299
15317
  const pending = countPendingMemories(ctx.config.getConfigDir());
15300
15318
  if (pending > 0) memoryLine = `
15301
15319
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -16104,7 +16122,7 @@ async function handleSecurityReview(args, ctx) {
16104
16122
  async function handleTest(args, ctx) {
16105
16123
  ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
16106
16124
  try {
16107
- const { executeTests } = await import("./run-tests-WWJHCLFZ.js");
16125
+ const { executeTests } = await import("./run-tests-HFT5RUXF.js");
16108
16126
  const argStr = args.join(" ").trim();
16109
16127
  let testArgs = {};
16110
16128
  if (argStr) {
@@ -16136,7 +16154,7 @@ async function handleDiff(args, ctx) {
16136
16154
  for (const [filePath, { earliest }] of fileMap) {
16137
16155
  const currentContent = existsSync28(filePath) ? (() => {
16138
16156
  try {
16139
- return readFileSync21(filePath, "utf-8");
16157
+ return readFileSync22(filePath, "utf-8");
16140
16158
  } catch {
16141
16159
  return null;
16142
16160
  }
@@ -16368,7 +16386,7 @@ async function handleMemory(args, ctx) {
16368
16386
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
16369
16387
  } else if (sub === "export") {
16370
16388
  if (args[1] === "md") {
16371
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-PAHA4R7U.js");
16389
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-I4JV3CME.js");
16372
16390
  ctx.send({
16373
16391
  type: "export_data",
16374
16392
  format: "md",
@@ -16410,7 +16428,7 @@ Use /add-dir remove to clear.` : "No directories added.\nUsage: /add-dir <path>
16410
16428
  ctx.send({ type: "error", message: `Directory not found: ${dirPath}` });
16411
16429
  return;
16412
16430
  }
16413
- if (!statSync12(dirPath).isDirectory()) {
16431
+ if (!statSync13(dirPath).isDirectory()) {
16414
16432
  ctx.send({ type: "error", message: `Not a directory: ${dirPath}` });
16415
16433
  return;
16416
16434
  }
@@ -18281,7 +18299,7 @@ async function setupProxy(configProxy) {
18281
18299
  }
18282
18300
 
18283
18301
  // src/web/auth.ts
18284
- import { existsSync as existsSync29, readFileSync as readFileSync22, writeFileSync as writeFileSync4, mkdirSync as mkdirSync15, readdirSync as readdirSync14, copyFileSync } from "fs";
18302
+ import { existsSync as existsSync29, readFileSync as readFileSync23, writeFileSync as writeFileSync4, mkdirSync as mkdirSync15, readdirSync as readdirSync14, copyFileSync } from "fs";
18285
18303
  import { isAbsolute as isAbsolute3, join as join24, relative as relative5 } from "path";
18286
18304
  import { createHmac, randomBytes, timingSafeEqual, pbkdf2Sync } from "crypto";
18287
18305
  var USERS_FILE = "users.json";
@@ -18482,7 +18500,7 @@ var AuthManager = class {
18482
18500
  const globalConfig = join24(this.baseDir, "config.json");
18483
18501
  if (existsSync29(globalConfig)) {
18484
18502
  try {
18485
- const content = readFileSync22(globalConfig, "utf-8");
18503
+ const content = readFileSync23(globalConfig, "utf-8");
18486
18504
  writeFileSync4(join24(userDir, "config.json"), content, "utf-8");
18487
18505
  } catch {
18488
18506
  }
@@ -18490,7 +18508,7 @@ var AuthManager = class {
18490
18508
  const globalMemory = join24(this.baseDir, "memory.md");
18491
18509
  if (existsSync29(globalMemory)) {
18492
18510
  try {
18493
- const content = readFileSync22(globalMemory, "utf-8");
18511
+ const content = readFileSync23(globalMemory, "utf-8");
18494
18512
  writeFileSync4(join24(userDir, "memory.md"), content, "utf-8");
18495
18513
  } catch {
18496
18514
  }
@@ -18515,7 +18533,7 @@ var AuthManager = class {
18515
18533
  loadOrCreate() {
18516
18534
  if (existsSync29(this.usersFile)) {
18517
18535
  try {
18518
- const parsed = JSON.parse(readFileSync22(this.usersFile, "utf-8"));
18536
+ const parsed = JSON.parse(readFileSync23(this.usersFile, "utf-8"));
18519
18537
  if (!this.isValidUsersDB(parsed)) {
18520
18538
  throw new Error("database structure is invalid");
18521
18539
  }
@@ -18892,7 +18910,7 @@ async function startWebServer(options = {}) {
18892
18910
  res.status(404).json({ error: "Session not found" });
18893
18911
  return;
18894
18912
  }
18895
- const data = JSON.parse(readFileSync23(filePath, "utf-8"));
18913
+ const data = JSON.parse(readFileSync24(filePath, "utf-8"));
18896
18914
  res.json({ session: data });
18897
18915
  } catch (err) {
18898
18916
  res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
@@ -18918,12 +18936,12 @@ async function startWebServer(options = {}) {
18918
18936
  return;
18919
18937
  }
18920
18938
  try {
18921
- const stat = statSync13(fullPath);
18939
+ const stat = statSync14(fullPath);
18922
18940
  if (stat.size > 512 * 1024) {
18923
18941
  res.json({ error: `File too large (${(stat.size / 1024).toFixed(0)} KB, max 512 KB)` });
18924
18942
  return;
18925
18943
  }
18926
- const content = readFileSync23(fullPath, "utf-8");
18944
+ const content = readFileSync24(fullPath, "utf-8");
18927
18945
  res.json({ content, size: stat.size });
18928
18946
  } catch {
18929
18947
  res.json({ error: "Cannot read file" });
@@ -19188,7 +19206,7 @@ function loadProjectMcpConfig() {
19188
19206
  const configPath = join25(projectRoot, MCP_PROJECT_CONFIG_NAME);
19189
19207
  if (!existsSync30(configPath)) return null;
19190
19208
  try {
19191
- const raw = JSON.parse(readFileSync23(configPath, "utf-8"));
19209
+ const raw = JSON.parse(readFileSync24(configPath, "utf-8"));
19192
19210
  return raw.mcpServers ?? raw;
19193
19211
  } catch {
19194
19212
  return null;
@@ -154,7 +154,7 @@ ${content}`);
154
154
  }
155
155
  }
156
156
  async function runTaskMode(config, providers, configManager, topic) {
157
- const { TaskOrchestrator } = await import("./task-orchestrator-F534G7LG.js");
157
+ const { TaskOrchestrator } = await import("./task-orchestrator-GXP5HNBZ.js");
158
158
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
159
159
  let interrupted = false;
160
160
  const onSigint = () => {