@wirecat/amo-cli 0.5.0 → 0.7.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 (281) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -2
  3. package/contracts/wirecat.json +14 -0
  4. package/dist/amo/button.js +1 -1
  5. package/dist/amo/json.js +1 -1
  6. package/dist/amo/oauth.js +3 -5
  7. package/dist/amo/transport.js +3 -7
  8. package/dist/api-keys.js +1 -1
  9. package/dist/bin/amo.js +11 -11
  10. package/dist/bundle/amo.js +5 -183
  11. package/dist/bundle/{chunk-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
  12. package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
  13. package/dist/bundle/chunk-AEWYRB6F.js +8 -0
  14. package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
  15. package/dist/bundle/chunk-N2UB32VN.js +76 -0
  16. package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
  17. package/dist/bundle/program-SQH3SPOW.js +2352 -0
  18. package/dist/bundle/{instructions-AMH5RWVJ.js → source-C65ZJUTW.js} +5 -6
  19. package/dist/bundle/store-SJ2TOUGU.js +12 -0
  20. package/dist/bundle/writer-I7GBI3VE.js +12 -0
  21. package/dist/commands/account.js +1 -1
  22. package/dist/commands/api.js +1 -3
  23. package/dist/commands/crm-shared.js +2 -3
  24. package/dist/commands/schedule.js +1 -1
  25. package/dist/commands/session.js +1 -8
  26. package/dist/commands/write.js +1 -2
  27. package/dist/config.js +1 -2
  28. package/dist/context.js +1 -2
  29. package/dist/crm/activities.js +1 -1
  30. package/dist/crm/records.js +1 -1
  31. package/dist/crm/source.js +1 -1
  32. package/dist/crm/writer.js +1 -1
  33. package/dist/identity.js +4 -0
  34. package/dist/program.js +1 -2
  35. package/dist/setup/flow.js +1 -1
  36. package/dist/store.js +1 -1
  37. package/dist/version.js +1 -1
  38. package/dist/whoami.js +1 -1
  39. package/package.json +3 -3
  40. package/scenarios/first-sync.md +13 -11
  41. package/scenarios/keep-in-sync.md +7 -6
  42. package/scenarios/safe-agent-writes.md +10 -9
  43. package/dist/amo/account.d.ts +0 -18
  44. package/dist/amo/account.d.ts.map +0 -1
  45. package/dist/amo/account.js.map +0 -1
  46. package/dist/amo/allow-list.d.ts +0 -31
  47. package/dist/amo/allow-list.d.ts.map +0 -1
  48. package/dist/amo/allow-list.js.map +0 -1
  49. package/dist/amo/button.d.ts +0 -53
  50. package/dist/amo/button.d.ts.map +0 -1
  51. package/dist/amo/button.js.map +0 -1
  52. package/dist/amo/errors.d.ts +0 -12
  53. package/dist/amo/errors.d.ts.map +0 -1
  54. package/dist/amo/errors.js.map +0 -1
  55. package/dist/amo/json.d.ts +0 -3
  56. package/dist/amo/json.d.ts.map +0 -1
  57. package/dist/amo/json.js.map +0 -1
  58. package/dist/amo/oauth.d.ts +0 -64
  59. package/dist/amo/oauth.d.ts.map +0 -1
  60. package/dist/amo/oauth.js.map +0 -1
  61. package/dist/amo/operation.d.ts +0 -45
  62. package/dist/amo/operation.d.ts.map +0 -1
  63. package/dist/amo/operation.js.map +0 -1
  64. package/dist/amo/operations.d.ts +0 -3
  65. package/dist/amo/operations.d.ts.map +0 -1
  66. package/dist/amo/operations.js.map +0 -1
  67. package/dist/amo/routes.d.ts +0 -67
  68. package/dist/amo/routes.d.ts.map +0 -1
  69. package/dist/amo/routes.js.map +0 -1
  70. package/dist/amo/transport.d.ts +0 -62
  71. package/dist/amo/transport.d.ts.map +0 -1
  72. package/dist/amo/transport.js.map +0 -1
  73. package/dist/api-keys.d.ts +0 -47
  74. package/dist/api-keys.d.ts.map +0 -1
  75. package/dist/api-keys.js.map +0 -1
  76. package/dist/bin/amo.d.ts +0 -3
  77. package/dist/bin/amo.d.ts.map +0 -1
  78. package/dist/bin/amo.js.map +0 -1
  79. package/dist/bundle/agent-EFMUK732.js +0 -41
  80. package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
  81. package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
  82. package/dist/bundle/app-server-QRBQODF2.js +0 -257
  83. package/dist/bundle/areas-QVHVU57Z.js +0 -63
  84. package/dist/bundle/bun-OPDGMZZQ.js +0 -169
  85. package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
  86. package/dist/bundle/chunk-2JHVQMVC.js +0 -16
  87. package/dist/bundle/chunk-2XBDILVW.js +0 -53
  88. package/dist/bundle/chunk-3DEQUYEG.js +0 -185
  89. package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
  90. package/dist/bundle/chunk-3HC5F3P7.js +0 -24
  91. package/dist/bundle/chunk-3YM4B2GT.js +0 -63
  92. package/dist/bundle/chunk-43OW5NTG.js +0 -338
  93. package/dist/bundle/chunk-43PMSR33.js +0 -357
  94. package/dist/bundle/chunk-4N7PP76S.js +0 -6848
  95. package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
  96. package/dist/bundle/chunk-57HFPNMF.js +0 -189
  97. package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
  98. package/dist/bundle/chunk-633NQY2R.js +0 -80
  99. package/dist/bundle/chunk-63N46DJU.js +0 -12278
  100. package/dist/bundle/chunk-6D4VWSJD.js +0 -259
  101. package/dist/bundle/chunk-6JTHXWPE.js +0 -64
  102. package/dist/bundle/chunk-6QGUK3H7.js +0 -161
  103. package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
  104. package/dist/bundle/chunk-7IR2G5XY.js +0 -559
  105. package/dist/bundle/chunk-7IWIFVXH.js +0 -52
  106. package/dist/bundle/chunk-ABX7BBS4.js +0 -388
  107. package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
  108. package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
  109. package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
  110. package/dist/bundle/chunk-BIKOE2IW.js +0 -614
  111. package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
  112. package/dist/bundle/chunk-CGW5R4UD.js +0 -362
  113. package/dist/bundle/chunk-D4NE7EON.js +0 -170
  114. package/dist/bundle/chunk-D72URWJE.js +0 -532
  115. package/dist/bundle/chunk-DFDN6AUB.js +0 -21
  116. package/dist/bundle/chunk-DNCLQPOM.js +0 -7
  117. package/dist/bundle/chunk-DPV53EZC.js +0 -206
  118. package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
  119. package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
  120. package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
  121. package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
  122. package/dist/bundle/chunk-EHK73OSW.js +0 -2017
  123. package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
  124. package/dist/bundle/chunk-FV4GQNIK.js +0 -136
  125. package/dist/bundle/chunk-G2TU5RYY.js +0 -332
  126. package/dist/bundle/chunk-GDK7ETSB.js +0 -218
  127. package/dist/bundle/chunk-GGMAIIVE.js +0 -38
  128. package/dist/bundle/chunk-GLYWZQY4.js +0 -86
  129. package/dist/bundle/chunk-H4AFNENN.js +0 -1343
  130. package/dist/bundle/chunk-HOF7GQWW.js +0 -142
  131. package/dist/bundle/chunk-HSPEU6S7.js +0 -209
  132. package/dist/bundle/chunk-IA7LLLEI.js +0 -100
  133. package/dist/bundle/chunk-IB55P46L.js +0 -334
  134. package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
  135. package/dist/bundle/chunk-JG6LCSEX.js +0 -407
  136. package/dist/bundle/chunk-JLXXUEAM.js +0 -72
  137. package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
  138. package/dist/bundle/chunk-K7YY6SXR.js +0 -738
  139. package/dist/bundle/chunk-KEKXERBE.js +0 -67181
  140. package/dist/bundle/chunk-KZN2BG3P.js +0 -721
  141. package/dist/bundle/chunk-LKH3UKLO.js +0 -230
  142. package/dist/bundle/chunk-LZPKBN3C.js +0 -193
  143. package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
  144. package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
  145. package/dist/bundle/chunk-NISH4UXM.js +0 -58
  146. package/dist/bundle/chunk-NSKMNIY6.js +0 -460
  147. package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
  148. package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
  149. package/dist/bundle/chunk-Q7ICVP25.js +0 -18
  150. package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
  151. package/dist/bundle/chunk-R53XXHEI.js +0 -76
  152. package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
  153. package/dist/bundle/chunk-RN6RT5CB.js +0 -58
  154. package/dist/bundle/chunk-RRTMPSQR.js +0 -29
  155. package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
  156. package/dist/bundle/chunk-S6JG4YUH.js +0 -72
  157. package/dist/bundle/chunk-TAVI73RW.js +0 -288
  158. package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
  159. package/dist/bundle/chunk-TXDR6YSF.js +0 -23
  160. package/dist/bundle/chunk-TY7NDMFY.js +0 -46
  161. package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
  162. package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
  163. package/dist/bundle/chunk-V2CNGXWX.js +0 -798
  164. package/dist/bundle/chunk-VB7FZOYX.js +0 -633
  165. package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
  166. package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
  167. package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
  168. package/dist/bundle/chunk-WOPVBRPV.js +0 -29
  169. package/dist/bundle/chunk-WXJYMMEL.js +0 -95
  170. package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
  171. package/dist/bundle/chunk-XEQQJBBO.js +0 -92
  172. package/dist/bundle/chunk-XUT7DSM5.js +0 -108
  173. package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
  174. package/dist/bundle/chunk-YWDFYQOU.js +0 -82
  175. package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
  176. package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
  177. package/dist/bundle/cli-3NXOSENF.js +0 -1239
  178. package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
  179. package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
  180. package/dist/bundle/decode-K7U7X5EL.js +0 -296
  181. package/dist/bundle/dispatch-56FECRCU.js +0 -411
  182. package/dist/bundle/dist-PAKDDIBT.js +0 -191
  183. package/dist/bundle/dist-T54K3FJV.js +0 -7577
  184. package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
  185. package/dist/bundle/embed-SWLVG73O.js +0 -37
  186. package/dist/bundle/embedder-EJN75BPV.js +0 -110
  187. package/dist/bundle/failure-WDSX6H3B.js +0 -24
  188. package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
  189. package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
  190. package/dist/bundle/mcp-5HFPWC3W.js +0 -167
  191. package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
  192. package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
  193. package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
  194. package/dist/bundle/node-EGMCBAO7.js +0 -176
  195. package/dist/bundle/node-P4E63KXA.js +0 -2340
  196. package/dist/bundle/node-TLZSIHIJ.js +0 -21
  197. package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
  198. package/dist/bundle/oauth-2SNRBIJM.js +0 -19
  199. package/dist/bundle/open-ABCPY5IH.js +0 -22
  200. package/dist/bundle/openai-4D6PXJR7.js +0 -237
  201. package/dist/bundle/process-SGHEN6MQ.js +0 -91
  202. package/dist/bundle/program-CBDQBZZ3.js +0 -4971
  203. package/dist/bundle/prompt-2QUK5QST.js +0 -16
  204. package/dist/bundle/recognize-QMQSJRIH.js +0 -25
  205. package/dist/bundle/remote-U7TC2BLZ.js +0 -30
  206. package/dist/bundle/rerank-5UPVXGVV.js +0 -51
  207. package/dist/bundle/serve-VX6GUM6J.js +0 -198
  208. package/dist/bundle/server-FOPC6DJ3.js +0 -219
  209. package/dist/bundle/server-OIVNOMVK.js +0 -87
  210. package/dist/bundle/source-HWS5SJIV.js +0 -46
  211. package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
  212. package/dist/bundle/state-X2HU6GB2.js +0 -35
  213. package/dist/bundle/store-2U4U6KL4.js +0 -184
  214. package/dist/bundle/store-3CHPHFP7.js +0 -301
  215. package/dist/bundle/store-Z3747L5F.js +0 -34
  216. package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
  217. package/dist/bundle/surface-MUT72QON.js +0 -73
  218. package/dist/bundle/writer-RBKQ64ZM.js +0 -48
  219. package/dist/commands/account.d.ts +0 -4
  220. package/dist/commands/account.d.ts.map +0 -1
  221. package/dist/commands/account.js.map +0 -1
  222. package/dist/commands/api.d.ts +0 -3
  223. package/dist/commands/api.d.ts.map +0 -1
  224. package/dist/commands/api.js.map +0 -1
  225. package/dist/commands/crm-shared.d.ts +0 -8
  226. package/dist/commands/crm-shared.d.ts.map +0 -1
  227. package/dist/commands/crm-shared.js.map +0 -1
  228. package/dist/commands/schedule.d.ts +0 -3
  229. package/dist/commands/schedule.d.ts.map +0 -1
  230. package/dist/commands/schedule.js.map +0 -1
  231. package/dist/commands/session.d.ts +0 -35
  232. package/dist/commands/session.d.ts.map +0 -1
  233. package/dist/commands/session.js.map +0 -1
  234. package/dist/commands/write.d.ts +0 -14
  235. package/dist/commands/write.d.ts.map +0 -1
  236. package/dist/commands/write.js.map +0 -1
  237. package/dist/config.d.ts +0 -4
  238. package/dist/config.d.ts.map +0 -1
  239. package/dist/config.js.map +0 -1
  240. package/dist/context.d.ts +0 -62
  241. package/dist/context.d.ts.map +0 -1
  242. package/dist/context.js.map +0 -1
  243. package/dist/crm/activities.d.ts +0 -32
  244. package/dist/crm/activities.d.ts.map +0 -1
  245. package/dist/crm/activities.js.map +0 -1
  246. package/dist/crm/records.d.ts +0 -20
  247. package/dist/crm/records.d.ts.map +0 -1
  248. package/dist/crm/records.js.map +0 -1
  249. package/dist/crm/source.d.ts +0 -41
  250. package/dist/crm/source.d.ts.map +0 -1
  251. package/dist/crm/source.js.map +0 -1
  252. package/dist/crm/writer.d.ts +0 -14
  253. package/dist/crm/writer.d.ts.map +0 -1
  254. package/dist/crm/writer.js.map +0 -1
  255. package/dist/identity.d.ts +0 -7
  256. package/dist/identity.d.ts.map +0 -1
  257. package/dist/identity.js.map +0 -1
  258. package/dist/index.d.ts +0 -3
  259. package/dist/index.d.ts.map +0 -1
  260. package/dist/index.js.map +0 -1
  261. package/dist/program.d.ts +0 -6
  262. package/dist/program.d.ts.map +0 -1
  263. package/dist/program.js.map +0 -1
  264. package/dist/reasons.d.ts +0 -10
  265. package/dist/reasons.d.ts.map +0 -1
  266. package/dist/reasons.js.map +0 -1
  267. package/dist/setup/flow.d.ts +0 -2
  268. package/dist/setup/flow.d.ts.map +0 -1
  269. package/dist/setup/flow.js.map +0 -1
  270. package/dist/store.d.ts +0 -15
  271. package/dist/store.d.ts.map +0 -1
  272. package/dist/store.js.map +0 -1
  273. package/dist/version.d.ts +0 -2
  274. package/dist/version.d.ts.map +0 -1
  275. package/dist/version.js.map +0 -1
  276. package/dist/wcat.d.ts +0 -3
  277. package/dist/wcat.d.ts.map +0 -1
  278. package/dist/wcat.js.map +0 -1
  279. package/dist/whoami.d.ts +0 -24
  280. package/dist/whoami.d.ts.map +0 -1
  281. package/dist/whoami.js.map +0 -1
@@ -1,259 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- textModel,
5
- vectorModelKey
6
- } from "./chunk-IB55P46L.js";
7
- import {
8
- OPENAI_URL,
9
- openRemote,
10
- remoteKey,
11
- remoteModel
12
- } from "./chunk-3DEQUYEG.js";
13
- import {
14
- endpointFetch
15
- } from "./chunk-G2TU5RYY.js";
16
- import {
17
- isTextModelInstalled,
18
- openEmbedder,
19
- textModelsDirectory
20
- } from "./chunk-ADTI5RUO.js";
21
- import {
22
- CliError
23
- } from "./chunk-S6JG4YUH.js";
24
- import {
25
- __name
26
- } from "./chunk-ZVVMGPBJ.js";
27
-
28
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/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
- };
@@ -1,64 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- count,
5
- id,
6
- text,
7
- time
8
- } from "./chunk-PPSAWFJD.js";
9
- import {
10
- array,
11
- nullable,
12
- optional,
13
- picklist,
14
- record,
15
- reference,
16
- strictObject,
17
- string,
18
- unknown
19
- } from "./chunk-QFOP3KUP.js";
20
-
21
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/entities/note.js
22
- var link = {
23
- target_text: nullable(text),
24
- kind: text,
25
- anchor: nullable(text)
26
- };
27
- var note = strictObject({
28
- ref: reference,
29
- kind: optional(picklist(["note", "document"])),
30
- provider: optional(text),
31
- account: optional(text),
32
- url: optional(text),
33
- id,
34
- source: picklist(["file", "internal"]),
35
- folder_id: nullable(id),
36
- path: nullable(text),
37
- title: nullable(text),
38
- text,
39
- /** Raises on every edit; `notes edit --revision` takes it, so an edit made meanwhile is refused, not lost. */
40
- revision: count,
41
- /** A file's front matter as parsed, keys as the file writes them; null for a note without it. */
42
- front_matter: nullable(record(string(), unknown())),
43
- /** The hash of a file's bytes when last imported; null for a note written here. */
44
- content_hash: nullable(text),
45
- /** The file the note was exported to, where that is known; null otherwise. */
46
- export_path: nullable(text),
47
- created_at: time,
48
- /** When the store's copy last changed. */
49
- updated_at: time,
50
- deleted_at: optional(nullable(time)),
51
- tags: optional(array(text)),
52
- /** The first line holding a word of a search. */
53
- excerpt: optional(text),
54
- /** Which halves of a search found it. */
55
- found_by: optional(array(picklist(["title", "words", "meaning"]))),
56
- /** What the note links to; `to` is null while the name written matches nothing stored. */
57
- links: optional(array(strictObject({ to: nullable(reference), ...link }))),
58
- /** The notes and messages that link to it. */
59
- backlinks: optional(array(strictObject({ from: reference, ...link })))
60
- });
61
-
62
- export {
63
- note
64
- };
@@ -1,161 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- holdLock,
5
- readLock,
6
- releaseLock,
7
- takeLock
8
- } from "./chunk-GLYWZQY4.js";
9
- import {
10
- __name
11
- } from "./chunk-ZVVMGPBJ.js";
12
-
13
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
14
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
15
-
16
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
17
- import { randomBytes } from "node:crypto";
18
- import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
19
- import { dirname } from "node:path";
20
- var WRITE_EVERY_MS = 2e3;
21
- var TOOL_NAME = /^[A-Za-z0-9_.-]{1,64}$/;
22
- var httpActivityFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.activity.json`, "httpActivityFile");
23
- var localDay = /* @__PURE__ */ __name((ms) => {
24
- const d = new Date(ms);
25
- return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
26
- }, "localDay");
27
- var readActivity = /* @__PURE__ */ __name((path) => {
28
- if (!existsSync(path))
29
- return {};
30
- try {
31
- const parsed = JSON.parse(readFileSync(path, "utf8"));
32
- return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
33
- } catch {
34
- return {};
35
- }
36
- }, "readActivity");
37
- var calledTools = /* @__PURE__ */ __name((body) => (Array.isArray(body) ? body : [body]).flatMap((message) => {
38
- if (!message || typeof message !== "object")
39
- return [];
40
- const { method, params } = message;
41
- const name = params?.name;
42
- return method === "tools/call" && typeof name === "string" && TOOL_NAME.test(name) ? [name] : [];
43
- }), "calledTools");
44
- var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
45
- const activity = readActivity(path);
46
- let timer;
47
- const write = /* @__PURE__ */ __name(() => {
48
- timer = void 0;
49
- try {
50
- mkdirSync(dirname(path), { recursive: true, mode: 448 });
51
- const temporary = `${path}.${randomBytes(8).toString("hex")}.tmp`;
52
- writeFileSync(temporary, JSON.stringify(activity), { mode: 384, flag: "wx" });
53
- chmodSync(temporary, 384);
54
- renameSync(temporary, path);
55
- } catch {
56
- }
57
- }, "write");
58
- return {
59
- record: /* @__PURE__ */ __name((clientId, tools) => {
60
- const at = now();
61
- const iso = new Date(at).toISOString();
62
- const day = localDay(at);
63
- const before = activity[clientId];
64
- const counted = before?.day === day ? before.toolCalls : 0;
65
- const last = tools.at(-1);
66
- activity[clientId] = {
67
- lastRequestAt: iso,
68
- day,
69
- toolCalls: counted + tools.length,
70
- ...last ? { lastTool: last, lastToolAt: iso } : before?.lastTool ? { lastTool: before.lastTool, ...before.lastToolAt ? { lastToolAt: before.lastToolAt } : {} } : {}
71
- };
72
- if (last) {
73
- clearTimeout(timer);
74
- write();
75
- } else if (!timer) {
76
- timer = setTimeout(write, WRITE_EVERY_MS);
77
- timer.unref();
78
- }
79
- }, "record"),
80
- flush: /* @__PURE__ */ __name(() => {
81
- if (!timer)
82
- return;
83
- clearTimeout(timer);
84
- write();
85
- }, "flush")
86
- };
87
- }, "activityRecorder");
88
-
89
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
90
- var ACCESS_SECONDS = 60 * 60;
91
- var REFRESH_SECONDS = 30 * 24 * 60 * 60;
92
- var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
93
- var mcpHttpMarker = /* @__PURE__ */ __name((envPrefix) => `${envPrefix}_MCP_HTTP`, "mcpHttpMarker");
94
- var httpLogFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.log`, "httpLogFile");
95
- var httpLockFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.lock`, "httpLockFile");
96
- var httpLaunchFile = /* @__PURE__ */ __name((lockFile) => `${lockFile.replace(/\.lock$/, "")}.launch.json`, "httpLaunchFile");
97
- var readHttpLaunch = /* @__PURE__ */ __name((path) => {
98
- try {
99
- const launch = JSON.parse(readFileSync2(path, "utf8"));
100
- return typeof launch.invocation === "string" && Array.isArray(launch.argv) && launch.argv.every((word) => typeof word === "string") && typeof launch.env === "object" && launch.env !== null ? launch : void 0;
101
- } catch {
102
- return void 0;
103
- }
104
- }, "readHttpLaunch");
105
- var readHttpLock = /* @__PURE__ */ __name((path) => {
106
- const lock = readLock(path);
107
- return lock && typeof lock.port === "number" && typeof lock.publicUrl === "string" ? lock : void 0;
108
- }, "readHttpLock");
109
- var httpLock = /* @__PURE__ */ __name((path, first) => {
110
- let current = first;
111
- const held = takeLock(path, current);
112
- return {
113
- held,
114
- update: /* @__PURE__ */ __name((change) => {
115
- current = { ...current, ...change };
116
- holdLock(path, current);
117
- }, "update"),
118
- release: /* @__PURE__ */ __name(() => releaseLock(path), "release")
119
- };
120
- }, "httpLock");
121
- var signedInClients = /* @__PURE__ */ __name((tokenFile, now = Date.now()) => {
122
- const seconds = Math.floor(now / 1e3);
123
- const { clients, tokens } = readStored(tokenFile);
124
- const activity = readActivity(httpActivityFile(tokenFile));
125
- const today = localDay(now);
126
- const last = /* @__PURE__ */ new Map();
127
- for (const token of tokens) {
128
- if (token.expiresAt <= seconds)
129
- continue;
130
- const issued = token.expiresAt - (token.kind === "access" ? ACCESS_SECONDS : REFRESH_SECONDS);
131
- last.set(token.clientId, Math.max(last.get(token.clientId) ?? 0, issued));
132
- }
133
- return clients.filter((client) => last.has(client.id)).map((client) => {
134
- const did = activity[client.id];
135
- return {
136
- claimedName: client.name ?? null,
137
- lastLoginAt: new Date((last.get(client.id) ?? 0) * 1e3).toISOString(),
138
- lastRequestAt: did?.lastRequestAt ?? null,
139
- lastTool: did?.lastTool ?? null,
140
- lastToolAt: did?.lastToolAt ?? null,
141
- toolCallsToday: did?.day === today ? did.toolCalls : 0
142
- };
143
- }).sort((a, b) => b.lastLoginAt.localeCompare(a.lastLoginAt));
144
- }, "signedInClients");
145
-
146
- export {
147
- httpActivityFile,
148
- calledTools,
149
- activityRecorder,
150
- ACCESS_SECONDS,
151
- REFRESH_SECONDS,
152
- readStored,
153
- mcpHttpMarker,
154
- httpLogFile,
155
- httpLockFile,
156
- httpLaunchFile,
157
- readHttpLaunch,
158
- readHttpLock,
159
- httpLock,
160
- signedInClients
161
- };
@@ -1,30 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- CliError
5
- } from "./chunk-S6JG4YUH.js";
6
- import {
7
- __name
8
- } from "./chunk-ZVVMGPBJ.js";
9
-
10
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/ports/messenger.js
11
- var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
12
- get: /* @__PURE__ */ __name((own, key) => {
13
- if (key in own)
14
- return own[key];
15
- const value = inner[key];
16
- return typeof value === "function" ? wrap(String(key), (...args) => value.apply(inner, args)) : value;
17
- }, "get"),
18
- has: /* @__PURE__ */ __name((own, key) => key in own || key in inner, "has")
19
- }), "throughWrapper");
20
- var capability = /* @__PURE__ */ __name((adapter, method, what) => {
21
- const found = adapter[method];
22
- if (typeof found !== "function")
23
- throw new CliError("validation_error", `this messenger cannot ${what}`);
24
- return found.bind(adapter);
25
- }, "capability");
26
-
27
- export {
28
- throughWrapper,
29
- capability
30
- };