@wirecat/amo-cli 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +204 -0
  3. package/README.md +265 -2
  4. package/contracts/wirecat.json +1356 -0
  5. package/dist/amo/account.d.ts +18 -0
  6. package/dist/amo/account.d.ts.map +1 -0
  7. package/dist/amo/account.js +48 -0
  8. package/dist/amo/account.js.map +1 -0
  9. package/dist/amo/allow-list.d.ts +31 -0
  10. package/dist/amo/allow-list.d.ts.map +1 -0
  11. package/dist/amo/allow-list.js +106 -0
  12. package/dist/amo/allow-list.js.map +1 -0
  13. package/dist/amo/errors.d.ts +12 -0
  14. package/dist/amo/errors.d.ts.map +1 -0
  15. package/dist/amo/errors.js +72 -0
  16. package/dist/amo/errors.js.map +1 -0
  17. package/dist/amo/json.d.ts +3 -0
  18. package/dist/amo/json.d.ts.map +1 -0
  19. package/dist/amo/json.js +3 -0
  20. package/dist/amo/json.js.map +1 -0
  21. package/dist/amo/oauth.d.ts +55 -0
  22. package/dist/amo/oauth.d.ts.map +1 -0
  23. package/dist/amo/oauth.js +189 -0
  24. package/dist/amo/oauth.js.map +1 -0
  25. package/dist/amo/operation.d.ts +45 -0
  26. package/dist/amo/operation.d.ts.map +1 -0
  27. package/dist/amo/operation.js +119 -0
  28. package/dist/amo/operation.js.map +1 -0
  29. package/dist/amo/operations.d.ts +3 -0
  30. package/dist/amo/operations.d.ts.map +1 -0
  31. package/dist/amo/operations.js +1407 -0
  32. package/dist/amo/operations.js.map +1 -0
  33. package/dist/amo/routes.d.ts +67 -0
  34. package/dist/amo/routes.d.ts.map +1 -0
  35. package/dist/amo/routes.js +65 -0
  36. package/dist/amo/routes.js.map +1 -0
  37. package/dist/amo/transport.d.ts +62 -0
  38. package/dist/amo/transport.d.ts.map +1 -0
  39. package/dist/amo/transport.js +282 -0
  40. package/dist/amo/transport.js.map +1 -0
  41. package/dist/api-keys.d.ts +47 -0
  42. package/dist/api-keys.d.ts.map +1 -0
  43. package/dist/api-keys.js +224 -0
  44. package/dist/api-keys.js.map +1 -0
  45. package/dist/bin/amo.d.ts +3 -0
  46. package/dist/bin/amo.d.ts.map +1 -0
  47. package/dist/bin/amo.js +40 -0
  48. package/dist/bin/amo.js.map +1 -0
  49. package/dist/bundle/all-profiles-3KQVWDV4.js +278 -0
  50. package/dist/bundle/amo.js +198 -0
  51. package/dist/bundle/anthropic-N5NOX7K7.js +90 -0
  52. package/dist/bundle/app-server-2MST5EZ5.js +245 -0
  53. package/dist/bundle/bun-4NHWOFX2.js +169 -0
  54. package/dist/bundle/bun-sqlite-DRSXPWPR.js +75 -0
  55. package/dist/bundle/chunk-2B24PDH7.js +1718 -0
  56. package/dist/bundle/chunk-2I5UVMLW.js +3232 -0
  57. package/dist/bundle/chunk-3IRJDH2U.js +731 -0
  58. package/dist/bundle/chunk-4ZAK773N.js +100 -0
  59. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  60. package/dist/bundle/chunk-5D4Z2B5B.js +334 -0
  61. package/dist/bundle/chunk-5E5R65CA.js +54 -0
  62. package/dist/bundle/chunk-5HGGG3QO.js +73 -0
  63. package/dist/bundle/chunk-5RLUHTK6.js +23 -0
  64. package/dist/bundle/chunk-5SBLU7D7.js +63 -0
  65. package/dist/bundle/chunk-5Z5PEEKP.js +206 -0
  66. package/dist/bundle/chunk-63F65DHU.js +29 -0
  67. package/dist/bundle/chunk-6RS7OYTD.js +64 -0
  68. package/dist/bundle/chunk-73CXFE36.js +88 -0
  69. package/dist/bundle/chunk-7GTUZY7M.js +170 -0
  70. package/dist/bundle/chunk-7PKFYX7V.js +189 -0
  71. package/dist/bundle/chunk-7U5HJEPZ.js +1400 -0
  72. package/dist/bundle/chunk-A33TIM5D.js +4172 -0
  73. package/dist/bundle/chunk-ADEWU4P4.js +38 -0
  74. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  75. package/dist/bundle/chunk-AHJ4W2IL.js +106 -0
  76. package/dist/bundle/chunk-AUBB72VF.js +2572 -0
  77. package/dist/bundle/chunk-BVMNXI53.js +1266 -0
  78. package/dist/bundle/chunk-CDY2NJFE.js +136 -0
  79. package/dist/bundle/chunk-CHUKWON6.js +244 -0
  80. package/dist/bundle/chunk-CUZRHF34.js +230 -0
  81. package/dist/bundle/chunk-D72URWJE.js +532 -0
  82. package/dist/bundle/chunk-DAY6TSPF.js +786 -0
  83. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  84. package/dist/bundle/chunk-DJD7TBYG.js +2791 -0
  85. package/dist/bundle/chunk-DOSJONCX.js +1197 -0
  86. package/dist/bundle/chunk-DQV2IKCF.js +72 -0
  87. package/dist/bundle/chunk-DXGGCGRP.js +218 -0
  88. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  89. package/dist/bundle/chunk-EPOV5UIO.js +185 -0
  90. package/dist/bundle/chunk-EQ7A6NA6.js +53 -0
  91. package/dist/bundle/chunk-EQUKVVHX.js +353 -0
  92. package/dist/bundle/chunk-EROSAUNP.js +133 -0
  93. package/dist/bundle/chunk-ESZSMZKT.js +82 -0
  94. package/dist/bundle/chunk-FKR3M62D.js +407 -0
  95. package/dist/bundle/chunk-GNTJMB6X.js +142 -0
  96. package/dist/bundle/chunk-GQ7VFIYM.js +316 -0
  97. package/dist/bundle/chunk-JH3UOHRE.js +161 -0
  98. package/dist/bundle/chunk-JMDLPBXK.js +1068 -0
  99. package/dist/bundle/chunk-JR6TSMFX.js +9435 -0
  100. package/dist/bundle/chunk-L6AFE73L.js +18 -0
  101. package/dist/bundle/chunk-LDEBZ3IX.js +238 -0
  102. package/dist/bundle/chunk-LGQXGOPJ.js +58 -0
  103. package/dist/bundle/chunk-LJQUYECN.js +6848 -0
  104. package/dist/bundle/chunk-LRBPT7LQ.js +95 -0
  105. package/dist/bundle/chunk-LSND5QYI.js +460 -0
  106. package/dist/bundle/chunk-NC76INB2.js +27955 -0
  107. package/dist/bundle/chunk-NHXJYS4R.js +1334 -0
  108. package/dist/bundle/chunk-NJYAL3UW.js +92 -0
  109. package/dist/bundle/chunk-O2UCU52O.js +4065 -0
  110. package/dist/bundle/chunk-ODNQU7DH.js +1028 -0
  111. package/dist/bundle/chunk-P3WQRTYZ.js +24 -0
  112. package/dist/bundle/chunk-P5LYZRKW.js +63373 -0
  113. package/dist/bundle/chunk-PFO76YFP.js +2003 -0
  114. package/dist/bundle/chunk-PM77PRB6.js +12269 -0
  115. package/dist/bundle/chunk-Q2VNBY4Y.js +38109 -0
  116. package/dist/bundle/chunk-QDMXZZG4.js +604 -0
  117. package/dist/bundle/chunk-QRQYUHCZ.js +761 -0
  118. package/dist/bundle/chunk-RPWAJYI6.js +2336 -0
  119. package/dist/bundle/chunk-SMSTGO2G.js +58 -0
  120. package/dist/bundle/chunk-SZ2V62HB.js +72 -0
  121. package/dist/bundle/chunk-T2UDLX76.js +259 -0
  122. package/dist/bundle/chunk-TGEQNS6G.js +16 -0
  123. package/dist/bundle/chunk-TNUFLULO.js +2333 -0
  124. package/dist/bundle/chunk-TZSUZGWM.js +25 -0
  125. package/dist/bundle/chunk-U7RLVJ34.js +274 -0
  126. package/dist/bundle/chunk-UBRREVLJ.js +72 -0
  127. package/dist/bundle/chunk-ULXQ5MJM.js +76 -0
  128. package/dist/bundle/chunk-UMVRT7VQ.js +46 -0
  129. package/dist/bundle/chunk-V77XNPXG.js +360 -0
  130. package/dist/bundle/chunk-VVHRQ46X.js +193 -0
  131. package/dist/bundle/chunk-VX37MPTJ.js +7 -0
  132. package/dist/bundle/chunk-WCYCUTSK.js +362 -0
  133. package/dist/bundle/chunk-XEFAMLSD.js +288 -0
  134. package/dist/bundle/chunk-XQL7FEF4.js +721 -0
  135. package/dist/bundle/chunk-XRTD2GCU.js +627 -0
  136. package/dist/bundle/chunk-Y37A3232.js +804 -0
  137. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  138. package/dist/bundle/chunk-ZM7I52EP.js +78 -0
  139. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  140. package/dist/bundle/cli-QVWTXADI.js +1193 -0
  141. package/dist/bundle/command-contract-QBUQBXH7.js +39 -0
  142. package/dist/bundle/command-server-entry-5VL5U5EE.js +168 -0
  143. package/dist/bundle/decode-SQ5WGNDX.js +296 -0
  144. package/dist/bundle/dispatch-LA4DFXJD.js +411 -0
  145. package/dist/bundle/dist-T54K3FJV.js +7577 -0
  146. package/dist/bundle/echarts-25Z3RINX.js +42501 -0
  147. package/dist/bundle/embed-BNOTNXMA.js +37 -0
  148. package/dist/bundle/embedder-BCUT7KKV.js +110 -0
  149. package/dist/bundle/failure-PKAC6XCT.js +24 -0
  150. package/dist/bundle/first-run-EO5K5GME.js +28 -0
  151. package/dist/bundle/first-screen-GMN3T6RW.js +39 -0
  152. package/dist/bundle/instructions-VLM3QAYB.js +11 -0
  153. package/dist/bundle/mcp-7ILNMJH5.js +167 -0
  154. package/dist/bundle/meeting-combined-LAMF7S2B.js +24 -0
  155. package/dist/bundle/meeting-model-GHMMUQ34.js +24 -0
  156. package/dist/bundle/meeting-semantic-BMP6323L.js +21 -0
  157. package/dist/bundle/node-CT3N3TNL.js +176 -0
  158. package/dist/bundle/node-P4E63KXA.js +2340 -0
  159. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  160. package/dist/bundle/node-sqlite-MELD2SBX.js +73 -0
  161. package/dist/bundle/oauth-YBH5OKC2.js +19 -0
  162. package/dist/bundle/open-WNSBWTAG.js +22 -0
  163. package/dist/bundle/openai-XSNMNLW6.js +237 -0
  164. package/dist/bundle/process-I2QKOMM7.js +91 -0
  165. package/dist/bundle/program-DV73CIGP.js +4940 -0
  166. package/dist/bundle/prompt-SOG4AKPM.js +16 -0
  167. package/dist/bundle/recognize-WMQLWMXH.js +25 -0
  168. package/dist/bundle/remote-4BTFOLFY.js +30 -0
  169. package/dist/bundle/rerank-LJ3TWRNV.js +51 -0
  170. package/dist/bundle/serve-B6UANKXN.js +198 -0
  171. package/dist/bundle/server-S6XD6V6E.js +77 -0
  172. package/dist/bundle/server-YRH6GJ5Z.js +206 -0
  173. package/dist/bundle/source-DGFTA2TN.js +42 -0
  174. package/dist/bundle/sqlite-runtime-R7QFWFE7.js +19 -0
  175. package/dist/bundle/state-DIJ5YUOE.js +35 -0
  176. package/dist/bundle/store-6WFWW7EC.js +294 -0
  177. package/dist/bundle/store-FJCNZULV.js +32 -0
  178. package/dist/bundle/store-MYTYDV6A.js +177 -0
  179. package/dist/bundle/store-maintenance-command-B5TMKFMG.js +68 -0
  180. package/dist/bundle/writer-GP7VIMAU.js +44 -0
  181. package/dist/commands/account.d.ts +3 -0
  182. package/dist/commands/account.d.ts.map +1 -0
  183. package/dist/commands/account.js +86 -0
  184. package/dist/commands/account.js.map +1 -0
  185. package/dist/commands/api.d.ts +3 -0
  186. package/dist/commands/api.d.ts.map +1 -0
  187. package/dist/commands/api.js +224 -0
  188. package/dist/commands/api.js.map +1 -0
  189. package/dist/commands/crm-shared.d.ts +8 -0
  190. package/dist/commands/crm-shared.d.ts.map +1 -0
  191. package/dist/commands/crm-shared.js +111 -0
  192. package/dist/commands/crm-shared.js.map +1 -0
  193. package/dist/commands/schedule.d.ts +3 -0
  194. package/dist/commands/schedule.d.ts.map +1 -0
  195. package/dist/commands/schedule.js +9 -0
  196. package/dist/commands/schedule.js.map +1 -0
  197. package/dist/commands/session.d.ts +18 -0
  198. package/dist/commands/session.d.ts.map +1 -0
  199. package/dist/commands/session.js +265 -0
  200. package/dist/commands/session.js.map +1 -0
  201. package/dist/commands/write.d.ts +14 -0
  202. package/dist/commands/write.d.ts.map +1 -0
  203. package/dist/commands/write.js +36 -0
  204. package/dist/commands/write.js.map +1 -0
  205. package/dist/config.d.ts +4 -0
  206. package/dist/config.d.ts.map +1 -0
  207. package/dist/config.js +29 -0
  208. package/dist/config.js.map +1 -0
  209. package/dist/context.d.ts +62 -0
  210. package/dist/context.d.ts.map +1 -0
  211. package/dist/context.js +97 -0
  212. package/dist/context.js.map +1 -0
  213. package/dist/crm/activities.d.ts +32 -0
  214. package/dist/crm/activities.d.ts.map +1 -0
  215. package/dist/crm/activities.js +196 -0
  216. package/dist/crm/activities.js.map +1 -0
  217. package/dist/crm/records.d.ts +20 -0
  218. package/dist/crm/records.d.ts.map +1 -0
  219. package/dist/crm/records.js +175 -0
  220. package/dist/crm/records.js.map +1 -0
  221. package/dist/crm/source.d.ts +41 -0
  222. package/dist/crm/source.d.ts.map +1 -0
  223. package/dist/crm/source.js +673 -0
  224. package/dist/crm/source.js.map +1 -0
  225. package/dist/crm/writer.d.ts +14 -0
  226. package/dist/crm/writer.d.ts.map +1 -0
  227. package/dist/crm/writer.js +247 -0
  228. package/dist/crm/writer.js.map +1 -0
  229. package/dist/identity.d.ts +7 -0
  230. package/dist/identity.d.ts.map +1 -0
  231. package/dist/identity.js +33 -0
  232. package/dist/identity.js.map +1 -0
  233. package/dist/index.d.ts +3 -0
  234. package/dist/index.d.ts.map +1 -0
  235. package/dist/index.js +3 -0
  236. package/dist/index.js.map +1 -0
  237. package/dist/program.d.ts +6 -0
  238. package/dist/program.d.ts.map +1 -0
  239. package/dist/program.js +91 -0
  240. package/dist/program.js.map +1 -0
  241. package/dist/reasons.d.ts +10 -0
  242. package/dist/reasons.d.ts.map +1 -0
  243. package/dist/reasons.js +35 -0
  244. package/dist/reasons.js.map +1 -0
  245. package/dist/setup/flow.d.ts +2 -0
  246. package/dist/setup/flow.d.ts.map +1 -0
  247. package/dist/setup/flow.js +127 -0
  248. package/dist/setup/flow.js.map +1 -0
  249. package/dist/setup/texts.en.json +25 -0
  250. package/dist/setup/texts.es.json +25 -0
  251. package/dist/setup/texts.ru.json +25 -0
  252. package/dist/store.d.ts +15 -0
  253. package/dist/store.d.ts.map +1 -0
  254. package/dist/store.js +16 -0
  255. package/dist/store.js.map +1 -0
  256. package/dist/version.d.ts +2 -0
  257. package/dist/version.d.ts.map +1 -0
  258. package/dist/version.js +2 -0
  259. package/dist/version.js.map +1 -0
  260. package/dist/wcat.d.ts +3 -0
  261. package/dist/wcat.d.ts.map +1 -0
  262. package/dist/wcat.js +4 -0
  263. package/dist/wcat.js.map +1 -0
  264. package/dist/whoami.d.ts +24 -0
  265. package/dist/whoami.d.ts.map +1 -0
  266. package/dist/whoami.js +33 -0
  267. package/dist/whoami.js.map +1 -0
  268. package/package.json +85 -4
  269. package/skills/amo-cli/SKILL.md +116 -0
  270. package/skills/amo-cli/references/mcp.md +38 -0
  271. package/skills/amo-cli/references/output.md +42 -0
  272. package/skills/amo-cli/references/reading.md +77 -0
  273. package/skills/amo-cli/references/setup.md +59 -0
  274. package/skills/amo-cli/references/writing.md +86 -0
