@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,50 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof require !== "undefined") return require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
16
- var __commonJS = (cb, mod) => function __require2() {
17
- try {
18
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
- } catch (e) {
20
- throw mod = 0, e;
21
- }
22
- };
23
- var __export = (target, all) => {
24
- for (var name in all)
25
- __defProp(target, name, { get: all[name], enumerable: true });
26
- };
27
- var __copyProps = (to, from, except, desc) => {
28
- if (from && typeof from === "object" || typeof from === "function") {
29
- for (let key of __getOwnPropNames(from))
30
- if (!__hasOwnProp.call(to, key) && key !== except)
31
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
- }
33
- return to;
34
- };
35
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
36
- // If the importer is in node compatibility mode or this is not an ESM
37
- // file that has been converted to a CommonJS file using a Babel-
38
- // compatible transform (i.e. "__esModule" has not been set), then set
39
- // "default" to the CommonJS "module.exports" for node compatibility.
40
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
41
- mod
42
- ));
43
-
44
- export {
45
- __name,
46
- __require,
47
- __commonJS,
48
- __export,
49
- __toESM
50
- };
@@ -1,37 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- SCHEMA_DIALECT,
5
- commandContract,
6
- commandPathOf,
7
- findCommand,
8
- outputOf
9
- } from "./chunk-QBYE26ZC.js";
10
- import "./chunk-J2LSOG3A.js";
11
- import "./chunk-5EH7S4RM.js";
12
- import "./chunk-GLU36VKA.js";
13
- import "./chunk-MFSWMNSZ.js";
14
- import "./chunk-T3W4V4A6.js";
15
- import "./chunk-K5L77R7P.js";
16
- import "./chunk-WRF6TY63.js";
17
- import "./chunk-SKUY7JDA.js";
18
- import "./chunk-XGNZD52X.js";
19
- import "./chunk-6V7ZUJI6.js";
20
- import "./chunk-DNCLQPOM.js";
21
- import "./chunk-NBNQLNVV.js";
22
- import "./chunk-P6OJKJJS.js";
23
- import "./chunk-O3DZDITT.js";
24
- import "./chunk-2R2EX5I6.js";
25
- import "./chunk-UXDUWGX6.js";
26
- import "./chunk-QPPOIWPY.js";
27
- import "./chunk-S4UUN6LD.js";
28
- import "./chunk-Y5E2WNWB.js";
29
- import "./chunk-S6JG4YUH.js";
30
- import "./chunk-ZVVMGPBJ.js";
31
- export {
32
- SCHEMA_DIALECT,
33
- commandContract,
34
- commandPathOf,
35
- findCommand,
36
- outputOf
37
- };
@@ -1,166 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- COMMAND_SERVER_CONCURRENT,
5
- enterCommandServer,
6
- serveCommands
7
- } from "./chunk-UOWHMOU3.js";
8
- import "./chunk-GZ7WBU5Y.js";
9
- import {
10
- ensureSqlite
11
- } from "./chunk-P6S3ZRVW.js";
12
- import "./chunk-QBYE26ZC.js";
13
- import {
14
- commandServerRequest,
15
- exitCodeSet,
16
- inCommandServerRequest
17
- } from "./chunk-J2LSOG3A.js";
18
- import "./chunk-5EH7S4RM.js";
19
- import "./chunk-GLU36VKA.js";
20
- import "./chunk-MFSWMNSZ.js";
21
- import "./chunk-T3W4V4A6.js";
22
- import "./chunk-K5L77R7P.js";
23
- import {
24
- asOwnProcess
25
- } from "./chunk-WRF6TY63.js";
26
- import "./chunk-SKUY7JDA.js";
27
- import "./chunk-XGNZD52X.js";
28
- import "./chunk-6V7ZUJI6.js";
29
- import "./chunk-DNCLQPOM.js";
30
- import "./chunk-NBNQLNVV.js";
31
- import "./chunk-P6OJKJJS.js";
32
- import "./chunk-O3DZDITT.js";
33
- import "./chunk-2R2EX5I6.js";
34
- import "./chunk-W4KLHM2K.js";
35
- import "./chunk-KYRYD4CR.js";
36
- import "./chunk-UXDUWGX6.js";
37
- import {
38
- catchCrashes
39
- } from "./chunk-QPPOIWPY.js";
40
- import "./chunk-S4UUN6LD.js";
41
- import "./chunk-Y5E2WNWB.js";
42
- import {
43
- CliError
44
- } from "./chunk-S6JG4YUH.js";
45
- import {
46
- __name
47
- } from "./chunk-ZVVMGPBJ.js";
48
-
49
- // 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/cli/command-server-entry.js
50
- import { PassThrough } from "node:stream";
51
- var route = /* @__PURE__ */ __name((stream, sink) => {
52
- const original = stream.write;
53
- stream.write = ((chunk, encoding, callback) => {
54
- sink()(typeof chunk === "string" ? Buffer.from(chunk, typeof encoding === "string" ? encoding : "utf8") : Buffer.from(chunk));
55
- const done = typeof encoding === "function" ? encoding : callback;
56
- if (done)
57
- process.nextTick(done);
58
- return true;
59
- });
60
- return () => {
61
- stream.write = original;
62
- };
63
- }, "route");
64
- var closedStdin = /* @__PURE__ */ __name(() => {
65
- const stdin = new PassThrough();
66
- stdin.end();
67
- return stdin;
68
- }, "closedStdin");
69
- var useStdin = /* @__PURE__ */ __name((outside) => Object.defineProperty(process, "stdin", {
70
- get: /* @__PURE__ */ __name(() => commandServerRequest()?.stdin ?? outside, "get"),
71
- configurable: true,
72
- enumerable: true
73
- }), "useStdin");
74
- var roomFor = /* @__PURE__ */ __name((runs) => {
75
- const emitters = [process, process.stdout, process.stderr];
76
- const before = emitters.map((emitter) => emitter.getMaxListeners());
77
- for (const emitter of emitters)
78
- emitter.setMaxListeners(emitter.getMaxListeners() + 2 * runs);
79
- return () => {
80
- for (const [at, emitter] of emitters.entries())
81
- emitter.setMaxListeners(before[at]);
82
- };
83
- }, "roomFor");
84
- var serveEntry = /* @__PURE__ */ __name(async (entry, io, { firstRunAt, commanderExit }) => {
85
- const release = catchCrashes({
86
- cli: entry.app.command,
87
- interactive: false,
88
- ...entry.reasons ? { reasons: entry.reasons } : {},
89
- target: io.signals
90
- });
91
- const stopper = new AbortController();
92
- const stop = /* @__PURE__ */ __name(() => stopper.abort(new CliError("cancelled", "the command server was stopped", { retryable: false })), "stop");
93
- const protocol = io.stdout.write.bind(io.stdout);
94
- const ownStderr = io.stderr.write.bind(io.stderr);
95
- const toStderr = /* @__PURE__ */ __name((chunk) => {
96
- ownStderr(chunk);
97
- }, "toStderr");
98
- const sink = /* @__PURE__ */ __name((pick) => () => {
99
- const request = commandServerRequest();
100
- return request ? (chunk) => pick(request).push(chunk) : toStderr;
101
- }, "sink");
102
- const unrouteOut = route(process.stdout, sink((request) => request.stdout));
103
- const unrouteErr = route(process.stderr, sink((request) => request.stderr));
104
- const stdin = Object.getOwnPropertyDescriptor(process, "stdin");
105
- const requests = io.stdin;
106
- useStdin(closedStdin());
107
- const unroom = roomFor(COMMAND_SERVER_CONCURRENT);
108
- io.signals.on("SIGINT", stop).on("SIGTERM", stop);
109
- io.stdout.on("error", stop);
110
- const run = /* @__PURE__ */ __name(async (argv, alone) => {
111
- const request = { stdout: [], stderr: [], stdin: closedStdin(), alone };
112
- const requestIo = { ...io, argv: [...io.argv.slice(0, 2), ...argv], stdin: request.stdin };
113
- const context = {
114
- args: argv,
115
- env: io.env,
116
- tty: false,
117
- signal: stopper.signal,
118
- atStart: /* @__PURE__ */ __name(async (command) => {
119
- await enterCommandServer(command, entry.app.command);
120
- await firstRunAt(entry, requestIo, () => true)(command);
121
- }, "atStart"),
122
- ask: /* @__PURE__ */ __name(async () => false, "ask"),
123
- openBrowser: /* @__PURE__ */ __name(async () => void 0, "openBrowser"),
124
- outputClosed: /* @__PURE__ */ __name(() => false, "outputClosed"),
125
- setExitCode: /* @__PURE__ */ __name((code2) => {
126
- request.exitCode = code2;
127
- }, "setExitCode")
128
- };
129
- const code = await inCommandServerRequest(request, () => asOwnProcess(async () => {
130
- try {
131
- const returned = await entry.run(context);
132
- return typeof returned === "number" ? returned : exitCodeSet() ?? 0;
133
- } catch (error) {
134
- return commanderExit(error) ?? entry.fail(error, context);
135
- }
136
- }));
137
- const text = /* @__PURE__ */ __name((chunks) => Buffer.concat(chunks).toString("utf8"), "text");
138
- return { code, stdout: text(request.stdout), stderr: text(request.stderr) };
139
- }, "run");
140
- try {
141
- if (entry.sqlite)
142
- await ensureSqlite();
143
- await serveCommands({
144
- input: requests,
145
- write: /* @__PURE__ */ __name((line) => new Promise((resolve) => protocol(line) ? resolve() : io.stdout.once("drain", resolve)), "write"),
146
- run,
147
- cli: entry.app.command,
148
- concurrent: COMMAND_SERVER_CONCURRENT,
149
- version: entry.app.version,
150
- signal: stopper.signal
151
- });
152
- io.setExitCode(0);
153
- } finally {
154
- io.signals.off("SIGINT", stop).off("SIGTERM", stop);
155
- unroom();
156
- unrouteOut();
157
- unrouteErr();
158
- if (stdin)
159
- Object.defineProperty(process, "stdin", stdin);
160
- requests.destroy?.();
161
- release();
162
- }
163
- }, "serveEntry");
164
- export {
165
- serveEntry
166
- };
@@ -1,297 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- SAMPLE_RATE,
5
- decodeOgg
6
- } from "./chunk-G6NY7LFB.js";
7
- import "./chunk-UXDUWGX6.js";
8
- import "./chunk-QPPOIWPY.js";
9
- import "./chunk-S4UUN6LD.js";
10
- import {
11
- importFrom
12
- } from "./chunk-Y5E2WNWB.js";
13
- import {
14
- CliError
15
- } from "./chunk-S6JG4YUH.js";
16
- import {
17
- __name
18
- } from "./chunk-ZVVMGPBJ.js";
19
-
20
- // 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/decode.js
21
- import { spawn } from "node:child_process";
22
- import { mkdtemp, open, readFile, rm, writeFile } from "node:fs/promises";
23
- import { createRequire } from "node:module";
24
- import { tmpdir } from "node:os";
25
- import { join } from "node:path";
26
- import { pathToFileURL } from "node:url";
27
- var LONGEST_AUDIO_SECONDS = 3600;
28
- var FFMPEG_TIMEOUT_MS = 12e4;
29
- var FFMPEG_FORMATS = "mov,mp4,m4a,3gp,3g2,mj2,aac,mp3,wav,amr,caf,aiff,flac,ogg,matroska,webm,asf";
30
- var text = /* @__PURE__ */ __name((bytes, from, length) => String.fromCharCode(...bytes.subarray(from, from + length)), "text");
31
- var contains = /* @__PURE__ */ __name((bytes, needle, within) => Buffer.from(bytes.buffer, bytes.byteOffset, Math.min(bytes.length, within)).includes(needle, 0, "latin1"), "contains");
32
- var formatOf = /* @__PURE__ */ __name((bytes) => {
33
- if (text(bytes, 0, 4) === "OggS") {
34
- if (contains(bytes, "OpusHead", 128))
35
- return "opus";
36
- if (contains(bytes, "vorbis", 128))
37
- return "vorbis";
38
- return "other";
39
- }
40
- if (text(bytes, 0, 4) === "fLaC")
41
- return "flac";
42
- const frame = bytes[0] === 255 && ((bytes[1] ?? 0) & 224) === 224 && ((bytes[1] ?? 0) >> 1 & 3) !== 0;
43
- if (text(bytes, 0, 3) === "ID3" || frame)
44
- return "mp3";
45
- return "other";
46
- }, "formatOf");
47
- var everyChannel = /* @__PURE__ */ __name((decoded) => {
48
- if (!decoded.channelData[0] || decoded.samplesDecoded === 0)
49
- throw new CliError("validation_error", "no audio in that file");
50
- return decoded.channelData.map((samples) => ({ samples, rate: decoded.sampleRate }));
51
- }, "everyChannel");
52
- var load = /* @__PURE__ */ __name((name) => importFrom(new URL("speech/decode.js", import.meta.resolve("@wirecat/cli-core")).href, pathToFileURL(createRequire(new URL("speech/decode.js", import.meta.resolve("@wirecat/cli-core")).href).resolve(name)).href), "load");
53
- var decodeVorbis = /* @__PURE__ */ __name(async (bytes) => {
54
- const { OggVorbisDecoder } = await load("@wasm-audio-decoders/ogg-vorbis");
55
- const decoder = new OggVorbisDecoder();
56
- await decoder.ready;
57
- try {
58
- return everyChannel(await decoder.decodeFile(bytes));
59
- } finally {
60
- decoder.free();
61
- }
62
- }, "decodeVorbis");
63
- var decodeFlac = /* @__PURE__ */ __name(async (bytes) => {
64
- const { FLACDecoder } = await load("@wasm-audio-decoders/flac");
65
- const decoder = new FLACDecoder();
66
- await decoder.ready;
67
- try {
68
- return everyChannel(await decoder.decodeFile(bytes));
69
- } finally {
70
- decoder.free();
71
- }
72
- }, "decodeFlac");
73
- var decodeMp3 = /* @__PURE__ */ __name(async (bytes) => {
74
- const { MPEGDecoder } = await load("mpg123-decoder");
75
- const decoder = new MPEGDecoder();
76
- await decoder.ready;
77
- try {
78
- return everyChannel(decoder.decode(bytes));
79
- } finally {
80
- decoder.free();
81
- }
82
- }, "decodeMp3");
83
- var tooLongError = /* @__PURE__ */ __name(() => new CliError("validation_error", `the audio is longer than ${LONGEST_AUDIO_SECONDS / 60} minutes`), "tooLongError");
84
- var FLOAT = 3;
85
- var LONGEST_HEADER = 64 * 1024;
86
- var EXTENSIBLE = 65534;
87
- var wavStream = /* @__PURE__ */ __name((most) => {
88
- let head = Buffer.alloc(0);
89
- let channels = 0;
90
- let rate = 0;
91
- let rest = Buffer.alloc(0);
92
- let length = 0;
93
- let parts = [];
94
- const header = /* @__PURE__ */ __name(() => {
95
- if (head.length < 12)
96
- return false;
97
- if (head.toString("latin1", 0, 4) !== "RIFF" || head.toString("latin1", 8, 12) !== "WAVE")
98
- throw new CliError("validation_error", "ffmpeg did not answer with WAV audio");
99
- for (let at = 12; at + 8 <= head.length; ) {
100
- const id = head.toString("latin1", at, at + 4);
101
- const size = head.readUInt32LE(at + 4);
102
- if (id === "data") {
103
- rest = head.subarray(at + 8);
104
- head = Buffer.alloc(0);
105
- return true;
106
- }
107
- if (at + 8 + size > head.length)
108
- return false;
109
- if (id === "fmt ") {
110
- const tag = head.readUInt16LE(at + 8);
111
- channels = head.readUInt16LE(at + 10);
112
- rate = head.readUInt32LE(at + 12);
113
- if (tag !== FLOAT && tag !== EXTENSIBLE || head.readUInt16LE(at + 22) !== 32 || channels < 1)
114
- throw new CliError("validation_error", "ffmpeg did not answer with 32-bit float samples");
115
- parts = Array.from({ length: channels }, () => []);
116
- }
117
- at += 8 + size + size % 2;
118
- }
119
- return false;
120
- }, "header");
121
- return {
122
- push: /* @__PURE__ */ __name((chunk) => {
123
- if (channels === 0 || head.length > 0) {
124
- head = Buffer.concat([head, chunk]);
125
- if (head.length > LONGEST_HEADER)
126
- throw new CliError("validation_error", "ffmpeg's WAV header never ended");
127
- if (!header())
128
- return true;
129
- chunk = Buffer.alloc(0);
130
- }
131
- const bytes = rest.length ? Buffer.concat([rest, chunk]) : chunk;
132
- const frame = channels * 4;
133
- const frames = Math.floor(bytes.length / frame);
134
- rest = Buffer.from(bytes.subarray(frames * frame));
135
- if (frames === 0)
136
- return length <= most;
137
- const view = new DataView(bytes.buffer, bytes.byteOffset, frames * frame);
138
- for (let channel = 0; channel < channels; channel++) {
139
- const samples = new Float32Array(frames);
140
- for (let index = 0; index < frames; index++)
141
- samples[index] = view.getFloat32(index * frame + channel * 4, true);
142
- parts[channel]?.push(samples);
143
- }
144
- length += frames;
145
- return length <= most;
146
- }, "push"),
147
- end: /* @__PURE__ */ __name(() => {
148
- if (channels === 0)
149
- throw new CliError("validation_error", "no audio in that file");
150
- return parts.map((pieces, channel) => {
151
- const samples = new Float32Array(length);
152
- let at = 0;
153
- for (const piece of pieces) {
154
- samples.set(piece, at);
155
- at += piece.length;
156
- }
157
- parts[channel] = [];
158
- return { samples, rate };
159
- });
160
- }, "end")
161
- };
162
- }, "wavStream");
163
- var runFfmpegFile = /* @__PURE__ */ __name((path) => new Promise((resolve, reject) => {
164
- const child = spawn("ffmpeg", [
165
- "-nostdin",
166
- "-hide_banner",
167
- "-loglevel",
168
- "error",
169
- "-protocol_whitelist",
170
- "file",
171
- "-format_whitelist",
172
- FFMPEG_FORMATS,
173
- "-i",
174
- path,
175
- "-vn",
176
- "-af",
177
- "aformat=channel_layouts=mono|stereo",
178
- "-ar",
179
- String(SAMPLE_RATE),
180
- "-c:a",
181
- "pcm_f32le",
182
- "-bitexact",
183
- "-f",
184
- "wav",
185
- "pipe:1"
186
- ], { stdio: ["ignore", "pipe", "pipe"], timeout: FFMPEG_TIMEOUT_MS });
187
- const wav = wavStream(LONGEST_AUDIO_SECONDS * SAMPLE_RATE);
188
- let long = false;
189
- let broken;
190
- let errors = "";
191
- child.stdout.on("data", (chunk) => {
192
- if (long || broken)
193
- return;
194
- try {
195
- long = !wav.push(chunk);
196
- } catch (error) {
197
- broken = error;
198
- }
199
- if (long || broken)
200
- child.kill();
201
- });
202
- child.stderr.on("data", (chunk) => {
203
- errors = (errors + chunk.toString()).slice(-500);
204
- });
205
- child.on("error", (error) => reject(error.code === "ENOENT" ? new CliError("validation_error", "only ffmpeg reads this audio format, and ffmpeg is not installed") : error));
206
- child.on("close", (code) => {
207
- if (long)
208
- return reject(tooLongError());
209
- if (broken)
210
- return reject(broken);
211
- if (code !== 0)
212
- return reject(new CliError("validation_error", `ffmpeg could not read the audio: ${errors.trim() || code}`));
213
- try {
214
- resolve(wav.end());
215
- } catch (error) {
216
- reject(error);
217
- }
218
- });
219
- }), "runFfmpegFile");
220
- var runFfmpeg = /* @__PURE__ */ __name(async (bytes) => {
221
- const directory = await mkdtemp(join(tmpdir(), "wirecat-audio-"));
222
- try {
223
- const input = join(directory, "audio");
224
- await writeFile(input, bytes, { mode: 384 });
225
- return await runFfmpegFile(input);
226
- } finally {
227
- await rm(directory, { recursive: true, force: true });
228
- }
229
- }, "runFfmpeg");
230
- var BUNDLED = {
231
- opus: decodeOgg,
232
- vorbis: decodeVorbis,
233
- flac: decodeFlac,
234
- mp3: decodeMp3
235
- };
236
- var tooLong = /* @__PURE__ */ __name((pcm) => pcm.samples.length / pcm.rate > LONGEST_AUDIO_SECONDS, "tooLong");
237
- var fromFfmpeg = /* @__PURE__ */ __name((answer) => Array.isArray(answer) ? { channels: answer, mixed: false } : { channels: [answer], mixed: true }, "fromFfmpeg");
238
- var decodeChannels = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => {
239
- const format = formatOf(bytes);
240
- const decoded = format === "other" ? fromFfmpeg(await ffmpeg(bytes)) : await BUNDLED[format](bytes).then((channels) => ({ channels, mixed: false }), (error) => ffmpeg(bytes).then(fromFfmpeg, () => {
241
- throw error;
242
- }));
243
- if (decoded.channels.length === 0)
244
- throw new CliError("validation_error", "no audio in that file");
245
- if (decoded.channels.some(tooLong))
246
- throw tooLongError();
247
- return decoded;
248
- }, "decodeChannels");
249
- var decodeChannelsFile = /* @__PURE__ */ __name(async (path, { maxBytes = 64 * 1024 * 1024, ffmpegFile = runFfmpegFile } = {}) => {
250
- const file = await open(path, "r");
251
- let start;
252
- let size;
253
- try {
254
- size = (await file.stat()).size;
255
- const head = Buffer.alloc(Math.min(size, 128));
256
- await file.read(head, 0, head.length, 0);
257
- start = head;
258
- } finally {
259
- await file.close();
260
- }
261
- if (formatOf(start) === "other") {
262
- const channels = await ffmpegFile(path);
263
- if (channels.some(tooLong))
264
- throw tooLongError();
265
- return { channels, mixed: false };
266
- }
267
- if (size > maxBytes)
268
- throw new CliError("validation_error", `the audio file is larger than ${Math.round(maxBytes / 1024 / 1024)} MB`, {
269
- reason: "file.too-large"
270
- });
271
- return decodeChannels(new Uint8Array(await readFile(path)), () => ffmpegFile(path));
272
- }, "decodeChannelsFile");
273
- var mixDown = /* @__PURE__ */ __name((channels) => {
274
- const [first] = channels;
275
- if (!first)
276
- throw new CliError("validation_error", "no audio in that file");
277
- if (channels.length === 1)
278
- return first;
279
- const length = channels.reduce((longest, { samples: samples2 }) => Math.max(longest, samples2.length), 0);
280
- const samples = new Float32Array(length);
281
- for (const channel of channels)
282
- for (let index = 0; index < channel.samples.length; index++)
283
- samples[index] = (samples[index] ?? 0) + (channel.samples[index] ?? 0) / channels.length;
284
- return { samples, rate: first.rate };
285
- }, "mixDown");
286
- var decodeAudio = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => mixDown((await decodeChannels(bytes, ffmpeg)).channels), "decodeAudio");
287
- export {
288
- LONGEST_AUDIO_SECONDS,
289
- decodeAudio,
290
- decodeChannels,
291
- decodeChannelsFile,
292
- formatOf,
293
- mixDown,
294
- runFfmpeg,
295
- runFfmpegFile,
296
- wavStream
297
- };