@wirecat/attio-cli 0.9.0 → 0.11.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 +23 -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-OFEXB726.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-4R7RYWV3.js +6210 -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 +12 -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,338 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- throughWrapper
5
- } from "./chunk-R2CEA7MK.js";
6
- import {
7
- environmentOf,
8
- readOnlyLockOf
9
- } from "./chunk-J2LSOG3A.js";
10
- import {
11
- array,
12
- boolean,
13
- check,
14
- pipe,
15
- record,
16
- safeParse,
17
- strictObject,
18
- string
19
- } from "./chunk-S4UUN6LD.js";
20
- import {
21
- CliError
22
- } from "./chunk-S6JG4YUH.js";
23
- import {
24
- __name
25
- } from "./chunk-ZVVMGPBJ.js";
26
-
27
- // 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/background/relay.js
28
- import { createHash } from "node:crypto";
29
- import { chmodSync, lstatSync, mkdirSync, rmSync } from "node:fs";
30
- import { createConnection, createServer } from "node:net";
31
- import { tmpdir } from "node:os";
32
- import { dirname, isAbsolute, join } from "node:path";
33
- import { PassThrough, Writable } from "node:stream";
34
- var RELAY_PROTOCOL = 1;
35
- var requestSchema = strictObject({
36
- argv: array(string()),
37
- env: record(string(), string()),
38
- cwd: pipe(string(), check((path) => isAbsolute(path))),
39
- tty: boolean(),
40
- stdinTty: boolean()
41
- });
42
- var MAX_CLIENT_LINE = 1024 * 1024;
43
- var MAX_SERVE_LINE = 64 * 1024 * 1024;
44
- var MAX_SOCKET_PATH = 100;
45
- var relayPath = /* @__PURE__ */ __name((lockPath) => {
46
- const beside = lockPath.replace(/\.lock$/, ".sock");
47
- if (beside.length <= MAX_SOCKET_PATH)
48
- return beside;
49
- const hash = createHash("sha256").update(beside).digest("hex").slice(0, 16);
50
- const name = join(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash}.sock`);
51
- const temporary = join(tmpdir(), name);
52
- if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
53
- return temporary;
54
- return join("/tmp", name);
55
- }, "relayPath");
56
- var privateDirectory = /* @__PURE__ */ __name((dir) => {
57
- mkdirSync(dir, { recursive: true, mode: 448 });
58
- const stat = lstatSync(dir);
59
- const mine = process.getuid === void 0 || stat.uid === process.getuid();
60
- if (!stat.isDirectory() || !mine || (stat.mode & 63) !== 0) {
61
- throw new CliError("permission_error", `${dir} is not a private directory, so serve does not listen there`);
62
- }
63
- }, "privateDirectory");
64
- var lines = /* @__PURE__ */ __name((socket, max, onLine, onTooLong) => {
65
- let buffered = "";
66
- socket.setEncoding("utf8");
67
- socket.on("data", (chunk) => {
68
- buffered += chunk;
69
- for (let end = buffered.indexOf("\n"); end >= 0; end = buffered.indexOf("\n")) {
70
- const line = buffered.slice(0, end);
71
- buffered = buffered.slice(end + 1);
72
- if (line)
73
- onLine(line);
74
- }
75
- if (buffered.length > max)
76
- onTooLong();
77
- });
78
- }, "lines");
79
- var frame = /* @__PURE__ */ __name((socket, value) => {
80
- if (!socket.destroyed)
81
- socket.write(`${JSON.stringify(value)}
82
- `);
83
- }, "frame");
84
- var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
85
- privateDirectory(dirname(path));
86
- rmSync(path, { force: true });
87
- const open = /* @__PURE__ */ new Set();
88
- const running = /* @__PURE__ */ new Set();
89
- const server = createServer((socket) => {
90
- open.add(socket);
91
- const stop = new AbortController();
92
- const stdin = new PassThrough();
93
- let started = false;
94
- socket.on("error", () => {
95
- });
96
- socket.on("close", () => {
97
- open.delete(socket);
98
- stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
99
- if (!stdin.writableEnded)
100
- stdin.end();
101
- });
102
- lines(socket, MAX_CLIENT_LINE, (line) => {
103
- let message;
104
- try {
105
- message = JSON.parse(line);
106
- } catch {
107
- socket.destroy();
108
- return;
109
- }
110
- if (!started) {
111
- started = true;
112
- if (message.v !== RELAY_PROTOCOL) {
113
- frame(socket, { diagnostic: `serve speaks relay protocol ${RELAY_PROTOCOL}; restart it`, exit: 1 });
114
- socket.end();
115
- return;
116
- }
117
- const parsed = safeParse(requestSchema, message.run);
118
- if (!parsed.success) {
119
- socket.destroy();
120
- return;
121
- }
122
- stdin.isTTY = parsed.output.stdinTty;
123
- if (parsed.output.stdinTty)
124
- stdin.end();
125
- const job = serve(socket, parsed.output, stdin, stop.signal, run);
126
- running.add(job);
127
- void job.then(() => running.delete(job), () => running.delete(job));
128
- return;
129
- }
130
- if (typeof message.stdin === "string" && !stdin.writableEnded)
131
- stdin.write(Buffer.from(message.stdin, "base64"));
132
- if (message.stdinEnd === true && !stdin.writableEnded)
133
- stdin.end();
134
- }, () => socket.destroy());
135
- });
136
- await new Promise((resolve, reject) => {
137
- server.once("error", reject);
138
- server.listen(path, () => {
139
- server.off("error", reject);
140
- resolve();
141
- });
142
- });
143
- chmodSync(path, 384);
144
- return {
145
- close: /* @__PURE__ */ __name(async () => {
146
- for (const socket of open)
147
- socket.destroy();
148
- await new Promise((resolve) => server.close(() => resolve()));
149
- await Promise.allSettled(running);
150
- rmSync(path, { force: true });
151
- }, "close")
152
- };
153
- }, "listenRelay");
154
- var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run) => {
155
- const streams = {
156
- data: /* @__PURE__ */ __name((text) => frame(socket, { data: text }), "data"),
157
- diagnostic: /* @__PURE__ */ __name((text) => frame(socket, { diagnostic: text }), "diagnostic"),
158
- progress: /* @__PURE__ */ __name((text) => frame(socket, { progress: text }), "progress")
159
- };
160
- const stdout = new Writable({
161
- write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
162
- frame(socket, { raw: Buffer.from(chunk).toString("base64") });
163
- done();
164
- }, "write")
165
- });
166
- let code = 1;
167
- try {
168
- code = await run(request, { streams, stdin, stdout, signal });
169
- } finally {
170
- frame(socket, { exit: code });
171
- socket.end();
172
- }
173
- }, "serve");
174
- var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promise((resolve, reject) => {
175
- const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options;
176
- const socket = createConnection(path);
177
- let connected = false;
178
- let settled = false;
179
- let timer;
180
- const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
181
- const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
182
- const brokenPipe = /* @__PURE__ */ __name((error) => {
183
- if (error.code === "EPIPE")
184
- finish({ code: 0 });
185
- }, "brokenPipe");
186
- const finish = /* @__PURE__ */ __name((outcome) => {
187
- if (settled)
188
- return;
189
- settled = true;
190
- if (timer)
191
- clearTimeout(timer);
192
- stdout.off("error", brokenPipe);
193
- signal.removeEventListener("abort", aborted);
194
- stdin.off("data", forward).off("end", ended);
195
- stdin.pause();
196
- socket.destroy();
197
- if ("code" in outcome)
198
- resolve(outcome.code);
199
- else
200
- reject(outcome.error);
201
- }, "finish");
202
- const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
203
- const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
204
- if (signal.aborted)
205
- return aborted();
206
- signal.addEventListener("abort", aborted, { once: true });
207
- stdout.on("error", brokenPipe);
208
- if (deadlineMs !== void 0)
209
- timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
210
- socket.on("connect", () => {
211
- connected = true;
212
- frame(socket, { v: RELAY_PROTOCOL, run: request });
213
- if (request.stdinTty)
214
- ended();
215
- else {
216
- stdin.on("data", forward).once("end", ended);
217
- stdin.resume();
218
- }
219
- });
220
- socket.on("error", (error) => {
221
- if (connected)
222
- return finish({ error: stopped() });
223
- finish({
224
- error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
225
- });
226
- });
227
- socket.on("close", () => finish({ error: stopped() }));
228
- lines(socket, MAX_SERVE_LINE, (line) => {
229
- let message;
230
- try {
231
- message = JSON.parse(line);
232
- } catch {
233
- return finish({ error: stopped() });
234
- }
235
- if (typeof message.data === "string")
236
- streams.data(message.data);
237
- if (typeof message.diagnostic === "string")
238
- streams.diagnostic(message.diagnostic);
239
- if (typeof message.progress === "string")
240
- streams.progress?.(message.progress);
241
- if (typeof message.raw === "string")
242
- stdout.write(Buffer.from(message.raw, "base64"));
243
- if (typeof message.exit === "number")
244
- finish({ code: message.exit });
245
- }, () => finish({ error: stopped() }));
246
- }), "relayCommand");
247
-
248
- // 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/messenger/serve-relay.js
249
- var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
250
- close: /* @__PURE__ */ __name(async () => {
251
- }, "close"),
252
- feed: void 0,
253
- storedChats: void 0,
254
- listen: void 0,
255
- listenHistory: void 0,
256
- ...connection.watch && watchers ? {
257
- // A watcher that throws (its output limit, a closed reader) ends its own watch, never serve's.
258
- watch: /* @__PURE__ */ __name(async (onEvent, signal, onReady) => {
259
- let watcher;
260
- try {
261
- await new Promise((resolve, reject) => {
262
- watcher = /* @__PURE__ */ __name((event) => {
263
- try {
264
- onEvent(event);
265
- } catch (error) {
266
- reject(error);
267
- }
268
- }, "watcher");
269
- watchers.add(watcher);
270
- signal.addEventListener("abort", () => resolve(), { once: true });
271
- onReady?.();
272
- if (signal.aborted)
273
- resolve();
274
- });
275
- } finally {
276
- if (watcher)
277
- watchers.delete(watcher);
278
- }
279
- }, "watch")
280
- } : { watch: void 0 }
281
- }), "lentConnection");
282
- var serveRelay = /* @__PURE__ */ __name((command, messenger) => {
283
- let held;
284
- let relay;
285
- const watchers = /* @__PURE__ */ new Set();
286
- const borrowed = /* @__PURE__ */ __name(() => {
287
- const connection = held;
288
- if (!connection)
289
- throw new CliError("provider_unavailable", "serve is not connected yet", { retryable: true });
290
- return lentConnection(connection, watchers);
291
- }, "borrowed");
292
- return {
293
- messenger: {
294
- ...messenger,
295
- connect: /* @__PURE__ */ __name(async (...args) => {
296
- held = await messenger.connect(...args);
297
- return held;
298
- }, "connect")
299
- },
300
- arrived: /* @__PURE__ */ __name((event) => {
301
- for (const watcher of watchers)
302
- watcher(event);
303
- }, "arrived"),
304
- /** Listens beside the lock; the address goes into it, which is how a client finds it. */
305
- open: /* @__PURE__ */ __name(async (lockPath, profile) => {
306
- const environment = environmentOf(command);
307
- const runCommand = environment.runCommand;
308
- if (!runCommand)
309
- return void 0;
310
- const readOnly = readOnlyLockOf(messenger.app, environment.env ?? process.env);
311
- const path = relayPath(lockPath);
312
- relay = await listenRelay(path, (request, io) => runCommand(request.argv, {
313
- env: {
314
- ...request.env,
315
- ...readOnly ? { [`${messenger.app.envPrefix}_READ_ONLY`]: "1" } : {}
316
- },
317
- streams: io.streams,
318
- stdin: io.stdin,
319
- stdout: io.stdout,
320
- tty: request.tty,
321
- signal: io.signal,
322
- answer: /* @__PURE__ */ __name(() => null, "answer"),
323
- relayed: { profile, cwd: request.cwd, connection: borrowed }
324
- }));
325
- return { path, protocol: RELAY_PROTOCOL };
326
- }, "open"),
327
- close: /* @__PURE__ */ __name(async () => {
328
- await relay?.close();
329
- }, "close")
330
- };
331
- }, "serveRelay");
332
-
333
- export {
334
- RELAY_PROTOCOL,
335
- relayCommand,
336
- lentConnection,
337
- serveRelay
338
- };
@@ -1,95 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- PRAGMAS
5
- } from "./chunk-KYRYD4CR.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/store/sqlite-warning.js
14
- var SQLITE_WARNING = "SQLite is an experimental feature";
15
- var quieted = /* @__PURE__ */ new WeakSet();
16
- var quietSqliteWarning = /* @__PURE__ */ __name((host = process) => {
17
- if (quieted.has(host))
18
- return;
19
- quieted.add(host);
20
- const emit = host.emitWarning;
21
- host.emitWarning = function(warning, ...rest) {
22
- if (isSqliteWarning(warning, rest[0]))
23
- return;
24
- return Reflect.apply(emit, this, [warning, ...rest]);
25
- };
26
- }, "quietSqliteWarning");
27
- var isSqliteWarning = /* @__PURE__ */ __name((warning, options) => {
28
- const type = typeof options === "string" ? options : options?.type;
29
- const name = typeof warning === "string" ? type : warning.name;
30
- const message = typeof warning === "string" ? warning : warning.message;
31
- return name === "ExperimentalWarning" && message.startsWith(SQLITE_WARNING);
32
- }, "isSqliteWarning");
33
-
34
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/store/open.js
35
- var openCache = /* @__PURE__ */ __name(async (path) => {
36
- const database = await openFile(path);
37
- try {
38
- database.exec(PRAGMAS);
39
- } catch (error) {
40
- database.close();
41
- throw error;
42
- }
43
- return database;
44
- }, "openCache");
45
- var openFile = /* @__PURE__ */ __name((path) => "Bun" in globalThis ? openUnderBun(path) : openUnderNode(path), "openFile");
46
- var openUnderBun = /* @__PURE__ */ __name(async (path) => {
47
- const { openWithBunSqlite } = await import("./bun-sqlite-33JTNHCK.js");
48
- return await openWithBunSqlite(path);
49
- }, "openUnderBun");
50
- var openUnderNode = /* @__PURE__ */ __name(async (path) => {
51
- quietSqliteWarning();
52
- const { openWithNodeSqlite } = await import("./node-sqlite-UHPODTKB.js");
53
- return openWithNodeSqlite(path);
54
- }, "openUnderNode");
55
- var runtime = /* @__PURE__ */ __name(() => {
56
- const bun = globalThis.Bun;
57
- return bun ? `Bun ${bun.version}` : `Node ${process.versions.node}`;
58
- }, "runtime");
59
- var CAPABILITY_STATEMENTS = [
60
- `CREATE VIRTUAL TABLE temp.capability_words USING fts5(a, content = '', contentless_delete = 1,
61
- tokenize = 'unicode61 remove_diacritics 2')`,
62
- "CREATE VIRTUAL TABLE temp.capability_text USING fts5(a, tokenize = 'trigram')",
63
- "DROP TABLE temp.capability_words",
64
- "DROP TABLE temp.capability_text"
65
- ];
66
- var assertStoreCapable = /* @__PURE__ */ __name((database, on = runtime()) => {
67
- try {
68
- for (const statement of CAPABILITY_STATEMENTS)
69
- database.exec(statement);
70
- } catch (error) {
71
- const version = String(database.prepare("SELECT sqlite_version() AS version").get()?.version);
72
- const remedy = on.startsWith("Bun") ? "Run it under Node 22.16 or newer instead" : "Update Node to 22.16 or newer, or run it under Bun";
73
- throw new CliError("configuration_error", `the message store needs full-text search that this SQLite (${version}, ${on}) does not have. ${remedy}.`, { sqlite: version, runtime: on, cause: error instanceof Error ? error.message : String(error) });
74
- }
75
- }, "assertStoreCapable");
76
- var capable;
77
- var storeCapable = /* @__PURE__ */ __name(() => {
78
- capable ??= openCache(":memory:").then((database) => {
79
- try {
80
- assertStoreCapable(database);
81
- } finally {
82
- database.close();
83
- }
84
- });
85
- return capable;
86
- }, "storeCapable");
87
-
88
- export {
89
- quietSqliteWarning,
90
- openCache,
91
- openFile,
92
- CAPABILITY_STATEMENTS,
93
- assertStoreCapable,
94
- storeCapable
95
- };
@@ -1,142 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- executableEnvironment,
5
- executableOnPath
6
- } from "./chunk-TY7NDMFY.js";
7
- import {
8
- require_cross_spawn
9
- } from "./chunk-D72URWJE.js";
10
- import {
11
- loadConfigFile,
12
- saveConfigFile
13
- } from "./chunk-UXDUWGX6.js";
14
- import {
15
- number,
16
- object,
17
- optional,
18
- string
19
- } from "./chunk-S4UUN6LD.js";
20
- import {
21
- __name,
22
- __toESM
23
- } from "./chunk-ZVVMGPBJ.js";
24
-
25
- // 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/update/index.js
26
- var import_cross_spawn = __toESM(require_cross_spawn(), 1);
27
- import { existsSync } from "node:fs";
28
- var updateCommand = /* @__PURE__ */ __name((installer, packageName) => {
29
- const target = `${packageName}@latest`;
30
- switch (installer) {
31
- // pnpm 11 installs only versions a day old (minimumReleaseAge 1440); a fix must reach users the day it ships.
32
- // Only the package's own scope is exempt — every other dependency keeps the wait.
33
- case "pnpm":
34
- return ["pnpm", "add", "-g", target, `--config.minimumReleaseAgeExclude=${ownScope(packageName)}`];
35
- case "npm":
36
- return ["npm", "install", "-g", target];
37
- case "bun":
38
- return ["bun", "add", "-g", target];
39
- default:
40
- return void 0;
41
- }
42
- }, "updateCommand");
43
- var ownScope = /* @__PURE__ */ __name((packageName) => packageName.startsWith("@") ? `${packageName.split("/", 1)[0]}/*` : packageName, "ownScope");
44
- var isNewer = /* @__PURE__ */ __name((candidate, current) => {
45
- const parse = /* @__PURE__ */ __name((version) => /^\d+\.\d+\.\d+$/.test(version) ? version.split(".").map(Number) : void 0, "parse");
46
- const a = parse(candidate);
47
- const b = parse(current);
48
- if (!a || !b)
49
- return false;
50
- for (let i = 0; i < 3; i++) {
51
- if (a[i] !== b[i])
52
- return a[i] > b[i];
53
- }
54
- return false;
55
- }, "isNewer");
56
- var latestVersion = /* @__PURE__ */ __name(async (packageName, fetch, { timeoutMs = 1e3 } = {}) => {
57
- try {
58
- const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
59
- signal: AbortSignal.timeout(timeoutMs),
60
- headers: { accept: "application/json" }
61
- });
62
- if (!response.ok)
63
- return void 0;
64
- const { version } = await response.json();
65
- return typeof version === "string" ? version : void 0;
66
- } catch {
67
- return void 0;
68
- }
69
- }, "latestVersion");
70
- var CHECK_EVERY_MS = 24 * 60 * 60 * 1e3;
71
- var mayNotify = /* @__PURE__ */ __name(({ format, stderrIsTTY, quiet, enabled, installer, env, offVariables = [] }) => enabled && format === "pretty" && stderrIsTTY && !quiet && updateCommand(installer, "any") !== void 0 && !env.CI && !env.NO_UPDATE_NOTIFIER && offVariables.every((name) => !env[name]), "mayNotify");
72
- var updateState = object({
73
- checkedAt: number(),
74
- latest: optional(string()),
75
- /** When the skill hint (`cli-base/skill`) was last shown — the other daily notice kept in this file. */
76
- skillHintAt: optional(number())
77
- });
78
- var readNoticeState = /* @__PURE__ */ __name((path) => {
79
- try {
80
- return loadConfigFile(path, updateState, () => ({ checkedAt: 0 }));
81
- } catch {
82
- return { checkedAt: 0 };
83
- }
84
- }, "readNoticeState");
85
- var readUpdateState = /* @__PURE__ */ __name((path) => {
86
- const state = readNoticeState(path);
87
- return state.checkedAt > 0 ? state : void 0;
88
- }, "readUpdateState");
89
- var writeUpdateState = /* @__PURE__ */ __name((path, state) => {
90
- try {
91
- saveConfigFile(path, { ...readNoticeState(path), ...state });
92
- } catch {
93
- }
94
- }, "writeUpdateState");
95
- var checkIsDue = /* @__PURE__ */ __name((state, now) => state === void 0 || now - state.checkedAt >= CHECK_EVERY_MS, "checkIsDue");
96
- var spawnPlan = /* @__PURE__ */ __name(([command, ...args], platform = process.platform, env = process.env, exists = existsSync) => ({ file: executableOnPath(command, env, platform, exists), args, shell: false }), "spawnPlan");
97
- var runUpdate = /* @__PURE__ */ __name((argv) => {
98
- const { file, args, shell } = spawnPlan(argv);
99
- const { status, error } = import_cross_spawn.default.sync(file, args, {
100
- stdio: ["inherit", 2, 2],
101
- shell,
102
- env: executableEnvironment(process.env)
103
- });
104
- if (error)
105
- throw new Error(`could not start ${argv[0]}: ${error.message}`);
106
- return status ?? 1;
107
- }, "runUpdate");
108
- var updateNotice = /* @__PURE__ */ __name(async ({ argv, packageName, command, upgradeCommand = "upgrade", version, statePath, fetch, now = Date.now, ...context }) => {
109
- try {
110
- const path = commandWords(argv).slice(0, 2);
111
- if (path.includes("complete") || path.includes(upgradeCommand))
112
- return void 0;
113
- if (!mayNotify(context))
114
- return void 0;
115
- const at = now();
116
- let state = readUpdateState(statePath);
117
- if (checkIsDue(state, at)) {
118
- const found = await latestVersion(packageName, fetch, { timeoutMs: 1e3 });
119
- const seen = found ?? state?.latest;
120
- state = seen ? { checkedAt: at, latest: seen } : { checkedAt: at };
121
- writeUpdateState(statePath, state);
122
- }
123
- return state?.latest && isNewer(state.latest, version) ? `${command} ${state.latest} is out \u2014 you have ${version}. \`${command} ${upgradeCommand}\` installs it.` : void 0;
124
- } catch {
125
- return void 0;
126
- }
127
- }, "updateNotice");
128
- var commandWords = /* @__PURE__ */ __name((argv) => {
129
- const end = argv.indexOf("--");
130
- return argv.slice(0, end < 0 ? void 0 : end).filter((word) => !word.startsWith("-"));
131
- }, "commandWords");
132
-
133
- export {
134
- updateCommand,
135
- isNewer,
136
- latestVersion,
137
- CHECK_EVERY_MS,
138
- readNoticeState,
139
- writeUpdateState,
140
- runUpdate,
141
- updateNotice
142
- };