@wirecat/wordpress-cli 0.0.0-stage → 0.1.0

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 (256) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +204 -0
  3. package/README.md +248 -2
  4. package/contracts/wirecat.json +2535 -0
  5. package/dist/bin/wordpress.d.ts +3 -0
  6. package/dist/bin/wordpress.d.ts.map +1 -0
  7. package/dist/bin/wordpress.js +40 -0
  8. package/dist/bin/wordpress.js.map +1 -0
  9. package/dist/bundle/agent-LKBRYKNB.js +37 -0
  10. package/dist/bundle/all-profiles-OEV7VFQG.js +320 -0
  11. package/dist/bundle/anthropic-JKTZP2DW.js +91 -0
  12. package/dist/bundle/app-server-7LWLDDE2.js +249 -0
  13. package/dist/bundle/bun-2FLR4IV4.js +169 -0
  14. package/dist/bundle/bun-sqlite-GRSRX5P4.js +76 -0
  15. package/dist/bundle/chunk-2BI25SEE.js +259 -0
  16. package/dist/bundle/chunk-2UEGJ5AJ.js +52 -0
  17. package/dist/bundle/chunk-2XUV7HNE.js +58 -0
  18. package/dist/bundle/chunk-2Z7UOXFC.js +16 -0
  19. package/dist/bundle/chunk-3BM6KBWP.js +2788 -0
  20. package/dist/bundle/chunk-3BRAZVHR.js +1010 -0
  21. package/dist/bundle/chunk-3LMW7U7F.js +1233 -0
  22. package/dist/bundle/chunk-3LVTQFGB.js +2000 -0
  23. package/dist/bundle/chunk-3TKFFSFU.js +106 -0
  24. package/dist/bundle/chunk-3UX4VJWD.js +78 -0
  25. package/dist/bundle/chunk-4HEXAGKT.js +334 -0
  26. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  27. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  28. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  29. package/dist/bundle/chunk-5XPHFV7H.js +2333 -0
  30. package/dist/bundle/chunk-5Z3P543G.js +80 -0
  31. package/dist/bundle/chunk-6UYDKCV6.js +794 -0
  32. package/dist/bundle/chunk-7GNB4LBX.js +50 -0
  33. package/dist/bundle/chunk-7HJFBOAT.js +161 -0
  34. package/dist/bundle/chunk-7JVKQ6NM.js +206 -0
  35. package/dist/bundle/chunk-7QH5BZUG.js +142 -0
  36. package/dist/bundle/chunk-A474OVIW.js +1392 -0
  37. package/dist/bundle/chunk-AENEMQL3.js +1068 -0
  38. package/dist/bundle/chunk-AL7I4DT4.js +65718 -0
  39. package/dist/bundle/chunk-ARGRGTPX.js +108 -0
  40. package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
  41. package/dist/bundle/chunk-BAXNAOOL.js +76 -0
  42. package/dist/bundle/chunk-BH63B66W.js +407 -0
  43. package/dist/bundle/chunk-CCOSG3F2.js +24616 -0
  44. package/dist/bundle/chunk-CFQQTDSA.js +46 -0
  45. package/dist/bundle/chunk-CGCUOT67.js +388 -0
  46. package/dist/bundle/chunk-CHPWBQUK.js +39 -0
  47. package/dist/bundle/chunk-D72URWJE.js +532 -0
  48. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  49. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  50. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  51. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  52. package/dist/bundle/chunk-EHW45LLT.js +100 -0
  53. package/dist/bundle/chunk-F3AV5ZSL.js +338 -0
  54. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  55. package/dist/bundle/chunk-F5ZAN7OC.js +6848 -0
  56. package/dist/bundle/chunk-FMMYBVCH.js +38 -0
  57. package/dist/bundle/chunk-FNB4SWTY.js +66 -0
  58. package/dist/bundle/chunk-FQROWBKV.js +12660 -0
  59. package/dist/bundle/chunk-FV2HJOSC.js +771 -0
  60. package/dist/bundle/chunk-GCAJW4SR.js +53 -0
  61. package/dist/bundle/chunk-GPRJXJC7.js +102 -0
  62. package/dist/bundle/chunk-HCOZUOSN.js +54 -0
  63. package/dist/bundle/chunk-HM6AMYHR.js +72 -0
  64. package/dist/bundle/chunk-HVXOA4FO.js +23 -0
  65. package/dist/bundle/chunk-HWQ7572G.js +95 -0
  66. package/dist/bundle/chunk-IJVTN5L3.js +82 -0
  67. package/dist/bundle/chunk-IZDDBOHU.js +3610 -0
  68. package/dist/bundle/chunk-JAE5B4G7.js +388 -0
  69. package/dist/bundle/chunk-K2Y5K37O.js +218 -0
  70. package/dist/bundle/chunk-KCH224US.js +9581 -0
  71. package/dist/bundle/chunk-KZJQPJK5.js +230 -0
  72. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  73. package/dist/bundle/chunk-LECMHK2F.js +18 -0
  74. package/dist/bundle/chunk-LWEMZJLG.js +1332 -0
  75. package/dist/bundle/chunk-LWTETL2O.js +185 -0
  76. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  77. package/dist/bundle/chunk-MJ6LTG4L.js +170 -0
  78. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  79. package/dist/bundle/chunk-ODVGFCBE.js +557 -0
  80. package/dist/bundle/chunk-OEQNP56V.js +633 -0
  81. package/dist/bundle/chunk-OV6WQY3L.js +39 -0
  82. package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
  83. package/dist/bundle/chunk-PPNTY7LD.js +733 -0
  84. package/dist/bundle/chunk-PRZYRA66.js +358 -0
  85. package/dist/bundle/chunk-PV5UYGRJ.js +41594 -0
  86. package/dist/bundle/chunk-QYTOLPNI.js +52 -0
  87. package/dist/bundle/chunk-R7Y3XU66.js +362 -0
  88. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  89. package/dist/bundle/chunk-SD5CXGIG.js +188 -0
  90. package/dist/bundle/chunk-SXY5G62I.js +288 -0
  91. package/dist/bundle/chunk-T37TAXVL.js +29 -0
  92. package/dist/bundle/chunk-T5SOY3AE.js +1197 -0
  93. package/dist/bundle/chunk-TJ7OORSO.js +1876 -0
  94. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  95. package/dist/bundle/chunk-U6VLNYCO.js +73 -0
  96. package/dist/bundle/chunk-UC7JLE6J.js +58 -0
  97. package/dist/bundle/chunk-UUIOAZPH.js +156 -0
  98. package/dist/bundle/chunk-UXQ24OY6.js +4072 -0
  99. package/dist/bundle/chunk-VBRRMGON.js +1007 -0
  100. package/dist/bundle/chunk-VRIBES2C.js +319 -0
  101. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  102. package/dist/bundle/chunk-XT5XYQEZ.js +3414 -0
  103. package/dist/bundle/chunk-XTAS5Z3G.js +2231 -0
  104. package/dist/bundle/chunk-XYQVVW4R.js +24 -0
  105. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  106. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  107. package/dist/bundle/chunk-YUDVRFXN.js +63 -0
  108. package/dist/bundle/chunk-Z3I2MCUT.js +131 -0
  109. package/dist/bundle/chunk-ZDI3WC7V.js +353 -0
  110. package/dist/bundle/chunk-ZVQ7KFMT.js +274 -0
  111. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  112. package/dist/bundle/command-contract-P7YE4EKS.js +37 -0
  113. package/dist/bundle/command-server-entry-XIMCBWMV.js +166 -0
  114. package/dist/bundle/decode-6XK55WYV.js +297 -0
  115. package/dist/bundle/definitions-GIQCGYPR.js +7986 -0
  116. package/dist/bundle/dispatch-JQBAZWCL.js +411 -0
  117. package/dist/bundle/dist-2TV3NVE5.js +7577 -0
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/echarts-YRRVLEX3.js +42501 -0
  120. package/dist/bundle/embed-L3EEQSGX.js +38 -0
  121. package/dist/bundle/embedder-BIKLBV3J.js +111 -0
  122. package/dist/bundle/failure-I6AAF5R5.js +25 -0
  123. package/dist/bundle/first-run-W6G6TYZ2.js +29 -0
  124. package/dist/bundle/first-screen-ITIAJIBU.js +37 -0
  125. package/dist/bundle/hast-util-from-html-ZHU6HGIE.js +10531 -0
  126. package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
  127. package/dist/bundle/hast-util-to-mdast-D62XX3NR.js +2272 -0
  128. package/dist/bundle/instructions-AG7SRWTR.js +11 -0
  129. package/dist/bundle/mcp-YGOAUNC3.js +167 -0
  130. package/dist/bundle/mdast-util-from-markdown-WVUJDSUO.js +1900 -0
  131. package/dist/bundle/mdast-util-gfm-KN2D32QS.js +1040 -0
  132. package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
  133. package/dist/bundle/mdast-util-to-markdown-UCAJNHJO.js +18 -0
  134. package/dist/bundle/meeting-combined-CQJ3JHHU.js +24 -0
  135. package/dist/bundle/meeting-model-MZ7VVBNK.js +25 -0
  136. package/dist/bundle/meeting-semantic-DADWRRHP.js +22 -0
  137. package/dist/bundle/micromark-extension-gfm-EEJRRJ36.js +1771 -0
  138. package/dist/bundle/node-GJQYN4FT.js +176 -0
  139. package/dist/bundle/node-JJ3WDCNJ.js +2340 -0
  140. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  141. package/dist/bundle/node-sqlite-TPR62DT2.js +74 -0
  142. package/dist/bundle/oauth-WGY7JQVW.js +20 -0
  143. package/dist/bundle/open-DE7QZNAN.js +23 -0
  144. package/dist/bundle/openai-NHEFT3HS.js +238 -0
  145. package/dist/bundle/process-MEKCZMX3.js +91 -0
  146. package/dist/bundle/program-EP2S5BTM.js +38857 -0
  147. package/dist/bundle/prompt-PWY53BYH.js +17 -0
  148. package/dist/bundle/recognize-74TXHKMQ.js +26 -0
  149. package/dist/bundle/remote-F5TJZ5ER.js +31 -0
  150. package/dist/bundle/rerank-HWUO52UF.js +52 -0
  151. package/dist/bundle/schemas-4K6WWS5N.js +2157 -0
  152. package/dist/bundle/serve-I2USUY4X.js +199 -0
  153. package/dist/bundle/server-GDYDNO6K.js +79 -0
  154. package/dist/bundle/server-KYUW2AHB.js +212 -0
  155. package/dist/bundle/sqlite-runtime-N6VFGBJK.js +20 -0
  156. package/dist/bundle/state-L6JSCN77.js +36 -0
  157. package/dist/bundle/store-EPG2YPN3.js +291 -0
  158. package/dist/bundle/store-SQWQJE32.js +181 -0
  159. package/dist/bundle/store-maintenance-command-FTGSICVA.js +66 -0
  160. package/dist/bundle/surface-SNMHY6GP.js +65 -0
  161. package/dist/bundle/wordpress.js +183 -0
  162. package/dist/commands/api.d.ts +22 -0
  163. package/dist/commands/api.d.ts.map +1 -0
  164. package/dist/commands/api.js +37 -0
  165. package/dist/commands/api.js.map +1 -0
  166. package/dist/commands/content.d.ts +4 -0
  167. package/dist/commands/content.d.ts.map +1 -0
  168. package/dist/commands/content.js +94 -0
  169. package/dist/commands/content.js.map +1 -0
  170. package/dist/commands/session.d.ts +8 -0
  171. package/dist/commands/session.d.ts.map +1 -0
  172. package/dist/commands/session.js +28 -0
  173. package/dist/commands/session.js.map +1 -0
  174. package/dist/config.d.ts +13 -0
  175. package/dist/config.d.ts.map +1 -0
  176. package/dist/config.js +69 -0
  177. package/dist/config.js.map +1 -0
  178. package/dist/context.d.ts +37 -0
  179. package/dist/context.d.ts.map +1 -0
  180. package/dist/context.js +31 -0
  181. package/dist/context.js.map +1 -0
  182. package/dist/generated/definitions.d.ts +3 -0
  183. package/dist/generated/definitions.d.ts.map +1 -0
  184. package/dist/generated/definitions.js +7982 -0
  185. package/dist/generated/definitions.js.map +1 -0
  186. package/dist/generated/manifest.d.ts +6 -0
  187. package/dist/generated/manifest.d.ts.map +1 -0
  188. package/dist/generated/manifest.js +8830 -0
  189. package/dist/generated/manifest.js.map +1 -0
  190. package/dist/generated/schemas.d.ts +229 -0
  191. package/dist/generated/schemas.d.ts.map +1 -0
  192. package/dist/generated/schemas.js +2019 -0
  193. package/dist/generated/schemas.js.map +1 -0
  194. package/dist/generated/types.d.ts +3365 -0
  195. package/dist/generated/types.d.ts.map +1 -0
  196. package/dist/generated/types.js +5 -0
  197. package/dist/generated/types.js.map +1 -0
  198. package/dist/generated/wirecat-config.d.ts +11 -0
  199. package/dist/generated/wirecat-config.d.ts.map +1 -0
  200. package/dist/generated/wirecat-config.js +337 -0
  201. package/dist/generated/wirecat-config.js.map +1 -0
  202. package/dist/identity.d.ts +28 -0
  203. package/dist/identity.d.ts.map +1 -0
  204. package/dist/identity.js +29 -0
  205. package/dist/identity.js.map +1 -0
  206. package/dist/index.d.ts +3 -0
  207. package/dist/index.d.ts.map +1 -0
  208. package/dist/index.js +3 -0
  209. package/dist/index.js.map +1 -0
  210. package/dist/program.d.ts +6 -0
  211. package/dist/program.d.ts.map +1 -0
  212. package/dist/program.js +53 -0
  213. package/dist/program.js.map +1 -0
  214. package/dist/version.d.ts +2 -0
  215. package/dist/version.d.ts.map +1 -0
  216. package/dist/version.js +2 -0
  217. package/dist/version.js.map +1 -0
  218. package/dist/wcat.d.ts +3 -0
  219. package/dist/wcat.d.ts.map +1 -0
  220. package/dist/wcat.js +4 -0
  221. package/dist/wcat.js.map +1 -0
  222. package/package.json +87 -4
  223. package/skills/wordpress-cli/SKILL.md +88 -0
  224. package/skills/wordpress-cli/references/api/api-block-directory.md +17 -0
  225. package/skills/wordpress-cli/references/api/api-block-patterns.md +13 -0
  226. package/skills/wordpress-cli/references/api/api-block-types.md +34 -0
  227. package/skills/wordpress-cli/references/api/api-blocks.md +159 -0
  228. package/skills/wordpress-cli/references/api/api-categories.md +69 -0
  229. package/skills/wordpress-cli/references/api/api-comments.md +79 -0
  230. package/skills/wordpress-cli/references/api/api-font-collections.md +16 -0
  231. package/skills/wordpress-cli/references/api/api-font-families.md +122 -0
  232. package/skills/wordpress-cli/references/api/api-global-styles.md +29 -0
  233. package/skills/wordpress-cli/references/api/api-media.md +106 -0
  234. package/skills/wordpress-cli/references/api/api-menu-items.md +115 -0
  235. package/skills/wordpress-cli/references/api/api-menu-locations.md +22 -0
  236. package/skills/wordpress-cli/references/api/api-menus.md +69 -0
  237. package/skills/wordpress-cli/references/api/api-navigation.md +155 -0
  238. package/skills/wordpress-cli/references/api/api-pages.md +161 -0
  239. package/skills/wordpress-cli/references/api/api-pattern-directory.md +23 -0
  240. package/skills/wordpress-cli/references/api/api-plugins.md +25 -0
  241. package/skills/wordpress-cli/references/api/api-posts.md +166 -0
  242. package/skills/wordpress-cli/references/api/api-search.md +21 -0
  243. package/skills/wordpress-cli/references/api/api-settings.md +19 -0
  244. package/skills/wordpress-cli/references/api/api-sidebars.md +34 -0
  245. package/skills/wordpress-cli/references/api/api-statuses.md +22 -0
  246. package/skills/wordpress-cli/references/api/api-tags.md +69 -0
  247. package/skills/wordpress-cli/references/api/api-taxonomies.md +23 -0
  248. package/skills/wordpress-cli/references/api/api-template-parts.md +38 -0
  249. package/skills/wordpress-cli/references/api/api-templates.md +38 -0
  250. package/skills/wordpress-cli/references/api/api-themes.md +12 -0
  251. package/skills/wordpress-cli/references/api/api-types.md +22 -0
  252. package/skills/wordpress-cli/references/api/api-users.md +149 -0
  253. package/skills/wordpress-cli/references/api/api-widget-types.md +46 -0
  254. package/skills/wordpress-cli/references/api/api-widgets.md +57 -0
  255. package/skills/wordpress-cli/references/api/api-wp-pattern-category.md +69 -0
  256. package/skills/wordpress-cli/references/api.md +44 -0
