@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,388 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- DEFAULT_RETRY,
5
- backoffMs,
6
- realSleep,
7
- wallClock
8
- } from "./chunk-UXDUWGX6.js";
9
- import {
10
- CliError,
11
- isCliError
12
- } from "./chunk-S6JG4YUH.js";
13
- import {
14
- __name
15
- } from "./chunk-ZVVMGPBJ.js";
16
-
17
- // node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/body.js
18
- var interrupted = /* @__PURE__ */ __name((signal) => isCliError(signal.reason) ? signal.reason : new CliError(signal.reason instanceof Error && signal.reason.name === "TimeoutError" ? "timeout" : "cancelled", "HTTP response read was interrupted"), "interrupted");
19
- var checked = /* @__PURE__ */ __name((signal) => {
20
- if (signal?.aborted)
21
- throw interrupted(signal);
22
- }, "checked");
23
- var abortable = /* @__PURE__ */ __name(async (pending, signal) => {
24
- if (!signal)
25
- return pending;
26
- let abort = /* @__PURE__ */ __name(() => {
27
- }, "abort");
28
- const stopped = new Promise((_, reject) => {
29
- abort = /* @__PURE__ */ __name(() => reject(interrupted(signal)), "abort");
30
- signal.addEventListener("abort", abort, { once: true });
31
- if (signal.aborted)
32
- abort();
33
- });
34
- try {
35
- return await Promise.race([pending, stopped]);
36
- } finally {
37
- signal.removeEventListener("abort", abort);
38
- }
39
- }, "abortable");
40
- var readJsonResponse = /* @__PURE__ */ __name(async (response, options) => {
41
- const { maxBytes, signal } = options ?? {};
42
- if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
43
- throw new CliError("validation_error", "maxBytes must be a positive safe integer");
44
- if (signal !== void 0 && !(signal instanceof AbortSignal))
45
- throw new CliError("validation_error", "signal must be an AbortSignal");
46
- if (signal?.aborted) {
47
- void response.body?.cancel().catch(() => {
48
- });
49
- throw interrupted(signal);
50
- }
51
- const length = response.headers.get("content-length");
52
- if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
53
- void response.body?.cancel().catch(() => {
54
- });
55
- throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
56
- }
57
- if (!response.body)
58
- throw new CliError("invalid_response", "HTTP response has no body");
59
- if (response.body.locked)
60
- throw new CliError("invalid_response", "HTTP response body is already in use");
61
- const reader = response.body.getReader();
62
- const chunks = [];
63
- let bytes = 0;
64
- try {
65
- for (; ; ) {
66
- checked(signal);
67
- const part = await abortable(reader.read(), signal);
68
- checked(signal);
69
- if (part.done)
70
- break;
71
- if (!(part.value instanceof Uint8Array))
72
- throw new CliError("invalid_response", "HTTP response is not bytes");
73
- bytes += part.value.byteLength;
74
- if (bytes > maxBytes)
75
- throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
76
- if (part.value.byteLength)
77
- chunks.push(new Uint8Array(part.value));
78
- }
79
- const body = new Uint8Array(bytes);
80
- let offset = 0;
81
- for (const chunk of chunks) {
82
- body.set(chunk, offset);
83
- offset += chunk.byteLength;
84
- }
85
- try {
86
- return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
87
- } catch {
88
- throw new CliError("invalid_response", "HTTP response is not valid UTF-8 JSON");
89
- }
90
- } catch (error) {
91
- checked(signal);
92
- if (isCliError(error))
93
- throw error;
94
- throw new CliError("network_error", "HTTP response could not be read");
95
- } finally {
96
- void reader.cancel().catch(() => {
97
- });
98
- reader.releaseLock();
99
- }
100
- }, "readJsonResponse");
101
-
102
- // node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/hosts.js
103
- var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
104
- var HOST_PATTERN = new RegExp(`^(?:${LABEL}(?:\\.${LABEL})*|\\*\\.${LABEL}(?:\\.${LABEL})+)$`);
105
- var hostProblems = /* @__PURE__ */ __name((hosts) => [
106
- ...hosts.filter((host) => !HOST_PATTERN.test(host) || host.length > 253).map((host) => `${JSON.stringify(host)} is not a host: a lower-case hostname with no scheme, port or path, or one leading *. before two labels or more`),
107
- ...hosts.filter((host, at) => hosts.indexOf(host) !== at).map((host) => `${JSON.stringify(host)} is listed twice`)
108
- ], "hostProblems");
109
- var hostCovered = /* @__PURE__ */ __name((hostname, hosts) => {
110
- const name = hostname.toLowerCase().replace(/\.$/, "");
111
- return hosts.some((host) => host.startsWith("*.") ? name.endsWith(host.slice(1)) : name === host);
112
- }, "hostCovered");
113
-
114
- // node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/fetch.js
115
- var HOST_FETCH_TIMEOUT_MS = 3e4;
116
- var REDIRECTS = 5;
117
- var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
118
- var CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
119
- var NO_BODY = /* @__PURE__ */ new Set([204, 205, 304]);
120
- var deadline = /* @__PURE__ */ __name((ms) => {
121
- const controller = new AbortController();
122
- const timer = setTimeout(() => controller.abort(new DOMException(`no answer within ${ms} ms`, "TimeoutError")), ms);
123
- timer.unref?.();
124
- return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
125
- }, "deadline");
126
- var released = /* @__PURE__ */ __name((response, clear) => {
127
- if (!response.body || NO_BODY.has(response.status) || response.status < 200 || response.status > 599) {
128
- clear();
129
- return response;
130
- }
131
- const { status, statusText, headers, url, redirected } = response;
132
- const wrapped = new Response(response.body.pipeThrough(new TransformStream({ flush: clear })), {
133
- status,
134
- statusText,
135
- headers
136
- });
137
- return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
138
- }, "released");
139
- var undeclared = /* @__PURE__ */ __name((url) => new CliError("configuration_error", `${url.hostname} is not a host this CLI declares: add "${url.hostname}" to \`hosts\` in its WCAT identity and run cli-dev manifest`, { reason: "network.host-undeclared", sent: false }), "undeclared");
140
- var checked2 = /* @__PURE__ */ __name((url, hosts) => {
141
- if (url.protocol !== "https:" && url.protocol !== "http:")
142
- throw new CliError("validation_error", `only http and https are fetched, not ${url.protocol.replace(/:$/, "")}`, {
143
- sent: false
144
- });
145
- if (!hostCovered(url.hostname, hosts))
146
- throw undeclared(url);
147
- return url;
148
- }, "checked");
149
- var ENCODED_SLASH = /%2f|%5c/i;
150
- var scopeOf = /* @__PURE__ */ __name((scope) => {
151
- if (scope === void 0)
152
- return void 0;
153
- if (!URL.canParse(scope))
154
- throw new CliError("configuration_error", `credentialScope ${scope} is not a URL`);
155
- const { origin, pathname } = new URL(scope);
156
- const prefix = pathname.endsWith("/") ? pathname : `${pathname}/`;
157
- return (url) => url.origin === origin && (url.pathname === pathname || url.pathname.startsWith(prefix)) && !ENCODED_SLASH.test(url.pathname);
158
- }, "scopeOf");
159
- var signedHeaders = /* @__PURE__ */ __name((headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name)), "signedHeaders");
160
- var NOT_SENT = /* @__PURE__ */ new Set(["EAI_AGAIN", "ENOTFOUND", "ECONNREFUSED"]);
161
- var neverSent = /* @__PURE__ */ __name((error) => {
162
- for (let at = error, depth = 0; at instanceof Error && depth < 4; at = at.cause, depth++) {
163
- const code = at.code;
164
- if (typeof code === "string" && NOT_SENT.has(code))
165
- return true;
166
- }
167
- return false;
168
- }, "neverSent");
169
- var hostFetch = /* @__PURE__ */ __name((options) => {
170
- const problems = hostProblems(options.hosts);
171
- if (problems.length > 0)
172
- throw new CliError("configuration_error", problems.join("; "));
173
- const { hosts, fetch: send = globalThis.fetch, timeoutMs = HOST_FETCH_TIMEOUT_MS, redirects = REDIRECTS } = options;
174
- const inScope = scopeOf(options.credentialScope);
175
- return async (input, init = {}) => {
176
- const request = input instanceof Request ? input : void 0;
177
- let url = checked2(new URL(request?.url ?? String(input)), hosts);
178
- const caller = init.signal ?? request?.signal;
179
- const timeout = deadline(timeoutMs);
180
- const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
181
- const follow = (init.redirect ?? request?.redirect ?? "follow") === "follow";
182
- let method = (init.method ?? request?.method ?? "GET").toUpperCase();
183
- let body = init.body ?? request?.body ?? void 0;
184
- const headers = new Headers(init.headers ?? request?.headers);
185
- if (inScope && signedHeaders(headers) && !inScope(url))
186
- throw new CliError("configuration_error", `the sign-in goes only under ${options.credentialScope}, not ${url.origin}${url.pathname}`, {
187
- sent: false
188
- });
189
- let answered = false;
190
- try {
191
- let response = await send(input, { ...init, signal, ...follow ? { redirect: "manual" } : {} });
192
- answered = true;
193
- for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
194
- const location = response.headers.get("location");
195
- if (!location)
196
- return released(response, timeout.clear);
197
- if (hop >= redirects)
198
- throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
199
- void response.body?.cancel().catch(() => {
200
- });
201
- const next = checked2(new URL(location, url), hosts);
202
- if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
203
- method = method === "HEAD" ? "HEAD" : "GET";
204
- body = void 0;
205
- headers.delete("content-type");
206
- headers.delete("content-length");
207
- } else if (body instanceof ReadableStream)
208
- throw new CliError("invalid_response", `${url.hostname} redirected a streamed body, which cannot be sent again`);
209
- if (inScope ? !inScope(next) : next.origin !== url.origin)
210
- for (const name of CREDENTIAL_HEADERS)
211
- headers.delete(name);
212
- url = next;
213
- response = await send(url, { ...init, method, headers, body, signal, redirect: "manual" });
214
- }
215
- return released(response, timeout.clear);
216
- } catch (error) {
217
- timeout.clear();
218
- if (isCliError(error))
219
- throw error;
220
- if (caller?.aborted)
221
- throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
222
- if (timeout.signal.aborted)
223
- throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
224
- throw new CliError("network_error", `${url.hostname} could not be reached`, {
225
- retryable: true,
226
- ...!answered && neverSent(error) ? { sent: false } : {}
227
- });
228
- }
229
- };
230
- }, "hostFetch");
231
-
232
- // node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
233
- var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
234
- if (!header)
235
- return void 0;
236
- const trimmed = header.trim();
237
- if (/^\d+$/.test(trimmed))
238
- return Number(trimmed) * 1e3;
239
- const at = Date.parse(trimmed);
240
- if (Number.isNaN(at))
241
- return void 0;
242
- const delta = at - now().getTime();
243
- return delta > 0 ? delta : void 0;
244
- }, "parseRetryAfter");
245
- var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
246
- if (!header)
247
- return void 0;
248
- const seconds = Number(header.trim());
249
- if (!Number.isFinite(seconds))
250
- return void 0;
251
- const delta = seconds * 1e3 - now().getTime();
252
- return delta > 0 ? delta : void 0;
253
- }, "parseRateLimitReset");
254
- var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
255
- var retryableStatus = /* @__PURE__ */ __name((status) => status === 408 || status === 429 || status >= 500, "retryableStatus");
256
- var statusToCode = /* @__PURE__ */ __name((status) => {
257
- if (status === 400 || status === 422)
258
- return "validation_error";
259
- if (status === 401)
260
- return "authentication_error";
261
- if (status === 403)
262
- return "permission_error";
263
- if (status === 404)
264
- return "not_found";
265
- if (status === 408)
266
- return "timeout";
267
- if (status === 429)
268
- return "rate_limited";
269
- if (status === 502 || status === 503 || status === 504)
270
- return "provider_unavailable";
271
- return "provider_error";
272
- }, "statusToCode");
273
- var SAFE = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
274
- var retrying = /* @__PURE__ */ __name((send, options = {}) => {
275
- const { retry = DEFAULT_RETRY, reads = /* @__PURE__ */ __name((method) => SAFE.has(method), "reads"), pacer, budget = Number.POSITIVE_INFINITY, sleep = realSleep, now = wallClock, random = Math.random } = options;
276
- return async (input, init = {}) => {
277
- const request = input instanceof Request ? input : void 0;
278
- const method = (init.method ?? request?.method ?? "GET").toUpperCase();
279
- const read = reads(method, new URL(request?.url ?? String(input)));
280
- const signal = init.signal ?? request?.signal ?? void 0;
281
- const once = init.body instanceof ReadableStream;
282
- let waited = 0;
283
- const pause = /* @__PURE__ */ __name(async (ms) => {
284
- waited += ms;
285
- await sleep(ms, signal, "retry");
286
- }, "pause");
287
- for (let attempt = 1; ; attempt++) {
288
- if (pacer) {
289
- const wait = await pacer.reserve() - now().getTime();
290
- if (wait > 0) {
291
- if (waited + wait > budget)
292
- throw new CliError("rate_limited", `the provider's pace needs a ${wait} ms wait, more than this run allows`, {
293
- retry_after_ms: wait,
294
- sent: false
295
- });
296
- await pause(wait);
297
- }
298
- }
299
- const last = once || attempt > retry.retries;
300
- try {
301
- const response = await send(request && !last ? request.clone() : input, init);
302
- if (last || !retryableStatus(response.status) || !(read || response.status === 429))
303
- return response;
304
- const wait = providerWaitMs(response.headers, now) ?? backoffMs(attempt, retry, random);
305
- if (wait > retry.maxRetryAfterMs || waited + wait > budget)
306
- return response;
307
- await response.body?.cancel().catch(() => {
308
- });
309
- if (response.status === 429)
310
- await pacer?.holdFor(wait);
311
- await pause(wait);
312
- } catch (error) {
313
- if (last || !read || signal?.aborted || !isCliError(error) || error.details.retryable !== true)
314
- throw error;
315
- const wait = backoffMs(attempt, retry, random);
316
- if (waited + wait > budget)
317
- throw error;
318
- await pause(wait);
319
- }
320
- }
321
- };
322
- }, "retrying");
323
-
324
- // 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/models/endpoint.js
325
- var endpoint = /* @__PURE__ */ __name((value) => {
326
- try {
327
- const url = new URL(value);
328
- return ["https:", "http:"].includes(url.protocol) && !url.username && !url.password && !url.search && !url.hash;
329
- } catch {
330
- return false;
331
- }
332
- }, "endpoint");
333
- var loopback = /* @__PURE__ */ __name((hostname) => hostname === "localhost" || hostname === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname), "loopback");
334
- var onThisComputer = /* @__PURE__ */ __name((value) => {
335
- try {
336
- return loopback(new URL(value).hostname);
337
- } catch {
338
- return false;
339
- }
340
- }, "onThisComputer");
341
- var modelAddressAllowed = /* @__PURE__ */ __name((value) => endpoint(value) && (new URL(value).protocol === "https:" || onThisComputer(value)), "modelAddressAllowed");
342
- var PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
343
- var literalFetch = /* @__PURE__ */ __name((hostname, timeoutMs) => async (input, init = {}) => {
344
- const url = new URL(input instanceof Request ? input.url : String(input));
345
- if (url.hostname !== hostname)
346
- throw new CliError("configuration_error", `${url.hostname} is not the model address's host, ${hostname}`, {
347
- reason: "network.host-undeclared",
348
- sent: false
349
- });
350
- const deadline2 = AbortSignal.timeout(timeoutMs);
351
- const signal = init.signal ? AbortSignal.any([init.signal, deadline2]) : deadline2;
352
- try {
353
- const response = await fetch(input, { ...init, signal, redirect: "manual" });
354
- if (response.status >= 300 && response.status < 400) {
355
- void response.body?.cancel().catch(() => {
356
- });
357
- throw new CliError("invalid_response", `${hostname} answered with a redirect, which is not followed`);
358
- }
359
- return response;
360
- } catch (error) {
361
- if (isCliError(error))
362
- throw error;
363
- if (init.signal?.aborted)
364
- throw new CliError("cancelled", "request cancelled");
365
- if (deadline2.aborted)
366
- throw new CliError("timeout", `${hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
367
- throw new CliError("network_error", `${hostname} could not be reached`, { retryable: true });
368
- }
369
- }, "literalFetch");
370
- var endpointFetch = /* @__PURE__ */ __name((address, timeoutMs) => {
371
- const { hostname } = new URL(address);
372
- if (hostname === "[::1]")
373
- return fetch;
374
- return hostname.startsWith("[") ? literalFetch(hostname, timeoutMs) : hostFetch({ hosts: [hostname], timeoutMs });
375
- }, "endpointFetch");
376
-
377
- export {
378
- readJsonResponse,
379
- hostFetch,
380
- providerWaitMs,
381
- statusToCode,
382
- retrying,
383
- endpoint,
384
- onThisComputer,
385
- modelAddressAllowed,
386
- PLAIN_HTTP_REFUSED,
387
- endpointFetch
388
- };
@@ -1,274 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- wirecatDirectory
5
- } from "./chunk-2R2EX5I6.js";
6
- import {
7
- CliError
8
- } from "./chunk-S6JG4YUH.js";
9
- import {
10
- __name
11
- } from "./chunk-ZVVMGPBJ.js";
12
-
13
- // 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/models.js
14
- var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
15
- var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
16
- var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
17
- var parakeet = huggingFace("sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8", "2bda32ec70b097a55adaa07d9a7173915b43cc78");
18
- var MODELS = [
19
- {
20
- id: "gigaam-v3",
21
- title: "GigaAM v3, with punctuation",
22
- languages: "Russian \u2014 the best of the three for Russian",
23
- language: "ru",
24
- featureDim: 64,
25
- files: [
26
- {
27
- name: "encoder.int8.onnx",
28
- url: gigaam("encoder.int8.onnx"),
29
- sha256: "369f35a71bf288d3b8e0391fabd8dba5f2314088d440bca474056b7b4b6e66bf",
30
- bytes: 224570820
31
- },
32
- {
33
- name: "decoder.onnx",
34
- url: gigaam("decoder.onnx"),
35
- sha256: "38fc7475443ea2a26f63211ca350f73ac50fff824ab7a3876ee2bd610c53bbc4",
36
- bytes: 4600132
37
- },
38
- {
39
- name: "joiner.onnx",
40
- url: gigaam("joiner.onnx"),
41
- sha256: "602ff7017a93311aad34df1437c8d7f49911353c13d6eae7a6ee7b041339465c",
42
- bytes: 2712896
43
- },
44
- {
45
- name: "tokens.txt",
46
- url: gigaam("tokens.txt"),
47
- sha256: "39abae20e692998290c574e606f11a9edef2902a1995463fcff63d1490cf22b7",
48
- bytes: 13354
49
- }
50
- ],
51
- config: /* @__PURE__ */ __name((path) => ({
52
- transducer: { encoder: path("encoder.int8.onnx"), decoder: path("decoder.onnx"), joiner: path("joiner.onnx") },
53
- tokens: path("tokens.txt"),
54
- modelType: "nemo_transducer"
55
- }), "config")
56
- },
57
- {
58
- id: "gigaam-v3-ctc",
59
- title: "GigaAM v3 CTC, with punctuation \u2014 a little faster",
60
- languages: "Russian \u2014 a little faster, rougher with capital letters",
61
- language: "ru",
62
- featureDim: 64,
63
- files: [
64
- {
65
- name: "model.int8.onnx",
66
- url: gigaamCtc("model.int8.onnx"),
67
- sha256: "d5fea8df94263c285e54b21e5774b707c707192d3bdbeffd7b1eb07fb6743b35",
68
- bytes: 224893661
69
- },
70
- {
71
- name: "tokens.txt",
72
- url: gigaamCtc("tokens.txt"),
73
- sha256: "142de7570b3de5b3035ce111a89c228e80e6085273731d944093ddf24fa539cd",
74
- bytes: 2007
75
- }
76
- ],
77
- config: /* @__PURE__ */ __name((path) => ({ nemoCtc: { model: path("model.int8.onnx") }, tokens: path("tokens.txt") }), "config")
78
- },
79
- {
80
- id: "parakeet-v3",
81
- title: "NVIDIA Parakeet TDT 0.6B v3",
82
- /** The model card's list: huggingface.co/nvidia/parakeet-tdt-0.6b-v3, read 2026-09-24. */
83
- languages: "25: bg cs da de el en es et fi fr hr hu it lt lv mt nl pl pt ro ru sk sl sv uk",
84
- featureDim: 80,
85
- files: [
86
- {
87
- name: "encoder.int8.onnx",
88
- url: parakeet("encoder.int8.onnx"),
89
- sha256: "acfc2b4456377e15d04f0243af540b7fe7c992f8d898d751cf134c3a55fd2247",
90
- bytes: 652184281
91
- },
92
- {
93
- name: "decoder.int8.onnx",
94
- url: parakeet("decoder.int8.onnx"),
95
- sha256: "179e50c43d1a9de79c8a24149a2f9bac6eb5981823f2a2ed88d655b24248db4e",
96
- bytes: 11845275
97
- },
98
- {
99
- name: "joiner.int8.onnx",
100
- url: parakeet("joiner.int8.onnx"),
101
- sha256: "3164c13fc2821009440d20fcb5fdc78bff28b4db2f8d0f0b329101719c0948b3",
102
- bytes: 6355277
103
- },
104
- {
105
- name: "tokens.txt",
106
- url: parakeet("tokens.txt"),
107
- sha256: "d58544679ea4bc6ac563d1f545eb7d474bd6cfa467f0a6e2c1dc1c7d37e3c35d",
108
- bytes: 93939
109
- }
110
- ],
111
- config: /* @__PURE__ */ __name((path) => ({
112
- transducer: {
113
- encoder: path("encoder.int8.onnx"),
114
- decoder: path("decoder.int8.onnx"),
115
- joiner: path("joiner.int8.onnx")
116
- },
117
- tokens: path("tokens.txt"),
118
- modelType: "nemo_transducer"
119
- }), "config")
120
- }
121
- ];
122
- var OPENAI_TRANSCRIBE_MODEL = "gpt-transcribe";
123
- var VAD = {
124
- name: "silero_vad.onnx",
125
- url: "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx",
126
- sha256: "9e2449e1087496d8d4caba907f23e0bd3f78d91fa552479bb9c23ac09cbb1fd6",
127
- bytes: 643854
128
- };
129
- var DEFAULT_ORDER = ["parakeet-v3", "gigaam-v3", "gigaam-v3-ctc"];
130
- var orderedModels = /* @__PURE__ */ __name((order = DEFAULT_ORDER) => [.../* @__PURE__ */ new Set([...order, ...DEFAULT_ORDER])].map(speechModel), "orderedModels");
131
- var findModel = /* @__PURE__ */ __name((id) => MODELS.find((model) => model.id === id), "findModel");
132
- var speechModel = /* @__PURE__ */ __name((id) => {
133
- const model = findModel(id);
134
- if (!model) {
135
- throw new CliError("validation_error", `no speech model "${id}" \u2014 one of ${MODELS.map((known) => known.id).join(", ")}`);
136
- }
137
- return model;
138
- }, "speechModel");
139
-
140
- // 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/install.js
141
- import { createHash, randomUUID } from "node:crypto";
142
- import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
143
- import { rename, rm } from "node:fs/promises";
144
- import { dirname, join } from "node:path";
145
- import { Readable, Transform } from "node:stream";
146
- import { pipeline } from "node:stream/promises";
147
- var sharedModelsDirectory = /* @__PURE__ */ __name((kind, env = process.env) => join(wirecatDirectory(env), "models", kind), "sharedModelsDirectory");
148
- var modelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("audio", env), "modelsDirectory");
149
- var STALL_MS = 6e4;
150
- var watchdog = /* @__PURE__ */ __name((ms) => {
151
- const controller = new AbortController();
152
- let timer = setTimeout(() => controller.abort(), ms);
153
- return {
154
- signal: controller.signal,
155
- poke: /* @__PURE__ */ __name(() => {
156
- clearTimeout(timer);
157
- timer = setTimeout(() => controller.abort(), ms);
158
- }, "poke"),
159
- stop: /* @__PURE__ */ __name(() => clearTimeout(timer), "stop")
160
- };
161
- }, "watchdog");
162
- var modelPath = /* @__PURE__ */ __name((directory, model) => (name) => join(directory, model.id, name), "modelPath");
163
- var vadPath = /* @__PURE__ */ __name((directory) => join(directory, VAD.name), "vadPath");
164
- var placed = /* @__PURE__ */ __name((model, directory) => [
165
- ...model.files.map((file) => [file, modelPath(directory, model)(file.name)]),
166
- [VAD, vadPath(directory)]
167
- ], "placed");
168
- var isInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placed(model, directory)), "isInstalled");
169
- var filesPresent = /* @__PURE__ */ __name((files) => files.every(([file, path]) => sizeOf(path) === file.bytes), "filesPresent");
170
- var sizeOf = /* @__PURE__ */ __name((path) => {
171
- try {
172
- return statSync(path).size;
173
- } catch {
174
- return void 0;
175
- }
176
- }, "sizeOf");
177
- var installedBytes = /* @__PURE__ */ __name((model) => model.files.reduce((sum, file) => sum + file.bytes, 0), "installedBytes");
178
- var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, bytes, verifyExisting } = {}) => {
179
- mkdirSync(join(directory, model.id), { recursive: true, mode: 448 });
180
- await installFiles(placed(model, directory), { fetch: get, progress, bytes, verifyExisting });
181
- }, "install");
182
- var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, bytes = /* @__PURE__ */ __name(() => {
183
- }, "bytes"), verifyExisting } = {}) => {
184
- if (verifyExisting)
185
- for (const [file, path] of files) {
186
- if (sizeOf(path) !== void 0) {
187
- const hash = createHash("sha256");
188
- for await (const chunk of createReadStream(path))
189
- hash.update(chunk);
190
- if (hash.digest("hex") !== file.sha256) {
191
- progress?.(`${path}: not the file this version expects, downloading it again`);
192
- await rm(path, { force: true });
193
- }
194
- }
195
- }
196
- const total = files.reduce((sum, [file]) => sum + file.bytes, 0);
197
- const missing = files.filter(([file, path]) => sizeOf(path) !== file.bytes);
198
- let done = total - missing.reduce((sum, [file]) => sum + file.bytes, 0);
199
- bytes(done, total);
200
- for (const [file, path] of missing) {
201
- mkdirSync(dirname(path), { recursive: true, mode: 448 });
202
- progress?.(`downloading ${file.name} (${megabytes(file.bytes)})`);
203
- const before = done;
204
- await fetchVerified(file, path, get, (received) => {
205
- done = before + received;
206
- bytes(done, total);
207
- });
208
- }
209
- }, "installFiles");
210
- var fetchVerified = /* @__PURE__ */ __name(async (file, path, get, received) => {
211
- const stalled = watchdog(STALL_MS);
212
- try {
213
- await fetchInto(file, path, get, stalled, received);
214
- } catch (error) {
215
- if (stalled.signal.aborted) {
216
- throw new CliError("timeout", `${file.name} stopped downloading for ${STALL_MS / 1e3} s \u2014 nothing was installed`);
217
- }
218
- throw error;
219
- } finally {
220
- stalled.stop();
221
- }
222
- }, "fetchVerified");
223
- var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled, received) => {
224
- const response = await get(file.url, { signal: stalled.signal });
225
- if (!response.ok || !response.body) {
226
- await response.body?.cancel();
227
- throw new CliError("network_error", `${file.name} could not be downloaded: HTTP ${response.status}`);
228
- }
229
- const partial = `${path}.${randomUUID()}.part`;
230
- const hash = createHash("sha256");
231
- let bytes = 0;
232
- const hashing = new Transform({
233
- transform(chunk, _encoding, done) {
234
- stalled.poke();
235
- bytes += chunk.length;
236
- if (bytes > file.bytes) {
237
- done(new CliError("invalid_response", `${file.name} is larger than this version expects \u2014 nothing was installed`));
238
- return;
239
- }
240
- hash.update(chunk);
241
- received(bytes);
242
- done(null, chunk);
243
- }
244
- });
245
- try {
246
- await pipeline(Readable.fromWeb(response.body), hashing, createWriteStream(partial, { flags: "wx", mode: 384 }));
247
- const actual = hash.digest("hex");
248
- if (actual !== file.sha256) {
249
- throw new CliError("invalid_response", `${file.name} is not the file this version expects (sha256 ${actual}) \u2014 nothing was installed`);
250
- }
251
- await rename(partial, path);
252
- } finally {
253
- await rm(partial, { force: true });
254
- }
255
- }, "fetchInto");
256
- var megabytes = /* @__PURE__ */ __name((bytes) => bytes < 1e6 ? "under 1 MB" : `${Math.round(bytes / 1e6)} MB`, "megabytes");
257
-
258
- export {
259
- OPENAI_TRANSCRIBE_MODEL,
260
- VAD,
261
- DEFAULT_ORDER,
262
- orderedModels,
263
- speechModel,
264
- sharedModelsDirectory,
265
- modelsDirectory,
266
- modelPath,
267
- vadPath,
268
- isInstalled,
269
- filesPresent,
270
- installedBytes,
271
- install,
272
- installFiles,
273
- megabytes
274
- };