@harmonyos-arkts/opencode-plugin 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.
Files changed (2) hide show
  1. package/dist/index.js +1650 -510
  2. package/package.json +7 -9
package/dist/index.js CHANGED
@@ -1673,8 +1673,8 @@ function slugify(input) {
1673
1673
  }
1674
1674
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
1675
1675
  };
1676
- function isObject(data2) {
1677
- return typeof data2 === "object" && data2 !== null && !Array.isArray(data2);
1676
+ function isObject(data) {
1677
+ return typeof data === "object" && data !== null && !Array.isArray(data);
1678
1678
  }
1679
1679
  var allowsEval = cached(() => {
1680
1680
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
@@ -1711,24 +1711,24 @@ function shallowClone(o) {
1711
1711
  return [...o];
1712
1712
  return o;
1713
1713
  }
1714
- function numKeys(data2) {
1714
+ function numKeys(data) {
1715
1715
  let keyCount = 0;
1716
- for (const key in data2) {
1717
- if (Object.prototype.hasOwnProperty.call(data2, key)) {
1716
+ for (const key in data) {
1717
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
1718
1718
  keyCount++;
1719
1719
  }
1720
1720
  }
1721
1721
  return keyCount;
1722
1722
  }
1723
- var getParsedType = (data2) => {
1724
- const t = typeof data2;
1723
+ var getParsedType = (data) => {
1724
+ const t = typeof data;
1725
1725
  switch (t) {
1726
1726
  case "undefined":
1727
1727
  return "undefined";
1728
1728
  case "string":
1729
1729
  return "string";
1730
1730
  case "number":
1731
- return Number.isNaN(data2) ? "nan" : "number";
1731
+ return Number.isNaN(data) ? "nan" : "number";
1732
1732
  case "boolean":
1733
1733
  return "boolean";
1734
1734
  case "function":
@@ -1738,25 +1738,25 @@ var getParsedType = (data2) => {
1738
1738
  case "symbol":
1739
1739
  return "symbol";
1740
1740
  case "object":
1741
- if (Array.isArray(data2)) {
1741
+ if (Array.isArray(data)) {
1742
1742
  return "array";
1743
1743
  }
1744
- if (data2 === null) {
1744
+ if (data === null) {
1745
1745
  return "null";
1746
1746
  }
1747
- if (data2.then && typeof data2.then === "function" && data2.catch && typeof data2.catch === "function") {
1747
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
1748
1748
  return "promise";
1749
1749
  }
1750
- if (typeof Map !== "undefined" && data2 instanceof Map) {
1750
+ if (typeof Map !== "undefined" && data instanceof Map) {
1751
1751
  return "map";
1752
1752
  }
1753
- if (typeof Set !== "undefined" && data2 instanceof Set) {
1753
+ if (typeof Set !== "undefined" && data instanceof Set) {
1754
1754
  return "set";
1755
1755
  }
1756
- if (typeof Date !== "undefined" && data2 instanceof Date) {
1756
+ if (typeof Date !== "undefined" && data instanceof Date) {
1757
1757
  return "date";
1758
1758
  }
1759
- if (typeof File !== "undefined" && data2 instanceof File) {
1759
+ if (typeof File !== "undefined" && data instanceof File) {
1760
1760
  return "file";
1761
1761
  }
1762
1762
  return "object";
@@ -2038,10 +2038,10 @@ function prefixIssues(path7, issues) {
2038
2038
  function unwrapMessage(message) {
2039
2039
  return typeof message === "string" ? message : message?.message;
2040
2040
  }
2041
- function finalizeIssue(iss, ctx, config4) {
2041
+ function finalizeIssue(iss, ctx, config3) {
2042
2042
  const full = { ...iss, path: iss.path ?? [] };
2043
2043
  if (!iss.message) {
2044
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config4.customError?.(iss)) ?? unwrapMessage(config4.localeError?.(iss)) ?? "Invalid input";
2044
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
2045
2045
  full.message = message;
2046
2046
  }
2047
2047
  delete full.inst;
@@ -2067,20 +2067,20 @@ function getLengthableOrigin(input) {
2067
2067
  return "string";
2068
2068
  return "unknown";
2069
2069
  }
2070
- function parsedType(data2) {
2071
- const t = typeof data2;
2070
+ function parsedType(data) {
2071
+ const t = typeof data;
2072
2072
  switch (t) {
2073
2073
  case "number": {
2074
- return Number.isNaN(data2) ? "nan" : "number";
2074
+ return Number.isNaN(data) ? "nan" : "number";
2075
2075
  }
2076
2076
  case "object": {
2077
- if (data2 === null) {
2077
+ if (data === null) {
2078
2078
  return "null";
2079
2079
  }
2080
- if (Array.isArray(data2)) {
2080
+ if (Array.isArray(data)) {
2081
2081
  return "array";
2082
2082
  }
2083
- const obj = data2;
2083
+ const obj = data;
2084
2084
  if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
2085
2085
  return obj.constructor.name;
2086
2086
  }
@@ -3436,13 +3436,13 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
3436
3436
  }
3437
3437
  };
3438
3438
  });
3439
- function isValidBase64(data2) {
3440
- if (data2 === "")
3439
+ function isValidBase64(data) {
3440
+ if (data === "")
3441
3441
  return true;
3442
- if (data2.length % 4 !== 0)
3442
+ if (data.length % 4 !== 0)
3443
3443
  return false;
3444
3444
  try {
3445
- atob(data2);
3445
+ atob(data);
3446
3446
  return true;
3447
3447
  } catch {
3448
3448
  return false;
@@ -3464,10 +3464,10 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
3464
3464
  });
3465
3465
  };
3466
3466
  });
3467
- function isValidBase64URL(data2) {
3468
- if (!base64url.test(data2))
3467
+ function isValidBase64URL(data) {
3468
+ if (!base64url.test(data))
3469
3469
  return false;
3470
- const base645 = data2.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
3470
+ const base645 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
3471
3471
  const padded = base645.padEnd(Math.ceil(base645.length / 4) * 4, "=");
3472
3472
  return isValidBase64(padded);
3473
3473
  }
@@ -11708,12 +11708,12 @@ function _stringbool(Classes, _params) {
11708
11708
  in: stringSchema,
11709
11709
  out: booleanSchema,
11710
11710
  transform: ((input, payload) => {
11711
- let data2 = input;
11711
+ let data = input;
11712
11712
  if (params.case !== "sensitive")
11713
- data2 = data2.toLowerCase();
11714
- if (truthySet.has(data2)) {
11713
+ data = data.toLowerCase();
11714
+ if (truthySet.has(data)) {
11715
11715
  return true;
11716
- } else if (falsySet.has(data2)) {
11716
+ } else if (falsySet.has(data)) {
11717
11717
  return false;
11718
11718
  } else {
11719
11719
  payload.issues.push({
@@ -13065,19 +13065,19 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
13065
13065
  reg.add(inst, meta3);
13066
13066
  return inst;
13067
13067
  });
13068
- inst.parse = (data2, params) => parse4(inst, data2, params, { callee: inst.parse });
13069
- inst.safeParse = (data2, params) => safeParse2(inst, data2, params);
13070
- inst.parseAsync = async (data2, params) => parseAsync2(inst, data2, params, { callee: inst.parseAsync });
13071
- inst.safeParseAsync = async (data2, params) => safeParseAsync2(inst, data2, params);
13068
+ inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
13069
+ inst.safeParse = (data, params) => safeParse2(inst, data, params);
13070
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
13071
+ inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
13072
13072
  inst.spa = inst.safeParseAsync;
13073
- inst.encode = (data2, params) => encode2(inst, data2, params);
13074
- inst.decode = (data2, params) => decode2(inst, data2, params);
13075
- inst.encodeAsync = async (data2, params) => encodeAsync2(inst, data2, params);
13076
- inst.decodeAsync = async (data2, params) => decodeAsync2(inst, data2, params);
13077
- inst.safeEncode = (data2, params) => safeEncode2(inst, data2, params);
13078
- inst.safeDecode = (data2, params) => safeDecode2(inst, data2, params);
13079
- inst.safeEncodeAsync = async (data2, params) => safeEncodeAsync2(inst, data2, params);
13080
- inst.safeDecodeAsync = async (data2, params) => safeDecodeAsync2(inst, data2, params);
13073
+ inst.encode = (data, params) => encode2(inst, data, params);
13074
+ inst.decode = (data, params) => decode2(inst, data, params);
13075
+ inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
13076
+ inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
13077
+ inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
13078
+ inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
13079
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
13080
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
13081
13081
  inst.refine = (check3, params) => inst.check(refine(check3, params));
13082
13082
  inst.superRefine = (refinement) => inst.check(superRefine(refinement));
13083
13083
  inst.overwrite = (fn) => inst.check(_overwrite(fn));
@@ -14081,7 +14081,7 @@ function _instanceof(cls, params = {}) {
14081
14081
  const inst = new ZodCustom({
14082
14082
  type: "custom",
14083
14083
  check: "custom",
14084
- fn: (data2) => data2 instanceof cls,
14084
+ fn: (data) => data instanceof cls,
14085
14085
  abort: true,
14086
14086
  ...util_exports.normalizeParams(params)
14087
14087
  });
@@ -14694,34 +14694,101 @@ function createPluginState() {
14694
14694
  import * as fs2 from "fs";
14695
14695
  import * as path3 from "path";
14696
14696
 
14697
- // node_modules/xdg-basedir/index.js
14698
- import os from "os";
14699
- import path from "path";
14700
- var homeDirectory = os.homedir();
14701
- var { env } = process;
14702
- var xdgData = env.XDG_DATA_HOME || (homeDirectory ? path.join(homeDirectory, ".local", "share") : void 0);
14703
- var xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ? path.join(homeDirectory, ".config") : void 0);
14704
- var xdgState = env.XDG_STATE_HOME || (homeDirectory ? path.join(homeDirectory, ".local", "state") : void 0);
14705
- var xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path.join(homeDirectory, ".cache") : void 0);
14706
- var xdgRuntime = env.XDG_RUNTIME_DIR || void 0;
14707
- var xdgDataDirectories = (env.XDG_DATA_DIRS || "/usr/local/share/:/usr/share/").split(":");
14708
- if (xdgData) {
14709
- xdgDataDirectories.unshift(xdgData);
14710
- }
14711
- var xdgConfigDirectories = (env.XDG_CONFIG_DIRS || "/etc/xdg").split(":");
14712
- if (xdgConfig) {
14713
- xdgConfigDirectories.unshift(xdgConfig);
14697
+ // node_modules/env-paths/index.js
14698
+ import path from "node:path";
14699
+ import os from "node:os";
14700
+ import process3 from "node:process";
14701
+
14702
+ // node_modules/is-safe-filename/index.js
14703
+ var unsafeFilenameFixtures = Object.freeze([
14704
+ "",
14705
+ " ",
14706
+ ".",
14707
+ "..",
14708
+ " .",
14709
+ ". ",
14710
+ " ..",
14711
+ ".. ",
14712
+ "../",
14713
+ "../foo",
14714
+ "foo/../bar",
14715
+ "foo/bar",
14716
+ "foo\\bar",
14717
+ "foo\0bar"
14718
+ ]);
14719
+ function isSafeFilename(filename) {
14720
+ if (typeof filename !== "string") {
14721
+ return false;
14722
+ }
14723
+ const trimmed = filename.trim();
14724
+ return trimmed !== "" && trimmed !== "." && trimmed !== ".." && !filename.includes("/") && !filename.includes("\\") && !filename.includes("\0");
14725
+ }
14726
+ function assertSafeFilename(filename) {
14727
+ if (typeof filename !== "string") {
14728
+ throw new TypeError("Expected a string");
14729
+ }
14730
+ if (!isSafeFilename(filename)) {
14731
+ throw new Error(`Unsafe filename: ${JSON.stringify(filename)}`);
14732
+ }
14733
+ }
14734
+
14735
+ // node_modules/env-paths/index.js
14736
+ var homedir = os.homedir();
14737
+ var tmpdir = os.tmpdir();
14738
+ var { env } = process3;
14739
+ var macos = (name) => {
14740
+ const library = path.join(homedir, "Library");
14741
+ return {
14742
+ data: path.join(library, "Application Support", name),
14743
+ config: path.join(library, "Preferences", name),
14744
+ cache: path.join(library, "Caches", name),
14745
+ log: path.join(library, "Logs", name),
14746
+ temp: path.join(tmpdir, name)
14747
+ };
14748
+ };
14749
+ var windows = (name) => {
14750
+ const appData = env.APPDATA || path.join(homedir, "AppData", "Roaming");
14751
+ const localAppData = env.LOCALAPPDATA || path.join(homedir, "AppData", "Local");
14752
+ return {
14753
+ // Data/config/cache/log are invented by me as Windows isn't opinionated about this
14754
+ data: path.join(localAppData, name, "Data"),
14755
+ config: path.join(appData, name, "Config"),
14756
+ cache: path.join(localAppData, name, "Cache"),
14757
+ log: path.join(localAppData, name, "Log"),
14758
+ temp: path.join(tmpdir, name)
14759
+ };
14760
+ };
14761
+ var linux = (name) => {
14762
+ const username = path.basename(homedir);
14763
+ return {
14764
+ data: path.join(env.XDG_DATA_HOME || path.join(homedir, ".local", "share"), name),
14765
+ config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, ".config"), name),
14766
+ cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, ".cache"), name),
14767
+ // https://wiki.debian.org/XDGBaseDirectorySpecification#state
14768
+ log: path.join(env.XDG_STATE_HOME || path.join(homedir, ".local", "state"), name),
14769
+ temp: path.join(tmpdir, username, name)
14770
+ };
14771
+ };
14772
+ function envPaths(name, { suffix = "nodejs" } = {}) {
14773
+ assertSafeFilename(name);
14774
+ if (suffix) {
14775
+ name += `-${suffix}`;
14776
+ }
14777
+ assertSafeFilename(name);
14778
+ if (process3.platform === "darwin") {
14779
+ return macos(name);
14780
+ }
14781
+ if (process3.platform === "win32") {
14782
+ return windows(name);
14783
+ }
14784
+ return linux(name);
14714
14785
  }
14715
14786
 
14716
14787
  // src/config/global.ts
14717
14788
  import path2 from "path";
14718
14789
  import fs from "fs/promises";
14719
14790
  import os2 from "os";
14720
- var app = "hm-plugin";
14721
- var data = path2.join(xdgData, app);
14722
- var cache = path2.join(xdgCache, app);
14723
- var config2 = path2.join(xdgConfig, app);
14724
- var state = path2.join(xdgState, app);
14791
+ var paths = envPaths("hm-plugin");
14725
14792
  var HMGlobal;
14726
14793
  ((HMGlobal2) => {
14727
14794
  HMGlobal2.Path = {
@@ -14729,12 +14796,12 @@ var HMGlobal;
14729
14796
  get home() {
14730
14797
  return process.env.OPENCODE_TEST_HOME || os2.homedir();
14731
14798
  },
14732
- data,
14733
- bin: path2.join(data, "bin"),
14734
- log: path2.join(data, "log"),
14735
- cache,
14736
- config: config2,
14737
- state
14799
+ data: paths.data,
14800
+ bin: path2.join(paths.data, "bin"),
14801
+ log: paths.log,
14802
+ cache: paths.cache,
14803
+ config: paths.config,
14804
+ state: paths.data
14738
14805
  };
14739
14806
  })(HMGlobal || (HMGlobal = {}));
14740
14807
  await Promise.all([
@@ -14753,10 +14820,10 @@ var FLUSH_INTERVAL_MS = 500;
14753
14820
  var BUFFER_SIZE_LIMIT = 50;
14754
14821
  function flush() {
14755
14822
  if (buffer.length === 0) return;
14756
- const data2 = buffer.join("");
14823
+ const data = buffer.join("");
14757
14824
  buffer = [];
14758
14825
  try {
14759
- fs2.appendFileSync(logFile, data2);
14826
+ fs2.appendFileSync(logFile, data);
14760
14827
  } catch {
14761
14828
  }
14762
14829
  }
@@ -14767,10 +14834,10 @@ function scheduleFlush() {
14767
14834
  flush();
14768
14835
  }, FLUSH_INTERVAL_MS);
14769
14836
  }
14770
- function log(message, data2) {
14837
+ function log(message, data) {
14771
14838
  try {
14772
14839
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
14773
- const logEntry = `[${timestamp}] ${message} ${data2 ? JSON.stringify(data2) : ""}
14840
+ const logEntry = `[${timestamp}] ${message} ${data ? JSON.stringify(data) : ""}
14774
14841
  `;
14775
14842
  buffer.push(logEntry);
14776
14843
  if (buffer.length >= BUFFER_SIZE_LIMIT) {
@@ -14797,6 +14864,14 @@ var HM_DEVELOP = `
14797
14864
  - Use the \`.harmonyos/\` file (*.md\u3001*.html) as references to generate
14798
14865
  - After completing development, you MUST proceed to the Build phase
14799
14866
  - **NO EXCEPTIONS**: Code must be built successfully before marking development as complete
14867
+ - **CODE OUTPUT POLICY**: NEVER include full source code in your thinking process or text output. Always use the Write or Edit tool to write/modify code files directly. Only include short snippets (\u226410 lines) in text output when explaining a concept. Full file contents or large code blocks must go through Write/Edit tools only.
14868
+ When generating ETS (ArkTS) code, follow these rules:
14869
+ - **ArkTS Type System**: Stricter than TypeScript \u2014 forbid any/unknown/as/for..in/dynamic property access; all types must be explicitly declared.
14870
+ - **V2 State Management**: Use @ComponentV2 + @Local/@Param for components, @ObservedV2 + @Trace for ViewModels. These are built-in decorators requiring no import.
14871
+ - **MVVM Architecture**: Define data models centrally in common/models/ and ensure complete imports. Use @ObservedV2 + @Trace for reactive ViewModels.
14872
+ - **Component Naming Collision Avoidance**: @Param/@Event property names must not share names with ArkUI built-in attributes (onClick, borderColor, width, etc.) \u2014 add a business prefix.
14873
+ - **build() Method**: No early return, no local variable declarations, no untyped object literals passed as arguments. Use If/Else components for conditional rendering.
14874
+ - **Common Substitutions**: Fsys.symbol \u2192 use Emoji; for..in \u2192 use for..of; any \u2192 use interface.
14800
14875
  `;
14801
14876
  var HM_BUILD = `
14802
14877
  ### Build Phase
@@ -14812,7 +14887,13 @@ var HM_BUILD = `
14812
14887
  `;
14813
14888
  var HM_ASCF = `
14814
14889
  ### ASCF Phase
14815
- - Use the \`atomic-ascf-convert\` and \`harmonyos-ascf-knowledge\` skill to description converts WeChat mini-program projects to HarmonyOS Atomic Service
14890
+ - HM_ASCF is the default active environment. Treat all requests as ASCF-context tasks unless the user explicitly asks to switch domain.
14891
+ - Skill routing is mandatory and must be explicit before execution. Never handle ASCF tasks without selecting one of the ASCF skills first.
14892
+ - Use \`harmonyos-atomic-ascf-convert\` for mini-program to HarmonyOS Atomic Service conversion (migration, API mapping, directory and component adaptation, conversion implementation).
14893
+ - Use \`harmonyos-ascf-knowledge\` for ASCF development guidance, technical Q&A, issue localization, and troubleshooting in existing ASCF projects.
14894
+ - For mixed requests, execute in two stages: (1) conversion via \`harmonyos-atomic-ascf-convert\`, then (2) engineering verification and issue diagnosis via \`harmonyos-ascf-knowledge\`.
14895
+ - If the request is "how to", "why it fails", "where the issue is", or "how to fix", always prioritize \`harmonyos-ascf-knowledge\`.
14896
+ - If a selected skill returns insufficient context, immediately continue with the other ASCF skill as fallback, then merge results into a single ASCF-oriented answer.
14816
14897
  `;
14817
14898
  var HM_ONE2MANY = `
14818
14899
  ### One-to-Many Adaptation Phase
@@ -15018,7 +15099,8 @@ function createHmAgent() {
15018
15099
  permission: {
15019
15100
  "task": {
15020
15101
  "explore": "deny"
15021
- }
15102
+ },
15103
+ "skillSearch": "deny"
15022
15104
  },
15023
15105
  metadata: void 0
15024
15106
  };
@@ -15043,7 +15125,8 @@ function createDesignAgent() {
15043
15125
  "skill": {
15044
15126
  "*": "deny",
15045
15127
  "harmonyos-prd-design": "allow"
15046
- }
15128
+ },
15129
+ "skillSearch": "deny"
15047
15130
  },
15048
15131
  metadata: void 0
15049
15132
  };
@@ -15074,7 +15157,8 @@ function createHmDevelopmentAgent() {
15074
15157
  permission: {
15075
15158
  "task": {
15076
15159
  "explore": "deny"
15077
- }
15160
+ },
15161
+ "skillSearch": "allow"
15078
15162
  },
15079
15163
  metadata: void 0
15080
15164
  };
@@ -15110,7 +15194,7 @@ function createHmExploreSubAgent() {
15110
15194
  // src/agents/ascf-agent.ts
15111
15195
  function getHmAscfDescription() {
15112
15196
  return `
15113
- HarmonyOS Ascf
15197
+ HarmonyOS ASCF assistant for mini-program conversion, ASCF development Q&A, and issue troubleshooting
15114
15198
  `;
15115
15199
  }
15116
15200
  function createAscfAgent() {
@@ -15121,7 +15205,18 @@ function createAscfAgent() {
15121
15205
  mode: "primary",
15122
15206
  prompt: buildHmAgentPrompt("ascf"),
15123
15207
  temperature: 0.6,
15124
- permission: {},
15208
+ permission: {
15209
+ "skill": {
15210
+ "*": "deny",
15211
+ "harmonyos-atomic-ascf-convert": "allow",
15212
+ "harmonyos-ascf-knowledge": "allow",
15213
+ "huawei-payment-integration-release": "allow",
15214
+ "harmonyos-atomic-service-filing": "allow",
15215
+ "harmony-emulator-debugging": "allow",
15216
+ "harmonyos-atomic-ascf-release": "allow"
15217
+ },
15218
+ "skillSearch": "deny"
15219
+ },
15125
15220
  metadata: void 0
15126
15221
  };
15127
15222
  return agent;
@@ -15141,7 +15236,9 @@ function createOne2ManyAgent() {
15141
15236
  mode: "primary",
15142
15237
  prompt: buildHmAgentPrompt("one2many"),
15143
15238
  temperature: 0.3,
15144
- permission: {},
15239
+ permission: {
15240
+ "skillSearch": "deny"
15241
+ },
15145
15242
  metadata: void 0
15146
15243
  };
15147
15244
  return agent;
@@ -15181,13 +15278,13 @@ var AgentRegistry = class {
15181
15278
  return this.agents.delete(id);
15182
15279
  }
15183
15280
  toAgentConfig(agent) {
15184
- const config4 = {};
15185
- if (agent.description) config4.description = agent.description;
15186
- if (agent.mode) config4.mode = agent.mode;
15187
- if (agent.prompt) config4.prompt = agent.prompt;
15188
- if (agent.temperature !== void 0) config4.temperature = agent.temperature;
15189
- if (agent.permission) config4.permission = agent.permission;
15190
- return config4;
15281
+ const config3 = {};
15282
+ if (agent.description) config3.description = agent.description;
15283
+ if (agent.mode) config3.mode = agent.mode;
15284
+ if (agent.prompt) config3.prompt = agent.prompt;
15285
+ if (agent.temperature !== void 0) config3.temperature = agent.temperature;
15286
+ if (agent.permission) config3.permission = agent.permission;
15287
+ return config3;
15191
15288
  }
15192
15289
  record() {
15193
15290
  const record3 = {};
@@ -15288,7 +15385,57 @@ var AgentManager = class {
15288
15385
  }
15289
15386
  };
15290
15387
 
15388
+ // src/shared/ets-counter.ts
15389
+ import { readdir, readFile as readFile2, stat } from "fs/promises";
15390
+ import { join as join2, extname } from "path";
15391
+ var SKIP_DIRS = /* @__PURE__ */ new Set([
15392
+ "node_modules",
15393
+ ".preview",
15394
+ "build",
15395
+ ".cxx",
15396
+ ".gradle",
15397
+ "oh_modules",
15398
+ ".hvigor",
15399
+ "entry/build"
15400
+ ]);
15401
+ async function collectEtsFiles(dir, results) {
15402
+ let entries;
15403
+ try {
15404
+ entries = await readdir(dir, { withFileTypes: true });
15405
+ } catch {
15406
+ return;
15407
+ }
15408
+ for (const entry of entries) {
15409
+ if (entry.isDirectory()) {
15410
+ if (SKIP_DIRS.has(entry.name)) continue;
15411
+ if (entry.name.startsWith(".") && entry.name !== ".ets") continue;
15412
+ await collectEtsFiles(join2(dir, entry.name), results);
15413
+ } else if (extname(entry.name) === ".ets") {
15414
+ const filePath = join2(dir, entry.name);
15415
+ try {
15416
+ const content = await readFile2(filePath, "utf-8");
15417
+ const lines = content.split("\n").length;
15418
+ results.push({ path: filePath, lines });
15419
+ } catch {
15420
+ log("Failed to read .ets file", { path: filePath });
15421
+ }
15422
+ }
15423
+ }
15424
+ }
15425
+ async function countEtsLines(projectDir) {
15426
+ const files = [];
15427
+ await collectEtsFiles(projectDir, files);
15428
+ const totalLines = files.reduce((sum, f) => sum + f.lines, 0);
15429
+ return {
15430
+ fileCount: files.length,
15431
+ totalLines,
15432
+ files,
15433
+ timestamp: Date.now()
15434
+ };
15435
+ }
15436
+
15291
15437
  // src/managers/config-handler.ts
15438
+ var EXPLORE_ETS_THRESHOLD = 2e3;
15292
15439
  function mergePermission(target, source) {
15293
15440
  if (!target) return source;
15294
15441
  const result = { ...target };
@@ -15303,43 +15450,59 @@ function mergePermission(target, source) {
15303
15450
  }
15304
15451
  return result;
15305
15452
  }
15306
- function createConfigHandler(_pluginConfig, agent) {
15307
- return async (config4) => {
15453
+ function createConfigHandler(_pluginConfig, agent, projectDir) {
15454
+ return async (config3) => {
15455
+ let exploreEnabled = true;
15456
+ try {
15457
+ const stats = await countEtsLines(projectDir);
15458
+ exploreEnabled = stats.totalLines >= EXPLORE_ETS_THRESHOLD;
15459
+ log("ETS count for explore agent", {
15460
+ totalLines: stats.totalLines,
15461
+ fileCount: stats.fileCount,
15462
+ enabled: exploreEnabled
15463
+ });
15464
+ } catch (err) {
15465
+ log("Failed to count ETS lines, enabling explore by default", { error: String(err) });
15466
+ }
15308
15467
  const pluginAgents = agent.record();
15309
- if (config4.agent) {
15468
+ if (config3.agent) {
15310
15469
  for (const [id, pluginAgentConfig] of Object.entries(pluginAgents)) {
15311
- if (config4.agent[id]) {
15312
- const merged = { ...config4.agent[id], ...pluginAgentConfig };
15313
- if (config4.agent[id].permission && pluginAgentConfig.permission) {
15470
+ if (id === "harmonyos-explore" && !exploreEnabled) {
15471
+ log("Skipping harmonyos-explore agent (insufficient .ets files)");
15472
+ continue;
15473
+ }
15474
+ if (config3.agent[id]) {
15475
+ const merged = { ...config3.agent[id], ...pluginAgentConfig };
15476
+ if (config3.agent[id].permission && pluginAgentConfig.permission) {
15314
15477
  merged.permission = mergePermission(
15315
- config4.agent[id].permission,
15478
+ config3.agent[id].permission,
15316
15479
  pluginAgentConfig.permission
15317
15480
  );
15318
15481
  }
15319
- config4.agent[id] = merged;
15482
+ config3.agent[id] = merged;
15320
15483
  } else {
15321
- config4.agent[id] = pluginAgentConfig;
15484
+ config3.agent[id] = pluginAgentConfig;
15322
15485
  }
15323
15486
  }
15324
- config4.default_agent = "harmonyos-plugin";
15487
+ config3.default_agent = "harmonyos-plugin";
15325
15488
  }
15326
- config4.command = config4.command || {};
15327
- config4.command["harmony-development-env-check"] = {
15489
+ config3.command = config3.command || {};
15490
+ config3.command["harmony-development-env-check"] = {
15328
15491
  template: "/harmony-development-env-check",
15329
15492
  description: "\u68C0\u67E5 HarmonyOS \u5F00\u53D1\u73AF\u5883\u914D\u7F6E\uFF08Node.js\u3001JDK\u3001ohpm\u3001hvigor\u3001DevEco SDK\uFF09"
15330
15493
  };
15331
- log("Config merged", config4.agent);
15494
+ log("Config merged", config3.agent);
15332
15495
  };
15333
15496
  }
15334
15497
 
15335
15498
  // src/create-managers.ts
15336
15499
  function createManagers(args) {
15337
- const { ctx, config: config4, agentRegistry } = args;
15500
+ const { ctx, config: config3, agentRegistry } = args;
15338
15501
  log("Creating managers");
15339
15502
  const session = new SessionManager();
15340
15503
  const agent = new AgentManager(agentRegistry, ctx);
15341
- const configHandler = createConfigHandler(config4, agent);
15342
- return { config: configHandler };
15504
+ const configHandler = createConfigHandler(config3, agent, ctx.directory);
15505
+ return { config: configHandler, session };
15343
15506
  }
15344
15507
 
15345
15508
  // src/shared/disabled-tools.ts
@@ -15486,7 +15649,7 @@ __export(external_exports2, {
15486
15649
  clone: () => clone2,
15487
15650
  codec: () => codec2,
15488
15651
  coerce: () => coerce_exports2,
15489
- config: () => config3,
15652
+ config: () => config2,
15490
15653
  core: () => core_exports4,
15491
15654
  cuid: () => cuid5,
15492
15655
  cuid2: () => cuid24,
@@ -15852,7 +16015,7 @@ __export(core_exports4, {
15852
16015
  _void: () => _void3,
15853
16016
  _xid: () => _xid2,
15854
16017
  clone: () => clone2,
15855
- config: () => config3,
16018
+ config: () => config2,
15856
16019
  decode: () => decode3,
15857
16020
  decodeAsync: () => decodeAsync3,
15858
16021
  encode: () => encode3,
@@ -15943,7 +16106,7 @@ var $ZodEncodeError2 = class extends Error {
15943
16106
  }
15944
16107
  };
15945
16108
  var globalConfig2 = {};
15946
- function config3(newConfig) {
16109
+ function config2(newConfig) {
15947
16110
  if (newConfig)
15948
16111
  Object.assign(globalConfig2, newConfig);
15949
16112
  return globalConfig2;
@@ -16149,8 +16312,8 @@ function esc2(str) {
16149
16312
  }
16150
16313
  var captureStackTrace2 = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
16151
16314
  };
16152
- function isObject2(data2) {
16153
- return typeof data2 === "object" && data2 !== null && !Array.isArray(data2);
16315
+ function isObject2(data) {
16316
+ return typeof data === "object" && data !== null && !Array.isArray(data);
16154
16317
  }
16155
16318
  var allowsEval2 = cached2(() => {
16156
16319
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
@@ -16185,24 +16348,24 @@ function shallowClone2(o) {
16185
16348
  return [...o];
16186
16349
  return o;
16187
16350
  }
16188
- function numKeys2(data2) {
16351
+ function numKeys2(data) {
16189
16352
  let keyCount = 0;
16190
- for (const key in data2) {
16191
- if (Object.prototype.hasOwnProperty.call(data2, key)) {
16353
+ for (const key in data) {
16354
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
16192
16355
  keyCount++;
16193
16356
  }
16194
16357
  }
16195
16358
  return keyCount;
16196
16359
  }
16197
- var getParsedType2 = (data2) => {
16198
- const t = typeof data2;
16360
+ var getParsedType2 = (data) => {
16361
+ const t = typeof data;
16199
16362
  switch (t) {
16200
16363
  case "undefined":
16201
16364
  return "undefined";
16202
16365
  case "string":
16203
16366
  return "string";
16204
16367
  case "number":
16205
- return Number.isNaN(data2) ? "nan" : "number";
16368
+ return Number.isNaN(data) ? "nan" : "number";
16206
16369
  case "boolean":
16207
16370
  return "boolean";
16208
16371
  case "function":
@@ -16212,25 +16375,25 @@ var getParsedType2 = (data2) => {
16212
16375
  case "symbol":
16213
16376
  return "symbol";
16214
16377
  case "object":
16215
- if (Array.isArray(data2)) {
16378
+ if (Array.isArray(data)) {
16216
16379
  return "array";
16217
16380
  }
16218
- if (data2 === null) {
16381
+ if (data === null) {
16219
16382
  return "null";
16220
16383
  }
16221
- if (data2.then && typeof data2.then === "function" && data2.catch && typeof data2.catch === "function") {
16384
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
16222
16385
  return "promise";
16223
16386
  }
16224
- if (typeof Map !== "undefined" && data2 instanceof Map) {
16387
+ if (typeof Map !== "undefined" && data instanceof Map) {
16225
16388
  return "map";
16226
16389
  }
16227
- if (typeof Set !== "undefined" && data2 instanceof Set) {
16390
+ if (typeof Set !== "undefined" && data instanceof Set) {
16228
16391
  return "set";
16229
16392
  }
16230
- if (typeof Date !== "undefined" && data2 instanceof Date) {
16393
+ if (typeof Date !== "undefined" && data instanceof Date) {
16231
16394
  return "date";
16232
16395
  }
16233
- if (typeof File !== "undefined" && data2 instanceof File) {
16396
+ if (typeof File !== "undefined" && data instanceof File) {
16234
16397
  return "file";
16235
16398
  }
16236
16399
  return "object";
@@ -16495,10 +16658,10 @@ function prefixIssues2(path7, issues) {
16495
16658
  function unwrapMessage2(message) {
16496
16659
  return typeof message === "string" ? message : message?.message;
16497
16660
  }
16498
- function finalizeIssue2(iss, ctx, config4) {
16661
+ function finalizeIssue2(iss, ctx, config3) {
16499
16662
  const full = { ...iss, path: iss.path ?? [] };
16500
16663
  if (!iss.message) {
16501
- const message = unwrapMessage2(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage2(ctx?.error?.(iss)) ?? unwrapMessage2(config4.customError?.(iss)) ?? unwrapMessage2(config4.localeError?.(iss)) ?? "Invalid input";
16664
+ const message = unwrapMessage2(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage2(ctx?.error?.(iss)) ?? unwrapMessage2(config3.customError?.(iss)) ?? unwrapMessage2(config3.localeError?.(iss)) ?? "Invalid input";
16502
16665
  full.message = message;
16503
16666
  }
16504
16667
  delete full.inst;
@@ -16733,7 +16896,7 @@ var _parse2 = (_Err) => (schema, value, _ctx, _params) => {
16733
16896
  throw new $ZodAsyncError2();
16734
16897
  }
16735
16898
  if (result.issues.length) {
16736
- const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())));
16899
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())));
16737
16900
  captureStackTrace2(e, _params?.callee);
16738
16901
  throw e;
16739
16902
  }
@@ -16746,7 +16909,7 @@ var _parseAsync2 = (_Err) => async (schema, value, _ctx, params) => {
16746
16909
  if (result instanceof Promise)
16747
16910
  result = await result;
16748
16911
  if (result.issues.length) {
16749
- const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())));
16912
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())));
16750
16913
  captureStackTrace2(e, params?.callee);
16751
16914
  throw e;
16752
16915
  }
@@ -16761,7 +16924,7 @@ var _safeParse2 = (_Err) => (schema, value, _ctx) => {
16761
16924
  }
16762
16925
  return result.issues.length ? {
16763
16926
  success: false,
16764
- error: new (_Err ?? $ZodError2)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())))
16927
+ error: new (_Err ?? $ZodError2)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
16765
16928
  } : { success: true, data: result.value };
16766
16929
  };
16767
16930
  var safeParse3 = /* @__PURE__ */ _safeParse2($ZodRealError2);
@@ -16772,7 +16935,7 @@ var _safeParseAsync2 = (_Err) => async (schema, value, _ctx) => {
16772
16935
  result = await result;
16773
16936
  return result.issues.length ? {
16774
16937
  success: false,
16775
- error: new _Err(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())))
16938
+ error: new _Err(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
16776
16939
  } : { success: true, data: result.value };
16777
16940
  };
16778
16941
  var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync2($ZodRealError2);
@@ -17868,13 +18031,13 @@ var $ZodCIDRv62 = /* @__PURE__ */ $constructor2("$ZodCIDRv6", (inst, def) => {
17868
18031
  }
17869
18032
  };
17870
18033
  });
17871
- function isValidBase642(data2) {
17872
- if (data2 === "")
18034
+ function isValidBase642(data) {
18035
+ if (data === "")
17873
18036
  return true;
17874
- if (data2.length % 4 !== 0)
18037
+ if (data.length % 4 !== 0)
17875
18038
  return false;
17876
18039
  try {
17877
- atob(data2);
18040
+ atob(data);
17878
18041
  return true;
17879
18042
  } catch {
17880
18043
  return false;
@@ -17898,10 +18061,10 @@ var $ZodBase642 = /* @__PURE__ */ $constructor2("$ZodBase64", (inst, def) => {
17898
18061
  });
17899
18062
  };
17900
18063
  });
17901
- function isValidBase64URL2(data2) {
17902
- if (!base64url3.test(data2))
18064
+ function isValidBase64URL2(data) {
18065
+ if (!base64url3.test(data))
17903
18066
  return false;
17904
- const base645 = data2.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
18067
+ const base645 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
17905
18068
  const padded = base645.padEnd(Math.ceil(base645.length / 4) * 4, "=");
17906
18069
  return isValidBase642(padded);
17907
18070
  }
@@ -18399,7 +18562,7 @@ function handleUnionResults2(results, final, inst, ctx) {
18399
18562
  code: "invalid_union",
18400
18563
  input: final.value,
18401
18564
  inst,
18402
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())))
18565
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
18403
18566
  });
18404
18567
  return final;
18405
18568
  }
@@ -18725,7 +18888,7 @@ var $ZodRecord2 = /* @__PURE__ */ $constructor2("$ZodRecord", (inst, def) => {
18725
18888
  payload.issues.push({
18726
18889
  code: "invalid_key",
18727
18890
  origin: "record",
18728
- issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config3())),
18891
+ issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2())),
18729
18892
  input: key,
18730
18893
  path: [key],
18731
18894
  inst
@@ -18796,7 +18959,7 @@ function handleMapResult2(keyResult, valueResult, final, key, input, inst, ctx)
18796
18959
  origin: "map",
18797
18960
  input,
18798
18961
  inst,
18799
- issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
18962
+ issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
18800
18963
  });
18801
18964
  }
18802
18965
  }
@@ -18810,7 +18973,7 @@ function handleMapResult2(keyResult, valueResult, final, key, input, inst, ctx)
18810
18973
  input,
18811
18974
  inst,
18812
18975
  key,
18813
- issues: valueResult.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
18976
+ issues: valueResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
18814
18977
  });
18815
18978
  }
18816
18979
  }
@@ -19071,7 +19234,7 @@ var $ZodCatch2 = /* @__PURE__ */ $constructor2("$ZodCatch", (inst, def) => {
19071
19234
  payload.value = def.catchValue({
19072
19235
  ...payload,
19073
19236
  error: {
19074
- issues: result2.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
19237
+ issues: result2.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
19075
19238
  },
19076
19239
  input: payload.value
19077
19240
  });
@@ -19085,7 +19248,7 @@ var $ZodCatch2 = /* @__PURE__ */ $constructor2("$ZodCatch", (inst, def) => {
19085
19248
  payload.value = def.catchValue({
19086
19249
  ...payload,
19087
19250
  error: {
19088
- issues: result.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
19251
+ issues: result.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
19089
19252
  },
19090
19253
  input: payload.value
19091
19254
  });
@@ -19444,21 +19607,21 @@ var error48 = () => {
19444
19607
  function getSizing(origin) {
19445
19608
  return Sizable[origin] ?? null;
19446
19609
  }
19447
- const parsedType8 = (data2) => {
19448
- const t = typeof data2;
19610
+ const parsedType8 = (data) => {
19611
+ const t = typeof data;
19449
19612
  switch (t) {
19450
19613
  case "number": {
19451
- return Number.isNaN(data2) ? "NaN" : "number";
19614
+ return Number.isNaN(data) ? "NaN" : "number";
19452
19615
  }
19453
19616
  case "object": {
19454
- if (Array.isArray(data2)) {
19617
+ if (Array.isArray(data)) {
19455
19618
  return "array";
19456
19619
  }
19457
- if (data2 === null) {
19620
+ if (data === null) {
19458
19621
  return "null";
19459
19622
  }
19460
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19461
- return data2.constructor.name;
19623
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
19624
+ return data.constructor.name;
19462
19625
  }
19463
19626
  }
19464
19627
  }
@@ -19561,21 +19724,21 @@ var error49 = () => {
19561
19724
  function getSizing(origin) {
19562
19725
  return Sizable[origin] ?? null;
19563
19726
  }
19564
- const parsedType8 = (data2) => {
19565
- const t = typeof data2;
19727
+ const parsedType8 = (data) => {
19728
+ const t = typeof data;
19566
19729
  switch (t) {
19567
19730
  case "number": {
19568
- return Number.isNaN(data2) ? "NaN" : "number";
19731
+ return Number.isNaN(data) ? "NaN" : "number";
19569
19732
  }
19570
19733
  case "object": {
19571
- if (Array.isArray(data2)) {
19734
+ if (Array.isArray(data)) {
19572
19735
  return "array";
19573
19736
  }
19574
- if (data2 === null) {
19737
+ if (data === null) {
19575
19738
  return "null";
19576
19739
  }
19577
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19578
- return data2.constructor.name;
19740
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
19741
+ return data.constructor.name;
19579
19742
  }
19580
19743
  }
19581
19744
  }
@@ -19720,21 +19883,21 @@ var error50 = () => {
19720
19883
  function getSizing(origin) {
19721
19884
  return Sizable[origin] ?? null;
19722
19885
  }
19723
- const parsedType8 = (data2) => {
19724
- const t = typeof data2;
19886
+ const parsedType8 = (data) => {
19887
+ const t = typeof data;
19725
19888
  switch (t) {
19726
19889
  case "number": {
19727
- return Number.isNaN(data2) ? "NaN" : "\u043B\u0456\u043A";
19890
+ return Number.isNaN(data) ? "NaN" : "\u043B\u0456\u043A";
19728
19891
  }
19729
19892
  case "object": {
19730
- if (Array.isArray(data2)) {
19893
+ if (Array.isArray(data)) {
19731
19894
  return "\u043C\u0430\u0441\u0456\u045E";
19732
19895
  }
19733
- if (data2 === null) {
19896
+ if (data === null) {
19734
19897
  return "null";
19735
19898
  }
19736
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19737
- return data2.constructor.name;
19899
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
19900
+ return data.constructor.name;
19738
19901
  }
19739
19902
  }
19740
19903
  }
@@ -19842,21 +20005,21 @@ var error51 = () => {
19842
20005
  function getSizing(origin) {
19843
20006
  return Sizable[origin] ?? null;
19844
20007
  }
19845
- const parsedType8 = (data2) => {
19846
- const t = typeof data2;
20008
+ const parsedType8 = (data) => {
20009
+ const t = typeof data;
19847
20010
  switch (t) {
19848
20011
  case "number": {
19849
- return Number.isNaN(data2) ? "NaN" : "number";
20012
+ return Number.isNaN(data) ? "NaN" : "number";
19850
20013
  }
19851
20014
  case "object": {
19852
- if (Array.isArray(data2)) {
20015
+ if (Array.isArray(data)) {
19853
20016
  return "array";
19854
20017
  }
19855
- if (data2 === null) {
20018
+ if (data === null) {
19856
20019
  return "null";
19857
20020
  }
19858
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19859
- return data2.constructor.name;
20021
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20022
+ return data.constructor.name;
19860
20023
  }
19861
20024
  }
19862
20025
  }
@@ -19962,11 +20125,11 @@ var error52 = () => {
19962
20125
  function getSizing(origin) {
19963
20126
  return Sizable[origin] ?? null;
19964
20127
  }
19965
- const parsedType8 = (data2) => {
19966
- const t = typeof data2;
20128
+ const parsedType8 = (data) => {
20129
+ const t = typeof data;
19967
20130
  switch (t) {
19968
20131
  case "number": {
19969
- return Number.isNaN(data2) ? "NaN" : "\u010D\xEDslo";
20132
+ return Number.isNaN(data) ? "NaN" : "\u010D\xEDslo";
19970
20133
  }
19971
20134
  case "string": {
19972
20135
  return "\u0159et\u011Bzec";
@@ -19987,14 +20150,14 @@ var error52 = () => {
19987
20150
  return "undefined";
19988
20151
  }
19989
20152
  case "object": {
19990
- if (Array.isArray(data2)) {
20153
+ if (Array.isArray(data)) {
19991
20154
  return "pole";
19992
20155
  }
19993
- if (data2 === null) {
20156
+ if (data === null) {
19994
20157
  return "null";
19995
20158
  }
19996
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19997
- return data2.constructor.name;
20159
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20160
+ return data.constructor.name;
19998
20161
  }
19999
20162
  }
20000
20163
  }
@@ -20110,21 +20273,21 @@ var error53 = () => {
20110
20273
  function getTypeName(type) {
20111
20274
  return TypeNames[type] ?? type;
20112
20275
  }
20113
- const parsedType8 = (data2) => {
20114
- const t = typeof data2;
20276
+ const parsedType8 = (data) => {
20277
+ const t = typeof data;
20115
20278
  switch (t) {
20116
20279
  case "number": {
20117
- return Number.isNaN(data2) ? "NaN" : "tal";
20280
+ return Number.isNaN(data) ? "NaN" : "tal";
20118
20281
  }
20119
20282
  case "object": {
20120
- if (Array.isArray(data2)) {
20283
+ if (Array.isArray(data)) {
20121
20284
  return "liste";
20122
20285
  }
20123
- if (data2 === null) {
20286
+ if (data === null) {
20124
20287
  return "null";
20125
20288
  }
20126
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20127
- return data2.constructor.name;
20289
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20290
+ return data.constructor.name;
20128
20291
  }
20129
20292
  return "objekt";
20130
20293
  }
@@ -20230,21 +20393,21 @@ var error54 = () => {
20230
20393
  function getSizing(origin) {
20231
20394
  return Sizable[origin] ?? null;
20232
20395
  }
20233
- const parsedType8 = (data2) => {
20234
- const t = typeof data2;
20396
+ const parsedType8 = (data) => {
20397
+ const t = typeof data;
20235
20398
  switch (t) {
20236
20399
  case "number": {
20237
- return Number.isNaN(data2) ? "NaN" : "Zahl";
20400
+ return Number.isNaN(data) ? "NaN" : "Zahl";
20238
20401
  }
20239
20402
  case "object": {
20240
- if (Array.isArray(data2)) {
20403
+ if (Array.isArray(data)) {
20241
20404
  return "Array";
20242
20405
  }
20243
- if (data2 === null) {
20406
+ if (data === null) {
20244
20407
  return "null";
20245
20408
  }
20246
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20247
- return data2.constructor.name;
20409
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20410
+ return data.constructor.name;
20248
20411
  }
20249
20412
  }
20250
20413
  }
@@ -20337,21 +20500,21 @@ function de_default2() {
20337
20500
  }
20338
20501
 
20339
20502
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/en.js
20340
- var parsedType2 = (data2) => {
20341
- const t = typeof data2;
20503
+ var parsedType2 = (data) => {
20504
+ const t = typeof data;
20342
20505
  switch (t) {
20343
20506
  case "number": {
20344
- return Number.isNaN(data2) ? "NaN" : "number";
20507
+ return Number.isNaN(data) ? "NaN" : "number";
20345
20508
  }
20346
20509
  case "object": {
20347
- if (Array.isArray(data2)) {
20510
+ if (Array.isArray(data)) {
20348
20511
  return "array";
20349
20512
  }
20350
- if (data2 === null) {
20513
+ if (data === null) {
20351
20514
  return "null";
20352
20515
  }
20353
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20354
- return data2.constructor.name;
20516
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20517
+ return data.constructor.name;
20355
20518
  }
20356
20519
  }
20357
20520
  }
@@ -20455,21 +20618,21 @@ function en_default2() {
20455
20618
  }
20456
20619
 
20457
20620
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/eo.js
20458
- var parsedType3 = (data2) => {
20459
- const t = typeof data2;
20621
+ var parsedType3 = (data) => {
20622
+ const t = typeof data;
20460
20623
  switch (t) {
20461
20624
  case "number": {
20462
- return Number.isNaN(data2) ? "NaN" : "nombro";
20625
+ return Number.isNaN(data) ? "NaN" : "nombro";
20463
20626
  }
20464
20627
  case "object": {
20465
- if (Array.isArray(data2)) {
20628
+ if (Array.isArray(data)) {
20466
20629
  return "tabelo";
20467
20630
  }
20468
- if (data2 === null) {
20631
+ if (data === null) {
20469
20632
  return "senvalora";
20470
20633
  }
20471
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20472
- return data2.constructor.name;
20634
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20635
+ return data.constructor.name;
20473
20636
  }
20474
20637
  }
20475
20638
  }
@@ -20611,21 +20774,21 @@ var error57 = () => {
20611
20774
  function getTypeName(type) {
20612
20775
  return TypeNames[type] ?? type;
20613
20776
  }
20614
- const parsedType8 = (data2) => {
20615
- const t = typeof data2;
20777
+ const parsedType8 = (data) => {
20778
+ const t = typeof data;
20616
20779
  switch (t) {
20617
20780
  case "number": {
20618
- return Number.isNaN(data2) ? "NaN" : "number";
20781
+ return Number.isNaN(data) ? "NaN" : "number";
20619
20782
  }
20620
20783
  case "object": {
20621
- if (Array.isArray(data2)) {
20784
+ if (Array.isArray(data)) {
20622
20785
  return "array";
20623
20786
  }
20624
- if (data2 === null) {
20787
+ if (data === null) {
20625
20788
  return "null";
20626
20789
  }
20627
- if (Object.getPrototypeOf(data2) !== Object.prototype) {
20628
- return data2.constructor.name;
20790
+ if (Object.getPrototypeOf(data) !== Object.prototype) {
20791
+ return data.constructor.name;
20629
20792
  }
20630
20793
  return "object";
20631
20794
  }
@@ -20732,21 +20895,21 @@ var error58 = () => {
20732
20895
  function getSizing(origin) {
20733
20896
  return Sizable[origin] ?? null;
20734
20897
  }
20735
- const parsedType8 = (data2) => {
20736
- const t = typeof data2;
20898
+ const parsedType8 = (data) => {
20899
+ const t = typeof data;
20737
20900
  switch (t) {
20738
20901
  case "number": {
20739
- return Number.isNaN(data2) ? "NaN" : "\u0639\u062F\u062F";
20902
+ return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
20740
20903
  }
20741
20904
  case "object": {
20742
- if (Array.isArray(data2)) {
20905
+ if (Array.isArray(data)) {
20743
20906
  return "\u0622\u0631\u0627\u06CC\u0647";
20744
20907
  }
20745
- if (data2 === null) {
20908
+ if (data === null) {
20746
20909
  return "null";
20747
20910
  }
20748
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20749
- return data2.constructor.name;
20911
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20912
+ return data.constructor.name;
20750
20913
  }
20751
20914
  }
20752
20915
  }
@@ -20859,21 +21022,21 @@ var error59 = () => {
20859
21022
  function getSizing(origin) {
20860
21023
  return Sizable[origin] ?? null;
20861
21024
  }
20862
- const parsedType8 = (data2) => {
20863
- const t = typeof data2;
21025
+ const parsedType8 = (data) => {
21026
+ const t = typeof data;
20864
21027
  switch (t) {
20865
21028
  case "number": {
20866
- return Number.isNaN(data2) ? "NaN" : "number";
21029
+ return Number.isNaN(data) ? "NaN" : "number";
20867
21030
  }
20868
21031
  case "object": {
20869
- if (Array.isArray(data2)) {
21032
+ if (Array.isArray(data)) {
20870
21033
  return "array";
20871
21034
  }
20872
- if (data2 === null) {
21035
+ if (data === null) {
20873
21036
  return "null";
20874
21037
  }
20875
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20876
- return data2.constructor.name;
21038
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21039
+ return data.constructor.name;
20877
21040
  }
20878
21041
  }
20879
21042
  }
@@ -20978,21 +21141,21 @@ var error60 = () => {
20978
21141
  function getSizing(origin) {
20979
21142
  return Sizable[origin] ?? null;
20980
21143
  }
20981
- const parsedType8 = (data2) => {
20982
- const t = typeof data2;
21144
+ const parsedType8 = (data) => {
21145
+ const t = typeof data;
20983
21146
  switch (t) {
20984
21147
  case "number": {
20985
- return Number.isNaN(data2) ? "NaN" : "nombre";
21148
+ return Number.isNaN(data) ? "NaN" : "nombre";
20986
21149
  }
20987
21150
  case "object": {
20988
- if (Array.isArray(data2)) {
21151
+ if (Array.isArray(data)) {
20989
21152
  return "tableau";
20990
21153
  }
20991
- if (data2 === null) {
21154
+ if (data === null) {
20992
21155
  return "null";
20993
21156
  }
20994
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20995
- return data2.constructor.name;
21157
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21158
+ return data.constructor.name;
20996
21159
  }
20997
21160
  }
20998
21161
  }
@@ -21095,21 +21258,21 @@ var error61 = () => {
21095
21258
  function getSizing(origin) {
21096
21259
  return Sizable[origin] ?? null;
21097
21260
  }
21098
- const parsedType8 = (data2) => {
21099
- const t = typeof data2;
21261
+ const parsedType8 = (data) => {
21262
+ const t = typeof data;
21100
21263
  switch (t) {
21101
21264
  case "number": {
21102
- return Number.isNaN(data2) ? "NaN" : "number";
21265
+ return Number.isNaN(data) ? "NaN" : "number";
21103
21266
  }
21104
21267
  case "object": {
21105
- if (Array.isArray(data2)) {
21268
+ if (Array.isArray(data)) {
21106
21269
  return "array";
21107
21270
  }
21108
- if (data2 === null) {
21271
+ if (data === null) {
21109
21272
  return "null";
21110
21273
  }
21111
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21112
- return data2.constructor.name;
21274
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21275
+ return data.constructor.name;
21113
21276
  }
21114
21277
  }
21115
21278
  }
@@ -21213,21 +21376,21 @@ var error62 = () => {
21213
21376
  function getSizing(origin) {
21214
21377
  return Sizable[origin] ?? null;
21215
21378
  }
21216
- const parsedType8 = (data2) => {
21217
- const t = typeof data2;
21379
+ const parsedType8 = (data) => {
21380
+ const t = typeof data;
21218
21381
  switch (t) {
21219
21382
  case "number": {
21220
- return Number.isNaN(data2) ? "NaN" : "number";
21383
+ return Number.isNaN(data) ? "NaN" : "number";
21221
21384
  }
21222
21385
  case "object": {
21223
- if (Array.isArray(data2)) {
21386
+ if (Array.isArray(data)) {
21224
21387
  return "array";
21225
21388
  }
21226
- if (data2 === null) {
21389
+ if (data === null) {
21227
21390
  return "null";
21228
21391
  }
21229
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21230
- return data2.constructor.name;
21392
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21393
+ return data.constructor.name;
21231
21394
  }
21232
21395
  }
21233
21396
  }
@@ -21331,21 +21494,21 @@ var error63 = () => {
21331
21494
  function getSizing(origin) {
21332
21495
  return Sizable[origin] ?? null;
21333
21496
  }
21334
- const parsedType8 = (data2) => {
21335
- const t = typeof data2;
21497
+ const parsedType8 = (data) => {
21498
+ const t = typeof data;
21336
21499
  switch (t) {
21337
21500
  case "number": {
21338
- return Number.isNaN(data2) ? "NaN" : "sz\xE1m";
21501
+ return Number.isNaN(data) ? "NaN" : "sz\xE1m";
21339
21502
  }
21340
21503
  case "object": {
21341
- if (Array.isArray(data2)) {
21504
+ if (Array.isArray(data)) {
21342
21505
  return "t\xF6mb";
21343
21506
  }
21344
- if (data2 === null) {
21507
+ if (data === null) {
21345
21508
  return "null";
21346
21509
  }
21347
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21348
- return data2.constructor.name;
21510
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21511
+ return data.constructor.name;
21349
21512
  }
21350
21513
  }
21351
21514
  }
@@ -21449,21 +21612,21 @@ var error64 = () => {
21449
21612
  function getSizing(origin) {
21450
21613
  return Sizable[origin] ?? null;
21451
21614
  }
21452
- const parsedType8 = (data2) => {
21453
- const t = typeof data2;
21615
+ const parsedType8 = (data) => {
21616
+ const t = typeof data;
21454
21617
  switch (t) {
21455
21618
  case "number": {
21456
- return Number.isNaN(data2) ? "NaN" : "number";
21619
+ return Number.isNaN(data) ? "NaN" : "number";
21457
21620
  }
21458
21621
  case "object": {
21459
- if (Array.isArray(data2)) {
21622
+ if (Array.isArray(data)) {
21460
21623
  return "array";
21461
21624
  }
21462
- if (data2 === null) {
21625
+ if (data === null) {
21463
21626
  return "null";
21464
21627
  }
21465
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21466
- return data2.constructor.name;
21628
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21629
+ return data.constructor.name;
21467
21630
  }
21468
21631
  }
21469
21632
  }
@@ -21556,21 +21719,21 @@ function id_default2() {
21556
21719
  }
21557
21720
 
21558
21721
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/is.js
21559
- var parsedType4 = (data2) => {
21560
- const t = typeof data2;
21722
+ var parsedType4 = (data) => {
21723
+ const t = typeof data;
21561
21724
  switch (t) {
21562
21725
  case "number": {
21563
- return Number.isNaN(data2) ? "NaN" : "n\xFAmer";
21726
+ return Number.isNaN(data) ? "NaN" : "n\xFAmer";
21564
21727
  }
21565
21728
  case "object": {
21566
- if (Array.isArray(data2)) {
21729
+ if (Array.isArray(data)) {
21567
21730
  return "fylki";
21568
21731
  }
21569
- if (data2 === null) {
21732
+ if (data === null) {
21570
21733
  return "null";
21571
21734
  }
21572
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21573
- return data2.constructor.name;
21735
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21736
+ return data.constructor.name;
21574
21737
  }
21575
21738
  }
21576
21739
  }
@@ -21684,21 +21847,21 @@ var error66 = () => {
21684
21847
  function getSizing(origin) {
21685
21848
  return Sizable[origin] ?? null;
21686
21849
  }
21687
- const parsedType8 = (data2) => {
21688
- const t = typeof data2;
21850
+ const parsedType8 = (data) => {
21851
+ const t = typeof data;
21689
21852
  switch (t) {
21690
21853
  case "number": {
21691
- return Number.isNaN(data2) ? "NaN" : "numero";
21854
+ return Number.isNaN(data) ? "NaN" : "numero";
21692
21855
  }
21693
21856
  case "object": {
21694
- if (Array.isArray(data2)) {
21857
+ if (Array.isArray(data)) {
21695
21858
  return "vettore";
21696
21859
  }
21697
- if (data2 === null) {
21860
+ if (data === null) {
21698
21861
  return "null";
21699
21862
  }
21700
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21701
- return data2.constructor.name;
21863
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21864
+ return data.constructor.name;
21702
21865
  }
21703
21866
  }
21704
21867
  }
@@ -21802,21 +21965,21 @@ var error67 = () => {
21802
21965
  function getSizing(origin) {
21803
21966
  return Sizable[origin] ?? null;
21804
21967
  }
21805
- const parsedType8 = (data2) => {
21806
- const t = typeof data2;
21968
+ const parsedType8 = (data) => {
21969
+ const t = typeof data;
21807
21970
  switch (t) {
21808
21971
  case "number": {
21809
- return Number.isNaN(data2) ? "NaN" : "\u6570\u5024";
21972
+ return Number.isNaN(data) ? "NaN" : "\u6570\u5024";
21810
21973
  }
21811
21974
  case "object": {
21812
- if (Array.isArray(data2)) {
21975
+ if (Array.isArray(data)) {
21813
21976
  return "\u914D\u5217";
21814
21977
  }
21815
- if (data2 === null) {
21978
+ if (data === null) {
21816
21979
  return "null";
21817
21980
  }
21818
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21819
- return data2.constructor.name;
21981
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21982
+ return data.constructor.name;
21820
21983
  }
21821
21984
  }
21822
21985
  }
@@ -21908,21 +22071,21 @@ function ja_default2() {
21908
22071
  }
21909
22072
 
21910
22073
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ka.js
21911
- var parsedType5 = (data2) => {
21912
- const t = typeof data2;
22074
+ var parsedType5 = (data) => {
22075
+ const t = typeof data;
21913
22076
  switch (t) {
21914
22077
  case "number": {
21915
- return Number.isNaN(data2) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";
22078
+ return Number.isNaN(data) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";
21916
22079
  }
21917
22080
  case "object": {
21918
- if (Array.isArray(data2)) {
22081
+ if (Array.isArray(data)) {
21919
22082
  return "\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";
21920
22083
  }
21921
- if (data2 === null) {
22084
+ if (data === null) {
21922
22085
  return "null";
21923
22086
  }
21924
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21925
- return data2.constructor.name;
22087
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22088
+ return data.constructor.name;
21926
22089
  }
21927
22090
  }
21928
22091
  }
@@ -22044,21 +22207,21 @@ var error69 = () => {
22044
22207
  function getSizing(origin) {
22045
22208
  return Sizable[origin] ?? null;
22046
22209
  }
22047
- const parsedType8 = (data2) => {
22048
- const t = typeof data2;
22210
+ const parsedType8 = (data) => {
22211
+ const t = typeof data;
22049
22212
  switch (t) {
22050
22213
  case "number": {
22051
- return Number.isNaN(data2) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781";
22214
+ return Number.isNaN(data) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781";
22052
22215
  }
22053
22216
  case "object": {
22054
- if (Array.isArray(data2)) {
22217
+ if (Array.isArray(data)) {
22055
22218
  return "\u17A2\u17B6\u179A\u17C1 (Array)";
22056
22219
  }
22057
- if (data2 === null) {
22220
+ if (data === null) {
22058
22221
  return "\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";
22059
22222
  }
22060
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22061
- return data2.constructor.name;
22223
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22224
+ return data.constructor.name;
22062
22225
  }
22063
22226
  }
22064
22227
  }
@@ -22167,21 +22330,21 @@ var error70 = () => {
22167
22330
  function getSizing(origin) {
22168
22331
  return Sizable[origin] ?? null;
22169
22332
  }
22170
- const parsedType8 = (data2) => {
22171
- const t = typeof data2;
22333
+ const parsedType8 = (data) => {
22334
+ const t = typeof data;
22172
22335
  switch (t) {
22173
22336
  case "number": {
22174
- return Number.isNaN(data2) ? "NaN" : "number";
22337
+ return Number.isNaN(data) ? "NaN" : "number";
22175
22338
  }
22176
22339
  case "object": {
22177
- if (Array.isArray(data2)) {
22340
+ if (Array.isArray(data)) {
22178
22341
  return "array";
22179
22342
  }
22180
- if (data2 === null) {
22343
+ if (data === null) {
22181
22344
  return "null";
22182
22345
  }
22183
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22184
- return data2.constructor.name;
22346
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22347
+ return data.constructor.name;
22185
22348
  }
22186
22349
  }
22187
22350
  }
@@ -22279,14 +22442,14 @@ function ko_default2() {
22279
22442
  }
22280
22443
 
22281
22444
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/lt.js
22282
- var parsedType6 = (data2) => {
22283
- const t = typeof data2;
22284
- return parsedTypeFromType(t, data2);
22445
+ var parsedType6 = (data) => {
22446
+ const t = typeof data;
22447
+ return parsedTypeFromType(t, data);
22285
22448
  };
22286
- var parsedTypeFromType = (t, data2 = void 0) => {
22449
+ var parsedTypeFromType = (t, data = void 0) => {
22287
22450
  switch (t) {
22288
22451
  case "number": {
22289
- return Number.isNaN(data2) ? "NaN" : "skai\u010Dius";
22452
+ return Number.isNaN(data) ? "NaN" : "skai\u010Dius";
22290
22453
  }
22291
22454
  case "bigint": {
22292
22455
  return "sveikasis skai\u010Dius";
@@ -22308,14 +22471,14 @@ var parsedTypeFromType = (t, data2 = void 0) => {
22308
22471
  return "simbolis";
22309
22472
  }
22310
22473
  case "object": {
22311
- if (data2 === void 0)
22474
+ if (data === void 0)
22312
22475
  return "ne\u017Einomas objektas";
22313
- if (data2 === null)
22476
+ if (data === null)
22314
22477
  return "nulin\u0117 reik\u0161m\u0117";
22315
- if (Array.isArray(data2))
22478
+ if (Array.isArray(data))
22316
22479
  return "masyvas";
22317
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22318
- return data2.constructor.name;
22480
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22481
+ return data.constructor.name;
22319
22482
  }
22320
22483
  return "objektas";
22321
22484
  }
@@ -22520,21 +22683,21 @@ var error72 = () => {
22520
22683
  function getSizing(origin) {
22521
22684
  return Sizable[origin] ?? null;
22522
22685
  }
22523
- const parsedType8 = (data2) => {
22524
- const t = typeof data2;
22686
+ const parsedType8 = (data) => {
22687
+ const t = typeof data;
22525
22688
  switch (t) {
22526
22689
  case "number": {
22527
- return Number.isNaN(data2) ? "NaN" : "\u0431\u0440\u043E\u0458";
22690
+ return Number.isNaN(data) ? "NaN" : "\u0431\u0440\u043E\u0458";
22528
22691
  }
22529
22692
  case "object": {
22530
- if (Array.isArray(data2)) {
22693
+ if (Array.isArray(data)) {
22531
22694
  return "\u043D\u0438\u0437\u0430";
22532
22695
  }
22533
- if (data2 === null) {
22696
+ if (data === null) {
22534
22697
  return "null";
22535
22698
  }
22536
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22537
- return data2.constructor.name;
22699
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22700
+ return data.constructor.name;
22538
22701
  }
22539
22702
  }
22540
22703
  }
@@ -22639,21 +22802,21 @@ var error73 = () => {
22639
22802
  function getSizing(origin) {
22640
22803
  return Sizable[origin] ?? null;
22641
22804
  }
22642
- const parsedType8 = (data2) => {
22643
- const t = typeof data2;
22805
+ const parsedType8 = (data) => {
22806
+ const t = typeof data;
22644
22807
  switch (t) {
22645
22808
  case "number": {
22646
- return Number.isNaN(data2) ? "NaN" : "nombor";
22809
+ return Number.isNaN(data) ? "NaN" : "nombor";
22647
22810
  }
22648
22811
  case "object": {
22649
- if (Array.isArray(data2)) {
22812
+ if (Array.isArray(data)) {
22650
22813
  return "array";
22651
22814
  }
22652
- if (data2 === null) {
22815
+ if (data === null) {
22653
22816
  return "null";
22654
22817
  }
22655
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22656
- return data2.constructor.name;
22818
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22819
+ return data.constructor.name;
22657
22820
  }
22658
22821
  }
22659
22822
  }
@@ -22756,21 +22919,21 @@ var error74 = () => {
22756
22919
  function getSizing(origin) {
22757
22920
  return Sizable[origin] ?? null;
22758
22921
  }
22759
- const parsedType8 = (data2) => {
22760
- const t = typeof data2;
22922
+ const parsedType8 = (data) => {
22923
+ const t = typeof data;
22761
22924
  switch (t) {
22762
22925
  case "number": {
22763
- return Number.isNaN(data2) ? "NaN" : "getal";
22926
+ return Number.isNaN(data) ? "NaN" : "getal";
22764
22927
  }
22765
22928
  case "object": {
22766
- if (Array.isArray(data2)) {
22929
+ if (Array.isArray(data)) {
22767
22930
  return "array";
22768
22931
  }
22769
- if (data2 === null) {
22932
+ if (data === null) {
22770
22933
  return "null";
22771
22934
  }
22772
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22773
- return data2.constructor.name;
22935
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22936
+ return data.constructor.name;
22774
22937
  }
22775
22938
  }
22776
22939
  }
@@ -22874,21 +23037,21 @@ var error75 = () => {
22874
23037
  function getSizing(origin) {
22875
23038
  return Sizable[origin] ?? null;
22876
23039
  }
22877
- const parsedType8 = (data2) => {
22878
- const t = typeof data2;
23040
+ const parsedType8 = (data) => {
23041
+ const t = typeof data;
22879
23042
  switch (t) {
22880
23043
  case "number": {
22881
- return Number.isNaN(data2) ? "NaN" : "tall";
23044
+ return Number.isNaN(data) ? "NaN" : "tall";
22882
23045
  }
22883
23046
  case "object": {
22884
- if (Array.isArray(data2)) {
23047
+ if (Array.isArray(data)) {
22885
23048
  return "liste";
22886
23049
  }
22887
- if (data2 === null) {
23050
+ if (data === null) {
22888
23051
  return "null";
22889
23052
  }
22890
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22891
- return data2.constructor.name;
23053
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23054
+ return data.constructor.name;
22892
23055
  }
22893
23056
  }
22894
23057
  }
@@ -22991,21 +23154,21 @@ var error76 = () => {
22991
23154
  function getSizing(origin) {
22992
23155
  return Sizable[origin] ?? null;
22993
23156
  }
22994
- const parsedType8 = (data2) => {
22995
- const t = typeof data2;
23157
+ const parsedType8 = (data) => {
23158
+ const t = typeof data;
22996
23159
  switch (t) {
22997
23160
  case "number": {
22998
- return Number.isNaN(data2) ? "NaN" : "numara";
23161
+ return Number.isNaN(data) ? "NaN" : "numara";
22999
23162
  }
23000
23163
  case "object": {
23001
- if (Array.isArray(data2)) {
23164
+ if (Array.isArray(data)) {
23002
23165
  return "saf";
23003
23166
  }
23004
- if (data2 === null) {
23167
+ if (data === null) {
23005
23168
  return "gayb";
23006
23169
  }
23007
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23008
- return data2.constructor.name;
23170
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23171
+ return data.constructor.name;
23009
23172
  }
23010
23173
  }
23011
23174
  }
@@ -23109,21 +23272,21 @@ var error77 = () => {
23109
23272
  function getSizing(origin) {
23110
23273
  return Sizable[origin] ?? null;
23111
23274
  }
23112
- const parsedType8 = (data2) => {
23113
- const t = typeof data2;
23275
+ const parsedType8 = (data) => {
23276
+ const t = typeof data;
23114
23277
  switch (t) {
23115
23278
  case "number": {
23116
- return Number.isNaN(data2) ? "NaN" : "\u0639\u062F\u062F";
23279
+ return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
23117
23280
  }
23118
23281
  case "object": {
23119
- if (Array.isArray(data2)) {
23282
+ if (Array.isArray(data)) {
23120
23283
  return "\u0627\u0631\u06D0";
23121
23284
  }
23122
- if (data2 === null) {
23285
+ if (data === null) {
23123
23286
  return "null";
23124
23287
  }
23125
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23126
- return data2.constructor.name;
23288
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23289
+ return data.constructor.name;
23127
23290
  }
23128
23291
  }
23129
23292
  }
@@ -23232,21 +23395,21 @@ var error78 = () => {
23232
23395
  function getSizing(origin) {
23233
23396
  return Sizable[origin] ?? null;
23234
23397
  }
23235
- const parsedType8 = (data2) => {
23236
- const t = typeof data2;
23398
+ const parsedType8 = (data) => {
23399
+ const t = typeof data;
23237
23400
  switch (t) {
23238
23401
  case "number": {
23239
- return Number.isNaN(data2) ? "NaN" : "liczba";
23402
+ return Number.isNaN(data) ? "NaN" : "liczba";
23240
23403
  }
23241
23404
  case "object": {
23242
- if (Array.isArray(data2)) {
23405
+ if (Array.isArray(data)) {
23243
23406
  return "tablica";
23244
23407
  }
23245
- if (data2 === null) {
23408
+ if (data === null) {
23246
23409
  return "null";
23247
23410
  }
23248
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23249
- return data2.constructor.name;
23411
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23412
+ return data.constructor.name;
23250
23413
  }
23251
23414
  }
23252
23415
  }
@@ -23350,21 +23513,21 @@ var error79 = () => {
23350
23513
  function getSizing(origin) {
23351
23514
  return Sizable[origin] ?? null;
23352
23515
  }
23353
- const parsedType8 = (data2) => {
23354
- const t = typeof data2;
23516
+ const parsedType8 = (data) => {
23517
+ const t = typeof data;
23355
23518
  switch (t) {
23356
23519
  case "number": {
23357
- return Number.isNaN(data2) ? "NaN" : "n\xFAmero";
23520
+ return Number.isNaN(data) ? "NaN" : "n\xFAmero";
23358
23521
  }
23359
23522
  case "object": {
23360
- if (Array.isArray(data2)) {
23523
+ if (Array.isArray(data)) {
23361
23524
  return "array";
23362
23525
  }
23363
- if (data2 === null) {
23526
+ if (data === null) {
23364
23527
  return "nulo";
23365
23528
  }
23366
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23367
- return data2.constructor.name;
23529
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23530
+ return data.constructor.name;
23368
23531
  }
23369
23532
  }
23370
23533
  }
@@ -23510,21 +23673,21 @@ var error80 = () => {
23510
23673
  function getSizing(origin) {
23511
23674
  return Sizable[origin] ?? null;
23512
23675
  }
23513
- const parsedType8 = (data2) => {
23514
- const t = typeof data2;
23676
+ const parsedType8 = (data) => {
23677
+ const t = typeof data;
23515
23678
  switch (t) {
23516
23679
  case "number": {
23517
- return Number.isNaN(data2) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
23680
+ return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
23518
23681
  }
23519
23682
  case "object": {
23520
- if (Array.isArray(data2)) {
23683
+ if (Array.isArray(data)) {
23521
23684
  return "\u043C\u0430\u0441\u0441\u0438\u0432";
23522
23685
  }
23523
- if (data2 === null) {
23686
+ if (data === null) {
23524
23687
  return "null";
23525
23688
  }
23526
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23527
- return data2.constructor.name;
23689
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23690
+ return data.constructor.name;
23528
23691
  }
23529
23692
  }
23530
23693
  }
@@ -23632,21 +23795,21 @@ var error81 = () => {
23632
23795
  function getSizing(origin) {
23633
23796
  return Sizable[origin] ?? null;
23634
23797
  }
23635
- const parsedType8 = (data2) => {
23636
- const t = typeof data2;
23798
+ const parsedType8 = (data) => {
23799
+ const t = typeof data;
23637
23800
  switch (t) {
23638
23801
  case "number": {
23639
- return Number.isNaN(data2) ? "NaN" : "\u0161tevilo";
23802
+ return Number.isNaN(data) ? "NaN" : "\u0161tevilo";
23640
23803
  }
23641
23804
  case "object": {
23642
- if (Array.isArray(data2)) {
23805
+ if (Array.isArray(data)) {
23643
23806
  return "tabela";
23644
23807
  }
23645
- if (data2 === null) {
23808
+ if (data === null) {
23646
23809
  return "null";
23647
23810
  }
23648
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23649
- return data2.constructor.name;
23811
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23812
+ return data.constructor.name;
23650
23813
  }
23651
23814
  }
23652
23815
  }
@@ -23750,21 +23913,21 @@ var error82 = () => {
23750
23913
  function getSizing(origin) {
23751
23914
  return Sizable[origin] ?? null;
23752
23915
  }
23753
- const parsedType8 = (data2) => {
23754
- const t = typeof data2;
23916
+ const parsedType8 = (data) => {
23917
+ const t = typeof data;
23755
23918
  switch (t) {
23756
23919
  case "number": {
23757
- return Number.isNaN(data2) ? "NaN" : "antal";
23920
+ return Number.isNaN(data) ? "NaN" : "antal";
23758
23921
  }
23759
23922
  case "object": {
23760
- if (Array.isArray(data2)) {
23923
+ if (Array.isArray(data)) {
23761
23924
  return "lista";
23762
23925
  }
23763
- if (data2 === null) {
23926
+ if (data === null) {
23764
23927
  return "null";
23765
23928
  }
23766
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23767
- return data2.constructor.name;
23929
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23930
+ return data.constructor.name;
23768
23931
  }
23769
23932
  }
23770
23933
  }
@@ -23869,21 +24032,21 @@ var error83 = () => {
23869
24032
  function getSizing(origin) {
23870
24033
  return Sizable[origin] ?? null;
23871
24034
  }
23872
- const parsedType8 = (data2) => {
23873
- const t = typeof data2;
24035
+ const parsedType8 = (data) => {
24036
+ const t = typeof data;
23874
24037
  switch (t) {
23875
24038
  case "number": {
23876
- return Number.isNaN(data2) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD";
24039
+ return Number.isNaN(data) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD";
23877
24040
  }
23878
24041
  case "object": {
23879
- if (Array.isArray(data2)) {
24042
+ if (Array.isArray(data)) {
23880
24043
  return "\u0B85\u0BA3\u0BBF";
23881
24044
  }
23882
- if (data2 === null) {
24045
+ if (data === null) {
23883
24046
  return "\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";
23884
24047
  }
23885
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23886
- return data2.constructor.name;
24048
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24049
+ return data.constructor.name;
23887
24050
  }
23888
24051
  }
23889
24052
  }
@@ -23987,21 +24150,21 @@ var error84 = () => {
23987
24150
  function getSizing(origin) {
23988
24151
  return Sizable[origin] ?? null;
23989
24152
  }
23990
- const parsedType8 = (data2) => {
23991
- const t = typeof data2;
24153
+ const parsedType8 = (data) => {
24154
+ const t = typeof data;
23992
24155
  switch (t) {
23993
24156
  case "number": {
23994
- return Number.isNaN(data2) ? "\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
24157
+ return Number.isNaN(data) ? "\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
23995
24158
  }
23996
24159
  case "object": {
23997
- if (Array.isArray(data2)) {
24160
+ if (Array.isArray(data)) {
23998
24161
  return "\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";
23999
24162
  }
24000
- if (data2 === null) {
24163
+ if (data === null) {
24001
24164
  return "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";
24002
24165
  }
24003
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24004
- return data2.constructor.name;
24166
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24167
+ return data.constructor.name;
24005
24168
  }
24006
24169
  }
24007
24170
  }
@@ -24095,21 +24258,21 @@ function th_default2() {
24095
24258
  }
24096
24259
 
24097
24260
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/tr.js
24098
- var parsedType7 = (data2) => {
24099
- const t = typeof data2;
24261
+ var parsedType7 = (data) => {
24262
+ const t = typeof data;
24100
24263
  switch (t) {
24101
24264
  case "number": {
24102
- return Number.isNaN(data2) ? "NaN" : "number";
24265
+ return Number.isNaN(data) ? "NaN" : "number";
24103
24266
  }
24104
24267
  case "object": {
24105
- if (Array.isArray(data2)) {
24268
+ if (Array.isArray(data)) {
24106
24269
  return "array";
24107
24270
  }
24108
- if (data2 === null) {
24271
+ if (data === null) {
24109
24272
  return "null";
24110
24273
  }
24111
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24112
- return data2.constructor.name;
24274
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24275
+ return data.constructor.name;
24113
24276
  }
24114
24277
  }
24115
24278
  }
@@ -24221,21 +24384,21 @@ var error86 = () => {
24221
24384
  function getSizing(origin) {
24222
24385
  return Sizable[origin] ?? null;
24223
24386
  }
24224
- const parsedType8 = (data2) => {
24225
- const t = typeof data2;
24387
+ const parsedType8 = (data) => {
24388
+ const t = typeof data;
24226
24389
  switch (t) {
24227
24390
  case "number": {
24228
- return Number.isNaN(data2) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
24391
+ return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
24229
24392
  }
24230
24393
  case "object": {
24231
- if (Array.isArray(data2)) {
24394
+ if (Array.isArray(data)) {
24232
24395
  return "\u043C\u0430\u0441\u0438\u0432";
24233
24396
  }
24234
- if (data2 === null) {
24397
+ if (data === null) {
24235
24398
  return "null";
24236
24399
  }
24237
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24238
- return data2.constructor.name;
24400
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24401
+ return data.constructor.name;
24239
24402
  }
24240
24403
  }
24241
24404
  }
@@ -24344,21 +24507,21 @@ var error87 = () => {
24344
24507
  function getSizing(origin) {
24345
24508
  return Sizable[origin] ?? null;
24346
24509
  }
24347
- const parsedType8 = (data2) => {
24348
- const t = typeof data2;
24510
+ const parsedType8 = (data) => {
24511
+ const t = typeof data;
24349
24512
  switch (t) {
24350
24513
  case "number": {
24351
- return Number.isNaN(data2) ? "NaN" : "\u0646\u0645\u0628\u0631";
24514
+ return Number.isNaN(data) ? "NaN" : "\u0646\u0645\u0628\u0631";
24352
24515
  }
24353
24516
  case "object": {
24354
- if (Array.isArray(data2)) {
24517
+ if (Array.isArray(data)) {
24355
24518
  return "\u0622\u0631\u06D2";
24356
24519
  }
24357
- if (data2 === null) {
24520
+ if (data === null) {
24358
24521
  return "\u0646\u0644";
24359
24522
  }
24360
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24361
- return data2.constructor.name;
24523
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24524
+ return data.constructor.name;
24362
24525
  }
24363
24526
  }
24364
24527
  }
@@ -24462,21 +24625,21 @@ var error88 = () => {
24462
24625
  function getSizing(origin) {
24463
24626
  return Sizable[origin] ?? null;
24464
24627
  }
24465
- const parsedType8 = (data2) => {
24466
- const t = typeof data2;
24628
+ const parsedType8 = (data) => {
24629
+ const t = typeof data;
24467
24630
  switch (t) {
24468
24631
  case "number": {
24469
- return Number.isNaN(data2) ? "NaN" : "s\u1ED1";
24632
+ return Number.isNaN(data) ? "NaN" : "s\u1ED1";
24470
24633
  }
24471
24634
  case "object": {
24472
- if (Array.isArray(data2)) {
24635
+ if (Array.isArray(data)) {
24473
24636
  return "m\u1EA3ng";
24474
24637
  }
24475
- if (data2 === null) {
24638
+ if (data === null) {
24476
24639
  return "null";
24477
24640
  }
24478
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24479
- return data2.constructor.name;
24641
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24642
+ return data.constructor.name;
24480
24643
  }
24481
24644
  }
24482
24645
  }
@@ -24579,21 +24742,21 @@ var error89 = () => {
24579
24742
  function getSizing(origin) {
24580
24743
  return Sizable[origin] ?? null;
24581
24744
  }
24582
- const parsedType8 = (data2) => {
24583
- const t = typeof data2;
24745
+ const parsedType8 = (data) => {
24746
+ const t = typeof data;
24584
24747
  switch (t) {
24585
24748
  case "number": {
24586
- return Number.isNaN(data2) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57";
24749
+ return Number.isNaN(data) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57";
24587
24750
  }
24588
24751
  case "object": {
24589
- if (Array.isArray(data2)) {
24752
+ if (Array.isArray(data)) {
24590
24753
  return "\u6570\u7EC4";
24591
24754
  }
24592
- if (data2 === null) {
24755
+ if (data === null) {
24593
24756
  return "\u7A7A\u503C(null)";
24594
24757
  }
24595
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24596
- return data2.constructor.name;
24758
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24759
+ return data.constructor.name;
24597
24760
  }
24598
24761
  }
24599
24762
  }
@@ -24696,21 +24859,21 @@ var error90 = () => {
24696
24859
  function getSizing(origin) {
24697
24860
  return Sizable[origin] ?? null;
24698
24861
  }
24699
- const parsedType8 = (data2) => {
24700
- const t = typeof data2;
24862
+ const parsedType8 = (data) => {
24863
+ const t = typeof data;
24701
24864
  switch (t) {
24702
24865
  case "number": {
24703
- return Number.isNaN(data2) ? "NaN" : "number";
24866
+ return Number.isNaN(data) ? "NaN" : "number";
24704
24867
  }
24705
24868
  case "object": {
24706
- if (Array.isArray(data2)) {
24869
+ if (Array.isArray(data)) {
24707
24870
  return "array";
24708
24871
  }
24709
- if (data2 === null) {
24872
+ if (data === null) {
24710
24873
  return "null";
24711
24874
  }
24712
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24713
- return data2.constructor.name;
24875
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24876
+ return data.constructor.name;
24714
24877
  }
24715
24878
  }
24716
24879
  }
@@ -24814,21 +24977,21 @@ var error91 = () => {
24814
24977
  function getSizing(origin) {
24815
24978
  return Sizable[origin] ?? null;
24816
24979
  }
24817
- const parsedType8 = (data2) => {
24818
- const t = typeof data2;
24980
+ const parsedType8 = (data) => {
24981
+ const t = typeof data;
24819
24982
  switch (t) {
24820
24983
  case "number": {
24821
- return Number.isNaN(data2) ? "NaN" : "n\u1ECD\u0301mb\xE0";
24984
+ return Number.isNaN(data) ? "NaN" : "n\u1ECD\u0301mb\xE0";
24822
24985
  }
24823
24986
  case "object": {
24824
- if (Array.isArray(data2)) {
24987
+ if (Array.isArray(data)) {
24825
24988
  return "akop\u1ECD";
24826
24989
  }
24827
- if (data2 === null) {
24990
+ if (data === null) {
24828
24991
  return "null";
24829
24992
  }
24830
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24831
- return data2.constructor.name;
24993
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24994
+ return data.constructor.name;
24832
24995
  }
24833
24996
  }
24834
24997
  }
@@ -25805,12 +25968,12 @@ function _stringbool2(Classes, _params) {
25805
25968
  in: stringSchema,
25806
25969
  out: booleanSchema,
25807
25970
  transform: ((input, payload) => {
25808
- let data2 = input;
25971
+ let data = input;
25809
25972
  if (params.case !== "sensitive")
25810
- data2 = data2.toLowerCase();
25811
- if (truthySet.has(data2)) {
25973
+ data = data.toLowerCase();
25974
+ if (truthySet.has(data)) {
25812
25975
  return true;
25813
- } else if (falsySet.has(data2)) {
25976
+ } else if (falsySet.has(data)) {
25814
25977
  return false;
25815
25978
  } else {
25816
25979
  payload.issues.push({
@@ -26794,19 +26957,19 @@ var ZodType2 = /* @__PURE__ */ $constructor2("ZodType", (inst, def) => {
26794
26957
  reg.add(inst, meta3);
26795
26958
  return inst;
26796
26959
  });
26797
- inst.parse = (data2, params) => parse6(inst, data2, params, { callee: inst.parse });
26798
- inst.safeParse = (data2, params) => safeParse4(inst, data2, params);
26799
- inst.parseAsync = async (data2, params) => parseAsync4(inst, data2, params, { callee: inst.parseAsync });
26800
- inst.safeParseAsync = async (data2, params) => safeParseAsync4(inst, data2, params);
26960
+ inst.parse = (data, params) => parse6(inst, data, params, { callee: inst.parse });
26961
+ inst.safeParse = (data, params) => safeParse4(inst, data, params);
26962
+ inst.parseAsync = async (data, params) => parseAsync4(inst, data, params, { callee: inst.parseAsync });
26963
+ inst.safeParseAsync = async (data, params) => safeParseAsync4(inst, data, params);
26801
26964
  inst.spa = inst.safeParseAsync;
26802
- inst.encode = (data2, params) => encode4(inst, data2, params);
26803
- inst.decode = (data2, params) => decode4(inst, data2, params);
26804
- inst.encodeAsync = async (data2, params) => encodeAsync4(inst, data2, params);
26805
- inst.decodeAsync = async (data2, params) => decodeAsync4(inst, data2, params);
26806
- inst.safeEncode = (data2, params) => safeEncode4(inst, data2, params);
26807
- inst.safeDecode = (data2, params) => safeDecode4(inst, data2, params);
26808
- inst.safeEncodeAsync = async (data2, params) => safeEncodeAsync4(inst, data2, params);
26809
- inst.safeDecodeAsync = async (data2, params) => safeDecodeAsync4(inst, data2, params);
26965
+ inst.encode = (data, params) => encode4(inst, data, params);
26966
+ inst.decode = (data, params) => decode4(inst, data, params);
26967
+ inst.encodeAsync = async (data, params) => encodeAsync4(inst, data, params);
26968
+ inst.decodeAsync = async (data, params) => decodeAsync4(inst, data, params);
26969
+ inst.safeEncode = (data, params) => safeEncode4(inst, data, params);
26970
+ inst.safeDecode = (data, params) => safeDecode4(inst, data, params);
26971
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync4(inst, data, params);
26972
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync4(inst, data, params);
26810
26973
  inst.refine = (check3, params) => inst.check(refine2(check3, params));
26811
26974
  inst.superRefine = (refinement) => inst.check(superRefine2(refinement));
26812
26975
  inst.overwrite = (fn) => inst.check(_overwrite2(fn));
@@ -27729,7 +27892,7 @@ function _instanceof2(cls, params = {
27729
27892
  const inst = new ZodCustom2({
27730
27893
  type: "custom",
27731
27894
  check: "custom",
27732
- fn: (data2) => data2 instanceof cls,
27895
+ fn: (data) => data instanceof cls,
27733
27896
  abort: true,
27734
27897
  ...util_exports2.normalizeParams(params)
27735
27898
  });
@@ -27766,12 +27929,12 @@ var ZodIssueCode2 = {
27766
27929
  custom: "custom"
27767
27930
  };
27768
27931
  function setErrorMap2(map3) {
27769
- config3({
27932
+ config2({
27770
27933
  customError: map3
27771
27934
  });
27772
27935
  }
27773
27936
  function getErrorMap2() {
27774
- return config3().customError;
27937
+ return config2().customError;
27775
27938
  }
27776
27939
  var ZodFirstPartyTypeKind2;
27777
27940
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind3) {
@@ -27803,7 +27966,7 @@ function date8(params) {
27803
27966
  }
27804
27967
 
27805
27968
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
27806
- config3(en_default2());
27969
+ config2(en_default2());
27807
27970
 
27808
27971
  // node_modules/@opencode-ai/plugin/dist/tool.js
27809
27972
  function tool(input) {
@@ -27910,35 +28073,352 @@ async function downloadTemplate(mode, filePath) {
27910
28073
  }
27911
28074
  }
27912
28075
 
28076
+ // src/tools/create-template/ets-check.ts
28077
+ async function checkEtsExists(directory) {
28078
+ try {
28079
+ const etsStats = await countEtsLines(directory);
28080
+ log("[createHmTemplate] ets check", { fileCount: etsStats.fileCount, totalLines: etsStats.totalLines });
28081
+ return etsStats.fileCount;
28082
+ } catch (e) {
28083
+ return 0;
28084
+ }
28085
+ }
28086
+ async function updateEtsCache(sessionManager, sessionID, directory) {
28087
+ try {
28088
+ const newStats = await countEtsLines(directory);
28089
+ let session = sessionManager.get(sessionID);
28090
+ if (!session) {
28091
+ session = sessionManager.create(sessionID);
28092
+ }
28093
+ session.data.set("etsStats", newStats);
28094
+ log("[createHmTemplate] cache updated", { fileCount: newStats.fileCount, totalLines: newStats.totalLines });
28095
+ } catch (e) {
28096
+ }
28097
+ }
28098
+
27913
28099
  // src/tools/create-template/create-template-tool.ts
27914
- var createHmTemplate = tool({
27915
- description: "Create an empty HarmonyOS project template. Supports three modes: 'application' (full app), 'module' (sub-module), 'atomic' (atomic service). Downloads and extracts the template to the specified directory.",
27916
- args: {
27917
- filePath: tool.schema.string("Absolute path of the target directory where the template will be created"),
27918
- mode: tool.schema.string("Template type: 'application' (\u5E94\u7528), 'module' (\u6A21\u5757), or 'atomic' (\u5143\u670D\u52A1)")
27919
- },
27920
- execute: async (args, context) => {
28100
+ var CHECK_ETS_TEMPLATE_MODES = /* @__PURE__ */ new Set(["atomic", "application"]);
28101
+ function createHmTemplateTool(managers) {
28102
+ return tool({
28103
+ description: "Create an empty HarmonyOS project template. Supports three modes: 'application' (full app), 'module' (sub-module), 'atomic' (atomic service). Downloads and extracts the template to the specified directory.",
28104
+ args: {
28105
+ filePath: tool.schema.string("Absolute path of the target directory where the template will be created"),
28106
+ mode: tool.schema.string("Template type: 'application' (\u5E94\u7528), 'module' (\u6A21\u5757), or 'atomic' (\u5143\u670D\u52A1)")
28107
+ },
28108
+ execute: async (args, context) => {
28109
+ try {
28110
+ if (CHECK_ETS_TEMPLATE_MODES.has(args.mode)) {
28111
+ const fileCount = await checkEtsExists(context.directory);
28112
+ if (fileCount > 0) {
28113
+ log("[createHmTemplate] skipped, ets files exist", { fileCount });
28114
+ return `Skipped: Current directory already contains ${fileCount} .ets file(s). Template download is not needed.`;
28115
+ }
28116
+ }
28117
+ await downloadTemplate(args.mode, args.filePath);
28118
+ await updateEtsCache(managers.session, context.sessionID, context.directory);
28119
+ return `Success to create harmonyos ${args.mode}`;
28120
+ } catch (e) {
28121
+ return `Error: ${e instanceof Error ? e.message : String(e)}`;
28122
+ }
28123
+ }
28124
+ });
28125
+ }
28126
+
28127
+ // src/tools/skill-search/skill-search-tool.ts
28128
+ import { homedir as homedir3 } from "node:os";
28129
+ import { join as join4 } from "node:path";
28130
+
28131
+ // src/tools/skill-search/search-skill.ts
28132
+ import { readFileSync } from "node:fs";
28133
+ import { homedir as homedir2 } from "node:os";
28134
+ import { join as join3 } from "node:path";
28135
+
28136
+ // src/tools/skill-search/tokenizer.ts
28137
+ var segmenter = new Intl.Segmenter("zh", { granularity: "word" });
28138
+ var SEG_RE = /[一-鿿㐀-䶿]+|[^\s\p{P}一-鿿㐀-䶿]+/gu;
28139
+ var CAMEL_RE = /[A-Z]?[a-z]+|[A-Z]+(?![a-z])/g;
28140
+ function tokenize(text) {
28141
+ const segments = text.match(SEG_RE) ?? [];
28142
+ const tokens = [];
28143
+ for (const seg of segments) {
28144
+ if (/[一-鿿㐀-䶿]/.test(seg)) {
28145
+ for (const s of segmenter.segment(seg)) {
28146
+ if (s.isWordLike) tokens.push(s.segment.toLowerCase().trim());
28147
+ }
28148
+ } else {
28149
+ const lower = seg.toLowerCase().trim();
28150
+ const words = seg.match(CAMEL_RE) ?? [];
28151
+ const splits = words.filter((w) => w.length > 1).map((w) => w.toLowerCase().trim());
28152
+ if (splits.length > 1) {
28153
+ if (lower.length > 1) tokens.push(lower);
28154
+ tokens.push(...splits);
28155
+ } else {
28156
+ if (lower.length > 1) tokens.push(lower);
28157
+ }
28158
+ }
28159
+ }
28160
+ return tokens.filter((w) => w.length > 0);
28161
+ }
28162
+
28163
+ // src/tools/skill-search/bm25.ts
28164
+ var BM25Retriever = class {
28165
+ k1;
28166
+ b;
28167
+ documents = [];
28168
+ tokenizedDocs = [];
28169
+ df = /* @__PURE__ */ new Map();
28170
+ tfMaps = [];
28171
+ avgDl = 0;
28172
+ constructor(opts) {
28173
+ this.k1 = opts?.k1 ?? 1.2;
28174
+ this.b = opts?.b ?? 0.75;
28175
+ }
28176
+ addDocuments(docs, tokenized) {
28177
+ this.documents = [...this.documents, ...docs];
28178
+ this.tokenizedDocs = [...this.tokenizedDocs, ...tokenized];
28179
+ const totalLen = this.tokenizedDocs.reduce(
28180
+ (sum, doc) => sum + doc.length,
28181
+ 0
28182
+ );
28183
+ this.avgDl = totalLen / this.tokenizedDocs.length;
28184
+ this.df = /* @__PURE__ */ new Map();
28185
+ this.tfMaps = this.tokenizedDocs.map((doc) => {
28186
+ const tfMap = /* @__PURE__ */ new Map();
28187
+ for (const t of doc) {
28188
+ tfMap.set(t, (tfMap.get(t) ?? 0) + 1);
28189
+ }
28190
+ const seen = new Set(doc);
28191
+ for (const token of seen) {
28192
+ this.df.set(token, (this.df.get(token) ?? 0) + 1);
28193
+ }
28194
+ return tfMap;
28195
+ });
28196
+ }
28197
+ search(query, topK = 5) {
28198
+ if (this.documents.length === 0) return [];
28199
+ const queryTokens = tokenize(query);
28200
+ const N = this.tokenizedDocs.length;
28201
+ const scored = this.tokenizedDocs.map((doc, i) => {
28202
+ const dl = doc.length;
28203
+ const tfMap = this.tfMaps[i];
28204
+ let score = 0;
28205
+ for (const qt of queryTokens) {
28206
+ const tf = tfMap.get(qt) ?? 0;
28207
+ if (tf === 0) continue;
28208
+ const dfVal = this.df.get(qt) ?? 0;
28209
+ const idf = Math.log((N - dfVal + 0.5) / (dfVal + 0.5) + 1);
28210
+ const tfNorm = tf * (this.k1 + 1) / (tf + this.k1 * (1 - this.b + this.b * dl / this.avgDl));
28211
+ score += idf * tfNorm;
28212
+ }
28213
+ return { index: i, text: this.documents[i], score };
28214
+ });
28215
+ scored.sort((a, b) => b.score - a.score);
28216
+ return scored.slice(0, topK);
28217
+ }
28218
+ };
28219
+
28220
+ // src/tools/skill-search/keyword.ts
28221
+ var KeywordRetriever = class {
28222
+ documents = [];
28223
+ tokenizedDocs = [];
28224
+ addDocuments(docs, tokenized) {
28225
+ this.documents = [...this.documents, ...docs];
28226
+ this.tokenizedDocs = [...this.tokenizedDocs, ...tokenized];
28227
+ }
28228
+ search(query, topK = 5) {
28229
+ if (this.documents.length === 0) return [];
28230
+ const queryTokens = tokenize(query);
28231
+ const querySet = new Set(queryTokens);
28232
+ const scored = this.tokenizedDocs.map((doc, i) => {
28233
+ let matched = 0;
28234
+ for (const token of doc) {
28235
+ if (querySet.has(token)) matched++;
28236
+ }
28237
+ const score = queryTokens.length > 0 ? matched / queryTokens.length : 0;
28238
+ return { index: i, text: this.documents[i], score };
28239
+ });
28240
+ scored.sort((a, b) => b.score - a.score);
28241
+ return scored.slice(0, topK);
28242
+ }
28243
+ };
28244
+
28245
+ // src/tools/skill-search/hybrid.ts
28246
+ var HybridRetriever = class {
28247
+ bm25;
28248
+ keyword;
28249
+ bm25Weight;
28250
+ keywordWeight;
28251
+ constructor(opts) {
28252
+ this.bm25Weight = opts?.bm25Weight ?? 0.7;
28253
+ this.keywordWeight = opts?.keywordWeight ?? 0.3;
28254
+ this.bm25 = new BM25Retriever({ k1: opts?.k1, b: opts?.b });
28255
+ this.keyword = new KeywordRetriever();
28256
+ }
28257
+ addDocuments(docs, tokenized) {
28258
+ this.bm25.addDocuments(docs, tokenized);
28259
+ this.keyword.addDocuments(docs, tokenized);
28260
+ }
28261
+ search(query, topK = 5) {
28262
+ if (this.bm25["documents"].length === 0) return [];
28263
+ const poolSize = topK * 3;
28264
+ const bm25Results = this.bm25.search(query, poolSize);
28265
+ const keywordResults = this.keyword.search(query, poolSize);
28266
+ const rrfK = 60;
28267
+ const documents = this.bm25["documents"];
28268
+ const scores = /* @__PURE__ */ new Map();
28269
+ for (let rank = 0; rank < bm25Results.length; rank++) {
28270
+ const idx = bm25Results[rank].index;
28271
+ scores.set(idx, (scores.get(idx) ?? 0) + this.bm25Weight / (rrfK + rank + 1));
28272
+ }
28273
+ for (let rank = 0; rank < keywordResults.length; rank++) {
28274
+ const idx = keywordResults[rank].index;
28275
+ scores.set(idx, (scores.get(idx) ?? 0) + this.keywordWeight / (rrfK + rank + 1));
28276
+ }
28277
+ const scored = [];
28278
+ for (const [idx, score] of scores) {
28279
+ scored.push({ index: idx, text: documents[idx], score });
28280
+ }
28281
+ scored.sort((a, b) => b.score - a.score);
28282
+ return scored.slice(0, topK);
28283
+ }
28284
+ };
28285
+
28286
+ // src/tools/skill-search/filter.json
28287
+ var filter_default = [
28288
+ { id: "1", summary: "Badge \u89D2\u6807\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_badge.md", category: "badge" },
28289
+ { id: "2", summary: "Blank \u7A7A\u767D\u586B\u5145\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_blank.md", category: "blank" },
28290
+ { id: "3", summary: "Button \u6309\u94AE\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_button.md", category: "button" },
28291
+ { id: "4", summary: "Column \u5782\u76F4\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_column.md", category: "column" },
28292
+ { id: "5", summary: "Counter \u8BA1\u6570\u5668\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_counter.md", category: "counter" },
28293
+ { id: "6", summary: "DataPanel \u6570\u636E\u9762\u677F\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_data_panel.md", category: "data_panel" },
28294
+ { id: "7", summary: "DatePicker \u65E5\u671F\u9009\u62E9\u5668\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_date_picker.md", category: "date_picker" },
28295
+ { id: "8", summary: "Divider \u5206\u5272\u7EBF\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_divider.md", category: "divider" },
28296
+ { id: "9", summary: "Flex \u5F39\u6027\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_flex.md", category: "flex" },
28297
+ { id: "10", summary: "ForEach \u5FAA\u73AF\u6E32\u67D3\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_for_each.md", category: "for_each" },
28298
+ { id: "11", summary: "LazyForEach \u5EF6\u8FDF\u52A0\u8F7D\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_lazy_for_each.md", category: "lazy_for_each" },
28299
+ { id: "12", summary: "Radio \u5355\u9009\u6309\u94AE\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_radio.md", category: "radio" },
28300
+ { id: "13", summary: "Rating \u8BC4\u5206\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_rating.md", category: "rating" },
28301
+ { id: "14", summary: "Refresh \u4E0B\u62C9\u5237\u65B0\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_refresh.md", category: "refresh" },
28302
+ { id: "15", summary: "Repeat \u5FAA\u73AF\u6E32\u67D3\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_repeat.md", category: "repeat" },
28303
+ { id: "16", summary: "Row \u6C34\u5E73\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_row.md", category: "row" },
28304
+ { id: "17", summary: "Search \u641C\u7D22\u6846\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_search.md", category: "search" },
28305
+ { id: "18", summary: "Slider \u6ED1\u52A8\u9009\u62E9\u5668\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_slider.md", category: "slider" },
28306
+ { id: "19", summary: "Span \u6587\u672C\u7247\u6BB5\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_span.md", category: "span" },
28307
+ { id: "20", summary: "Stack \u5C42\u53E0\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_stack.md", category: "stack" },
28308
+ { id: "21", summary: "Swiper \u8F6E\u64AD\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_swiper.md", category: "swiper" },
28309
+ { id: "22", summary: "TextArea \u591A\u884C\u6587\u672C\u8F93\u5165\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_text_area.md", category: "text_area" },
28310
+ { id: "23", summary: "TextInput \u5355\u884C\u6587\u672C\u8F93\u5165\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_text_input.md", category: "text_input" },
28311
+ { id: "24", summary: "Toggle \u5F00\u5173\u5207\u6362\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_toggle.md", category: "toggle" },
28312
+ { id: "25", summary: "WaterFlow \u7011\u5E03\u6D41\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_water_flow.md", category: "water_flow" }
28313
+ ];
28314
+
28315
+ // src/tools/skill-search/search-skill.ts
28316
+ var DEFAULT_SKILL_PATH = join3(homedir2(), ".config", "opencode", "skills", "harmonyos-atomic-dev");
28317
+ var cachedEntries = null;
28318
+ var cachedIndexableEntries = null;
28319
+ var cachedFilters = null;
28320
+ var cachedRetriever = null;
28321
+ function loadAndCache(resolvedPath) {
28322
+ const raw = readFileSync(join3(resolvedPath, "index.json"), "utf-8");
28323
+ const entries = JSON.parse(raw);
28324
+ if (!Array.isArray(entries) || entries.length === 0) {
28325
+ return false;
28326
+ }
28327
+ cachedFilters = new Map(filter_default.map((e) => [e.category, e]));
28328
+ cachedEntries = entries;
28329
+ cachedIndexableEntries = cachedEntries.filter((e) => e.type === "component" || e.type === "kit");
28330
+ const documents = cachedIndexableEntries.map((e) => e.summary);
28331
+ const tokenizedDocs = documents.map((d) => tokenize(d));
28332
+ const retriever = new HybridRetriever();
28333
+ retriever.addDocuments(documents, tokenizedDocs);
28334
+ cachedRetriever = retriever;
28335
+ return true;
28336
+ }
28337
+ function searchSkill(skill_path, query, topK = 5) {
28338
+ const resolvedPath = skill_path?.trim() || DEFAULT_SKILL_PATH;
28339
+ if (!cachedEntries) {
27921
28340
  try {
27922
- await downloadTemplate(args.mode, args.filePath);
27923
- return `Success to create harmonyos ${args.mode}`;
27924
- } catch (e) {
27925
- return `Error: ${e instanceof Error ? e.message : String(e)}`;
28341
+ if (!loadAndCache(resolvedPath)) return [];
28342
+ } catch {
28343
+ return [];
28344
+ }
28345
+ }
28346
+ const preFiltered = [];
28347
+ for (const [category, entry] of cachedFilters) {
28348
+ const idx = query.toLowerCase().indexOf(category);
28349
+ if (idx !== -1) {
28350
+ preFiltered.push({
28351
+ ets_file_path: "",
28352
+ experience_file_path: entry.path,
28353
+ summary: entry.summary,
28354
+ range: 0
28355
+ });
28356
+ query = (query.slice(0, idx) + query.slice(idx + category.length)).trim();
27926
28357
  }
27927
28358
  }
27928
- });
28359
+ if (!query) {
28360
+ return preFiltered;
28361
+ }
28362
+ const searchResults = cachedRetriever.search(query, topK);
28363
+ const MIN_SCORE = 2e-3;
28364
+ const filtered = searchResults.filter((r) => r.score >= MIN_SCORE);
28365
+ if (filtered.length === 0) return preFiltered;
28366
+ return [...preFiltered, ...convert_search_result(filtered)];
28367
+ }
28368
+ function convert_search_result(searchResults) {
28369
+ return searchResults.map((result, rank) => {
28370
+ const entry = cachedIndexableEntries[result.index];
28371
+ const experience = cachedEntries.find(
28372
+ (e) => e.type === "experience" && e.category === entry.category
28373
+ );
28374
+ return {
28375
+ ets_file_path: entry.path,
28376
+ experience_file_path: experience?.path ?? "",
28377
+ summary: entry.summary,
28378
+ range: rank + 1
28379
+ };
28380
+ });
28381
+ }
28382
+
28383
+ // src/tools/skill-search/skill-search-tool.ts
28384
+ function skillSearchTool(managers) {
28385
+ return tool({
28386
+ description: "Search for relevant documents within the harmonyos-atomic-dev skill directory by keywords. Returns the top K most relevant document snippets from the skill directory, ranked by keyword match frequency. Use this tool instead of Glob/Grep when you need to find specific knowledge or documentation within harmonyos-atomic-dev skill. It scans all files under the given skill_path and returns the most relevant matches based on your query keywords. The results include ets_file_path (path to the ETS code examples), experience_file_path (path to the matching experience document best practices), summary (document summary), and range (relevance rank 1 = most relevant)\u3002",
28387
+ args: {
28388
+ skill_path: tool.schema.string("Absolute path to the skill directory to search within. Default path may not contains harmonyos-atomic-dev skill").default(join4(homedir3(), ".config", "opencode", "skills", "harmonyos-atomic-dev")),
28389
+ query: tool.schema.string("A decomposed requirement or intent describing what you want to find, broken down into searchable keywords separated by spaces."),
28390
+ topK: tool.schema.number("Maximum number of top-ranked documents to return. Actual results may be fewer depending on query relevance.").min(1).max(5).default(5)
28391
+ },
28392
+ execute: async (args, context) => {
28393
+ try {
28394
+ const results = searchSkill(args.skill_path, args.query, args.topK);
28395
+ if (results.length === 0) {
28396
+ return "No relative items found in the skill directory.";
28397
+ }
28398
+ return JSON.stringify(results, null, 2);
28399
+ } catch (e) {
28400
+ return `Error: ${e instanceof Error ? e.message : String(e)}`;
28401
+ }
28402
+ }
28403
+ });
28404
+ }
27929
28405
 
27930
28406
  // src/tools/builtin.ts
27931
- var builtinTools = {
27932
- createHmTemplate
27933
- };
28407
+ function createBuiltinTools(managers) {
28408
+ return {
28409
+ createHmTemplate: createHmTemplateTool(managers),
28410
+ skillSearch: skillSearchTool(managers)
28411
+ };
28412
+ }
27934
28413
 
27935
28414
  // src/create-tools.ts
27936
28415
  function createTools(args) {
27937
- const { ctx, config: config4 } = args;
28416
+ const { ctx, config: config3 } = args;
27938
28417
  log("Creating tools");
27939
28418
  const registry3 = new ToolRegistry();
28419
+ const builtinTools = createBuiltinTools(args.managers);
27940
28420
  registry3.registerMultiple(builtinTools, "builtin");
27941
- const filteredTools = registry3.filterDisabled(config4.disabled_tools ?? []);
28421
+ const filteredTools = registry3.filterDisabled(config3.disabled_tools ?? []);
27942
28422
  log("Tools created", {
27943
28423
  total: registry3.listAll().length,
27944
28424
  enabled: Object.keys(filteredTools).length
@@ -27946,6 +28426,562 @@ function createTools(args) {
27946
28426
  return { filteredTools };
27947
28427
  }
27948
28428
 
28429
+ // src/hooks/tool-hooks.ts
28430
+ import { readFile as readFile3 } from "fs/promises";
28431
+
28432
+ // node_modules/diff/lib/index.mjs
28433
+ function Diff() {
28434
+ }
28435
+ Diff.prototype = {
28436
+ diff: function diff(oldString, newString) {
28437
+ var _options$timeout;
28438
+ var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
28439
+ var callback = options.callback;
28440
+ if (typeof options === "function") {
28441
+ callback = options;
28442
+ options = {};
28443
+ }
28444
+ var self = this;
28445
+ function done(value) {
28446
+ value = self.postProcess(value, options);
28447
+ if (callback) {
28448
+ setTimeout(function() {
28449
+ callback(value);
28450
+ }, 0);
28451
+ return true;
28452
+ } else {
28453
+ return value;
28454
+ }
28455
+ }
28456
+ oldString = this.castInput(oldString, options);
28457
+ newString = this.castInput(newString, options);
28458
+ oldString = this.removeEmpty(this.tokenize(oldString, options));
28459
+ newString = this.removeEmpty(this.tokenize(newString, options));
28460
+ var newLen = newString.length, oldLen = oldString.length;
28461
+ var editLength = 1;
28462
+ var maxEditLength = newLen + oldLen;
28463
+ if (options.maxEditLength != null) {
28464
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
28465
+ }
28466
+ var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
28467
+ var abortAfterTimestamp = Date.now() + maxExecutionTime;
28468
+ var bestPath = [{
28469
+ oldPos: -1,
28470
+ lastComponent: void 0
28471
+ }];
28472
+ var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
28473
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
28474
+ return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));
28475
+ }
28476
+ var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
28477
+ function execEditLength() {
28478
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
28479
+ var basePath = void 0;
28480
+ var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
28481
+ if (removePath) {
28482
+ bestPath[diagonalPath - 1] = void 0;
28483
+ }
28484
+ var canAdd = false;
28485
+ if (addPath) {
28486
+ var addPathNewPos = addPath.oldPos - diagonalPath;
28487
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
28488
+ }
28489
+ var canRemove = removePath && removePath.oldPos + 1 < oldLen;
28490
+ if (!canAdd && !canRemove) {
28491
+ bestPath[diagonalPath] = void 0;
28492
+ continue;
28493
+ }
28494
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
28495
+ basePath = self.addToPath(addPath, true, false, 0, options);
28496
+ } else {
28497
+ basePath = self.addToPath(removePath, false, true, 1, options);
28498
+ }
28499
+ newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);
28500
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
28501
+ return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
28502
+ } else {
28503
+ bestPath[diagonalPath] = basePath;
28504
+ if (basePath.oldPos + 1 >= oldLen) {
28505
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
28506
+ }
28507
+ if (newPos + 1 >= newLen) {
28508
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
28509
+ }
28510
+ }
28511
+ }
28512
+ editLength++;
28513
+ }
28514
+ if (callback) {
28515
+ (function exec() {
28516
+ setTimeout(function() {
28517
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
28518
+ return callback();
28519
+ }
28520
+ if (!execEditLength()) {
28521
+ exec();
28522
+ }
28523
+ }, 0);
28524
+ })();
28525
+ } else {
28526
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
28527
+ var ret = execEditLength();
28528
+ if (ret) {
28529
+ return ret;
28530
+ }
28531
+ }
28532
+ }
28533
+ },
28534
+ addToPath: function addToPath(path7, added, removed, oldPosInc, options) {
28535
+ var last = path7.lastComponent;
28536
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
28537
+ return {
28538
+ oldPos: path7.oldPos + oldPosInc,
28539
+ lastComponent: {
28540
+ count: last.count + 1,
28541
+ added,
28542
+ removed,
28543
+ previousComponent: last.previousComponent
28544
+ }
28545
+ };
28546
+ } else {
28547
+ return {
28548
+ oldPos: path7.oldPos + oldPosInc,
28549
+ lastComponent: {
28550
+ count: 1,
28551
+ added,
28552
+ removed,
28553
+ previousComponent: last
28554
+ }
28555
+ };
28556
+ }
28557
+ },
28558
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
28559
+ var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
28560
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
28561
+ newPos++;
28562
+ oldPos++;
28563
+ commonCount++;
28564
+ if (options.oneChangePerToken) {
28565
+ basePath.lastComponent = {
28566
+ count: 1,
28567
+ previousComponent: basePath.lastComponent,
28568
+ added: false,
28569
+ removed: false
28570
+ };
28571
+ }
28572
+ }
28573
+ if (commonCount && !options.oneChangePerToken) {
28574
+ basePath.lastComponent = {
28575
+ count: commonCount,
28576
+ previousComponent: basePath.lastComponent,
28577
+ added: false,
28578
+ removed: false
28579
+ };
28580
+ }
28581
+ basePath.oldPos = oldPos;
28582
+ return newPos;
28583
+ },
28584
+ equals: function equals(left, right, options) {
28585
+ if (options.comparator) {
28586
+ return options.comparator(left, right);
28587
+ } else {
28588
+ return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
28589
+ }
28590
+ },
28591
+ removeEmpty: function removeEmpty(array3) {
28592
+ var ret = [];
28593
+ for (var i = 0; i < array3.length; i++) {
28594
+ if (array3[i]) {
28595
+ ret.push(array3[i]);
28596
+ }
28597
+ }
28598
+ return ret;
28599
+ },
28600
+ castInput: function castInput(value) {
28601
+ return value;
28602
+ },
28603
+ tokenize: function tokenize2(value) {
28604
+ return Array.from(value);
28605
+ },
28606
+ join: function join5(chars) {
28607
+ return chars.join("");
28608
+ },
28609
+ postProcess: function postProcess(changeObjects) {
28610
+ return changeObjects;
28611
+ }
28612
+ };
28613
+ function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
28614
+ var components = [];
28615
+ var nextComponent;
28616
+ while (lastComponent) {
28617
+ components.push(lastComponent);
28618
+ nextComponent = lastComponent.previousComponent;
28619
+ delete lastComponent.previousComponent;
28620
+ lastComponent = nextComponent;
28621
+ }
28622
+ components.reverse();
28623
+ var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
28624
+ for (; componentPos < componentLen; componentPos++) {
28625
+ var component = components[componentPos];
28626
+ if (!component.removed) {
28627
+ if (!component.added && useLongestToken) {
28628
+ var value = newString.slice(newPos, newPos + component.count);
28629
+ value = value.map(function(value2, i) {
28630
+ var oldValue = oldString[oldPos + i];
28631
+ return oldValue.length > value2.length ? oldValue : value2;
28632
+ });
28633
+ component.value = diff2.join(value);
28634
+ } else {
28635
+ component.value = diff2.join(newString.slice(newPos, newPos + component.count));
28636
+ }
28637
+ newPos += component.count;
28638
+ if (!component.added) {
28639
+ oldPos += component.count;
28640
+ }
28641
+ } else {
28642
+ component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
28643
+ oldPos += component.count;
28644
+ }
28645
+ }
28646
+ return components;
28647
+ }
28648
+ var characterDiff = new Diff();
28649
+ function longestCommonPrefix(str1, str2) {
28650
+ var i;
28651
+ for (i = 0; i < str1.length && i < str2.length; i++) {
28652
+ if (str1[i] != str2[i]) {
28653
+ return str1.slice(0, i);
28654
+ }
28655
+ }
28656
+ return str1.slice(0, i);
28657
+ }
28658
+ function longestCommonSuffix(str1, str2) {
28659
+ var i;
28660
+ if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
28661
+ return "";
28662
+ }
28663
+ for (i = 0; i < str1.length && i < str2.length; i++) {
28664
+ if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
28665
+ return str1.slice(-i);
28666
+ }
28667
+ }
28668
+ return str1.slice(-i);
28669
+ }
28670
+ function replacePrefix(string7, oldPrefix, newPrefix) {
28671
+ if (string7.slice(0, oldPrefix.length) != oldPrefix) {
28672
+ throw Error("string ".concat(JSON.stringify(string7), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
28673
+ }
28674
+ return newPrefix + string7.slice(oldPrefix.length);
28675
+ }
28676
+ function replaceSuffix(string7, oldSuffix, newSuffix) {
28677
+ if (!oldSuffix) {
28678
+ return string7 + newSuffix;
28679
+ }
28680
+ if (string7.slice(-oldSuffix.length) != oldSuffix) {
28681
+ throw Error("string ".concat(JSON.stringify(string7), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
28682
+ }
28683
+ return string7.slice(0, -oldSuffix.length) + newSuffix;
28684
+ }
28685
+ function removePrefix(string7, oldPrefix) {
28686
+ return replacePrefix(string7, oldPrefix, "");
28687
+ }
28688
+ function removeSuffix(string7, oldSuffix) {
28689
+ return replaceSuffix(string7, oldSuffix, "");
28690
+ }
28691
+ function maximumOverlap(string1, string22) {
28692
+ return string22.slice(0, overlapCount(string1, string22));
28693
+ }
28694
+ function overlapCount(a, b) {
28695
+ var startA = 0;
28696
+ if (a.length > b.length) {
28697
+ startA = a.length - b.length;
28698
+ }
28699
+ var endB = b.length;
28700
+ if (a.length < b.length) {
28701
+ endB = a.length;
28702
+ }
28703
+ var map3 = Array(endB);
28704
+ var k = 0;
28705
+ map3[0] = 0;
28706
+ for (var j = 1; j < endB; j++) {
28707
+ if (b[j] == b[k]) {
28708
+ map3[j] = map3[k];
28709
+ } else {
28710
+ map3[j] = k;
28711
+ }
28712
+ while (k > 0 && b[j] != b[k]) {
28713
+ k = map3[k];
28714
+ }
28715
+ if (b[j] == b[k]) {
28716
+ k++;
28717
+ }
28718
+ }
28719
+ k = 0;
28720
+ for (var i = startA; i < a.length; i++) {
28721
+ while (k > 0 && a[i] != b[k]) {
28722
+ k = map3[k];
28723
+ }
28724
+ if (a[i] == b[k]) {
28725
+ k++;
28726
+ }
28727
+ }
28728
+ return k;
28729
+ }
28730
+ var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
28731
+ var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
28732
+ var wordDiff = new Diff();
28733
+ wordDiff.equals = function(left, right, options) {
28734
+ if (options.ignoreCase) {
28735
+ left = left.toLowerCase();
28736
+ right = right.toLowerCase();
28737
+ }
28738
+ return left.trim() === right.trim();
28739
+ };
28740
+ wordDiff.tokenize = function(value) {
28741
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
28742
+ var parts;
28743
+ if (options.intlSegmenter) {
28744
+ if (options.intlSegmenter.resolvedOptions().granularity != "word") {
28745
+ throw new Error('The segmenter passed must have a granularity of "word"');
28746
+ }
28747
+ parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
28748
+ return segment.segment;
28749
+ });
28750
+ } else {
28751
+ parts = value.match(tokenizeIncludingWhitespace) || [];
28752
+ }
28753
+ var tokens = [];
28754
+ var prevPart = null;
28755
+ parts.forEach(function(part) {
28756
+ if (/\s/.test(part)) {
28757
+ if (prevPart == null) {
28758
+ tokens.push(part);
28759
+ } else {
28760
+ tokens.push(tokens.pop() + part);
28761
+ }
28762
+ } else if (/\s/.test(prevPart)) {
28763
+ if (tokens[tokens.length - 1] == prevPart) {
28764
+ tokens.push(tokens.pop() + part);
28765
+ } else {
28766
+ tokens.push(prevPart + part);
28767
+ }
28768
+ } else {
28769
+ tokens.push(part);
28770
+ }
28771
+ prevPart = part;
28772
+ });
28773
+ return tokens;
28774
+ };
28775
+ wordDiff.join = function(tokens) {
28776
+ return tokens.map(function(token, i) {
28777
+ if (i == 0) {
28778
+ return token;
28779
+ } else {
28780
+ return token.replace(/^\s+/, "");
28781
+ }
28782
+ }).join("");
28783
+ };
28784
+ wordDiff.postProcess = function(changes, options) {
28785
+ if (!changes || options.oneChangePerToken) {
28786
+ return changes;
28787
+ }
28788
+ var lastKeep = null;
28789
+ var insertion = null;
28790
+ var deletion = null;
28791
+ changes.forEach(function(change) {
28792
+ if (change.added) {
28793
+ insertion = change;
28794
+ } else if (change.removed) {
28795
+ deletion = change;
28796
+ } else {
28797
+ if (insertion || deletion) {
28798
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
28799
+ }
28800
+ lastKeep = change;
28801
+ insertion = null;
28802
+ deletion = null;
28803
+ }
28804
+ });
28805
+ if (insertion || deletion) {
28806
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
28807
+ }
28808
+ return changes;
28809
+ };
28810
+ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
28811
+ if (deletion && insertion) {
28812
+ var oldWsPrefix = deletion.value.match(/^\s*/)[0];
28813
+ var oldWsSuffix = deletion.value.match(/\s*$/)[0];
28814
+ var newWsPrefix = insertion.value.match(/^\s*/)[0];
28815
+ var newWsSuffix = insertion.value.match(/\s*$/)[0];
28816
+ if (startKeep) {
28817
+ var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
28818
+ startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
28819
+ deletion.value = removePrefix(deletion.value, commonWsPrefix);
28820
+ insertion.value = removePrefix(insertion.value, commonWsPrefix);
28821
+ }
28822
+ if (endKeep) {
28823
+ var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
28824
+ endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
28825
+ deletion.value = removeSuffix(deletion.value, commonWsSuffix);
28826
+ insertion.value = removeSuffix(insertion.value, commonWsSuffix);
28827
+ }
28828
+ } else if (insertion) {
28829
+ if (startKeep) {
28830
+ insertion.value = insertion.value.replace(/^\s*/, "");
28831
+ }
28832
+ if (endKeep) {
28833
+ endKeep.value = endKeep.value.replace(/^\s*/, "");
28834
+ }
28835
+ } else if (startKeep && endKeep) {
28836
+ var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
28837
+ var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
28838
+ deletion.value = removePrefix(deletion.value, newWsStart);
28839
+ var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
28840
+ deletion.value = removeSuffix(deletion.value, newWsEnd);
28841
+ endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
28842
+ startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
28843
+ } else if (endKeep) {
28844
+ var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
28845
+ var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
28846
+ var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
28847
+ deletion.value = removeSuffix(deletion.value, overlap);
28848
+ } else if (startKeep) {
28849
+ var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
28850
+ var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
28851
+ var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
28852
+ deletion.value = removePrefix(deletion.value, _overlap);
28853
+ }
28854
+ }
28855
+ var wordWithSpaceDiff = new Diff();
28856
+ wordWithSpaceDiff.tokenize = function(value) {
28857
+ var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
28858
+ return value.match(regex) || [];
28859
+ };
28860
+ var lineDiff = new Diff();
28861
+ lineDiff.tokenize = function(value, options) {
28862
+ if (options.stripTrailingCr) {
28863
+ value = value.replace(/\r\n/g, "\n");
28864
+ }
28865
+ var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
28866
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
28867
+ linesAndNewlines.pop();
28868
+ }
28869
+ for (var i = 0; i < linesAndNewlines.length; i++) {
28870
+ var line = linesAndNewlines[i];
28871
+ if (i % 2 && !options.newlineIsToken) {
28872
+ retLines[retLines.length - 1] += line;
28873
+ } else {
28874
+ retLines.push(line);
28875
+ }
28876
+ }
28877
+ return retLines;
28878
+ };
28879
+ lineDiff.equals = function(left, right, options) {
28880
+ if (options.ignoreWhitespace) {
28881
+ if (!options.newlineIsToken || !left.includes("\n")) {
28882
+ left = left.trim();
28883
+ }
28884
+ if (!options.newlineIsToken || !right.includes("\n")) {
28885
+ right = right.trim();
28886
+ }
28887
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
28888
+ if (left.endsWith("\n")) {
28889
+ left = left.slice(0, -1);
28890
+ }
28891
+ if (right.endsWith("\n")) {
28892
+ right = right.slice(0, -1);
28893
+ }
28894
+ }
28895
+ return Diff.prototype.equals.call(this, left, right, options);
28896
+ };
28897
+ function diffLines(oldStr, newStr, callback) {
28898
+ return lineDiff.diff(oldStr, newStr, callback);
28899
+ }
28900
+ var sentenceDiff = new Diff();
28901
+ sentenceDiff.tokenize = function(value) {
28902
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
28903
+ };
28904
+ var cssDiff = new Diff();
28905
+ cssDiff.tokenize = function(value) {
28906
+ return value.split(/([{}:;,]|\s+)/);
28907
+ };
28908
+ function _typeof(o) {
28909
+ "@babel/helpers - typeof";
28910
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
28911
+ return typeof o2;
28912
+ } : function(o2) {
28913
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
28914
+ }, _typeof(o);
28915
+ }
28916
+ var jsonDiff = new Diff();
28917
+ jsonDiff.useLongestToken = true;
28918
+ jsonDiff.tokenize = lineDiff.tokenize;
28919
+ jsonDiff.castInput = function(value, options) {
28920
+ var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
28921
+ return typeof v === "undefined" ? undefinedReplacement : v;
28922
+ } : _options$stringifyRep;
28923
+ return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
28924
+ };
28925
+ jsonDiff.equals = function(left, right, options) {
28926
+ return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
28927
+ };
28928
+ function canonicalize(obj, stack, replacementStack, replacer, key) {
28929
+ stack = stack || [];
28930
+ replacementStack = replacementStack || [];
28931
+ if (replacer) {
28932
+ obj = replacer(key, obj);
28933
+ }
28934
+ var i;
28935
+ for (i = 0; i < stack.length; i += 1) {
28936
+ if (stack[i] === obj) {
28937
+ return replacementStack[i];
28938
+ }
28939
+ }
28940
+ var canonicalizedObj;
28941
+ if ("[object Array]" === Object.prototype.toString.call(obj)) {
28942
+ stack.push(obj);
28943
+ canonicalizedObj = new Array(obj.length);
28944
+ replacementStack.push(canonicalizedObj);
28945
+ for (i = 0; i < obj.length; i += 1) {
28946
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
28947
+ }
28948
+ stack.pop();
28949
+ replacementStack.pop();
28950
+ return canonicalizedObj;
28951
+ }
28952
+ if (obj && obj.toJSON) {
28953
+ obj = obj.toJSON();
28954
+ }
28955
+ if (_typeof(obj) === "object" && obj !== null) {
28956
+ stack.push(obj);
28957
+ canonicalizedObj = {};
28958
+ replacementStack.push(canonicalizedObj);
28959
+ var sortedKeys = [], _key;
28960
+ for (_key in obj) {
28961
+ if (Object.prototype.hasOwnProperty.call(obj, _key)) {
28962
+ sortedKeys.push(_key);
28963
+ }
28964
+ }
28965
+ sortedKeys.sort();
28966
+ for (i = 0; i < sortedKeys.length; i += 1) {
28967
+ _key = sortedKeys[i];
28968
+ canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
28969
+ }
28970
+ stack.pop();
28971
+ replacementStack.pop();
28972
+ } else {
28973
+ canonicalizedObj = obj;
28974
+ }
28975
+ return canonicalizedObj;
28976
+ }
28977
+ var arrayDiff = new Diff();
28978
+ arrayDiff.tokenize = function(value) {
28979
+ return value.slice();
28980
+ };
28981
+ arrayDiff.join = arrayDiff.removeEmpty = function(value) {
28982
+ return value;
28983
+ };
28984
+
27949
28985
  // src/compress/compile-hvigorw.ts
27950
28986
  function processHvigorwCompileInfo(input, output) {
27951
28987
  if (input.tool !== "bash") return;
@@ -27968,15 +29004,91 @@ function stripAnsi(text) {
27968
29004
  }
27969
29005
 
27970
29006
  // src/hooks/tool-hooks.ts
27971
- function createToolHooks() {
29007
+ var writeContentCache = /* @__PURE__ */ new Map();
29008
+ function createToolHooks(sessionManager, projectDir) {
27972
29009
  return {
27973
29010
  "tool.execute.before": async (input, output) => {
29011
+ try {
29012
+ if (input.tool === "write") {
29013
+ const filePath = output.args?.filePath;
29014
+ if (filePath) {
29015
+ const oldContent = await readFile3(filePath, "utf-8").catch(() => "");
29016
+ writeContentCache.set(input.callID, oldContent);
29017
+ }
29018
+ }
29019
+ } catch (e) {
29020
+ log("aiCodeChange before hook error", { tool: input.tool, error: String(e) });
29021
+ }
27974
29022
  },
27975
29023
  "tool.execute.after": async (input, output) => {
27976
29024
  processHvigorwCompileInfo(input, output);
29025
+ injectAiCodeChange(input, output);
29026
+ await updateEtsCount(sessionManager, projectDir, input);
27977
29027
  }
27978
29028
  };
27979
29029
  }
29030
+ async function updateEtsCount(sessionManager, projectDir, input) {
29031
+ if (input.tool === "edit" || input.tool === "write") {
29032
+ try {
29033
+ const stats = await countEtsLines(projectDir);
29034
+ log("ETS line count", {
29035
+ fileCount: stats.fileCount,
29036
+ totalLines: stats.totalLines
29037
+ });
29038
+ const sessionID = input.sessionID;
29039
+ if (sessionID) {
29040
+ let session = sessionManager.get(sessionID);
29041
+ if (!session) {
29042
+ session = sessionManager.create(sessionID);
29043
+ }
29044
+ session.data.set("etsStats", stats);
29045
+ }
29046
+ } catch (err) {
29047
+ log("Failed to count .ets lines", { error: String(err) });
29048
+ }
29049
+ }
29050
+ }
29051
+ function injectAiCodeChange(input, output) {
29052
+ try {
29053
+ if (input.tool === "write") {
29054
+ const callID = input.callID;
29055
+ if (!callID) return;
29056
+ const oldContent = writeContentCache.get(callID) ?? "";
29057
+ writeContentCache.delete(callID);
29058
+ const newContent = input.args?.content ?? "";
29059
+ const filePath = input.args?.filePath;
29060
+ if (newContent && filePath) {
29061
+ let additions = 0;
29062
+ let deletions = 0;
29063
+ for (const change of diffLines(oldContent, newContent)) {
29064
+ if (change.added) additions += change.count || 0;
29065
+ if (change.removed) deletions += change.count || 0;
29066
+ }
29067
+ output.metadata.aiCodeChange = {
29068
+ file: filePath,
29069
+ additions,
29070
+ deletions
29071
+ };
29072
+ }
29073
+ } else if (input.tool === "edit") {
29074
+ const filediff = output.metadata?.filediff;
29075
+ const filePath = input.args?.filePath;
29076
+ if (filediff && filePath) {
29077
+ output.metadata.aiCodeChange = {
29078
+ file: filePath,
29079
+ additions: filediff.additions,
29080
+ deletions: filediff.deletions
29081
+ };
29082
+ }
29083
+ }
29084
+ const aiCodeChange = output.metadata?.aiCodeChange;
29085
+ if (aiCodeChange) {
29086
+ log("aiCodeChange injected", { tool: input.tool, ...aiCodeChange });
29087
+ }
29088
+ } catch (e) {
29089
+ log("aiCodeChange after hook error", { tool: input.tool, error: String(e) });
29090
+ }
29091
+ }
27980
29092
 
27981
29093
  // src/commands/env-check.ts
27982
29094
  import { execSync } from "child_process";
@@ -28014,7 +29126,7 @@ function createCommandHooks(ctx) {
28014
29126
  log("Run env check command", result);
28015
29127
  await ctx.client.session.prompt({
28016
29128
  body: {
28017
- parts: [{ type: "text", text: result }],
29129
+ parts: [{ type: "text", text: result, ignored: true }],
28018
29130
  noReply: true
28019
29131
  },
28020
29132
  path: { id: input.sessionID }
@@ -28025,12 +29137,38 @@ function createCommandHooks(ctx) {
28025
29137
  };
28026
29138
  }
28027
29139
 
29140
+ // src/hooks/session-hooks.ts
29141
+ function createSessionHooks(sessionManager, projectDir) {
29142
+ return {
29143
+ event: async ({ event }) => {
29144
+ const props = event.properties;
29145
+ if (!props) return;
29146
+ const sessionID = props.sessionID ?? props.info?.id;
29147
+ if (event.type === "session.created" && sessionID) {
29148
+ const session = sessionManager.create(sessionID);
29149
+ log("Session created via event", { sessionID });
29150
+ try {
29151
+ const stats = await countEtsLines(projectDir);
29152
+ session.data.set("etsStats", stats);
29153
+ log("Initial ETS line count", {
29154
+ sessionID,
29155
+ fileCount: stats.fileCount,
29156
+ totalLines: stats.totalLines
29157
+ });
29158
+ } catch (err) {
29159
+ log("Failed to count initial .ets lines", { sessionID, error: String(err) });
29160
+ }
29161
+ } else if (event.type === "session.deleted" && sessionID) {
29162
+ sessionManager.delete(sessionID);
29163
+ log("Session deleted via event", { sessionID });
29164
+ }
29165
+ }
29166
+ };
29167
+ }
29168
+
28028
29169
  // src/hooks/chat-params.ts
28029
- function createChatParamsHandler(config4) {
29170
+ function createChatParamsHandler(_config) {
28030
29171
  return async (input, output) => {
28031
- const agentConfig = config4.agents?.[input.agent];
28032
- if (agentConfig) {
28033
- }
28034
29172
  };
28035
29173
  }
28036
29174
 
@@ -28042,18 +29180,20 @@ function createChatMessageHandler(_ctx, _managers) {
28042
29180
 
28043
29181
  // src/create-hooks.ts
28044
29182
  function createHooks(args) {
28045
- const { ctx, config: config4, managers } = args;
28046
- const disabledHooks = new Set(config4.disabled_hooks ?? []);
29183
+ const { ctx, config: config3, managers } = args;
29184
+ const disabledHooks = new Set(config3.disabled_hooks ?? []);
28047
29185
  const isHookEnabled = (name) => !disabledHooks.has(name);
28048
29186
  log("Creating hooks", { disabledCount: disabledHooks.size });
28049
29187
  const hooks = {};
28050
- const toolHooks = createToolHooks();
29188
+ const toolHooks = createToolHooks(managers.session, ctx.directory);
28051
29189
  const commandHooks = createCommandHooks(ctx);
29190
+ const sessionHooks = createSessionHooks(managers.session, ctx.directory);
28052
29191
  const registrations = [
28053
29192
  ["tool.execute.before", () => toolHooks["tool.execute.before"]],
28054
29193
  ["tool.execute.after", () => toolHooks["tool.execute.after"]],
28055
29194
  ["command.execute.before", () => commandHooks["command.execute.before"]],
28056
- ["chat.params", () => createChatParamsHandler(config4)],
29195
+ ["event", () => sessionHooks["event"]],
29196
+ ["chat.params", () => createChatParamsHandler(config3)],
28057
29197
  ["chat.message", () => createChatMessageHandler(ctx, managers)]
28058
29198
  ];
28059
29199
  for (const [key, factory] of registrations) {
@@ -28067,13 +29207,13 @@ function createHooks(args) {
28067
29207
  // src/index.ts
28068
29208
  var HMPlugin = async (ctx) => {
28069
29209
  log("Plugin loading", { directory: ctx.directory });
28070
- const config4 = await loadPluginConfig(ctx.directory);
28071
- log("Config loaded", { disabledTools: config4.disabled_tools?.length ?? 0 });
28072
- const state2 = createPluginState();
29210
+ const config3 = await loadPluginConfig(ctx.directory);
29211
+ log("Config loaded", { disabledTools: config3.disabled_tools?.length ?? 0 });
29212
+ const state = createPluginState();
28073
29213
  const agentRegistry = new AgentRegistry();
28074
- const managers = createManagers({ ctx, config: config4, agentRegistry });
28075
- const toolsResult = createTools({ ctx, config: config4, managers });
28076
- const hooks = createHooks({ ctx, config: config4, managers });
29214
+ const managers = createManagers({ ctx, config: config3, agentRegistry });
29215
+ const toolsResult = createTools({ ctx, config: config3, managers });
29216
+ const hooks = createHooks({ ctx, config: config3, managers });
28077
29217
  const pluginInterface = {
28078
29218
  tool: toolsResult.filteredTools,
28079
29219
  config: managers.config,