@wirecat/attio-cli 0.9.0 → 0.10.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 (206) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/contracts/wirecat.json +1 -0
  3. package/dist/bin/attio.js +11 -11
  4. package/dist/bundle/attio.js +5 -166
  5. package/dist/bundle/{chunk-6E5QWCBK.js → chunk-OGWKDPR5.js} +2 -1
  6. package/dist/bundle/chunk-TQAECZFO.js +13 -0
  7. package/dist/bundle/{definitions-FODOIPM2.js → definitions-J73IBAHT.js} +1 -1
  8. package/dist/bundle/program-NSBWZ25F.js +6201 -0
  9. package/dist/bundle/{schemas-YGSTNU6F.js → schemas-G3HFAS45.js} +576 -29
  10. package/dist/commands/api.js +1 -2
  11. package/dist/commands/crm.js +1 -4
  12. package/dist/commands/schedule.js +1 -1
  13. package/dist/commands/session.js +1 -2
  14. package/dist/config.js +1 -2
  15. package/dist/context.js +1 -1
  16. package/dist/identity.js +1 -0
  17. package/dist/program.js +1 -2
  18. package/dist/version.js +1 -1
  19. package/package.json +3 -3
  20. package/dist/activities.d.ts +0 -4
  21. package/dist/activities.d.ts.map +0 -1
  22. package/dist/activities.js.map +0 -1
  23. package/dist/bin/attio.d.ts +0 -3
  24. package/dist/bin/attio.d.ts.map +0 -1
  25. package/dist/bin/attio.js.map +0 -1
  26. package/dist/bundle/agent-C3SZOGZS.js +0 -38
  27. package/dist/bundle/all-profiles-673VSTRG.js +0 -320
  28. package/dist/bundle/anthropic-V4RZS5XM.js +0 -91
  29. package/dist/bundle/app-server-CTEDPA5H.js +0 -249
  30. package/dist/bundle/bun-F4M4KCNA.js +0 -169
  31. package/dist/bundle/bun-sqlite-33JTNHCK.js +0 -76
  32. package/dist/bundle/chunk-2R2EX5I6.js +0 -54
  33. package/dist/bundle/chunk-5EH7S4RM.js +0 -362
  34. package/dist/bundle/chunk-5N2V6XO7.js +0 -119
  35. package/dist/bundle/chunk-5WY6RURV.js +0 -161
  36. package/dist/bundle/chunk-6V7ZUJI6.js +0 -4072
  37. package/dist/bundle/chunk-AOKAYQSJ.js +0 -2338
  38. package/dist/bundle/chunk-AQ5RIOUE.js +0 -633
  39. package/dist/bundle/chunk-B4DVW2BA.js +0 -185
  40. package/dist/bundle/chunk-C7JPYWYQ.js +0 -77
  41. package/dist/bundle/chunk-D72URWJE.js +0 -532
  42. package/dist/bundle/chunk-DBHZ7TQ7.js +0 -69828
  43. package/dist/bundle/chunk-DFDN6AUB.js +0 -21
  44. package/dist/bundle/chunk-DNCLQPOM.js +0 -7
  45. package/dist/bundle/chunk-DPV53EZC.js +0 -206
  46. package/dist/bundle/chunk-E2L4R6EI.js +0 -388
  47. package/dist/bundle/chunk-EDWRHVHD.js +0 -218
  48. package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
  49. package/dist/bundle/chunk-EV6B3GHM.js +0 -323
  50. package/dist/bundle/chunk-FBWECICU.js +0 -259
  51. package/dist/bundle/chunk-FFER7KJI.js +0 -407
  52. package/dist/bundle/chunk-FTH6WGYO.js +0 -24
  53. package/dist/bundle/chunk-G3PK5BZB.js +0 -1222
  54. package/dist/bundle/chunk-G46PNDWL.js +0 -58
  55. package/dist/bundle/chunk-G6NY7LFB.js +0 -230
  56. package/dist/bundle/chunk-GLU36VKA.js +0 -52
  57. package/dist/bundle/chunk-GZ7WBU5Y.js +0 -18
  58. package/dist/bundle/chunk-HMYBAVIE.js +0 -86
  59. package/dist/bundle/chunk-HOJJPSLU.js +0 -288
  60. package/dist/bundle/chunk-HUAHLO6N.js +0 -29
  61. package/dist/bundle/chunk-ISQ23VKV.js +0 -123
  62. package/dist/bundle/chunk-J2LSOG3A.js +0 -12766
  63. package/dist/bundle/chunk-K5L77R7P.js +0 -66
  64. package/dist/bundle/chunk-KKRFVN4X.js +0 -1835
  65. package/dist/bundle/chunk-KLRCTMES.js +0 -100
  66. package/dist/bundle/chunk-KYRYD4CR.js +0 -38
  67. package/dist/bundle/chunk-L5QLKUQR.js +0 -794
  68. package/dist/bundle/chunk-MFSWMNSZ.js +0 -334
  69. package/dist/bundle/chunk-MYK2F5LD.js +0 -1251
  70. package/dist/bundle/chunk-NBNQLNVV.js +0 -388
  71. package/dist/bundle/chunk-O3DZDITT.js +0 -274
  72. package/dist/bundle/chunk-OEEWVKJX.js +0 -53
  73. package/dist/bundle/chunk-P5XYQZVW.js +0 -80
  74. package/dist/bundle/chunk-P6OJKJJS.js +0 -1197
  75. package/dist/bundle/chunk-P6S3ZRVW.js +0 -106
  76. package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
  77. package/dist/bundle/chunk-QBJRK733.js +0 -1068
  78. package/dist/bundle/chunk-QBYE26ZC.js +0 -131
  79. package/dist/bundle/chunk-QPPOIWPY.js +0 -1246
  80. package/dist/bundle/chunk-R2CEA7MK.js +0 -743
  81. package/dist/bundle/chunk-S4UUN6LD.js +0 -1410
  82. package/dist/bundle/chunk-S6JG4YUH.js +0 -72
  83. package/dist/bundle/chunk-SKUY7JDA.js +0 -164
  84. package/dist/bundle/chunk-T35IOBPJ.js +0 -1341
  85. package/dist/bundle/chunk-T3W4V4A6.js +0 -63
  86. package/dist/bundle/chunk-TB3LN5G2.js +0 -50
  87. package/dist/bundle/chunk-TCT5D2X2.js +0 -6848
  88. package/dist/bundle/chunk-TES7MB6I.js +0 -82
  89. package/dist/bundle/chunk-TXDR6YSF.js +0 -23
  90. package/dist/bundle/chunk-TY7NDMFY.js +0 -46
  91. package/dist/bundle/chunk-U7UTYALA.js +0 -353
  92. package/dist/bundle/chunk-UOWHMOU3.js +0 -188
  93. package/dist/bundle/chunk-UXDUWGX6.js +0 -2791
  94. package/dist/bundle/chunk-V5I3QHDU.js +0 -558
  95. package/dist/bundle/chunk-VCDIKCFE.js +0 -1007
  96. package/dist/bundle/chunk-VJHUMB7U.js +0 -338
  97. package/dist/bundle/chunk-W4KLHM2K.js +0 -95
  98. package/dist/bundle/chunk-W5LKEOGN.js +0 -142
  99. package/dist/bundle/chunk-WLDZWHSF.js +0 -170
  100. package/dist/bundle/chunk-WQEEYEWO.js +0 -3752
  101. package/dist/bundle/chunk-WRF6TY63.js +0 -1521
  102. package/dist/bundle/chunk-WXYOELRI.js +0 -108
  103. package/dist/bundle/chunk-WZBPUOWM.js +0 -76
  104. package/dist/bundle/chunk-XGNZD52X.js +0 -592
  105. package/dist/bundle/chunk-XQUUANA2.js +0 -24600
  106. package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
  107. package/dist/bundle/chunk-YQH4J6YZ.js +0 -358
  108. package/dist/bundle/chunk-Z7Y2I5YR.js +0 -44045
  109. package/dist/bundle/chunk-ZBCC7MBN.js +0 -9671
  110. package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
  111. package/dist/bundle/command-contract-ZL67KMYL.js +0 -37
  112. package/dist/bundle/command-server-entry-COR2VDRU.js +0 -166
  113. package/dist/bundle/decode-33SGRQM6.js +0 -297
  114. package/dist/bundle/dispatch-2FTOHA5D.js +0 -411
  115. package/dist/bundle/dist-EM7KLEG4.js +0 -7577
  116. package/dist/bundle/dist-PAKDDIBT.js +0 -191
  117. package/dist/bundle/echarts-QMAA7HH5.js +0 -42501
  118. package/dist/bundle/embed-W4ZBXPWD.js +0 -38
  119. package/dist/bundle/embedder-73CCZC52.js +0 -111
  120. package/dist/bundle/failure-OHIXWTR6.js +0 -25
  121. package/dist/bundle/first-run-MOSUMMVX.js +0 -28
  122. package/dist/bundle/first-screen-GUXBF3SL.js +0 -38
  123. package/dist/bundle/instructions-4H7UREH2.js +0 -11
  124. package/dist/bundle/mcp-5HFPWC3W.js +0 -167
  125. package/dist/bundle/meeting-combined-QMIZOBBJ.js +0 -24
  126. package/dist/bundle/meeting-model-2UYVGXD5.js +0 -25
  127. package/dist/bundle/meeting-semantic-LEJPUIN3.js +0 -22
  128. package/dist/bundle/node-KM3CUABH.js +0 -2340
  129. package/dist/bundle/node-P3PUHKYH.js +0 -176
  130. package/dist/bundle/node-TLZSIHIJ.js +0 -21
  131. package/dist/bundle/node-sqlite-UHPODTKB.js +0 -74
  132. package/dist/bundle/oauth-T3DWL7OV.js +0 -20
  133. package/dist/bundle/open-ODWX32PF.js +0 -23
  134. package/dist/bundle/openai-GSXXHKPX.js +0 -238
  135. package/dist/bundle/process-AFIXYXWL.js +0 -91
  136. package/dist/bundle/program-SXSUG335.js +0 -35250
  137. package/dist/bundle/prompt-GVTYTFK7.js +0 -17
  138. package/dist/bundle/recognize-XDSZEZP5.js +0 -26
  139. package/dist/bundle/remote-ZWZKMEY6.js +0 -31
  140. package/dist/bundle/rerank-OBZQ54NL.js +0 -52
  141. package/dist/bundle/serve-NY5MUTNW.js +0 -199
  142. package/dist/bundle/server-JK334V5Y.js +0 -212
  143. package/dist/bundle/server-VOPYQCUD.js +0 -79
  144. package/dist/bundle/sqlite-runtime-2NHF4S6G.js +0 -20
  145. package/dist/bundle/state-YGWZZWPM.js +0 -36
  146. package/dist/bundle/store-LRQUTFJR.js +0 -306
  147. package/dist/bundle/store-ND6KU4RI.js +0 -181
  148. package/dist/bundle/store-maintenance-command-GLYGQM2V.js +0 -66
  149. package/dist/bundle/surface-P53WLLXP.js +0 -65
  150. package/dist/commands/api.d.ts +0 -12
  151. package/dist/commands/api.d.ts.map +0 -1
  152. package/dist/commands/api.js.map +0 -1
  153. package/dist/commands/crm.d.ts +0 -7
  154. package/dist/commands/crm.d.ts.map +0 -1
  155. package/dist/commands/crm.js.map +0 -1
  156. package/dist/commands/schedule.d.ts +0 -3
  157. package/dist/commands/schedule.d.ts.map +0 -1
  158. package/dist/commands/schedule.js.map +0 -1
  159. package/dist/commands/session.d.ts +0 -8
  160. package/dist/commands/session.d.ts.map +0 -1
  161. package/dist/commands/session.js.map +0 -1
  162. package/dist/config.d.ts +0 -13
  163. package/dist/config.d.ts.map +0 -1
  164. package/dist/config.js.map +0 -1
  165. package/dist/context.d.ts +0 -37
  166. package/dist/context.d.ts.map +0 -1
  167. package/dist/context.js.map +0 -1
  168. package/dist/generated/definitions.d.ts +0 -3
  169. package/dist/generated/definitions.d.ts.map +0 -1
  170. package/dist/generated/definitions.js.map +0 -1
  171. package/dist/generated/manifest.d.ts +0 -6
  172. package/dist/generated/manifest.d.ts.map +0 -1
  173. package/dist/generated/manifest.js.map +0 -1
  174. package/dist/generated/schemas.d.ts +0 -383
  175. package/dist/generated/schemas.d.ts.map +0 -1
  176. package/dist/generated/schemas.js.map +0 -1
  177. package/dist/generated/types.d.ts +0 -10166
  178. package/dist/generated/types.d.ts.map +0 -1
  179. package/dist/generated/types.js.map +0 -1
  180. package/dist/generated/wirecat-config.d.ts +0 -15
  181. package/dist/generated/wirecat-config.d.ts.map +0 -1
  182. package/dist/generated/wirecat-config.js.map +0 -1
  183. package/dist/hooks.d.ts +0 -33
  184. package/dist/hooks.d.ts.map +0 -1
  185. package/dist/hooks.js.map +0 -1
  186. package/dist/identity.d.ts +0 -33
  187. package/dist/identity.d.ts.map +0 -1
  188. package/dist/identity.js.map +0 -1
  189. package/dist/index.d.ts +0 -3
  190. package/dist/index.d.ts.map +0 -1
  191. package/dist/index.js.map +0 -1
  192. package/dist/links.d.ts +0 -10
  193. package/dist/links.d.ts.map +0 -1
  194. package/dist/links.js.map +0 -1
  195. package/dist/meetings.d.ts +0 -57
  196. package/dist/meetings.d.ts.map +0 -1
  197. package/dist/meetings.js.map +0 -1
  198. package/dist/program.d.ts +0 -6
  199. package/dist/program.d.ts.map +0 -1
  200. package/dist/program.js.map +0 -1
  201. package/dist/version.d.ts +0 -2
  202. package/dist/version.d.ts.map +0 -1
  203. package/dist/version.js.map +0 -1
  204. package/dist/wcat.d.ts +0 -3
  205. package/dist/wcat.d.ts.map +0 -1
  206. package/dist/wcat.js.map +0 -1
