@wirecat/amo-cli 0.0.0-stage → 0.1.1

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 (274) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +204 -0
  3. package/README.md +265 -2
  4. package/contracts/wirecat.json +1356 -0
  5. package/dist/amo/account.d.ts +18 -0
  6. package/dist/amo/account.d.ts.map +1 -0
  7. package/dist/amo/account.js +48 -0
  8. package/dist/amo/account.js.map +1 -0
  9. package/dist/amo/allow-list.d.ts +31 -0
  10. package/dist/amo/allow-list.d.ts.map +1 -0
  11. package/dist/amo/allow-list.js +106 -0
  12. package/dist/amo/allow-list.js.map +1 -0
  13. package/dist/amo/errors.d.ts +12 -0
  14. package/dist/amo/errors.d.ts.map +1 -0
  15. package/dist/amo/errors.js +72 -0
  16. package/dist/amo/errors.js.map +1 -0
  17. package/dist/amo/json.d.ts +3 -0
  18. package/dist/amo/json.d.ts.map +1 -0
  19. package/dist/amo/json.js +3 -0
  20. package/dist/amo/json.js.map +1 -0
  21. package/dist/amo/oauth.d.ts +55 -0
  22. package/dist/amo/oauth.d.ts.map +1 -0
  23. package/dist/amo/oauth.js +189 -0
  24. package/dist/amo/oauth.js.map +1 -0
  25. package/dist/amo/operation.d.ts +45 -0
  26. package/dist/amo/operation.d.ts.map +1 -0
  27. package/dist/amo/operation.js +119 -0
  28. package/dist/amo/operation.js.map +1 -0
  29. package/dist/amo/operations.d.ts +3 -0
  30. package/dist/amo/operations.d.ts.map +1 -0
  31. package/dist/amo/operations.js +1407 -0
  32. package/dist/amo/operations.js.map +1 -0
  33. package/dist/amo/routes.d.ts +67 -0
  34. package/dist/amo/routes.d.ts.map +1 -0
  35. package/dist/amo/routes.js +65 -0
  36. package/dist/amo/routes.js.map +1 -0
  37. package/dist/amo/transport.d.ts +62 -0
  38. package/dist/amo/transport.d.ts.map +1 -0
  39. package/dist/amo/transport.js +282 -0
  40. package/dist/amo/transport.js.map +1 -0
  41. package/dist/api-keys.d.ts +47 -0
  42. package/dist/api-keys.d.ts.map +1 -0
  43. package/dist/api-keys.js +224 -0
  44. package/dist/api-keys.js.map +1 -0
  45. package/dist/bin/amo.d.ts +3 -0
  46. package/dist/bin/amo.d.ts.map +1 -0
  47. package/dist/bin/amo.js +40 -0
  48. package/dist/bin/amo.js.map +1 -0
  49. package/dist/bundle/all-profiles-3KQVWDV4.js +278 -0
  50. package/dist/bundle/amo.js +198 -0
  51. package/dist/bundle/anthropic-N5NOX7K7.js +90 -0
  52. package/dist/bundle/app-server-2MST5EZ5.js +245 -0
  53. package/dist/bundle/bun-4NHWOFX2.js +169 -0
  54. package/dist/bundle/bun-sqlite-DRSXPWPR.js +75 -0
  55. package/dist/bundle/chunk-2B24PDH7.js +1718 -0
  56. package/dist/bundle/chunk-2I5UVMLW.js +3232 -0
  57. package/dist/bundle/chunk-3IRJDH2U.js +731 -0
  58. package/dist/bundle/chunk-4ZAK773N.js +100 -0
  59. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  60. package/dist/bundle/chunk-5D4Z2B5B.js +334 -0
  61. package/dist/bundle/chunk-5E5R65CA.js +54 -0
  62. package/dist/bundle/chunk-5HGGG3QO.js +73 -0
  63. package/dist/bundle/chunk-5RLUHTK6.js +23 -0
  64. package/dist/bundle/chunk-5SBLU7D7.js +63 -0
  65. package/dist/bundle/chunk-5Z5PEEKP.js +206 -0
  66. package/dist/bundle/chunk-63F65DHU.js +29 -0
  67. package/dist/bundle/chunk-6RS7OYTD.js +64 -0
  68. package/dist/bundle/chunk-73CXFE36.js +88 -0
  69. package/dist/bundle/chunk-7GTUZY7M.js +170 -0
  70. package/dist/bundle/chunk-7PKFYX7V.js +189 -0
  71. package/dist/bundle/chunk-7U5HJEPZ.js +1400 -0
  72. package/dist/bundle/chunk-A33TIM5D.js +4172 -0
  73. package/dist/bundle/chunk-ADEWU4P4.js +38 -0
  74. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  75. package/dist/bundle/chunk-AHJ4W2IL.js +106 -0
  76. package/dist/bundle/chunk-AUBB72VF.js +2572 -0
  77. package/dist/bundle/chunk-BVMNXI53.js +1266 -0
  78. package/dist/bundle/chunk-CDY2NJFE.js +136 -0
  79. package/dist/bundle/chunk-CHUKWON6.js +244 -0
  80. package/dist/bundle/chunk-CUZRHF34.js +230 -0
  81. package/dist/bundle/chunk-D72URWJE.js +532 -0
  82. package/dist/bundle/chunk-DAY6TSPF.js +786 -0
  83. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  84. package/dist/bundle/chunk-DJD7TBYG.js +2791 -0
  85. package/dist/bundle/chunk-DOSJONCX.js +1197 -0
  86. package/dist/bundle/chunk-DQV2IKCF.js +72 -0
  87. package/dist/bundle/chunk-DXGGCGRP.js +218 -0
  88. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  89. package/dist/bundle/chunk-EPOV5UIO.js +185 -0
  90. package/dist/bundle/chunk-EQ7A6NA6.js +53 -0
  91. package/dist/bundle/chunk-EQUKVVHX.js +353 -0
  92. package/dist/bundle/chunk-EROSAUNP.js +133 -0
  93. package/dist/bundle/chunk-ESZSMZKT.js +82 -0
  94. package/dist/bundle/chunk-FKR3M62D.js +407 -0
  95. package/dist/bundle/chunk-GNTJMB6X.js +142 -0
  96. package/dist/bundle/chunk-GQ7VFIYM.js +316 -0
  97. package/dist/bundle/chunk-JH3UOHRE.js +161 -0
  98. package/dist/bundle/chunk-JMDLPBXK.js +1068 -0
  99. package/dist/bundle/chunk-JR6TSMFX.js +9435 -0
  100. package/dist/bundle/chunk-L6AFE73L.js +18 -0
  101. package/dist/bundle/chunk-LDEBZ3IX.js +238 -0
  102. package/dist/bundle/chunk-LGQXGOPJ.js +58 -0
  103. package/dist/bundle/chunk-LJQUYECN.js +6848 -0
  104. package/dist/bundle/chunk-LRBPT7LQ.js +95 -0
  105. package/dist/bundle/chunk-LSND5QYI.js +460 -0
  106. package/dist/bundle/chunk-NC76INB2.js +27955 -0
  107. package/dist/bundle/chunk-NHXJYS4R.js +1334 -0
  108. package/dist/bundle/chunk-NJYAL3UW.js +92 -0
  109. package/dist/bundle/chunk-O2UCU52O.js +4065 -0
  110. package/dist/bundle/chunk-ODNQU7DH.js +1028 -0
  111. package/dist/bundle/chunk-P3WQRTYZ.js +24 -0
  112. package/dist/bundle/chunk-P5LYZRKW.js +63373 -0
  113. package/dist/bundle/chunk-PFO76YFP.js +2003 -0
  114. package/dist/bundle/chunk-PM77PRB6.js +12269 -0
  115. package/dist/bundle/chunk-Q2VNBY4Y.js +38109 -0
  116. package/dist/bundle/chunk-QDMXZZG4.js +604 -0
  117. package/dist/bundle/chunk-QRQYUHCZ.js +761 -0
  118. package/dist/bundle/chunk-RPWAJYI6.js +2336 -0
  119. package/dist/bundle/chunk-SMSTGO2G.js +58 -0
  120. package/dist/bundle/chunk-SZ2V62HB.js +72 -0
  121. package/dist/bundle/chunk-T2UDLX76.js +259 -0
  122. package/dist/bundle/chunk-TGEQNS6G.js +16 -0
  123. package/dist/bundle/chunk-TNUFLULO.js +2333 -0
  124. package/dist/bundle/chunk-TZSUZGWM.js +25 -0
  125. package/dist/bundle/chunk-U7RLVJ34.js +274 -0
  126. package/dist/bundle/chunk-UBRREVLJ.js +72 -0
  127. package/dist/bundle/chunk-ULXQ5MJM.js +76 -0
  128. package/dist/bundle/chunk-UMVRT7VQ.js +46 -0
  129. package/dist/bundle/chunk-V77XNPXG.js +360 -0
  130. package/dist/bundle/chunk-VVHRQ46X.js +193 -0
  131. package/dist/bundle/chunk-VX37MPTJ.js +7 -0
  132. package/dist/bundle/chunk-WCYCUTSK.js +362 -0
  133. package/dist/bundle/chunk-XEFAMLSD.js +288 -0
  134. package/dist/bundle/chunk-XQL7FEF4.js +721 -0
  135. package/dist/bundle/chunk-XRTD2GCU.js +627 -0
  136. package/dist/bundle/chunk-Y37A3232.js +804 -0
  137. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  138. package/dist/bundle/chunk-ZM7I52EP.js +78 -0
  139. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  140. package/dist/bundle/cli-QVWTXADI.js +1193 -0
  141. package/dist/bundle/command-contract-QBUQBXH7.js +39 -0
  142. package/dist/bundle/command-server-entry-5VL5U5EE.js +168 -0
  143. package/dist/bundle/decode-SQ5WGNDX.js +296 -0
  144. package/dist/bundle/dispatch-LA4DFXJD.js +411 -0
  145. package/dist/bundle/dist-T54K3FJV.js +7577 -0
  146. package/dist/bundle/echarts-25Z3RINX.js +42501 -0
  147. package/dist/bundle/embed-BNOTNXMA.js +37 -0
  148. package/dist/bundle/embedder-BCUT7KKV.js +110 -0
  149. package/dist/bundle/failure-PKAC6XCT.js +24 -0
  150. package/dist/bundle/first-run-EO5K5GME.js +28 -0
  151. package/dist/bundle/first-screen-GMN3T6RW.js +39 -0
  152. package/dist/bundle/instructions-VLM3QAYB.js +11 -0
  153. package/dist/bundle/mcp-7ILNMJH5.js +167 -0
  154. package/dist/bundle/meeting-combined-LAMF7S2B.js +24 -0
  155. package/dist/bundle/meeting-model-GHMMUQ34.js +24 -0
  156. package/dist/bundle/meeting-semantic-BMP6323L.js +21 -0
  157. package/dist/bundle/node-CT3N3TNL.js +176 -0
  158. package/dist/bundle/node-P4E63KXA.js +2340 -0
  159. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  160. package/dist/bundle/node-sqlite-MELD2SBX.js +73 -0
  161. package/dist/bundle/oauth-YBH5OKC2.js +19 -0
  162. package/dist/bundle/open-WNSBWTAG.js +22 -0
  163. package/dist/bundle/openai-XSNMNLW6.js +237 -0
  164. package/dist/bundle/process-I2QKOMM7.js +91 -0
  165. package/dist/bundle/program-DV73CIGP.js +4940 -0
  166. package/dist/bundle/prompt-SOG4AKPM.js +16 -0
  167. package/dist/bundle/recognize-WMQLWMXH.js +25 -0
  168. package/dist/bundle/remote-4BTFOLFY.js +30 -0
  169. package/dist/bundle/rerank-LJ3TWRNV.js +51 -0
  170. package/dist/bundle/serve-B6UANKXN.js +198 -0
  171. package/dist/bundle/server-S6XD6V6E.js +77 -0
  172. package/dist/bundle/server-YRH6GJ5Z.js +206 -0
  173. package/dist/bundle/source-DGFTA2TN.js +42 -0
  174. package/dist/bundle/sqlite-runtime-R7QFWFE7.js +19 -0
  175. package/dist/bundle/state-DIJ5YUOE.js +35 -0
  176. package/dist/bundle/store-6WFWW7EC.js +294 -0
  177. package/dist/bundle/store-FJCNZULV.js +32 -0
  178. package/dist/bundle/store-MYTYDV6A.js +177 -0
  179. package/dist/bundle/store-maintenance-command-B5TMKFMG.js +68 -0
  180. package/dist/bundle/writer-GP7VIMAU.js +44 -0
  181. package/dist/commands/account.d.ts +3 -0
  182. package/dist/commands/account.d.ts.map +1 -0
  183. package/dist/commands/account.js +86 -0
  184. package/dist/commands/account.js.map +1 -0
  185. package/dist/commands/api.d.ts +3 -0
  186. package/dist/commands/api.d.ts.map +1 -0
  187. package/dist/commands/api.js +224 -0
  188. package/dist/commands/api.js.map +1 -0
  189. package/dist/commands/crm-shared.d.ts +8 -0
  190. package/dist/commands/crm-shared.d.ts.map +1 -0
  191. package/dist/commands/crm-shared.js +111 -0
  192. package/dist/commands/crm-shared.js.map +1 -0
  193. package/dist/commands/schedule.d.ts +3 -0
  194. package/dist/commands/schedule.d.ts.map +1 -0
  195. package/dist/commands/schedule.js +9 -0
  196. package/dist/commands/schedule.js.map +1 -0
  197. package/dist/commands/session.d.ts +18 -0
  198. package/dist/commands/session.d.ts.map +1 -0
  199. package/dist/commands/session.js +265 -0
  200. package/dist/commands/session.js.map +1 -0
  201. package/dist/commands/write.d.ts +14 -0
  202. package/dist/commands/write.d.ts.map +1 -0
  203. package/dist/commands/write.js +36 -0
  204. package/dist/commands/write.js.map +1 -0
  205. package/dist/config.d.ts +4 -0
  206. package/dist/config.d.ts.map +1 -0
  207. package/dist/config.js +29 -0
  208. package/dist/config.js.map +1 -0
  209. package/dist/context.d.ts +62 -0
  210. package/dist/context.d.ts.map +1 -0
  211. package/dist/context.js +97 -0
  212. package/dist/context.js.map +1 -0
  213. package/dist/crm/activities.d.ts +32 -0
  214. package/dist/crm/activities.d.ts.map +1 -0
  215. package/dist/crm/activities.js +196 -0
  216. package/dist/crm/activities.js.map +1 -0
  217. package/dist/crm/records.d.ts +20 -0
  218. package/dist/crm/records.d.ts.map +1 -0
  219. package/dist/crm/records.js +175 -0
  220. package/dist/crm/records.js.map +1 -0
  221. package/dist/crm/source.d.ts +41 -0
  222. package/dist/crm/source.d.ts.map +1 -0
  223. package/dist/crm/source.js +673 -0
  224. package/dist/crm/source.js.map +1 -0
  225. package/dist/crm/writer.d.ts +14 -0
  226. package/dist/crm/writer.d.ts.map +1 -0
  227. package/dist/crm/writer.js +247 -0
  228. package/dist/crm/writer.js.map +1 -0
  229. package/dist/identity.d.ts +7 -0
  230. package/dist/identity.d.ts.map +1 -0
  231. package/dist/identity.js +33 -0
  232. package/dist/identity.js.map +1 -0
  233. package/dist/index.d.ts +3 -0
  234. package/dist/index.d.ts.map +1 -0
  235. package/dist/index.js +3 -0
  236. package/dist/index.js.map +1 -0
  237. package/dist/program.d.ts +6 -0
  238. package/dist/program.d.ts.map +1 -0
  239. package/dist/program.js +91 -0
  240. package/dist/program.js.map +1 -0
  241. package/dist/reasons.d.ts +10 -0
  242. package/dist/reasons.d.ts.map +1 -0
  243. package/dist/reasons.js +35 -0
  244. package/dist/reasons.js.map +1 -0
  245. package/dist/setup/flow.d.ts +2 -0
  246. package/dist/setup/flow.d.ts.map +1 -0
  247. package/dist/setup/flow.js +127 -0
  248. package/dist/setup/flow.js.map +1 -0
  249. package/dist/setup/texts.en.json +25 -0
  250. package/dist/setup/texts.es.json +25 -0
  251. package/dist/setup/texts.ru.json +25 -0
  252. package/dist/store.d.ts +15 -0
  253. package/dist/store.d.ts.map +1 -0
  254. package/dist/store.js +16 -0
  255. package/dist/store.js.map +1 -0
  256. package/dist/version.d.ts +2 -0
  257. package/dist/version.d.ts.map +1 -0
  258. package/dist/version.js +2 -0
  259. package/dist/version.js.map +1 -0
  260. package/dist/wcat.d.ts +3 -0
  261. package/dist/wcat.d.ts.map +1 -0
  262. package/dist/wcat.js +4 -0
  263. package/dist/wcat.js.map +1 -0
  264. package/dist/whoami.d.ts +24 -0
  265. package/dist/whoami.d.ts.map +1 -0
  266. package/dist/whoami.js +33 -0
  267. package/dist/whoami.js.map +1 -0
  268. package/package.json +85 -4
  269. package/skills/amo-cli/SKILL.md +116 -0
  270. package/skills/amo-cli/references/mcp.md +38 -0
  271. package/skills/amo-cli/references/output.md +42 -0
  272. package/skills/amo-cli/references/reading.md +77 -0
  273. package/skills/amo-cli/references/setup.md +59 -0
  274. package/skills/amo-cli/references/writing.md +86 -0
