@wirecat/yandex-disk-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 (235) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +204 -0
  3. package/README.md +243 -2
  4. package/contracts/wirecat.json +1554 -0
  5. package/dist/bin/ydisk.d.ts +3 -0
  6. package/dist/bin/ydisk.d.ts.map +1 -0
  7. package/dist/bin/ydisk.js +40 -0
  8. package/dist/bin/ydisk.js.map +1 -0
  9. package/dist/bundle/all-profiles-4OLZF3RT.js +279 -0
  10. package/dist/bundle/anthropic-DKB4OJXZ.js +91 -0
  11. package/dist/bundle/app-server-G4545SSV.js +247 -0
  12. package/dist/bundle/bun-RXEQKFED.js +169 -0
  13. package/dist/bundle/bun-sqlite-VHT5LN7U.js +76 -0
  14. package/dist/bundle/chunk-2BITUXGC.js +12289 -0
  15. package/dist/bundle/chunk-2CLWDQKA.js +39330 -0
  16. package/dist/bundle/chunk-2JFDOPKA.js +9575 -0
  17. package/dist/bundle/chunk-3GVI2MAO.js +106 -0
  18. package/dist/bundle/chunk-3SZBWBMI.js +131 -0
  19. package/dist/bundle/chunk-44VSEXW6.js +4054 -0
  20. package/dist/bundle/chunk-4YPRRQBE.js +95 -0
  21. package/dist/bundle/chunk-5COYRL5B.js +379 -0
  22. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  23. package/dist/bundle/chunk-5DM7DIZL.js +1402 -0
  24. package/dist/bundle/chunk-6R2DVTVZ.js +24 -0
  25. package/dist/bundle/chunk-762BS35H.js +2787 -0
  26. package/dist/bundle/chunk-AG64V7AB.js +1233 -0
  27. package/dist/bundle/chunk-BC5HGIXB.js +334 -0
  28. package/dist/bundle/chunk-BH7LFEX7.js +36 -0
  29. package/dist/bundle/chunk-BLNPGY7N.js +53 -0
  30. package/dist/bundle/chunk-CNIA2LJF.js +372 -0
  31. package/dist/bundle/chunk-COSXMDC7.js +230 -0
  32. package/dist/bundle/chunk-D72URWJE.js +532 -0
  33. package/dist/bundle/chunk-D7FO33KU.js +785 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DJH26PQ3.js +1396 -0
  36. package/dist/bundle/chunk-DJPT7IUC.js +64567 -0
  37. package/dist/bundle/chunk-DTMSCZDW.js +209 -0
  38. package/dist/bundle/chunk-E6LGZ5LX.js +16 -0
  39. package/dist/bundle/chunk-E6YRIHS5.js +92 -0
  40. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  41. package/dist/bundle/chunk-F3DDSZTF.js +78 -0
  42. package/dist/bundle/chunk-F4WWTQNL.js +188 -0
  43. package/dist/bundle/chunk-FDDAUASC.js +1028 -0
  44. package/dist/bundle/chunk-FMNPG6N2.js +170 -0
  45. package/dist/bundle/chunk-FOKJ4POB.js +274 -0
  46. package/dist/bundle/chunk-G22C7JG6.js +731 -0
  47. package/dist/bundle/chunk-GA442SYZ.js +161 -0
  48. package/dist/bundle/chunk-GEBSW7UK.js +6848 -0
  49. package/dist/bundle/chunk-GGRKWAOK.js +594 -0
  50. package/dist/bundle/chunk-HHINRNZA.js +788 -0
  51. package/dist/bundle/chunk-HUZCL33L.js +128 -0
  52. package/dist/bundle/chunk-IALSIQVT.js +142 -0
  53. package/dist/bundle/chunk-IOXR2QBX.js +398 -0
  54. package/dist/bundle/chunk-J5CXR6VX.js +63 -0
  55. package/dist/bundle/chunk-J5PWSTOX.js +82 -0
  56. package/dist/bundle/chunk-J7BVAEHR.js +364 -0
  57. package/dist/bundle/chunk-JH46HMZW.js +1334 -0
  58. package/dist/bundle/chunk-JOBO7F6W.js +52 -0
  59. package/dist/bundle/chunk-JXZ5B3L5.js +2333 -0
  60. package/dist/bundle/chunk-KBIAMDZN.js +66 -0
  61. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  62. package/dist/bundle/chunk-LNHTLSR5.js +288 -0
  63. package/dist/bundle/chunk-M24RAKMJ.js +58 -0
  64. package/dist/bundle/chunk-MDQ57Q3H.js +1197 -0
  65. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  66. package/dist/bundle/chunk-MLXQ4X5L.js +206 -0
  67. package/dist/bundle/chunk-NQAKARHE.js +54 -0
  68. package/dist/bundle/chunk-OF7VVUDQ.js +23 -0
  69. package/dist/bundle/chunk-OQVPE3XK.js +324 -0
  70. package/dist/bundle/chunk-OR3QG7UR.js +259 -0
  71. package/dist/bundle/chunk-OUUYVROP.js +76 -0
  72. package/dist/bundle/chunk-PQBAM64O.js +168 -0
  73. package/dist/bundle/chunk-PYVIA7WF.js +88 -0
  74. package/dist/bundle/chunk-Q6HK3PHE.js +72 -0
  75. package/dist/bundle/chunk-QB3KECV2.js +218 -0
  76. package/dist/bundle/chunk-QGWXSFYN.js +73 -0
  77. package/dist/bundle/chunk-RC5QAAAE.js +29 -0
  78. package/dist/bundle/chunk-RMJ26HLB.js +18 -0
  79. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  80. package/dist/bundle/chunk-T7ZUDA4C.js +72 -0
  81. package/dist/bundle/chunk-TRCSMVV5.js +72 -0
  82. package/dist/bundle/chunk-UD2BQEKA.js +46 -0
  83. package/dist/bundle/chunk-V4TL55GS.js +1068 -0
  84. package/dist/bundle/chunk-VJNWN5VU.js +4072 -0
  85. package/dist/bundle/chunk-VRRNBLMA.js +1227 -0
  86. package/dist/bundle/chunk-WUCMMNFJ.js +771 -0
  87. package/dist/bundle/chunk-XDESE3NY.js +44 -0
  88. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  91. package/dist/bundle/chunk-Z2QEON7B.js +2275 -0
  92. package/dist/bundle/chunk-ZMJ56GME.js +7 -0
  93. package/dist/bundle/chunk-ZTSB3D7Q.js +100 -0
  94. package/dist/bundle/chunk-ZVJWD3FK.js +38 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-YIOYGPJA.js +40 -0
  97. package/dist/bundle/command-server-entry-MHBQDXS4.js +169 -0
  98. package/dist/bundle/decode-NUGJIOUW.js +297 -0
  99. package/dist/bundle/definitions-AILHKEQT.js +2005 -0
  100. package/dist/bundle/dispatch-5LC4UEGY.js +411 -0
  101. package/dist/bundle/dist-4I2W6X2I.js +7577 -0
  102. package/dist/bundle/echarts-MHSH6PGC.js +42501 -0
  103. package/dist/bundle/embed-ZDXTHHYS.js +38 -0
  104. package/dist/bundle/embedder-XFEELFUL.js +111 -0
  105. package/dist/bundle/failure-5S7VPBYK.js +25 -0
  106. package/dist/bundle/first-run-JHCHT3RJ.js +29 -0
  107. package/dist/bundle/first-screen-FHGQ6QRV.js +40 -0
  108. package/dist/bundle/instructions-WKSMBUFX.js +11 -0
  109. package/dist/bundle/mcp-HS2ZDUVR.js +167 -0
  110. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  111. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  112. package/dist/bundle/meeting-combined-K4U4NYRZ.js +25 -0
  113. package/dist/bundle/meeting-model-KCEG6Y5O.js +26 -0
  114. package/dist/bundle/meeting-semantic-VYGSV3H6.js +22 -0
  115. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  116. package/dist/bundle/node-CM6NC6UE.js +176 -0
  117. package/dist/bundle/node-KM3CUABH.js +2340 -0
  118. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  119. package/dist/bundle/node-sqlite-5YDQ3LIJ.js +74 -0
  120. package/dist/bundle/notes-search-PGO7KM2U.js +62 -0
  121. package/dist/bundle/oauth-NY4C5UCK.js +20 -0
  122. package/dist/bundle/open-YNUTA6ZE.js +23 -0
  123. package/dist/bundle/openai-4CVT5PHH.js +241 -0
  124. package/dist/bundle/process-2XT3TL27.js +91 -0
  125. package/dist/bundle/program-FMIVF5T6.js +31904 -0
  126. package/dist/bundle/prompt-VNWY3H6S.js +17 -0
  127. package/dist/bundle/recognize-JS4PBPSZ.js +26 -0
  128. package/dist/bundle/remote-RCLFH4V2.js +32 -0
  129. package/dist/bundle/rerank-EG6VKYGO.js +52 -0
  130. package/dist/bundle/schemas-ED2LHKXK.js +645 -0
  131. package/dist/bundle/serve-AHG25QXB.js +199 -0
  132. package/dist/bundle/server-5FTB7WM3.js +78 -0
  133. package/dist/bundle/server-JNZVSAZE.js +209 -0
  134. package/dist/bundle/sqlite-runtime-XSZOAQPF.js +20 -0
  135. package/dist/bundle/state-XGVAJFF7.js +36 -0
  136. package/dist/bundle/store-OHSCWZEV.js +177 -0
  137. package/dist/bundle/store-PKSPKJXL.js +293 -0
  138. package/dist/bundle/store-maintenance-command-KAWGBSWK.js +69 -0
  139. package/dist/bundle/ydisk.js +183 -0
  140. package/dist/commands/api.d.ts +9 -0
  141. package/dist/commands/api.d.ts.map +1 -0
  142. package/dist/commands/api.js +59 -0
  143. package/dist/commands/api.js.map +1 -0
  144. package/dist/commands/comments.d.ts +3 -0
  145. package/dist/commands/comments.d.ts.map +1 -0
  146. package/dist/commands/comments.js +114 -0
  147. package/dist/commands/comments.js.map +1 -0
  148. package/dist/commands/files.d.ts +3 -0
  149. package/dist/commands/files.d.ts.map +1 -0
  150. package/dist/commands/files.js +272 -0
  151. package/dist/commands/files.js.map +1 -0
  152. package/dist/commands/library.d.ts +13 -0
  153. package/dist/commands/library.d.ts.map +1 -0
  154. package/dist/commands/library.js +118 -0
  155. package/dist/commands/library.js.map +1 -0
  156. package/dist/commands/session.d.ts +3 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +99 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +18 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +62 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +80 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +77 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/generated/definitions.d.ts +3 -0
  169. package/dist/generated/definitions.d.ts.map +1 -0
  170. package/dist/generated/definitions.js +2001 -0
  171. package/dist/generated/definitions.js.map +1 -0
  172. package/dist/generated/manifest.d.ts +6 -0
  173. package/dist/generated/manifest.d.ts.map +1 -0
  174. package/dist/generated/manifest.js +1473 -0
  175. package/dist/generated/manifest.js.map +1 -0
  176. package/dist/generated/schemas.d.ts +127 -0
  177. package/dist/generated/schemas.d.ts.map +1 -0
  178. package/dist/generated/schemas.js +545 -0
  179. package/dist/generated/schemas.js.map +1 -0
  180. package/dist/generated/types.d.ts +829 -0
  181. package/dist/generated/types.d.ts.map +1 -0
  182. package/dist/generated/types.js +5 -0
  183. package/dist/generated/types.js.map +1 -0
  184. package/dist/identity.d.ts +10 -0
  185. package/dist/identity.d.ts.map +1 -0
  186. package/dist/identity.js +33 -0
  187. package/dist/identity.js.map +1 -0
  188. package/dist/index.d.ts +3 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +3 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/program.d.ts +6 -0
  193. package/dist/program.d.ts.map +1 -0
  194. package/dist/program.js +65 -0
  195. package/dist/program.js.map +1 -0
  196. package/dist/sample/comments.d.ts +61 -0
  197. package/dist/sample/comments.d.ts.map +1 -0
  198. package/dist/sample/comments.js +39 -0
  199. package/dist/sample/comments.js.map +1 -0
  200. package/dist/sample/records.d.ts +16 -0
  201. package/dist/sample/records.d.ts.map +1 -0
  202. package/dist/sample/records.js +22 -0
  203. package/dist/sample/records.js.map +1 -0
  204. package/dist/sample/transport.d.ts +42 -0
  205. package/dist/sample/transport.d.ts.map +1 -0
  206. package/dist/sample/transport.js +153 -0
  207. package/dist/sample/transport.js.map +1 -0
  208. package/dist/version.d.ts +2 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +2 -0
  211. package/dist/version.js.map +1 -0
  212. package/dist/wcat.d.ts +3 -0
  213. package/dist/wcat.d.ts.map +1 -0
  214. package/dist/wcat.js +4 -0
  215. package/dist/wcat.js.map +1 -0
  216. package/dist/yandex/source.d.ts +39 -0
  217. package/dist/yandex/source.d.ts.map +1 -0
  218. package/dist/yandex/source.js +189 -0
  219. package/dist/yandex/source.js.map +1 -0
  220. package/dist/yandex/transport.d.ts +41 -0
  221. package/dist/yandex/transport.d.ts.map +1 -0
  222. package/dist/yandex/transport.js +152 -0
  223. package/dist/yandex/transport.js.map +1 -0
  224. package/dist/yandex/writes.d.ts +27 -0
  225. package/dist/yandex/writes.d.ts.map +1 -0
  226. package/dist/yandex/writes.js +61 -0
  227. package/dist/yandex/writes.js.map +1 -0
  228. package/package.json +88 -4
  229. package/skills/yandex-disk-cli/SKILL.md +46 -0
  230. package/skills/yandex-disk-cli/references/api/api-disk-operations-operation-id.md +13 -0
  231. package/skills/yandex-disk-cli/references/api/api-disk-public-resources.md +50 -0
  232. package/skills/yandex-disk-cli/references/api/api-disk-resources.md +171 -0
  233. package/skills/yandex-disk-cli/references/api/api-disk-trash-resources.md +48 -0
  234. package/skills/yandex-disk-cli/references/api/api-disk.md +13 -0
  235. package/skills/yandex-disk-cli/references/api.md +17 -0
