@wirecat/cli-memo 0.131.73 → 0.131.75

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 (200) hide show
  1. package/dist/bin/memo.js +2 -2
  2. package/dist/bundle/{all-profiles-L5QBYI3V.js → all-profiles-LUGN5BHP.js} +9 -9
  3. package/dist/bundle/{anthropic-XXKHNCQS.js → anthropic-W7JXDZPL.js} +5 -5
  4. package/dist/bundle/{app-server-FDMP3IBP.js → app-server-TRRARE66.js} +50 -49
  5. package/dist/bundle/auto-AQAKW55Z.js +89 -0
  6. package/dist/bundle/{bun-VLN4HBWB.js → bun-S3JZIN4S.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-KJCYXNMS.js → bun-sqlite-X3WQN3CV.js} +5 -5
  8. package/dist/bundle/{chunk-ZTONSM5X.js → chunk-2EZFUIL4.js} +2 -2
  9. package/dist/bundle/{chunk-HBP7AQXX.js → chunk-2QND7VJS.js} +12 -12
  10. package/dist/bundle/{chunk-2BH2RNFR.js → chunk-346PWQJF.js} +8 -8
  11. package/dist/bundle/{chunk-B7ATMWVO.js → chunk-4KDORB7C.js} +12 -37
  12. package/dist/bundle/{chunk-V3JOIUVB.js → chunk-4O2MYFYC.js} +4 -4
  13. package/dist/bundle/{chunk-I6MGDSYH.js → chunk-4QGUBKN5.js} +6 -6
  14. package/dist/bundle/{chunk-YDGZJK6U.js → chunk-4XI7S3PO.js} +24 -24
  15. package/dist/bundle/{chunk-XGXEWKR7.js → chunk-5CTOWPOL.js} +12 -12
  16. package/dist/bundle/{chunk-6OPZTBRR.js → chunk-5RLCKP5E.js} +59 -35
  17. package/dist/bundle/{chunk-VQUSPMYO.js → chunk-6AOPUQTC.js} +1 -1
  18. package/dist/bundle/chunk-6FTZ53TT.js +18 -0
  19. package/dist/bundle/{chunk-BTVND2RV.js → chunk-6I4DOBSD.js} +13 -13
  20. package/dist/bundle/{chunk-WJNLBQSV.js → chunk-6VMIMAZ2.js} +544 -586
  21. package/dist/bundle/{chunk-BBLT77AO.js → chunk-7Y4HUYI3.js} +26 -14
  22. package/dist/bundle/{chunk-JLC2RE4Y.js → chunk-AOHT5FNX.js} +82 -82
  23. package/dist/bundle/{chunk-VPR47AG4.js → chunk-BDVM5652.js} +1 -1
  24. package/dist/bundle/{chunk-MM3OMWST.js → chunk-C6MWOBEL.js} +24 -22
  25. package/dist/bundle/{chunk-LHZ4QBWB.js → chunk-E2PSOSTN.js} +2 -2
  26. package/dist/bundle/{chunk-J7ESMDVV.js → chunk-E74VWHZ2.js} +1 -1
  27. package/dist/bundle/{chunk-MLN4DPXN.js → chunk-EWRHTZD3.js} +17 -17
  28. package/dist/bundle/{chunk-FMSXN2N6.js → chunk-FGMFJUHR.js} +1058 -774
  29. package/dist/bundle/{chunk-A7QXBRUH.js → chunk-G45BLLDR.js} +4 -4
  30. package/dist/bundle/{chunk-KK3ZHBMI.js → chunk-GFVSZY4J.js} +26 -2
  31. package/dist/bundle/{chunk-IUEYR3TK.js → chunk-IQIM4UC7.js} +10 -10
  32. package/dist/bundle/{chunk-JABLJBXL.js → chunk-JINEHQ2T.js} +4927 -4920
  33. package/dist/bundle/chunk-KA5MDFLU.js +138 -0
  34. package/dist/bundle/{chunk-IKH4RCJO.js → chunk-KDBAY5JZ.js} +1 -1
  35. package/dist/bundle/{chunk-LJCT7YG6.js → chunk-KEBL3PY4.js} +4 -4
  36. package/dist/bundle/{chunk-C3UOKLIT.js → chunk-KUFOM3SB.js} +2 -2
  37. package/dist/bundle/{chunk-ZIGVDRSI.js → chunk-KYJBGCTC.js} +2 -2
  38. package/dist/bundle/{chunk-R3PK4Y7C.js → chunk-LPGE6ACC.js} +2 -2
  39. package/dist/bundle/{chunk-6ZRBQTKZ.js → chunk-LX3OSTBD.js} +4 -4
  40. package/dist/bundle/{chunk-NMOWIFH3.js → chunk-MPZBV5RL.js} +8 -8
  41. package/dist/bundle/{chunk-H74CWBSY.js → chunk-NR633L2N.js} +4 -4
  42. package/dist/bundle/{chunk-DSU6UR2X.js → chunk-NT5IOEEK.js} +1 -1
  43. package/dist/bundle/chunk-OWUEEVF6.js +177 -0
  44. package/dist/bundle/{chunk-L62FWN3Y.js → chunk-OYKQX4H3.js} +1 -1
  45. package/dist/bundle/{chunk-W6JPIP5C.js → chunk-QKWM4VK4.js} +6 -6
  46. package/dist/bundle/chunk-QYJJBE56.js +109 -0
  47. package/dist/bundle/{chunk-JPXDDRBD.js → chunk-RZS24U4N.js} +11 -11
  48. package/dist/bundle/{chunk-EI2P5E4C.js → chunk-SCYHDYLI.js} +3 -1
  49. package/dist/bundle/{chunk-OGUXOAOH.js → chunk-SIOPF2UG.js} +6 -6
  50. package/dist/bundle/{chunk-RB266FS6.js → chunk-SIQDO5DN.js} +4 -4
  51. package/dist/bundle/{chunk-O5KXCQE4.js → chunk-SJD4KTK2.js} +4 -4
  52. package/dist/bundle/{chunk-PAHBDQ5A.js → chunk-UIAGASGP.js} +6 -6
  53. package/dist/bundle/{chunk-ZI5Y2EUA.js → chunk-UU3OAPGO.js} +7 -7
  54. package/dist/bundle/{chunk-ON7ZROFP.js → chunk-V7BDQIZS.js} +2 -2
  55. package/dist/bundle/{chunk-EH7ACKFW.js → chunk-VB4OLJHK.js} +3 -3
  56. package/dist/bundle/{chunk-SILEPITK.js → chunk-VFKCZJFT.js} +25 -35
  57. package/dist/bundle/{chunk-HE2F4JII.js → chunk-VYCLOFPC.js} +24 -9
  58. package/dist/bundle/{chunk-UUBV5ATQ.js → chunk-W46O6RJ5.js} +20 -20
  59. package/dist/bundle/{chunk-QHLEMEF3.js → chunk-W64FO6DD.js} +53 -48
  60. package/dist/bundle/{chunk-LG5SQGNM.js → chunk-WKLF7CAM.js} +47 -45
  61. package/dist/bundle/{chunk-X35Q5CHE.js → chunk-WZHCQ4VZ.js} +8 -8
  62. package/dist/bundle/{chunk-PF6LXPK5.js → chunk-XMHWGHID.js} +4280 -4278
  63. package/dist/bundle/chunk-XPCTY6XV.js +116 -0
  64. package/dist/bundle/{chunk-E75LK7GD.js → chunk-XPSXVUZG.js} +3 -3
  65. package/dist/bundle/{chunk-XM6ZAPFW.js → chunk-XQ3RZU3J.js} +1 -1
  66. package/dist/bundle/{chunk-LOYI3STE.js → chunk-XQHOMQNZ.js} +4 -4
  67. package/dist/bundle/{chunk-K54MCZWM.js → chunk-YB4KGUXY.js} +3 -3
  68. package/dist/bundle/{chunk-US2HTCJA.js → chunk-YDTGYYOR.js} +4 -4
  69. package/dist/bundle/{chunk-EQLOQOIB.js → chunk-YLYZNPAZ.js} +2 -2
  70. package/dist/bundle/{chunk-BOZEBD3I.js → chunk-ZISVFVQU.js} +1445 -832
  71. package/dist/bundle/{chunk-IDCYBSML.js → chunk-ZL63GL3Y.js} +3 -3
  72. package/dist/bundle/{chunk-2C323QNQ.js → chunk-ZP2XI5DR.js} +9 -9
  73. package/dist/bundle/{chunk-3CANRF2G.js → chunk-ZTZLAGZA.js} +3 -3
  74. package/dist/bundle/{chunk-FSXQLNU4.js → chunk-ZXW5FPH2.js} +1 -1
  75. package/dist/bundle/command-contract-QQG343ZQ.js +32 -0
  76. package/dist/bundle/command-server-entry-XVUPTSSH.js +145 -0
  77. package/dist/bundle/{decode-OS6Y6ICA.js → decode-METZOSMG.js} +5 -5
  78. package/dist/bundle/{dispatch-VJSUBAUM.js → dispatch-PHB2Y6ZL.js} +8 -8
  79. package/dist/bundle/{echarts-JKGDUDYL.js → echarts-EBSP4VCK.js} +2 -2
  80. package/dist/bundle/{embed-UB4LH6MF.js → embed-GVVU7N7W.js} +6 -6
  81. package/dist/bundle/{embedder-TUQBG22Y.js → embedder-6BZOYAXV.js} +9 -9
  82. package/dist/bundle/entry-TBOYUMWB.js +21 -0
  83. package/dist/bundle/failure-EKMEAYZH.js +69 -0
  84. package/dist/bundle/{failure-GLF7OMMM.js → failure-OBT7CUVW.js} +2 -2
  85. package/dist/bundle/{first-run-VNJHZYGS.js → first-run-HQ4GA4EF.js} +11 -11
  86. package/dist/bundle/first-screen-6T65PQ37.js +30 -0
  87. package/dist/bundle/{instructions-Q6IZQUU7.js → instructions-VDKK3Y5Z.js} +1 -1
  88. package/dist/bundle/{mcp-H2WYFBNW.js → mcp-5275YLID.js} +2 -2
  89. package/dist/bundle/mcp-DEY765VA.js +90 -0
  90. package/dist/bundle/memo.js +16 -16
  91. package/dist/bundle/{node-ZSSIVKVC.js → node-HWGZYNUX.js} +2 -2
  92. package/dist/bundle/{node-sqlite-AUNJSQQL.js → node-sqlite-PSYENWGS.js} +6 -6
  93. package/dist/bundle/{oauth-2MTJFCMI.js → oauth-TQGMUJK2.js} +7 -7
  94. package/dist/bundle/{open-U7RC27MJ.js → open-KDDJDKCE.js} +5 -5
  95. package/dist/bundle/openai-QPGCUM4T.js +24 -0
  96. package/dist/bundle/{process-UEQX5STY.js → process-APNTXJJE.js} +1 -1
  97. package/dist/bundle/{program-G3F26HW7.js → program-OGDARQTX.js} +3060 -2547
  98. package/dist/bundle/{prompt-F23FC5PJ.js → prompt-BMBZCLGF.js} +5 -5
  99. package/dist/bundle/{recognize-ZVEGVD56.js → recognize-3SEY2MAR.js} +4 -4
  100. package/dist/bundle/{remote-CZXQS7PS.js → remote-ODH54UXO.js} +7 -7
  101. package/dist/bundle/{rerank-IRFXSVVO.js → rerank-JQHBNTUK.js} +7 -7
  102. package/dist/bundle/{serve-6CIMU5HP.js → serve-C22ZONSM.js} +9 -9
  103. package/dist/bundle/server-3UX245DY.js +62 -0
  104. package/dist/bundle/server-6G5XF3V5.js +48 -0
  105. package/dist/bundle/{server-H24MAUT2.js → server-ADPO4V4B.js} +70 -66
  106. package/dist/bundle/{state-TRWZWXB5.js → state-M3VGXSV4.js} +6 -6
  107. package/dist/bundle/{store-E4QUOOLX.js → store-GSZAXU3A.js} +13 -13
  108. package/dist/bundle/store-maintenance-command-QMTALGSQ.js +47 -0
  109. package/dist/bundle/update-HDJ23IV5.js +72 -0
  110. package/dist/context/context.d.ts.map +1 -1
  111. package/dist/context/context.js +4 -2
  112. package/dist/context/context.js.map +1 -1
  113. package/dist/contract-overrides/search.d.ts.map +1 -1
  114. package/dist/contract-overrides/search.js +6 -0
  115. package/dist/contract-overrides/search.js.map +1 -1
  116. package/dist/digest/backfill.d.ts +1 -1
  117. package/dist/digest/backfill.d.ts.map +1 -1
  118. package/dist/digest/backfill.js +71 -42
  119. package/dist/digest/backfill.js.map +1 -1
  120. package/dist/digest/brief.d.ts +14 -3
  121. package/dist/digest/brief.d.ts.map +1 -1
  122. package/dist/digest/brief.js +84 -34
  123. package/dist/digest/brief.js.map +1 -1
  124. package/dist/digest/command.d.ts +3 -0
  125. package/dist/digest/command.d.ts.map +1 -1
  126. package/dist/digest/command.js +23 -0
  127. package/dist/digest/command.js.map +1 -1
  128. package/dist/digest/digest-commands.d.ts +6 -0
  129. package/dist/digest/digest-commands.d.ts.map +1 -0
  130. package/dist/digest/digest-commands.js +241 -0
  131. package/dist/digest/digest-commands.js.map +1 -0
  132. package/dist/digest/digest.d.ts +5 -2
  133. package/dist/digest/digest.d.ts.map +1 -1
  134. package/dist/digest/digest.js +29 -8
  135. package/dist/digest/digest.js.map +1 -1
  136. package/dist/digest/digests.d.ts +72 -0
  137. package/dist/digest/digests.d.ts.map +1 -0
  138. package/dist/digest/digests.js +122 -0
  139. package/dist/digest/digests.js.map +1 -0
  140. package/dist/digest/tasks.d.ts +7 -4
  141. package/dist/digest/tasks.d.ts.map +1 -1
  142. package/dist/digest/tasks.js +13 -5
  143. package/dist/digest/tasks.js.map +1 -1
  144. package/dist/examples.d.ts.map +1 -1
  145. package/dist/examples.js +17 -1
  146. package/dist/examples.js.map +1 -1
  147. package/dist/people/command.d.ts +0 -1
  148. package/dist/people/command.d.ts.map +1 -1
  149. package/dist/people/command.js +114 -12
  150. package/dist/people/command.js.map +1 -1
  151. package/dist/program.d.ts +4 -1
  152. package/dist/program.d.ts.map +1 -1
  153. package/dist/program.js +9 -5
  154. package/dist/program.js.map +1 -1
  155. package/dist/reasons.d.ts.map +1 -1
  156. package/dist/reasons.js +24 -0
  157. package/dist/reasons.js.map +1 -1
  158. package/dist/rows.d.ts.map +1 -1
  159. package/dist/rows.js +13 -1
  160. package/dist/rows.js.map +1 -1
  161. package/dist/schedule/command.d.ts +8 -0
  162. package/dist/schedule/command.d.ts.map +1 -1
  163. package/dist/schedule/command.js +4 -2
  164. package/dist/schedule/command.js.map +1 -1
  165. package/dist/search/answers.d.ts +6 -1
  166. package/dist/search/answers.d.ts.map +1 -1
  167. package/dist/search/answers.js +17 -1
  168. package/dist/search/answers.js.map +1 -1
  169. package/dist/search/command.d.ts.map +1 -1
  170. package/dist/search/command.js +13 -2
  171. package/dist/search/command.js.map +1 -1
  172. package/dist/search/lane-gates.d.ts +4 -3
  173. package/dist/search/lane-gates.d.ts.map +1 -1
  174. package/dist/search/lane-gates.js +13 -7
  175. package/dist/search/lane-gates.js.map +1 -1
  176. package/dist/search/people.d.ts +2 -0
  177. package/dist/search/people.d.ts.map +1 -1
  178. package/dist/search/people.js +11 -4
  179. package/dist/search/people.js.map +1 -1
  180. package/dist/search/search.d.ts +5 -1
  181. package/dist/search/search.d.ts.map +1 -1
  182. package/dist/search/search.js +5 -1
  183. package/dist/search/search.js.map +1 -1
  184. package/dist/version.d.ts +1 -1
  185. package/dist/version.js +1 -1
  186. package/package.json +3 -3
  187. package/dist/bundle/auto-YQAECIZA.js +0 -85
  188. package/dist/bundle/chunk-KQTR6YA4.js +0 -262
  189. package/dist/bundle/command-contract-6HJ322BP.js +0 -32
  190. package/dist/bundle/entry-N4NCIQYH.js +0 -18
  191. package/dist/bundle/failure-BJEFFYH3.js +0 -65
  192. package/dist/bundle/first-screen-4XGF2NZ3.js +0 -30
  193. package/dist/bundle/mcp-REIASUJR.js +0 -90
  194. package/dist/bundle/openai-2SJCG6XM.js +0 -23
  195. package/dist/bundle/server-27KXLL4E.js +0 -61
  196. package/dist/bundle/server-TWMUWMFM.js +0 -48
  197. package/dist/bundle/store-maintenance-command-GLHRB2VZ.js +0 -47
  198. package/dist/bundle/update-QQEM73O5.js +0 -68
  199. /package/dist/bundle/{chunk-SYWHHQMC.js → chunk-G5GW3FFJ.js} +0 -0
  200. /package/dist/bundle/{chunk-ZOWQ5B33.js → chunk-IXSUVHW6.js} +0 -0
