@harmonyos-arkts/opencode-acp 0.0.2 → 0.0.4

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/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
33
+ // node_modules/isexe/windows.js
34
34
  var require_windows = __commonJS({
35
- "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module2) {
35
+ "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/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
73
+ // node_modules/isexe/mode.js
74
74
  var require_mode = __commonJS({
75
- "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports2, module2) {
75
+ "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/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
106
+ // node_modules/isexe/index.js
107
107
  var require_isexe = __commonJS({
108
- "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
108
+ "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/.pnpm/which@2.0.2/node_modules/which/which.js
161
+ // node_modules/which/which.js
162
162
  var require_which = __commonJS({
163
- "node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
163
+ "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/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
257
+ // node_modules/path-key/index.js
258
258
  var require_path_key = __commonJS({
259
- "node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports2, module2) {
259
+ "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/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
274
+ // node_modules/cross-spawn/lib/util/resolveCommand.js
275
275
  var require_resolveCommand = __commonJS({
276
- "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
276
+ "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/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
316
+ // node_modules/cross-spawn/lib/util/escape.js
317
317
  var require_escape = __commonJS({
318
- "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
318
+ "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/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
341
+ // node_modules/shebang-regex/index.js
342
342
  var require_shebang_regex = __commonJS({
343
- "node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports2, module2) {
343
+ "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/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
349
+ // node_modules/shebang-command/index.js
350
350
  var require_shebang_command = __commonJS({
351
- "node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports2, module2) {
351
+ "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/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
369
+ // node_modules/cross-spawn/lib/util/readShebang.js
370
370
  var require_readShebang = __commonJS({
371
- "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
371
+ "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,9 +388,9 @@ var require_readShebang = __commonJS({
388
388
  }
389
389
  });
390
390
 
391
- // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
391
+ // node_modules/cross-spawn/lib/parse.js
392
392
  var require_parse = __commonJS({
393
- "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
393
+ "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();
@@ -450,9 +450,9 @@ var require_parse = __commonJS({
450
450
  }
451
451
  });
452
452
 
453
- // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
453
+ // node_modules/cross-spawn/lib/enoent.js
454
454
  var require_enoent = __commonJS({
455
- "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
455
+ "node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
456
456
  "use strict";
457
457
  var isWin2 = process.platform === "win32";
458
458
  function notFoundError(original, syscall) {
@@ -500,9 +500,9 @@ var require_enoent = __commonJS({
500
500
  }
501
501
  });
502
502
 
503
- // node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
503
+ // node_modules/cross-spawn/index.js
504
504
  var require_cross_spawn = __commonJS({
505
- "node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
505
+ "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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
530
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/index.js
771
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
1049
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
1124
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
1803
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
1939
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
2027
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
2184
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
2732
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
2768
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
2775
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/index.js
4746
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ar.js
4800
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/az.js
4907
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/be.js
5013
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/bg.js
5170
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ca.js
5291
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/cs.js
5400
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/da.js
5512
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/de.js
5628
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/en.js
5737
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/eo.js
5846
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/es.js
5956
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fa.js
6089
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fi.js
6204
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fr.js
6317
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/fr-CA.js
6426
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/he.js
6534
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/hu.js
6729
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/hy.js
6838
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/id.js
6986
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/is.js
7093
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/it.js
7203
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ja.js
7312
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ka.js
7420
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/km.js
7533
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/kh.js
7644
+ // node_modules/zod/v4/locales/kh.js
7645
7645
  function kh_default() {
7646
7646
  return km_default();
7647
7647
  }
7648
7648
 
7649
- // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ko.js
7649
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/lt.js
7761
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/mk.js
7965
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ms.js
8075
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/nl.js
8183
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/no.js
8294
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ota.js
8403
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ps.js
8513
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/pl.js
8628
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/pt.js
8738
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ru.js
8847
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/sl.js
9004
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/sv.js
9114
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ta.js
9225
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/th.js
9336
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/tr.js
9447
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/uk.js
9553
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ua.js
9662
+ // node_modules/zod/v4/locales/ua.js
9663
9663
  function ua_default() {
9664
9664
  return uk_default();
9665
9665
  }
9666
9666
 
9667
- // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/ur.js
9667
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/uz.js
9778
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/vi.js
9888
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/zh-CN.js
9997
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/zh-TW.js
10107
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/locales/yo.js
10215
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
10323
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
10373
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
11412
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
11764
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-generator.js
12315
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.js
12390
+ // node_modules/zod/v4/core/json-schema.js
12391
12391
  var json_schema_exports = {};
12392
12392
 
12393
- // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
12393
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/checks.js
12562
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
12596
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
12637
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
12677
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
12691
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/compat.js
13770
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js
13796
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/coerce.js
14270
+ // 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/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
14295
+ // node_modules/zod/v4/classic/external.js
14296
14296
  config(en_default());
14297
14297
 
14298
- // node_modules/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
14298
+ // 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/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js
14326
+ // 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/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/stream.js
15189
+ // 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/.pnpm/@agentclientprotocol+sdk@0.16.1_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/acp.js
15241
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
15814
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/pathSerializer.gen.js
15933
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
16036
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/auth.gen.js
16119
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/bodySerializer.gen.js
16134
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/client/utils.gen.js
16139
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/client/client.gen.js
16349
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/core/params.gen.js
16557
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/client.gen.js
16653
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/gen/sdk.gen.js
16656
+ // 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/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/client.js
19513
+ // node_modules/@opencode-ai/sdk/dist/v2/client.js
19514
19514
  function pick2(value, fallback, encode3) {
19515
19515
  if (!value)
19516
19516
  return;
@@ -19583,7 +19583,7 @@ function createOpencodeClient(config2) {
19583
19583
  return new OpencodeClient({ client: client2 });
19584
19584
  }
19585
19585
 
19586
- // node_modules/.pnpm/@opencode-ai+sdk@1.14.21/node_modules/@opencode-ai/sdk/dist/v2/server.js
19586
+ // node_modules/@opencode-ai/sdk/dist/v2/server.js
19587
19587
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
19588
19588
 
19589
19589
  // src/agent.ts
@@ -19616,10 +19616,7 @@ var SessionManager = class {
19616
19616
  * Called by agent.newSession() / agent.loadSession().
19617
19617
  */
19618
19618
  async create(cwd, mcpServers, model) {
19619
- const response = await this.sdk.session.create(
19620
- { directory: cwd },
19621
- { throwOnError: true }
19622
- );
19619
+ const response = await this.sdk.session.create({ directory: cwd }, { throwOnError: true });
19623
19620
  const session = response.data;
19624
19621
  const state = {
19625
19622
  id: session.id,
@@ -19634,12 +19631,11 @@ var SessionManager = class {
19634
19631
  /**
19635
19632
  * Load an existing session into the manager.
19636
19633
  * Called by agent.loadSession() / agent.unstable_resumeSession().
19634
+ * Returns the session state plus the raw Session object from OpenCode.
19637
19635
  */
19638
19636
  async load(sessionId, cwd, mcpServers, model) {
19639
- await this.sdk.session.get(
19640
- { sessionID: sessionId, directory: cwd },
19641
- { throwOnError: true }
19642
- );
19637
+ const response = await this.sdk.session.get({ sessionID: sessionId, directory: cwd }, { throwOnError: true });
19638
+ const session = response.data;
19643
19639
  const state = {
19644
19640
  id: sessionId,
19645
19641
  cwd,
@@ -19648,7 +19644,7 @@ var SessionManager = class {
19648
19644
  model
19649
19645
  };
19650
19646
  this.sessions.set(sessionId, state);
19651
- return state;
19647
+ return { state, session };
19652
19648
  }
19653
19649
  /**
19654
19650
  * Auto-register a session discovered via SSE events.
@@ -19727,7 +19723,7 @@ var SessionManager = class {
19727
19723
  }
19728
19724
  };
19729
19725
 
19730
- // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/util/string.js
19726
+ // node_modules/diff/libesm/util/string.js
19731
19727
  function hasOnlyWinLineEndings(string4) {
19732
19728
  return string4.includes("\r\n") && !string4.startsWith("\n") && !string4.match(/[^\r]\n/);
19733
19729
  }
@@ -19735,7 +19731,7 @@ function hasOnlyUnixLineEndings(string4) {
19735
19731
  return !string4.includes("\r\n") && string4.includes("\n");
19736
19732
  }
19737
19733
 
19738
- // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/line-endings.js
19734
+ // node_modules/diff/libesm/patch/line-endings.js
19739
19735
  function unixToWin(patch) {
19740
19736
  if (Array.isArray(patch)) {
19741
19737
  return patch.map((p) => unixToWin(p));
@@ -19767,7 +19763,7 @@ function isWin(patch) {
19767
19763
  })));
19768
19764
  }
19769
19765
 
19770
- // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/parse.js
19766
+ // node_modules/diff/libesm/patch/parse.js
19771
19767
  function parsePatch(uniDiff) {
19772
19768
  const diffstr = uniDiff.split(/\n/), list = [];
19773
19769
  let i = 0;
@@ -20103,7 +20099,7 @@ function parsePatch(uniDiff) {
20103
20099
  return list;
20104
20100
  }
20105
20101
 
20106
- // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/util/distance-iterator.js
20102
+ // node_modules/diff/libesm/util/distance-iterator.js
20107
20103
  function distance_iterator_default(start, minLine, maxLine) {
20108
20104
  let wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
20109
20105
  return function iterator() {
@@ -20132,7 +20128,7 @@ function distance_iterator_default(start, minLine, maxLine) {
20132
20128
  };
20133
20129
  }
20134
20130
 
20135
- // node_modules/.pnpm/diff@9.0.0/node_modules/diff/libesm/patch/apply.js
20131
+ // node_modules/diff/libesm/patch/apply.js
20136
20132
  function applyPatch(source, patch, options = {}) {
20137
20133
  let patches;
20138
20134
  if (typeof patch === "string") {
@@ -20363,7 +20359,11 @@ function setLogEnabled(v) {
20363
20359
  }
20364
20360
  function cleanOldLogs() {
20365
20361
  try {
20366
- const files = (0, import_fs.readdirSync)(LOG_DIR).filter((f) => f.endsWith(".log")).map((f) => ({ name: f, path: (0, import_path.join)(LOG_DIR, f), mtime: (0, import_fs.statSync)((0, import_path.join)(LOG_DIR, f)).mtime.getTime() })).sort((a, b) => b.mtime - a.mtime);
20362
+ const files = (0, import_fs.readdirSync)(LOG_DIR).filter((f) => f.endsWith(".log")).map((f) => ({
20363
+ name: f,
20364
+ path: (0, import_path.join)(LOG_DIR, f),
20365
+ mtime: (0, import_fs.statSync)((0, import_path.join)(LOG_DIR, f)).mtime.getTime()
20366
+ })).sort((a, b) => b.mtime - a.mtime);
20367
20367
  for (let i = MAX_LOG_FILES; i < files.length; i++) {
20368
20368
  try {
20369
20369
  const { unlinkSync } = require("fs");
@@ -20403,7 +20403,7 @@ function sysLog(action, data) {
20403
20403
  write("system", action, data);
20404
20404
  }
20405
20405
  function sanitize(obj, depth = 0) {
20406
- if (!obj || depth > 2) return obj;
20406
+ if (!obj || depth > 5) return obj;
20407
20407
  const result = {};
20408
20408
  for (const [key, val] of Object.entries(obj)) {
20409
20409
  if (typeof val === "string" && val.length > 2e3) {
@@ -20416,33 +20416,6 @@ function sanitize(obj, depth = 0) {
20416
20416
  }
20417
20417
  return result;
20418
20418
  }
20419
- function acpAssembled(action, data) {
20420
- if (!enabled) return;
20421
- const entry = {
20422
- ts: (/* @__PURE__ */ new Date()).toISOString(),
20423
- cat: "acp.out",
20424
- action,
20425
- ...data && { data: sanitizeAssembled(data) }
20426
- };
20427
- try {
20428
- (0, import_fs.appendFileSync)(logFile, JSON.stringify(entry) + "\n");
20429
- } catch {
20430
- }
20431
- }
20432
- function sanitizeAssembled(obj, depth = 0) {
20433
- if (!obj || depth > 2) return obj;
20434
- const result = {};
20435
- for (const [key, val] of Object.entries(obj)) {
20436
- if (typeof val === "string" && val.length > 1e4) {
20437
- result[key] = val.slice(0, 1e4) + `... [${val.length} chars total]`;
20438
- } else if (val && typeof val === "object" && !Array.isArray(val)) {
20439
- result[key] = sanitizeAssembled(val, depth + 1);
20440
- } else {
20441
- result[key] = val;
20442
- }
20443
- }
20444
- return result;
20445
- }
20446
20419
 
20447
20420
  // src/event-handler.ts
20448
20421
  var QUESTION_TIMEOUT_MS = 6e4;
@@ -20461,73 +20434,31 @@ var EventHandler = class {
20461
20434
  permissionQueues = /* @__PURE__ */ new Map();
20462
20435
  questionQueues = /* @__PURE__ */ new Map();
20463
20436
  started = false;
20464
- messageBuffers = /* @__PURE__ */ new Map();
20437
+ /** partID { type, ignored }, built from message.part.updated SSE events. */
20438
+ partMetaIndex = /* @__PURE__ */ new Map();
20439
+ /** Track tool call counts per child session to detect completion. */
20440
+ childToolCounts = /* @__PURE__ */ new Map();
20441
+ /** Cumulative code change stats per session, aggregated from session.diff SSE events. */
20442
+ diffStats = /* @__PURE__ */ new Map();
20465
20443
  /**
20466
- * Wrapper around connection.sessionUpdate that logs what's sent to the ACP client.
20467
- * This is the single point where we record all outgoing traffic.
20444
+ * Wrapper around connection.sessionUpdate that logs ALL outgoing traffic to the ACP client.
20445
+ * Every call here corresponds to a real message sent over the wire.
20468
20446
  */
20469
20447
  async sendToClient(params) {
20470
20448
  const updateType = params.update.sessionUpdate;
20471
- if (updateType !== "agent_message_chunk" && updateType !== "agent_thought_chunk") {
20472
- this.flushMessageBuffer(params.sessionId, `boundary:${updateType}`);
20473
- acpOut(`sessionUpdate.${updateType}`, {
20474
- sessionId: params.sessionId.slice(0, 12),
20475
- ...updateType === "tool_call" || updateType === "tool_call_update" ? { toolCallId: params.update.toolCallId, tool: params.update.title, kind: params.update.kind, status: params.update.status } : updateType === "session_info_update" ? { title: params.update.title, _meta: params.update._meta } : {}
20476
- });
20477
- }
20449
+ const update = params.update;
20450
+ acpOut(`sessionUpdate.${updateType}`, {
20451
+ sessionId: params.sessionId.slice(0, 12),
20452
+ ...updateType === "agent_message_chunk" || updateType === "agent_thought_chunk" ? { messageId: update.messageId?.slice(0, 12), delta: update.content?.text?.slice(0, 200) } : updateType === "tool_call" || updateType === "tool_call_update" ? { toolCallId: update.toolCallId, tool: update.title, kind: update.kind, status: update.status } : updateType === "session_info_update" ? { title: update.title, _meta: update._meta } : updateType === "usage_update" ? { used: update.used, size: update.size, cost: update.cost, _meta: update._meta } : {}
20453
+ });
20478
20454
  return this.connection.sessionUpdate(params);
20479
20455
  }
20480
- /**
20481
- * Accumulate a text/thought delta into the message buffer.
20482
- * The buffer is flushed as a single log entry when a boundary event occurs
20483
- * (e.g. tool_call starts, new message, session change).
20484
- */
20485
- accumulateDelta(messageId, sessionId, kind, delta) {
20486
- let buf = this.messageBuffers.get(messageId);
20487
- if (!buf) {
20488
- buf = { sessionId, text: "", thought: "" };
20489
- this.messageBuffers.set(messageId, buf);
20490
- }
20491
- buf[kind] += delta;
20492
- }
20493
- /**
20494
- * Flush accumulated message content for a given session as assembled log entries.
20495
- * Called when a boundary event (tool_call, session change, etc.) signals the
20496
- * text/thought phase is complete.
20497
- */
20498
- flushMessageBuffer(sessionId, reason) {
20499
- for (const [messageId, buf] of this.messageBuffers) {
20500
- if (buf.sessionId !== sessionId) continue;
20501
- if (!buf.text && !buf.thought) {
20502
- this.messageBuffers.delete(messageId);
20503
- continue;
20504
- }
20505
- if (buf.text) {
20506
- acpAssembled("sessionUpdate.agent_message_complete", {
20507
- sessionId: sessionId.slice(0, 12),
20508
- messageId: messageId.slice(0, 12),
20509
- length: buf.text.length,
20510
- text: buf.text,
20511
- flushReason: reason
20512
- });
20513
- }
20514
- if (buf.thought) {
20515
- acpAssembled("sessionUpdate.agent_thought_complete", {
20516
- sessionId: sessionId.slice(0, 12),
20517
- messageId: messageId.slice(0, 12),
20518
- length: buf.thought.length,
20519
- text: buf.thought,
20520
- flushReason: reason
20521
- });
20522
- }
20523
- this.messageBuffers.delete(messageId);
20524
- }
20456
+ getDiffStats(sessionId) {
20457
+ return this.diffStats.get(sessionId);
20525
20458
  }
20526
- /** Flush all remaining buffers (e.g. on stop) */
20527
- flushAllBuffers() {
20528
- for (const [messageId, buf] of this.messageBuffers) {
20529
- this.flushMessageBuffer(buf.sessionId, "stop");
20530
- }
20459
+ setDiffStats(sessionId, stats) {
20460
+ if (this.diffStats.has(sessionId)) return;
20461
+ this.diffStats.set(sessionId, stats);
20531
20462
  }
20532
20463
  constructor(deps) {
20533
20464
  this.connection = deps.connection;
@@ -20543,7 +20474,6 @@ var EventHandler = class {
20543
20474
  });
20544
20475
  }
20545
20476
  stop() {
20546
- this.flushAllBuffers();
20547
20477
  this.abort.abort();
20548
20478
  }
20549
20479
  async runSubscription() {
@@ -20570,18 +20500,18 @@ var EventHandler = class {
20570
20500
  */
20571
20501
  resolveSession(sessionId) {
20572
20502
  const session = this.sessionManager.tryGet(sessionId);
20573
- if (session) return { sessionId: session.id, cwd: session.cwd };
20574
- const root = this.sessionManager.findRootSession(sessionId);
20575
- if (!root) return void 0;
20576
- const child = this.sessionManager.tryGet(sessionId);
20577
- if (child) return { sessionId: child.id, cwd: child.cwd };
20578
- return void 0;
20503
+ if (!session) return void 0;
20504
+ return { sessionId: session.id, cwd: session.cwd };
20579
20505
  }
20580
20506
  // ─── Event Handling ──────────────────────────────────────────────
20581
20507
  async handleEvent(event) {
20508
+ if (event.type === "server.heartbeat") {
20509
+ return;
20510
+ }
20582
20511
  switch (event.type) {
20583
20512
  case "session.created":
20584
20513
  case "session.updated": {
20514
+ ocEvent(event.type, event);
20585
20515
  const props = event.properties;
20586
20516
  const info = props.info ?? props;
20587
20517
  const parentID = info.parentID;
@@ -20591,12 +20521,18 @@ var EventHandler = class {
20591
20521
  const isNew = !this.sessionManager.tryGet(id);
20592
20522
  this.sessionManager.registerDiscovered(id, parentID, title);
20593
20523
  if (isNew) {
20594
- ocEvent("session.created.child", { id, parentID, title });
20595
- await this.announceChildSession(id, parentID, title);
20524
+ const agentMatch = title?.match(/@(\w+)\s+subagent/);
20525
+ const agentType = agentMatch?.[1];
20526
+ const description = title?.replace(/\s*\(@\w+\s+subagent\)\s*$/, "") ?? title;
20527
+ await this.announceChildSession(id, parentID, title, {
20528
+ agentType,
20529
+ description
20530
+ });
20596
20531
  }
20597
20532
  return;
20598
20533
  }
20599
20534
  case "permission.asked": {
20535
+ ocEvent("permission.asked", event);
20600
20536
  const permission = event.properties;
20601
20537
  const resolved = this.resolveSession(permission.sessionID);
20602
20538
  if (!resolved) return;
@@ -20670,7 +20606,11 @@ var EventHandler = class {
20670
20606
  if (!resolved) return;
20671
20607
  const directory = resolved.cwd;
20672
20608
  const sessionId = resolved.sessionId;
20673
- ocEvent("question.asked", { id: q.id, sessionID: q.sessionID, questions: q.questions.length });
20609
+ ocEvent("question.asked", {
20610
+ id: q.id,
20611
+ sessionID: q.sessionID,
20612
+ questions: q.questions.length
20613
+ });
20674
20614
  const prev = this.questionQueues.get(q.sessionID) ?? Promise.resolve();
20675
20615
  const next = prev.then(async () => {
20676
20616
  const extResult = await Promise.race([
@@ -20698,7 +20638,10 @@ var EventHandler = class {
20698
20638
  console.error("[event-handler] invalid answers shape from client:", JSON.stringify(answers));
20699
20639
  await this.sdk.question.reject({ requestID: q.id, directory }).catch(() => {
20700
20640
  });
20701
- ocEvent("question.rejected", { requestID: q.id, reason: "invalid_answers" });
20641
+ ocEvent("question.rejected", {
20642
+ requestID: q.id,
20643
+ reason: "invalid_answers"
20644
+ });
20702
20645
  return;
20703
20646
  }
20704
20647
  await this.sdk.question.reply({
@@ -20718,39 +20661,39 @@ var EventHandler = class {
20718
20661
  return;
20719
20662
  }
20720
20663
  case "message.part.updated": {
20664
+ ocEvent("message.part.updated", event);
20721
20665
  const props = event.properties;
20722
20666
  const part = props.part;
20667
+ if (part.id) {
20668
+ this.partMetaIndex.set(part.id, { type: part.type, ignored: part.ignored });
20669
+ }
20723
20670
  const resolved = this.resolveSession(part.sessionID);
20724
20671
  if (!resolved) return;
20725
20672
  if (part.type === "tool") {
20726
20673
  await this.handleToolPart(resolved.sessionId, part);
20727
20674
  }
20675
+ if (part.type === "text" && typeof part.text === "string" && part.ignored === true) {
20676
+ await this.sendToClient({
20677
+ sessionId: resolved.sessionId,
20678
+ update: {
20679
+ sessionUpdate: "agent_message_chunk",
20680
+ messageId: part.messageID,
20681
+ content: { type: "text", text: part.text }
20682
+ }
20683
+ }).catch(() => {
20684
+ });
20685
+ }
20728
20686
  return;
20729
20687
  }
20730
20688
  case "message.part.delta": {
20689
+ ocEvent("message.part.delta", event);
20731
20690
  const props = event.properties;
20732
20691
  const resolved = this.resolveSession(props.sessionID);
20733
20692
  if (!resolved) return;
20734
20693
  const sessionId = resolved.sessionId;
20735
- const currentBufKey = [...this.messageBuffers.keys()].find(
20736
- (k) => this.messageBuffers.get(k)?.sessionId === sessionId && k !== props.messageID
20737
- );
20738
- if (currentBufKey) {
20739
- this.flushMessageBuffer(sessionId, "new_message");
20740
- }
20741
- const message = await this.sdk.session.message(
20742
- {
20743
- sessionID: props.sessionID,
20744
- messageID: props.messageID,
20745
- directory: resolved.cwd
20746
- },
20747
- { throwOnError: true }
20748
- ).then((x) => x.data).catch(() => void 0);
20749
- if (!message || message.info.role !== "assistant") return;
20750
- const part = message.parts.find((p) => p.id === props.partID);
20751
- if (!part) return;
20752
- if (part.type === "text" && props.field === "text" && part.ignored !== true) {
20753
- this.accumulateDelta(props.messageID, sessionId, "text", props.delta);
20694
+ const partMeta = this.partMetaIndex.get(props.partID);
20695
+ if (!partMeta) return;
20696
+ if (partMeta.type === "text" && props.field === "text" && partMeta.ignored !== true) {
20754
20697
  await this.sendToClient({
20755
20698
  sessionId,
20756
20699
  update: {
@@ -20762,8 +20705,7 @@ var EventHandler = class {
20762
20705
  });
20763
20706
  return;
20764
20707
  }
20765
- if (part.type === "reasoning" && props.field === "text") {
20766
- this.accumulateDelta(props.messageID, sessionId, "thought", props.delta);
20708
+ if (partMeta.type === "reasoning" && props.field === "text") {
20767
20709
  await this.sendToClient({
20768
20710
  sessionId,
20769
20711
  update: {
@@ -20776,6 +20718,25 @@ var EventHandler = class {
20776
20718
  }
20777
20719
  return;
20778
20720
  }
20721
+ case "session.diff": {
20722
+ ocEvent("session.diff", event);
20723
+ const { sessionID, diff } = event.properties;
20724
+ const resolved = this.resolveSession(sessionID);
20725
+ if (!resolved) {
20726
+ return;
20727
+ }
20728
+ let additions = 0;
20729
+ let deletions = 0;
20730
+ for (const d of diff) {
20731
+ additions += d.additions;
20732
+ deletions += d.deletions;
20733
+ }
20734
+ this.diffStats.set(resolved.sessionId, { additions, deletions, files: diff.length });
20735
+ return;
20736
+ }
20737
+ default: {
20738
+ return;
20739
+ }
20779
20740
  }
20780
20741
  }
20781
20742
  // ─── Child Session Announcement ──────────────────────────────────
@@ -20783,19 +20744,20 @@ var EventHandler = class {
20783
20744
  * Announce a child session to the ACP client.
20784
20745
  *
20785
20746
  * Sends a session_info_update with the child's own sessionId,
20786
- * and _meta containing the parent relationship so the client
20787
- * can display it as a linked sub-session.
20747
+ * and _meta containing structured metadata about the subagent.
20788
20748
  */
20789
- async announceChildSession(childSessionId, parentSessionId, title) {
20749
+ async announceChildSession(childSessionId, parentSessionId, title, meta3) {
20790
20750
  await this.sendToClient({
20791
20751
  sessionId: childSessionId,
20792
20752
  update: {
20793
20753
  sessionUpdate: "session_info_update",
20794
- title,
20754
+ title: title ?? "Subagent",
20795
20755
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
20796
20756
  _meta: {
20797
20757
  parentSessionId,
20798
- isSubagent: true
20758
+ isSubagent: true,
20759
+ ...meta3?.agentType && { agentType: meta3.agentType },
20760
+ ...meta3?.description && { description: meta3.description }
20799
20761
  }
20800
20762
  }
20801
20763
  }).catch(() => {
@@ -20805,6 +20767,19 @@ var EventHandler = class {
20805
20767
  async handleToolPart(sessionId, part) {
20806
20768
  if (!this.toolStarts.has(part.callID)) {
20807
20769
  this.toolStarts.add(part.callID);
20770
+ const session = this.sessionManager.tryGet(sessionId);
20771
+ if (session?.parentID) {
20772
+ const tracker = this.childToolCounts.get(sessionId);
20773
+ if (tracker) {
20774
+ tracker.total++;
20775
+ } else {
20776
+ this.childToolCounts.set(sessionId, {
20777
+ completed: 0,
20778
+ total: 1,
20779
+ startTime: Date.now()
20780
+ });
20781
+ }
20782
+ }
20808
20783
  await this.sendToClient({
20809
20784
  sessionId,
20810
20785
  update: {
@@ -20856,6 +20831,27 @@ var EventHandler = class {
20856
20831
  case "completed": {
20857
20832
  this.toolStarts.delete(part.callID);
20858
20833
  this.bashSnapshots.delete(part.callID);
20834
+ if (part.tool === "task" && part.state.metadata) {
20835
+ const childSessionId = typeof part.state.metadata["sessionId"] === "string" ? part.state.metadata["sessionId"] : void 0;
20836
+ if (childSessionId && this.sessionManager.tryGet(childSessionId)) {
20837
+ const tracker = this.childToolCounts.get(childSessionId);
20838
+ await this.sendChildSessionCompleted(
20839
+ childSessionId,
20840
+ sessionId,
20841
+ tracker?.completed ?? 0,
20842
+ tracker ? Date.now() - tracker.startTime : 0
20843
+ ).catch(() => {
20844
+ });
20845
+ this.childToolCounts.delete(childSessionId);
20846
+ }
20847
+ }
20848
+ const session = this.sessionManager.tryGet(sessionId);
20849
+ if (session?.parentID) {
20850
+ const tracker = this.childToolCounts.get(sessionId);
20851
+ if (tracker) {
20852
+ tracker.completed++;
20853
+ }
20854
+ }
20859
20855
  const kind = toToolKind(part.tool);
20860
20856
  const content = [
20861
20857
  {
@@ -20938,6 +20934,34 @@ var EventHandler = class {
20938
20934
  }
20939
20935
  }
20940
20936
  }
20937
+ /**
20938
+ * Notify the ACP client that a child session has completed.
20939
+ */
20940
+ async sendChildSessionCompleted(childSessionId, parentSessionId, toolCallCount, durationMs) {
20941
+ const child = this.sessionManager.tryGet(childSessionId);
20942
+ const title = child?.title ?? "Subagent";
20943
+ const agentMatch = title.match(/@(\w+)\s+subagent/);
20944
+ const agentType = agentMatch?.[1];
20945
+ const description = title.replace(/\s*\(@\w+\s+subagent\)\s*$/, "");
20946
+ const childDiffStats = this.diffStats.get(childSessionId);
20947
+ await this.sendToClient({
20948
+ sessionId: childSessionId,
20949
+ update: {
20950
+ sessionUpdate: "session_info_update",
20951
+ title,
20952
+ status: "completed",
20953
+ _meta: {
20954
+ parentSessionId,
20955
+ isSubagent: true,
20956
+ toolCallCount,
20957
+ durationMs,
20958
+ ...agentType && { agentType },
20959
+ ...description && { description },
20960
+ ...childDiffStats && { codeChange: childDiffStats }
20961
+ }
20962
+ }
20963
+ });
20964
+ }
20941
20965
  bashOutput(part) {
20942
20966
  if (part.tool !== "bash") return;
20943
20967
  if (!("metadata" in part.state) || !part.state.metadata || typeof part.state.metadata !== "object") return;
@@ -20955,6 +20979,87 @@ function simpleHash(str) {
20955
20979
  return hash2.toString(36);
20956
20980
  }
20957
20981
 
20982
+ // src/mcp-manager.ts
20983
+ var THROW = { throwOnError: true };
20984
+ var McpManager = class {
20985
+ constructor(sdk) {
20986
+ this.sdk = sdk;
20987
+ }
20988
+ async status(directory) {
20989
+ ocCall("mcp.status", { directory });
20990
+ const result = await this.sdk.mcp.status({ directory });
20991
+ return result.data ?? {};
20992
+ }
20993
+ async add(directory, name, config2) {
20994
+ ocCall("mcp.add", { directory, name });
20995
+ const result = await this.sdk.mcp.add({ directory, name, config: config2 }, THROW);
20996
+ return result.data ?? {};
20997
+ }
20998
+ async connect(directory, name) {
20999
+ ocCall("mcp.connect", { directory, name });
21000
+ await this.sdk.mcp.connect({ name, directory }, THROW);
21001
+ return { success: true };
21002
+ }
21003
+ async disconnect(directory, name) {
21004
+ ocCall("mcp.disconnect", { directory, name });
21005
+ await this.sdk.mcp.disconnect({ name, directory }, THROW);
21006
+ return { success: true };
21007
+ }
21008
+ async startAuth(directory, name) {
21009
+ ocCall("mcp.auth.start", { directory, name });
21010
+ const result = await this.sdk.mcp.auth.start({ name, directory }, THROW);
21011
+ return result.data ?? {};
21012
+ }
21013
+ async callbackAuth(directory, name, code) {
21014
+ ocCall("mcp.auth.callback", { directory, name });
21015
+ const result = await this.sdk.mcp.auth.callback({ name, directory, code }, THROW);
21016
+ return result.data ?? {};
21017
+ }
21018
+ async removeAuth(directory, name) {
21019
+ ocCall("mcp.auth.remove", { directory, name });
21020
+ await this.sdk.mcp.auth.remove({ name, directory }, THROW);
21021
+ return { success: true };
21022
+ }
21023
+ };
21024
+
21025
+ // src/auth-provider.ts
21026
+ var AuthProviderManager = class {
21027
+ sdk;
21028
+ constructor(sdk) {
21029
+ this.sdk = sdk;
21030
+ }
21031
+ async listProviders(directory) {
21032
+ ocCall("provider.list", { directory });
21033
+ const res = await this.sdk.provider.list({ directory });
21034
+ return res.data;
21035
+ }
21036
+ async authMethods(directory) {
21037
+ ocCall("provider.auth", { directory });
21038
+ const res = await this.sdk.provider.auth({ directory });
21039
+ return res.data;
21040
+ }
21041
+ async setApiKey(providerID, auth) {
21042
+ ocCall("auth.set", { providerID });
21043
+ const res = await this.sdk.auth.set({ providerID, auth });
21044
+ return res.data;
21045
+ }
21046
+ async removeAuth(providerID) {
21047
+ ocCall("auth.remove", { providerID });
21048
+ const res = await this.sdk.auth.remove({ providerID });
21049
+ return res.data;
21050
+ }
21051
+ async oauthAuthorize(providerID, method, inputs, directory) {
21052
+ ocCall("provider.oauth.authorize", { providerID, method });
21053
+ const res = await this.sdk.provider.oauth.authorize({ providerID, method, inputs, directory });
21054
+ return res.data;
21055
+ }
21056
+ async oauthCallback(providerID, method, code, directory) {
21057
+ ocCall("provider.oauth.callback", { providerID, method });
21058
+ const res = await this.sdk.provider.oauth.callback({ providerID, method, code, directory });
21059
+ return res.data;
21060
+ }
21061
+ };
21062
+
20958
21063
  // src/agent.ts
20959
21064
  function isApiKeyError(err) {
20960
21065
  return err instanceof Error && err.name === "AI_LoadAPIKeyError";
@@ -20965,23 +21070,39 @@ var Agent = class {
20965
21070
  sdk;
20966
21071
  sessionManager;
20967
21072
  eventHandler;
21073
+ authProvider;
21074
+ mcpManager;
20968
21075
  /**
20969
21076
  * Wrapper around connection.sessionUpdate that logs what's sent to the ACP client.
20970
21077
  */
20971
21078
  async sendToClient(params) {
20972
21079
  const updateType = params.update.sessionUpdate;
20973
- if (updateType !== "agent_message_chunk" && updateType !== "agent_thought_chunk") {
20974
- acpOut(`sessionUpdate.${updateType}`, {
20975
- sessionId: params.sessionId.slice(0, 12),
20976
- ...updateType === "tool_call" || updateType === "tool_call_update" ? { toolCallId: params.update.toolCallId, tool: params.update.title, kind: params.update.kind, status: params.update.status } : {}
20977
- });
20978
- }
21080
+ const update = params.update;
21081
+ acpOut(`sessionUpdate.${updateType}`, {
21082
+ sessionId: params.sessionId.slice(0, 12),
21083
+ ...updateType === "agent_message_chunk" || updateType === "agent_thought_chunk" ? {
21084
+ messageId: update.messageId?.slice(0, 12),
21085
+ delta: update.content?.text?.slice(0, 200)
21086
+ } : updateType === "tool_call" || updateType === "tool_call_update" ? {
21087
+ toolCallId: update.toolCallId,
21088
+ tool: update.title,
21089
+ kind: update.kind,
21090
+ status: update.status
21091
+ } : updateType === "usage_update" ? {
21092
+ used: update.used,
21093
+ size: update.size,
21094
+ cost: update.cost,
21095
+ _meta: update._meta
21096
+ } : {}
21097
+ });
20979
21098
  return this.connection.sessionUpdate(params);
20980
21099
  }
20981
21100
  constructor(config2) {
20982
21101
  this.config = config2;
20983
21102
  this.sdk = config2.sdk;
20984
21103
  this.sessionManager = new SessionManager(config2.sdk);
21104
+ this.authProvider = new AuthProviderManager(config2.sdk);
21105
+ this.mcpManager = new McpManager(config2.sdk);
20985
21106
  }
20986
21107
  init(connection) {
20987
21108
  this.connection = connection;
@@ -21021,12 +21142,153 @@ var Agent = class {
21021
21142
  agentInfo: {
21022
21143
  name: "Harmony-ACP",
21023
21144
  version: "0.1.0"
21024
- }
21145
+ },
21146
+ _meta: await this.buildProviderMeta()
21025
21147
  };
21026
21148
  }
21027
21149
  async authenticate(_params) {
21028
21150
  throw new Error("Authentication not implemented");
21029
21151
  }
21152
+ // ─── Extension Methods ────────────────────────────────────────────
21153
+ async extMethod(method, params) {
21154
+ acpIn("extMethod", { method });
21155
+ if (method.startsWith("provider/")) {
21156
+ return this.handleProviderMethod(method, params);
21157
+ }
21158
+ if (method.startsWith("mcp/")) {
21159
+ return this.handleMcpMethod(method, params);
21160
+ }
21161
+ throw new Error(`Unknown extMethod: ${method}`);
21162
+ }
21163
+ async handleProviderMethod(method, params) {
21164
+ const sessionId = params.sessionId;
21165
+ const cwd = sessionId ? this.sessionManager.get(sessionId)?.cwd : this.config.cwd;
21166
+ switch (method) {
21167
+ case "provider/list": {
21168
+ if (!cwd) throw new Error("Session not found");
21169
+ const data = await this.authProvider.listProviders(cwd);
21170
+ acpOut("extMethod.response", { method: "provider/list" });
21171
+ return data;
21172
+ }
21173
+ case "provider/auth/methods": {
21174
+ if (!cwd) throw new Error("Session not found");
21175
+ const data = await this.authProvider.authMethods(cwd);
21176
+ acpOut("extMethod.response", { method: "provider/auth/methods" });
21177
+ return data;
21178
+ }
21179
+ case "provider/auth/set": {
21180
+ const providerID = params.providerID;
21181
+ const auth = params.auth;
21182
+ if (!providerID) throw new Error("Missing required parameter: providerID");
21183
+ if (!auth?.key) throw new Error("Missing required parameter: auth.key");
21184
+ await this.authProvider.setApiKey(providerID, auth);
21185
+ acpOut("extMethod.response", { method: "provider/auth/set", providerID });
21186
+ return { success: true };
21187
+ }
21188
+ case "provider/auth/remove": {
21189
+ const providerID = params.providerID;
21190
+ if (!providerID) throw new Error("Missing required parameter: providerID");
21191
+ await this.authProvider.removeAuth(providerID);
21192
+ acpOut("extMethod.response", { method: "provider/auth/remove", providerID });
21193
+ return { success: true };
21194
+ }
21195
+ case "provider/oauth/authorize": {
21196
+ const providerID = params.providerID;
21197
+ const oauthMethod = params.method;
21198
+ if (!providerID) throw new Error("Missing required parameter: providerID");
21199
+ const inputs = params.inputs;
21200
+ const data = await this.authProvider.oauthAuthorize(providerID, oauthMethod ?? 0, inputs, cwd);
21201
+ acpOut("extMethod.response", { method: "provider/oauth/authorize", providerID });
21202
+ return data;
21203
+ }
21204
+ case "provider/oauth/callback": {
21205
+ const providerID = params.providerID;
21206
+ const oauthMethod = params.method;
21207
+ const code = params.code;
21208
+ if (!providerID) throw new Error("Missing required parameter: providerID");
21209
+ await this.authProvider.oauthCallback(providerID, oauthMethod ?? 0, code, cwd);
21210
+ acpOut("extMethod.response", { method: "provider/oauth/callback", providerID });
21211
+ return { success: true };
21212
+ }
21213
+ default:
21214
+ throw new Error(`Unknown provider extMethod: ${method}`);
21215
+ }
21216
+ }
21217
+ async handleMcpMethod(method, params) {
21218
+ const sessionId = params.sessionId;
21219
+ if (!sessionId) throw new Error("sessionId required");
21220
+ const directory = this.sessionManager.get(sessionId)?.cwd;
21221
+ if (!directory) throw new Error("Session not found");
21222
+ switch (method) {
21223
+ case "mcp/status": {
21224
+ const data = await this.mcpManager.status(directory);
21225
+ acpOut("extMethod.response", { method: "mcp/status" });
21226
+ return data;
21227
+ }
21228
+ case "mcp/add": {
21229
+ const name = params.name;
21230
+ const config2 = params.config;
21231
+ if (!name) throw new Error("Missing required parameter: name");
21232
+ if (!config2) throw new Error("Missing required parameter: config");
21233
+ const data = await this.mcpManager.add(directory, name, config2);
21234
+ acpOut("extMethod.response", { method: "mcp/add", name });
21235
+ return data;
21236
+ }
21237
+ case "mcp/connect": {
21238
+ const name = params.name;
21239
+ if (!name) throw new Error("Missing required parameter: name");
21240
+ const data = await this.mcpManager.connect(directory, name);
21241
+ acpOut("extMethod.response", { method: "mcp/connect", name });
21242
+ return data;
21243
+ }
21244
+ case "mcp/disconnect": {
21245
+ const name = params.name;
21246
+ if (!name) throw new Error("Missing required parameter: name");
21247
+ const data = await this.mcpManager.disconnect(directory, name);
21248
+ acpOut("extMethod.response", { method: "mcp/disconnect", name });
21249
+ return data;
21250
+ }
21251
+ case "mcp/auth/start": {
21252
+ const name = params.name;
21253
+ if (!name) throw new Error("Missing required parameter: name");
21254
+ const data = await this.mcpManager.startAuth(directory, name);
21255
+ acpOut("extMethod.response", { method: "mcp/auth/start", name });
21256
+ return data;
21257
+ }
21258
+ case "mcp/auth/callback": {
21259
+ const name = params.name;
21260
+ const code = params.code;
21261
+ if (!name) throw new Error("Missing required parameter: name");
21262
+ if (!code) throw new Error("Missing required parameter: code");
21263
+ const data = await this.mcpManager.callbackAuth(directory, name, code);
21264
+ acpOut("extMethod.response", { method: "mcp/auth/callback", name });
21265
+ return data;
21266
+ }
21267
+ case "mcp/auth/remove": {
21268
+ const name = params.name;
21269
+ if (!name) throw new Error("Missing required parameter: name");
21270
+ const data = await this.mcpManager.removeAuth(directory, name);
21271
+ acpOut("extMethod.response", { method: "mcp/auth/remove", name });
21272
+ return data;
21273
+ }
21274
+ default:
21275
+ throw new Error(`Unknown MCP method: ${method}`);
21276
+ }
21277
+ }
21278
+ async buildProviderMeta() {
21279
+ try {
21280
+ const data = await this.authProvider.listProviders(this.config.cwd);
21281
+ if (!data?.all) return void 0;
21282
+ const providers = data.all.map((p) => ({
21283
+ id: p.id,
21284
+ name: p.name,
21285
+ connected: data.connected?.includes(p.id) ?? false
21286
+ }));
21287
+ return { providers };
21288
+ } catch {
21289
+ return void 0;
21290
+ }
21291
+ }
21030
21292
  // ─── Session Management ───────────────────────────────────────────
21031
21293
  async newSession(params) {
21032
21294
  acpIn("newSession", { cwd: params.cwd, mcpServers: params.mcpServers.length });
@@ -21034,11 +21296,7 @@ var Agent = class {
21034
21296
  const directory = params.cwd;
21035
21297
  ocCall("session.create", { directory });
21036
21298
  const model = await this.defaultModel(directory);
21037
- const state = await this.sessionManager.create(
21038
- params.cwd,
21039
- params.mcpServers,
21040
- model
21041
- );
21299
+ const state = await this.sessionManager.create(params.cwd, params.mcpServers, model);
21042
21300
  const sessionId = state.id;
21043
21301
  const result = await this.loadSessionMode({
21044
21302
  cwd: directory,
@@ -21063,7 +21321,14 @@ var Agent = class {
21063
21321
  const directory = params.cwd;
21064
21322
  const sessionId = params.sessionId;
21065
21323
  const model = await this.defaultModel(directory);
21066
- await this.sessionManager.load(sessionId, params.cwd, params.mcpServers, model);
21324
+ const { session } = await this.sessionManager.load(sessionId, params.cwd, params.mcpServers, model);
21325
+ if (session.summary) {
21326
+ this.eventHandler.setDiffStats(sessionId, {
21327
+ additions: session.summary.additions,
21328
+ deletions: session.summary.deletions,
21329
+ files: session.summary.files
21330
+ });
21331
+ }
21067
21332
  const result = await this.loadSessionMode({
21068
21333
  cwd: directory,
21069
21334
  mcpServers: params.mcpServers,
@@ -21078,13 +21343,18 @@ var Agent = class {
21078
21343
  modelID: lastUser.model.modelID
21079
21344
  });
21080
21345
  if (result.modes?.availableModes.some((m) => m.id === lastUser.agent)) {
21081
- ;
21082
21346
  result.modes.currentModeId = lastUser.agent;
21083
21347
  this.sessionManager.setMode(sessionId, lastUser.agent);
21084
21348
  }
21085
21349
  }
21086
21350
  for (const msg of messages ?? []) {
21087
21351
  await this.processMessage(msg);
21352
+ for (const part of msg.parts ?? []) {
21353
+ if (part.type === "tool" && part.tool === "task" && part.state?.status === "completed" && part.state?.metadata?.sessionId) {
21354
+ const childSessionId = part.state.metadata.sessionId;
21355
+ await this.replayChildSession(childSessionId, sessionId, directory);
21356
+ }
21357
+ }
21088
21358
  }
21089
21359
  await this.sendUsageUpdate(sessionId, directory);
21090
21360
  return result;
@@ -21143,7 +21413,14 @@ var Agent = class {
21143
21413
  const sessionId = params.sessionId;
21144
21414
  const mcpServers = params.mcpServers ?? [];
21145
21415
  const model = await this.defaultModel(directory);
21146
- await this.sessionManager.load(sessionId, directory, mcpServers, model);
21416
+ const { session } = await this.sessionManager.load(sessionId, directory, mcpServers, model);
21417
+ if (session.summary) {
21418
+ this.eventHandler.setDiffStats(sessionId, {
21419
+ additions: session.summary.additions,
21420
+ deletions: session.summary.deletions,
21421
+ files: session.summary.files
21422
+ });
21423
+ }
21147
21424
  const result = await this.loadSessionMode({
21148
21425
  cwd: directory,
21149
21426
  mcpServers,
@@ -21366,6 +21643,32 @@ var Agent = class {
21366
21643
  return { configOptions };
21367
21644
  }
21368
21645
  // ─── Internal Helpers ─────────────────────────────────────────────
21646
+ /**
21647
+ * Replay a child subagent session by fetching its messages and sending
21648
+ * them to the ACP client. Registers the child with the session manager.
21649
+ */
21650
+ async replayChildSession(childSessionId, parentSessionId, directory) {
21651
+ if (this.sessionManager.tryGet(childSessionId)) return;
21652
+ const childMessages = await this.sdk.session.messages({ sessionID: childSessionId, directory }).then((x) => x.data).catch(() => void 0);
21653
+ if (!childMessages?.length) return;
21654
+ const title = `Subagent (${childSessionId.slice(0, 8)})`;
21655
+ this.sessionManager.registerDiscovered(childSessionId, parentSessionId, title);
21656
+ await this.sendToClient({
21657
+ sessionId: childSessionId,
21658
+ update: {
21659
+ sessionUpdate: "session_info_update",
21660
+ title,
21661
+ _meta: {
21662
+ parentSessionId,
21663
+ isSubagent: true
21664
+ }
21665
+ }
21666
+ }).catch(() => {
21667
+ });
21668
+ for (const msg of childMessages) {
21669
+ await this.processMessage({ ...msg, info: { ...msg.info, sessionID: childSessionId } });
21670
+ }
21671
+ }
21369
21672
  async defaultModel(cwd) {
21370
21673
  const configured = this.config.defaultModel;
21371
21674
  if (configured) return configured;
@@ -21384,9 +21687,7 @@ var Agent = class {
21384
21687
  return { providerID: "opencode", modelID: models[0] };
21385
21688
  }
21386
21689
  }
21387
- const allModels = providers.flatMap(
21388
- (p) => Object.keys(p.models).map((m) => ({ providerID: p.id, modelID: m }))
21389
- );
21690
+ const allModels = providers.flatMap((p) => Object.keys(p.models).map((m) => ({ providerID: p.id, modelID: m })));
21390
21691
  if (allModels.length > 0) return allModels[0];
21391
21692
  return { providerID: "opencode", modelID: "big-pickle" };
21392
21693
  }
@@ -21456,7 +21757,7 @@ var Agent = class {
21456
21757
  {}
21457
21758
  )
21458
21759
  };
21459
- await this.sdk.mcp.add({ directory: params.cwd, name: server.name, config: config2 }).catch(() => {
21760
+ await this.mcpManager.add(params.cwd, server.name, config2).catch(() => {
21460
21761
  });
21461
21762
  })
21462
21763
  );
@@ -21572,7 +21873,11 @@ var Agent = class {
21572
21873
  } else {
21573
21874
  const isText = effectiveMime.startsWith("text/") || effectiveMime === "application/json";
21574
21875
  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 };
21876
+ const resource = isText ? {
21877
+ uri: fileUri,
21878
+ mimeType: effectiveMime,
21879
+ text: Buffer.from(base64Data, "base64").toString("utf-8")
21880
+ } : { uri: fileUri, mimeType: effectiveMime, blob: base64Data };
21576
21881
  await this.sendToClient({
21577
21882
  sessionId,
21578
21883
  update: {
@@ -21614,9 +21919,7 @@ var Agent = class {
21614
21919
  switch (part.state.status) {
21615
21920
  case "completed": {
21616
21921
  const kind = toToolKind(part.tool);
21617
- const content = [
21618
- { type: "content", content: { type: "text", text: part.state.output } }
21619
- ];
21922
+ const content = [{ type: "content", content: { type: "text", text: part.state.output } }];
21620
21923
  if (kind === "edit") {
21621
21924
  const input = part.state.input;
21622
21925
  content.push({
@@ -21691,17 +21994,51 @@ var Agent = class {
21691
21994
  const msg = lastAssistant.info;
21692
21995
  if (!msg.providerID || !msg.modelID) return;
21693
21996
  const totalCost = assistantMessages.reduce((sum, m) => sum + m.info.cost, 0);
21997
+ const children = this.sessionManager.getChildren(sessionId);
21998
+ let childCost = 0;
21999
+ for (const childId of children) {
22000
+ const childMessages = await this.sdk.session.messages({ sessionID: childId, directory }).then((x) => x.data).catch(() => void 0);
22001
+ if (childMessages) {
22002
+ childCost += childMessages.filter((m) => m.info.role === "assistant").reduce((sum, m) => sum + (m.info.cost ?? 0), 0);
22003
+ }
22004
+ }
22005
+ const stats = this.eventHandler.getDiffStats(sessionId);
22006
+ let childStats;
22007
+ for (const childId of children) {
22008
+ const cs = this.eventHandler.getDiffStats(childId);
22009
+ if (cs) {
22010
+ childStats = childStats ? {
22011
+ additions: childStats.additions + cs.additions,
22012
+ deletions: childStats.deletions + cs.deletions,
22013
+ files: childStats.files + cs.files
22014
+ } : { ...cs };
22015
+ }
22016
+ }
22017
+ const totalStats = stats ?? childStats;
21694
22018
  const providers = await this.sdk.config.providers({ directory }).then((x) => x.data?.providers ?? []).catch(() => []);
21695
22019
  const provider = providers.find((p) => p.id === msg.providerID);
21696
22020
  const model = provider?.models[msg.modelID];
21697
22021
  const size = model?.limit?.context ?? 0;
22022
+ const _meta = {};
22023
+ if (childCost > 0) {
22024
+ _meta.parentCost = totalCost;
22025
+ _meta.childCost = childCost;
22026
+ _meta.childSessionCount = children.length;
22027
+ }
22028
+ if (totalStats) {
22029
+ _meta.codeChange = totalStats;
22030
+ }
22031
+ if (childStats) {
22032
+ _meta.childCodeChange = childStats;
22033
+ }
21698
22034
  await this.sendToClient({
21699
22035
  sessionId,
21700
22036
  update: {
21701
22037
  sessionUpdate: "usage_update",
21702
22038
  used: msg.tokens.input + (msg.tokens.cache?.read ?? 0),
21703
22039
  size,
21704
- cost: { amount: totalCost, currency: "USD" }
22040
+ cost: { amount: totalCost + childCost, currency: "USD" },
22041
+ ...Object.keys(_meta).length > 0 && { _meta }
21705
22042
  }
21706
22043
  }).catch(() => {
21707
22044
  });
@@ -21768,33 +22105,13 @@ var Agent = class {
21768
22105
  return { name, args: rest.join(" ").trim() };
21769
22106
  }
21770
22107
  /**
21771
- * Fetch the complete message content after prompt returns and log it.
21772
- * This ensures the response text is always captured in logs, even if
21773
- * SSE delta events arrive out of sync or are missed.
22108
+ * Fetch the complete message content after prompt returns and log tool usage.
21774
22109
  */
21775
22110
  async logMessageContent(sessionId, messageId, directory) {
21776
22111
  if (!messageId) return;
21777
22112
  const message = await this.sdk.session.message({ sessionID: sessionId, messageID: messageId, directory }).then((x) => x.data).catch(() => void 0);
21778
22113
  if (!message) return;
21779
22114
  for (const part of message.parts) {
21780
- if (part.type === "text" && part.text) {
21781
- acpAssembled("sessionUpdate.agent_message_complete", {
21782
- sessionId: sessionId.slice(0, 12),
21783
- messageId: messageId.slice(0, 12),
21784
- length: part.text.length,
21785
- text: part.text,
21786
- flushReason: "prompt_complete"
21787
- });
21788
- }
21789
- if (part.type === "reasoning" && part.text) {
21790
- acpAssembled("sessionUpdate.agent_thought_complete", {
21791
- sessionId: sessionId.slice(0, 12),
21792
- messageId: messageId.slice(0, 12),
21793
- length: part.text.length,
21794
- text: part.text,
21795
- flushReason: "prompt_complete"
21796
- });
21797
- }
21798
22115
  if (part.type === "tool") {
21799
22116
  ocCall("session.prompt.tool", {
21800
22117
  sessionId: sessionId.slice(0, 12),