@harmonyos-arkts/opencode-plugin 0.0.3 → 0.0.5

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 +1648 -529
  2. package/package.json +8 -11
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,27 +15205,18 @@ function createAscfAgent() {
15121
15205
  mode: "primary",
15122
15206
  prompt: buildHmAgentPrompt("ascf"),
15123
15207
  temperature: 0.6,
15124
- permission: {},
15125
- metadata: void 0
15126
- };
15127
- return agent;
15128
- }
15129
-
15130
- // src/agents/one2many-agent.ts
15131
- function getHmOne2ManyDescription() {
15132
- return `
15133
- HarmonyOS One-to-Many Adaptation \u2014 adapts applications for multiple device types (phone, tablet, foldable, 2-in-1, wearable, TV)
15134
- `;
15135
- }
15136
- function createOne2ManyAgent() {
15137
- const agent = {
15138
- id: "harmonyos-one2many",
15139
- name: "harmonyos-one2many",
15140
- description: getHmOne2ManyDescription(),
15141
- mode: "primary",
15142
- prompt: buildHmAgentPrompt("one2many"),
15143
- temperature: 0.3,
15144
- 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
+ },
15145
15220
  metadata: void 0
15146
15221
  };
15147
15222
  return agent;
@@ -15155,7 +15230,6 @@ var AgentRegistry = class {
15155
15230
  this.register(createDesignAgent());
15156
15231
  this.register(createHmDevelopmentAgent());
15157
15232
  this.register(createAscfAgent());
15158
- this.register(createOne2ManyAgent());
15159
15233
  this.register(createHmExploreSubAgent());
15160
15234
  }
15161
15235
  register(agent) {
@@ -15181,13 +15255,13 @@ var AgentRegistry = class {
15181
15255
  return this.agents.delete(id);
15182
15256
  }
15183
15257
  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;
15258
+ const config3 = {};
15259
+ if (agent.description) config3.description = agent.description;
15260
+ if (agent.mode) config3.mode = agent.mode;
15261
+ if (agent.prompt) config3.prompt = agent.prompt;
15262
+ if (agent.temperature !== void 0) config3.temperature = agent.temperature;
15263
+ if (agent.permission) config3.permission = agent.permission;
15264
+ return config3;
15191
15265
  }
15192
15266
  record() {
15193
15267
  const record3 = {};
@@ -15288,7 +15362,57 @@ var AgentManager = class {
15288
15362
  }
15289
15363
  };
15290
15364
 
15365
+ // src/shared/ets-counter.ts
15366
+ import { readdir, readFile as readFile2, stat } from "fs/promises";
15367
+ import { join as join2, extname } from "path";
15368
+ var SKIP_DIRS = /* @__PURE__ */ new Set([
15369
+ "node_modules",
15370
+ ".preview",
15371
+ "build",
15372
+ ".cxx",
15373
+ ".gradle",
15374
+ "oh_modules",
15375
+ ".hvigor",
15376
+ "entry/build"
15377
+ ]);
15378
+ async function collectEtsFiles(dir, results) {
15379
+ let entries;
15380
+ try {
15381
+ entries = await readdir(dir, { withFileTypes: true });
15382
+ } catch {
15383
+ return;
15384
+ }
15385
+ for (const entry of entries) {
15386
+ if (entry.isDirectory()) {
15387
+ if (SKIP_DIRS.has(entry.name)) continue;
15388
+ if (entry.name.startsWith(".") && entry.name !== ".ets") continue;
15389
+ await collectEtsFiles(join2(dir, entry.name), results);
15390
+ } else if (extname(entry.name) === ".ets") {
15391
+ const filePath = join2(dir, entry.name);
15392
+ try {
15393
+ const content = await readFile2(filePath, "utf-8");
15394
+ const lines = content.split("\n").length;
15395
+ results.push({ path: filePath, lines });
15396
+ } catch {
15397
+ log("Failed to read .ets file", { path: filePath });
15398
+ }
15399
+ }
15400
+ }
15401
+ }
15402
+ async function countEtsLines(projectDir) {
15403
+ const files = [];
15404
+ await collectEtsFiles(projectDir, files);
15405
+ const totalLines = files.reduce((sum, f) => sum + f.lines, 0);
15406
+ return {
15407
+ fileCount: files.length,
15408
+ totalLines,
15409
+ files,
15410
+ timestamp: Date.now()
15411
+ };
15412
+ }
15413
+
15291
15414
  // src/managers/config-handler.ts
15415
+ var EXPLORE_ETS_THRESHOLD = 2e3;
15292
15416
  function mergePermission(target, source) {
15293
15417
  if (!target) return source;
15294
15418
  const result = { ...target };
@@ -15303,43 +15427,61 @@ function mergePermission(target, source) {
15303
15427
  }
15304
15428
  return result;
15305
15429
  }
15306
- function createConfigHandler(_pluginConfig, agent) {
15307
- return async (config4) => {
15430
+ function createConfigHandler(_pluginConfig, agent, projectDir) {
15431
+ return async (config3) => {
15432
+ let exploreEnabled = true;
15433
+ try {
15434
+ const stats = await countEtsLines(projectDir);
15435
+ exploreEnabled = stats.totalLines >= EXPLORE_ETS_THRESHOLD;
15436
+ log("ETS count for explore agent", {
15437
+ totalLines: stats.totalLines,
15438
+ fileCount: stats.fileCount,
15439
+ enabled: exploreEnabled
15440
+ });
15441
+ } catch (err) {
15442
+ log("Failed to count ETS lines, enabling explore by default", { error: String(err) });
15443
+ }
15308
15444
  const pluginAgents = agent.record();
15309
- if (config4.agent) {
15445
+ if (config3.agent) {
15310
15446
  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) {
15447
+ if (id === "harmonyos-explore" && !exploreEnabled) {
15448
+ log("Skipping harmonyos-explore agent (insufficient .ets files)");
15449
+ continue;
15450
+ }
15451
+ if (config3.agent[id]) {
15452
+ const merged = { ...config3.agent[id], ...pluginAgentConfig };
15453
+ if (config3.agent[id].permission && pluginAgentConfig.permission) {
15314
15454
  merged.permission = mergePermission(
15315
- config4.agent[id].permission,
15455
+ config3.agent[id].permission,
15316
15456
  pluginAgentConfig.permission
15317
15457
  );
15318
15458
  }
15319
- config4.agent[id] = merged;
15459
+ config3.agent[id] = merged;
15320
15460
  } else {
15321
- config4.agent[id] = pluginAgentConfig;
15461
+ config3.agent[id] = pluginAgentConfig;
15322
15462
  }
15323
15463
  }
15324
- config4.default_agent = "harmonyos-plugin";
15464
+ config3.agent.build = { "disable": true };
15465
+ config3.agent.plan = { "disable": true };
15466
+ config3.default_agent = "harmonyos-plugin";
15325
15467
  }
15326
- config4.command = config4.command || {};
15327
- config4.command["harmony-development-env-check"] = {
15468
+ config3.command = config3.command || {};
15469
+ config3.command["harmony-development-env-check"] = {
15328
15470
  template: "/harmony-development-env-check",
15329
15471
  description: "\u68C0\u67E5 HarmonyOS \u5F00\u53D1\u73AF\u5883\u914D\u7F6E\uFF08Node.js\u3001JDK\u3001ohpm\u3001hvigor\u3001DevEco SDK\uFF09"
15330
15472
  };
15331
- log("Config merged", config4.agent);
15473
+ log("Config merged", config3.agent);
15332
15474
  };
15333
15475
  }
15334
15476
 
15335
15477
  // src/create-managers.ts
15336
15478
  function createManagers(args) {
15337
- const { ctx, config: config4, agentRegistry } = args;
15479
+ const { ctx, config: config3, agentRegistry } = args;
15338
15480
  log("Creating managers");
15339
15481
  const session = new SessionManager();
15340
15482
  const agent = new AgentManager(agentRegistry, ctx);
15341
- const configHandler = createConfigHandler(config4, agent);
15342
- return { config: configHandler };
15483
+ const configHandler = createConfigHandler(config3, agent, ctx.directory);
15484
+ return { config: configHandler, session };
15343
15485
  }
15344
15486
 
15345
15487
  // src/shared/disabled-tools.ts
@@ -15486,7 +15628,7 @@ __export(external_exports2, {
15486
15628
  clone: () => clone2,
15487
15629
  codec: () => codec2,
15488
15630
  coerce: () => coerce_exports2,
15489
- config: () => config3,
15631
+ config: () => config2,
15490
15632
  core: () => core_exports4,
15491
15633
  cuid: () => cuid5,
15492
15634
  cuid2: () => cuid24,
@@ -15852,7 +15994,7 @@ __export(core_exports4, {
15852
15994
  _void: () => _void3,
15853
15995
  _xid: () => _xid2,
15854
15996
  clone: () => clone2,
15855
- config: () => config3,
15997
+ config: () => config2,
15856
15998
  decode: () => decode3,
15857
15999
  decodeAsync: () => decodeAsync3,
15858
16000
  encode: () => encode3,
@@ -15943,7 +16085,7 @@ var $ZodEncodeError2 = class extends Error {
15943
16085
  }
15944
16086
  };
15945
16087
  var globalConfig2 = {};
15946
- function config3(newConfig) {
16088
+ function config2(newConfig) {
15947
16089
  if (newConfig)
15948
16090
  Object.assign(globalConfig2, newConfig);
15949
16091
  return globalConfig2;
@@ -16149,8 +16291,8 @@ function esc2(str) {
16149
16291
  }
16150
16292
  var captureStackTrace2 = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
16151
16293
  };
16152
- function isObject2(data2) {
16153
- return typeof data2 === "object" && data2 !== null && !Array.isArray(data2);
16294
+ function isObject2(data) {
16295
+ return typeof data === "object" && data !== null && !Array.isArray(data);
16154
16296
  }
16155
16297
  var allowsEval2 = cached2(() => {
16156
16298
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
@@ -16185,24 +16327,24 @@ function shallowClone2(o) {
16185
16327
  return [...o];
16186
16328
  return o;
16187
16329
  }
16188
- function numKeys2(data2) {
16330
+ function numKeys2(data) {
16189
16331
  let keyCount = 0;
16190
- for (const key in data2) {
16191
- if (Object.prototype.hasOwnProperty.call(data2, key)) {
16332
+ for (const key in data) {
16333
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
16192
16334
  keyCount++;
16193
16335
  }
16194
16336
  }
16195
16337
  return keyCount;
16196
16338
  }
16197
- var getParsedType2 = (data2) => {
16198
- const t = typeof data2;
16339
+ var getParsedType2 = (data) => {
16340
+ const t = typeof data;
16199
16341
  switch (t) {
16200
16342
  case "undefined":
16201
16343
  return "undefined";
16202
16344
  case "string":
16203
16345
  return "string";
16204
16346
  case "number":
16205
- return Number.isNaN(data2) ? "nan" : "number";
16347
+ return Number.isNaN(data) ? "nan" : "number";
16206
16348
  case "boolean":
16207
16349
  return "boolean";
16208
16350
  case "function":
@@ -16212,25 +16354,25 @@ var getParsedType2 = (data2) => {
16212
16354
  case "symbol":
16213
16355
  return "symbol";
16214
16356
  case "object":
16215
- if (Array.isArray(data2)) {
16357
+ if (Array.isArray(data)) {
16216
16358
  return "array";
16217
16359
  }
16218
- if (data2 === null) {
16360
+ if (data === null) {
16219
16361
  return "null";
16220
16362
  }
16221
- if (data2.then && typeof data2.then === "function" && data2.catch && typeof data2.catch === "function") {
16363
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
16222
16364
  return "promise";
16223
16365
  }
16224
- if (typeof Map !== "undefined" && data2 instanceof Map) {
16366
+ if (typeof Map !== "undefined" && data instanceof Map) {
16225
16367
  return "map";
16226
16368
  }
16227
- if (typeof Set !== "undefined" && data2 instanceof Set) {
16369
+ if (typeof Set !== "undefined" && data instanceof Set) {
16228
16370
  return "set";
16229
16371
  }
16230
- if (typeof Date !== "undefined" && data2 instanceof Date) {
16372
+ if (typeof Date !== "undefined" && data instanceof Date) {
16231
16373
  return "date";
16232
16374
  }
16233
- if (typeof File !== "undefined" && data2 instanceof File) {
16375
+ if (typeof File !== "undefined" && data instanceof File) {
16234
16376
  return "file";
16235
16377
  }
16236
16378
  return "object";
@@ -16495,10 +16637,10 @@ function prefixIssues2(path7, issues) {
16495
16637
  function unwrapMessage2(message) {
16496
16638
  return typeof message === "string" ? message : message?.message;
16497
16639
  }
16498
- function finalizeIssue2(iss, ctx, config4) {
16640
+ function finalizeIssue2(iss, ctx, config3) {
16499
16641
  const full = { ...iss, path: iss.path ?? [] };
16500
16642
  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";
16643
+ const message = unwrapMessage2(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage2(ctx?.error?.(iss)) ?? unwrapMessage2(config3.customError?.(iss)) ?? unwrapMessage2(config3.localeError?.(iss)) ?? "Invalid input";
16502
16644
  full.message = message;
16503
16645
  }
16504
16646
  delete full.inst;
@@ -16733,7 +16875,7 @@ var _parse2 = (_Err) => (schema, value, _ctx, _params) => {
16733
16875
  throw new $ZodAsyncError2();
16734
16876
  }
16735
16877
  if (result.issues.length) {
16736
- const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())));
16878
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())));
16737
16879
  captureStackTrace2(e, _params?.callee);
16738
16880
  throw e;
16739
16881
  }
@@ -16746,7 +16888,7 @@ var _parseAsync2 = (_Err) => async (schema, value, _ctx, params) => {
16746
16888
  if (result instanceof Promise)
16747
16889
  result = await result;
16748
16890
  if (result.issues.length) {
16749
- const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())));
16891
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())));
16750
16892
  captureStackTrace2(e, params?.callee);
16751
16893
  throw e;
16752
16894
  }
@@ -16761,7 +16903,7 @@ var _safeParse2 = (_Err) => (schema, value, _ctx) => {
16761
16903
  }
16762
16904
  return result.issues.length ? {
16763
16905
  success: false,
16764
- error: new (_Err ?? $ZodError2)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())))
16906
+ error: new (_Err ?? $ZodError2)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
16765
16907
  } : { success: true, data: result.value };
16766
16908
  };
16767
16909
  var safeParse3 = /* @__PURE__ */ _safeParse2($ZodRealError2);
@@ -16772,7 +16914,7 @@ var _safeParseAsync2 = (_Err) => async (schema, value, _ctx) => {
16772
16914
  result = await result;
16773
16915
  return result.issues.length ? {
16774
16916
  success: false,
16775
- error: new _Err(result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())))
16917
+ error: new _Err(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
16776
16918
  } : { success: true, data: result.value };
16777
16919
  };
16778
16920
  var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync2($ZodRealError2);
@@ -17868,13 +18010,13 @@ var $ZodCIDRv62 = /* @__PURE__ */ $constructor2("$ZodCIDRv6", (inst, def) => {
17868
18010
  }
17869
18011
  };
17870
18012
  });
17871
- function isValidBase642(data2) {
17872
- if (data2 === "")
18013
+ function isValidBase642(data) {
18014
+ if (data === "")
17873
18015
  return true;
17874
- if (data2.length % 4 !== 0)
18016
+ if (data.length % 4 !== 0)
17875
18017
  return false;
17876
18018
  try {
17877
- atob(data2);
18019
+ atob(data);
17878
18020
  return true;
17879
18021
  } catch {
17880
18022
  return false;
@@ -17898,10 +18040,10 @@ var $ZodBase642 = /* @__PURE__ */ $constructor2("$ZodBase64", (inst, def) => {
17898
18040
  });
17899
18041
  };
17900
18042
  });
17901
- function isValidBase64URL2(data2) {
17902
- if (!base64url3.test(data2))
18043
+ function isValidBase64URL2(data) {
18044
+ if (!base64url3.test(data))
17903
18045
  return false;
17904
- const base645 = data2.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
18046
+ const base645 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
17905
18047
  const padded = base645.padEnd(Math.ceil(base645.length / 4) * 4, "=");
17906
18048
  return isValidBase642(padded);
17907
18049
  }
@@ -18399,7 +18541,7 @@ function handleUnionResults2(results, final, inst, ctx) {
18399
18541
  code: "invalid_union",
18400
18542
  input: final.value,
18401
18543
  inst,
18402
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx, config3())))
18544
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
18403
18545
  });
18404
18546
  return final;
18405
18547
  }
@@ -18725,7 +18867,7 @@ var $ZodRecord2 = /* @__PURE__ */ $constructor2("$ZodRecord", (inst, def) => {
18725
18867
  payload.issues.push({
18726
18868
  code: "invalid_key",
18727
18869
  origin: "record",
18728
- issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config3())),
18870
+ issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2())),
18729
18871
  input: key,
18730
18872
  path: [key],
18731
18873
  inst
@@ -18796,7 +18938,7 @@ function handleMapResult2(keyResult, valueResult, final, key, input, inst, ctx)
18796
18938
  origin: "map",
18797
18939
  input,
18798
18940
  inst,
18799
- issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
18941
+ issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
18800
18942
  });
18801
18943
  }