@@ -0,0 +1,138 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError,
5
+ isCliError
6
+ } from "./chunk-2EZFUIL4.js";
7
+ import {
8
+ __name
9
+ } from "./chunk-ZVVMGPBJ.js";
10
+
11
+ // node_modules/.pnpm/@wirecat+cli-base@0.95.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
12
+ var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
13
+ var HOST_PATTERN = new RegExp(`^(?:${LABEL}(?:\\.${LABEL})*|\\*\\.${LABEL}(?:\\.${LABEL})+)$`);
14
+ var hostProblems = /* @__PURE__ */ __name((hosts) => [
15
+ ...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`),
16
+ ...hosts.filter((host, at) => hosts.indexOf(host) !== at).map((host) => `${JSON.stringify(host)} is listed twice`)
17
+ ], "hostProblems");
18
+ var hostCovered = /* @__PURE__ */ __name((hostname, hosts) => {
19
+ const name = hostname.toLowerCase().replace(/\.$/, "");
20
+ return hosts.some((host) => host.startsWith("*.") ? name.endsWith(host.slice(1)) : name === host);
21
+ }, "hostCovered");
22
+
23
+ // node_modules/.pnpm/@wirecat+cli-base@0.95.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
24
+ var HOST_FETCH_TIMEOUT_MS = 3e4;
25
+ var REDIRECTS = 5;
26
+ var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
27
+ var CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
28
+ var NO_BODY = /* @__PURE__ */ new Set([204, 205, 304]);
29
+ var deadline = /* @__PURE__ */ __name((ms) => {
30
+ const controller = new AbortController();
31
+ const timer = setTimeout(() => controller.abort(new DOMException(`no answer within ${ms} ms`, "TimeoutError")), ms);
32
+ timer.unref?.();
33
+ return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
34
+ }, "deadline");
35
+ var released = /* @__PURE__ */ __name((response, clear) => {
36
+ if (!response.body || NO_BODY.has(response.status) || response.status < 200 || response.status > 599) {
37
+ clear();
38
+ return response;
39
+ }
40
+ const { status, statusText, headers, url, redirected } = response;
41
+ const wrapped = new Response(response.body.pipeThrough(new TransformStream({ flush: clear })), {
42
+ status,
43
+ statusText,
44
+ headers
45
+ });
46
+ return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
47
+ }, "released");
48
+ 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");
49
+ var checked = /* @__PURE__ */ __name((url, hosts) => {
50
+ if (url.protocol !== "https:" && url.protocol !== "http:")
51
+ throw new CliError("validation_error", `only http and https are fetched, not ${url.protocol.replace(/:$/, "")}`, {
52
+ sent: false
53
+ });
54
+ if (!hostCovered(url.hostname, hosts))
55
+ throw undeclared(url);
56
+ return url;
57
+ }, "checked");
58
+ var hostFetch = /* @__PURE__ */ __name((options) => {
59
+ const problems = hostProblems(options.hosts);
60
+ if (problems.length > 0)
61
+ throw new CliError("configuration_error", problems.join("; "));
62
+ const { hosts, fetch: send = globalThis.fetch, timeoutMs = HOST_FETCH_TIMEOUT_MS, redirects = REDIRECTS } = options;
63
+ return async (input, init = {}) => {
64
+ const request = input instanceof Request ? input : void 0;
65
+ let url = checked(new URL(request?.url ?? String(input)), hosts);
66
+ const caller = init.signal ?? request?.signal;
67
+ const timeout = deadline(timeoutMs);
68
+ const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
69
+ const follow = (init.redirect ?? request?.redirect ?? "follow") === "follow";
70
+ let method = (init.method ?? request?.method ?? "GET").toUpperCase();
71
+ let body = init.body ?? request?.body ?? void 0;
72
+ const headers = new Headers(init.headers ?? request?.headers);
73
+ try {
74
+ let response = await send(input, { ...init, signal, ...follow ? { redirect: "manual" } : {} });
75
+ for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
76
+ const location = response.headers.get("location");
77
+ if (!location)
78
+ return released(response, timeout.clear);
79
+ if (hop >= redirects)
80
+ throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
81
+ void response.body?.cancel().catch(() => {
82
+ });
83
+ const next = checked(new URL(location, url), hosts);
84
+ if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
85
+ method = method === "HEAD" ? "HEAD" : "GET";
86
+ body = void 0;
87
+ headers.delete("content-type");
88
+ headers.delete("content-length");
89
+ } else if (body instanceof ReadableStream)
90
+ throw new CliError("invalid_response", `${url.hostname} redirected a streamed body, which cannot be sent again`);
91
+ if (next.origin !== url.origin)
92
+ for (const name of CREDENTIAL_HEADERS)
93
+ headers.delete(name);
94
+ url = next;
95
+ response = await send(url, { ...init, method, headers, body, signal, redirect: "manual" });
96
+ }
97
+ return released(response, timeout.clear);
98
+ } catch (error) {
99
+ timeout.clear();
100
+ if (isCliError(error))
101
+ throw error;
102
+ if (caller?.aborted)
103
+ throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
104
+ if (timeout.signal.aborted)
105
+ throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
106
+ throw new CliError("network_error", `${url.hostname} could not be reached`, { retryable: true });
107
+ }
108
+ };
109
+ }, "hostFetch");
110
+
111
+ // node_modules/.pnpm/@wirecat+cli-base@0.95.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
112
+ var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
113
+ if (!header)
114
+ return void 0;
115
+ const trimmed = header.trim();
116
+ if (/^\d+$/.test(trimmed))
117
+ return Number(trimmed) * 1e3;
118
+ const at = Date.parse(trimmed);
119
+ if (Number.isNaN(at))
120
+ return void 0;
121
+ const delta = at - now().getTime();
122
+ return delta > 0 ? delta : void 0;
123
+ }, "parseRetryAfter");
124
+ var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
125
+ if (!header)
126
+ return void 0;
127
+ const seconds = Number(header.trim());
128
+ if (!Number.isFinite(seconds))
129
+ return void 0;
130
+ const delta = seconds * 1e3 - now().getTime();
131
+ return delta > 0 ? delta : void 0;
132
+ }, "parseRateLimitReset");
133
+ var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
134
+
135
+ export {
136
+ hostFetch,
137
+ providerWaitMs
138
+ };
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
8
8
  var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
9
9
  const all = typeof profile !== "string";
10
10
  const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");
@@ -3,26 +3,26 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  executableEnvironment,
5
5
  executableOnPath
6
- } from "./chunk-L62FWN3Y.js";
6
+ } from "./chunk-OYKQX4H3.js";
7
7
  import {
8
8
  require_cross_spawn
9
9
  } from "./chunk-D72URWJE.js";
10
10
  import {
11
11
  loadConfigFile,
12
12
  saveConfigFile
13
- } from "./chunk-UUBV5ATQ.js";
13
+ } from "./chunk-W46O6RJ5.js";
14
14
  import {
15
15
  number,
16
16
  object,
17
17
  optional,
18
18
  string
19
- } from "./chunk-HE2F4JII.js";
19
+ } from "./chunk-VYCLOFPC.js";
20
20
  import {
21
21
  __name,
22
22
  __toESM
23
23
  } from "./chunk-ZVVMGPBJ.js";
24
24
 
25
- // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/update/index.js
25
+ // node_modules/.pnpm/@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/update/index.js
26
26
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
27
27
  import { existsSync } from "node:fs";
28
28
  var updateCommand = /* @__PURE__ */ __name((installer, packageName) => {
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-ZTONSM5X.js";
5
+ } from "./chunk-2EZFUIL4.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/ports/app.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/ports/app.js
11
11
  var envName = /* @__PURE__ */ __name((app, name) => `${app.envPrefix}_${name}`, "envName");
12
12
  var readOnlyLockOf = /* @__PURE__ */ __name((app, env) => {
13
13
  const name = envName(app, "READ_ONLY");
@@ -5,12 +5,12 @@ import {
5
5
  } from "./chunk-Y5E2WNWB.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-ZTONSM5X.js";
8
+ } from "./chunk-2EZFUIL4.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
14
14
  import { readFileSync } from "node:fs";
15
15
  var musl = /* @__PURE__ */ __name(() => {
16
16
  if (process.platform !== "linux")
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  resolvePaths
5
- } from "./chunk-UUBV5ATQ.js";
5
+ } from "./chunk-W46O6RJ5.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/store/path.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/store/path.js
11
11
  import { userInfo } from "node:os";
12
12
  import { isAbsolute, join, relative, resolve } from "node:path";
13
13
  var wirecatDirectory = /* @__PURE__ */ __name((env = process.env, platform) => resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env, ...platform ? { platform } : {} }).state, "wirecatDirectory");
@@ -5,15 +5,15 @@ import {
5
5
  readLock,
6
6
  releaseLock,
7
7
  takeLock
8
- } from "./chunk-IDCYBSML.js";
8
+ } from "./chunk-ZL63GL3Y.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
14
14
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
17
17
  import { randomBytes } from "node:crypto";
18
18
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
19
19
  import { dirname } from "node:path";
@@ -86,7 +86,7 @@ var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
86
86
  };
87
87
  }, "activityRecorder");
88
88
 
89
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
89
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
90
90
  var ACCESS_SECONDS = 60 * 60;
91
91
  var REFRESH_SECONDS = 30 * 24 * 60 * 60;
92
92
  var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-ZTONSM5X.js";
5
+ } from "./chunk-2EZFUIL4.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/search/languages.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/search/languages.js
11
11
  var LANGUAGES = [
12
12
  { name: "russian", code: "ru", label: "Russian", script: "cyrillic", dictionary: "dictionary-ru" },
13
13
  { name: "english", code: "en", label: "English", script: "latin", dictionary: "dictionary-en" },
@@ -15,12 +15,12 @@ var LANGUAGES = [
15
15
  ];
16
16
  var languagesOf = /* @__PURE__ */ __name((script) => LANGUAGES.filter((one) => one.script === script).map(({ name }) => name), "languagesOf");
17
17
 
18
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/store/normalize.js
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/store/normalize.js
19
19
  var NORMALIZER_VERSION = 1;
20
20
  var fold = /* @__PURE__ */ __name((text) => text.normalize("NFKD").replace(new RegExp("\\p{M}+", "gu"), "").normalize("NFC").toLowerCase(), "fold");
21
21
  var normalize = /* @__PURE__ */ __name((text) => fold(text).replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/gu, " ").trim(), "normalize");
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/search/snowball/base-stemmer.js
24
24
  var BaseStemmer = class {
25
25
  static {
26
26
  __name(this, "BaseStemmer");
@@ -395,7 +395,7 @@ var BaseStemmer = class {
395
395
  }
396
396
  };
397
397
 
398
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
398
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/search/snowball/english-stemmer.js
399
399
  var a_0 = [
400
400
  ["arsen", -1],
401
401
  ["commun", -1],
@@ -1096,7 +1096,7 @@ var english_stemmer_default = class extends BaseStemmer {
1096
1096
  stemWord = this.stem;
1097
1097
  };
1098
1098
 
1099
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1099
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/search/snowball/russian-stemmer.js
1100
1100
  var a_02 = [
1101
1101
  ["\u0432", 1],
1102
1102
  ["\u0438\u0432", 2, 1],
@@ -1519,7 +1519,7 @@ var russian_stemmer_default = class extends BaseStemmer {
1519
1519
  stemWord = this.stem;
1520
1520
  };
1521
1521
 
1522
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1522
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/search/snowball/spanish-stemmer.js
1523
1523
  var a_03 = [
1524
1524
  ["", 6],
1525
1525
  ["\xE1", 1, 1],
@@ -2195,7 +2195,7 @@ var spanish_stemmer_default = class extends BaseStemmer {
2195
2195
  stemWord = this.stem;
2196
2196
  };
2197
2197
 
2198
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/search/stem.js
2198
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/search/stem.js
2199
2199
  var SNOWBALL_VERSION = "3.1.1";
2200
2200
  var CYRILLIC_STEMMERS = [...languagesOf("cyrillic"), "none"];
2201
2201
  var LATIN_STEMMERS = [...languagesOf("latin"), "none"];
@@ -5,15 +5,15 @@ import {
5
5
  } from "./chunk-Y5E2WNWB.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-ZTONSM5X.js";
8
+ } from "./chunk-2EZFUIL4.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/speech/recognize.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/speech/recognize.js
14
14
  import { createRequire } from "node:module";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
17
17
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
18
18
  var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
19
19
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
@@ -70,7 +70,7 @@ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
70
70
  throw invalid();
71
71
  }, "checkOggDuration");
72
72
 
73
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/speech/recognize.js
73
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/speech/recognize.js
74
74
  var SAMPLE_RATE = 16e3;
75
75
  var LEAD = SAMPLE_RATE / 2;
76
76
  var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/installer.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/installer.js
8
8
  var installerOf = /* @__PURE__ */ __name((scriptPath) => {
9
9
  const path = scriptPath.replaceAll("\\", "/");
10
10
  if (path.includes("/_npx/"))
@@ -0,0 +1,177 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ ensureSqlite,
5
+ isCommandServer
6
+ } from "./chunk-QYJJBE56.js";
7
+ import {
8
+ envName,
9
+ readOnlyLockOf
10
+ } from "./chunk-KUFOM3SB.js";
11
+ import {
12
+ catchCrashes
13
+ } from "./chunk-VYCLOFPC.js";
14
+ import {
15
+ CliError
16
+ } from "./chunk-2EZFUIL4.js";
17
+ import {
18
+ __name
19
+ } from "./chunk-ZVVMGPBJ.js";
20
+
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/cli/entry.js
22
+ import { spawn } from "node:child_process";
23
+
24
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/cli/argv-log.js
25
+ import { appendFileSync } from "node:fs";
26
+ var logVersion = /* @__PURE__ */ __name((file) => {
27
+ appendFileSync(file, `${JSON.stringify({ command: "", options: ["--version"] })}
28
+ `);
29
+ }, "logVersion");
30
+
31
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/cli/entry.js
32
+ var processIo = /* @__PURE__ */ __name(() => ({
33
+ argv: process.argv,
34
+ env: process.env,
35
+ platform: process.platform,
36
+ stdin: process.stdin,
37
+ stdout: process.stdout,
38
+ stderr: process.stderr,
39
+ signals: process,
40
+ setExitCode: /* @__PURE__ */ __name((code) => {
41
+ process.exitCode = code;
42
+ }, "setExitCode"),
43
+ spawn
44
+ }), "processIo");
45
+ var startCli = /* @__PURE__ */ __name(async (entry) => {
46
+ const io = { ...processIo(), ...entry.io };
47
+ const args = io.argv.slice(2);
48
+ if (args.length === 1 && (args[0] === "--version" || args[0] === "-V"))
49
+ return printVersion(entry.app, io);
50
+ if (isCommandServer(args)) {
51
+ const { serveEntry } = await import("./command-server-entry-XVUPTSSH.js");
52
+ return serveEntry(entry, io, { firstRunAt, commanderExit });
53
+ }
54
+ const tty = io.stdout.isTTY === true;
55
+ const release = catchCrashes({
56
+ cli: entry.app.command,
57
+ interactive: entry.interactive?.(args, tty) ?? tty,
58
+ ...entry.reasons ? { reasons: entry.reasons } : {},
59
+ target: io.signals
60
+ });
61
+ const controller = new AbortController();
62
+ let closed = false;
63
+ let unwritable = false;
64
+ const interrupted = /* @__PURE__ */ __name((signal) => () => controller.abort(new CliError("cancelled", `command interrupted by ${signal}`, { reason: signal, retryable: false })), "interrupted");
65
+ const sigint = interrupted("SIGINT");
66
+ const sigterm = interrupted("SIGTERM");
67
+ const outputFailed = /* @__PURE__ */ __name((error) => {
68
+ if (error.code === "EPIPE") {
69
+ closed = true;
70
+ controller.abort(new CliError("cancelled", "output pipe closed", { retryable: false }));
71
+ } else {
72
+ unwritable = true;
73
+ controller.abort(new CliError("configuration_error", "could not write command output"));
74
+ }
75
+ }, "outputFailed");
76
+ const headless = /* @__PURE__ */ __name((command) => {
77
+ const flags = command?.optsWithGlobals() ?? {};
78
+ return Boolean(flags.json || flags.jsonl || flags.input === false || io.env.CI) || !tty;
79
+ }, "headless");
80
+ const context = {
81
+ args,
82
+ env: io.env,
83
+ tty,
84
+ signal: controller.signal,
85
+ atStart: firstRunAt(entry, io, headless),
86
+ ask: /* @__PURE__ */ __name(async (question, command) => {
87
+ if (headless(command) || io.stdin.isTTY !== true)
88
+ return false;
89
+ const { readSecret } = await import("./prompt-BMBZCLGF.js");
90
+ const answer = await readSecret(`${question} [y/N] `, {
91
+ input: io.stdin,
92
+ output: io.stderr,
93
+ echo: true,
94
+ signal: controller.signal
95
+ });
96
+ return /^(y|yes)$/i.test(answer.trim());
97
+ }, "ask"),
98
+ openBrowser: /* @__PURE__ */ __name(async (url, browser, command) => {
99
+ if (!headless(command))
100
+ await openBrowser(url, browser, io);
101
+ }, "openBrowser"),
102
+ outputClosed: /* @__PURE__ */ __name(() => closed, "outputClosed")
103
+ };
104
+ let code;
105
+ try {
106
+ if (entry.sqlite)
107
+ await ensureSqlite();
108
+ io.signals.on("SIGINT", sigint).on("SIGTERM", sigterm);
109
+ io.stdout.on("error", outputFailed);
110
+ io.stderr.on("error", outputFailed);
111
+ const returned = await entry.run(context);
112
+ if (typeof returned === "number")
113
+ code = returned;
114
+ } catch (error) {
115
+ code = commanderExit(error) ?? entry.fail(error, context);
116
+ } finally {
117
+ io.signals.off("SIGINT", sigint).off("SIGTERM", sigterm);
118
+ release();
119
+ }
120
+ if (closed)
121
+ io.setExitCode(0);
122
+ else if (unwritable)
123
+ io.setExitCode(3);
124
+ else if (code !== void 0)
125
+ io.setExitCode(code);
126
+ }, "startCli");
127
+ var firstRunAt = /* @__PURE__ */ __name((entry, io, headless) => async (command) => {
128
+ if (command.optsWithGlobals().dryRun === true)
129
+ return;
130
+ const [{ setupAtStart }, { commandPathOf }] = await Promise.all([
131
+ import("./first-run-HQ4GA4EF.js"),
132
+ import("./command-contract-QQG343ZQ.js")
133
+ ]);
134
+ await setupAtStart({
135
+ command: entry.app.command,
136
+ env: io.env,
137
+ contentLanguages: entry.app.contentLanguages,
138
+ path: commandPathOf(command),
139
+ headless: headless(command),
140
+ readOnlyLock: readOnlyLockOf(entry.app, io.env),
141
+ input: io.stdin
142
+ });
143
+ }, "firstRunAt");
144
+ var printVersion = /* @__PURE__ */ __name((app, io) => {
145
+ const argvLog = io.env[envName(app, "TEST_ARGV_LOG")];
146
+ if (argvLog)
147
+ logVersion(argvLog);
148
+ io.stdout.write(`${app.version}
149
+ `);
150
+ }, "printVersion");
151
+ var commanderExit = /* @__PURE__ */ __name((error) => {
152
+ if (!(error instanceof Error))
153
+ return void 0;
154
+ const { code, exitCode } = error;
155
+ if (typeof code !== "string" || !code.startsWith("commander.") || typeof exitCode !== "number")
156
+ return void 0;
157
+ if (exitCode === 0)
158
+ return 0;
159
+ return code === "commander.help" ? 2 : void 0;
160
+ }, "commanderExit");
161
+ var openBrowser = /* @__PURE__ */ __name((url, browser, io = { platform: process.platform, spawn }) => {
162
+ const [command, prefix] = browser !== void 0 ? [browser, []] : io.platform === "darwin" ? ["open", []] : io.platform === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler"]] : ["xdg-open", []];
163
+ return new Promise((resolve, reject) => {
164
+ const child = io.spawn(command, [...prefix, url], { detached: true, stdio: "ignore", windowsHide: true });
165
+ child.once("error", () => reject(new CliError("configuration_error", `could not start ${command} \u2014 open the printed URL in a browser`)));
166
+ child.once("spawn", () => {
167
+ child.unref();
168
+ resolve();
169
+ });
170
+ });
171
+ }, "openBrowser");
172
+
173
+ export {
174
+ startCli,
175
+ firstRunAt,
176
+ openBrowser
177
+ };
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
8
8
  import { existsSync } from "node:fs";
9
9
  import { win32 } from "node:path";
10
10
  var variable = /* @__PURE__ */ __name((env, name) => Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1], "variable");
@@ -1,19 +1,19 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
- import {
4
- OAuthError,
5
- OAuthErrorCode
6
- } from "./chunk-H3ZN4YLB.js";
7
3
  import {
8
4
  ACCESS_SECONDS,
9
5
  REFRESH_SECONDS,
10
6
  readStored
11
- } from "./chunk-6ZRBQTKZ.js";
7
+ } from "./chunk-LX3OSTBD.js";
8
+ import {
9
+ OAuthError,
10
+ OAuthErrorCode
11
+ } from "./chunk-H3ZN4YLB.js";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-ZVVMGPBJ.js";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.91.0_commander@15.0.0_esbuild@0.28.2_type_5a9525690cd264264c4a3180795dd7f6/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
17
17
  import { createHash, randomBytes, randomInt, timingSafeEqual } from "node:crypto";
18
18
  import { chmodSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
19
19
  import { dirname } from "node:path";