@@ -0,0 +1,169 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ DefaultLogger,
5
+ DrizzleQueryError,
6
+ NoopLogger,
7
+ SQLiteAsyncDatabase,
8
+ SQLiteAsyncPreparedQuery,
9
+ SQLiteAsyncSession,
10
+ SQLiteAsyncTransaction,
11
+ SQLiteDialect,
12
+ booleanFromInteger,
13
+ bufferFromBytes,
14
+ castToText,
15
+ dateFromStoredMilliseconds,
16
+ dateFromStoredSeconds,
17
+ entityKind,
18
+ jitCompatCheck,
19
+ refineSqliteCodecs,
20
+ sql
21
+ } from "./chunk-LJQUYECN.js";
22
+ import {
23
+ __name
24
+ } from "./chunk-ZVVMGPBJ.js";
25
+
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
27
+ import { Database } from "bun:sqlite";
28
+ var bunSQLiteCodecs = refineSqliteCodecs({
29
+ "integer:boolean": { normalize: booleanFromInteger },
30
+ "integer:timestamp": { normalize: dateFromStoredSeconds },
31
+ "integer:timestamp_ms": { normalize: dateFromStoredMilliseconds },
32
+ "text:json": { normalize: JSON.parse },
33
+ blob: { normalize: bufferFromBytes },
34
+ "blob:json": {
35
+ cast: castToText,
36
+ normalize: JSON.parse
37
+ },
38
+ "blob:bigint": {
39
+ cast: castToText,
40
+ normalize: BigInt
41
+ },
42
+ numeric: {
43
+ cast: castToText,
44
+ normalize: String
45
+ },
46
+ "numeric:number": { normalize: Number },
47
+ "numeric:bigint": {
48
+ cast: castToText,
49
+ normalize: BigInt
50
+ }
51
+ });
52
+ var SQLiteBunSession = class extends SQLiteAsyncSession {
53
+ static {
54
+ __name(this, "SQLiteBunSession");
55
+ }
56
+ client;
57
+ relations;
58
+ options;
59
+ static [entityKind] = "SQLiteBunSession";
60
+ logger;
61
+ constructor(client, dialect, relations, options = {}) {
62
+ super(dialect, "sync");
63
+ this.client = client;
64
+ this.relations = relations;
65
+ this.options = options;
66
+ this.logger = options.logger ?? new NoopLogger();
67
+ }
68
+ exec(query) {
69
+ this.client.exec(query);
70
+ }
71
+ prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
72
+ let stmt;
73
+ try {
74
+ stmt = this.client.query(query.sql);
75
+ } catch (e) {
76
+ throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
77
+ }
78
+ return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
79
+ all: /* @__PURE__ */ __name((params) => {
80
+ if (mode === "arrays") return stmt.values(...params);
81
+ return stmt.all(...params);
82
+ }, "all"),
83
+ get: /* @__PURE__ */ __name((params) => {
84
+ if (mode === "arrays") return stmt.values(...params)[0];
85
+ return stmt.get(...params);
86
+ }, "get"),
87
+ run: /* @__PURE__ */ __name((params) => {
88
+ return stmt.run(...params);
89
+ }, "run")
90
+ }, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
91
+ }
92
+ transaction(transaction, config = {}) {
93
+ const tx = new SQLiteBunTransaction("sync", this.dialect, this, this.relations);
94
+ let result;
95
+ const nativeTx = this.client.transaction(() => {
96
+ result = transaction(tx);
97
+ });
98
+ if (config.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
99
+ nativeTx[config.behavior ?? "deferred"]();
100
+ return result;
101
+ }
102
+ };
103
+ var SQLiteBunTransaction = class SQLiteBunTransaction2 extends SQLiteAsyncTransaction {
104
+ static {
105
+ __name(this, "SQLiteBunTransaction2");
106
+ }
107
+ static [entityKind] = "SQLiteBunTransaction";
108
+ transaction(transaction) {
109
+ const savepointName = `sp${this.nestedIndex}`;
110
+ const tx = new SQLiteBunTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
111
+ this.session.run(sql.raw(`savepoint ${savepointName}`));
112
+ try {
113
+ const result = transaction(tx);
114
+ this.session.run(sql.raw(`release savepoint ${savepointName}`));
115
+ return result;
116
+ } catch (err) {
117
+ try {
118
+ this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
119
+ } catch {
120
+ }
121
+ throw err;
122
+ }
123
+ }
124
+ };
125
+ var SQLiteBunDatabase = class extends SQLiteAsyncDatabase {
126
+ static {
127
+ __name(this, "SQLiteBunDatabase");
128
+ }
129
+ static [entityKind] = "SQLiteBunDatabase";
130
+ };
131
+ function construct(client, config = {}) {
132
+ const dialect = new SQLiteDialect({
133
+ codecs: config.codecs ?? bunSQLiteCodecs,
134
+ useJitMappers: jitCompatCheck(config.jit)
135
+ });
136
+ let logger;
137
+ if (config.logger === true) logger = new DefaultLogger();
138
+ else if (config.logger !== false) logger = config.logger;
139
+ const relations = config.relations ?? {};
140
+ const db = new SQLiteBunDatabase("sync", dialect, new SQLiteBunSession(client, dialect, relations, {
141
+ logger,
142
+ paramsInErrors: config.paramsInErrors
143
+ }), relations);
144
+ db.$client = client;
145
+ return db;
146
+ }
147
+ __name(construct, "construct");
148
+ function drizzle(...params) {
149
+ if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new Database() : new Database(params[0]), params[1]);
150
+ const { connection, client, ...DrizzleSQLiteConfig } = params[0];
151
+ if (client) return construct(client, DrizzleSQLiteConfig);
152
+ if (typeof connection === "object") {
153
+ const { source, ...opts } = connection;
154
+ const options = Object.values(opts).filter((v) => v !== void 0).length ? opts : void 0;
155
+ return construct(new Database(source, options), DrizzleSQLiteConfig);
156
+ }
157
+ return construct(new Database(connection), DrizzleSQLiteConfig);
158
+ }
159
+ __name(drizzle, "drizzle");
160
+ (function(_drizzle) {
161
+ function mock(config) {
162
+ return construct({}, config);
163
+ }
164
+ __name(mock, "mock");
165
+ _drizzle.mock = mock;
166
+ })(drizzle || (drizzle = {}));
167
+ export {
168
+ drizzle
169
+ };
@@ -0,0 +1,75 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ loadVectorExtension,
5
+ vectorExtension
6
+ } from "./chunk-LGQXGOPJ.js";
7
+ import {
8
+ refuseOwnerStoreInTests
9
+ } from "./chunk-5E5R65CA.js";
10
+ import "./chunk-DJD7TBYG.js";
11
+ import "./chunk-AUBB72VF.js";
12
+ import {
13
+ importFrom
14
+ } from "./chunk-Y5E2WNWB.js";
15
+ import "./chunk-SZ2V62HB.js";
16
+ import {
17
+ __name
18
+ } from "./chunk-ZVVMGPBJ.js";
19
+
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
21
+ var customised = false;
22
+ var ownLibrary = /* @__PURE__ */ __name(async () => {
23
+ try {
24
+ const { libraryFor } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
25
+ return libraryFor();
26
+ } catch {
27
+ return void 0;
28
+ }
29
+ }, "ownLibrary");
30
+ var bunDatabase = /* @__PURE__ */ __name(async () => {
31
+ const specifier = "bun:sqlite";
32
+ const { Database } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, specifier);
33
+ if (process.platform === "darwin" && !customised) {
34
+ customised = true;
35
+ const library = await ownLibrary();
36
+ if (library)
37
+ Database.setCustomSQLite(library);
38
+ }
39
+ return Database;
40
+ }, "bunDatabase");
41
+ var openWithBunSqlite = /* @__PURE__ */ __name(async (path) => cacheOverBunSqlite(await bunClient(path)), "openWithBunSqlite");
42
+ var bunClient = /* @__PURE__ */ __name(async (path, options) => {
43
+ refuseOwnerStoreInTests(path);
44
+ const Database = await bunDatabase();
45
+ const extension = await vectorExtension();
46
+ const client = options ? new Database(path, options) : new Database(path);
47
+ try {
48
+ loadVectorExtension(client, extension);
49
+ return client;
50
+ } catch (error) {
51
+ client.close();
52
+ throw error;
53
+ }
54
+ }, "bunClient");
55
+ var cacheOverBunSqlite = /* @__PURE__ */ __name((database) => {
56
+ return {
57
+ exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
58
+ prepare: /* @__PURE__ */ __name((sql) => {
59
+ const statement = database.query(sql);
60
+ return {
61
+ run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
62
+ // Bun answers null for no row; the seam promises undefined, and `!== undefined` checks rely on it.
63
+ get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters) ?? void 0, "get"),
64
+ all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
65
+ };
66
+ }, "prepare"),
67
+ close: /* @__PURE__ */ __name(() => database.close(), "close")
68
+ };
69
+ }, "cacheOverBunSqlite");
70
+ export {
71
+ bunClient,
72
+ bunDatabase,
73
+ cacheOverBunSqlite,
74
+ openWithBunSqlite
75
+ };