@harmonyos-arkts/opencode-acp 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
- // node_modules/isexe/windows.js
33
+ // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
34
34
  var require_windows = __commonJS({
35
- "node_modules/isexe/windows.js"(exports2, module2) {
35
+ "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module2) {
36
36
  module2.exports = isexe;
37
37
  isexe.sync = sync;
38
38
  var fs = require("fs");
@@ -70,9 +70,9 @@ var require_windows = __commonJS({
70
70
  }
71
71
  });
72
72
 
73
- // node_modules/isexe/mode.js
73
+ // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
74
74
  var require_mode = __commonJS({
75
- "node_modules/isexe/mode.js"(exports2, module2) {
75
+ "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports2, module2) {
76
76
  module2.exports = isexe;
77
77
  isexe.sync = sync;
78
78
  var fs = require("fs");
@@ -103,9 +103,9 @@ var require_mode = __commonJS({
103
103
  }
104
104
  });
105
105
 
106
- // node_modules/isexe/index.js
106
+ // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
107
107
  var require_isexe = __commonJS({
108
- "node_modules/isexe/index.js"(exports2, module2) {
108
+ "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
109
109
  var fs = require("fs");
110
110
  var core;
111
111
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
@@ -158,9 +158,9 @@ var require_isexe = __commonJS({
158
158
  }
159
159
  });
160
160
 
161
- // node_modules/which/which.js
161
+ // node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
162
162
  var require_which = __commonJS({
163
- "node_modules/which/which.js"(exports2, module2) {
163
+ "node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
164
164
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
165
165
  var path = require("path");
166
166
  var COLON = isWindows ? ";" : ":";
@@ -254,9 +254,9 @@ var require_which = __commonJS({
254
254
  }
255
255
  });
256
256
 
257
- // node_modules/path-key/index.js
257
+ // node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
258
258
  var require_path_key = __commonJS({
259
- "node_modules/path-key/index.js"(exports2, module2) {
259
+ "node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports2, module2) {
260
260
  "use strict";
261
261
  var pathKey = (options = {}) => {
262
262
  const environment = options.env || process.env;
@@ -271,9 +271,9 @@ var require_path_key = __commonJS({
271
271
  }
272
272
  });
273
273
 
274
- // node_modules/cross-spawn/lib/util/resolveCommand.js
274
+ // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
275
275
  var require_resolveCommand = __commonJS({
276
- "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
276
+ "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
277
277
  "use strict";
278
278
  var path = require("path");
279
279
  var which = require_which();
@@ -313,9 +313,9 @@ var require_resolveCommand = __commonJS({
313
313
  }
314
314
  });
315
315
 
316
- // node_modules/cross-spawn/lib/util/escape.js
316
+ // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
317
317
  var require_escape = __commonJS({
318
- "node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
318
+ "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
319
319
  "use strict";
320
320
  var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
321
321
  function escapeCommand(arg) {
@@ -338,17 +338,17 @@ var require_escape = __commonJS({
338
338
  }
339
339
  });
340
340
 
341
- // node_modules/shebang-regex/index.js
341
+ // node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
342
342
  var require_shebang_regex = __commonJS({
343
- "node_modules/shebang-regex/index.js"(exports2, module2) {
343
+ "node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports2, module2) {
344
344
  "use strict";
345
345
  module2.exports = /^#!(.*)/;
346
346
  }
347
347
  });
348
348
 
349
- // node_modules/shebang-command/index.js
349
+ // node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
350
350
  var require_shebang_command = __commonJS({
351
- "node_modules/shebang-command/index.js"(exports2, module2) {
351
+ "node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports2, module2) {
352
352
  "use strict";
353
353
  var shebangRegex = require_shebang_regex();
354
354
  module2.exports = (string4 = "") => {
@@ -366,9 +366,9 @@ var require_shebang_command = __commonJS({
366
366
  }
367
367
  });
368
368
 
369
- // node_modules/cross-spawn/lib/util/readShebang.js
369
+ // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
370
370
  var require_readShebang = __commonJS({
371
- "node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
371
+ "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
372
372
  "use strict";
373
373
  var fs = require("fs");
374
374
  var shebangCommand = require_shebang_command();
@@ -388,15 +388,15 @@ var require_readShebang = __commonJS({
388
388
  }
389
389
  });
390
390
 
391
- // node_modules/cross-spawn/lib/parse.js
391
+ // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
392
392
  var require_parse = __commonJS({
393
- "node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
393
+ "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
394
394
  "use strict";
395
395
  var path = require("path");
396
396
  var resolveCommand = require_resolveCommand();
397
397
  var escape = require_escape();
398
398
  var readShebang = require_readShebang();
399
- var isWin = process.platform === "win32";
399
+ var isWin2 = process.platform === "win32";
400
400
  var isExecutableRegExp = /\.(?:com|exe)$/i;
401
401
  var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
402
402
  function detectShebang(parsed) {
@@ -410,7 +410,7 @@ var require_parse = __commonJS({
410
410
  return parsed.file;
411
411
  }
412
412
  function parseNonShell(parsed) {
413
- if (!isWin) {
413
+ if (!isWin2) {
414
414
  return parsed;
415
415
  }
416
416
  const commandFile = detectShebang(parsed);
@@ -450,11 +450,11 @@ var require_parse = __commonJS({
450
450
  }
451
451
  });
452
452
 
453
- // node_modules/cross-spawn/lib/enoent.js
453
+ // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
454
454
  var require_enoent = __commonJS({
455
- "node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
455
+ "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
456
456
  "use strict";
457
- var isWin = process.platform === "win32";
457
+ var isWin2 = process.platform === "win32";
458
458
  function notFoundError(original, syscall) {
459
459
  return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
460
460
  code: "ENOENT",
@@ -465,7 +465,7 @@ var require_enoent = __commonJS({
465
465
  });
466
466
  }
467
467
  function hookChildProcess(cp, parsed) {
468
- if (!isWin) {
468
+ if (!isWin2) {
469
469
  return;
470
470
  }
471
471
  const originalEmit = cp.emit;
@@ -480,13 +480,13 @@ var require_enoent = __commonJS({
480
480
  };
481
481
  }
482
482
  function verifyENOENT(status, parsed) {
483
- if (isWin && status === 1 && !parsed.file) {
483
+ if (isWin2 && status === 1 && !parsed.file) {
484
484
  return notFoundError(parsed.original, "spawn");
485
485
  }
486
486
  return null;
487
487
  }
488
488
  function verifyENOENTSync(status, parsed) {
489
- if (isWin && status === 1 && !parsed.file) {
489
+ if (isWin2 && status === 1 && !parsed.file) {
490
490
  return notFoundError(parsed.original, "spawnSync");
491
491
  }
492
492
  return null;
@@ -500,9 +500,9 @@ var require_enoent = __commonJS({
500
500
  }
501
501
  });
502
502
 
503
- // node_modules/cross-spawn/index.js
503
+ // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
504
504
  var require_cross_spawn = __commonJS({
505
- "node_modules/cross-spawn/index.js"(exports2, module2) {
505
+ "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
506
506
  "use strict";
507
507
  var cp = require("child_process");
508
508
  var parse3 = require_parse();
@@ -527,7 +527,7 @@ var require_cross_spawn = __commonJS({
527
527
  }
528
528
  });
529
529
 
530
- // node_modules/zod/v4/classic/external.js
530
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
531
531
  var external_exports = {};
532
532
  __export(external_exports, {
533
533
  $brand: () => $brand,
@@ -768,7 +768,7 @@ __export(external_exports, {
768
768
  xor: () => xor
769
769
  });
770
770
 
771
- // node_modules/zod/v4/core/index.js
771
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/index.js
772
772
  var core_exports2 = {};
773
773
  __export(core_exports2, {
774
774
  $ZodAny: () => $ZodAny,
@@ -1046,7 +1046,7 @@ __export(core_exports2, {
1046
1046
  version: () => version
1047
1047
  });
1048
1048
 
1049
- // node_modules/zod/v4/core/core.js
1049
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
1050
1050
  var NEVER = Object.freeze({
1051
1051
  status: "aborted"
1052
1052
  });
@@ -1121,7 +1121,7 @@ function config(newConfig) {
1121
1121
  return globalConfig;
1122
1122
  }
1123
1123
 
1124
- // node_modules/zod/v4/core/util.js
1124
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
1125
1125
  var util_exports = {};
1126
1126
  __export(util_exports, {
1127
1127
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -1800,7 +1800,7 @@ var Class = class {
1800
1800
  }
1801
1801
  };
1802
1802
 
1803
- // node_modules/zod/v4/core/errors.js
1803
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
1804
1804
  var initializer = (inst, def) => {
1805
1805
  inst.name = "$ZodError";
1806
1806
  Object.defineProperty(inst, "_zod", {
@@ -1936,7 +1936,7 @@ function prettifyError(error48) {
1936
1936
  return lines.join("\n");
1937
1937
  }
1938
1938
 
1939
- // node_modules/zod/v4/core/parse.js
1939
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
1940
1940
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
1941
1941
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
1942
1942
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -2024,7 +2024,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
2024
2024
  };
2025
2025
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
2026
2026
 
2027
- // node_modules/zod/v4/core/regexes.js
2027
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
2028
2028
  var regexes_exports = {};
2029
2029
  __export(regexes_exports, {
2030
2030
  base64: () => base64,
@@ -2181,7 +2181,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
2181
2181
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
2182
2182
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
2183
2183
 
2184
- // node_modules/zod/v4/core/checks.js
2184
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
2185
2185
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
2186
2186
  var _a2;
2187
2187
  inst._zod ?? (inst._zod = {});
@@ -2729,7 +2729,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
2729
2729
  };
2730
2730
  });
2731
2731
 
2732
- // node_modules/zod/v4/core/doc.js
2732
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
2733
2733
  var Doc = class {
2734
2734
  constructor(args = []) {
2735
2735
  this.content = [];
@@ -2765,14 +2765,14 @@ var Doc = class {
2765
2765
  }
2766
2766
  };
2767
2767
 
2768
- // node_modules/zod/v4/core/versions.js
2768
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
2769
2769
  var version = {
2770
2770
  major: 4,
2771
2771
  minor: 3,
2772
2772
  patch: 6
2773
2773
  };
2774
2774
 
2775
- // node_modules/zod/v4/core/schemas.js
2775
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
2776
2776
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2777
2777
  var _a2;
2778
2778
  inst ?? (inst = {});
@@ -4743,7 +4743,7 @@ function handleRefineResult(result, payload, input, inst) {
4743
4743
  }
4744
4744
  }
4745
4745
 
4746
- // node_modules/zod/v4/locales/index.js
4746
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/index.js
4747
4747
  var locales_exports = {};
4748
4748
  __export(locales_exports, {
4749
4749
  ar: () => ar_default,
@@ -4797,7 +4797,7 @@ __export(locales_exports, {
4797
4797
  zhTW: () => zh_TW_default
4798
4798
  });
4799
4799
 
4800
- // node_modules/zod/v4/locales/ar.js
4800
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ar.js
4801
4801
  var error = () => {
4802
4802
  const Sizable = {
4803
4803
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -4904,7 +4904,7 @@ function ar_default() {
4904
4904
  };
4905
4905
  }
4906
4906
 
4907
- // node_modules/zod/v4/locales/az.js
4907
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/az.js
4908
4908
  var error2 = () => {
4909
4909
  const Sizable = {
4910
4910
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
@@ -5010,7 +5010,7 @@ function az_default() {
5010
5010
  };
5011
5011
  }
5012
5012
 
5013
- // node_modules/zod/v4/locales/be.js
5013
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/be.js
5014
5014
  function getBelarusianPlural(count, one, few, many) {
5015
5015
  const absCount = Math.abs(count);
5016
5016
  const lastDigit = absCount % 10;
@@ -5167,7 +5167,7 @@ function be_default() {
5167
5167
  };
5168
5168
  }
5169
5169
 
5170
- // node_modules/zod/v4/locales/bg.js
5170
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/bg.js
5171
5171
  var error4 = () => {
5172
5172
  const Sizable = {
5173
5173
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -5288,7 +5288,7 @@ function bg_default() {
5288
5288
  };
5289
5289
  }
5290
5290
 
5291
- // node_modules/zod/v4/locales/ca.js
5291
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ca.js
5292
5292
  var error5 = () => {
5293
5293
  const Sizable = {
5294
5294
  string: { unit: "car\xE0cters", verb: "contenir" },
@@ -5397,7 +5397,7 @@ function ca_default() {
5397
5397
  };
5398
5398
  }
5399
5399
 
5400
- // node_modules/zod/v4/locales/cs.js
5400
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/cs.js
5401
5401
  var error6 = () => {
5402
5402
  const Sizable = {
5403
5403
  string: { unit: "znak\u016F", verb: "m\xEDt" },
@@ -5509,7 +5509,7 @@ function cs_default() {
5509
5509
  };
5510
5510
  }
5511
5511
 
5512
- // node_modules/zod/v4/locales/da.js
5512
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/da.js
5513
5513
  var error7 = () => {
5514
5514
  const Sizable = {
5515
5515
  string: { unit: "tegn", verb: "havde" },
@@ -5625,7 +5625,7 @@ function da_default() {
5625
5625
  };
5626
5626
  }
5627
5627
 
5628
- // node_modules/zod/v4/locales/de.js
5628
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/de.js
5629
5629
  var error8 = () => {
5630
5630
  const Sizable = {
5631
5631
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -5734,7 +5734,7 @@ function de_default() {
5734
5734
  };
5735
5735
  }
5736
5736
 
5737
- // node_modules/zod/v4/locales/en.js
5737
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/en.js
5738
5738
  var error9 = () => {
5739
5739
  const Sizable = {
5740
5740
  string: { unit: "characters", verb: "to have" },
@@ -5843,7 +5843,7 @@ function en_default() {
5843
5843
  };
5844
5844
  }
5845
5845
 
5846
- // node_modules/zod/v4/locales/eo.js
5846
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/eo.js
5847
5847
  var error10 = () => {
5848
5848
  const Sizable = {
5849
5849
  string: { unit: "karaktrojn", verb: "havi" },
@@ -5953,7 +5953,7 @@ function eo_default() {
5953
5953
  };
5954
5954
  }
5955
5955
 
5956
- // node_modules/zod/v4/locales/es.js
5956
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/es.js
5957
5957
  var error11 = () => {
5958
5958
  const Sizable = {
5959
5959
  string: { unit: "caracteres", verb: "tener" },
@@ -6086,7 +6086,7 @@ function es_default() {
6086
6086
  };
6087
6087
  }
6088
6088
 
6089
- // node_modules/zod/v4/locales/fa.js
6089
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fa.js
6090
6090
  var error12 = () => {
6091
6091
  const Sizable = {
6092
6092
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -6201,7 +6201,7 @@ function fa_default() {
6201
6201
  };
6202
6202
  }
6203
6203
 
6204
- // node_modules/zod/v4/locales/fi.js
6204
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fi.js
6205
6205
  var error13 = () => {
6206
6206
  const Sizable = {
6207
6207
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
@@ -6314,7 +6314,7 @@ function fi_default() {
6314
6314
  };
6315
6315
  }
6316
6316
 
6317
- // node_modules/zod/v4/locales/fr.js
6317
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fr.js
6318
6318
  var error14 = () => {
6319
6319
  const Sizable = {
6320
6320
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -6423,7 +6423,7 @@ function fr_default() {
6423
6423
  };
6424
6424
  }
6425
6425
 
6426
- // node_modules/zod/v4/locales/fr-CA.js
6426
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fr-CA.js
6427
6427
  var error15 = () => {
6428
6428
  const Sizable = {
6429
6429
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -6531,7 +6531,7 @@ function fr_CA_default() {
6531
6531
  };
6532
6532
  }
6533
6533
 
6534
- // node_modules/zod/v4/locales/he.js
6534
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/he.js
6535
6535
  var error16 = () => {
6536
6536
  const TypeNames = {
6537
6537
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
@@ -6726,7 +6726,7 @@ function he_default() {
6726
6726
  };
6727
6727
  }
6728
6728
 
6729
- // node_modules/zod/v4/locales/hu.js
6729
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/hu.js
6730
6730
  var error17 = () => {
6731
6731
  const Sizable = {
6732
6732
  string: { unit: "karakter", verb: "legyen" },
@@ -6835,7 +6835,7 @@ function hu_default() {
6835
6835
  };
6836
6836
  }
6837
6837
 
6838
- // node_modules/zod/v4/locales/hy.js
6838
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/hy.js
6839
6839
  function getArmenianPlural(count, one, many) {
6840
6840
  return Math.abs(count) === 1 ? one : many;
6841
6841
  }
@@ -6983,7 +6983,7 @@ function hy_default() {
6983
6983
  };
6984
6984
  }
6985
6985
 
6986
- // node_modules/zod/v4/locales/id.js
6986
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/id.js
6987
6987
  var error19 = () => {
6988
6988
  const Sizable = {
6989
6989
  string: { unit: "karakter", verb: "memiliki" },
@@ -7090,7 +7090,7 @@ function id_default() {
7090
7090
  };
7091
7091
  }
7092
7092
 
7093
- // node_modules/zod/v4/locales/is.js
7093
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/is.js
7094
7094
  var error20 = () => {
7095
7095
  const Sizable = {
7096
7096
  string: { unit: "stafi", verb: "a\xF0 hafa" },
@@ -7200,7 +7200,7 @@ function is_default() {
7200
7200
  };
7201
7201
  }
7202
7202
 
7203
- // node_modules/zod/v4/locales/it.js
7203
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/it.js
7204
7204
  var error21 = () => {
7205
7205
  const Sizable = {
7206
7206
  string: { unit: "caratteri", verb: "avere" },
@@ -7309,7 +7309,7 @@ function it_default() {
7309
7309
  };
7310
7310
  }
7311
7311
 
7312
- // node_modules/zod/v4/locales/ja.js
7312
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ja.js
7313
7313
  var error22 = () => {
7314
7314
  const Sizable = {
7315
7315
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
@@ -7417,7 +7417,7 @@ function ja_default() {
7417
7417
  };
7418
7418
  }
7419
7419
 
7420
- // node_modules/zod/v4/locales/ka.js
7420
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ka.js
7421
7421
  var error23 = () => {
7422
7422
  const Sizable = {
7423
7423
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -7530,7 +7530,7 @@ function ka_default() {
7530
7530
  };
7531
7531
  }
7532
7532
 
7533
- // node_modules/zod/v4/locales/km.js
7533
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/km.js
7534
7534
  var error24 = () => {
7535
7535
  const Sizable = {
7536
7536
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -7641,12 +7641,12 @@ function km_default() {
7641
7641
  };
7642
7642
  }
7643
7643
 
7644
- // node_modules/zod/v4/locales/kh.js
7644
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/kh.js
7645
7645
  function kh_default() {
7646
7646
  return km_default();
7647
7647
  }
7648
7648
 
7649
- // node_modules/zod/v4/locales/ko.js
7649
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ko.js
7650
7650
  var error25 = () => {
7651
7651
  const Sizable = {
7652
7652
  string: { unit: "\uBB38\uC790", verb: "to have" },
@@ -7758,7 +7758,7 @@ function ko_default() {
7758
7758
  };
7759
7759
  }
7760
7760
 
7761
- // node_modules/zod/v4/locales/lt.js
7761
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/lt.js
7762
7762
  var capitalizeFirstCharacter = (text) => {
7763
7763
  return text.charAt(0).toUpperCase() + text.slice(1);
7764
7764
  };
@@ -7962,7 +7962,7 @@ function lt_default() {
7962
7962
  };
7963
7963
  }
7964
7964
 
7965
- // node_modules/zod/v4/locales/mk.js
7965
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/mk.js
7966
7966
  var error27 = () => {
7967
7967
  const Sizable = {
7968
7968
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -8072,7 +8072,7 @@ function mk_default() {
8072
8072
  };
8073
8073
  }
8074
8074
 
8075
- // node_modules/zod/v4/locales/ms.js
8075
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ms.js
8076
8076
  var error28 = () => {
8077
8077
  const Sizable = {
8078
8078
  string: { unit: "aksara", verb: "mempunyai" },
@@ -8180,7 +8180,7 @@ function ms_default() {
8180
8180
  };
8181
8181
  }
8182
8182
 
8183
- // node_modules/zod/v4/locales/nl.js
8183
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/nl.js
8184
8184
  var error29 = () => {
8185
8185
  const Sizable = {
8186
8186
  string: { unit: "tekens", verb: "heeft" },
@@ -8291,7 +8291,7 @@ function nl_default() {
8291
8291
  };
8292
8292
  }
8293
8293
 
8294
- // node_modules/zod/v4/locales/no.js
8294
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/no.js
8295
8295
  var error30 = () => {
8296
8296
  const Sizable = {
8297
8297
  string: { unit: "tegn", verb: "\xE5 ha" },
@@ -8400,7 +8400,7 @@ function no_default() {
8400
8400
  };
8401
8401
  }
8402
8402
 
8403
- // node_modules/zod/v4/locales/ota.js
8403
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ota.js
8404
8404
  var error31 = () => {
8405
8405
  const Sizable = {
8406
8406
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
@@ -8510,7 +8510,7 @@ function ota_default() {
8510
8510
  };
8511
8511
  }
8512
8512
 
8513
- // node_modules/zod/v4/locales/ps.js
8513
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ps.js
8514
8514
  var error32 = () => {
8515
8515
  const Sizable = {
8516
8516
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
@@ -8625,7 +8625,7 @@ function ps_default() {
8625
8625
  };
8626
8626
  }
8627
8627
 
8628
- // node_modules/zod/v4/locales/pl.js
8628
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/pl.js
8629
8629
  var error33 = () => {
8630
8630
  const Sizable = {
8631
8631
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
@@ -8735,7 +8735,7 @@ function pl_default() {
8735
8735
  };
8736
8736
  }
8737
8737
 
8738
- // node_modules/zod/v4/locales/pt.js
8738
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/pt.js
8739
8739
  var error34 = () => {
8740
8740
  const Sizable = {
8741
8741
  string: { unit: "caracteres", verb: "ter" },
@@ -8844,7 +8844,7 @@ function pt_default() {
8844
8844
  };
8845
8845
  }
8846
8846
 
8847
- // node_modules/zod/v4/locales/ru.js
8847
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ru.js
8848
8848
  function getRussianPlural(count, one, few, many) {
8849
8849
  const absCount = Math.abs(count);
8850
8850
  const lastDigit = absCount % 10;
@@ -9001,7 +9001,7 @@ function ru_default() {
9001
9001
  };
9002
9002
  }
9003
9003
 
9004
- // node_modules/zod/v4/locales/sl.js
9004
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/sl.js
9005
9005
  var error36 = () => {
9006
9006
  const Sizable = {
9007
9007
  string: { unit: "znakov", verb: "imeti" },
@@ -9111,7 +9111,7 @@ function sl_default() {
9111
9111
  };
9112
9112
  }
9113
9113
 
9114
- // node_modules/zod/v4/locales/sv.js
9114
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/sv.js
9115
9115
  var error37 = () => {
9116
9116
  const Sizable = {
9117
9117
  string: { unit: "tecken", verb: "att ha" },
@@ -9222,7 +9222,7 @@ function sv_default() {
9222
9222
  };
9223
9223
  }
9224
9224
 
9225
- // node_modules/zod/v4/locales/ta.js
9225
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ta.js
9226
9226
  var error38 = () => {
9227
9227
  const Sizable = {
9228
9228
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -9333,7 +9333,7 @@ function ta_default() {
9333
9333
  };
9334
9334
  }
9335
9335
 
9336
- // node_modules/zod/v4/locales/th.js
9336
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/th.js
9337
9337
  var error39 = () => {
9338
9338
  const Sizable = {
9339
9339
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -9444,7 +9444,7 @@ function th_default() {
9444
9444
  };
9445
9445
  }
9446
9446
 
9447
- // node_modules/zod/v4/locales/tr.js
9447
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/tr.js
9448
9448
  var error40 = () => {
9449
9449
  const Sizable = {
9450
9450
  string: { unit: "karakter", verb: "olmal\u0131" },
@@ -9550,7 +9550,7 @@ function tr_default() {
9550
9550
  };
9551
9551
  }
9552
9552
 
9553
- // node_modules/zod/v4/locales/uk.js
9553
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/uk.js
9554
9554
  var error41 = () => {
9555
9555
  const Sizable = {
9556
9556
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -9659,12 +9659,12 @@ function uk_default() {
9659
9659
  };
9660
9660
  }
9661
9661
 
9662
- // node_modules/zod/v4/locales/ua.js
9662
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ua.js
9663
9663
  function ua_default() {
9664
9664
  return uk_default();
9665
9665
  }
9666
9666
 
9667
- // node_modules/zod/v4/locales/ur.js
9667
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ur.js
9668
9668
  var error42 = () => {
9669
9669
  const Sizable = {
9670
9670
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
@@ -9775,7 +9775,7 @@ function ur_default() {
9775
9775
  };
9776
9776
  }
9777
9777
 
9778
- // node_modules/zod/v4/locales/uz.js
9778
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/uz.js
9779
9779
  var error43 = () => {
9780
9780
  const Sizable = {
9781
9781
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
@@ -9885,7 +9885,7 @@ function uz_default() {
9885
9885
  };
9886
9886
  }
9887
9887
 
9888
- // node_modules/zod/v4/locales/vi.js
9888
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/vi.js
9889
9889
  var error44 = () => {
9890
9890
  const Sizable = {
9891
9891
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
@@ -9994,7 +9994,7 @@ function vi_default() {
9994
9994
  };
9995
9995
  }
9996
9996
 
9997
- // node_modules/zod/v4/locales/zh-CN.js
9997
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/zh-CN.js
9998
9998
  var error45 = () => {
9999
9999
  const Sizable = {
10000
10000
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
@@ -10104,7 +10104,7 @@ function zh_CN_default() {
10104
10104
  };
10105
10105
  }
10106
10106
 
10107
- // node_modules/zod/v4/locales/zh-TW.js
10107
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/zh-TW.js
10108
10108
  var error46 = () => {
10109
10109
  const Sizable = {
10110
10110
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
@@ -10212,7 +10212,7 @@ function zh_TW_default() {
10212
10212
  };
10213
10213
  }
10214
10214
 
10215
- // node_modules/zod/v4/locales/yo.js
10215
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/yo.js
10216
10216
  var error47 = () => {
10217
10217
  const Sizable = {
10218
10218
  string: { unit: "\xE0mi", verb: "n\xED" },
@@ -10320,7 +10320,7 @@ function yo_default() {
10320
10320
  };
10321
10321
  }
10322
10322
 
10323
- // node_modules/zod/v4/core/registries.js
10323
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
10324
10324
  var _a;
10325
10325
  var $output = Symbol("ZodOutput");
10326
10326
  var $input = Symbol("ZodInput");
@@ -10370,7 +10370,7 @@ function registry() {
10370
10370
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
10371
10371
  var globalRegistry = globalThis.__zod_globalRegistry;
10372
10372
 
10373
- // node_modules/zod/v4/core/api.js
10373
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
10374
10374
  // @__NO_SIDE_EFFECTS__
10375
10375
  function _string(Class2, params) {
10376
10376
  return new Class2({
@@ -11409,7 +11409,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
11409
11409
  return inst;
11410
11410
  }
11411
11411
 
11412
- // node_modules/zod/v4/core/to-json-schema.js
11412
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
11413
11413
  function initializeContext(params) {
11414
11414
  let target = params?.target ?? "draft-2020-12";
11415
11415
  if (target === "draft-4")
@@ -11761,7 +11761,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
11761
11761
  return finalize(ctx, schema);
11762
11762
  };
11763
11763
 
11764
- // node_modules/zod/v4/core/json-schema-processors.js
11764
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
11765
11765
  var formatMap = {
11766
11766
  guid: "uuid",
11767
11767
  url: "uri",
@@ -12312,7 +12312,7 @@ function toJSONSchema(input, params) {
12312
12312
  return finalize(ctx, input);
12313
12313
  }
12314
12314
 
12315
- // node_modules/zod/v4/core/json-schema-generator.js
12315
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-generator.js
12316
12316
  var JSONSchemaGenerator = class {
12317
12317
  /** @deprecated Access via ctx instead */
12318
12318
  get metadataRegistry() {
@@ -12387,10 +12387,10 @@ var JSONSchemaGenerator = class {
12387
12387
  }
12388
12388
  };
12389
12389
 
12390
- // node_modules/zod/v4/core/json-schema.js
12390
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.js
12391
12391
  var json_schema_exports = {};
12392
12392
 
12393
- // node_modules/zod/v4/classic/schemas.js
12393
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
12394
12394
  var schemas_exports2 = {};
12395
12395
  __export(schemas_exports2, {
12396
12396
  ZodAny: () => ZodAny,
@@ -12559,7 +12559,7 @@ __export(schemas_exports2, {
12559
12559
  xor: () => xor
12560
12560
  });
12561
12561
 
12562
- // node_modules/zod/v4/classic/checks.js
12562
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/checks.js
12563
12563
  var checks_exports2 = {};
12564
12564
  __export(checks_exports2, {
12565
12565
  endsWith: () => _endsWith,
@@ -12593,7 +12593,7 @@ __export(checks_exports2, {
12593
12593
  uppercase: () => _uppercase
12594
12594
  });
12595
12595
 
12596
- // node_modules/zod/v4/classic/iso.js
12596
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
12597
12597
  var iso_exports = {};
12598
12598
  __export(iso_exports, {
12599
12599
  ZodISODate: () => ZodISODate,
@@ -12634,7 +12634,7 @@ function duration2(params) {
12634
12634
  return _isoDuration(ZodISODuration, params);
12635
12635
  }
12636
12636
 
12637
- // node_modules/zod/v4/classic/errors.js
12637
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
12638
12638
  var initializer2 = (inst, issues) => {
12639
12639
  $ZodError.init(inst, issues);
12640
12640
  inst.name = "ZodError";
@@ -12674,7 +12674,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
12674
12674
  Parent: Error
12675
12675
  });
12676
12676
 
12677
- // node_modules/zod/v4/classic/parse.js
12677
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
12678
12678
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
12679
12679
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
12680
12680
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -12688,7 +12688,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
12688
12688
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
12689
12689
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
12690
12690
 
12691
- // node_modules/zod/v4/classic/schemas.js
12691
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
12692
12692
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
12693
12693
  $ZodType.init(inst, def);
12694
12694
  Object.assign(inst["~standard"], {
@@ -13767,7 +13767,7 @@ function preprocess(fn, schema) {
13767
13767
  return pipe(transform(fn), schema);
13768
13768
  }
13769
13769
 
13770
- // node_modules/zod/v4/classic/compat.js
13770
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/compat.js
13771
13771
  var ZodIssueCode = {
13772
13772
  invalid_type: "invalid_type",
13773
13773
  too_big: "too_big",
@@ -13793,7 +13793,7 @@ var ZodFirstPartyTypeKind;
13793
13793
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
13794
13794
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
13795
13795
 
13796
- // node_modules/zod/v4/classic/from-json-schema.js
13796
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js
13797
13797
  var z = {
13798
13798
  ...schemas_exports2,
13799
13799
  ...checks_exports2,
@@ -14267,7 +14267,7 @@ function fromJSONSchema(schema, params) {
14267
14267
  return convertSchema(schema, ctx);
14268
14268
  }
14269
14269
 
14270
- // node_modules/zod/v4/classic/coerce.js
14270
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/coerce.js
14271
14271
  var coerce_exports = {};
14272
14272
  __export(coerce_exports, {
14273
14273
  bigint: () => bigint3,
@@ -14292,10 +14292,10 @@ function date4(params) {
14292
14292
  return _coercedDate(ZodDate, params);
14293
14293
  }
14294
14294
 
14295
- // node_modules/zod/v4/classic/external.js
14295
+ // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
14296
14296
  config(en_default());
14297
14297
 
14298
- // node_modules/@agentclientprotocol/sdk/dist/schema/index.js
14298
+ // node_modules/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
14299
14299
  var AGENT_METHODS = {
14300
14300
  authenticate: "authenticate",
14301
14301
  initialize: "initialize",
@@ -14323,7 +14323,7 @@ var CLIENT_METHODS = {
14323
14323
  terminal_wait_for_exit: "terminal/wait_for_exit"
14324
14324
  };
14325
14325
 
14326
- // node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js
14326
+ // node_modules/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js
14327
14327
  var zAuthCapabilities = external_exports.object({
14328
14328
  _meta: external_exports.record(external_exports.string(), external_exports.unknown()).nullish(),
14329
14329
  terminal: external_exports.boolean().optional().default(false)
@@ -15186,7 +15186,7 @@ var zClientResponse = external_exports.union([
15186
15186
  })
15187
15187
  ]);
15188
15188
 
15189
- // node_modules/@agentclientprotocol/sdk/dist/stream.js
15189
+ // node_modules/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/stream.js
15190
15190
  function ndJsonStream(output, input) {
15191
15191
  const textEncoder = new TextEncoder();
15192
15192
  const textDecoder = new TextDecoder();
@@ -15238,7 +15238,7 @@ function ndJsonStream(output, input) {
15238
15238
  return { readable, writable };
15239
15239
  }
15240
15240
 
15241
- // node_modules/@agentclientprotocol/sdk/dist/acp.js
15241
+ // node_modules/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/acp.js
15242
15242
  var AgentSideConnection = class {
15243
15243
  #connection;
15244
15244
  /**
@@ -15811,7 +15811,7 @@ var RequestError = class _RequestError extends Error {
15811
15811
  }
15812
15812
  };
15813
15813
 
15814
- // node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
15814
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
15815
15815
  var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
15816
15816
  let lastEventId;
15817
15817
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
@@ -15930,7 +15930,7 @@ var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer,
15930
15930
  return { stream };
15931
15931
  };
15932
15932
 
15933
- // node_modules/@opencode-ai/sdk/dist/v2/gen/core/pathSerializer.gen.js
15933
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/pathSerializer.gen.js
15934
15934
  var separatorArrayExplode = (style) => {
15935
15935
  switch (style) {
15936
15936
  case "label":
@@ -16033,7 +16033,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
16033
16033
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
16034
16034
  };
16035
16035
 
16036
- // node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
16036
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
16037
16037
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
16038
16038
  var defaultPathSerializer = ({ path, url: _url2 }) => {
16039
16039
  let url2 = _url2;
@@ -16116,7 +16116,7 @@ function getValidRequestBody(options) {
16116
16116
  return void 0;
16117
16117
  }
16118
16118
 
16119
- // node_modules/@opencode-ai/sdk/dist/v2/gen/core/auth.gen.js
16119
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/auth.gen.js
16120
16120
  var getAuthToken = async (auth, callback) => {
16121
16121
  const token = typeof callback === "function" ? await callback(auth) : callback;
16122
16122
  if (!token) {
@@ -16131,12 +16131,12 @@ var getAuthToken = async (auth, callback) => {
16131
16131
  return token;
16132
16132
  };
16133
16133
 
16134
- // node_modules/@opencode-ai/sdk/dist/v2/gen/core/bodySerializer.gen.js
16134
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/bodySerializer.gen.js
16135
16135
  var jsonBodySerializer = {
16136
16136
  bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
16137
16137
  };
16138
16138
 
16139
- // node_modules/@opencode-ai/sdk/dist/v2/gen/client/utils.gen.js
16139
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/client/utils.gen.js
16140
16140
  var createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
16141
16141
  const querySerializer = (queryParams) => {
16142
16142
  const search = [];
@@ -16346,7 +16346,7 @@ var createConfig = (override = {}) => ({
16346
16346
  ...override
16347
16347
  });
16348
16348
 
16349
- // node_modules/@opencode-ai/sdk/dist/v2/gen/client/client.gen.js
16349
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/client/client.gen.js
16350
16350
  var createClient = (config2 = {}) => {
16351
16351
  let _config = mergeConfigs(createConfig(), config2);
16352
16352
  const getConfig = () => ({ ..._config });
@@ -16554,7 +16554,7 @@ var createClient = (config2 = {}) => {
16554
16554
  };
16555
16555
  };
16556
16556
 
16557
- // node_modules/@opencode-ai/sdk/dist/v2/gen/core/params.gen.js
16557
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/params.gen.js
16558
16558
  var extraPrefixesMap = {
16559
16559
  $body_: "body",
16560
16560
  $headers_: "headers",
@@ -16650,10 +16650,10 @@ var buildClientParams = (args, fields) => {
16650
16650
  return params;
16651
16651
  };
16652
16652
 
16653
- // node_modules/@opencode-ai/sdk/dist/v2/gen/client.gen.js
16653
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/client.gen.js
16654
16654
  var client = createClient(createConfig({ baseUrl: "http://localhost:4096" }));
16655
16655
 
16656
- // node_modules/@opencode-ai/sdk/dist/v2/gen/sdk.gen.js
16656
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/sdk.gen.js
16657
16657
  var HeyApiClient = class {
16658
16658
  client;
16659
16659
  constructor(args) {
@@ -19510,7 +19510,7 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
19510
19510
  }
19511
19511
  };
19512
19512
 
19513
- // node_modules/@opencode-ai/sdk/dist/v2/client.js
19513
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/client.js
19514
19514
  function pick2(value, fallback, encode3) {
19515
19515
  if (!value)
19516
19516
  return;
@@ -19583,9 +19583,12 @@ function createOpencodeClient(config2) {
19583
19583
  return new OpencodeClient({ client: client2 });
19584
19584
  }
19585
19585
 
19586
- // node_modules/@opencode-ai/sdk/dist/v2/server.js
19586
+ // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/server.js
19587
19587
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
19588
19588
 
19589
+ // src/agent.ts
19590
+ var import_url2 = require("url");
19591
+
19589
19592
  // src/session-manager.ts
19590
19593
  var SessionManager = class {
19591
19594
  sessions = /* @__PURE__ */ new Map();
@@ -19724,7 +19727,562 @@ var SessionManager = class {
19724
19727
  }
19725
19728
  };
19726
19729
 
19730
+ // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/util/string.js
19731
+ function hasOnlyWinLineEndings(string4) {
19732
+ return string4.includes("\r\n") && !string4.startsWith("\n") && !string4.match(/[^\r]\n/);
19733
+ }
19734
+ function hasOnlyUnixLineEndings(string4) {
19735
+ return !string4.includes("\r\n") && string4.includes("\n");
19736
+ }
19737
+
19738
+ // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/line-endings.js
19739
+ function unixToWin(patch) {
19740
+ if (Array.isArray(patch)) {
19741
+ return patch.map((p) => unixToWin(p));
19742
+ }
19743
+ return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line, i) => {
19744
+ var _a2;
19745
+ return line.startsWith("\\") || line.endsWith("\r") || ((_a2 = hunk.lines[i + 1]) === null || _a2 === void 0 ? void 0 : _a2.startsWith("\\")) ? line : line + "\r";
19746
+ }) })) });
19747
+ }
19748
+ function winToUnix(patch) {
19749
+ if (Array.isArray(patch)) {
19750
+ return patch.map((p) => winToUnix(p));
19751
+ }
19752
+ return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line) => line.endsWith("\r") ? line.substring(0, line.length - 1) : line) })) });
19753
+ }
19754
+ function isUnix(patch) {
19755
+ if (!Array.isArray(patch)) {
19756
+ patch = [patch];
19757
+ }
19758
+ return !patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => !line.startsWith("\\") && line.endsWith("\r"))));
19759
+ }
19760
+ function isWin(patch) {
19761
+ if (!Array.isArray(patch)) {
19762
+ patch = [patch];
19763
+ }
19764
+ return patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => line.endsWith("\r")))) && patch.every((index) => index.hunks.every((hunk) => hunk.lines.every((line, i) => {
19765
+ var _a2;
19766
+ return line.startsWith("\\") || line.endsWith("\r") || ((_a2 = hunk.lines[i + 1]) === null || _a2 === void 0 ? void 0 : _a2.startsWith("\\"));
19767
+ })));
19768
+ }
19769
+
19770
+ // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/parse.js
19771
+ function parsePatch(uniDiff) {
19772
+ const diffstr = uniDiff.split(/\n/), list = [];
19773
+ let i = 0;
19774
+ function isGitDiffHeader(line) {
19775
+ return /^diff --git /.test(line);
19776
+ }
19777
+ function isDiffHeader(line) {
19778
+ return isGitDiffHeader(line) || /^Index:\s/.test(line) || /^diff(?: -r \w+)+\s/.test(line);
19779
+ }
19780
+ function isFileHeader(line) {
19781
+ return /^(---|\+\+\+)\s/.test(line);
19782
+ }
19783
+ function isHunkHeader(line) {
19784
+ return /^@@\s/.test(line);
19785
+ }
19786
+ function parseIndex() {
19787
+ var _a2;
19788
+ const index = {};
19789
+ index.hunks = [];
19790
+ list.push(index);
19791
+ let seenDiffHeader = false;
19792
+ while (i < diffstr.length) {
19793
+ const line = diffstr[i];
19794
+ if (isFileHeader(line) || isHunkHeader(line)) {
19795
+ break;
19796
+ }
19797
+ if (isGitDiffHeader(line)) {
19798
+ if (seenDiffHeader) {
19799
+ return;
19800
+ }
19801
+ seenDiffHeader = true;
19802
+ index.isGit = true;
19803
+ const paths = parseGitDiffHeader(line);
19804
+ if (paths) {
19805
+ index.oldFileName = paths.oldFileName;
19806
+ index.newFileName = paths.newFileName;
19807
+ }
19808
+ i++;
19809
+ while (i < diffstr.length) {
19810
+ const extLine = diffstr[i];
19811
+ if (isFileHeader(extLine) || isHunkHeader(extLine) || isDiffHeader(extLine)) {
19812
+ break;
19813
+ }
19814
+ const renameFromMatch = /^rename from (.*)/.exec(extLine);
19815
+ if (renameFromMatch) {
19816
+ index.oldFileName = "a/" + unquoteIfQuoted(renameFromMatch[1]);
19817
+ index.isRename = true;
19818
+ }
19819
+ const renameToMatch = /^rename to (.*)/.exec(extLine);
19820
+ if (renameToMatch) {
19821
+ index.newFileName = "b/" + unquoteIfQuoted(renameToMatch[1]);
19822
+ index.isRename = true;
19823
+ }
19824
+ const copyFromMatch = /^copy from (.*)/.exec(extLine);
19825
+ if (copyFromMatch) {
19826
+ index.oldFileName = "a/" + unquoteIfQuoted(copyFromMatch[1]);
19827
+ index.isCopy = true;
19828
+ }
19829
+ const copyToMatch = /^copy to (.*)/.exec(extLine);
19830
+ if (copyToMatch) {
19831
+ index.newFileName = "b/" + unquoteIfQuoted(copyToMatch[1]);
19832
+ index.isCopy = true;
19833
+ }
19834
+ const newFileModeMatch = /^new file mode (\d+)/.exec(extLine);
19835
+ if (newFileModeMatch) {
19836
+ index.isCreate = true;
19837
+ index.newMode = newFileModeMatch[1];
19838
+ }
19839
+ const deletedFileModeMatch = /^deleted file mode (\d+)/.exec(extLine);
19840
+ if (deletedFileModeMatch) {
19841
+ index.isDelete = true;
19842
+ index.oldMode = deletedFileModeMatch[1];
19843
+ }
19844
+ const oldModeMatch = /^old mode (\d+)/.exec(extLine);
19845
+ if (oldModeMatch) {
19846
+ index.oldMode = oldModeMatch[1];
19847
+ }
19848
+ const newModeMatch = /^new mode (\d+)/.exec(extLine);
19849
+ if (newModeMatch) {
19850
+ index.newMode = newModeMatch[1];
19851
+ }
19852
+ if (/^Binary files /.test(extLine)) {
19853
+ index.isBinary = true;
19854
+ }
19855
+ i++;
19856
+ }
19857
+ continue;
19858
+ } else if (isDiffHeader(line)) {
19859
+ if (seenDiffHeader) {
19860
+ return;
19861
+ }
19862
+ seenDiffHeader = true;
19863
+ const headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line);
19864
+ if (headerMatch) {
19865
+ index.index = line.substring(headerMatch[0].length).trim();
19866
+ }
19867
+ }
19868
+ i++;
19869
+ }
19870
+ parseFileHeader(index);
19871
+ parseFileHeader(index);
19872
+ if (index.oldFileName === void 0 !== (index.newFileName === void 0)) {
19873
+ throw new Error("Missing " + (index.oldFileName !== void 0 ? '"+++ ..."' : '"--- ..."') + " file header for " + ((_a2 = index.oldFileName) !== null && _a2 !== void 0 ? _a2 : index.newFileName));
19874
+ }
19875
+ while (i < diffstr.length) {
19876
+ const line = diffstr[i];
19877
+ if (isDiffHeader(line) || isFileHeader(line) || /^===================================================================/.test(line)) {
19878
+ break;
19879
+ } else if (isHunkHeader(line)) {
19880
+ index.hunks.push(parseHunk());
19881
+ } else {
19882
+ i++;
19883
+ }
19884
+ }
19885
+ }
19886
+ function parseGitDiffHeader(line) {
19887
+ const rest = line.substring("diff --git ".length);
19888
+ if (rest.startsWith('"')) {
19889
+ const oldPath = parseQuotedFileName(rest);
19890
+ if (oldPath === null) {
19891
+ return null;
19892
+ }
19893
+ const afterOld = rest.substring(oldPath.rawLength + 1);
19894
+ let newFileName;
19895
+ if (afterOld.startsWith('"')) {
19896
+ const newPath = parseQuotedFileName(afterOld);
19897
+ if (newPath === null) {
19898
+ return null;
19899
+ }
19900
+ newFileName = newPath.fileName;
19901
+ } else {
19902
+ newFileName = afterOld;
19903
+ }
19904
+ return {
19905
+ oldFileName: oldPath.fileName,
19906
+ newFileName
19907
+ };
19908
+ }
19909
+ const quoteIdx = rest.indexOf('"');
19910
+ if (quoteIdx > 0) {
19911
+ const oldFileName = rest.substring(0, quoteIdx - 1);
19912
+ const newPath = parseQuotedFileName(rest.substring(quoteIdx));
19913
+ if (newPath === null) {
19914
+ return null;
19915
+ }
19916
+ return {
19917
+ oldFileName,
19918
+ newFileName: newPath.fileName
19919
+ };
19920
+ }
19921
+ if (rest.startsWith("a/")) {
19922
+ const splits = [];
19923
+ let idx = 0;
19924
+ while (true) {
19925
+ idx = rest.indexOf(" b/", idx + 1);
19926
+ if (idx === -1) {
19927
+ break;
19928
+ }
19929
+ splits.push(idx);
19930
+ }
19931
+ if (splits.length > 0) {
19932
+ const mid = splits[Math.floor(splits.length / 2)];
19933
+ return {
19934
+ oldFileName: rest.substring(0, mid),
19935
+ newFileName: rest.substring(mid + 1)
19936
+ };
19937
+ }
19938
+ }
19939
+ return null;
19940
+ }
19941
+ function unquoteIfQuoted(s) {
19942
+ if (s.startsWith('"')) {
19943
+ const parsed = parseQuotedFileName(s);
19944
+ if (parsed) {
19945
+ return parsed.fileName;
19946
+ }
19947
+ }
19948
+ return s;
19949
+ }
19950
+ function parseQuotedFileName(s) {
19951
+ if (!s.startsWith('"')) {
19952
+ return null;
19953
+ }
19954
+ let result = "";
19955
+ let j = 1;
19956
+ while (j < s.length) {
19957
+ if (s[j] === '"') {
19958
+ return { fileName: result, rawLength: j + 1 };
19959
+ }
19960
+ if (s[j] === "\\" && j + 1 < s.length) {
19961
+ j++;
19962
+ switch (s[j]) {
19963
+ case "a":
19964
+ result += "\x07";
19965
+ break;
19966
+ case "b":
19967
+ result += "\b";
19968
+ break;
19969
+ case "f":
19970
+ result += "\f";
19971
+ break;
19972
+ case "n":
19973
+ result += "\n";
19974
+ break;
19975
+ case "r":
19976
+ result += "\r";
19977
+ break;
19978
+ case "t":
19979
+ result += " ";
19980
+ break;
19981
+ case "v":
19982
+ result += "\v";
19983
+ break;
19984
+ case "\\":
19985
+ result += "\\";
19986
+ break;
19987
+ case '"':
19988
+ result += '"';
19989
+ break;
19990
+ case "0":
19991
+ case "1":
19992
+ case "2":
19993
+ case "3":
19994
+ case "4":
19995
+ case "5":
19996
+ case "6":
19997
+ case "7": {
19998
+ if (j + 2 >= s.length || s[j + 1] < "0" || s[j + 1] > "7" || s[j + 2] < "0" || s[j + 2] > "7") {
19999
+ return null;
20000
+ }
20001
+ const bytes = [parseInt(s.substring(j, j + 3), 8)];
20002
+ j += 3;
20003
+ while (s[j] === "\\" && s[j + 1] >= "0" && s[j + 1] <= "7") {
20004
+ if (j + 3 >= s.length || s[j + 2] < "0" || s[j + 2] > "7" || s[j + 3] < "0" || s[j + 3] > "7") {
20005
+ return null;
20006
+ }
20007
+ bytes.push(parseInt(s.substring(j + 1, j + 4), 8));
20008
+ j += 4;
20009
+ }
20010
+ result += new TextDecoder("utf-8").decode(new Uint8Array(bytes));
20011
+ continue;
20012
+ }
20013
+ // Note that in C, there are also three kinds of hex escape sequences:
20014
+ // - \xhh
20015
+ // - \uhhhh
20016
+ // - \Uhhhhhhhh
20017
+ // We do not bother to parse them here because, so far as we know,
20018
+ // they are never emitted by any tools that generate unified diff
20019
+ // format diffs, and so for now jsdiff does not consider them legal.
20020
+ default:
20021
+ return null;
20022
+ }
20023
+ } else {
20024
+ result += s[j];
20025
+ }
20026
+ j++;
20027
+ }
20028
+ return null;
20029
+ }
20030
+ function parseFileHeader(index) {
20031
+ const fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]);
20032
+ if (fileHeaderMatch) {
20033
+ const prefix = fileHeaderMatch[1], data = diffstr[i].substring(3).trim().split(" ", 2), header = (data[1] || "").trim();
20034
+ let fileName = data[0];
20035
+ if (fileName.startsWith('"')) {
20036
+ fileName = unquoteIfQuoted(fileName);
20037
+ } else {
20038
+ fileName = fileName.replace(/\\\\/g, "\\");
20039
+ }
20040
+ if (prefix === "---") {
20041
+ index.oldFileName = fileName;
20042
+ index.oldHeader = header;
20043
+ } else {
20044
+ index.newFileName = fileName;
20045
+ index.newHeader = header;
20046
+ }
20047
+ i++;
20048
+ }
20049
+ }
20050
+ function parseHunk() {
20051
+ var _a2;
20052
+ const chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
20053
+ const hunk = {
20054
+ oldStart: +chunkHeader[1],
20055
+ oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
20056
+ newStart: +chunkHeader[3],
20057
+ newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
20058
+ lines: []
20059
+ };
20060
+ if (hunk.oldLines === 0) {
20061
+ hunk.oldStart += 1;
20062
+ }
20063
+ if (hunk.newLines === 0) {
20064
+ hunk.newStart += 1;
20065
+ }
20066
+ let addCount = 0, removeCount = 0;
20067
+ for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a2 = diffstr[i]) === null || _a2 === void 0 ? void 0 : _a2.startsWith("\\"))); i++) {
20068
+ const operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
20069
+ if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
20070
+ hunk.lines.push(diffstr[i]);
20071
+ if (operation === "+") {
20072
+ addCount++;
20073
+ } else if (operation === "-") {
20074
+ removeCount++;
20075
+ } else if (operation === " ") {
20076
+ addCount++;
20077
+ removeCount++;
20078
+ }
20079
+ } else {
20080
+ throw new Error(`Hunk at line ${chunkHeaderIndex + 1} contained invalid line ${diffstr[i]}`);
20081
+ }
20082
+ }
20083
+ if (!addCount && hunk.newLines === 1) {
20084
+ hunk.newLines = 0;
20085
+ }
20086
+ if (!removeCount && hunk.oldLines === 1) {
20087
+ hunk.oldLines = 0;
20088
+ }
20089
+ if (addCount !== hunk.newLines) {
20090
+ throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
20091
+ }
20092
+ if (removeCount !== hunk.oldLines) {
20093
+ throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
20094
+ }
20095
+ if (i < diffstr.length && diffstr[i] && /^[+ -]/.test(diffstr[i]) && !isFileHeader(diffstr[i])) {
20096
+ throw new Error("Hunk at line " + (chunkHeaderIndex + 1) + " has more lines than expected (expected " + hunk.oldLines + " old lines and " + hunk.newLines + " new lines)");
20097
+ }
20098
+ return hunk;
20099
+ }
20100
+ while (i < diffstr.length) {
20101
+ parseIndex();
20102
+ }
20103
+ return list;
20104
+ }
20105
+
20106
+ // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/util/distance-iterator.js
20107
+ function distance_iterator_default(start, minLine, maxLine) {
20108
+ let wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
20109
+ return function iterator() {
20110
+ if (wantForward && !forwardExhausted) {
20111
+ if (backwardExhausted) {
20112
+ localOffset++;
20113
+ } else {
20114
+ wantForward = false;
20115
+ }
20116
+ if (start + localOffset <= maxLine) {
20117
+ return start + localOffset;
20118
+ }
20119
+ forwardExhausted = true;
20120
+ }
20121
+ if (!backwardExhausted) {
20122
+ if (!forwardExhausted) {
20123
+ wantForward = true;
20124
+ }
20125
+ if (minLine <= start - localOffset) {
20126
+ return start - localOffset++;
20127
+ }
20128
+ backwardExhausted = true;
20129
+ return iterator();
20130
+ }
20131
+ return void 0;
20132
+ };
20133
+ }
20134
+
20135
+ // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/apply.js
20136
+ function applyPatch(source, patch, options = {}) {
20137
+ let patches;
20138
+ if (typeof patch === "string") {
20139
+ patches = parsePatch(patch);
20140
+ } else if (Array.isArray(patch)) {
20141
+ patches = patch;
20142
+ } else {
20143
+ patches = [patch];
20144
+ }
20145
+ if (patches.length > 1) {
20146
+ throw new Error("applyPatch only works with a single input.");
20147
+ }
20148
+ return applyStructuredPatch(source, patches[0], options);
20149
+ }
20150
+ function applyStructuredPatch(source, patch, options = {}) {
20151
+ if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) {
20152
+ if (hasOnlyWinLineEndings(source) && isUnix(patch)) {
20153
+ patch = unixToWin(patch);
20154
+ } else if (hasOnlyUnixLineEndings(source) && isWin(patch)) {
20155
+ patch = winToUnix(patch);
20156
+ }
20157
+ }
20158
+ const lines = source.split("\n"), hunks = patch.hunks, compareLine = options.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent), fuzzFactor = options.fuzzFactor || 0;
20159
+ let minLine = 0;
20160
+ if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) {
20161
+ throw new Error("fuzzFactor must be a non-negative integer");
20162
+ }
20163
+ if (!hunks.length) {
20164
+ return source;
20165
+ }
20166
+ let prevLine = "", removeEOFNL = false, addEOFNL = false;
20167
+ for (let i = 0; i < hunks[hunks.length - 1].lines.length; i++) {
20168
+ const line = hunks[hunks.length - 1].lines[i];
20169
+ if (line[0] == "\\") {
20170
+ if (prevLine[0] == "+") {
20171
+ removeEOFNL = true;
20172
+ } else if (prevLine[0] == "-") {
20173
+ addEOFNL = true;
20174
+ }
20175
+ }
20176
+ prevLine = line;
20177
+ }
20178
+ if (removeEOFNL) {
20179
+ if (addEOFNL) {
20180
+ if (!fuzzFactor && lines[lines.length - 1] == "") {
20181
+ return false;
20182
+ }
20183
+ } else if (lines[lines.length - 1] == "") {
20184
+ lines.pop();
20185
+ } else if (!fuzzFactor) {
20186
+ return false;
20187
+ }
20188
+ } else if (addEOFNL) {
20189
+ if (lines[lines.length - 1] != "") {
20190
+ lines.push("");
20191
+ } else if (!fuzzFactor) {
20192
+ return false;
20193
+ }
20194
+ }
20195
+ function applyHunk(hunkLines, toPos, maxErrors, hunkLinesI = 0, lastContextLineMatched = true, patchedLines = [], patchedLinesLength = 0) {
20196
+ let nConsecutiveOldContextLines = 0;
20197
+ let nextContextLineMustMatch = false;
20198
+ for (; hunkLinesI < hunkLines.length; hunkLinesI++) {
20199
+ const hunkLine = hunkLines[hunkLinesI], operation = hunkLine.length > 0 ? hunkLine[0] : " ", content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine;
20200
+ if (operation === "-") {
20201
+ if (compareLine(toPos + 1, lines[toPos], operation, content)) {
20202
+ toPos++;
20203
+ nConsecutiveOldContextLines = 0;
20204
+ } else {
20205
+ if (!maxErrors || lines[toPos] == null) {
20206
+ return null;
20207
+ }
20208
+ patchedLines[patchedLinesLength] = lines[toPos];
20209
+ return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1);
20210
+ }
20211
+ }
20212
+ if (operation === "+") {
20213
+ if (!lastContextLineMatched) {
20214
+ return null;
20215
+ }
20216
+ patchedLines[patchedLinesLength] = content;
20217
+ patchedLinesLength++;
20218
+ nConsecutiveOldContextLines = 0;
20219
+ nextContextLineMustMatch = true;
20220
+ }
20221
+ if (operation === " ") {
20222
+ nConsecutiveOldContextLines++;
20223
+ patchedLines[patchedLinesLength] = lines[toPos];
20224
+ if (compareLine(toPos + 1, lines[toPos], operation, content)) {
20225
+ patchedLinesLength++;
20226
+ lastContextLineMatched = true;
20227
+ nextContextLineMustMatch = false;
20228
+ toPos++;
20229
+ } else {
20230
+ if (nextContextLineMustMatch || !maxErrors) {
20231
+ return null;
20232
+ }
20233
+ return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength);
20234
+ }
20235
+ }
20236
+ }
20237
+ patchedLinesLength -= nConsecutiveOldContextLines;
20238
+ toPos -= nConsecutiveOldContextLines;
20239
+ patchedLines.length = patchedLinesLength;
20240
+ return {
20241
+ patchedLines,
20242
+ oldLineLastI: toPos - 1
20243
+ };
20244
+ }
20245
+ const resultLines = [];
20246
+ let prevHunkOffset = 0;
20247
+ for (let i = 0; i < hunks.length; i++) {
20248
+ const hunk = hunks[i];
20249
+ let hunkResult;
20250
+ const maxLine = lines.length - hunk.oldLines + fuzzFactor;
20251
+ let toPos;
20252
+ for (let maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) {
20253
+ toPos = hunk.oldStart + prevHunkOffset - 1;
20254
+ const iterator = distance_iterator_default(toPos, minLine, maxLine);
20255
+ for (; toPos !== void 0; toPos = iterator()) {
20256
+ hunkResult = applyHunk(hunk.lines, toPos, maxErrors);
20257
+ if (hunkResult) {
20258
+ break;
20259
+ }
20260
+ }
20261
+ if (hunkResult) {
20262
+ break;
20263
+ }
20264
+ }
20265
+ if (!hunkResult) {
20266
+ return false;
20267
+ }
20268
+ for (let i2 = minLine; i2 < toPos; i2++) {
20269
+ resultLines.push(lines[i2]);
20270
+ }
20271
+ for (let i2 = 0; i2 < hunkResult.patchedLines.length; i2++) {
20272
+ const line = hunkResult.patchedLines[i2];
20273
+ resultLines.push(line);
20274
+ }
20275
+ minLine = hunkResult.oldLineLastI + 1;
20276
+ prevHunkOffset = toPos + 1 - hunk.oldStart;
20277
+ }
20278
+ for (let i = minLine; i < lines.length; i++) {
20279
+ resultLines.push(lines[i]);
20280
+ }
20281
+ return resultLines.join("\n");
20282
+ }
20283
+
19727
20284
  // src/utils.ts
20285
+ var import_url = require("url");
19728
20286
  function toToolKind(toolName) {
19729
20287
  const tool = toolName.toLowerCase();
19730
20288
  switch (tool) {
@@ -19764,6 +20322,26 @@ function toLocations(toolName, input) {
19764
20322
  return [];
19765
20323
  }
19766
20324
  }
20325
+ function parseUri(uri) {
20326
+ try {
20327
+ if (uri.startsWith("file://")) {
20328
+ const path = uri.slice(7);
20329
+ const name = path.split("/").pop() || path;
20330
+ return { type: "file", url: uri, filename: name, mime: "text/plain" };
20331
+ }
20332
+ if (uri.startsWith("zed://")) {
20333
+ const url2 = new URL(uri);
20334
+ const path = url2.searchParams.get("path");
20335
+ if (path) {
20336
+ const name = path.split("/").pop() || path;
20337
+ return { type: "file", url: (0, import_url.pathToFileURL)(path).href, filename: name, mime: "text/plain" };
20338
+ }
20339
+ }
20340
+ return { type: "text", text: uri };
20341
+ } catch {
20342
+ return { type: "text", text: uri };
20343
+ }
20344
+ }
19767
20345
 
19768
20346
  // src/logger.ts
19769
20347
  var import_fs = require("fs");
@@ -19867,6 +20445,7 @@ function sanitizeAssembled(obj, depth = 0) {
19867
20445
  }
19868
20446
 
19869
20447
  // src/event-handler.ts
20448
+ var QUESTION_TIMEOUT_MS = 6e4;
19870
20449
  var permissionOptions = [
19871
20450
  { optionId: "once", kind: "allow_once", name: "Allow once" },
19872
20451
  { optionId: "always", kind: "allow_always", name: "Always allow" },
@@ -20058,11 +20637,16 @@ var EventHandler = class {
20058
20637
  const filepath = typeof metadata["filepath"] === "string" ? metadata["filepath"] : "";
20059
20638
  const diff = typeof metadata["diff"] === "string" ? metadata["diff"] : "";
20060
20639
  if (filepath && diff) {
20061
- this.connection.writeTextFile({
20062
- sessionId,
20063
- path: filepath,
20064
- content: ""
20065
- });
20640
+ const fileResult = await this.sdk.file.read({ path: filepath, directory }).then((x) => x.data).catch(() => void 0);
20641
+ const original = typeof fileResult?.content === "string" ? fileResult.content : "";
20642
+ const newContent = applyPatch(original, diff);
20643
+ if (newContent !== false) {
20644
+ this.connection.writeTextFile({
20645
+ sessionId,
20646
+ path: filepath,
20647
+ content: newContent
20648
+ });
20649
+ }
20066
20650
  }
20067
20651
  }
20068
20652
  await this.sdk.permission.reply({
@@ -20089,23 +20673,40 @@ var EventHandler = class {
20089
20673
  ocEvent("question.asked", { id: q.id, sessionID: q.sessionID, questions: q.questions.length });
20090
20674
  const prev = this.questionQueues.get(q.sessionID) ?? Promise.resolve();
20091
20675
  const next = prev.then(async () => {
20092
- const res = await this.connection.extMethod("questionAsked", {
20093
- sessionId,
20094
- questionId: q.id,
20095
- questions: q.questions
20096
- }).catch(() => void 0);
20097
- if (!res || !res.answers) {
20676
+ const extResult = await Promise.race([
20677
+ this.connection.extMethod("questionAsked", {
20678
+ sessionId,
20679
+ questionId: q.id,
20680
+ questions: q.questions,
20681
+ ...q.tool && { tool: q.tool }
20682
+ }),
20683
+ new Promise(
20684
+ (_, reject) => setTimeout(() => reject(new Error("questionAsked timeout")), QUESTION_TIMEOUT_MS)
20685
+ )
20686
+ ]).catch((err) => {
20687
+ console.error("[event-handler] extMethod questionAsked failed:", err?.message ?? err);
20688
+ return void 0;
20689
+ });
20690
+ if (!extResult || !extResult.answers) {
20098
20691
  await this.sdk.question.reject({ requestID: q.id, directory }).catch(() => {
20099
20692
  });
20100
20693
  ocEvent("question.rejected", { requestID: q.id });
20101
20694
  return;
20102
20695
  }
20696
+ const answers = extResult.answers;
20697
+ if (!Array.isArray(answers) || !answers.every((a) => Array.isArray(a) && a.every((v) => typeof v === "string"))) {
20698
+ console.error("[event-handler] invalid answers shape from client:", JSON.stringify(answers));
20699
+ await this.sdk.question.reject({ requestID: q.id, directory }).catch(() => {
20700
+ });
20701
+ ocEvent("question.rejected", { requestID: q.id, reason: "invalid_answers" });
20702
+ return;
20703
+ }
20103
20704
  await this.sdk.question.reply({
20104
20705
  requestID: q.id,
20105
20706
  directory,
20106
- answers: res.answers
20707
+ answers
20107
20708
  });
20108
- ocEvent("question.reply", { requestID: q.id, answers: res.answers });
20709
+ ocEvent("question.reply", { requestID: q.id, answers });
20109
20710
  }).catch((err) => {
20110
20711
  console.error("[event-handler] question handling error:", err);
20111
20712
  }).finally(() => {
@@ -20269,6 +20870,26 @@ var EventHandler = class {
20269
20870
  const newText = typeof input["newString"] === "string" ? input["newString"] : typeof input["content"] === "string" ? input["content"] : "";
20270
20871
  content.push({ type: "diff", path: filePath, oldText, newText });
20271
20872
  }
20873
+ if (part.tool === "todowrite") {
20874
+ try {
20875
+ const todos = JSON.parse(part.state.output);
20876
+ if (Array.isArray(todos)) {
20877
+ await this.sendToClient({
20878
+ sessionId,
20879
+ update: {
20880
+ sessionUpdate: "plan",
20881
+ entries: todos.map((todo) => ({
20882
+ priority: "medium",
20883
+ status: todo.status === "cancelled" ? "completed" : todo.status,
20884
+ content: todo.content
20885
+ }))
20886
+ }
20887
+ }).catch(() => {
20888
+ });
20889
+ }
20890
+ } catch {
20891
+ }
20892
+ }
20272
20893
  await this.sendToClient({
20273
20894
  sessionId,
20274
20895
  update: {
@@ -20335,6 +20956,9 @@ function simpleHash(str) {
20335
20956
  }
20336
20957
 
20337
20958
  // src/agent.ts
20959
+ function isApiKeyError(err) {
20960
+ return err instanceof Error && err.name === "AI_LoadAPIKeyError";
20961
+ }
20338
20962
  var Agent = class {
20339
20963
  connection;
20340
20964
  config;
@@ -20369,8 +20993,22 @@ var Agent = class {
20369
20993
  this.eventHandler.start();
20370
20994
  }
20371
20995
  // ─── Protocol Lifecycle ───────────────────────────────────────────
20372
- async initialize(_params) {
20373
- acpIn("initialize", { protocolVersion: _params.protocolVersion });
20996
+ async initialize(params) {
20997
+ acpIn("initialize", { protocolVersion: params.protocolVersion });
20998
+ const authMethod = {
20999
+ description: "Run `opencode auth login` in the terminal",
21000
+ name: "Login with opencode",
21001
+ id: "opencode-login"
21002
+ };
21003
+ if (params.clientCapabilities?._meta?.["terminal-auth"] === true) {
21004
+ authMethod._meta = {
21005
+ "terminal-auth": {
21006
+ command: "opencode",
21007
+ args: ["auth", "login"],
21008
+ label: "OpenCode Login"
21009
+ }
21010
+ };
21011
+ }
20374
21012
  return {
20375
21013
  protocolVersion: 1,
20376
21014
  agentCapabilities: {
@@ -20379,13 +21017,7 @@ var Agent = class {
20379
21017
  promptCapabilities: { embeddedContext: true, image: true },
20380
21018
  sessionCapabilities: { fork: {}, list: {}, resume: {} }
20381
21019
  },
20382
- authMethods: [
20383
- {
20384
- description: "Run `opencode auth login` in the terminal",
20385
- name: "Login with opencode",
20386
- id: "opencode-login"
20387
- }
20388
- ],
21020
+ authMethods: [authMethod],
20389
21021
  agentInfo: {
20390
21022
  name: "Harmony-ACP",
20391
21023
  version: "0.1.0"
@@ -20398,57 +21030,68 @@ var Agent = class {
20398
21030
  // ─── Session Management ───────────────────────────────────────────
20399
21031
  async newSession(params) {
20400
21032
  acpIn("newSession", { cwd: params.cwd, mcpServers: params.mcpServers.length });
20401
- const directory = params.cwd;
20402
- ocCall("session.create", { directory });
20403
- const model = await this.defaultModel(directory);
20404
- const state = await this.sessionManager.create(
20405
- params.cwd,
20406
- params.mcpServers,
20407
- model
20408
- );
20409
- const sessionId = state.id;
20410
- const result = await this.loadSessionMode({
20411
- cwd: directory,
20412
- mcpServers: params.mcpServers,
20413
- sessionId
20414
- });
20415
- acpOut("newSession.response", { sessionId });
20416
- return {
20417
- sessionId,
20418
- configOptions: result.configOptions,
20419
- models: result.models,
20420
- modes: result.modes,
20421
- _meta: result._meta
20422
- };
21033
+ try {
21034
+ const directory = params.cwd;
21035
+ ocCall("session.create", { directory });
21036
+ const model = await this.defaultModel(directory);
21037
+ const state = await this.sessionManager.create(
21038
+ params.cwd,
21039
+ params.mcpServers,
21040
+ model
21041
+ );
21042
+ const sessionId = state.id;
21043
+ const result = await this.loadSessionMode({
21044
+ cwd: directory,
21045
+ mcpServers: params.mcpServers,
21046
+ sessionId
21047
+ });
21048
+ acpOut("newSession.response", { sessionId });
21049
+ return {
21050
+ sessionId,
21051
+ configOptions: result.configOptions,
21052
+ models: result.models,
21053
+ modes: result.modes,
21054
+ _meta: result._meta
21055
+ };
21056
+ } catch (e) {
21057
+ if (isApiKeyError(e)) throw RequestError.authRequired();
21058
+ throw e;
21059
+ }
20423
21060
  }
20424
21061
  async loadSession(params) {
20425
- const directory = params.cwd;
20426
- const sessionId = params.sessionId;
20427
- const model = await this.defaultModel(directory);
20428
- await this.sessionManager.load(sessionId, params.cwd, params.mcpServers, model);
20429
- const result = await this.loadSessionMode({
20430
- cwd: directory,
20431
- mcpServers: params.mcpServers,
20432
- sessionId
20433
- });
20434
- const messages = await this.sdk.session.messages({ sessionID: sessionId, directory }).then((x) => x.data).catch(() => void 0);
20435
- const lastUser = messages?.findLast((m) => m.info.role === "user")?.info;
20436
- if (lastUser?.role === "user") {
20437
- result.models.currentModelId = `${lastUser.model.providerID}/${lastUser.model.modelID}`;
20438
- this.sessionManager.setModel(sessionId, {
20439
- providerID: lastUser.model.providerID,
20440
- modelID: lastUser.model.modelID
21062
+ try {
21063
+ const directory = params.cwd;
21064
+ const sessionId = params.sessionId;
21065
+ const model = await this.defaultModel(directory);
21066
+ await this.sessionManager.load(sessionId, params.cwd, params.mcpServers, model);
21067
+ const result = await this.loadSessionMode({
21068
+ cwd: directory,
21069
+ mcpServers: params.mcpServers,
21070
+ sessionId
20441
21071
  });
20442
- if (result.modes?.availableModes.some((m) => m.id === lastUser.agent)) {
20443
- result.modes.currentModeId = lastUser.agent;
20444
- this.sessionManager.setMode(sessionId, lastUser.agent);
21072
+ const messages = await this.sdk.session.messages({ sessionID: sessionId, directory }).then((x) => x.data).catch(() => void 0);
21073
+ const lastUser = messages?.findLast((m) => m.info.role === "user")?.info;
21074
+ if (lastUser?.role === "user") {
21075
+ result.models.currentModelId = `${lastUser.model.providerID}/${lastUser.model.modelID}`;
21076
+ this.sessionManager.setModel(sessionId, {
21077
+ providerID: lastUser.model.providerID,
21078
+ modelID: lastUser.model.modelID
21079
+ });
21080
+ if (result.modes?.availableModes.some((m) => m.id === lastUser.agent)) {
21081
+ ;
21082
+ result.modes.currentModeId = lastUser.agent;
21083
+ this.sessionManager.setMode(sessionId, lastUser.agent);
21084
+ }
20445
21085
  }
21086
+ for (const msg of messages ?? []) {
21087
+ await this.processMessage(msg);
21088
+ }
21089
+ await this.sendUsageUpdate(sessionId, directory);
21090
+ return result;
21091
+ } catch (e) {
21092
+ if (isApiKeyError(e)) throw RequestError.authRequired();
21093
+ throw e;
20446
21094
  }
20447
- for (const msg of messages ?? []) {
20448
- await this.processMessage(msg);
20449
- }
20450
- await this.sendUsageUpdate(sessionId, directory);
20451
- return result;
20452
21095
  }
20453
21096
  async listSessions(params) {
20454
21097
  const limit = 100;
@@ -20470,38 +21113,48 @@ var Agent = class {
20470
21113
  return response;
20471
21114
  }
20472
21115
  async unstable_forkSession(params) {
20473
- const directory = params.cwd;
20474
- const mcpServers = params.mcpServers ?? [];
20475
- const model = await this.defaultModel(directory);
20476
- const forked = await this.sdk.session.fork({ sessionID: params.sessionId, directory }).then((x) => x.data);
20477
- if (!forked) throw new Error("Fork session returned no data");
20478
- const sessionId = forked.id;
20479
- await this.sessionManager.load(sessionId, directory, mcpServers, model);
20480
- const result = await this.loadSessionMode({
20481
- cwd: directory,
20482
- mcpServers,
20483
- sessionId
20484
- });
20485
- const messages = await this.sdk.session.messages({ sessionID: sessionId, directory }).then((x) => x.data).catch(() => void 0);
20486
- for (const msg of messages ?? []) {
20487
- await this.processMessage(msg);
21116
+ try {
21117
+ const directory = params.cwd;
21118
+ const mcpServers = params.mcpServers ?? [];
21119
+ const model = await this.defaultModel(directory);
21120
+ const forked = await this.sdk.session.fork({ sessionID: params.sessionId, directory }).then((x) => x.data);
21121
+ if (!forked) throw new Error("Fork session returned no data");
21122
+ const sessionId = forked.id;
21123
+ await this.sessionManager.load(sessionId, directory, mcpServers, model);
21124
+ const result = await this.loadSessionMode({
21125
+ cwd: directory,
21126
+ mcpServers,
21127
+ sessionId
21128
+ });
21129
+ const messages = await this.sdk.session.messages({ sessionID: sessionId, directory }).then((x) => x.data).catch(() => void 0);
21130
+ for (const msg of messages ?? []) {
21131
+ await this.processMessage(msg);
21132
+ }
21133
+ await this.sendUsageUpdate(sessionId, directory);
21134
+ return result;
21135
+ } catch (e) {
21136
+ if (isApiKeyError(e)) throw RequestError.authRequired();
21137
+ throw e;
20488
21138
  }
20489
- await this.sendUsageUpdate(sessionId, directory);
20490
- return result;
20491
21139
  }
20492
21140
  async unstable_resumeSession(params) {
20493
- const directory = params.cwd;
20494
- const sessionId = params.sessionId;
20495
- const mcpServers = params.mcpServers ?? [];
20496
- const model = await this.defaultModel(directory);
20497
- await this.sessionManager.load(sessionId, directory, mcpServers, model);
20498
- const result = await this.loadSessionMode({
20499
- cwd: directory,
20500
- mcpServers,
20501
- sessionId
20502
- });
20503
- await this.sendUsageUpdate(sessionId, directory);
20504
- return result;
21141
+ try {
21142
+ const directory = params.cwd;
21143
+ const sessionId = params.sessionId;
21144
+ const mcpServers = params.mcpServers ?? [];
21145
+ const model = await this.defaultModel(directory);
21146
+ await this.sessionManager.load(sessionId, directory, mcpServers, model);
21147
+ const result = await this.loadSessionMode({
21148
+ cwd: directory,
21149
+ mcpServers,
21150
+ sessionId
21151
+ });
21152
+ await this.sendUsageUpdate(sessionId, directory);
21153
+ return result;
21154
+ } catch (e) {
21155
+ if (isApiKeyError(e)) throw RequestError.authRequired();
21156
+ throw e;
21157
+ }
20505
21158
  }
20506
21159
  // ─── Prompt Execution ─────────────────────────────────────────────
20507
21160
  async prompt(params) {
@@ -20514,7 +21167,7 @@ var Agent = class {
20514
21167
  if (!session.model) {
20515
21168
  this.sessionManager.setModel(session.id, model);
20516
21169
  }
20517
- const agent = session.modeId ?? "build";
21170
+ const agent = session.modeId ?? await this.defaultAgent(directory);
20518
21171
  const parts = this.convertPromptParts(params.prompt);
20519
21172
  const cmd = this.parseCommand(parts);
20520
21173
  ocCall("session.prompt", { sessionID, agent, model: `${model.providerID}/${model.modelID}` });
@@ -20571,6 +21224,23 @@ var Agent = class {
20571
21224
  _meta: {}
20572
21225
  };
20573
21226
  }
21227
+ if (cmd.name === "compact") {
21228
+ await this.sdk.session.summarize(
21229
+ {
21230
+ sessionID,
21231
+ directory,
21232
+ providerID: model.providerID,
21233
+ modelID: model.modelID
21234
+ },
21235
+ { throwOnError: true }
21236
+ ).catch(() => {
21237
+ });
21238
+ await this.sendUsageUpdate(sessionID, directory);
21239
+ return {
21240
+ stopReason: "end_turn",
21241
+ _meta: {}
21242
+ };
21243
+ }
20574
21244
  const response = await this.sdk.session.prompt({
20575
21245
  sessionID,
20576
21246
  model: { providerID: model.providerID, modelID: model.modelID },
@@ -20599,36 +21269,101 @@ var Agent = class {
20599
21269
  }
20600
21270
  // ─── Configuration ────────────────────────────────────────────────
20601
21271
  async setSessionMode(params) {
21272
+ const session = this.sessionManager.get(params.sessionId);
21273
+ const agents = await this.sdk.app.agents({ directory: session.cwd }).then((x) => x.data ?? []).catch(() => []);
21274
+ const availableModes = agents.filter((a) => a.mode !== "subagent" && !a.hidden);
21275
+ if (!availableModes.some((a) => a.name === params.modeId)) {
21276
+ throw new Error(`Agent not found: ${params.modeId}`);
21277
+ }
20602
21278
  this.sessionManager.setMode(params.sessionId, params.modeId);
20603
21279
  }
20604
21280
  async unstable_setSessionModel(params) {
20605
21281
  const session = this.sessionManager.get(params.sessionId);
20606
- const [providerID, modelID] = params.modelId.split("/");
20607
- this.sessionManager.setModel(params.sessionId, { providerID, modelID });
21282
+ const providers = await this.sdk.config.providers({ directory: session.cwd }).then((x) => x.data?.providers ?? []).catch(() => []);
21283
+ const selection = parseModelSelection(params.modelId, providers);
21284
+ this.sessionManager.setModel(params.sessionId, selection.model);
21285
+ this.sessionManager.setVariant(params.sessionId, selection.variant);
21286
+ const currentProvider = providers.find((p) => p.id === selection.model.providerID);
21287
+ const currentModelInfo = currentProvider?.models?.[selection.model.modelID];
21288
+ const availableVariants = currentModelInfo?.variants ? Object.keys(currentModelInfo.variants) : [];
21289
+ return {
21290
+ _meta: buildVariantMeta(selection.model, selection.variant, availableVariants)
21291
+ };
20608
21292
  }
20609
21293
  async setSessionConfigOption(params) {
20610
21294
  const session = this.sessionManager.get(params.sessionId);
20611
- if (params.configId === "model" && typeof params.value === "string") {
20612
- const [providerID, modelID] = params.value.split("/");
20613
- this.sessionManager.setModel(params.sessionId, { providerID, modelID });
20614
- } else if (params.configId === "mode" && typeof params.value === "string") {
21295
+ const providers = await this.sdk.config.providers({ directory: session.cwd }).then((x) => x.data?.providers ?? []).catch(() => []);
21296
+ const sortedProviders = [...providers].sort(
21297
+ (a, b) => a.name.toLowerCase() < b.name.toLowerCase() ? -1 : a.name.toLowerCase() > b.name.toLowerCase() ? 1 : 0
21298
+ );
21299
+ if (params.configId === "model") {
21300
+ if (typeof params.value !== "string") throw RequestError.invalidParams("model value must be a string");
21301
+ const selection = parseModelSelection(params.value, providers);
21302
+ this.sessionManager.setModel(params.sessionId, selection.model);
21303
+ this.sessionManager.setVariant(params.sessionId, selection.variant);
21304
+ } else if (params.configId === "mode") {
21305
+ if (typeof params.value !== "string") throw RequestError.invalidParams("mode value must be a string");
21306
+ const agents2 = await this.sdk.app.agents({ directory: session.cwd }).then((x) => x.data ?? []).catch(() => []);
21307
+ const availableModes2 = agents2.filter((a) => a.mode !== "subagent" && !a.hidden);
21308
+ if (!availableModes2.some((a) => a.name === params.value)) {
21309
+ throw RequestError.invalidParams(JSON.stringify({ error: `Mode not found: ${params.value}` }));
21310
+ }
20615
21311
  this.sessionManager.setMode(params.sessionId, params.value);
21312
+ } else {
21313
+ throw RequestError.invalidParams(JSON.stringify({ error: `Unknown config option: ${params.configId}` }));
21314
+ }
21315
+ const updatedSession = this.sessionManager.get(params.sessionId);
21316
+ const model = updatedSession.model ?? await this.defaultModel(session.cwd);
21317
+ const currentProvider = sortedProviders.find((p) => p.id === model.providerID);
21318
+ const currentModelInfo = currentProvider?.models?.[model.modelID];
21319
+ const availableVariants = currentModelInfo?.variants ? Object.keys(currentModelInfo.variants) : [];
21320
+ const variant = updatedSession.variant;
21321
+ const currentModelId = formatModelIdWithVariant(model, variant, availableVariants);
21322
+ const availableModels = sortedProviders.flatMap(
21323
+ (provider) => Object.values(provider.models).flatMap((modelInfo) => {
21324
+ const base = {
21325
+ modelId: `${provider.id}/${modelInfo.id}`,
21326
+ name: `${provider.name}/${modelInfo.name}`
21327
+ };
21328
+ if (!modelInfo.variants) return [base];
21329
+ const variants = Object.keys(modelInfo.variants).filter((v) => v !== "default");
21330
+ return [
21331
+ base,
21332
+ ...variants.map((v) => ({
21333
+ modelId: `${provider.id}/${modelInfo.id}/${v}`,
21334
+ name: `${provider.name}/${modelInfo.name} (${v})`
21335
+ }))
21336
+ ];
21337
+ })
21338
+ );
21339
+ const agents = await this.sdk.app.agents({ directory: session.cwd }).then((x) => x.data ?? []).catch(() => []);
21340
+ const availableModes = agents.filter((a) => a.mode !== "subagent" && !a.hidden).map((a) => ({ id: a.name, name: a.name, description: a.description }));
21341
+ const currentModeId = updatedSession.modeId ?? availableModes[0]?.id;
21342
+ const configOptions = [
21343
+ {
21344
+ id: "model",
21345
+ name: "Model",
21346
+ category: "model",
21347
+ type: "select",
21348
+ currentValue: currentModelId,
21349
+ options: availableModels.map((m) => ({ value: m.modelId, name: m.name }))
21350
+ }
21351
+ ];
21352
+ if (currentModeId && availableModes.length > 0) {
21353
+ configOptions.push({
21354
+ id: "mode",
21355
+ name: "Session Mode",
21356
+ category: "mode",
21357
+ type: "select",
21358
+ currentValue: currentModeId,
21359
+ options: availableModes.map((m) => ({
21360
+ value: m.id,
21361
+ name: m.name,
21362
+ ...m.description ? { description: m.description } : {}
21363
+ }))
21364
+ });
20616
21365
  }
20617
- const model = this.sessionManager.getModel(params.sessionId) ?? await this.defaultModel(session.cwd);
20618
- const currentModelId = `${model.providerID}/${model.modelID}`;
20619
- return {
20620
- configOptions: [
20621
- {
20622
- id: "model",
20623
- name: "Model",
20624
- category: "model",
20625
- type: "select",
20626
- currentValue: currentModelId,
20627
- options: []
20628
- // TODO: populate from providers
20629
- }
20630
- ]
20631
- };
21366
+ return { configOptions };
20632
21367
  }
20633
21368
  // ─── Internal Helpers ─────────────────────────────────────────────
20634
21369
  async defaultModel(cwd) {
@@ -20655,59 +21390,133 @@ var Agent = class {
20655
21390
  if (allModels.length > 0) return allModels[0];
20656
21391
  return { providerID: "opencode", modelID: "big-pickle" };
20657
21392
  }
21393
+ async defaultAgent(cwd) {
21394
+ const agents = await this.sdk.app.agents({ directory: cwd }).then((x) => x.data ?? []).catch(() => []);
21395
+ const primary = agents.filter((a) => a.mode !== "subagent" && !a.hidden);
21396
+ return primary.length > 0 ? primary[0].name : "build";
21397
+ }
20658
21398
  async loadSessionMode(params) {
20659
21399
  const model = await this.defaultModel(params.cwd);
20660
21400
  const providers = await this.sdk.config.providers({ directory: params.cwd }).then((x) => x.data?.providers ?? []).catch(() => []);
20661
- const availableModels = providers.flatMap(
20662
- (provider) => Object.keys(provider.models).map((modelId) => ({
20663
- modelId: `${provider.id}/${modelId}`,
20664
- name: `${provider.name}/${provider.models[modelId].name}`
20665
- }))
21401
+ const sortedProviders = [...providers].sort(
21402
+ (a, b) => a.name.toLowerCase() < b.name.toLowerCase() ? -1 : a.name.toLowerCase() > b.name.toLowerCase() ? 1 : 0
21403
+ );
21404
+ const availableModels = sortedProviders.flatMap(
21405
+ (provider) => Object.values(provider.models).flatMap((modelInfo) => {
21406
+ const base = {
21407
+ modelId: `${provider.id}/${modelInfo.id}`,
21408
+ name: `${provider.name}/${modelInfo.name}`
21409
+ };
21410
+ if (!modelInfo.variants) return [base];
21411
+ const variants = Object.keys(modelInfo.variants).filter((v) => v !== "default");
21412
+ return [
21413
+ base,
21414
+ ...variants.map((v) => ({
21415
+ modelId: `${provider.id}/${modelInfo.id}/${v}`,
21416
+ name: `${provider.name}/${modelInfo.name} (${v})`
21417
+ }))
21418
+ ];
21419
+ })
21420
+ );
21421
+ const currentProvider = sortedProviders.find((p) => p.id === model.providerID);
21422
+ const currentModelInfo = currentProvider?.models[model.modelID];
21423
+ const availableVariants = currentModelInfo?.variants ? Object.keys(currentModelInfo.variants) : [];
21424
+ const variant = this.sessionManager.getVariant(params.sessionId);
21425
+ if (variant && !availableVariants.includes(variant)) {
21426
+ this.sessionManager.setVariant(params.sessionId, void 0);
21427
+ }
21428
+ const currentModelId = formatModelIdWithVariant(model, variant, availableVariants);
21429
+ const agents = await this.sdk.app.agents({ directory: params.cwd }).then((x) => x.data ?? []).catch(() => []);
21430
+ const availableModes = agents.filter((a) => a.mode !== "subagent" && !a.hidden).map((a) => ({ id: a.name, name: a.name, description: a.description }));
21431
+ const currentModeId = this.sessionManager.getMode(params.sessionId) ?? (availableModes.length > 0 ? availableModes[0].id : void 0);
21432
+ if (currentModeId && !this.sessionManager.getMode(params.sessionId)) {
21433
+ this.sessionManager.setMode(params.sessionId, currentModeId);
21434
+ }
21435
+ const modes = currentModeId ? { availableModes, currentModeId } : void 0;
21436
+ await Promise.all(
21437
+ params.mcpServers.map(async (server) => {
21438
+ const config2 = "url" in server ? {
21439
+ url: server.url,
21440
+ type: "remote",
21441
+ headers: (server.headers ?? []).reduce(
21442
+ (acc, h) => {
21443
+ acc[h.name] = h.value;
21444
+ return acc;
21445
+ },
21446
+ {}
21447
+ )
21448
+ } : {
21449
+ type: "local",
21450
+ command: [server.command, ...server.args],
21451
+ environment: (server.env ?? []).reduce(
21452
+ (acc, v) => {
21453
+ acc[v.name] = v.value;
21454
+ return acc;
21455
+ },
21456
+ {}
21457
+ )
21458
+ };
21459
+ await this.sdk.mcp.add({ directory: params.cwd, name: server.name, config: config2 }).catch(() => {
21460
+ });
21461
+ })
20666
21462
  );
20667
- const currentModelId = `${model.providerID}/${model.modelID}`;
20668
- for (const server of params.mcpServers) {
20669
- const config2 = "type" in server ? { url: server.url, type: "remote", headers: {} } : { type: "local", command: [server.command, ...server.args] };
20670
- await this.sdk.mcp.add({ directory: params.cwd, name: server.name, config: config2 }).catch(() => {
20671
- });
20672
- }
20673
21463
  const commands = await this.sdk.command.list({ directory: params.cwd }).then((x) => x.data ?? []).catch(() => []);
21464
+ const availableCommands = commands.map((c) => ({
21465
+ name: c.name,
21466
+ description: c.description ?? ""
21467
+ }));
21468
+ if (!availableCommands.some((c) => c.name === "compact")) {
21469
+ availableCommands.push({ name: "compact", description: "compact the session" });
21470
+ }
20674
21471
  setTimeout(() => {
20675
21472
  this.sendToClient({
20676
21473
  sessionId: params.sessionId,
20677
21474
  update: {
20678
21475
  sessionUpdate: "available_commands_update",
20679
- availableCommands: commands.map((c) => ({
20680
- name: c.name,
20681
- description: c.description ?? ""
20682
- }))
21476
+ availableCommands
20683
21477
  }
20684
21478
  }).catch(() => {
20685
21479
  });
20686
21480
  }, 0);
21481
+ const configOptions = [
21482
+ {
21483
+ id: "model",
21484
+ name: "Model",
21485
+ category: "model",
21486
+ type: "select",
21487
+ currentValue: currentModelId,
21488
+ options: availableModels.map((m) => ({
21489
+ value: m.modelId,
21490
+ name: m.name
21491
+ }))
21492
+ }
21493
+ ];
21494
+ if (modes) {
21495
+ configOptions.push({
21496
+ id: "mode",
21497
+ name: "Session Mode",
21498
+ category: "mode",
21499
+ type: "select",
21500
+ currentValue: modes.currentModeId,
21501
+ options: modes.availableModes.map((m) => ({
21502
+ value: m.id,
21503
+ name: m.name,
21504
+ ...m.description ? { description: m.description } : {}
21505
+ }))
21506
+ });
21507
+ }
20687
21508
  return {
20688
21509
  sessionId: params.sessionId,
20689
21510
  models: { currentModelId, availableModels },
20690
- modes: void 0,
20691
- // TODO: implement mode loading
20692
- configOptions: [
20693
- {
20694
- id: "model",
20695
- name: "Model",
20696
- category: "model",
20697
- type: "select",
20698
- currentValue: currentModelId,
20699
- options: availableModels.map((m) => ({
20700
- value: m.modelId,
20701
- name: m.name
20702
- }))
20703
- }
20704
- ],
20705
- _meta: {}
21511
+ modes,
21512
+ configOptions,
21513
+ _meta: buildVariantMeta(model, variant, availableVariants)
20706
21514
  };
20707
21515
  }
20708
21516
  async processMessage(message) {
20709
21517
  if (message.info.role !== "assistant" && message.info.role !== "user") return;
20710
21518
  const sessionId = message.info.sessionID;
21519
+ const messageChunk = message.info.role === "user" ? "user_message_chunk" : "agent_message_chunk";
20711
21520
  for (const part of message.parts) {
20712
21521
  if (part.type === "tool") {
20713
21522
  await this.replayToolPart(sessionId, part);
@@ -20716,7 +21525,7 @@ var Agent = class {
20716
21525
  await this.sendToClient({
20717
21526
  sessionId,
20718
21527
  update: {
20719
- sessionUpdate: message.info.role === "user" ? "user_message_chunk" : "agent_message_chunk",
21528
+ sessionUpdate: messageChunk,
20720
21529
  messageId: message.info.id,
20721
21530
  content: {
20722
21531
  type: "text",
@@ -20726,6 +21535,55 @@ var Agent = class {
20726
21535
  }
20727
21536
  }).catch(() => {
20728
21537
  });
21538
+ } else if (part.type === "file" && part.url) {
21539
+ const url2 = part.url;
21540
+ const filename = part.filename ?? "file";
21541
+ const mime = part.mime || "application/octet-stream";
21542
+ if (url2.startsWith("file://")) {
21543
+ await this.sendToClient({
21544
+ sessionId,
21545
+ update: {
21546
+ sessionUpdate: messageChunk,
21547
+ messageId: message.info.id,
21548
+ content: { type: "resource_link", uri: url2, name: filename, mimeType: mime }
21549
+ }
21550
+ }).catch(() => {
21551
+ });
21552
+ } else if (url2.startsWith("data:")) {
21553
+ const base64Match = url2.match(/^data:([^;]+);base64,(.*)$/);
21554
+ const dataMime = base64Match?.[1];
21555
+ const base64Data = base64Match?.[2] ?? "";
21556
+ const effectiveMime = dataMime || mime;
21557
+ if (effectiveMime.startsWith("image/")) {
21558
+ await this.sendToClient({
21559
+ sessionId,
21560
+ update: {
21561
+ sessionUpdate: messageChunk,
21562
+ messageId: message.info.id,
21563
+ content: {
21564
+ type: "image",
21565
+ mimeType: effectiveMime,
21566
+ data: base64Data,
21567
+ uri: (0, import_url2.pathToFileURL)(filename).href
21568
+ }
21569
+ }
21570
+ }).catch(() => {
21571
+ });
21572
+ } else {
21573
+ const isText = effectiveMime.startsWith("text/") || effectiveMime === "application/json";
21574
+ const fileUri = (0, import_url2.pathToFileURL)(filename).href;
21575
+ const resource = isText ? { uri: fileUri, mimeType: effectiveMime, text: Buffer.from(base64Data, "base64").toString("utf-8") } : { uri: fileUri, mimeType: effectiveMime, blob: base64Data };
21576
+ await this.sendToClient({
21577
+ sessionId,
21578
+ update: {
21579
+ sessionUpdate: messageChunk,
21580
+ messageId: message.info.id,
21581
+ content: { type: "resource", resource }
21582
+ }
21583
+ }).catch(() => {
21584
+ });
21585
+ }
21586
+ }
20729
21587
  } else if (part.type === "reasoning" && part.text) {
20730
21588
  await this.sendToClient({
20731
21589
  sessionId,
@@ -20768,6 +21626,26 @@ var Agent = class {
20768
21626
  newText: typeof input["newString"] === "string" ? input["newString"] : typeof input["content"] === "string" ? input["content"] : ""
20769
21627
  });
20770
21628
  }
21629
+ if (part.tool === "todowrite") {
21630
+ try {
21631
+ const todos = JSON.parse(part.state.output);
21632
+ if (Array.isArray(todos)) {
21633
+ await this.sendToClient({
21634
+ sessionId,
21635
+ update: {
21636
+ sessionUpdate: "plan",
21637
+ entries: todos.map((todo) => ({
21638
+ priority: "medium",
21639
+ status: todo.status === "cancelled" ? "completed" : todo.status,
21640
+ content: todo.content
21641
+ }))
21642
+ }
21643
+ }).catch(() => {
21644
+ });
21645
+ }
21646
+ } catch {
21647
+ }
21648
+ }
20771
21649
  await this.sendToClient({
20772
21650
  sessionId,
20773
21651
  update: {
@@ -20813,13 +21691,16 @@ var Agent = class {
20813
21691
  const msg = lastAssistant.info;
20814
21692
  if (!msg.providerID || !msg.modelID) return;
20815
21693
  const totalCost = assistantMessages.reduce((sum, m) => sum + m.info.cost, 0);
21694
+ const providers = await this.sdk.config.providers({ directory }).then((x) => x.data?.providers ?? []).catch(() => []);
21695
+ const provider = providers.find((p) => p.id === msg.providerID);
21696
+ const model = provider?.models[msg.modelID];
21697
+ const size = model?.limit?.context ?? 0;
20816
21698
  await this.sendToClient({
20817
21699
  sessionId,
20818
21700
  update: {
20819
21701
  sessionUpdate: "usage_update",
20820
21702
  used: msg.tokens.input + (msg.tokens.cache?.read ?? 0),
20821
- size: 0,
20822
- // TODO: get from model config
21703
+ size,
20823
21704
  cost: { amount: totalCost, currency: "USD" }
20824
21705
  }
20825
21706
  }).catch(() => {
@@ -20856,11 +21737,26 @@ var Agent = class {
20856
21737
  const resource = part.resource;
20857
21738
  if ("text" in resource && resource.text) {
20858
21739
  result.push({ type: "text", text: resource.text });
21740
+ } else if ("blob" in resource && resource.blob && resource.mimeType) {
21741
+ const parsed = parseUri(resource.uri ?? "");
21742
+ const filename = parsed.type === "file" ? parsed.filename : "file";
21743
+ result.push({
21744
+ type: "file",
21745
+ url: `data:${resource.mimeType};base64,${resource.blob}`,
21746
+ filename,
21747
+ mime: resource.mimeType
21748
+ });
20859
21749
  }
20860
21750
  break;
20861
21751
  }
20862
- case "resource_link":
21752
+ case "resource_link": {
21753
+ const parsed = parseUri(part.uri);
21754
+ if (parsed.type === "file") {
21755
+ if (part.name) parsed.filename = part.name;
21756
+ result.push(parsed);
21757
+ }
20863
21758
  break;
21759
+ }
20864
21760
  }
20865
21761
  }
20866
21762
  return result;
@@ -20921,6 +21817,38 @@ var Agent = class {
20921
21817
  };
20922
21818
  }
20923
21819
  };
21820
+ function formatModelIdWithVariant(model, variant, availableVariants) {
21821
+ const base = `${model.providerID}/${model.modelID}`;
21822
+ if (!variant || !availableVariants.includes(variant)) return base;
21823
+ return `${base}/${variant}`;
21824
+ }
21825
+ function buildVariantMeta(model, variant, availableVariants) {
21826
+ return {
21827
+ opencode: {
21828
+ modelId: `${model.providerID}/${model.modelID}`,
21829
+ variant: variant ?? null,
21830
+ availableVariants
21831
+ }
21832
+ };
21833
+ }
21834
+ function parseModelSelection(modelId, providers) {
21835
+ const segments = modelId.split("/");
21836
+ const providerID = segments[0];
21837
+ const rest = segments.slice(1).join("/");
21838
+ const provider = providers.find((p) => p.id === providerID);
21839
+ if (!provider) return { model: { providerID, modelID: rest } };
21840
+ if (provider.models[rest]) return { model: { providerID, modelID: rest } };
21841
+ const lastSlash = rest.lastIndexOf("/");
21842
+ if (lastSlash > 0) {
21843
+ const candidateBase = rest.slice(0, lastSlash);
21844
+ const candidateVariant = rest.slice(lastSlash + 1);
21845
+ const baseInfo = provider.models[candidateBase];
21846
+ if (baseInfo?.variants && candidateVariant in baseInfo.variants) {
21847
+ return { model: { providerID, modelID: candidateBase }, variant: candidateVariant };
21848
+ }
21849
+ }
21850
+ return { model: { providerID, modelID: rest } };
21851
+ }
20924
21852
 
20925
21853
  // src/index.ts
20926
21854
  function parseArgs(args) {