@@ -0,0 +1,58 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ readSharedSection,
5
+ sharedConfigPath,
6
+ writeSharedSection
7
+ } from "./chunk-DOSJONCX.js";
8
+ import {
9
+ storePath
10
+ } from "./chunk-5E5R65CA.js";
11
+ import {
12
+ CliError
13
+ } from "./chunk-SZ2V62HB.js";
14
+ import {
15
+ __name
16
+ } from "./chunk-ZVVMGPBJ.js";
17
+
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/cli/setup-answers.js
19
+ var PERMISSION_ANSWERS = ["readonly", "allow"];
20
+ var QUESTIONS = ["languages", "tools", "permissions"];
21
+ var SECTION = "setup";
22
+ var readSetupAnswers = /* @__PURE__ */ __name((path) => {
23
+ const section = readSharedSection(path, SECTION);
24
+ if (section === void 0)
25
+ return {};
26
+ const answers = section;
27
+ if (section === null || typeof section !== "object" || Array.isArray(section) || answers.languages !== void 0 && answers.languages !== true || answers.tools !== void 0 && answers.tools !== true || answers.permissions !== void 0 && !PERMISSION_ANSWERS.includes(answers.permissions))
28
+ throw new CliError("configuration_error", `${path}: ${SECTION} holds what setup asked \u2014 languages: true, tools: true, permissions: ${PERMISSION_ANSWERS.join(" | ")}`);
29
+ return answers;
30
+ }, "readSetupAnswers");
31
+ var unanswered = /* @__PURE__ */ __name((answers) => QUESTIONS.filter((question) => answers[question] === void 0), "unanswered");
32
+ var writeSetupAnswers = /* @__PURE__ */ __name((path, answers) => {
33
+ let kept = {};
34
+ try {
35
+ kept = readSetupAnswers(path);
36
+ } catch (error) {
37
+ if (!(error instanceof CliError) || !error.message.includes(`${SECTION} holds`))
38
+ throw error;
39
+ }
40
+ writeSharedSection(path, SECTION, { ...kept, ...answers });
41
+ }, "writeSetupAnswers");
42
+ var permissionCeiling = /* @__PURE__ */ __name((path) => {
43
+ try {
44
+ return readSetupAnswers(path).permissions === "readonly" ? "readonly" : void 0;
45
+ } catch {
46
+ return void 0;
47
+ }
48
+ }, "permissionCeiling");
49
+ var setupPermissionCeiling = /* @__PURE__ */ __name((env = process.env) => permissionCeiling(sharedConfigPath(storePath(env), env)), "setupPermissionCeiling");
50
+
51
+ export {
52
+ QUESTIONS,
53
+ readSetupAnswers,
54
+ unanswered,
55
+ writeSetupAnswers,
56
+ permissionCeiling,
57
+ setupPermissionCeiling
58
+ };
@@ -0,0 +1,72 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
8
+ var errorCodes = [
9
+ "validation_error",
10
+ "configuration_error",
11
+ "authentication_error",
12
+ "permission_error",
13
+ "not_found",
14
+ "confirmation_required",
15
+ "rate_limited",
16
+ "timeout",
17
+ "network_error",
18
+ "provider_error",
19
+ "provider_unavailable",
20
+ "invalid_response",
21
+ "outcome_unknown",
22
+ "conflict",
23
+ "cancelled"
24
+ ];
25
+ var BRAND = /* @__PURE__ */ Symbol.for("@wirecat/cli-base/CliError");
26
+ var CliError = class extends Error {
27
+ static {
28
+ __name(this, "CliError");
29
+ }
30
+ code;
31
+ details;
32
+ constructor(code, message, details = {}) {
33
+ super(message);
34
+ this.name = "CliError";
35
+ this.code = code;
36
+ this.details = details;
37
+ Object.defineProperty(this, BRAND, { value: true });
38
+ }
39
+ };
40
+ var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
41
+
42
+ // node_modules/.pnpm/@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
43
+ var CONTROL = (
44
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
45
+ /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
46
+ );
47
+ var SUBDIVISION_FLAG = /\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}/gu;
48
+ var LINE_BREAKS = /[\t\n\u2028\u2029]/g;
49
+ var escaped = /* @__PURE__ */ __name((c) => {
50
+ const code = c.codePointAt(0) ?? 0;
51
+ if (code > 65535)
52
+ return `\\u{${code.toString(16)}}`;
53
+ return code > 255 ? `\\u${code.toString(16).padStart(4, "0")}` : `\\x${code.toString(16).padStart(2, "0")}`;
54
+ }, "escaped");
55
+ var visibleControls = /* @__PURE__ */ __name((text) => {
56
+ let at = 0;
57
+ let result = "";
58
+ for (const flag of text.matchAll(SUBDIVISION_FLAG)) {
59
+ result += text.slice(at, flag.index).replace(CONTROL, escaped) + flag[0];
60
+ at = flag.index + flag[0].length;
61
+ }
62
+ return result + text.slice(at).replace(CONTROL, escaped);
63
+ }, "visibleControls");
64
+ var singleLine = /* @__PURE__ */ __name((text) => visibleControls(text).replace(LINE_BREAKS, escaped), "singleLine");
65
+
66
+ export {
67
+ errorCodes,
68
+ CliError,
69
+ isCliError,
70
+ visibleControls,
71
+ singleLine
72
+ };
@@ -0,0 +1,259 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ textModel,
5
+ vectorModelKey
6
+ } from "./chunk-5D4Z2B5B.js";
7
+ import {
8
+ OPENAI_URL,
9
+ openRemote,
10
+ remoteKey,
11
+ remoteModel
12
+ } from "./chunk-EPOV5UIO.js";
13
+ import {
14
+ endpointFetch
15
+ } from "./chunk-GQ7VFIYM.js";
16
+ import {
17
+ isTextModelInstalled,
18
+ openEmbedder,
19
+ textModelsDirectory
20
+ } from "./chunk-ODNQU7DH.js";
21
+ import {
22
+ CliError
23
+ } from "./chunk-SZ2V62HB.js";
24
+ import {
25
+ __name
26
+ } from "./chunk-ZVVMGPBJ.js";
27
+
28
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
29
+ var integer = /* @__PURE__ */ __name((value, name, max) => {
30
+ if (!Number.isSafeInteger(value) || value < 1 || value > max)
31
+ throw new CliError("validation_error", `Invalid ${name}`);
32
+ return value;
33
+ }, "integer");
34
+ var cancelled = /* @__PURE__ */ __name((signal) => {
35
+ if (signal?.aborted)
36
+ throw new CliError("cancelled", "Meeting embedding was cancelled");
37
+ }, "cancelled");
38
+ var validatedRemote = /* @__PURE__ */ __name((remote) => {
39
+ let url;
40
+ try {
41
+ url = new URL(remote.baseUrl);
42
+ } catch {
43
+ throw new CliError("validation_error", "Invalid embedding endpoint");
44
+ }
45
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
46
+ throw new CliError("validation_error", "Embedding endpoint requires HTTP/S without credentials, query or fragment");
47
+ if (typeof remote.model !== "string" || !/^[\w./:-]{1,200}$/.test(remote.model))
48
+ throw new CliError("validation_error", "Invalid embedding model name");
49
+ const dims = integer(remote.dims, "embedding dimensions", 8192);
50
+ const baseUrl = remote.baseUrl.replace(/\/+$/, "");
51
+ const result = remoteModel({ model: remote.model, dims, ...baseUrl === OPENAI_URL ? {} : { baseUrl } });
52
+ return result;
53
+ }, "validatedRemote");
54
+ var meetingEmbeddingModel = /* @__PURE__ */ __name((choice, env) => {
55
+ if (typeof choice === "string") {
56
+ const model = textModel(choice, env);
57
+ return { key: vectorModelKey(model), dims: model.dims, kind: "local", model: model.id };
58
+ }
59
+ if (!choice || typeof choice !== "object" || !choice.remote)
60
+ throw new CliError("validation_error", "An explicit embedding model is required");
61
+ const remote = validatedRemote(choice.remote);
62
+ if (choice.concurrency !== void 0 && choice.concurrency !== 1)
63
+ throw new CliError("validation_error", "Meeting embedding supports one remote request worker");
64
+ return { key: remoteKey(remote), dims: remote.dims, kind: "remote", model: remote.model };
65
+ }, "meetingEmbeddingModel");
66
+ var createMeetingRemoteModel = /* @__PURE__ */ __name((input) => {
67
+ try {
68
+ return validatedRemote(remoteModel(input));
69
+ } catch (error) {
70
+ if (error instanceof CliError)
71
+ throw error;
72
+ throw new CliError("validation_error", "Invalid embedding endpoint");
73
+ }
74
+ }, "createMeetingRemoteModel");
75
+ var withAbort = /* @__PURE__ */ __name(async (pending, signal) => {
76
+ cancelled(signal);
77
+ if (!signal)
78
+ return pending;
79
+ let onAbort = /* @__PURE__ */ __name(() => {
80
+ }, "onAbort");
81
+ const interrupted = new Promise((_, reject) => {
82
+ onAbort = /* @__PURE__ */ __name(() => reject(new CliError("cancelled", "Meeting embedding was cancelled")), "onAbort");
83
+ signal.addEventListener("abort", onAbort, { once: true });
84
+ });
85
+ try {
86
+ return await Promise.race([pending, interrupted]);
87
+ } finally {
88
+ signal.removeEventListener("abort", onAbort);
89
+ }
90
+ }, "withAbort");
91
+ var boundedResponse = /* @__PURE__ */ __name(async (response, maxBytes, signal) => {
92
+ const length = response.headers.get("content-length");
93
+ if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
94
+ void response.body?.cancel().catch(() => {
95
+ });
96
+ throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
97
+ }
98
+ if (!response.body)
99
+ throw new CliError("invalid_response", "Embedding response has no body");
100
+ const reader = response.body.getReader();
101
+ const chunks = [];
102
+ let bytes = 0;
103
+ try {
104
+ for (; ; ) {
105
+ cancelled(signal);
106
+ const part = await withAbort(reader.read(), signal);
107
+ cancelled(signal);
108
+ if (part.done)
109
+ break;
110
+ bytes += part.value.byteLength;
111
+ if (bytes > maxBytes)
112
+ throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
113
+ chunks.push(part.value);
114
+ }
115
+ const body = Buffer.concat(chunks, bytes).toString("utf8");
116
+ try {
117
+ return JSON.parse(body);
118
+ } catch {
119
+ throw new CliError("invalid_response", "Embedding response is not JSON");
120
+ }
121
+ } finally {
122
+ void reader.cancel().catch(() => {
123
+ });
124
+ reader.releaseLock();
125
+ }
126
+ }, "boundedResponse");
127
+ var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) => {
128
+ const descriptor = meetingEmbeddingModel(choice, options.env);
129
+ const { signal } = options;
130
+ cancelled(signal);
131
+ const maxInputBytes = integer(options.maxInputBytes ?? 1024 * 1024, "input byte budget", 16 * 1024 * 1024);
132
+ const maxResponseBytes = integer(options.maxResponseBytes ?? 8 * 1024 * 1024, "response byte budget", 64 * 1024 * 1024);
133
+ if (options.threads !== void 0)
134
+ integer(options.threads, "embedding threads", 128);
135
+ let engine;
136
+ let remoteFailure;
137
+ if (typeof choice === "string") {
138
+ const model = textModel(choice, options.env);
139
+ const directory = options.directory ?? textModelsDirectory(options.env);
140
+ if (!isTextModelInstalled(model, directory))
141
+ throw new CliError("configuration_error", "The explicit local embedding model is not installed");
142
+ engine = await openEmbedder(model, directory, {
143
+ ...options.threads === void 0 ? {} : { threads: options.threads }
144
+ });
145
+ } else {
146
+ const remote = validatedRemote(choice.remote);
147
+ const key = choice.apiKey ?? (remote.provider === "openai" ? (options.env ?? process.env).OPENAI_API_KEY : void 0);
148
+ if (remote.provider === "openai" && !key)
149
+ throw new CliError("authentication_error", "The explicit remote embedding model requires an API key");
150
+ const post = options.fetch ?? endpointFetch(remote.baseUrl, 12e4);
151
+ const guarded = /* @__PURE__ */ __name(async (url, init) => {
152
+ try {
153
+ cancelled(signal);
154
+ const responseTask = post(url, { ...init, redirect: "manual", ...signal ? { signal } : {} }).then((response2) => {
155
+ if (signal?.aborted) {
156
+ void response2.body?.cancel().catch(() => {
157
+ });
158
+ cancelled(signal);
159
+ }
160
+ return response2;
161
+ });
162
+ const response = await withAbort(responseTask, signal);
163
+ if (signal?.aborted) {
164
+ void response.body?.cancel().catch(() => {
165
+ });
166
+ cancelled(signal);
167
+ }
168
+ if (response.status >= 300 && response.status < 400) {
169
+ void response.body?.cancel().catch(() => {
170
+ });
171
+ throw new CliError("invalid_response", "Embedding redirects are refused");
172
+ }
173
+ if (!response.ok) {
174
+ void response.body?.cancel().catch(() => {
175
+ });
176
+ return new Response("{}", { status: response.status });
177
+ }
178
+ const body = await boundedResponse(response, maxResponseBytes, signal);
179
+ if (!body || typeof body !== "object" || !("data" in body) || !Array.isArray(body.data) || body.data.length > 256)
180
+ throw new CliError("invalid_response", "Embedding response lacks vector data");
181
+ for (const entry of body.data) {
182
+ if (!entry || typeof entry !== "object" || !Number.isSafeInteger(entry.index) || entry.index < 0 || !Array.isArray(entry.embedding) || entry.embedding.length !== remote.dims || entry.embedding.some((value) => typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(Math.fround(value))))
183
+ throw new CliError("invalid_response", "Embedding response contains invalid vectors");
184
+ }
185
+ const indices = body.data.map((entry) => entry.index).sort((a, b) => a - b);
186
+ if (indices.some((index, position) => index !== position))
187
+ throw new CliError("invalid_response", "Embedding response contains invalid vector indices");
188
+ return new Response(JSON.stringify({ data: body.data.map((entry) => ({ index: entry.index, embedding: entry.embedding })) }), { status: response.status });
189
+ } catch (error) {
190
+ remoteFailure = error;
191
+ throw error;
192
+ }
193
+ }, "guarded");
194
+ engine = openRemote(remote, key, { concurrency: 1, fetch: guarded, tries: 1, env: options.env ?? process.env });
195
+ }
196
+ if (signal?.aborted) {
197
+ await engine.close();
198
+ cancelled(signal);
199
+ }
200
+ let closed = false;
201
+ let running = false;
202
+ let active = null;
203
+ let closing = null;
204
+ return {
205
+ ...descriptor,
206
+ async embed(texts, kind) {
207
+ cancelled(signal);
208
+ if (closed)
209
+ throw new CliError("configuration_error", "Meeting embedder is closed");
210
+ if (!Array.isArray(texts) || texts.length > 1e3 || texts.some((text) => typeof text !== "string") || !["query", "passage"].includes(kind))
211
+ throw new CliError("validation_error", "Invalid meeting embedding inputs");
212
+ if (Buffer.byteLength(JSON.stringify(texts), "utf8") > maxInputBytes || texts.length * descriptor.dims * 4 > maxResponseBytes)
213
+ throw new CliError("validation_error", "Meeting embedding input or vector payload exceeds its byte budget");
214
+ if (running)
215
+ throw new CliError("validation_error", "A meeting embedding request is already running");
216
+ running = true;
217
+ let settled = /* @__PURE__ */ __name(() => {
218
+ }, "settled");
219
+ active = new Promise((resolve) => {
220
+ settled = resolve;
221
+ });
222
+ remoteFailure = void 0;
223
+ try {
224
+ const vectors = await engine.embed([...texts], kind);
225
+ cancelled(signal);
226
+ if (vectors.length !== texts.length || vectors.some((vector) => vector.length !== descriptor.dims || !vector.some((value) => value !== 0) || [...vector].some((value) => !Number.isFinite(value))))
227
+ throw new CliError("invalid_response", "Meeting embedder returned invalid vectors");
228
+ return vectors;
229
+ } catch (error) {
230
+ cancelled(signal);
231
+ if (remoteFailure instanceof CliError)
232
+ throw remoteFailure;
233
+ if (error instanceof CliError)
234
+ throw error;
235
+ throw new CliError("provider_error", "Meeting embedding failed");
236
+ } finally {
237
+ running = false;
238
+ settled();
239
+ active = null;
240
+ }
241
+ },
242
+ async close() {
243
+ if (!closing) {
244
+ closed = true;
245
+ closing = (async () => {
246
+ await active;
247
+ await engine.close();
248
+ })();
249
+ }
250
+ await closing;
251
+ }
252
+ };
253
+ }, "openMeetingEmbedder");
254
+
255
+ export {
256
+ meetingEmbeddingModel,
257
+ createMeetingRemoteModel,
258
+ openMeetingEmbedder
259
+ };
@@ -0,0 +1,16 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/store/normalize.js
8
+ var NORMALIZER_VERSION = 1;
9
+ var fold = /* @__PURE__ */ __name((text) => text.normalize("NFKD").replace(new RegExp("\\p{M}+", "gu"), "").normalize("NFC").toLowerCase(), "fold");
10
+ var normalize = /* @__PURE__ */ __name((text) => fold(text).replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/gu, " ").trim(), "normalize");
11
+
12
+ export {
13
+ NORMALIZER_VERSION,
14
+ fold,
15
+ normalize
16
+ };