@wirecat/amo-cli 0.5.0 → 0.7.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 (281) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -2
  3. package/contracts/wirecat.json +14 -0
  4. package/dist/amo/button.js +1 -1
  5. package/dist/amo/json.js +1 -1
  6. package/dist/amo/oauth.js +3 -5
  7. package/dist/amo/transport.js +3 -7
  8. package/dist/api-keys.js +1 -1
  9. package/dist/bin/amo.js +11 -11
  10. package/dist/bundle/amo.js +5 -183
  11. package/dist/bundle/{chunk-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
  12. package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
  13. package/dist/bundle/chunk-AEWYRB6F.js +8 -0
  14. package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
  15. package/dist/bundle/chunk-N2UB32VN.js +76 -0
  16. package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
  17. package/dist/bundle/program-SQH3SPOW.js +2352 -0
  18. package/dist/bundle/{instructions-AMH5RWVJ.js → source-C65ZJUTW.js} +5 -6
  19. package/dist/bundle/store-SJ2TOUGU.js +12 -0
  20. package/dist/bundle/writer-I7GBI3VE.js +12 -0
  21. package/dist/commands/account.js +1 -1
  22. package/dist/commands/api.js +1 -3
  23. package/dist/commands/crm-shared.js +2 -3
  24. package/dist/commands/schedule.js +1 -1
  25. package/dist/commands/session.js +1 -8
  26. package/dist/commands/write.js +1 -2
  27. package/dist/config.js +1 -2
  28. package/dist/context.js +1 -2
  29. package/dist/crm/activities.js +1 -1
  30. package/dist/crm/records.js +1 -1
  31. package/dist/crm/source.js +1 -1
  32. package/dist/crm/writer.js +1 -1
  33. package/dist/identity.js +4 -0
  34. package/dist/program.js +1 -2
  35. package/dist/setup/flow.js +1 -1
  36. package/dist/store.js +1 -1
  37. package/dist/version.js +1 -1
  38. package/dist/whoami.js +1 -1
  39. package/package.json +3 -3
  40. package/scenarios/first-sync.md +13 -11
  41. package/scenarios/keep-in-sync.md +7 -6
  42. package/scenarios/safe-agent-writes.md +10 -9
  43. package/dist/amo/account.d.ts +0 -18
  44. package/dist/amo/account.d.ts.map +0 -1
  45. package/dist/amo/account.js.map +0 -1
  46. package/dist/amo/allow-list.d.ts +0 -31
  47. package/dist/amo/allow-list.d.ts.map +0 -1
  48. package/dist/amo/allow-list.js.map +0 -1
  49. package/dist/amo/button.d.ts +0 -53
  50. package/dist/amo/button.d.ts.map +0 -1
  51. package/dist/amo/button.js.map +0 -1
  52. package/dist/amo/errors.d.ts +0 -12
  53. package/dist/amo/errors.d.ts.map +0 -1
  54. package/dist/amo/errors.js.map +0 -1
  55. package/dist/amo/json.d.ts +0 -3
  56. package/dist/amo/json.d.ts.map +0 -1
  57. package/dist/amo/json.js.map +0 -1
  58. package/dist/amo/oauth.d.ts +0 -64
  59. package/dist/amo/oauth.d.ts.map +0 -1
  60. package/dist/amo/oauth.js.map +0 -1
  61. package/dist/amo/operation.d.ts +0 -45
  62. package/dist/amo/operation.d.ts.map +0 -1
  63. package/dist/amo/operation.js.map +0 -1
  64. package/dist/amo/operations.d.ts +0 -3
  65. package/dist/amo/operations.d.ts.map +0 -1
  66. package/dist/amo/operations.js.map +0 -1
  67. package/dist/amo/routes.d.ts +0 -67
  68. package/dist/amo/routes.d.ts.map +0 -1
  69. package/dist/amo/routes.js.map +0 -1
  70. package/dist/amo/transport.d.ts +0 -62
  71. package/dist/amo/transport.d.ts.map +0 -1
  72. package/dist/amo/transport.js.map +0 -1
  73. package/dist/api-keys.d.ts +0 -47
  74. package/dist/api-keys.d.ts.map +0 -1
  75. package/dist/api-keys.js.map +0 -1
  76. package/dist/bin/amo.d.ts +0 -3
  77. package/dist/bin/amo.d.ts.map +0 -1
  78. package/dist/bin/amo.js.map +0 -1
  79. package/dist/bundle/agent-EFMUK732.js +0 -41
  80. package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
  81. package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
  82. package/dist/bundle/app-server-QRBQODF2.js +0 -257
  83. package/dist/bundle/areas-QVHVU57Z.js +0 -63
  84. package/dist/bundle/bun-OPDGMZZQ.js +0 -169
  85. package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
  86. package/dist/bundle/chunk-2JHVQMVC.js +0 -16
  87. package/dist/bundle/chunk-2XBDILVW.js +0 -53
  88. package/dist/bundle/chunk-3DEQUYEG.js +0 -185
  89. package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
  90. package/dist/bundle/chunk-3HC5F3P7.js +0 -24
  91. package/dist/bundle/chunk-3YM4B2GT.js +0 -63
  92. package/dist/bundle/chunk-43OW5NTG.js +0 -338
  93. package/dist/bundle/chunk-43PMSR33.js +0 -357
  94. package/dist/bundle/chunk-4N7PP76S.js +0 -6848
  95. package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
  96. package/dist/bundle/chunk-57HFPNMF.js +0 -189
  97. package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
  98. package/dist/bundle/chunk-633NQY2R.js +0 -80
  99. package/dist/bundle/chunk-63N46DJU.js +0 -12278
  100. package/dist/bundle/chunk-6D4VWSJD.js +0 -259
  101. package/dist/bundle/chunk-6JTHXWPE.js +0 -64
  102. package/dist/bundle/chunk-6QGUK3H7.js +0 -161
  103. package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
  104. package/dist/bundle/chunk-7IR2G5XY.js +0 -559
  105. package/dist/bundle/chunk-7IWIFVXH.js +0 -52
  106. package/dist/bundle/chunk-ABX7BBS4.js +0 -388
  107. package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
  108. package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
  109. package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
  110. package/dist/bundle/chunk-BIKOE2IW.js +0 -614
  111. package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
  112. package/dist/bundle/chunk-CGW5R4UD.js +0 -362
  113. package/dist/bundle/chunk-D4NE7EON.js +0 -170
  114. package/dist/bundle/chunk-D72URWJE.js +0 -532
  115. package/dist/bundle/chunk-DFDN6AUB.js +0 -21
  116. package/dist/bundle/chunk-DNCLQPOM.js +0 -7
  117. package/dist/bundle/chunk-DPV53EZC.js +0 -206
  118. package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
  119. package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
  120. package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
  121. package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
  122. package/dist/bundle/chunk-EHK73OSW.js +0 -2017
  123. package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
  124. package/dist/bundle/chunk-FV4GQNIK.js +0 -136
  125. package/dist/bundle/chunk-G2TU5RYY.js +0 -332
  126. package/dist/bundle/chunk-GDK7ETSB.js +0 -218
  127. package/dist/bundle/chunk-GGMAIIVE.js +0 -38
  128. package/dist/bundle/chunk-GLYWZQY4.js +0 -86
  129. package/dist/bundle/chunk-H4AFNENN.js +0 -1343
  130. package/dist/bundle/chunk-HOF7GQWW.js +0 -142
  131. package/dist/bundle/chunk-HSPEU6S7.js +0 -209
  132. package/dist/bundle/chunk-IA7LLLEI.js +0 -100
  133. package/dist/bundle/chunk-IB55P46L.js +0 -334
  134. package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
  135. package/dist/bundle/chunk-JG6LCSEX.js +0 -407
  136. package/dist/bundle/chunk-JLXXUEAM.js +0 -72
  137. package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
  138. package/dist/bundle/chunk-K7YY6SXR.js +0 -738
  139. package/dist/bundle/chunk-KEKXERBE.js +0 -67181
  140. package/dist/bundle/chunk-KZN2BG3P.js +0 -721
  141. package/dist/bundle/chunk-LKH3UKLO.js +0 -230
  142. package/dist/bundle/chunk-LZPKBN3C.js +0 -193
  143. package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
  144. package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
  145. package/dist/bundle/chunk-NISH4UXM.js +0 -58
  146. package/dist/bundle/chunk-NSKMNIY6.js +0 -460
  147. package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
  148. package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
  149. package/dist/bundle/chunk-Q7ICVP25.js +0 -18
  150. package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
  151. package/dist/bundle/chunk-R53XXHEI.js +0 -76
  152. package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
  153. package/dist/bundle/chunk-RN6RT5CB.js +0 -58
  154. package/dist/bundle/chunk-RRTMPSQR.js +0 -29
  155. package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
  156. package/dist/bundle/chunk-S6JG4YUH.js +0 -72
  157. package/dist/bundle/chunk-TAVI73RW.js +0 -288
  158. package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
  159. package/dist/bundle/chunk-TXDR6YSF.js +0 -23
  160. package/dist/bundle/chunk-TY7NDMFY.js +0 -46
  161. package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
  162. package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
  163. package/dist/bundle/chunk-V2CNGXWX.js +0 -798
  164. package/dist/bundle/chunk-VB7FZOYX.js +0 -633
  165. package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
  166. package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
  167. package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
  168. package/dist/bundle/chunk-WOPVBRPV.js +0 -29
  169. package/dist/bundle/chunk-WXJYMMEL.js +0 -95
  170. package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
  171. package/dist/bundle/chunk-XEQQJBBO.js +0 -92
  172. package/dist/bundle/chunk-XUT7DSM5.js +0 -108
  173. package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
  174. package/dist/bundle/chunk-YWDFYQOU.js +0 -82
  175. package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
  176. package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
  177. package/dist/bundle/cli-3NXOSENF.js +0 -1239
  178. package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
  179. package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
  180. package/dist/bundle/decode-K7U7X5EL.js +0 -296
  181. package/dist/bundle/dispatch-56FECRCU.js +0 -411
  182. package/dist/bundle/dist-PAKDDIBT.js +0 -191
  183. package/dist/bundle/dist-T54K3FJV.js +0 -7577
  184. package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
  185. package/dist/bundle/embed-SWLVG73O.js +0 -37
  186. package/dist/bundle/embedder-EJN75BPV.js +0 -110
  187. package/dist/bundle/failure-WDSX6H3B.js +0 -24
  188. package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
  189. package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
  190. package/dist/bundle/mcp-5HFPWC3W.js +0 -167
  191. package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
  192. package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
  193. package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
  194. package/dist/bundle/node-EGMCBAO7.js +0 -176
  195. package/dist/bundle/node-P4E63KXA.js +0 -2340
  196. package/dist/bundle/node-TLZSIHIJ.js +0 -21
  197. package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
  198. package/dist/bundle/oauth-2SNRBIJM.js +0 -19
  199. package/dist/bundle/open-ABCPY5IH.js +0 -22
  200. package/dist/bundle/openai-4D6PXJR7.js +0 -237
  201. package/dist/bundle/process-SGHEN6MQ.js +0 -91
  202. package/dist/bundle/program-CBDQBZZ3.js +0 -4971
  203. package/dist/bundle/prompt-2QUK5QST.js +0 -16
  204. package/dist/bundle/recognize-QMQSJRIH.js +0 -25
  205. package/dist/bundle/remote-U7TC2BLZ.js +0 -30
  206. package/dist/bundle/rerank-5UPVXGVV.js +0 -51
  207. package/dist/bundle/serve-VX6GUM6J.js +0 -198
  208. package/dist/bundle/server-FOPC6DJ3.js +0 -219
  209. package/dist/bundle/server-OIVNOMVK.js +0 -87
  210. package/dist/bundle/source-HWS5SJIV.js +0 -46
  211. package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
  212. package/dist/bundle/state-X2HU6GB2.js +0 -35
  213. package/dist/bundle/store-2U4U6KL4.js +0 -184
  214. package/dist/bundle/store-3CHPHFP7.js +0 -301
  215. package/dist/bundle/store-Z3747L5F.js +0 -34
  216. package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
  217. package/dist/bundle/surface-MUT72QON.js +0 -73
  218. package/dist/bundle/writer-RBKQ64ZM.js +0 -48
  219. package/dist/commands/account.d.ts +0 -4
  220. package/dist/commands/account.d.ts.map +0 -1
  221. package/dist/commands/account.js.map +0 -1
  222. package/dist/commands/api.d.ts +0 -3
  223. package/dist/commands/api.d.ts.map +0 -1
  224. package/dist/commands/api.js.map +0 -1
  225. package/dist/commands/crm-shared.d.ts +0 -8
  226. package/dist/commands/crm-shared.d.ts.map +0 -1
  227. package/dist/commands/crm-shared.js.map +0 -1
  228. package/dist/commands/schedule.d.ts +0 -3
  229. package/dist/commands/schedule.d.ts.map +0 -1
  230. package/dist/commands/schedule.js.map +0 -1
  231. package/dist/commands/session.d.ts +0 -35
  232. package/dist/commands/session.d.ts.map +0 -1
  233. package/dist/commands/session.js.map +0 -1
  234. package/dist/commands/write.d.ts +0 -14
  235. package/dist/commands/write.d.ts.map +0 -1
  236. package/dist/commands/write.js.map +0 -1
  237. package/dist/config.d.ts +0 -4
  238. package/dist/config.d.ts.map +0 -1
  239. package/dist/config.js.map +0 -1
  240. package/dist/context.d.ts +0 -62
  241. package/dist/context.d.ts.map +0 -1
  242. package/dist/context.js.map +0 -1
  243. package/dist/crm/activities.d.ts +0 -32
  244. package/dist/crm/activities.d.ts.map +0 -1
  245. package/dist/crm/activities.js.map +0 -1
  246. package/dist/crm/records.d.ts +0 -20
  247. package/dist/crm/records.d.ts.map +0 -1
  248. package/dist/crm/records.js.map +0 -1
  249. package/dist/crm/source.d.ts +0 -41
  250. package/dist/crm/source.d.ts.map +0 -1
  251. package/dist/crm/source.js.map +0 -1
  252. package/dist/crm/writer.d.ts +0 -14
  253. package/dist/crm/writer.d.ts.map +0 -1
  254. package/dist/crm/writer.js.map +0 -1
  255. package/dist/identity.d.ts +0 -7
  256. package/dist/identity.d.ts.map +0 -1
  257. package/dist/identity.js.map +0 -1
  258. package/dist/index.d.ts +0 -3
  259. package/dist/index.d.ts.map +0 -1
  260. package/dist/index.js.map +0 -1
  261. package/dist/program.d.ts +0 -6
  262. package/dist/program.d.ts.map +0 -1
  263. package/dist/program.js.map +0 -1
  264. package/dist/reasons.d.ts +0 -10
  265. package/dist/reasons.d.ts.map +0 -1
  266. package/dist/reasons.js.map +0 -1
  267. package/dist/setup/flow.d.ts +0 -2
  268. package/dist/setup/flow.d.ts.map +0 -1
  269. package/dist/setup/flow.js.map +0 -1
  270. package/dist/store.d.ts +0 -15
  271. package/dist/store.d.ts.map +0 -1
  272. package/dist/store.js.map +0 -1
  273. package/dist/version.d.ts +0 -2
  274. package/dist/version.d.ts.map +0 -1
  275. package/dist/version.js.map +0 -1
  276. package/dist/wcat.d.ts +0 -3
  277. package/dist/wcat.d.ts.map +0 -1
  278. package/dist/wcat.js.map +0 -1
  279. package/dist/whoami.d.ts +0 -24
  280. package/dist/whoami.d.ts.map +0 -1
  281. package/dist/whoami.js.map +0 -1
@@ -1,411 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- require_cross_spawn
5
- } from "./chunk-D72URWJE.js";
6
- import {
7
- BUILT_IN_COMMANDS,
8
- DESCRIBE_FLAG,
9
- DESCRIBE_MAX_BYTES,
10
- FIRST_PARTY_TOOLS,
11
- PROGRAM_PREFIX,
12
- TOOL_NAME,
13
- fileState,
14
- parseDescribe,
15
- shimFiles,
16
- writeShim
17
- } from "./chunk-DPV53EZC.js";
18
- import "./chunk-Y5E2WNWB.js";
19
- import {
20
- CliError
21
- } from "./chunk-S6JG4YUH.js";
22
- import {
23
- __name,
24
- __toESM
25
- } from "./chunk-ZVVMGPBJ.js";
26
-
27
- // 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/wcat/dispatch.js
28
- var import_cross_spawn2 = __toESM(require_cross_spawn(), 1);
29
- import { randomUUID } from "node:crypto";
30
- import { constants } from "node:os";
31
-
32
- // 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/wcat/path.js
33
- import { readdirSync, statSync } from "node:fs";
34
- import { join } from "node:path";
35
- var variable = /* @__PURE__ */ __name((env, name, platform) => platform === "win32" ? Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1] : env[name], "variable");
36
- var pathEntries = /* @__PURE__ */ __name(({ env, platform }) => {
37
- const raw = variable(env, "PATH", platform) ?? "";
38
- const entries = raw.split(platform === "win32" ? ";" : ":").map((entry) => entry.replace(/^"(.*)"$/, "$1"));
39
- const seen = /* @__PURE__ */ new Set();
40
- return entries.filter((entry) => {
41
- const key = platform === "win32" ? entry.toLowerCase().replace(/[\\/]+$/, "") : entry.replace(/\/+$/, "");
42
- if (entry === "" || seen.has(key))
43
- return false;
44
- seen.add(key);
45
- return true;
46
- });
47
- }, "pathEntries");
48
- var programExtensions = /* @__PURE__ */ __name(({ env, platform }) => platform === "win32" ? (variable(env, "PATHEXT", platform) ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((ext) => /^\.[a-z0-9]+$/i.test(ext)).map((ext) => ext.toLowerCase()) : [""], "programExtensions");
49
- var isProgram = /* @__PURE__ */ __name((path, platform) => {
50
- try {
51
- const stat = statSync(path);
52
- return stat.isFile() && (platform === "win32" || (stat.mode & 73) !== 0);
53
- } catch {
54
- return false;
55
- }
56
- }, "isProgram");
57
- var findOnPath = /* @__PURE__ */ __name((command, search) => {
58
- const extensions = programExtensions(search);
59
- return pathEntries(search).flatMap((dir) => {
60
- for (const extension of extensions) {
61
- const path = join(dir, command + extension);
62
- if (isProgram(path, search.platform))
63
- return [path];
64
- }
65
- return [];
66
- });
67
- }, "findOnPath");
68
- var findTools = /* @__PURE__ */ __name((search) => {
69
- const extensions = programExtensions(search);
70
- const tools = /* @__PURE__ */ new Map();
71
- for (const dir of pathEntries(search)) {
72
- let files;
73
- try {
74
- files = readdirSync(dir);
75
- } catch {
76
- continue;
77
- }
78
- const here = /* @__PURE__ */ new Map();
79
- for (const file of files) {
80
- if (!(search.platform === "win32" ? file.toLowerCase() : file).startsWith(PROGRAM_PREFIX))
81
- continue;
82
- const extension = extensions.find((ext) => ext !== "" && file.toLowerCase().endsWith(ext)) ?? "";
83
- if (search.platform === "win32" && extension === "")
84
- continue;
85
- const base = search.platform === "win32" ? file.toLowerCase() : file;
86
- const name = base.slice(PROGRAM_PREFIX.length, base.length - extension.length);
87
- if (!TOOL_NAME.test(name))
88
- continue;
89
- const best = here.get(name);
90
- const rank = /* @__PURE__ */ __name((path2) => extensions.findIndex((ext) => path2.toLowerCase().endsWith(ext)), "rank");
91
- const path = join(dir, file);
92
- if (best !== void 0 && rank(best) <= rank(path))
93
- continue;
94
- if (isProgram(path, search.platform))
95
- here.set(name, path);
96
- }
97
- for (const [name, path] of here)
98
- tools.set(name, [...tools.get(name) ?? [], path]);
99
- }
100
- return new Map([...tools].sort(([a], [b]) => a < b ? -1 : 1));
101
- }, "findTools");
102
- var isBuiltIn = /* @__PURE__ */ __name((name) => name === "wcat" || BUILT_IN_COMMANDS.includes(name), "isBuiltIn");
103
-
104
- // 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/wcat/probe.js
105
- var import_cross_spawn = __toESM(require_cross_spawn(), 1);
106
- import { readFileSync } from "node:fs";
107
- var probeDescribe = /* @__PURE__ */ __name((path, { env, timeoutMs }) => new Promise((resolve) => {
108
- let child;
109
- try {
110
- child = (0, import_cross_spawn.default)(path, [DESCRIBE_FLAG], { stdio: ["ignore", "pipe", "ignore"], env, windowsHide: true });
111
- } catch {
112
- resolve(void 0);
113
- return;
114
- }
115
- const chunks = [];
116
- let size = 0;
117
- let settled = false;
118
- const settle = /* @__PURE__ */ __name((answer) => {
119
- if (settled)
120
- return;
121
- settled = true;
122
- clearTimeout(timer);
123
- resolve(answer);
124
- }, "settle");
125
- const giveUp = /* @__PURE__ */ __name(() => {
126
- child.kill();
127
- child.stdout?.destroy();
128
- child.unref();
129
- settle(void 0);
130
- }, "giveUp");
131
- const timer = setTimeout(giveUp, timeoutMs);
132
- child.stdout?.on("data", (chunk) => {
133
- size += chunk.length;
134
- if (size > DESCRIBE_MAX_BYTES)
135
- giveUp();
136
- else
137
- chunks.push(chunk);
138
- });
139
- child.once("error", () => settle(void 0));
140
- child.once("close", (code) => settle(code === 0 ? parseDescribe(Buffer.concat(chunks).toString("utf8")) : void 0));
141
- }), "probeDescribe");
142
- var baseVersion = /* @__PURE__ */ __name(() => {
143
- try {
144
- const raw = readFileSync(new URL("../../package.json", new URL("wcat/probe.js", import.meta.resolve("@wirecat/cli-base")).href), "utf8");
145
- const { name, version } = JSON.parse(raw);
146
- return name === "@wirecat/cli-base" && typeof version === "string" ? version : "unknown";
147
- } catch {
148
- return "unknown";
149
- }
150
- }, "baseVersion");
151
-
152
- // 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/wcat/shortcuts.js
153
- import { closeSync, openSync, readSync, realpathSync, rmSync } from "node:fs";
154
- import { basename, dirname } from "node:path";
155
- var WIRECAT_PACKAGE = /node_modules[\\/]+@wirecat[\\/]/;
156
- var isWirecatPackage = /* @__PURE__ */ __name((path) => {
157
- try {
158
- if (WIRECAT_PACKAGE.test(realpathSync(path)))
159
- return true;
160
- const buffer = Buffer.alloc(16 * 1024);
161
- const fd = openSync(path, "r");
162
- try {
163
- const read = readSync(fd, buffer, 0, buffer.length, 0);
164
- return WIRECAT_PACKAGE.test(buffer.subarray(0, read).toString("latin1"));
165
- } finally {
166
- closeSync(fd);
167
- }
168
- } catch {
169
- return false;
170
- }
171
- }, "isWirecatPackage");
172
- var ourShortcut = /* @__PURE__ */ __name((path) => {
173
- const state = fileState(path);
174
- return state.state === "ours" && state.mark.kind === "shortcut";
175
- }, "ourShortcut");
176
- var statusOf = /* @__PURE__ */ __name((name, program, search) => {
177
- const files = shimFiles("shortcut", {
178
- dir: dirname(program),
179
- name,
180
- target: basename(program),
181
- platform: search.platform
182
- });
183
- const named = findOnPath(name, search);
184
- const made = [...files.map((file) => file.path), ...named].find(ourShortcut);
185
- if (made)
186
- return { name, status: "made", path: made, program };
187
- const first = named[0];
188
- if (first === void 0)
189
- return { name, status: "free", program };
190
- return { name, status: isWirecatPackage(first) ? "package" : "taken", path: first, program };
191
- }, "statusOf");
192
- var changeFile = /* @__PURE__ */ __name((path, change) => {
193
- try {
194
- change();
195
- } catch (error) {
196
- throw new CliError("permission_error", `could not change ${path}: ${error.code ?? error}`, {
197
- reason: "access.denied"
198
- });
199
- }
200
- }, "changeFile");
201
- var installedPrograms = /* @__PURE__ */ __name((search) => new Map([...findTools(search)].filter(([name]) => !isBuiltIn(name))), "installedPrograms");
202
- var chosen = /* @__PURE__ */ __name((names, search) => {
203
- const installed = installedPrograms(search);
204
- if (names === void 0 || names.length === 0)
205
- return [...installed].map(([name, paths]) => [name, paths[0]]);
206
- const missing = names.filter((name) => !installed.has(name));
207
- if (missing.length > 0)
208
- throw new CliError("not_found", `not installed: ${missing.map((name) => `wcat-${name}`).join(", ")}`, {
209
- reason: "tool.not-installed",
210
- tool: missing[0],
211
- installed: [...installed.keys()]
212
- });
213
- return [...new Set(names)].map((name) => [name, installed.get(name)[0]]);
214
- }, "chosen");
215
- var listShortcuts = /* @__PURE__ */ __name((search, names) => chosen(names, search).map(([name, program]) => statusOf(name, program, search)), "listShortcuts");
216
- var addShortcuts = /* @__PURE__ */ __name((search, names) => listShortcuts(search, names).map((shortcut) => {
217
- if (shortcut.status !== "free")
218
- return { ...shortcut, changed: false };
219
- const files = shimFiles("shortcut", {
220
- dir: dirname(shortcut.program),
221
- name: shortcut.name,
222
- target: basename(shortcut.program),
223
- platform: search.platform
224
- });
225
- for (const file of files)
226
- changeFile(file.path, () => writeShim(file));
227
- return { ...shortcut, status: "made", path: files[0]?.path, changed: true };
228
- }), "addShortcuts");
229
- var removeShortcuts = /* @__PURE__ */ __name((search, names) => listShortcuts(search, names).map((shortcut) => {
230
- if (shortcut.status !== "made")
231
- return { ...shortcut, changed: false };
232
- const files = shimFiles("shortcut", {
233
- dir: dirname(shortcut.path),
234
- name: shortcut.name,
235
- target: basename(shortcut.program),
236
- platform: search.platform
237
- });
238
- for (const file of files)
239
- if (ourShortcut(file.path))
240
- changeFile(file.path, () => rmSync(file.path, { force: true }));
241
- return { ...statusOf(shortcut.name, shortcut.program, search), changed: true };
242
- }), "removeShortcuts");
243
-
244
- // 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/wcat/dispatch.js
245
- var DEFAULT_DESCRIBE_TIMEOUT_MS = 2e3;
246
- var listTools = /* @__PURE__ */ __name(async (context) => {
247
- const installed = installedPrograms(context);
248
- const timeoutMs = context.describeTimeoutMs ?? DEFAULT_DESCRIBE_TIMEOUT_MS;
249
- const found = await Promise.all([...installed].map(async ([name, paths]) => {
250
- const [path, ...shadowed] = paths;
251
- const own = context.self?.command === name ? context.self : void 0;
252
- const described = own ?? await probeDescribe(path, { env: context.env, timeoutMs });
253
- return {
254
- name,
255
- installed: true,
256
- path,
257
- ...described?.version ? { version: described.version } : {},
258
- ...described?.description ? { description: described.description } : {},
259
- ...described?.docs ? { docs_url: described.docs } : {},
260
- ...shadowed.length > 0 ? { shadowed } : {}
261
- };
262
- }));
263
- const missing = FIRST_PARTY_TOOLS.filter((tool) => tool.package && !installed.has(tool.name)).map((tool) => ({
264
- name: tool.name,
265
- installed: false,
266
- package: tool.package,
267
- install: `npm install -g ${tool.package}`
268
- }));
269
- return [...found, ...missing];
270
- }, "listTools");
271
- var envelope = /* @__PURE__ */ __name((items, started) => ({
272
- items,
273
- page: { mode: "page", limit: Math.max(items.length, 1), has_more: false },
274
- meta: { run_id: randomUUID(), duration_ms: Math.max(0, Math.round(performance.now() - started)), complete: true }
275
- }), "envelope");
276
- var column = /* @__PURE__ */ __name((rows) => {
277
- const widths = rows[0]?.map((_, at) => rows.reduce((wide, row) => Math.max(wide, (row[at] ?? "").length), 0)) ?? [];
278
- return rows.map((row) => ` ${row.map((cell, at) => cell.padEnd(widths[at] ?? 0)).join(" ")}`.trimEnd());
279
- }, "column");
280
- var USAGE = [
281
- "wcat <tool> [arguments] run a tool: wcat tg --help",
282
- "wcat shortcuts [add|remove] [tool...] short names, such as tg, for installed tools",
283
- "wcat --json the list below as JSON"
284
- ];
285
- var listText = /* @__PURE__ */ __name((tools) => {
286
- const installed = tools.filter((tool) => tool.installed);
287
- const missing = tools.filter((tool) => !tool.installed);
288
- return [
289
- "wcat runs WireCat tools, and any other wcat-<name> program on PATH.",
290
- "",
291
- ...USAGE,
292
- "",
293
- installed.length > 0 ? "Installed:" : "Installed: none",
294
- ...column(installed.map((tool) => [tool.name, tool.version ?? "", tool.description ?? "(no description)"])),
295
- ...missing.length > 0 ? ["", "Not installed:", ...column(missing.map((tool) => [tool.name, tool.install ?? ""]))] : [],
296
- ""
297
- ].join("\n");
298
- }, "listText");
299
- var shadowWarnings = /* @__PURE__ */ __name((tools) => tools.filter((tool) => tool.shadowed).map((tool) => `wcat: ${(tool.shadowed?.length ?? 0) + 1} programs are named ${PROGRAM_PREFIX}${tool.name}; wcat runs the first:
300
- ${[tool.path, ...tool.shadowed ?? []].map((path) => ` ${path}`).join("\n")}
301
- `).join(""), "shadowWarnings");
302
- var shortcutText = /* @__PURE__ */ __name((shortcuts2) => {
303
- if (shortcuts2.length === 0)
304
- return "No wcat-<name> programs are installed.\n";
305
- const said = /* @__PURE__ */ __name((shortcut) => {
306
- switch (shortcut.status) {
307
- case "made":
308
- return `made: ${shortcut.path}`;
309
- case "free":
310
- return shortcut.changed ? "removed" : "free: wcat shortcuts add makes it";
311
- case "package":
312
- return `installed by the package: ${shortcut.path}`;
313
- case "taken":
314
- return `taken by ${shortcut.path}`;
315
- }
316
- }, "said");
317
- return `${column(shortcuts2.map((shortcut) => [shortcut.name, said(shortcut)])).join("\n")}
318
- `;
319
- }, "shortcutText");
320
- var signalNumber = /* @__PURE__ */ __name((signal) => constants.signals[signal] ?? 1, "signalNumber");
321
- var runTool = /* @__PURE__ */ __name((path, args, context) => new Promise((resolve, reject) => {
322
- const signals = context.signals ?? process;
323
- const child = (0, import_cross_spawn2.default)(path, [...args], { stdio: "inherit", env: context.env });
324
- const pass = /* @__PURE__ */ __name((signal) => () => child.kill(signal), "pass");
325
- const term = pass("SIGTERM");
326
- const hup = pass("SIGHUP");
327
- const ignore = /* @__PURE__ */ __name(() => {
328
- }, "ignore");
329
- signals.on("SIGTERM", term).on("SIGHUP", hup).on("SIGINT", ignore);
330
- const done = /* @__PURE__ */ __name(() => signals.off("SIGTERM", term).off("SIGHUP", hup).off("SIGINT", ignore), "done");
331
- child.once("error", (error) => {
332
- done();
333
- reject(new CliError("configuration_error", `could not start ${path}: ${error.message}`));
334
- });
335
- child.once("exit", (code, signal) => {
336
- done();
337
- resolve(code ?? (signal ? 128 + signalNumber(signal) : 1));
338
- });
339
- }), "runTool");
340
- var fail = /* @__PURE__ */ __name(async (error, json, context) => {
341
- const { errorObjectOf, exitCodeOfError, renderError } = await import("./failure-WDSX6H3B.js");
342
- const object = errorObjectOf(error);
343
- context.stderr.write(`${renderError(object, { cli: "wcat", interactive: !json })}
344
- `);
345
- return exitCodeOfError(object);
346
- }, "fail");
347
- var shortcuts = /* @__PURE__ */ __name(async (args, json, context) => {
348
- const [action, ...names] = args;
349
- const started = performance.now();
350
- const result = action === "add" ? addShortcuts(context, names) : action === "remove" ? removeShortcuts(context, names) : action === void 0 || action === "list" ? listShortcuts(context, names) : void 0;
351
- if (result === void 0)
352
- throw new CliError("validation_error", `wcat shortcuts takes list, add or remove, not "${action}"`, {
353
- reason: "input.invalid"
354
- });
355
- context.stdout.write(json ? `${JSON.stringify(envelope(result, started))}
356
- ` : shortcutText(result));
357
- return 0;
358
- }, "shortcuts");
359
- var runWcat = /* @__PURE__ */ __name(async (args, context) => {
360
- const [first, ...rest] = args;
361
- const json = args.includes("--json");
362
- const words = args.filter((word) => word !== "--json");
363
- const started = performance.now();
364
- try {
365
- if (first === "--version" || first === "-V" || first === "version") {
366
- const tools = await listTools(context);
367
- const by = context.self ? `, run by ${PROGRAM_PREFIX}${context.self.command} ${context.self.version}` : "";
368
- context.stdout.write(`wcat ${baseVersion()} (@wirecat/cli-base${by})
369
-
370
- ${listText(tools)}`);
371
- return 0;
372
- }
373
- if (words.length === 0 || first === "--help" || first === "-h" || first === "help") {
374
- const tools = await listTools(context);
375
- if (json)
376
- context.stdout.write(`${JSON.stringify(envelope(tools, started))}
377
- `);
378
- else {
379
- context.stderr.write(shadowWarnings(tools));
380
- context.stdout.write(listText(tools));
381
- }
382
- return 0;
383
- }
384
- if (first === "shortcuts")
385
- return await shortcuts(words.slice(1), json, context);
386
- if (BUILT_IN_COMMANDS.includes(first))
387
- throw new CliError("validation_error", `wcat ${first} is reserved for a later version of wcat`, {
388
- reason: "input.invalid"
389
- });
390
- if (first?.startsWith("-"))
391
- throw new CliError("validation_error", `wcat does not take ${first} before a tool's name`, {
392
- reason: "input.invalid"
393
- });
394
- const name = first;
395
- const [path, ...shadowed] = TOOL_NAME.test(name) ? findOnPath(`${PROGRAM_PREFIX}${name}`, context) : [];
396
- if (path === void 0) {
397
- const installed = [...installedPrograms(context).keys()];
398
- throw new CliError("not_found", `no ${PROGRAM_PREFIX}${name} on PATH; installed: ${installed.length > 0 ? installed.join(", ") : "none"}`, { reason: "tool.not-installed", tool: name, installed });
399
- }
400
- if (shadowed.length > 0 && context.stderr.isTTY)
401
- context.stderr.write(shadowWarnings([{ name, installed: true, path, shadowed }]));
402
- return await runTool(path, rest, context);
403
- } catch (error) {
404
- return fail(error, json, context);
405
- }
406
- }, "runWcat");
407
- export {
408
- listTools,
409
- runTool,
410
- runWcat
411
- };
@@ -1,191 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- BAGGAGE_META_KEY,
5
- CLIENT_CAPABILITIES_META_KEY,
6
- CLIENT_INFO_META_KEY,
7
- DEFAULT_MAX_REQUEST_BODY_SIZE,
8
- DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
9
- DEFAULT_REQUEST_TIMEOUT_MSEC,
10
- INTERNAL_ERROR,
11
- INVALID_PARAMS,
12
- INVALID_REQUEST,
13
- InMemoryServerEventBus,
14
- InMemoryTransport,
15
- JSONRPC_VERSION,
16
- LATEST_PROTOCOL_VERSION,
17
- LOG_LEVEL_META_KEY,
18
- METHOD_NOT_FOUND,
19
- McpServer,
20
- MissingRequiredClientCapabilityError,
21
- OAuthError,
22
- OAuthErrorCode,
23
- PARSE_ERROR,
24
- PROTOCOL_VERSION_META_KEY,
25
- PerRequestHTTPServerTransport,
26
- Protocol,
27
- ProtocolError,
28
- ProtocolErrorCode,
29
- RELATED_TASK_META_KEY,
30
- ReadBuffer,
31
- ResourceNotFoundError,
32
- ResourceTemplate,
33
- SERVER_INFO_META_KEY,
34
- STDIO_DEFAULT_MAX_BUFFER_SIZE,
35
- SUBSCRIPTION_ID_META_KEY,
36
- SUPPORTED_PROTOCOL_VERSIONS,
37
- SdkError,
38
- SdkErrorCode,
39
- SdkHttpError,
40
- Server,
41
- TRACEPARENT_META_KEY,
42
- TRACESTATE_META_KEY,
43
- UnsupportedProtocolVersionError,
44
- UriTemplate,
45
- UrlElicitationRequiredError,
46
- WebStandardStreamableHTTPServerTransport,
47
- acceptedContent,
48
- assertCompleteRequestPrompt,
49
- assertCompleteRequestResourceTemplate,
50
- bearerAuthChallengeResponse,
51
- buildOAuthProtectedResourceMetadata,
52
- checkResourceAllowed,
53
- classifyInboundRequest,
54
- completable,
55
- createFetchWithInit,
56
- createMcpHandler,
57
- createRequestStateCodec,
58
- deserializeMessage,
59
- fromJsonSchema,
60
- getDisplayName,
61
- getOAuthProtectedResourceMetadataUrl,
62
- hostHeaderValidationResponse,
63
- inputRequired,
64
- inputResponse,
65
- isCallToolResult,
66
- isCompletable,
67
- isInitializeRequest,
68
- isInitializedNotification,
69
- isInputRequiredResult,
70
- isJSONRPCErrorResponse,
71
- isJSONRPCNotification,
72
- isJSONRPCRequest,
73
- isJSONRPCResponse,
74
- isJSONRPCResultResponse,
75
- isJsonContentType,
76
- isLegacyRequest,
77
- isSpecType,
78
- isTaskAugmentedRequestParams,
79
- legacyStatelessFallback,
80
- localhostAllowedHostnames,
81
- localhostAllowedOrigins,
82
- mergeCapabilities,
83
- oauthMetadataResponse,
84
- originValidationResponse,
85
- parseJSONRPCMessage,
86
- preloadSchemas,
87
- readRequestBody,
88
- requireBearerAuth,
89
- requireScopes,
90
- resourceUrlFromServerUrl,
91
- serializeMessage,
92
- specTypeSchemas,
93
- validateHostHeader,
94
- validateOriginHeader,
95
- verifyBearerToken
96
- } from "./chunk-PL5P7UKW.js";
97
- import "./chunk-ZVVMGPBJ.js";
98
- export {
99
- BAGGAGE_META_KEY,
100
- CLIENT_CAPABILITIES_META_KEY,
101
- CLIENT_INFO_META_KEY,
102
- DEFAULT_MAX_REQUEST_BODY_SIZE,
103
- DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
104
- DEFAULT_REQUEST_TIMEOUT_MSEC,
105
- INTERNAL_ERROR,
106
- INVALID_PARAMS,
107
- INVALID_REQUEST,
108
- InMemoryServerEventBus,
109
- InMemoryTransport,
110
- JSONRPC_VERSION,
111
- LATEST_PROTOCOL_VERSION,
112
- LOG_LEVEL_META_KEY,
113
- METHOD_NOT_FOUND,
114
- McpServer,
115
- MissingRequiredClientCapabilityError,
116
- OAuthError,
117
- OAuthErrorCode,
118
- PARSE_ERROR,
119
- PROTOCOL_VERSION_META_KEY,
120
- PerRequestHTTPServerTransport,
121
- Protocol,
122
- ProtocolError,
123
- ProtocolErrorCode,
124
- RELATED_TASK_META_KEY,
125
- ReadBuffer,
126
- ResourceNotFoundError,
127
- ResourceTemplate,
128
- SERVER_INFO_META_KEY,
129
- STDIO_DEFAULT_MAX_BUFFER_SIZE,
130
- SUBSCRIPTION_ID_META_KEY,
131
- SUPPORTED_PROTOCOL_VERSIONS,
132
- SdkError,
133
- SdkErrorCode,
134
- SdkHttpError,
135
- Server,
136
- TRACEPARENT_META_KEY,
137
- TRACESTATE_META_KEY,
138
- UnsupportedProtocolVersionError,
139
- UriTemplate,
140
- UrlElicitationRequiredError,
141
- WebStandardStreamableHTTPServerTransport,
142
- acceptedContent,
143
- assertCompleteRequestPrompt,
144
- assertCompleteRequestResourceTemplate,
145
- bearerAuthChallengeResponse,
146
- buildOAuthProtectedResourceMetadata,
147
- checkResourceAllowed,
148
- classifyInboundRequest,
149
- completable,
150
- createFetchWithInit,
151
- createMcpHandler,
152
- createRequestStateCodec,
153
- deserializeMessage,
154
- fromJsonSchema,
155
- getDisplayName,
156
- getOAuthProtectedResourceMetadataUrl,
157
- hostHeaderValidationResponse,
158
- inputRequired,
159
- inputResponse,
160
- isCallToolResult,
161
- isCompletable,
162
- isInitializeRequest,
163
- isInitializedNotification,
164
- isInputRequiredResult,
165
- isJSONRPCErrorResponse,
166
- isJSONRPCNotification,
167
- isJSONRPCRequest,
168
- isJSONRPCResponse,
169
- isJSONRPCResultResponse,
170
- isJsonContentType,
171
- isLegacyRequest,
172
- isSpecType,
173
- isTaskAugmentedRequestParams,
174
- legacyStatelessFallback,
175
- localhostAllowedHostnames,
176
- localhostAllowedOrigins,
177
- mergeCapabilities,
178
- oauthMetadataResponse,
179
- originValidationResponse,
180
- parseJSONRPCMessage,
181
- preloadSchemas,
182
- readRequestBody,
183
- requireBearerAuth,
184
- requireScopes,
185
- resourceUrlFromServerUrl,
186
- serializeMessage,
187
- specTypeSchemas,
188
- validateHostHeader,
189
- validateOriginHeader,
190
- verifyBearerToken
191
- };