@@ -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-4HEXAGKT.js";
7
+ import {
8
+ OPENAI_URL,
9
+ openRemote,
10
+ remoteKey,
11
+ remoteModel
12
+ } from "./chunk-LWTETL2O.js";
13
+ import {
14
+ endpointFetch
15
+ } from "./chunk-JAE5B4G7.js";
16
+ import {
17
+ isTextModelInstalled,
18
+ openEmbedder,
19
+ textModelsDirectory
20
+ } from "./chunk-VBRRMGON.js";
21
+ import {
22
+ CliError
23
+ } from "./chunk-HM6AMYHR.js";
24
+ import {
25
+ __name
26
+ } from "./chunk-ZVVMGPBJ.js";
27
+
28
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/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,52 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ readSharedSection,
5
+ writeSharedSection
6
+ } from "./chunk-T5SOY3AE.js";
7
+ import {
8
+ CliError
9
+ } from "./chunk-HM6AMYHR.js";
10
+ import {
11
+ __name
12
+ } from "./chunk-ZVVMGPBJ.js";
13
+
14
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/cli/setup-answers.js
15
+ var PERMISSION_ANSWERS = ["readonly", "allow"];
16
+ var QUESTIONS = ["languages", "tools", "permissions"];
17
+ var SECTION = "setup";
18
+ var readSetupAnswers = /* @__PURE__ */ __name((path) => {
19
+ const section = readSharedSection(path, SECTION);
20
+ if (section === void 0)
21
+ return {};
22
+ const answers = section;
23
+ 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))
24
+ throw new CliError("configuration_error", `${path}: ${SECTION} holds what setup asked \u2014 languages: true, tools: true, permissions: ${PERMISSION_ANSWERS.join(" | ")}`);
25
+ return answers;
26
+ }, "readSetupAnswers");
27
+ var unanswered = /* @__PURE__ */ __name((answers) => QUESTIONS.filter((question) => answers[question] === void 0), "unanswered");
28
+ var writeSetupAnswers = /* @__PURE__ */ __name((path, answers) => {
29
+ let kept = {};
30
+ try {
31
+ kept = readSetupAnswers(path);
32
+ } catch (error) {
33
+ if (!(error instanceof CliError) || !error.message.includes(`${SECTION} holds`))
34
+ throw error;
35
+ }
36
+ writeSharedSection(path, SECTION, { ...kept, ...answers });
37
+ }, "writeSetupAnswers");
38
+ var permissionCeiling = /* @__PURE__ */ __name((path) => {
39
+ try {
40
+ return readSetupAnswers(path).permissions === "readonly" ? "readonly" : void 0;
41
+ } catch {
42
+ return void 0;
43
+ }
44
+ }, "permissionCeiling");
45
+
46
+ export {
47
+ QUESTIONS,
48
+ readSetupAnswers,
49
+ unanswered,
50
+ writeSetupAnswers,
51
+ permissionCeiling
52
+ };
@@ -0,0 +1,58 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ importFrom
5
+ } from "./chunk-Y5E2WNWB.js";
6
+ import {
7
+ CliError
8
+ } from "./chunk-HM6AMYHR.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
14
+ import { readFileSync } from "node:fs";
15
+ var musl = /* @__PURE__ */ __name(() => {
16
+ if (process.platform !== "linux")
17
+ return false;
18
+ try {
19
+ return readFileSync("/proc/self/maps", "utf8").includes("ld-musl");
20
+ } catch {
21
+ return false;
22
+ }
23
+ }, "musl");
24
+ var found;
25
+ var vectorExtension = /* @__PURE__ */ __name(() => {
26
+ found ??= locate();
27
+ return found;
28
+ }, "vectorExtension");
29
+ var locate = /* @__PURE__ */ __name(async () => {
30
+ const onMusl = musl();
31
+ const target = `${process.platform}-${process.arch}${onMusl ? "-musl" : ""}`;
32
+ let path;
33
+ try {
34
+ const { extensionFor } = await importFrom(new URL("store/vector-extension.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
35
+ path = extensionFor({ musl: onMusl });
36
+ } catch {
37
+ path = void 0;
38
+ }
39
+ if (path === void 0) {
40
+ found = void 0;
41
+ throw new CliError("configuration_error", `the message store needs the sqlite-vec extension, and @wirecat/cli-core-sqlite has none for ${target} \u2014 reinstall the CLI so its dependencies install with it (an install that skips optional or native packages leaves it out)`, { reason: "store.vector-extension-missing", target });
42
+ }
43
+ return path;
44
+ }, "locate");
45
+ var loadVectorExtension = /* @__PURE__ */ __name((database, path) => {
46
+ try {
47
+ database.loadExtension(path);
48
+ } catch (error) {
49
+ throw new CliError("configuration_error", `the sqlite-vec extension did not load on ${process.platform}-${process.arch} \u2014 reinstall the CLI; on macOS under Bun, @wirecat/cli-core-sqlite's SQLite must be installed, since the system's cannot load extensions`, { reason: "store.vector-extension-failed", cause: error instanceof Error ? error.message : String(error) });
50
+ } finally {
51
+ database.enableLoadExtension?.(false);
52
+ }
53
+ }, "loadVectorExtension");
54
+
55
+ export {
56
+ vectorExtension,
57
+ loadVectorExtension
58
+ };
@@ -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.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/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
+ };