@@ -0,0 +1,21 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ child_process,
5
+ crypto,
6
+ fs,
7
+ os,
8
+ path,
9
+ stream,
10
+ util
11
+ } from "./chunk-DFDN6AUB.js";
12
+ import "./chunk-ZVVMGPBJ.js";
13
+ export {
14
+ child_process,
15
+ crypto,
16
+ fs,
17
+ os,
18
+ path,
19
+ stream,
20
+ util
21
+ };
@@ -0,0 +1,74 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ loadVectorExtension,
5
+ vectorExtension
6
+ } from "./chunk-M24RAKMJ.js";
7
+ import {
8
+ refuseOwnerStoreInTests
9
+ } from "./chunk-NQAKARHE.js";
10
+ import {
11
+ TIME_LIMIT_FUNCTION,
12
+ beforeTimeLimit
13
+ } from "./chunk-ZVJWD3FK.js";
14
+ import "./chunk-762BS35H.js";
15
+ import "./chunk-AG64V7AB.js";
16
+ import "./chunk-S4UUN6LD.js";
17
+ import "./chunk-Y5E2WNWB.js";
18
+ import "./chunk-T7ZUDA4C.js";
19
+ import {
20
+ __name
21
+ } from "./chunk-ZVVMGPBJ.js";
22
+
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/store/drivers/node-sqlite.js
24
+ import { DatabaseSync } from "node:sqlite";
25
+ var openWithNodeSqlite = /* @__PURE__ */ __name(async (path) => cacheOverNodeSqlite(await nodeClient(path)), "openWithNodeSqlite");
26
+ var nodeClient = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
27
+ refuseOwnerStoreInTests(path);
28
+ const extension = await vectorExtension();
29
+ const client = new DatabaseSync(path, { readOnly, allowExtension: true });
30
+ try {
31
+ loadVectorExtension(client, extension);
32
+ return client;
33
+ } catch (error) {
34
+ client.close();
35
+ throw error;
36
+ }
37
+ }, "nodeClient");
38
+ var STATEMENT_CACHE_SIZE = 1e3;
39
+ var cacheOverNodeSqlite = /* @__PURE__ */ __name((database, cacheSize = STATEMENT_CACHE_SIZE) => {
40
+ const statements = /* @__PURE__ */ new Map();
41
+ database.function(TIME_LIMIT_FUNCTION, { deterministic: false, directOnly: true }, beforeTimeLimit);
42
+ const prepare = /* @__PURE__ */ __name((sql) => {
43
+ const statement = database.prepare(sql);
44
+ return {
45
+ run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
46
+ get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters), "get"),
47
+ all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
48
+ };
49
+ }, "prepare");
50
+ return {
51
+ timeLimit: true,
52
+ exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
53
+ prepare: /* @__PURE__ */ __name((sql) => {
54
+ const cached = statements.get(sql);
55
+ if (cached)
56
+ statements.delete(sql);
57
+ const statement = cached ?? prepare(sql);
58
+ statements.set(sql, statement);
59
+ if (statements.size > cacheSize)
60
+ statements.delete(statements.keys().next().value);
61
+ return statement;
62
+ }, "prepare"),
63
+ close: /* @__PURE__ */ __name(() => {
64
+ statements.clear();
65
+ database.close();
66
+ }, "close")
67
+ };
68
+ }, "cacheOverNodeSqlite");
69
+ export {
70
+ STATEMENT_CACHE_SIZE,
71
+ cacheOverNodeSqlite,
72
+ nodeClient,
73
+ openWithNodeSqlite
74
+ };
@@ -0,0 +1,62 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ RANK_WITHIN,
5
+ embedEvents,
6
+ embedMail,
7
+ embedNotes,
8
+ fieldsOfQuery2 as fieldsOfQuery,
9
+ importAccounts,
10
+ localModel,
11
+ nearestNotes,
12
+ noteSourceOfQuery,
13
+ notesScopeOf,
14
+ searchNotes,
15
+ searchNotesOf,
16
+ searchNotesQuery,
17
+ storeQuery,
18
+ withLocal
19
+ } from "./chunk-Z2QEON7B.js";
20
+ import "./chunk-BH7LFEX7.js";
21
+ import "./chunk-OUUYVROP.js";
22
+ import "./chunk-PQBAM64O.js";
23
+ import "./chunk-IOXR2QBX.js";
24
+ import "./chunk-BC5HGIXB.js";
25
+ import "./chunk-GGRKWAOK.js";
26
+ import "./chunk-JXZ5B3L5.js";
27
+ import "./chunk-WUCMMNFJ.js";
28
+ import "./chunk-E6LGZ5LX.js";
29
+ import "./chunk-VRRNBLMA.js";
30
+ import "./chunk-TRCSMVV5.js";
31
+ import "./chunk-RC5QAAAE.js";
32
+ import "./chunk-VJNWN5VU.js";
33
+ import "./chunk-ZMJ56GME.js";
34
+ import "./chunk-Q6HK3PHE.js";
35
+ import "./chunk-CNIA2LJF.js";
36
+ import "./chunk-MDQ57Q3H.js";
37
+ import "./chunk-FDDAUASC.js";
38
+ import "./chunk-FOKJ4POB.js";
39
+ import "./chunk-NQAKARHE.js";
40
+ import "./chunk-762BS35H.js";
41
+ import "./chunk-AG64V7AB.js";
42
+ import "./chunk-S4UUN6LD.js";
43
+ import "./chunk-Y5E2WNWB.js";
44
+ import "./chunk-T7ZUDA4C.js";
45
+ import "./chunk-ZVVMGPBJ.js";
46
+ export {
47
+ RANK_WITHIN,
48
+ embedEvents,
49
+ embedMail,
50
+ embedNotes,
51
+ fieldsOfQuery,
52
+ importAccounts,
53
+ localModel,
54
+ nearestNotes,
55
+ noteSourceOfQuery,
56
+ notesScopeOf,
57
+ searchNotes,
58
+ searchNotesOf,
59
+ searchNotesQuery,
60
+ storeQuery,
61
+ withLocal
62
+ };
@@ -0,0 +1,20 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ ownerLogin,
5
+ revokeAll
6
+ } from "./chunk-LNHTLSR5.js";
7
+ import "./chunk-5D4AEUVA.js";
8
+ import "./chunk-GA442SYZ.js";
9
+ import "./chunk-QGWXSFYN.js";
10
+ import "./chunk-J5CXR6VX.js";
11
+ import "./chunk-762BS35H.js";
12
+ import "./chunk-AG64V7AB.js";
13
+ import "./chunk-S4UUN6LD.js";
14
+ import "./chunk-Y5E2WNWB.js";
15
+ import "./chunk-T7ZUDA4C.js";
16
+ import "./chunk-ZVVMGPBJ.js";
17
+ export {
18
+ ownerLogin,
19
+ revokeAll
20
+ };
@@ -0,0 +1,23 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CAPABILITY_STATEMENTS,
5
+ assertStoreCapable,
6
+ openCache,
7
+ openFile,
8
+ storeCapable
9
+ } from "./chunk-4YPRRQBE.js";
10
+ import "./chunk-ZVJWD3FK.js";
11
+ import "./chunk-762BS35H.js";
12
+ import "./chunk-AG64V7AB.js";
13
+ import "./chunk-S4UUN6LD.js";
14
+ import "./chunk-Y5E2WNWB.js";
15
+ import "./chunk-T7ZUDA4C.js";
16
+ import "./chunk-ZVVMGPBJ.js";
17
+ export {
18
+ CAPABILITY_STATEMENTS,
19
+ assertStoreCapable,
20
+ openCache,
21
+ openFile,
22
+ storeCapable
23
+ };
@@ -0,0 +1,241 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ SAMPLE_RATE,
5
+ toModelRate
6
+ } from "./chunk-COSXMDC7.js";
7
+ import "./chunk-5COYRL5B.js";
8
+ import "./chunk-BH7LFEX7.js";
9
+ import {
10
+ OPENAI_URL
11
+ } from "./chunk-HUZCL33L.js";
12
+ import {
13
+ refuseModelAddress
14
+ } from "./chunk-Q6HK3PHE.js";
15
+ import {
16
+ endpointFetch,
17
+ onThisComputer,
18
+ providerWaitMs
19
+ } from "./chunk-CNIA2LJF.js";
20
+ import "./chunk-MDQ57Q3H.js";
21
+ import "./chunk-FDDAUASC.js";
22
+ import {
23
+ OPENAI_TRANSCRIBE_MODEL,
24
+ VAD,
25
+ filesPresent,
26
+ modelsDirectory,
27
+ vadPath
28
+ } from "./chunk-FOKJ4POB.js";
29
+ import "./chunk-NQAKARHE.js";
30
+ import {
31
+ DEFAULT_RETRY,
32
+ backoffMs
33
+ } from "./chunk-762BS35H.js";
34
+ import "./chunk-AG64V7AB.js";
35
+ import "./chunk-S4UUN6LD.js";
36
+ import "./chunk-Y5E2WNWB.js";
37
+ import {
38
+ CliError
39
+ } from "./chunk-T7ZUDA4C.js";
40
+ import {
41
+ __name
42
+ } from "./chunk-ZVVMGPBJ.js";
43
+
44
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/speech/openai.js
45
+ import { setTimeout as wait } from "node:timers/promises";
46
+
47
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/speech/wav.js
48
+ var encodeWav = /* @__PURE__ */ __name((samples, sampleRate = 16e3) => {
49
+ const bytes = Buffer.alloc(44 + samples.length * 2);
50
+ bytes.write("RIFF", 0, "ascii");
51
+ bytes.writeUInt32LE(bytes.length - 8, 4);
52
+ bytes.write("WAVEfmt ", 8, "ascii");
53
+ bytes.writeUInt32LE(16, 16);
54
+ bytes.writeUInt16LE(1, 20);
55
+ bytes.writeUInt16LE(1, 22);
56
+ bytes.writeUInt32LE(sampleRate, 24);
57
+ bytes.writeUInt32LE(sampleRate * 2, 28);
58
+ bytes.writeUInt16LE(2, 32);
59
+ bytes.writeUInt16LE(16, 34);
60
+ bytes.write("data", 36, "ascii");
61
+ bytes.writeUInt32LE(samples.length * 2, 40);
62
+ samples.forEach((sample, index) => {
63
+ bytes.writeInt16LE(Math.round(Math.max(-1, Math.min(1, sample || 0)) * 32767), 44 + index * 2);
64
+ });
65
+ return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.length);
66
+ }, "encodeWav");
67
+
68
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/speech/openai.js
69
+ var LONGEST_REQUEST_SECONDS = 600;
70
+ var JOINED_SECONDS = 0.2;
71
+ var PAD_SECONDS = 0.2;
72
+ var LEAD = SAMPLE_RATE / 2;
73
+ var EXHAUSTED = /* @__PURE__ */ new Set([
74
+ "insufficient_quota",
75
+ "credit_balance_exhausted",
76
+ "organization_spend_limit_exceeded",
77
+ "project_spend_limit_exceeded",
78
+ "organization_usage_limit_exceeded"
79
+ ]);
80
+ var RETRY = { ...DEFAULT_RETRY, retries: 4 };
81
+ var interrupted = /* @__PURE__ */ __name((signal) => {
82
+ if (!signal?.aborted)
83
+ return;
84
+ if (signal.reason instanceof CliError)
85
+ throw signal.reason;
86
+ const timeout = signal.reason instanceof Error && signal.reason.name === "TimeoutError";
87
+ throw new CliError(timeout ? "timeout" : "cancelled", "the transcription was interrupted");
88
+ }, "interrupted");
89
+ var sleeping = /* @__PURE__ */ __name((ms, signal) => wait(ms, void 0, signal ? { signal } : {}).then(() => void 0, (error) => {
90
+ interrupted(signal);
91
+ throw error;
92
+ }), "sleeping");
93
+ var formOf = /* @__PURE__ */ __name((wav, options) => {
94
+ const form = new FormData();
95
+ form.append("file", new Blob([wav], { type: "audio/wav" }), "audio.wav");
96
+ form.append("model", options.model ?? OPENAI_TRANSCRIBE_MODEL);
97
+ for (const language of options.languages ?? [])
98
+ form.append("languages[]", language);
99
+ for (const keyword of options.keywords ?? [])
100
+ form.append("keywords[]", keyword);
101
+ if (options.prompt)
102
+ form.append("prompt", options.prompt);
103
+ return form;
104
+ }, "formOf");
105
+ var safe = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[\w.-]{1,64}$/.test(value) ? value : void 0, "safe");
106
+ var failureOf = /* @__PURE__ */ __name(async (response) => {
107
+ try {
108
+ const body = await response.json();
109
+ const code = safe(body.error?.code);
110
+ const type = safe(body.error?.type);
111
+ return { ...code ? { code } : {}, ...type ? { type } : {} };
112
+ } catch {
113
+ return {};
114
+ }
115
+ }, "failureOf");
116
+ var TRANSCRIPTION_TIMEOUT_MS = 6e5;
117
+ var send = /* @__PURE__ */ __name(async (wav, options) => {
118
+ const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
119
+ const post = options.fetch ?? endpointFetch(url, TRANSCRIPTION_TIMEOUT_MS);
120
+ const retry = options.retry ?? RETRY;
121
+ const sleep = options.sleep ?? sleeping;
122
+ const random = options.random ?? Math.random;
123
+ const who = options.label ?? "OpenAI";
124
+ for (let attempt = 1; ; attempt++) {
125
+ interrupted(options.signal);
126
+ let response;
127
+ try {
128
+ response = await post(url, {
129
+ method: "POST",
130
+ headers: options.apiKey ? { authorization: `Bearer ${options.apiKey}` } : {},
131
+ body: formOf(wav, options),
132
+ ...options.signal ? { signal: options.signal } : {}
133
+ });
134
+ } catch {
135
+ interrupted(options.signal);
136
+ if (attempt > retry.retries)
137
+ throw new CliError("network_error", `${who} could not be reached`, { reason: "network.failed" });
138
+ await sleep(backoffMs(attempt, retry, random), options.signal);
139
+ continue;
140
+ }
141
+ if (response.ok) {
142
+ const body = await response.json().catch(() => interrupted(options.signal));
143
+ if (typeof body?.text !== "string")
144
+ throw new CliError("invalid_response", `${who} answered without a transcript`, {
145
+ reason: "provider.invalid-response"
146
+ });
147
+ return body.text.trim();
148
+ }
149
+ const { code, type } = await failureOf(response);
150
+ const status = response.status;
151
+ const said = `HTTP ${status}${code ? `, ${code}` : type ? `, ${type}` : ""}`;
152
+ if (status === 401)
153
+ throw new CliError("authentication_error", `${who} refused the key (${said}) \u2014 set it again with \`${options.keyHint ?? "models keys set openai"}\``, { reason: "auth.failed" });
154
+ if (status === 403)
155
+ throw new CliError("permission_error", `${who} refused the request (${said}) \u2014 OpenAI answers this when the country or region is not supported, or the key's project may not use the model`, { reason: "access.denied" });
156
+ if (status === 413)
157
+ throw new CliError("validation_error", `${who} refused the audio as too large (${said})`, {
158
+ reason: "transcription.too-large"
159
+ });
160
+ if (EXHAUSTED.has(code ?? "") || EXHAUSTED.has(type ?? ""))
161
+ throw new CliError("permission_error", `${who} refused: the account's credit, spend limit or usage limit is used up (${said}) \u2014 see the billing page`, { reason: "transcription.quota-exhausted" });
162
+ const again = status === 408 || status === 429 || status >= 500;
163
+ const asked = providerWaitMs(response.headers, () => /* @__PURE__ */ new Date());
164
+ if (again && attempt <= retry.retries && (asked === void 0 || asked <= retry.maxRetryAfterMs)) {
165
+ await sleep(asked ?? backoffMs(attempt, retry, random), options.signal);
166
+ continue;
167
+ }
168
+ if (status === 429)
169
+ throw new CliError("rate_limited", `${who} answered ${said}`, {
170
+ reason: "provider.rate-limited",
171
+ ...asked === void 0 ? {} : { retry_after_ms: asked }
172
+ });
173
+ if (status >= 500)
174
+ throw new CliError([502, 503, 504].includes(status) ? "provider_unavailable" : "provider_error", `${who} answered ${said}`, { reason: [502, 503, 504].includes(status) ? "provider.unavailable" : "provider.refused" });
175
+ throw new CliError("provider_error", `${who} answered ${said}`, { reason: "provider.refused" });
176
+ }
177
+ }, "send");
178
+ var piecesOf = /* @__PURE__ */ __name((spans, limit) => {
179
+ const pieces = [];
180
+ for (const span of spans) {
181
+ const last = pieces.at(-1);
182
+ const joined = last !== void 0 && span.start - last.end < JOINED_SECONDS;
183
+ const fits = last !== void 0 && limit !== void 0 && span.end - last.start <= limit;
184
+ if (last && (fits || joined && span.end - last.start <= LONGEST_REQUEST_SECONDS))
185
+ last.end = span.end;
186
+ else
187
+ pieces.push({ start: span.start, end: span.end });
188
+ }
189
+ return pieces;
190
+ }, "piecesOf");
191
+ var openCutter = /* @__PURE__ */ __name(async (vadModel) => {
192
+ const { openSpeechCutter } = await import("./recognize-JS4PBPSZ.js");
193
+ return openSpeechCutter(vadModel);
194
+ }, "openCutter");
195
+ var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
196
+ const bad = keywords.find((keyword) => typeof keyword !== "string" || !keyword.trim() || /[<>\r\n]/.test(keyword));
197
+ if (bad !== void 0)
198
+ throw new CliError("validation_error", "a keyword must be a non-empty single line without < or > \u2014 OpenAI refuses the whole request otherwise");
199
+ }, "checkKeywords");
200
+ var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
201
+ refuseModelAddress(options.env ?? process.env, options.baseUrl ?? OPENAI_URL, "audio");
202
+ if (!options.apiKey && !onThisComputer(options.baseUrl ?? OPENAI_URL))
203
+ throw new CliError("authentication_error", "no OpenAI key \u2014 `models keys set openai`, or OPENAI_API_KEY", {
204
+ reason: "transcription.no-key"
205
+ });
206
+ checkKeywords(options.keywords);
207
+ interrupted(options.signal);
208
+ const pcm = toModelRate(audio.samples, audio.rate);
209
+ const duration = (pcm.length - LEAD) / SAMPLE_RATE;
210
+ if (options.bundle && duration <= LONGEST_REQUEST_SECONDS) {
211
+ const text = await send(encodeWav(pcm.subarray(LEAD)), options);
212
+ return text ? [{ start: 0, end: duration, text }] : [];
213
+ }
214
+ const vadModel = options.vadModel ?? vadPath(modelsDirectory(options.env));
215
+ if (!options.cutter && !filesPresent([[VAD, vadModel]]))
216
+ throw new CliError("not_found", "the voice detector that finds the speech is not on this machine \u2014 it comes with any speech model: `models download`", { reason: "model.not-downloaded", model: "silero_vad" });
217
+ const cutter = await (options.cutter ?? openCutter)(vadModel);
218
+ let spans;
219
+ try {
220
+ spans = cutter.cut(pcm);
221
+ } finally {
222
+ cutter.free();
223
+ }
224
+ const pieces = piecesOf(spans, options.bundle ? LONGEST_REQUEST_SECONDS : void 0);
225
+ const heard = [];
226
+ for (const [index, piece] of pieces.entries()) {
227
+ const end = Math.min(piece.end, duration);
228
+ const from = Math.max(piece.start - PAD_SECONDS, pieces[index - 1]?.end ?? 0);
229
+ const to = Math.min(end + PAD_SECONDS, pieces[index + 1]?.start ?? duration);
230
+ const samples = pcm.subarray(LEAD + Math.floor(from * SAMPLE_RATE), LEAD + Math.ceil(to * SAMPLE_RATE));
231
+ const text = await send(encodeWav(samples), options);
232
+ if (text)
233
+ heard.push({ start: Math.min(piece.start, end), end, text });
234
+ }
235
+ return heard;
236
+ }, "transcribeOpenAI");
237
+ export {
238
+ LONGEST_REQUEST_SECONDS,
239
+ piecesOf,
240
+ transcribeOpenAI
241
+ };
@@ -0,0 +1,91 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import "./chunk-Y5E2WNWB.js";
4
+ import {
5
+ __name
6
+ } from "./chunk-ZVVMGPBJ.js";
7
+
8
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/embeddings/process.js
9
+ import { spawn } from "node:child_process";
10
+ import { createInterface } from "node:readline";
11
+ import { fileURLToPath } from "node:url";
12
+ var openProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
13
+ const child = await modelProcess({ model, directory, threads });
14
+ return {
15
+ model,
16
+ embed: /* @__PURE__ */ __name(async (texts, kind) => ((await child.ask({ texts, kind })).vectors ?? []).map((vector) => Float32Array.from(vector)), "embed"),
17
+ close: child.close
18
+ };
19
+ }, "openProcess");
20
+ var openRerankerProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
21
+ const child = await modelProcess({ model, directory, threads, rerank: true });
22
+ return {
23
+ model,
24
+ score: /* @__PURE__ */ __name(async (question, passages) => (await child.ask({ question, texts: passages })).scores ?? [], "score"),
25
+ close: child.close
26
+ };
27
+ }, "openRerankerProcess");
28
+ var modelProcess = /* @__PURE__ */ __name(async (setup) => {
29
+ const child = spawn(process.execPath, [fileURLToPath(new URL("./child.js", new URL("embeddings/process.js", import.meta.resolve("@wirecat/cli-core")).href)), JSON.stringify(setup)], { stdio: ["pipe", "pipe", "pipe"] });
30
+ const pending = /* @__PURE__ */ new Map();
31
+ let said = "";
32
+ child.stderr.setEncoding("utf8").on("data", (text) => {
33
+ said = (said + text).slice(-2e3);
34
+ });
35
+ let ready = /* @__PURE__ */ __name(() => {
36
+ }, "ready");
37
+ let refused = /* @__PURE__ */ __name((_error) => {
38
+ }, "refused");
39
+ const started = new Promise((resolve, reject) => {
40
+ ready = resolve;
41
+ refused = reject;
42
+ });
43
+ let gone;
44
+ const stopped = /* @__PURE__ */ __name((error) => {
45
+ gone ??= error;
46
+ refused(error);
47
+ for (const job of pending.values())
48
+ job.reject(error);
49
+ pending.clear();
50
+ }, "stopped");
51
+ const exited = new Promise((resolve) => {
52
+ child.once("exit", (code) => {
53
+ const last = said.trim().split("\n").at(-1);
54
+ stopped(new Error(`the embedding process stopped (exit ${code})${last ? `: ${last}` : ""}`));
55
+ resolve();
56
+ });
57
+ });
58
+ child.once("error", stopped);
59
+ createInterface({ input: child.stdout }).on("line", (line) => {
60
+ const answer = JSON.parse(line);
61
+ if ("ready" in answer)
62
+ return ready();
63
+ const job = pending.get(answer.id);
64
+ pending.delete(answer.id);
65
+ if (answer.error !== void 0 || !(answer.vectors ?? answer.scores))
66
+ job?.reject(new Error(answer.error ?? "no answer"));
67
+ else
68
+ job?.resolve(answer);
69
+ });
70
+ await started;
71
+ let next = 0;
72
+ return {
73
+ ask: /* @__PURE__ */ __name((request) => new Promise((resolve, reject) => {
74
+ if (gone)
75
+ return reject(gone);
76
+ const id = next++;
77
+ pending.set(id, { resolve, reject });
78
+ child.stdin.write(`${JSON.stringify({ id, ...request })}
79
+ `);
80
+ }), "ask"),
81
+ close: /* @__PURE__ */ __name(async () => {
82
+ if (child.exitCode === null && child.signalCode === null)
83
+ child.stdin.end();
84
+ await exited;
85
+ }, "close")
86
+ };
87
+ }, "modelProcess");
88
+ export {
89
+ openProcess,
90
+ openRerankerProcess
91
+ };