@@ -1,176 +0,0 @@
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-TCT5D2X2.js";
22
- import {
23
- __name
24
- } from "./chunk-ZVVMGPBJ.js";
25
-
26
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/node.js
27
- import { DatabaseSync } from "node:sqlite";
28
- var nodeSQLiteCodecs = 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 NodeSQLiteSession = class extends SQLiteAsyncSession {
53
- static {
54
- __name(this, "NodeSQLiteSession");
55
- }
56
- client;
57
- relations;
58
- options;
59
- static [entityKind] = "SQLJsSession";
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
- prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
69
- let stmt;
70
- try {
71
- stmt = this.client.prepare(query.sql);
72
- } catch (e) {
73
- throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
74
- }
75
- return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
76
- all: /* @__PURE__ */ __name((params) => {
77
- stmt.setReturnArrays(mode === "arrays");
78
- const res = stmt.all(...params);
79
- if (mode === "objects") return res.map((row) => ({ ...row }));
80
- return res;
81
- }, "all"),
82
- get: /* @__PURE__ */ __name((params) => {
83
- stmt.setReturnArrays(mode === "arrays");
84
- const res = stmt.get(...params);
85
- if (res && mode === "objects") return { ...res };
86
- return res;
87
- }, "get"),
88
- run: /* @__PURE__ */ __name((params) => {
89
- stmt.setReturnArrays(false);
90
- return stmt.run(...params);
91
- }, "run")
92
- }, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
93
- }
94
- transaction(transaction, config = {}) {
95
- if (config?.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
96
- const tx = new NodeSQLiteTransaction("sync", this.dialect, this, this.relations);
97
- this.run(sql.raw(`begin${config.behavior ? ` ${config.behavior}` : ""}`));
98
- try {
99
- const result = transaction(tx);
100
- this.run(sql`commit`);
101
- return result;
102
- } catch (err) {
103
- try {
104
- this.run(sql`rollback`);
105
- } catch {
106
- }
107
- throw err;
108
- }
109
- }
110
- };
111
- var NodeSQLiteTransaction = class NodeSQLiteTransaction2 extends SQLiteAsyncTransaction {
112
- static {
113
- __name(this, "NodeSQLiteTransaction2");
114
- }
115
- static [entityKind] = "SQLJsTransaction";
116
- transaction(transaction) {
117
- const savepointName = `sp${this.nestedIndex + 1}`;
118
- const tx = new NodeSQLiteTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
119
- tx.run(sql.raw(`savepoint ${savepointName}`));
120
- try {
121
- const result = transaction(tx);
122
- tx.run(sql.raw(`release savepoint ${savepointName}`));
123
- return result;
124
- } catch (err) {
125
- try {
126
- tx.run(sql.raw(`rollback to savepoint ${savepointName}`));
127
- } catch {
128
- }
129
- throw err;
130
- }
131
- }
132
- };
133
- var NodeSQLiteDatabase = class extends SQLiteAsyncDatabase {
134
- static {
135
- __name(this, "NodeSQLiteDatabase");
136
- }
137
- static [entityKind] = "NodeSQLiteDatabase";
138
- };
139
- function construct(client, config = {}) {
140
- const dialect = new SQLiteDialect({
141
- codecs: config.codecs ?? nodeSQLiteCodecs,
142
- useJitMappers: jitCompatCheck(config.jit)
143
- });
144
- let logger;
145
- if (config.logger === true) logger = new DefaultLogger();
146
- else if (config.logger !== false) logger = config.logger;
147
- const relations = config.relations ?? {};
148
- const db = new NodeSQLiteDatabase("sync", dialect, new NodeSQLiteSession(client, dialect, relations, {
149
- logger,
150
- paramsInErrors: config.paramsInErrors
151
- }), relations);
152
- db.$client = client;
153
- return db;
154
- }
155
- __name(construct, "construct");
156
- function drizzle(...params) {
157
- if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new DatabaseSync(":memory:") : new DatabaseSync(params[0]), params[1]);
158
- const { connection, client, ...config } = params[0];
159
- if (client) return construct(client, config);
160
- if (typeof connection === "object") {
161
- const { path, ...options } = connection;
162
- return construct(new DatabaseSync(path ?? ":memory:", options), config);
163
- }
164
- return construct(new DatabaseSync(connection ?? ":memory:"), config);
165
- }
166
- __name(drizzle, "drizzle");
167
- (function(_drizzle) {
168
- function mock(config) {
169
- return construct({}, config);
170
- }
171
- __name(mock, "mock");
172
- _drizzle.mock = mock;
173
- })(drizzle || (drizzle = {}));
174
- export {
175
- drizzle
176
- };
@@ -1,21 +0,0 @@
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
- };
@@ -1,74 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- loadVectorExtension,
5
- vectorExtension
6
- } from "./chunk-G46PNDWL.js";
7
- import {
8
- refuseOwnerStoreInTests
9
- } from "./chunk-2R2EX5I6.js";
10
- import {
11
- TIME_LIMIT_FUNCTION,
12
- beforeTimeLimit
13
- } from "./chunk-KYRYD4CR.js";
14
- import "./chunk-UXDUWGX6.js";
15
- import "./chunk-QPPOIWPY.js";
16
- import "./chunk-S4UUN6LD.js";
17
- import "./chunk-Y5E2WNWB.js";
18
- import "./chunk-S6JG4YUH.js";
19
- import {
20
- __name
21
- } from "./chunk-ZVVMGPBJ.js";
22
-
23
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/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
- };
@@ -1,20 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- ownerLogin,
5
- revokeAll
6
- } from "./chunk-HOJJPSLU.js";
7
- import "./chunk-PL5P7UKW.js";
8
- import "./chunk-5WY6RURV.js";
9
- import "./chunk-HMYBAVIE.js";
10
- import "./chunk-T3W4V4A6.js";
11
- import "./chunk-UXDUWGX6.js";
12
- import "./chunk-QPPOIWPY.js";
13
- import "./chunk-S4UUN6LD.js";
14
- import "./chunk-Y5E2WNWB.js";
15
- import "./chunk-S6JG4YUH.js";
16
- import "./chunk-ZVVMGPBJ.js";
17
- export {
18
- ownerLogin,
19
- revokeAll
20
- };
@@ -1,23 +0,0 @@
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-W4KLHM2K.js";
10
- import "./chunk-KYRYD4CR.js";
11
- import "./chunk-UXDUWGX6.js";
12
- import "./chunk-QPPOIWPY.js";
13
- import "./chunk-S4UUN6LD.js";
14
- import "./chunk-Y5E2WNWB.js";
15
- import "./chunk-S6JG4YUH.js";
16
- import "./chunk-ZVVMGPBJ.js";
17
- export {
18
- CAPABILITY_STATEMENTS,
19
- assertStoreCapable,
20
- openCache,
21
- openFile,
22
- storeCapable
23
- };
@@ -1,238 +0,0 @@
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-G6NY7LFB.js";
7
- import "./chunk-FFER7KJI.js";
8
- import {
9
- OPENAI_URL,
10
- refuseModelAddress
11
- } from "./chunk-B4DVW2BA.js";
12
- import {
13
- endpointFetch,
14
- onThisComputer,
15
- providerWaitMs
16
- } from "./chunk-NBNQLNVV.js";
17
- import "./chunk-P6OJKJJS.js";
18
- import "./chunk-VCDIKCFE.js";
19
- import {
20
- OPENAI_TRANSCRIBE_MODEL,
21
- VAD,
22
- filesPresent,
23
- modelsDirectory,
24
- vadPath
25
- } from "./chunk-O3DZDITT.js";
26
- import "./chunk-2R2EX5I6.js";
27
- import {
28
- DEFAULT_RETRY,
29
- backoffMs
30
- } from "./chunk-UXDUWGX6.js";
31
- import "./chunk-QPPOIWPY.js";
32
- import "./chunk-S4UUN6LD.js";
33
- import "./chunk-Y5E2WNWB.js";
34
- import {
35
- CliError
36
- } from "./chunk-S6JG4YUH.js";
37
- import {
38
- __name
39
- } from "./chunk-ZVVMGPBJ.js";
40
-
41
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/speech/openai.js
42
- import { setTimeout as wait } from "node:timers/promises";
43
-
44
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/speech/wav.js
45
- var encodeWav = /* @__PURE__ */ __name((samples, sampleRate = 16e3) => {
46
- const bytes = Buffer.alloc(44 + samples.length * 2);
47
- bytes.write("RIFF", 0, "ascii");
48
- bytes.writeUInt32LE(bytes.length - 8, 4);
49
- bytes.write("WAVEfmt ", 8, "ascii");
50
- bytes.writeUInt32LE(16, 16);
51
- bytes.writeUInt16LE(1, 20);
52
- bytes.writeUInt16LE(1, 22);
53
- bytes.writeUInt32LE(sampleRate, 24);
54
- bytes.writeUInt32LE(sampleRate * 2, 28);
55
- bytes.writeUInt16LE(2, 32);
56
- bytes.writeUInt16LE(16, 34);
57
- bytes.write("data", 36, "ascii");
58
- bytes.writeUInt32LE(samples.length * 2, 40);
59
- samples.forEach((sample, index) => {
60
- bytes.writeInt16LE(Math.round(Math.max(-1, Math.min(1, sample || 0)) * 32767), 44 + index * 2);
61
- });
62
- return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.length);
63
- }, "encodeWav");
64
-
65
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/speech/openai.js
66
- var LONGEST_REQUEST_SECONDS = 600;
67
- var JOINED_SECONDS = 0.2;
68
- var PAD_SECONDS = 0.2;
69
- var LEAD = SAMPLE_RATE / 2;
70
- var EXHAUSTED = /* @__PURE__ */ new Set([
71
- "insufficient_quota",
72
- "credit_balance_exhausted",
73
- "organization_spend_limit_exceeded",
74
- "project_spend_limit_exceeded",
75
- "organization_usage_limit_exceeded"
76
- ]);
77
- var RETRY = { ...DEFAULT_RETRY, retries: 4 };
78
- var interrupted = /* @__PURE__ */ __name((signal) => {
79
- if (!signal?.aborted)
80
- return;
81
- if (signal.reason instanceof CliError)
82
- throw signal.reason;
83
- const timeout = signal.reason instanceof Error && signal.reason.name === "TimeoutError";
84
- throw new CliError(timeout ? "timeout" : "cancelled", "the transcription was interrupted");
85
- }, "interrupted");
86
- var sleeping = /* @__PURE__ */ __name((ms, signal) => wait(ms, void 0, signal ? { signal } : {}).then(() => void 0, (error) => {
87
- interrupted(signal);
88
- throw error;
89
- }), "sleeping");
90
- var formOf = /* @__PURE__ */ __name((wav, options) => {
91
- const form = new FormData();
92
- form.append("file", new Blob([wav], { type: "audio/wav" }), "audio.wav");
93
- form.append("model", options.model ?? OPENAI_TRANSCRIBE_MODEL);
94
- for (const language of options.languages ?? [])
95
- form.append("languages[]", language);
96
- for (const keyword of options.keywords ?? [])
97
- form.append("keywords[]", keyword);
98
- if (options.prompt)
99
- form.append("prompt", options.prompt);
100
- return form;
101
- }, "formOf");
102
- var safe = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[\w.-]{1,64}$/.test(value) ? value : void 0, "safe");
103
- var failureOf = /* @__PURE__ */ __name(async (response) => {
104
- try {
105
- const body = await response.json();
106
- const code = safe(body.error?.code);
107
- const type = safe(body.error?.type);
108
- return { ...code ? { code } : {}, ...type ? { type } : {} };
109
- } catch {
110
- return {};
111
- }
112
- }, "failureOf");
113
- var TRANSCRIPTION_TIMEOUT_MS = 6e5;
114
- var send = /* @__PURE__ */ __name(async (wav, options) => {
115
- const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
116
- const post = options.fetch ?? endpointFetch(url, TRANSCRIPTION_TIMEOUT_MS);
117
- const retry = options.retry ?? RETRY;
118
- const sleep = options.sleep ?? sleeping;
119
- const random = options.random ?? Math.random;
120
- const who = options.label ?? "OpenAI";
121
- for (let attempt = 1; ; attempt++) {
122
- interrupted(options.signal);
123
- let response;
124
- try {
125
- response = await post(url, {
126
- method: "POST",
127
- headers: options.apiKey ? { authorization: `Bearer ${options.apiKey}` } : {},
128
- body: formOf(wav, options),
129
- ...options.signal ? { signal: options.signal } : {}
130
- });
131
- } catch {
132
- interrupted(options.signal);
133
- if (attempt > retry.retries)
134
- throw new CliError("network_error", `${who} could not be reached`, { reason: "network.failed" });
135
- await sleep(backoffMs(attempt, retry, random), options.signal);
136
- continue;
137
- }
138
- if (response.ok) {
139
- const body = await response.json().catch(() => interrupted(options.signal));
140
- if (typeof body?.text !== "string")
141
- throw new CliError("invalid_response", `${who} answered without a transcript`, {
142
- reason: "provider.invalid-response"
143
- });
144
- return body.text.trim();
145
- }
146
- const { code, type } = await failureOf(response);
147
- const status = response.status;
148
- const said = `HTTP ${status}${code ? `, ${code}` : type ? `, ${type}` : ""}`;
149
- if (status === 401)
150
- throw new CliError("authentication_error", `${who} refused the key (${said}) \u2014 set it again with \`${options.keyHint ?? "models keys set openai"}\``, { reason: "auth.failed" });
151
- if (status === 403)
152
- 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" });
153
- if (status === 413)
154
- throw new CliError("validation_error", `${who} refused the audio as too large (${said})`, {
155
- reason: "transcription.too-large"
156
- });
157
- if (EXHAUSTED.has(code ?? "") || EXHAUSTED.has(type ?? ""))
158
- 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" });
159
- const again = status === 408 || status === 429 || status >= 500;
160
- const asked = providerWaitMs(response.headers, () => /* @__PURE__ */ new Date());
161
- if (again && attempt <= retry.retries && (asked === void 0 || asked <= retry.maxRetryAfterMs)) {
162
- await sleep(asked ?? backoffMs(attempt, retry, random), options.signal);
163
- continue;
164
- }
165
- if (status === 429)
166
- throw new CliError("rate_limited", `${who} answered ${said}`, {
167
- reason: "provider.rate-limited",
168
- ...asked === void 0 ? {} : { retry_after_ms: asked }
169
- });
170
- if (status >= 500)
171
- 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" });
172
- throw new CliError("provider_error", `${who} answered ${said}`, { reason: "provider.refused" });
173
- }
174
- }, "send");
175
- var piecesOf = /* @__PURE__ */ __name((spans, limit) => {
176
- const pieces = [];
177
- for (const span of spans) {
178
- const last = pieces.at(-1);
179
- const joined = last !== void 0 && span.start - last.end < JOINED_SECONDS;
180
- const fits = last !== void 0 && limit !== void 0 && span.end - last.start <= limit;
181
- if (last && (fits || joined && span.end - last.start <= LONGEST_REQUEST_SECONDS))
182
- last.end = span.end;
183
- else
184
- pieces.push({ start: span.start, end: span.end });
185
- }
186
- return pieces;
187
- }, "piecesOf");
188
- var openCutter = /* @__PURE__ */ __name(async (vadModel) => {
189
- const { openSpeechCutter } = await import("./recognize-XDSZEZP5.js");
190
- return openSpeechCutter(vadModel);
191
- }, "openCutter");
192
- var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
193
- const bad = keywords.find((keyword) => typeof keyword !== "string" || !keyword.trim() || /[<>\r\n]/.test(keyword));
194
- if (bad !== void 0)
195
- throw new CliError("validation_error", "a keyword must be a non-empty single line without < or > \u2014 OpenAI refuses the whole request otherwise");
196
- }, "checkKeywords");
197
- var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
198
- refuseModelAddress(options.env ?? process.env, options.baseUrl ?? OPENAI_URL, "audio");
199
- if (!options.apiKey && !onThisComputer(options.baseUrl ?? OPENAI_URL))
200
- throw new CliError("authentication_error", "no OpenAI key \u2014 `models keys set openai`, or OPENAI_API_KEY", {
201
- reason: "transcription.no-key"
202
- });
203
- checkKeywords(options.keywords);
204
- interrupted(options.signal);
205
- const pcm = toModelRate(audio.samples, audio.rate);
206
- const duration = (pcm.length - LEAD) / SAMPLE_RATE;
207
- if (options.bundle && duration <= LONGEST_REQUEST_SECONDS) {
208
- const text = await send(encodeWav(pcm.subarray(LEAD)), options);
209
- return text ? [{ start: 0, end: duration, text }] : [];
210
- }
211
- const vadModel = options.vadModel ?? vadPath(modelsDirectory(options.env));
212
- if (!options.cutter && !filesPresent([[VAD, vadModel]]))
213
- 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" });
214
- const cutter = await (options.cutter ?? openCutter)(vadModel);
215
- let spans;
216
- try {
217
- spans = cutter.cut(pcm);
218
- } finally {
219
- cutter.free();
220
- }
221
- const pieces = piecesOf(spans, options.bundle ? LONGEST_REQUEST_SECONDS : void 0);
222
- const heard = [];
223
- for (const [index, piece] of pieces.entries()) {
224
- const end = Math.min(piece.end, duration);
225
- const from = Math.max(piece.start - PAD_SECONDS, pieces[index - 1]?.end ?? 0);
226
- const to = Math.min(end + PAD_SECONDS, pieces[index + 1]?.start ?? duration);
227
- const samples = pcm.subarray(LEAD + Math.floor(from * SAMPLE_RATE), LEAD + Math.ceil(to * SAMPLE_RATE));
228
- const text = await send(encodeWav(samples), options);
229
- if (text)
230
- heard.push({ start: Math.min(piece.start, end), end, text });
231
- }
232
- return heard;
233
- }, "transcribeOpenAI");
234
- export {
235
- LONGEST_REQUEST_SECONDS,
236
- piecesOf,
237
- transcribeOpenAI
238
- };
@@ -1,91 +0,0 @@
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@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/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
- };