18802
18944
  }
@@ -18810,7 +18952,7 @@ function handleMapResult2(keyResult, valueResult, final, key, input, inst, ctx)
18810
18952
  input,
18811
18953
  inst,
18812
18954
  key,
18813
- issues: valueResult.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
18955
+ issues: valueResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
18814
18956
  });
18815
18957
  }
18816
18958
  }
@@ -19071,7 +19213,7 @@ var $ZodCatch2 = /* @__PURE__ */ $constructor2("$ZodCatch", (inst, def) => {
19071
19213
  payload.value = def.catchValue({
19072
19214
  ...payload,
19073
19215
  error: {
19074
- issues: result2.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
19216
+ issues: result2.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
19075
19217
  },
19076
19218
  input: payload.value
19077
19219
  });
@@ -19085,7 +19227,7 @@ var $ZodCatch2 = /* @__PURE__ */ $constructor2("$ZodCatch", (inst, def) => {
19085
19227
  payload.value = def.catchValue({
19086
19228
  ...payload,
19087
19229
  error: {
19088
- issues: result.issues.map((iss) => finalizeIssue2(iss, ctx, config3()))
19230
+ issues: result.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
19089
19231
  },
19090
19232
  input: payload.value
19091
19233
  });
@@ -19444,21 +19586,21 @@ var error48 = () => {
19444
19586
  function getSizing(origin) {
19445
19587
  return Sizable[origin] ?? null;
19446
19588
  }
19447
- const parsedType8 = (data2) => {
19448
- const t = typeof data2;
19589
+ const parsedType8 = (data) => {
19590
+ const t = typeof data;
19449
19591
  switch (t) {
19450
19592
  case "number": {
19451
- return Number.isNaN(data2) ? "NaN" : "number";
19593
+ return Number.isNaN(data) ? "NaN" : "number";
19452
19594
  }
19453
19595
  case "object": {
19454
- if (Array.isArray(data2)) {
19596
+ if (Array.isArray(data)) {
19455
19597
  return "array";
19456
19598
  }
19457
- if (data2 === null) {
19599
+ if (data === null) {
19458
19600
  return "null";
19459
19601
  }
19460
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19461
- return data2.constructor.name;
19602
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
19603
+ return data.constructor.name;
19462
19604
  }
19463
19605
  }
19464
19606
  }
@@ -19561,21 +19703,21 @@ var error49 = () => {
19561
19703
  function getSizing(origin) {
19562
19704
  return Sizable[origin] ?? null;
19563
19705
  }
19564
- const parsedType8 = (data2) => {
19565
- const t = typeof data2;
19706
+ const parsedType8 = (data) => {
19707
+ const t = typeof data;
19566
19708
  switch (t) {
19567
19709
  case "number": {
19568
- return Number.isNaN(data2) ? "NaN" : "number";
19710
+ return Number.isNaN(data) ? "NaN" : "number";
19569
19711
  }
19570
19712
  case "object": {
19571
- if (Array.isArray(data2)) {
19713
+ if (Array.isArray(data)) {
19572
19714
  return "array";
19573
19715
  }
19574
- if (data2 === null) {
19716
+ if (data === null) {
19575
19717
  return "null";
19576
19718
  }
19577
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19578
- return data2.constructor.name;
19719
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
19720
+ return data.constructor.name;
19579
19721
  }
19580
19722
  }
19581
19723
  }
@@ -19720,21 +19862,21 @@ var error50 = () => {
19720
19862
  function getSizing(origin) {
19721
19863
  return Sizable[origin] ?? null;
19722
19864
  }
19723
- const parsedType8 = (data2) => {
19724
- const t = typeof data2;
19865
+ const parsedType8 = (data) => {
19866
+ const t = typeof data;
19725
19867
  switch (t) {
19726
19868
  case "number": {
19727
- return Number.isNaN(data2) ? "NaN" : "\u043B\u0456\u043A";
19869
+ return Number.isNaN(data) ? "NaN" : "\u043B\u0456\u043A";
19728
19870
  }
19729
19871
  case "object": {
19730
- if (Array.isArray(data2)) {
19872
+ if (Array.isArray(data)) {
19731
19873
  return "\u043C\u0430\u0441\u0456\u045E";
19732
19874
  }
19733
- if (data2 === null) {
19875
+ if (data === null) {
19734
19876
  return "null";
19735
19877
  }
19736
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19737
- return data2.constructor.name;
19878
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
19879
+ return data.constructor.name;
19738
19880
  }
19739
19881
  }
19740
19882
  }
@@ -19842,21 +19984,21 @@ var error51 = () => {
19842
19984
  function getSizing(origin) {
19843
19985
  return Sizable[origin] ?? null;
19844
19986
  }
19845
- const parsedType8 = (data2) => {
19846
- const t = typeof data2;
19987
+ const parsedType8 = (data) => {
19988
+ const t = typeof data;
19847
19989
  switch (t) {
19848
19990
  case "number": {
19849
- return Number.isNaN(data2) ? "NaN" : "number";
19991
+ return Number.isNaN(data) ? "NaN" : "number";
19850
19992
  }
19851
19993
  case "object": {
19852
- if (Array.isArray(data2)) {
19994
+ if (Array.isArray(data)) {
19853
19995
  return "array";
19854
19996
  }
19855
- if (data2 === null) {
19997
+ if (data === null) {
19856
19998
  return "null";
19857
19999
  }
19858
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19859
- return data2.constructor.name;
20000
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20001
+ return data.constructor.name;
19860
20002
  }
19861
20003
  }
19862
20004
  }
@@ -19962,11 +20104,11 @@ var error52 = () => {
19962
20104
  function getSizing(origin) {
19963
20105
  return Sizable[origin] ?? null;
19964
20106
  }
19965
- const parsedType8 = (data2) => {
19966
- const t = typeof data2;
20107
+ const parsedType8 = (data) => {
20108
+ const t = typeof data;
19967
20109
  switch (t) {
19968
20110
  case "number": {
19969
- return Number.isNaN(data2) ? "NaN" : "\u010D\xEDslo";
20111
+ return Number.isNaN(data) ? "NaN" : "\u010D\xEDslo";
19970
20112
  }
19971
20113
  case "string": {
19972
20114
  return "\u0159et\u011Bzec";
@@ -19987,14 +20129,14 @@ var error52 = () => {
19987
20129
  return "undefined";
19988
20130
  }
19989
20131
  case "object": {
19990
- if (Array.isArray(data2)) {
20132
+ if (Array.isArray(data)) {
19991
20133
  return "pole";
19992
20134
  }
19993
- if (data2 === null) {
20135
+ if (data === null) {
19994
20136
  return "null";
19995
20137
  }
19996
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
19997
- return data2.constructor.name;
20138
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20139
+ return data.constructor.name;
19998
20140
  }
19999
20141
  }
20000
20142
  }
@@ -20110,21 +20252,21 @@ var error53 = () => {
20110
20252
  function getTypeName(type) {
20111
20253
  return TypeNames[type] ?? type;
20112
20254
  }
20113
- const parsedType8 = (data2) => {
20114
- const t = typeof data2;
20255
+ const parsedType8 = (data) => {
20256
+ const t = typeof data;
20115
20257
  switch (t) {
20116
20258
  case "number": {
20117
- return Number.isNaN(data2) ? "NaN" : "tal";
20259
+ return Number.isNaN(data) ? "NaN" : "tal";
20118
20260
  }
20119
20261
  case "object": {
20120
- if (Array.isArray(data2)) {
20262
+ if (Array.isArray(data)) {
20121
20263
  return "liste";
20122
20264
  }
20123
- if (data2 === null) {
20265
+ if (data === null) {
20124
20266
  return "null";
20125
20267
  }
20126
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20127
- return data2.constructor.name;
20268
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20269
+ return data.constructor.name;
20128
20270
  }
20129
20271
  return "objekt";
20130
20272
  }
@@ -20230,21 +20372,21 @@ var error54 = () => {
20230
20372
  function getSizing(origin) {
20231
20373
  return Sizable[origin] ?? null;
20232
20374
  }
20233
- const parsedType8 = (data2) => {
20234
- const t = typeof data2;
20375
+ const parsedType8 = (data) => {
20376
+ const t = typeof data;
20235
20377
  switch (t) {
20236
20378
  case "number": {
20237
- return Number.isNaN(data2) ? "NaN" : "Zahl";
20379
+ return Number.isNaN(data) ? "NaN" : "Zahl";
20238
20380
  }
20239
20381
  case "object": {
20240
- if (Array.isArray(data2)) {
20382
+ if (Array.isArray(data)) {
20241
20383
  return "Array";
20242
20384
  }
20243
- if (data2 === null) {
20385
+ if (data === null) {
20244
20386
  return "null";
20245
20387
  }
20246
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20247
- return data2.constructor.name;
20388
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20389
+ return data.constructor.name;
20248
20390
  }
20249
20391
  }
20250
20392
  }
@@ -20337,21 +20479,21 @@ function de_default2() {
20337
20479
  }
20338
20480
 
20339
20481
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/en.js
20340
- var parsedType2 = (data2) => {
20341
- const t = typeof data2;
20482
+ var parsedType2 = (data) => {
20483
+ const t = typeof data;
20342
20484
  switch (t) {
20343
20485
  case "number": {
20344
- return Number.isNaN(data2) ? "NaN" : "number";
20486
+ return Number.isNaN(data) ? "NaN" : "number";
20345
20487
  }
20346
20488
  case "object": {
20347
- if (Array.isArray(data2)) {
20489
+ if (Array.isArray(data)) {
20348
20490
  return "array";
20349
20491
  }
20350
- if (data2 === null) {
20492
+ if (data === null) {
20351
20493
  return "null";
20352
20494
  }
20353
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20354
- return data2.constructor.name;
20495
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20496
+ return data.constructor.name;
20355
20497
  }
20356
20498
  }
20357
20499
  }
@@ -20455,21 +20597,21 @@ function en_default2() {
20455
20597
  }
20456
20598
 
20457
20599
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/eo.js
20458
- var parsedType3 = (data2) => {
20459
- const t = typeof data2;
20600
+ var parsedType3 = (data) => {
20601
+ const t = typeof data;
20460
20602
  switch (t) {
20461
20603
  case "number": {
20462
- return Number.isNaN(data2) ? "NaN" : "nombro";
20604
+ return Number.isNaN(data) ? "NaN" : "nombro";
20463
20605
  }
20464
20606
  case "object": {
20465
- if (Array.isArray(data2)) {
20607
+ if (Array.isArray(data)) {
20466
20608
  return "tabelo";
20467
20609
  }
20468
- if (data2 === null) {
20610
+ if (data === null) {
20469
20611
  return "senvalora";
20470
20612
  }
20471
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20472
- return data2.constructor.name;
20613
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20614
+ return data.constructor.name;
20473
20615
  }
20474
20616
  }
20475
20617
  }
@@ -20611,21 +20753,21 @@ var error57 = () => {
20611
20753
  function getTypeName(type) {
20612
20754
  return TypeNames[type] ?? type;
20613
20755
  }
20614
- const parsedType8 = (data2) => {
20615
- const t = typeof data2;
20756
+ const parsedType8 = (data) => {
20757
+ const t = typeof data;
20616
20758
  switch (t) {
20617
20759
  case "number": {
20618
- return Number.isNaN(data2) ? "NaN" : "number";
20760
+ return Number.isNaN(data) ? "NaN" : "number";
20619
20761
  }
20620
20762
  case "object": {
20621
- if (Array.isArray(data2)) {
20763
+ if (Array.isArray(data)) {
20622
20764
  return "array";
20623
20765
  }
20624
- if (data2 === null) {
20766
+ if (data === null) {
20625
20767
  return "null";
20626
20768
  }
20627
- if (Object.getPrototypeOf(data2) !== Object.prototype) {
20628
- return data2.constructor.name;
20769
+ if (Object.getPrototypeOf(data) !== Object.prototype) {
20770
+ return data.constructor.name;
20629
20771
  }
20630
20772
  return "object";
20631
20773
  }
@@ -20732,21 +20874,21 @@ var error58 = () => {
20732
20874
  function getSizing(origin) {
20733
20875
  return Sizable[origin] ?? null;
20734
20876
  }
20735
- const parsedType8 = (data2) => {
20736
- const t = typeof data2;
20877
+ const parsedType8 = (data) => {
20878
+ const t = typeof data;
20737
20879
  switch (t) {
20738
20880
  case "number": {
20739
- return Number.isNaN(data2) ? "NaN" : "\u0639\u062F\u062F";
20881
+ return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
20740
20882
  }
20741
20883
  case "object": {
20742
- if (Array.isArray(data2)) {
20884
+ if (Array.isArray(data)) {
20743
20885
  return "\u0622\u0631\u0627\u06CC\u0647";
20744
20886
  }
20745
- if (data2 === null) {
20887
+ if (data === null) {
20746
20888
  return "null";
20747
20889
  }
20748
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20749
- return data2.constructor.name;
20890
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
20891
+ return data.constructor.name;
20750
20892
  }
20751
20893
  }
20752
20894
  }
@@ -20859,21 +21001,21 @@ var error59 = () => {
20859
21001
  function getSizing(origin) {
20860
21002
  return Sizable[origin] ?? null;
20861
21003
  }
20862
- const parsedType8 = (data2) => {
20863
- const t = typeof data2;
21004
+ const parsedType8 = (data) => {
21005
+ const t = typeof data;
20864
21006
  switch (t) {
20865
21007
  case "number": {
20866
- return Number.isNaN(data2) ? "NaN" : "number";
21008
+ return Number.isNaN(data) ? "NaN" : "number";
20867
21009
  }
20868
21010
  case "object": {
20869
- if (Array.isArray(data2)) {
21011
+ if (Array.isArray(data)) {
20870
21012
  return "array";
20871
21013
  }
20872
- if (data2 === null) {
21014
+ if (data === null) {
20873
21015
  return "null";
20874
21016
  }
20875
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20876
- return data2.constructor.name;
21017
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21018
+ return data.constructor.name;
20877
21019
  }
20878
21020
  }
20879
21021
  }
@@ -20978,21 +21120,21 @@ var error60 = () => {
20978
21120
  function getSizing(origin) {
20979
21121
  return Sizable[origin] ?? null;
20980
21122
  }
20981
- const parsedType8 = (data2) => {
20982
- const t = typeof data2;
21123
+ const parsedType8 = (data) => {
21124
+ const t = typeof data;
20983
21125
  switch (t) {
20984
21126
  case "number": {
20985
- return Number.isNaN(data2) ? "NaN" : "nombre";
21127
+ return Number.isNaN(data) ? "NaN" : "nombre";
20986
21128
  }
20987
21129
  case "object": {
20988
- if (Array.isArray(data2)) {
21130
+ if (Array.isArray(data)) {
20989
21131
  return "tableau";
20990
21132
  }
20991
- if (data2 === null) {
21133
+ if (data === null) {
20992
21134
  return "null";
20993
21135
  }
20994
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
20995
- return data2.constructor.name;
21136
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21137
+ return data.constructor.name;
20996
21138
  }
20997
21139
  }
20998
21140
  }
@@ -21095,21 +21237,21 @@ var error61 = () => {
21095
21237
  function getSizing(origin) {
21096
21238
  return Sizable[origin] ?? null;
21097
21239
  }
21098
- const parsedType8 = (data2) => {
21099
- const t = typeof data2;
21240
+ const parsedType8 = (data) => {
21241
+ const t = typeof data;
21100
21242
  switch (t) {
21101
21243
  case "number": {
21102
- return Number.isNaN(data2) ? "NaN" : "number";
21244
+ return Number.isNaN(data) ? "NaN" : "number";
21103
21245
  }
21104
21246
  case "object": {
21105
- if (Array.isArray(data2)) {
21247
+ if (Array.isArray(data)) {
21106
21248
  return "array";
21107
21249
  }
21108
- if (data2 === null) {
21250
+ if (data === null) {
21109
21251
  return "null";
21110
21252
  }
21111
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21112
- return data2.constructor.name;
21253
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21254
+ return data.constructor.name;
21113
21255
  }
21114
21256
  }
21115
21257
  }
@@ -21213,21 +21355,21 @@ var error62 = () => {
21213
21355
  function getSizing(origin) {
21214
21356
  return Sizable[origin] ?? null;
21215
21357
  }
21216
- const parsedType8 = (data2) => {
21217
- const t = typeof data2;
21358
+ const parsedType8 = (data) => {
21359
+ const t = typeof data;
21218
21360
  switch (t) {
21219
21361
  case "number": {
21220
- return Number.isNaN(data2) ? "NaN" : "number";
21362
+ return Number.isNaN(data) ? "NaN" : "number";
21221
21363
  }
21222
21364
  case "object": {
21223
- if (Array.isArray(data2)) {
21365
+ if (Array.isArray(data)) {
21224
21366
  return "array";
21225
21367
  }
21226
- if (data2 === null) {
21368
+ if (data === null) {
21227
21369
  return "null";
21228
21370
  }
21229
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21230
- return data2.constructor.name;
21371
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21372
+ return data.constructor.name;
21231
21373
  }
21232
21374
  }
21233
21375
  }
@@ -21331,21 +21473,21 @@ var error63 = () => {
21331
21473
  function getSizing(origin) {
21332
21474
  return Sizable[origin] ?? null;
21333
21475
  }
21334
- const parsedType8 = (data2) => {
21335
- const t = typeof data2;
21476
+ const parsedType8 = (data) => {
21477
+ const t = typeof data;
21336
21478
  switch (t) {
21337
21479
  case "number": {
21338
- return Number.isNaN(data2) ? "NaN" : "sz\xE1m";
21480
+ return Number.isNaN(data) ? "NaN" : "sz\xE1m";
21339
21481
  }
21340
21482
  case "object": {
21341
- if (Array.isArray(data2)) {
21483
+ if (Array.isArray(data)) {
21342
21484
  return "t\xF6mb";
21343
21485
  }
21344
- if (data2 === null) {
21486
+ if (data === null) {
21345
21487
  return "null";
21346
21488
  }
21347
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21348
- return data2.constructor.name;
21489
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21490
+ return data.constructor.name;
21349
21491
  }
21350
21492
  }
21351
21493
  }
@@ -21449,21 +21591,21 @@ var error64 = () => {
21449
21591
  function getSizing(origin) {
21450
21592
  return Sizable[origin] ?? null;
21451
21593
  }
21452
- const parsedType8 = (data2) => {
21453
- const t = typeof data2;
21594
+ const parsedType8 = (data) => {
21595
+ const t = typeof data;
21454
21596
  switch (t) {
21455
21597
  case "number": {
21456
- return Number.isNaN(data2) ? "NaN" : "number";
21598
+ return Number.isNaN(data) ? "NaN" : "number";
21457
21599
  }
21458
21600
  case "object": {
21459
- if (Array.isArray(data2)) {
21601
+ if (Array.isArray(data)) {
21460
21602
  return "array";
21461
21603
  }
21462
- if (data2 === null) {
21604
+ if (data === null) {
21463
21605
  return "null";
21464
21606
  }
21465
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21466
- return data2.constructor.name;
21607
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21608
+ return data.constructor.name;
21467
21609
  }
21468
21610
  }
21469
21611
  }
@@ -21556,21 +21698,21 @@ function id_default2() {
21556
21698
  }
21557
21699
 
21558
21700
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/is.js
21559
- var parsedType4 = (data2) => {
21560
- const t = typeof data2;
21701
+ var parsedType4 = (data) => {
21702
+ const t = typeof data;
21561
21703
  switch (t) {
21562
21704
  case "number": {
21563
- return Number.isNaN(data2) ? "NaN" : "n\xFAmer";
21705
+ return Number.isNaN(data) ? "NaN" : "n\xFAmer";
21564
21706
  }
21565
21707
  case "object": {
21566
- if (Array.isArray(data2)) {
21708
+ if (Array.isArray(data)) {
21567
21709
  return "fylki";
21568
21710
  }
21569
- if (data2 === null) {
21711
+ if (data === null) {
21570
21712
  return "null";
21571
21713
  }
21572
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21573
- return data2.constructor.name;
21714
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21715
+ return data.constructor.name;
21574
21716
  }
21575
21717
  }
21576
21718
  }
@@ -21684,21 +21826,21 @@ var error66 = () => {
21684
21826
  function getSizing(origin) {
21685
21827
  return Sizable[origin] ?? null;
21686
21828
  }
21687
- const parsedType8 = (data2) => {
21688
- const t = typeof data2;
21829
+ const parsedType8 = (data) => {
21830
+ const t = typeof data;
21689
21831
  switch (t) {
21690
21832
  case "number": {
21691
- return Number.isNaN(data2) ? "NaN" : "numero";
21833
+ return Number.isNaN(data) ? "NaN" : "numero";
21692
21834
  }
21693
21835
  case "object": {
21694
- if (Array.isArray(data2)) {
21836
+ if (Array.isArray(data)) {
21695
21837
  return "vettore";
21696
21838
  }
21697
- if (data2 === null) {
21839
+ if (data === null) {
21698
21840
  return "null";
21699
21841
  }
21700
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21701
- return data2.constructor.name;
21842
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21843
+ return data.constructor.name;
21702
21844
  }
21703
21845
  }
21704
21846
  }
@@ -21802,21 +21944,21 @@ var error67 = () => {
21802
21944
  function getSizing(origin) {
21803
21945
  return Sizable[origin] ?? null;
21804
21946
  }
21805
- const parsedType8 = (data2) => {
21806
- const t = typeof data2;
21947
+ const parsedType8 = (data) => {
21948
+ const t = typeof data;
21807
21949
  switch (t) {
21808
21950
  case "number": {
21809
- return Number.isNaN(data2) ? "NaN" : "\u6570\u5024";
21951
+ return Number.isNaN(data) ? "NaN" : "\u6570\u5024";
21810
21952
  }
21811
21953
  case "object": {
21812
- if (Array.isArray(data2)) {
21954
+ if (Array.isArray(data)) {
21813
21955
  return "\u914D\u5217";
21814
21956
  }
21815
- if (data2 === null) {
21957
+ if (data === null) {
21816
21958
  return "null";
21817
21959
  }
21818
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21819
- return data2.constructor.name;
21960
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21961
+ return data.constructor.name;
21820
21962
  }
21821
21963
  }
21822
21964
  }
@@ -21908,21 +22050,21 @@ function ja_default2() {
21908
22050
  }
21909
22051
 
21910
22052
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ka.js
21911
- var parsedType5 = (data2) => {
21912
- const t = typeof data2;
22053
+ var parsedType5 = (data) => {
22054
+ const t = typeof data;
21913
22055
  switch (t) {
21914
22056
  case "number": {
21915
- return Number.isNaN(data2) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";
22057
+ return Number.isNaN(data) ? "NaN" : "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8";
21916
22058
  }
21917
22059
  case "object": {
21918
- if (Array.isArray(data2)) {
22060
+ if (Array.isArray(data)) {
21919
22061
  return "\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8";
21920
22062
  }
21921
- if (data2 === null) {
22063
+ if (data === null) {
21922
22064
  return "null";
21923
22065
  }
21924
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
21925
- return data2.constructor.name;
22066
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22067
+ return data.constructor.name;
21926
22068
  }
21927
22069
  }
21928
22070
  }
@@ -22044,21 +22186,21 @@ var error69 = () => {
22044
22186
  function getSizing(origin) {
22045
22187
  return Sizable[origin] ?? null;
22046
22188
  }
22047
- const parsedType8 = (data2) => {
22048
- const t = typeof data2;
22189
+ const parsedType8 = (data) => {
22190
+ const t = typeof data;
22049
22191
  switch (t) {
22050
22192
  case "number": {
22051
- return Number.isNaN(data2) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781";
22193
+ return Number.isNaN(data) ? "\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)" : "\u179B\u17C1\u1781";
22052
22194
  }
22053
22195
  case "object": {
22054
- if (Array.isArray(data2)) {
22196
+ if (Array.isArray(data)) {
22055
22197
  return "\u17A2\u17B6\u179A\u17C1 (Array)";
22056
22198
  }
22057
- if (data2 === null) {
22199
+ if (data === null) {
22058
22200
  return "\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";
22059
22201
  }
22060
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22061
- return data2.constructor.name;
22202
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22203
+ return data.constructor.name;
22062
22204
  }
22063
22205
  }
22064
22206
  }
@@ -22167,21 +22309,21 @@ var error70 = () => {
22167
22309
  function getSizing(origin) {
22168
22310
  return Sizable[origin] ?? null;
22169
22311
  }
22170
- const parsedType8 = (data2) => {
22171
- const t = typeof data2;
22312
+ const parsedType8 = (data) => {
22313
+ const t = typeof data;
22172
22314
  switch (t) {
22173
22315
  case "number": {
22174
- return Number.isNaN(data2) ? "NaN" : "number";
22316
+ return Number.isNaN(data) ? "NaN" : "number";
22175
22317
  }
22176
22318
  case "object": {
22177
- if (Array.isArray(data2)) {
22319
+ if (Array.isArray(data)) {
22178
22320
  return "array";
22179
22321
  }
22180
- if (data2 === null) {
22322
+ if (data === null) {
22181
22323
  return "null";
22182
22324
  }
22183
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22184
- return data2.constructor.name;
22325
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22326
+ return data.constructor.name;
22185
22327
  }
22186
22328
  }
22187
22329
  }
@@ -22279,14 +22421,14 @@ function ko_default2() {
22279
22421
  }
22280
22422
 
22281
22423
  // 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);
22424
+ var parsedType6 = (data) => {
22425
+ const t = typeof data;
22426
+ return parsedTypeFromType(t, data);
22285
22427
  };
22286
- var parsedTypeFromType = (t, data2 = void 0) => {
22428
+ var parsedTypeFromType = (t, data = void 0) => {
22287
22429
  switch (t) {
22288
22430
  case "number": {
22289
- return Number.isNaN(data2) ? "NaN" : "skai\u010Dius";
22431
+ return Number.isNaN(data) ? "NaN" : "skai\u010Dius";
22290
22432
  }
22291
22433
  case "bigint": {
22292
22434
  return "sveikasis skai\u010Dius";
@@ -22308,14 +22450,14 @@ var parsedTypeFromType = (t, data2 = void 0) => {
22308
22450
  return "simbolis";
22309
22451
  }
22310
22452
  case "object": {
22311
- if (data2 === void 0)
22453
+ if (data === void 0)
22312
22454
  return "ne\u017Einomas objektas";
22313
- if (data2 === null)
22455
+ if (data === null)
22314
22456
  return "nulin\u0117 reik\u0161m\u0117";
22315
- if (Array.isArray(data2))
22457
+ if (Array.isArray(data))
22316
22458
  return "masyvas";
22317
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22318
- return data2.constructor.name;
22459
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22460
+ return data.constructor.name;
22319
22461
  }
22320
22462
  return "objektas";
22321
22463
  }
@@ -22520,21 +22662,21 @@ var error72 = () => {
22520
22662
  function getSizing(origin) {
22521
22663
  return Sizable[origin] ?? null;
22522
22664
  }
22523
- const parsedType8 = (data2) => {
22524
- const t = typeof data2;
22665
+ const parsedType8 = (data) => {
22666
+ const t = typeof data;
22525
22667
  switch (t) {
22526
22668
  case "number": {
22527
- return Number.isNaN(data2) ? "NaN" : "\u0431\u0440\u043E\u0458";
22669
+ return Number.isNaN(data) ? "NaN" : "\u0431\u0440\u043E\u0458";
22528
22670
  }
22529
22671
  case "object": {
22530
- if (Array.isArray(data2)) {
22672
+ if (Array.isArray(data)) {
22531
22673
  return "\u043D\u0438\u0437\u0430";
22532
22674
  }
22533
- if (data2 === null) {
22675
+ if (data === null) {
22534
22676
  return "null";
22535
22677
  }
22536
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22537
- return data2.constructor.name;
22678
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22679
+ return data.constructor.name;
22538
22680
  }
22539
22681
  }
22540
22682
  }
@@ -22639,21 +22781,21 @@ var error73 = () => {
22639
22781
  function getSizing(origin) {
22640
22782
  return Sizable[origin] ?? null;
22641
22783
  }
22642
- const parsedType8 = (data2) => {
22643
- const t = typeof data2;
22784
+ const parsedType8 = (data) => {
22785
+ const t = typeof data;
22644
22786
  switch (t) {
22645
22787
  case "number": {
22646
- return Number.isNaN(data2) ? "NaN" : "nombor";
22788
+ return Number.isNaN(data) ? "NaN" : "nombor";
22647
22789
  }
22648
22790
  case "object": {
22649
- if (Array.isArray(data2)) {
22791
+ if (Array.isArray(data)) {
22650
22792
  return "array";
22651
22793
  }
22652
- if (data2 === null) {
22794
+ if (data === null) {
22653
22795
  return "null";
22654
22796
  }
22655
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22656
- return data2.constructor.name;
22797
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22798
+ return data.constructor.name;
22657
22799
  }
22658
22800
  }
22659
22801
  }
@@ -22756,21 +22898,21 @@ var error74 = () => {
22756
22898
  function getSizing(origin) {
22757
22899
  return Sizable[origin] ?? null;
22758
22900
  }
22759
- const parsedType8 = (data2) => {
22760
- const t = typeof data2;
22901
+ const parsedType8 = (data) => {
22902
+ const t = typeof data;
22761
22903
  switch (t) {
22762
22904
  case "number": {
22763
- return Number.isNaN(data2) ? "NaN" : "getal";
22905
+ return Number.isNaN(data) ? "NaN" : "getal";
22764
22906
  }
22765
22907
  case "object": {
22766
- if (Array.isArray(data2)) {
22908
+ if (Array.isArray(data)) {
22767
22909
  return "array";
22768
22910
  }
22769
- if (data2 === null) {
22911
+ if (data === null) {
22770
22912
  return "null";
22771
22913
  }
22772
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22773
- return data2.constructor.name;
22914
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
22915
+ return data.constructor.name;
22774
22916
  }
22775
22917
  }
22776
22918
  }
@@ -22874,21 +23016,21 @@ var error75 = () => {
22874
23016
  function getSizing(origin) {
22875
23017
  return Sizable[origin] ?? null;
22876
23018
  }
22877
- const parsedType8 = (data2) => {
22878
- const t = typeof data2;
23019
+ const parsedType8 = (data) => {
23020
+ const t = typeof data;
22879
23021
  switch (t) {
22880
23022
  case "number": {
22881
- return Number.isNaN(data2) ? "NaN" : "tall";
23023
+ return Number.isNaN(data) ? "NaN" : "tall";
22882
23024
  }
22883
23025
  case "object": {
22884
- if (Array.isArray(data2)) {
23026
+ if (Array.isArray(data)) {
22885
23027
  return "liste";
22886
23028
  }
22887
- if (data2 === null) {
23029
+ if (data === null) {
22888
23030
  return "null";
22889
23031
  }
22890
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
22891
- return data2.constructor.name;
23032
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23033
+ return data.constructor.name;
22892
23034
  }
22893
23035
  }
22894
23036
  }
@@ -22991,21 +23133,21 @@ var error76 = () => {
22991
23133
  function getSizing(origin) {
22992
23134
  return Sizable[origin] ?? null;
22993
23135
  }
22994
- const parsedType8 = (data2) => {
22995
- const t = typeof data2;
23136
+ const parsedType8 = (data) => {
23137
+ const t = typeof data;
22996
23138
  switch (t) {
22997
23139
  case "number": {
22998
- return Number.isNaN(data2) ? "NaN" : "numara";
23140
+ return Number.isNaN(data) ? "NaN" : "numara";
22999
23141
  }
23000
23142
  case "object": {
23001
- if (Array.isArray(data2)) {
23143
+ if (Array.isArray(data)) {
23002
23144
  return "saf";
23003
23145
  }
23004
- if (data2 === null) {
23146
+ if (data === null) {
23005
23147
  return "gayb";
23006
23148
  }
23007
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23008
- return data2.constructor.name;
23149
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23150
+ return data.constructor.name;
23009
23151
  }
23010
23152
  }
23011
23153
  }
@@ -23109,21 +23251,21 @@ var error77 = () => {
23109
23251
  function getSizing(origin) {
23110
23252
  return Sizable[origin] ?? null;
23111
23253
  }
23112
- const parsedType8 = (data2) => {
23113
- const t = typeof data2;
23254
+ const parsedType8 = (data) => {
23255
+ const t = typeof data;
23114
23256
  switch (t) {
23115
23257
  case "number": {
23116
- return Number.isNaN(data2) ? "NaN" : "\u0639\u062F\u062F";
23258
+ return Number.isNaN(data) ? "NaN" : "\u0639\u062F\u062F";
23117
23259
  }
23118
23260
  case "object": {
23119
- if (Array.isArray(data2)) {
23261
+ if (Array.isArray(data)) {
23120
23262
  return "\u0627\u0631\u06D0";
23121
23263
  }
23122
- if (data2 === null) {
23264
+ if (data === null) {
23123
23265
  return "null";
23124
23266
  }
23125
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23126
- return data2.constructor.name;
23267
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23268
+ return data.constructor.name;
23127
23269
  }
23128
23270
  }
23129
23271
  }
@@ -23232,21 +23374,21 @@ var error78 = () => {
23232
23374
  function getSizing(origin) {
23233
23375
  return Sizable[origin] ?? null;
23234
23376
  }
23235
- const parsedType8 = (data2) => {
23236
- const t = typeof data2;
23377
+ const parsedType8 = (data) => {
23378
+ const t = typeof data;
23237
23379
  switch (t) {
23238
23380
  case "number": {
23239
- return Number.isNaN(data2) ? "NaN" : "liczba";
23381
+ return Number.isNaN(data) ? "NaN" : "liczba";
23240
23382
  }
23241
23383
  case "object": {
23242
- if (Array.isArray(data2)) {
23384
+ if (Array.isArray(data)) {
23243
23385
  return "tablica";
23244
23386
  }
23245
- if (data2 === null) {
23387
+ if (data === null) {
23246
23388
  return "null";
23247
23389
  }
23248
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23249
- return data2.constructor.name;
23390
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23391
+ return data.constructor.name;
23250
23392
  }
23251
23393
  }
23252
23394
  }
@@ -23350,21 +23492,21 @@ var error79 = () => {
23350
23492
  function getSizing(origin) {
23351
23493
  return Sizable[origin] ?? null;
23352
23494
  }
23353
- const parsedType8 = (data2) => {
23354
- const t = typeof data2;
23495
+ const parsedType8 = (data) => {
23496
+ const t = typeof data;
23355
23497
  switch (t) {
23356
23498
  case "number": {
23357
- return Number.isNaN(data2) ? "NaN" : "n\xFAmero";
23499
+ return Number.isNaN(data) ? "NaN" : "n\xFAmero";
23358
23500
  }
23359
23501
  case "object": {
23360
- if (Array.isArray(data2)) {
23502
+ if (Array.isArray(data)) {
23361
23503
  return "array";
23362
23504
  }
23363
- if (data2 === null) {
23505
+ if (data === null) {
23364
23506
  return "nulo";
23365
23507
  }
23366
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23367
- return data2.constructor.name;
23508
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23509
+ return data.constructor.name;
23368
23510
  }
23369
23511
  }
23370
23512
  }
@@ -23510,21 +23652,21 @@ var error80 = () => {
23510
23652
  function getSizing(origin) {
23511
23653
  return Sizable[origin] ?? null;
23512
23654
  }
23513
- const parsedType8 = (data2) => {
23514
- const t = typeof data2;
23655
+ const parsedType8 = (data) => {
23656
+ const t = typeof data;
23515
23657
  switch (t) {
23516
23658
  case "number": {
23517
- return Number.isNaN(data2) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
23659
+ return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
23518
23660
  }
23519
23661
  case "object": {
23520
- if (Array.isArray(data2)) {
23662
+ if (Array.isArray(data)) {
23521
23663
  return "\u043C\u0430\u0441\u0441\u0438\u0432";
23522
23664
  }
23523
- if (data2 === null) {
23665
+ if (data === null) {
23524
23666
  return "null";
23525
23667
  }
23526
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23527
- return data2.constructor.name;
23668
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23669
+ return data.constructor.name;
23528
23670
  }
23529
23671
  }
23530
23672
  }
@@ -23632,21 +23774,21 @@ var error81 = () => {
23632
23774
  function getSizing(origin) {
23633
23775
  return Sizable[origin] ?? null;
23634
23776
  }
23635
- const parsedType8 = (data2) => {
23636
- const t = typeof data2;
23777
+ const parsedType8 = (data) => {
23778
+ const t = typeof data;
23637
23779
  switch (t) {
23638
23780
  case "number": {
23639
- return Number.isNaN(data2) ? "NaN" : "\u0161tevilo";
23781
+ return Number.isNaN(data) ? "NaN" : "\u0161tevilo";
23640
23782
  }
23641
23783
  case "object": {
23642
- if (Array.isArray(data2)) {
23784
+ if (Array.isArray(data)) {
23643
23785
  return "tabela";
23644
23786
  }
23645
- if (data2 === null) {
23787
+ if (data === null) {
23646
23788
  return "null";
23647
23789
  }
23648
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23649
- return data2.constructor.name;
23790
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23791
+ return data.constructor.name;
23650
23792
  }
23651
23793
  }
23652
23794
  }
@@ -23750,21 +23892,21 @@ var error82 = () => {
23750
23892
  function getSizing(origin) {
23751
23893
  return Sizable[origin] ?? null;
23752
23894
  }
23753
- const parsedType8 = (data2) => {
23754
- const t = typeof data2;
23895
+ const parsedType8 = (data) => {
23896
+ const t = typeof data;
23755
23897
  switch (t) {
23756
23898
  case "number": {
23757
- return Number.isNaN(data2) ? "NaN" : "antal";
23899
+ return Number.isNaN(data) ? "NaN" : "antal";
23758
23900
  }
23759
23901
  case "object": {
23760
- if (Array.isArray(data2)) {
23902
+ if (Array.isArray(data)) {
23761
23903
  return "lista";
23762
23904
  }
23763
- if (data2 === null) {
23905
+ if (data === null) {
23764
23906
  return "null";
23765
23907
  }
23766
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23767
- return data2.constructor.name;
23908
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23909
+ return data.constructor.name;
23768
23910
  }
23769
23911
  }
23770
23912
  }
@@ -23869,21 +24011,21 @@ var error83 = () => {
23869
24011
  function getSizing(origin) {
23870
24012
  return Sizable[origin] ?? null;
23871
24013
  }
23872
- const parsedType8 = (data2) => {
23873
- const t = typeof data2;
24014
+ const parsedType8 = (data) => {
24015
+ const t = typeof data;
23874
24016
  switch (t) {
23875
24017
  case "number": {
23876
- return Number.isNaN(data2) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD";
24018
+ return Number.isNaN(data) ? "\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1" : "\u0B8E\u0BA3\u0BCD";
23877
24019
  }
23878
24020
  case "object": {
23879
- if (Array.isArray(data2)) {
24021
+ if (Array.isArray(data)) {
23880
24022
  return "\u0B85\u0BA3\u0BBF";
23881
24023
  }
23882
- if (data2 === null) {
24024
+ if (data === null) {
23883
24025
  return "\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";
23884
24026
  }
23885
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
23886
- return data2.constructor.name;
24027
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24028
+ return data.constructor.name;
23887
24029
  }
23888
24030
  }
23889
24031
  }
@@ -23987,21 +24129,21 @@ var error84 = () => {
23987
24129
  function getSizing(origin) {
23988
24130
  return Sizable[origin] ?? null;
23989
24131
  }
23990
- const parsedType8 = (data2) => {
23991
- const t = typeof data2;
24132
+ const parsedType8 = (data) => {
24133
+ const t = typeof data;
23992
24134
  switch (t) {
23993
24135
  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";
24136
+ return Number.isNaN(data) ? "\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";
23995
24137
  }
23996
24138
  case "object": {
23997
- if (Array.isArray(data2)) {
24139
+ if (Array.isArray(data)) {
23998
24140
  return "\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";
23999
24141
  }
24000
- if (data2 === null) {
24142
+ if (data === null) {
24001
24143
  return "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";
24002
24144
  }
24003
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24004
- return data2.constructor.name;
24145
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24146
+ return data.constructor.name;
24005
24147
  }
24006
24148
  }
24007
24149
  }
@@ -24095,21 +24237,21 @@ function th_default2() {
24095
24237
  }
24096
24238
 
24097
24239
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/tr.js
24098
- var parsedType7 = (data2) => {
24099
- const t = typeof data2;
24240
+ var parsedType7 = (data) => {
24241
+ const t = typeof data;
24100
24242
  switch (t) {
24101
24243
  case "number": {
24102
- return Number.isNaN(data2) ? "NaN" : "number";
24244
+ return Number.isNaN(data) ? "NaN" : "number";
24103
24245
  }
24104
24246
  case "object": {
24105
- if (Array.isArray(data2)) {
24247
+ if (Array.isArray(data)) {
24106
24248
  return "array";
24107
24249
  }
24108
- if (data2 === null) {
24250
+ if (data === null) {
24109
24251
  return "null";
24110
24252
  }
24111
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24112
- return data2.constructor.name;
24253
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24254
+ return data.constructor.name;
24113
24255
  }
24114
24256
  }
24115
24257
  }
@@ -24221,21 +24363,21 @@ var error86 = () => {
24221
24363
  function getSizing(origin) {
24222
24364
  return Sizable[origin] ?? null;
24223
24365
  }
24224
- const parsedType8 = (data2) => {
24225
- const t = typeof data2;
24366
+ const parsedType8 = (data) => {
24367
+ const t = typeof data;
24226
24368
  switch (t) {
24227
24369
  case "number": {
24228
- return Number.isNaN(data2) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
24370
+ return Number.isNaN(data) ? "NaN" : "\u0447\u0438\u0441\u043B\u043E";
24229
24371
  }
24230
24372
  case "object": {
24231
- if (Array.isArray(data2)) {
24373
+ if (Array.isArray(data)) {
24232
24374
  return "\u043C\u0430\u0441\u0438\u0432";
24233
24375
  }
24234
- if (data2 === null) {
24376
+ if (data === null) {
24235
24377
  return "null";
24236
24378
  }
24237
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24238
- return data2.constructor.name;
24379
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24380
+ return data.constructor.name;
24239
24381
  }
24240
24382
  }
24241
24383
  }
@@ -24344,21 +24486,21 @@ var error87 = () => {
24344
24486
  function getSizing(origin) {
24345
24487
  return Sizable[origin] ?? null;
24346
24488
  }
24347
- const parsedType8 = (data2) => {
24348
- const t = typeof data2;
24489
+ const parsedType8 = (data) => {
24490
+ const t = typeof data;
24349
24491
  switch (t) {
24350
24492
  case "number": {
24351
- return Number.isNaN(data2) ? "NaN" : "\u0646\u0645\u0628\u0631";
24493
+ return Number.isNaN(data) ? "NaN" : "\u0646\u0645\u0628\u0631";
24352
24494
  }
24353
24495
  case "object": {
24354
- if (Array.isArray(data2)) {
24496
+ if (Array.isArray(data)) {
24355
24497
  return "\u0622\u0631\u06D2";
24356
24498
  }
24357
- if (data2 === null) {
24499
+ if (data === null) {
24358
24500
  return "\u0646\u0644";
24359
24501
  }
24360
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24361
- return data2.constructor.name;
24502
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24503
+ return data.constructor.name;
24362
24504
  }
24363
24505
  }
24364
24506
  }
@@ -24462,21 +24604,21 @@ var error88 = () => {
24462
24604
  function getSizing(origin) {
24463
24605
  return Sizable[origin] ?? null;
24464
24606
  }
24465
- const parsedType8 = (data2) => {
24466
- const t = typeof data2;
24607
+ const parsedType8 = (data) => {
24608
+ const t = typeof data;
24467
24609
  switch (t) {
24468
24610
  case "number": {
24469
- return Number.isNaN(data2) ? "NaN" : "s\u1ED1";
24611
+ return Number.isNaN(data) ? "NaN" : "s\u1ED1";
24470
24612
  }
24471
24613
  case "object": {
24472
- if (Array.isArray(data2)) {
24614
+ if (Array.isArray(data)) {
24473
24615
  return "m\u1EA3ng";
24474
24616
  }
24475
- if (data2 === null) {
24617
+ if (data === null) {
24476
24618
  return "null";
24477
24619
  }
24478
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24479
- return data2.constructor.name;
24620
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24621
+ return data.constructor.name;
24480
24622
  }
24481
24623
  }
24482
24624
  }
@@ -24579,21 +24721,21 @@ var error89 = () => {
24579
24721
  function getSizing(origin) {
24580
24722
  return Sizable[origin] ?? null;
24581
24723
  }
24582
- const parsedType8 = (data2) => {
24583
- const t = typeof data2;
24724
+ const parsedType8 = (data) => {
24725
+ const t = typeof data;
24584
24726
  switch (t) {
24585
24727
  case "number": {
24586
- return Number.isNaN(data2) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57";
24728
+ return Number.isNaN(data) ? "\u975E\u6570\u5B57(NaN)" : "\u6570\u5B57";
24587
24729
  }
24588
24730
  case "object": {
24589
- if (Array.isArray(data2)) {
24731
+ if (Array.isArray(data)) {
24590
24732
  return "\u6570\u7EC4";
24591
24733
  }
24592
- if (data2 === null) {
24734
+ if (data === null) {
24593
24735
  return "\u7A7A\u503C(null)";
24594
24736
  }
24595
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24596
- return data2.constructor.name;
24737
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24738
+ return data.constructor.name;
24597
24739
  }
24598
24740
  }
24599
24741
  }
@@ -24696,21 +24838,21 @@ var error90 = () => {
24696
24838
  function getSizing(origin) {
24697
24839
  return Sizable[origin] ?? null;
24698
24840
  }
24699
- const parsedType8 = (data2) => {
24700
- const t = typeof data2;
24841
+ const parsedType8 = (data) => {
24842
+ const t = typeof data;
24701
24843
  switch (t) {
24702
24844
  case "number": {
24703
- return Number.isNaN(data2) ? "NaN" : "number";
24845
+ return Number.isNaN(data) ? "NaN" : "number";
24704
24846
  }
24705
24847
  case "object": {
24706
- if (Array.isArray(data2)) {
24848
+ if (Array.isArray(data)) {
24707
24849
  return "array";
24708
24850
  }
24709
- if (data2 === null) {
24851
+ if (data === null) {
24710
24852
  return "null";
24711
24853
  }
24712
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24713
- return data2.constructor.name;
24854
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24855
+ return data.constructor.name;
24714
24856
  }
24715
24857
  }
24716
24858
  }
@@ -24814,21 +24956,21 @@ var error91 = () => {
24814
24956
  function getSizing(origin) {
24815
24957
  return Sizable[origin] ?? null;
24816
24958
  }
24817
- const parsedType8 = (data2) => {
24818
- const t = typeof data2;
24959
+ const parsedType8 = (data) => {
24960
+ const t = typeof data;
24819
24961
  switch (t) {
24820
24962
  case "number": {
24821
- return Number.isNaN(data2) ? "NaN" : "n\u1ECD\u0301mb\xE0";
24963
+ return Number.isNaN(data) ? "NaN" : "n\u1ECD\u0301mb\xE0";
24822
24964
  }
24823
24965
  case "object": {
24824
- if (Array.isArray(data2)) {
24966
+ if (Array.isArray(data)) {
24825
24967
  return "akop\u1ECD";
24826
24968
  }
24827
- if (data2 === null) {
24969
+ if (data === null) {
24828
24970
  return "null";
24829
24971
  }
24830
- if (Object.getPrototypeOf(data2) !== Object.prototype && data2.constructor) {
24831
- return data2.constructor.name;
24972
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
24973
+ return data.constructor.name;
24832
24974
  }
24833
24975
  }
24834
24976
  }
@@ -25805,12 +25947,12 @@ function _stringbool2(Classes, _params) {
25805
25947
  in: stringSchema,
25806
25948
  out: booleanSchema,
25807
25949
  transform: ((input, payload) => {
25808
- let data2 = input;
25950
+ let data = input;
25809
25951
  if (params.case !== "sensitive")
25810
- data2 = data2.toLowerCase();
25811
- if (truthySet.has(data2)) {
25952
+ data = data.toLowerCase();
25953
+ if (truthySet.has(data)) {
25812
25954
  return true;
25813
- } else if (falsySet.has(data2)) {
25955
+ } else if (falsySet.has(data)) {
25814
25956
  return false;
25815
25957
  } else {
25816
25958
  payload.issues.push({
@@ -26794,19 +26936,19 @@ var ZodType2 = /* @__PURE__ */ $constructor2("ZodType", (inst, def) => {
26794
26936
  reg.add(inst, meta3);
26795
26937
  return inst;
26796
26938
  });
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);
26939
+ inst.parse = (data, params) => parse6(inst, data, params, { callee: inst.parse });
26940
+ inst.safeParse = (data, params) => safeParse4(inst, data, params);
26941
+ inst.parseAsync = async (data, params) => parseAsync4(inst, data, params, { callee: inst.parseAsync });
26942
+ inst.safeParseAsync = async (data, params) => safeParseAsync4(inst, data, params);
26801
26943
  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);
26944
+ inst.encode = (data, params) => encode4(inst, data, params);
26945
+ inst.decode = (data, params) => decode4(inst, data, params);
26946
+ inst.encodeAsync = async (data, params) => encodeAsync4(inst, data, params);
26947
+ inst.decodeAsync = async (data, params) => decodeAsync4(inst, data, params);
26948
+ inst.safeEncode = (data, params) => safeEncode4(inst, data, params);
26949
+ inst.safeDecode = (data, params) => safeDecode4(inst, data, params);
26950
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync4(inst, data, params);
26951
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync4(inst, data, params);
26810
26952
  inst.refine = (check3, params) => inst.check(refine2(check3, params));
26811
26953
  inst.superRefine = (refinement) => inst.check(superRefine2(refinement));
26812
26954
  inst.overwrite = (fn) => inst.check(_overwrite2(fn));
@@ -27729,7 +27871,7 @@ function _instanceof2(cls, params = {
27729
27871
  const inst = new ZodCustom2({
27730
27872
  type: "custom",
27731
27873
  check: "custom",
27732
- fn: (data2) => data2 instanceof cls,
27874
+ fn: (data) => data instanceof cls,
27733
27875
  abort: true,
27734
27876
  ...util_exports2.normalizeParams(params)
27735
27877
  });
@@ -27766,12 +27908,12 @@ var ZodIssueCode2 = {
27766
27908
  custom: "custom"
27767
27909
  };
27768
27910
  function setErrorMap2(map3) {
27769
- config3({
27911
+ config2({
27770
27912
  customError: map3
27771
27913
  });
27772
27914
  }
27773
27915
  function getErrorMap2() {
27774
- return config3().customError;
27916
+ return config2().customError;
27775
27917
  }
27776
27918
  var ZodFirstPartyTypeKind2;
27777
27919
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind3) {
@@ -27803,7 +27945,7 @@ function date8(params) {
27803
27945
  }
27804
27946
 
27805
27947
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
27806
- config3(en_default2());
27948
+ config2(en_default2());
27807
27949
 
27808
27950
  // node_modules/@opencode-ai/plugin/dist/tool.js
27809
27951
  function tool(input) {
@@ -27910,35 +28052,352 @@ async function downloadTemplate(mode, filePath) {
27910
28052
  }
27911
28053
  }
27912
28054
 
28055
+ // src/tools/create-template/ets-check.ts
28056
+ async function checkEtsExists(directory) {
28057
+ try {
28058
+ const etsStats = await countEtsLines(directory);
28059
+ log("[createHmTemplate] ets check", { fileCount: etsStats.fileCount, totalLines: etsStats.totalLines });
28060
+ return etsStats.fileCount;
28061
+ } catch (e) {
28062
+ return 0;
28063
+ }
28064
+ }
28065
+ async function updateEtsCache(sessionManager, sessionID, directory) {
28066
+ try {
28067
+ const newStats = await countEtsLines(directory);
28068
+ let session = sessionManager.get(sessionID);
28069
+ if (!session) {
28070
+ session = sessionManager.create(sessionID);
28071
+ }
28072
+ session.data.set("etsStats", newStats);
28073
+ log("[createHmTemplate] cache updated", { fileCount: newStats.fileCount, totalLines: newStats.totalLines });
28074
+ } catch (e) {
28075
+ }
28076
+ }
28077
+
27913
28078
  // 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) => {
28079
+ var CHECK_ETS_TEMPLATE_MODES = /* @__PURE__ */ new Set(["atomic", "application"]);
28080
+ function createHmTemplateTool(managers) {
28081
+ return tool({
28082
+ 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.",
28083
+ args: {
28084
+ filePath: tool.schema.string("Absolute path of the target directory where the template will be created"),
28085
+ mode: tool.schema.string("Template type: 'application' (\u5E94\u7528), 'module' (\u6A21\u5757), or 'atomic' (\u5143\u670D\u52A1)")
28086
+ },
28087
+ execute: async (args, context) => {
28088
+ try {
28089
+ if (CHECK_ETS_TEMPLATE_MODES.has(args.mode)) {
28090
+ const fileCount = await checkEtsExists(context.directory);
28091
+ if (fileCount > 0) {
28092
+ log("[createHmTemplate] skipped, ets files exist", { fileCount });
28093
+ return `Skipped: Current directory already contains ${fileCount} .ets file(s). Template download is not needed.`;
28094
+ }
28095
+ }
28096
+ await downloadTemplate(args.mode, args.filePath);
28097
+ await updateEtsCache(managers.session, context.sessionID, context.directory);
28098
+ return `Success to create harmonyos ${args.mode}`;
28099
+ } catch (e) {
28100
+ return `Error: ${e instanceof Error ? e.message : String(e)}`;
28101
+ }
28102
+ }
28103
+ });
28104
+ }
28105
+
28106
+ // src/tools/skill-search/skill-search-tool.ts
28107
+ import { homedir as homedir3 } from "node:os";
28108
+ import { join as join4 } from "node:path";
28109
+
28110
+ // src/tools/skill-search/search-skill.ts
28111
+ import { readFileSync } from "node:fs";
28112
+ import { homedir as homedir2 } from "node:os";
28113
+ import { join as join3 } from "node:path";
28114
+
28115
+ // src/tools/skill-search/tokenizer.ts
28116
+ var segmenter = new Intl.Segmenter("zh", { granularity: "word" });
28117
+ var SEG_RE = /[一-鿿㐀-䶿]+|[^\s\p{P}一-鿿㐀-䶿]+/gu;
28118
+ var CAMEL_RE = /[A-Z]?[a-z]+|[A-Z]+(?![a-z])/g;
28119
+ function tokenize(text) {
28120
+ const segments = text.match(SEG_RE) ?? [];
28121
+ const tokens = [];
28122
+ for (const seg of segments) {
28123
+ if (/[一-鿿㐀-䶿]/.test(seg)) {
28124
+ for (const s of segmenter.segment(seg)) {
28125
+ if (s.isWordLike) tokens.push(s.segment.toLowerCase().trim());
28126
+ }
28127
+ } else {
28128
+ const lower = seg.toLowerCase().trim();
28129
+ const words = seg.match(CAMEL_RE) ?? [];
28130
+ const splits = words.filter((w) => w.length > 1).map((w) => w.toLowerCase().trim());
28131
+ if (splits.length > 1) {
28132
+ if (lower.length > 1) tokens.push(lower);
28133
+ tokens.push(...splits);
28134
+ } else {
28135
+ if (lower.length > 1) tokens.push(lower);
28136
+ }
28137
+ }
28138
+ }
28139
+ return tokens.filter((w) => w.length > 0);
28140
+ }
28141
+
28142
+ // src/tools/skill-search/bm25.ts
28143
+ var BM25Retriever = class {
28144
+ k1;
28145
+ b;
28146
+ documents = [];
28147
+ tokenizedDocs = [];
28148
+ df = /* @__PURE__ */ new Map();
28149
+ tfMaps = [];
28150
+ avgDl = 0;
28151
+ constructor(opts) {
28152
+ this.k1 = opts?.k1 ?? 1.2;
28153
+ this.b = opts?.b ?? 0.75;
28154
+ }
28155
+ addDocuments(docs, tokenized) {
28156
+ this.documents = [...this.documents, ...docs];
28157
+ this.tokenizedDocs = [...this.tokenizedDocs, ...tokenized];
28158
+ const totalLen = this.tokenizedDocs.reduce(
28159
+ (sum, doc) => sum + doc.length,
28160
+ 0
28161
+ );
28162
+ this.avgDl = totalLen / this.tokenizedDocs.length;
28163
+ this.df = /* @__PURE__ */ new Map();
28164
+ this.tfMaps = this.tokenizedDocs.map((doc) => {
28165
+ const tfMap = /* @__PURE__ */ new Map();
28166
+ for (const t of doc) {
28167
+ tfMap.set(t, (tfMap.get(t) ?? 0) + 1);
28168
+ }
28169
+ const seen = new Set(doc);
28170
+ for (const token of seen) {
28171
+ this.df.set(token, (this.df.get(token) ?? 0) + 1);
28172
+ }
28173
+ return tfMap;
28174
+ });
28175
+ }
28176
+ search(query, topK = 5) {
28177
+ if (this.documents.length === 0) return [];
28178
+ const queryTokens = tokenize(query);
28179
+ const N = this.tokenizedDocs.length;
28180
+ const scored = this.tokenizedDocs.map((doc, i) => {
28181
+ const dl = doc.length;
28182
+ const tfMap = this.tfMaps[i];
28183
+ let score = 0;
28184
+ for (const qt of queryTokens) {
28185
+ const tf = tfMap.get(qt) ?? 0;
28186
+ if (tf === 0) continue;
28187
+ const dfVal = this.df.get(qt) ?? 0;
28188
+ const idf = Math.log((N - dfVal + 0.5) / (dfVal + 0.5) + 1);
28189
+ const tfNorm = tf * (this.k1 + 1) / (tf + this.k1 * (1 - this.b + this.b * dl / this.avgDl));
28190
+ score += idf * tfNorm;
28191
+ }
28192
+ return { index: i, text: this.documents[i], score };
28193
+ });
28194
+ scored.sort((a, b) => b.score - a.score);
28195
+ return scored.slice(0, topK);
28196
+ }
28197
+ };
28198
+
28199
+ // src/tools/skill-search/keyword.ts
28200
+ var KeywordRetriever = class {
28201
+ documents = [];
28202
+ tokenizedDocs = [];
28203
+ addDocuments(docs, tokenized) {
28204
+ this.documents = [...this.documents, ...docs];
28205
+ this.tokenizedDocs = [...this.tokenizedDocs, ...tokenized];
28206
+ }
28207
+ search(query, topK = 5) {
28208
+ if (this.documents.length === 0) return [];
28209
+ const queryTokens = tokenize(query);
28210
+ const querySet = new Set(queryTokens);
28211
+ const scored = this.tokenizedDocs.map((doc, i) => {
28212
+ let matched = 0;
28213
+ for (const token of doc) {
28214
+ if (querySet.has(token)) matched++;
28215
+ }
28216
+ const score = queryTokens.length > 0 ? matched / queryTokens.length : 0;
28217
+ return { index: i, text: this.documents[i], score };
28218
+ });
28219
+ scored.sort((a, b) => b.score - a.score);
28220
+ return scored.slice(0, topK);
28221
+ }
28222
+ };
28223
+
28224
+ // src/tools/skill-search/hybrid.ts
28225
+ var HybridRetriever = class {
28226
+ bm25;
28227
+ keyword;
28228
+ bm25Weight;
28229
+ keywordWeight;
28230
+ constructor(opts) {
28231
+ this.bm25Weight = opts?.bm25Weight ?? 0.7;
28232
+ this.keywordWeight = opts?.keywordWeight ?? 0.3;
28233
+ this.bm25 = new BM25Retriever({ k1: opts?.k1, b: opts?.b });
28234
+ this.keyword = new KeywordRetriever();
28235
+ }
28236
+ addDocuments(docs, tokenized) {
28237
+ this.bm25.addDocuments(docs, tokenized);
28238
+ this.keyword.addDocuments(docs, tokenized);
28239
+ }
28240
+ search(query, topK = 5) {
28241
+ if (this.bm25["documents"].length === 0) return [];
28242
+ const poolSize = topK * 3;
28243
+ const bm25Results = this.bm25.search(query, poolSize);
28244
+ const keywordResults = this.keyword.search(query, poolSize);
28245
+ const rrfK = 60;
28246
+ const documents = this.bm25["documents"];
28247
+ const scores = /* @__PURE__ */ new Map();
28248
+ for (let rank = 0; rank < bm25Results.length; rank++) {
28249
+ const idx = bm25Results[rank].index;
28250
+ scores.set(idx, (scores.get(idx) ?? 0) + this.bm25Weight / (rrfK + rank + 1));
28251
+ }
28252
+ for (let rank = 0; rank < keywordResults.length; rank++) {
28253
+ const idx = keywordResults[rank].index;
28254
+ scores.set(idx, (scores.get(idx) ?? 0) + this.keywordWeight / (rrfK + rank + 1));
28255
+ }
28256
+ const scored = [];
28257
+ for (const [idx, score] of scores) {
28258
+ scored.push({ index: idx, text: documents[idx], score });
28259
+ }
28260
+ scored.sort((a, b) => b.score - a.score);
28261
+ return scored.slice(0, topK);
28262
+ }
28263
+ };
28264
+
28265
+ // src/tools/skill-search/filter.json
28266
+ var filter_default = [
28267
+ { id: "1", summary: "Badge \u89D2\u6807\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_badge.md", category: "badge" },
28268
+ { id: "2", summary: "Blank \u7A7A\u767D\u586B\u5145\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_blank.md", category: "blank" },
28269
+ { id: "3", summary: "Button \u6309\u94AE\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_button.md", category: "button" },
28270
+ { id: "4", summary: "Column \u5782\u76F4\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_column.md", category: "column" },
28271
+ { id: "5", summary: "Counter \u8BA1\u6570\u5668\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_counter.md", category: "counter" },
28272
+ { id: "6", summary: "DataPanel \u6570\u636E\u9762\u677F\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_data_panel.md", category: "data_panel" },
28273
+ { id: "7", summary: "DatePicker \u65E5\u671F\u9009\u62E9\u5668\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_date_picker.md", category: "date_picker" },
28274
+ { id: "8", summary: "Divider \u5206\u5272\u7EBF\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_divider.md", category: "divider" },
28275
+ { id: "9", summary: "Flex \u5F39\u6027\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_flex.md", category: "flex" },
28276
+ { id: "10", summary: "ForEach \u5FAA\u73AF\u6E32\u67D3\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_for_each.md", category: "for_each" },
28277
+ { id: "11", summary: "LazyForEach \u5EF6\u8FDF\u52A0\u8F7D\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_lazy_for_each.md", category: "lazy_for_each" },
28278
+ { id: "12", summary: "Radio \u5355\u9009\u6309\u94AE\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_radio.md", category: "radio" },
28279
+ { id: "13", summary: "Rating \u8BC4\u5206\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_rating.md", category: "rating" },
28280
+ { id: "14", summary: "Refresh \u4E0B\u62C9\u5237\u65B0\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_refresh.md", category: "refresh" },
28281
+ { id: "15", summary: "Repeat \u5FAA\u73AF\u6E32\u67D3\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_repeat.md", category: "repeat" },
28282
+ { id: "16", summary: "Row \u6C34\u5E73\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_row.md", category: "row" },
28283
+ { id: "17", summary: "Search \u641C\u7D22\u6846\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_search.md", category: "search" },
28284
+ { id: "18", summary: "Slider \u6ED1\u52A8\u9009\u62E9\u5668\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_slider.md", category: "slider" },
28285
+ { id: "19", summary: "Span \u6587\u672C\u7247\u6BB5\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_span.md", category: "span" },
28286
+ { id: "20", summary: "Stack \u5C42\u53E0\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_stack.md", category: "stack" },
28287
+ { id: "21", summary: "Swiper \u8F6E\u64AD\u7EC4\u4EF6\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_swiper.md", category: "swiper" },
28288
+ { id: "22", summary: "TextArea \u591A\u884C\u6587\u672C\u8F93\u5165\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_text_area.md", category: "text_area" },
28289
+ { id: "23", summary: "TextInput \u5355\u884C\u6587\u672C\u8F93\u5165\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_text_input.md", category: "text_input" },
28290
+ { id: "24", summary: "Toggle \u5F00\u5173\u5207\u6362\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_toggle.md", category: "toggle" },
28291
+ { id: "25", summary: "WaterFlow \u7011\u5E03\u6D41\u5E03\u5C40\u5F00\u53D1\u5B9E\u8DF5", path: "experience/experience_water_flow.md", category: "water_flow" }
28292
+ ];
28293
+
28294
+ // src/tools/skill-search/search-skill.ts
28295
+ var DEFAULT_SKILL_PATH = join3(homedir2(), ".config", "opencode", "skills", "harmonyos-atomic-dev");
28296
+ var cachedEntries = null;
28297
+ var cachedIndexableEntries = null;
28298
+ var cachedFilters = null;
28299
+ var cachedRetriever = null;
28300
+ function loadAndCache(resolvedPath) {
28301
+ const raw = readFileSync(join3(resolvedPath, "index.json"), "utf-8");
28302
+ const entries = JSON.parse(raw);
28303
+ if (!Array.isArray(entries) || entries.length === 0) {
28304
+ return false;
28305
+ }
28306
+ cachedFilters = new Map(filter_default.map((e) => [e.category, e]));
28307
+ cachedEntries = entries;
28308
+ cachedIndexableEntries = cachedEntries.filter((e) => e.type === "component" || e.type === "kit");
28309
+ const documents = cachedIndexableEntries.map((e) => e.summary);
28310
+ const tokenizedDocs = documents.map((d) => tokenize(d));
28311
+ const retriever = new HybridRetriever();
28312
+ retriever.addDocuments(documents, tokenizedDocs);
28313
+ cachedRetriever = retriever;
28314
+ return true;
28315
+ }
28316
+ function searchSkill(skill_path, query, topK = 5) {
28317
+ const resolvedPath = skill_path?.trim() || DEFAULT_SKILL_PATH;
28318
+ if (!cachedEntries) {
27921
28319
  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)}`;
28320
+ if (!loadAndCache(resolvedPath)) return [];
28321
+ } catch {
28322
+ return [];
28323
+ }
28324
+ }
28325
+ const preFiltered = [];
28326
+ for (const [category, entry] of cachedFilters) {
28327
+ const idx = query.toLowerCase().indexOf(category);
28328
+ if (idx !== -1) {
28329
+ preFiltered.push({
28330
+ ets_file_path: "",
28331
+ experience_file_path: entry.path,
28332
+ summary: entry.summary,
28333
+ range: 0
28334
+ });
28335
+ query = (query.slice(0, idx) + query.slice(idx + category.length)).trim();
27926
28336
  }
27927
28337
  }
27928
- });
28338
+ if (!query) {
28339
+ return preFiltered;
28340
+ }
28341
+ const searchResults = cachedRetriever.search(query, topK);
28342
+ const MIN_SCORE = 2e-3;
28343
+ const filtered = searchResults.filter((r) => r.score >= MIN_SCORE);
28344
+ if (filtered.length === 0) return preFiltered;
28345
+ return [...preFiltered, ...convert_search_result(filtered)];
28346
+ }
28347
+ function convert_search_result(searchResults) {
28348
+ return searchResults.map((result, rank) => {
28349
+ const entry = cachedIndexableEntries[result.index];
28350
+ const experience = cachedEntries.find(
28351
+ (e) => e.type === "experience" && e.category === entry.category
28352
+ );
28353
+ return {
28354
+ ets_file_path: entry.path,
28355
+ experience_file_path: experience?.path ?? "",
28356
+ summary: entry.summary,
28357
+ range: rank + 1
28358
+ };
28359
+ });
28360
+ }
28361
+
28362
+ // src/tools/skill-search/skill-search-tool.ts
28363
+ function skillSearchTool(managers) {
28364
+ return tool({
28365
+ 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",
28366
+ args: {
28367
+ 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")),
28368
+ query: tool.schema.string("A decomposed requirement or intent describing what you want to find, broken down into searchable keywords separated by spaces."),
28369
+ 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)
28370
+ },
28371
+ execute: async (args, context) => {
28372
+ try {
28373
+ const results = searchSkill(args.skill_path, args.query, args.topK);
28374
+ if (results.length === 0) {
28375
+ return "No relative items found in the skill directory.";
28376
+ }
28377
+ return JSON.stringify(results, null, 2);
28378
+ } catch (e) {
28379
+ return `Error: ${e instanceof Error ? e.message : String(e)}`;
28380
+ }
28381
+ }
28382
+ });
28383
+ }
27929
28384
 
27930
28385
  // src/tools/builtin.ts
27931
- var builtinTools = {
27932
- createHmTemplate
27933
- };
28386
+ function createBuiltinTools(managers) {
28387
+ return {
28388
+ createHmTemplate: createHmTemplateTool(managers),
28389
+ skillSearch: skillSearchTool(managers)
28390
+ };
28391
+ }
27934
28392
 
27935
28393
  // src/create-tools.ts
27936
28394
  function createTools(args) {
27937
- const { ctx, config: config4 } = args;
28395
+ const { ctx, config: config3 } = args;
27938
28396
  log("Creating tools");
27939
28397
  const registry3 = new ToolRegistry();
28398
+ const builtinTools = createBuiltinTools(args.managers);
27940
28399
  registry3.registerMultiple(builtinTools, "builtin");
27941
- const filteredTools = registry3.filterDisabled(config4.disabled_tools ?? []);
28400
+ const filteredTools = registry3.filterDisabled(config3.disabled_tools ?? []);
27942
28401
  log("Tools created", {
27943
28402
  total: registry3.listAll().length,
27944
28403
  enabled: Object.keys(filteredTools).length
@@ -27946,6 +28405,562 @@ function createTools(args) {
27946
28405
  return { filteredTools };
27947
28406
  }
27948
28407
 
28408
+ // src/hooks/tool-hooks.ts
28409
+ import { readFile as readFile3 } from "fs/promises";
28410
+
28411
+ // node_modules/diff/lib/index.mjs
28412
+ function Diff() {
28413
+ }
28414
+ Diff.prototype = {
28415
+ diff: function diff(oldString, newString) {
28416
+ var _options$timeout;
28417
+ var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
28418
+ var callback = options.callback;
28419
+ if (typeof options === "function") {
28420
+ callback = options;
28421
+ options = {};
28422
+ }
28423
+ var self = this;
28424
+ function done(value) {
28425
+ value = self.postProcess(value, options);
28426
+ if (callback) {
28427
+ setTimeout(function() {
28428
+ callback(value);
28429
+ }, 0);
28430
+ return true;
28431
+ } else {
28432
+ return value;
28433
+ }
28434
+ }
28435
+ oldString = this.castInput(oldString, options);
28436
+ newString = this.castInput(newString, options);
28437
+ oldString = this.removeEmpty(this.tokenize(oldString, options));
28438
+ newString = this.removeEmpty(this.tokenize(newString, options));
28439
+ var newLen = newString.length, oldLen = oldString.length;
28440
+ var editLength = 1;
28441
+ var maxEditLength = newLen + oldLen;
28442
+ if (options.maxEditLength != null) {
28443
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
28444
+ }
28445
+ var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
28446
+ var abortAfterTimestamp = Date.now() + maxExecutionTime;
28447
+ var bestPath = [{
28448
+ oldPos: -1,
28449
+ lastComponent: void 0
28450
+ }];
28451
+ var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
28452
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
28453
+ return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));
28454
+ }
28455
+ var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
28456
+ function execEditLength() {
28457
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
28458
+ var basePath = void 0;
28459
+ var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
28460
+ if (removePath) {
28461
+ bestPath[diagonalPath - 1] = void 0;
28462
+ }
28463
+ var canAdd = false;
28464
+ if (addPath) {
28465
+ var addPathNewPos = addPath.oldPos - diagonalPath;
28466
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
28467
+ }
28468
+ var canRemove = removePath && removePath.oldPos + 1 < oldLen;
28469
+ if (!canAdd && !canRemove) {
28470
+ bestPath[diagonalPath] = void 0;
28471
+ continue;
28472
+ }
28473
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
28474
+ basePath = self.addToPath(addPath, true, false, 0, options);
28475
+ } else {
28476
+ basePath = self.addToPath(removePath, false, true, 1, options);
28477
+ }
28478
+ newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);
28479
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
28480
+ return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
28481
+ } else {
28482
+ bestPath[diagonalPath] = basePath;
28483
+ if (basePath.oldPos + 1 >= oldLen) {
28484
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
28485
+ }
28486
+ if (newPos + 1 >= newLen) {
28487
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
28488
+ }
28489
+ }
28490
+ }
28491
+ editLength++;
28492
+ }
28493
+ if (callback) {
28494
+ (function exec() {
28495
+ setTimeout(function() {
28496
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
28497
+ return callback();
28498
+ }
28499
+ if (!execEditLength()) {
28500
+ exec();
28501
+ }
28502
+ }, 0);
28503
+ })();
28504
+ } else {
28505
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
28506
+ var ret = execEditLength();
28507
+ if (ret) {
28508
+ return ret;
28509
+ }
28510
+ }
28511
+ }
28512
+ },
28513
+ addToPath: function addToPath(path7, added, removed, oldPosInc, options) {
28514
+ var last = path7.lastComponent;
28515
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
28516
+ return {
28517
+ oldPos: path7.oldPos + oldPosInc,
28518
+ lastComponent: {
28519
+ count: last.count + 1,
28520
+ added,
28521
+ removed,
28522
+ previousComponent: last.previousComponent
28523
+ }
28524
+ };
28525
+ } else {
28526
+ return {
28527
+ oldPos: path7.oldPos + oldPosInc,
28528
+ lastComponent: {
28529
+ count: 1,
28530
+ added,
28531
+ removed,
28532
+ previousComponent: last
28533
+ }
28534
+ };
28535
+ }
28536
+ },
28537
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
28538
+ var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
28539
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
28540
+ newPos++;
28541
+ oldPos++;
28542
+ commonCount++;
28543
+ if (options.oneChangePerToken) {
28544
+ basePath.lastComponent = {
28545
+ count: 1,
28546
+ previousComponent: basePath.lastComponent,
28547
+ added: false,
28548
+ removed: false
28549
+ };
28550
+ }
28551
+ }
28552
+ if (commonCount && !options.oneChangePerToken) {
28553
+ basePath.lastComponent = {
28554
+ count: commonCount,
28555
+ previousComponent: basePath.lastComponent,
28556
+ added: false,
28557
+ removed: false
28558
+ };
28559
+ }
28560
+ basePath.oldPos = oldPos;
28561
+ return newPos;
28562
+ },
28563
+ equals: function equals(left, right, options) {
28564
+ if (options.comparator) {
28565
+ return options.comparator(left, right);
28566
+ } else {
28567
+ return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
28568
+ }
28569
+ },
28570
+ removeEmpty: function removeEmpty(array3) {
28571
+ var ret = [];
28572
+ for (var i = 0; i < array3.length; i++) {
28573
+ if (array3[i]) {
28574
+ ret.push(array3[i]);
28575
+ }
28576
+ }
28577
+ return ret;
28578
+ },
28579
+ castInput: function castInput(value) {
28580
+ return value;
28581
+ },
28582
+ tokenize: function tokenize2(value) {
28583
+ return Array.from(value);
28584
+ },
28585
+ join: function join5(chars) {
28586
+ return chars.join("");
28587
+ },
28588
+ postProcess: function postProcess(changeObjects) {
28589
+ return changeObjects;
28590
+ }
28591
+ };
28592
+ function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
28593
+ var components = [];
28594
+ var nextComponent;
28595
+ while (lastComponent) {
28596
+ components.push(lastComponent);
28597
+ nextComponent = lastComponent.previousComponent;
28598
+ delete lastComponent.previousComponent;
28599
+ lastComponent = nextComponent;
28600
+ }
28601
+ components.reverse();
28602
+ var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
28603
+ for (; componentPos < componentLen; componentPos++) {
28604
+ var component = components[componentPos];
28605
+ if (!component.removed) {
28606
+ if (!component.added && useLongestToken) {
28607
+ var value = newString.slice(newPos, newPos + component.count);
28608
+ value = value.map(function(value2, i) {
28609
+ var oldValue = oldString[oldPos + i];
28610
+ return oldValue.length > value2.length ? oldValue : value2;
28611
+ });
28612
+ component.value = diff2.join(value);
28613
+ } else {
28614
+ component.value = diff2.join(newString.slice(newPos, newPos + component.count));
28615
+ }
28616
+ newPos += component.count;
28617
+ if (!component.added) {
28618
+ oldPos += component.count;
28619
+ }
28620
+ } else {
28621
+ component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
28622
+ oldPos += component.count;
28623
+ }
28624
+ }
28625
+ return components;
28626
+ }
28627
+ var characterDiff = new Diff();
28628
+ function longestCommonPrefix(str1, str2) {
28629
+ var i;
28630
+ for (i = 0; i < str1.length && i < str2.length; i++) {
28631
+ if (str1[i] != str2[i]) {
28632
+ return str1.slice(0, i);
28633
+ }
28634
+ }
28635
+ return str1.slice(0, i);
28636
+ }
28637
+ function longestCommonSuffix(str1, str2) {
28638
+ var i;
28639
+ if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
28640
+ return "";
28641
+ }
28642
+ for (i = 0; i < str1.length && i < str2.length; i++) {
28643
+ if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
28644
+ return str1.slice(-i);
28645
+ }
28646
+ }
28647
+ return str1.slice(-i);
28648
+ }
28649
+ function replacePrefix(string7, oldPrefix, newPrefix) {
28650
+ if (string7.slice(0, oldPrefix.length) != oldPrefix) {
28651
+ throw Error("string ".concat(JSON.stringify(string7), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
28652
+ }
28653
+ return newPrefix + string7.slice(oldPrefix.length);
28654
+ }
28655
+ function replaceSuffix(string7, oldSuffix, newSuffix) {
28656
+ if (!oldSuffix) {
28657
+ return string7 + newSuffix;
28658
+ }
28659
+ if (string7.slice(-oldSuffix.length) != oldSuffix) {
28660
+ throw Error("string ".concat(JSON.stringify(string7), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
28661
+ }
28662
+ return string7.slice(0, -oldSuffix.length) + newSuffix;
28663
+ }
28664
+ function removePrefix(string7, oldPrefix) {
28665
+ return replacePrefix(string7, oldPrefix, "");
28666
+ }
28667
+ function removeSuffix(string7, oldSuffix) {
28668
+ return replaceSuffix(string7, oldSuffix, "");
28669
+ }
28670
+ function maximumOverlap(string1, string22) {
28671
+ return string22.slice(0, overlapCount(string1, string22));
28672
+ }
28673
+ function overlapCount(a, b) {
28674
+ var startA = 0;
28675
+ if (a.length > b.length) {
28676
+ startA = a.length - b.length;
28677
+ }
28678
+ var endB = b.length;
28679
+ if (a.length < b.length) {
28680
+ endB = a.length;
28681
+ }
28682
+ var map3 = Array(endB);
28683
+ var k = 0;
28684
+ map3[0] = 0;
28685
+ for (var j = 1; j < endB; j++) {
28686
+ if (b[j] == b[k]) {
28687
+ map3[j] = map3[k];
28688
+ } else {
28689
+ map3[j] = k;
28690
+ }
28691
+ while (k > 0 && b[j] != b[k]) {
28692
+ k = map3[k];
28693
+ }
28694
+ if (b[j] == b[k]) {
28695
+ k++;
28696
+ }
28697
+ }
28698
+ k = 0;
28699
+ for (var i = startA; i < a.length; i++) {
28700
+ while (k > 0 && a[i] != b[k]) {
28701
+ k = map3[k];
28702
+ }
28703
+ if (a[i] == b[k]) {
28704
+ k++;
28705
+ }
28706
+ }
28707
+ return k;
28708
+ }
28709
+ 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}";
28710
+ var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
28711
+ var wordDiff = new Diff();
28712
+ wordDiff.equals = function(left, right, options) {
28713
+ if (options.ignoreCase) {
28714
+ left = left.toLowerCase();
28715
+ right = right.toLowerCase();
28716
+ }
28717
+ return left.trim() === right.trim();
28718
+ };
28719
+ wordDiff.tokenize = function(value) {
28720
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
28721
+ var parts;
28722
+ if (options.intlSegmenter) {
28723
+ if (options.intlSegmenter.resolvedOptions().granularity != "word") {
28724
+ throw new Error('The segmenter passed must have a granularity of "word"');
28725
+ }
28726
+ parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
28727
+ return segment.segment;
28728
+ });
28729
+ } else {
28730
+ parts = value.match(tokenizeIncludingWhitespace) || [];
28731
+ }
28732
+ var tokens = [];
28733
+ var prevPart = null;
28734
+ parts.forEach(function(part) {
28735
+ if (/\s/.test(part)) {
28736
+ if (prevPart == null) {
28737
+ tokens.push(part);
28738
+ } else {
28739
+ tokens.push(tokens.pop() + part);
28740
+ }
28741
+ } else if (/\s/.test(prevPart)) {
28742
+ if (tokens[tokens.length - 1] == prevPart) {
28743
+ tokens.push(tokens.pop() + part);
28744
+ } else {
28745
+ tokens.push(prevPart + part);
28746
+ }
28747
+ } else {
28748
+ tokens.push(part);
28749
+ }
28750
+ prevPart = part;
28751
+ });
28752
+ return tokens;
28753
+ };
28754
+ wordDiff.join = function(tokens) {
28755
+ return tokens.map(function(token, i) {
28756
+ if (i == 0) {
28757
+ return token;
28758
+ } else {
28759
+ return token.replace(/^\s+/, "");
28760
+ }
28761
+ }).join("");
28762
+ };
28763
+ wordDiff.postProcess = function(changes, options) {
28764
+ if (!changes || options.oneChangePerToken) {
28765
+ return changes;
28766
+ }
28767
+ var lastKeep = null;
28768
+ var insertion = null;
28769
+ var deletion = null;
28770
+ changes.forEach(function(change) {
28771
+ if (change.added) {
28772
+ insertion = change;
28773
+ } else if (change.removed) {
28774
+ deletion = change;
28775
+ } else {
28776
+ if (insertion || deletion) {
28777
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
28778
+ }
28779
+ lastKeep = change;
28780
+ insertion = null;
28781
+ deletion = null;
28782
+ }
28783
+ });
28784
+ if (insertion || deletion) {
28785
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
28786
+ }
28787
+ return changes;
28788
+ };
28789
+ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
28790
+ if (deletion && insertion) {
28791
+ var oldWsPrefix = deletion.value.match(/^\s*/)[0];
28792
+ var oldWsSuffix = deletion.value.match(/\s*$/)[0];
28793
+ var newWsPrefix = insertion.value.match(/^\s*/)[0];
28794
+ var newWsSuffix = insertion.value.match(/\s*$/)[0];
28795
+ if (startKeep) {
28796
+ var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
28797
+ startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
28798
+ deletion.value = removePrefix(deletion.value, commonWsPrefix);
28799
+ insertion.value = removePrefix(insertion.value, commonWsPrefix);
28800
+ }
28801
+ if (endKeep) {
28802
+ var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
28803
+ endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
28804
+ deletion.value = removeSuffix(deletion.value, commonWsSuffix);
28805
+ insertion.value = removeSuffix(insertion.value, commonWsSuffix);
28806
+ }
28807
+ } else if (insertion) {
28808
+ if (startKeep) {
28809
+ insertion.value = insertion.value.replace(/^\s*/, "");
28810
+ }
28811
+ if (endKeep) {
28812
+ endKeep.value = endKeep.value.replace(/^\s*/, "");
28813
+ }
28814
+ } else if (startKeep && endKeep) {
28815
+ var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
28816
+ var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
28817
+ deletion.value = removePrefix(deletion.value, newWsStart);
28818
+ var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
28819
+ deletion.value = removeSuffix(deletion.value, newWsEnd);
28820
+ endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
28821
+ startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
28822
+ } else if (endKeep) {
28823
+ var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
28824
+ var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
28825
+ var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
28826
+ deletion.value = removeSuffix(deletion.value, overlap);
28827
+ } else if (startKeep) {
28828
+ var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
28829
+ var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
28830
+ var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
28831
+ deletion.value = removePrefix(deletion.value, _overlap);
28832
+ }
28833
+ }
28834
+ var wordWithSpaceDiff = new Diff();
28835
+ wordWithSpaceDiff.tokenize = function(value) {
28836
+ var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
28837
+ return value.match(regex) || [];
28838
+ };
28839
+ var lineDiff = new Diff();
28840
+ lineDiff.tokenize = function(value, options) {
28841
+ if (options.stripTrailingCr) {
28842
+ value = value.replace(/\r\n/g, "\n");
28843
+ }
28844
+ var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
28845
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
28846
+ linesAndNewlines.pop();
28847
+ }
28848
+ for (var i = 0; i < linesAndNewlines.length; i++) {
28849
+ var line = linesAndNewlines[i];
28850
+ if (i % 2 && !options.newlineIsToken) {
28851
+ retLines[retLines.length - 1] += line;
28852
+ } else {
28853
+ retLines.push(line);
28854
+ }
28855
+ }
28856
+ return retLines;
28857
+ };
28858
+ lineDiff.equals = function(left, right, options) {
28859
+ if (options.ignoreWhitespace) {
28860
+ if (!options.newlineIsToken || !left.includes("\n")) {
28861
+ left = left.trim();
28862
+ }
28863
+ if (!options.newlineIsToken || !right.includes("\n")) {
28864
+ right = right.trim();
28865
+ }
28866
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
28867
+ if (left.endsWith("\n")) {
28868
+ left = left.slice(0, -1);
28869
+ }
28870
+ if (right.endsWith("\n")) {
28871
+ right = right.slice(0, -1);
28872
+ }
28873
+ }
28874
+ return Diff.prototype.equals.call(this, left, right, options);
28875
+ };
28876
+ function diffLines(oldStr, newStr, callback) {
28877
+ return lineDiff.diff(oldStr, newStr, callback);
28878
+ }
28879
+ var sentenceDiff = new Diff();
28880
+ sentenceDiff.tokenize = function(value) {
28881
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
28882
+ };
28883
+ var cssDiff = new Diff();
28884
+ cssDiff.tokenize = function(value) {
28885
+ return value.split(/([{}:;,]|\s+)/);
28886
+ };
28887
+ function _typeof(o) {
28888
+ "@babel/helpers - typeof";
28889
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
28890
+ return typeof o2;
28891
+ } : function(o2) {
28892
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
28893
+ }, _typeof(o);
28894
+ }
28895
+ var jsonDiff = new Diff();
28896
+ jsonDiff.useLongestToken = true;
28897
+ jsonDiff.tokenize = lineDiff.tokenize;
28898
+ jsonDiff.castInput = function(value, options) {
28899
+ var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
28900
+ return typeof v === "undefined" ? undefinedReplacement : v;
28901
+ } : _options$stringifyRep;
28902
+ return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
28903
+ };
28904
+ jsonDiff.equals = function(left, right, options) {
28905
+ return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
28906
+ };
28907
+ function canonicalize(obj, stack, replacementStack, replacer, key) {
28908
+ stack = stack || [];
28909
+ replacementStack = replacementStack || [];
28910
+ if (replacer) {
28911
+ obj = replacer(key, obj);
28912
+ }
28913
+ var i;
28914
+ for (i = 0; i < stack.length; i += 1) {
28915
+ if (stack[i] === obj) {
28916
+ return replacementStack[i];
28917
+ }
28918
+ }
28919
+ var canonicalizedObj;
28920
+ if ("[object Array]" === Object.prototype.toString.call(obj)) {
28921
+ stack.push(obj);
28922
+ canonicalizedObj = new Array(obj.length);
28923
+ replacementStack.push(canonicalizedObj);
28924
+ for (i = 0; i < obj.length; i += 1) {
28925
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
28926
+ }
28927
+ stack.pop();
28928
+ replacementStack.pop();
28929
+ return canonicalizedObj;
28930
+ }
28931
+ if (obj && obj.toJSON) {
28932
+ obj = obj.toJSON();
28933
+ }
28934
+ if (_typeof(obj) === "object" && obj !== null) {
28935
+ stack.push(obj);
28936
+ canonicalizedObj = {};
28937
+ replacementStack.push(canonicalizedObj);
28938
+ var sortedKeys = [], _key;
28939
+ for (_key in obj) {
28940
+ if (Object.prototype.hasOwnProperty.call(obj, _key)) {
28941
+ sortedKeys.push(_key);
28942
+ }
28943
+ }
28944
+ sortedKeys.sort();
28945
+ for (i = 0; i < sortedKeys.length; i += 1) {
28946
+ _key = sortedKeys[i];
28947
+ canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
28948
+ }
28949
+ stack.pop();
28950
+ replacementStack.pop();
28951
+ } else {
28952
+ canonicalizedObj = obj;
28953
+ }
28954
+ return canonicalizedObj;
28955
+ }
28956
+ var arrayDiff = new Diff();
28957
+ arrayDiff.tokenize = function(value) {
28958
+ return value.slice();
28959
+ };
28960
+ arrayDiff.join = arrayDiff.removeEmpty = function(value) {
28961
+ return value;
28962
+ };
28963
+
27949
28964
  // src/compress/compile-hvigorw.ts
27950
28965
  function processHvigorwCompileInfo(input, output) {
27951
28966
  if (input.tool !== "bash") return;
@@ -27968,15 +28983,91 @@ function stripAnsi(text) {
27968
28983
  }
27969
28984
 
27970
28985
  // src/hooks/tool-hooks.ts
27971
- function createToolHooks() {
28986
+ var writeContentCache = /* @__PURE__ */ new Map();
28987
+ function createToolHooks(sessionManager, projectDir) {
27972
28988
  return {
27973
28989
  "tool.execute.before": async (input, output) => {
28990
+ try {
28991
+ if (input.tool === "write") {
28992
+ const filePath = output.args?.filePath;
28993
+ if (filePath) {
28994
+ const oldContent = await readFile3(filePath, "utf-8").catch(() => "");
28995
+ writeContentCache.set(input.callID, oldContent);
28996
+ }
28997
+ }
28998
+ } catch (e) {
28999
+ log("aiCodeChange before hook error", { tool: input.tool, error: String(e) });
29000
+ }
27974
29001
  },
27975
29002
  "tool.execute.after": async (input, output) => {
27976
29003
  processHvigorwCompileInfo(input, output);
29004
+ injectAiCodeChange(input, output);
29005
+ await updateEtsCount(sessionManager, projectDir, input);
27977
29006
  }
27978
29007
  };
27979
29008
  }
29009
+ async function updateEtsCount(sessionManager, projectDir, input) {
29010
+ if (input.tool === "edit" || input.tool === "write") {
29011
+ try {
29012
+ const stats = await countEtsLines(projectDir);
29013
+ log("ETS line count", {
29014
+ fileCount: stats.fileCount,
29015
+ totalLines: stats.totalLines
29016
+ });
29017
+ const sessionID = input.sessionID;
29018
+ if (sessionID) {
29019
+ let session = sessionManager.get(sessionID);
29020
+ if (!session) {
29021
+ session = sessionManager.create(sessionID);
29022
+ }
29023
+ session.data.set("etsStats", stats);
29024
+ }
29025
+ } catch (err) {
29026
+ log("Failed to count .ets lines", { error: String(err) });
29027
+ }
29028
+ }
29029
+ }
29030
+ function injectAiCodeChange(input, output) {
29031
+ try {
29032
+ if (input.tool === "write") {
29033
+ const callID = input.callID;
29034
+ if (!callID) return;
29035
+ const oldContent = writeContentCache.get(callID) ?? "";
29036
+ writeContentCache.delete(callID);
29037
+ const newContent = input.args?.content ?? "";
29038
+ const filePath = input.args?.filePath;
29039
+ if (newContent && filePath) {
29040
+ let additions = 0;
29041
+ let deletions = 0;
29042
+ for (const change of diffLines(oldContent, newContent)) {
29043
+ if (change.added) additions += change.count || 0;
29044
+ if (change.removed) deletions += change.count || 0;
29045
+ }
29046
+ output.metadata.aiCodeChange = {
29047
+ file: filePath,
29048
+ additions,
29049
+ deletions
29050
+ };
29051
+ }
29052
+ } else if (input.tool === "edit") {
29053
+ const filediff = output.metadata?.filediff;
29054
+ const filePath = input.args?.filePath;
29055
+ if (filediff && filePath) {
29056
+ output.metadata.aiCodeChange = {
29057
+ file: filePath,
29058
+ additions: filediff.additions,
29059
+ deletions: filediff.deletions
29060
+ };
29061
+ }
29062
+ }
29063
+ const aiCodeChange = output.metadata?.aiCodeChange;
29064
+ if (aiCodeChange) {
29065
+ log("aiCodeChange injected", { tool: input.tool, ...aiCodeChange });
29066
+ }
29067
+ } catch (e) {
29068
+ log("aiCodeChange after hook error", { tool: input.tool, error: String(e) });
29069
+ }
29070
+ }
27980
29071
 
27981
29072
  // src/commands/env-check.ts
27982
29073
  import { execSync } from "child_process";
@@ -28025,12 +29116,38 @@ function createCommandHooks(ctx) {
28025
29116
  };
28026
29117
  }
28027
29118
 
29119
+ // src/hooks/session-hooks.ts
29120
+ function createSessionHooks(sessionManager, projectDir) {
29121
+ return {
29122
+ event: async ({ event }) => {
29123
+ const props = event.properties;
29124
+ if (!props) return;
29125
+ const sessionID = props.sessionID ?? props.info?.id;
29126
+ if (event.type === "session.created" && sessionID) {
29127
+ const session = sessionManager.create(sessionID);
29128
+ log("Session created via event", { sessionID });
29129
+ try {
29130
+ const stats = await countEtsLines(projectDir);
29131
+ session.data.set("etsStats", stats);
29132
+ log("Initial ETS line count", {
29133
+ sessionID,
29134
+ fileCount: stats.fileCount,
29135
+ totalLines: stats.totalLines
29136
+ });
29137
+ } catch (err) {
29138
+ log("Failed to count initial .ets lines", { sessionID, error: String(err) });
29139
+ }
29140
+ } else if (event.type === "session.deleted" && sessionID) {
29141
+ sessionManager.delete(sessionID);
29142
+ log("Session deleted via event", { sessionID });
29143
+ }
29144
+ }
29145
+ };
29146
+ }
29147
+
28028
29148
  // src/hooks/chat-params.ts
28029
- function createChatParamsHandler(config4) {
29149
+ function createChatParamsHandler(_config) {
28030
29150
  return async (input, output) => {
28031
- const agentConfig = config4.agents?.[input.agent];
28032
- if (agentConfig) {
28033
- }
28034
29151
  };
28035
29152
  }
28036
29153
 
@@ -28042,18 +29159,20 @@ function createChatMessageHandler(_ctx, _managers) {
28042
29159
 
28043
29160
  // src/create-hooks.ts
28044
29161
  function createHooks(args) {
28045
- const { ctx, config: config4, managers } = args;
28046
- const disabledHooks = new Set(config4.disabled_hooks ?? []);
29162
+ const { ctx, config: config3, managers } = args;
29163
+ const disabledHooks = new Set(config3.disabled_hooks ?? []);
28047
29164
  const isHookEnabled = (name) => !disabledHooks.has(name);
28048
29165
  log("Creating hooks", { disabledCount: disabledHooks.size });
28049
29166
  const hooks = {};
28050
- const toolHooks = createToolHooks();
29167
+ const toolHooks = createToolHooks(managers.session, ctx.directory);
28051
29168
  const commandHooks = createCommandHooks(ctx);
29169
+ const sessionHooks = createSessionHooks(managers.session, ctx.directory);
28052
29170
  const registrations = [
28053
29171
  ["tool.execute.before", () => toolHooks["tool.execute.before"]],
28054
29172
  ["tool.execute.after", () => toolHooks["tool.execute.after"]],
28055
29173
  ["command.execute.before", () => commandHooks["command.execute.before"]],
28056
- ["chat.params", () => createChatParamsHandler(config4)],
29174
+ ["event", () => sessionHooks["event"]],
29175
+ ["chat.params", () => createChatParamsHandler(config3)],
28057
29176
  ["chat.message", () => createChatMessageHandler(ctx, managers)]
28058
29177
  ];
28059
29178
  for (const [key, factory] of registrations) {
@@ -28067,13 +29186,13 @@ function createHooks(args) {
28067
29186
  // src/index.ts
28068
29187
  var HMPlugin = async (ctx) => {
28069
29188
  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();
29189
+ const config3 = await loadPluginConfig(ctx.directory);
29190
+ log("Config loaded", { disabledTools: config3.disabled_tools?.length ?? 0 });
29191
+ const state = createPluginState();
28073
29192
  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 });
29193
+ const managers = createManagers({ ctx, config: config3, agentRegistry });
29194
+ const toolsResult = createTools({ ctx, config: config3, managers });
29195
+ const hooks = createHooks({ ctx, config: config3, managers });
28077
29196
  const pluginInterface = {
28078
29197
  tool: toolsResult.filteredTools,
28079
29198
  config: managers.config,