@wirecat/amo-cli 0.0.0-stage → 0.1.1

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 (274) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +204 -0
  3. package/README.md +265 -2
  4. package/contracts/wirecat.json +1356 -0
  5. package/dist/amo/account.d.ts +18 -0
  6. package/dist/amo/account.d.ts.map +1 -0
  7. package/dist/amo/account.js +48 -0
  8. package/dist/amo/account.js.map +1 -0
  9. package/dist/amo/allow-list.d.ts +31 -0
  10. package/dist/amo/allow-list.d.ts.map +1 -0
  11. package/dist/amo/allow-list.js +106 -0
  12. package/dist/amo/allow-list.js.map +1 -0
  13. package/dist/amo/errors.d.ts +12 -0
  14. package/dist/amo/errors.d.ts.map +1 -0
  15. package/dist/amo/errors.js +72 -0
  16. package/dist/amo/errors.js.map +1 -0
  17. package/dist/amo/json.d.ts +3 -0
  18. package/dist/amo/json.d.ts.map +1 -0
  19. package/dist/amo/json.js +3 -0
  20. package/dist/amo/json.js.map +1 -0
  21. package/dist/amo/oauth.d.ts +55 -0
  22. package/dist/amo/oauth.d.ts.map +1 -0
  23. package/dist/amo/oauth.js +189 -0
  24. package/dist/amo/oauth.js.map +1 -0
  25. package/dist/amo/operation.d.ts +45 -0
  26. package/dist/amo/operation.d.ts.map +1 -0
  27. package/dist/amo/operation.js +119 -0
  28. package/dist/amo/operation.js.map +1 -0
  29. package/dist/amo/operations.d.ts +3 -0
  30. package/dist/amo/operations.d.ts.map +1 -0
  31. package/dist/amo/operations.js +1407 -0
  32. package/dist/amo/operations.js.map +1 -0
  33. package/dist/amo/routes.d.ts +67 -0
  34. package/dist/amo/routes.d.ts.map +1 -0
  35. package/dist/amo/routes.js +65 -0
  36. package/dist/amo/routes.js.map +1 -0
  37. package/dist/amo/transport.d.ts +62 -0
  38. package/dist/amo/transport.d.ts.map +1 -0
  39. package/dist/amo/transport.js +282 -0
  40. package/dist/amo/transport.js.map +1 -0
  41. package/dist/api-keys.d.ts +47 -0
  42. package/dist/api-keys.d.ts.map +1 -0
  43. package/dist/api-keys.js +224 -0
  44. package/dist/api-keys.js.map +1 -0
  45. package/dist/bin/amo.d.ts +3 -0
  46. package/dist/bin/amo.d.ts.map +1 -0
  47. package/dist/bin/amo.js +40 -0
  48. package/dist/bin/amo.js.map +1 -0
  49. package/dist/bundle/all-profiles-3KQVWDV4.js +278 -0
  50. package/dist/bundle/amo.js +198 -0
  51. package/dist/bundle/anthropic-N5NOX7K7.js +90 -0
  52. package/dist/bundle/app-server-2MST5EZ5.js +245 -0
  53. package/dist/bundle/bun-4NHWOFX2.js +169 -0
  54. package/dist/bundle/bun-sqlite-DRSXPWPR.js +75 -0
  55. package/dist/bundle/chunk-2B24PDH7.js +1718 -0
  56. package/dist/bundle/chunk-2I5UVMLW.js +3232 -0
  57. package/dist/bundle/chunk-3IRJDH2U.js +731 -0
  58. package/dist/bundle/chunk-4ZAK773N.js +100 -0
  59. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  60. package/dist/bundle/chunk-5D4Z2B5B.js +334 -0
  61. package/dist/bundle/chunk-5E5R65CA.js +54 -0
  62. package/dist/bundle/chunk-5HGGG3QO.js +73 -0
  63. package/dist/bundle/chunk-5RLUHTK6.js +23 -0
  64. package/dist/bundle/chunk-5SBLU7D7.js +63 -0
  65. package/dist/bundle/chunk-5Z5PEEKP.js +206 -0
  66. package/dist/bundle/chunk-63F65DHU.js +29 -0
  67. package/dist/bundle/chunk-6RS7OYTD.js +64 -0
  68. package/dist/bundle/chunk-73CXFE36.js +88 -0
  69. package/dist/bundle/chunk-7GTUZY7M.js +170 -0
  70. package/dist/bundle/chunk-7PKFYX7V.js +189 -0
  71. package/dist/bundle/chunk-7U5HJEPZ.js +1400 -0
  72. package/dist/bundle/chunk-A33TIM5D.js +4172 -0
  73. package/dist/bundle/chunk-ADEWU4P4.js +38 -0
  74. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  75. package/dist/bundle/chunk-AHJ4W2IL.js +106 -0
  76. package/dist/bundle/chunk-AUBB72VF.js +2572 -0
  77. package/dist/bundle/chunk-BVMNXI53.js +1266 -0
  78. package/dist/bundle/chunk-CDY2NJFE.js +136 -0
  79. package/dist/bundle/chunk-CHUKWON6.js +244 -0
  80. package/dist/bundle/chunk-CUZRHF34.js +230 -0
  81. package/dist/bundle/chunk-D72URWJE.js +532 -0
  82. package/dist/bundle/chunk-DAY6TSPF.js +786 -0
  83. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  84. package/dist/bundle/chunk-DJD7TBYG.js +2791 -0
  85. package/dist/bundle/chunk-DOSJONCX.js +1197 -0
  86. package/dist/bundle/chunk-DQV2IKCF.js +72 -0
  87. package/dist/bundle/chunk-DXGGCGRP.js +218 -0
  88. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  89. package/dist/bundle/chunk-EPOV5UIO.js +185 -0
  90. package/dist/bundle/chunk-EQ7A6NA6.js +53 -0
  91. package/dist/bundle/chunk-EQUKVVHX.js +353 -0
  92. package/dist/bundle/chunk-EROSAUNP.js +133 -0
  93. package/dist/bundle/chunk-ESZSMZKT.js +82 -0
  94. package/dist/bundle/chunk-FKR3M62D.js +407 -0
  95. package/dist/bundle/chunk-GNTJMB6X.js +142 -0
  96. package/dist/bundle/chunk-GQ7VFIYM.js +316 -0
  97. package/dist/bundle/chunk-JH3UOHRE.js +161 -0
  98. package/dist/bundle/chunk-JMDLPBXK.js +1068 -0
  99. package/dist/bundle/chunk-JR6TSMFX.js +9435 -0
  100. package/dist/bundle/chunk-L6AFE73L.js +18 -0
  101. package/dist/bundle/chunk-LDEBZ3IX.js +238 -0
  102. package/dist/bundle/chunk-LGQXGOPJ.js +58 -0
  103. package/dist/bundle/chunk-LJQUYECN.js +6848 -0
  104. package/dist/bundle/chunk-LRBPT7LQ.js +95 -0
  105. package/dist/bundle/chunk-LSND5QYI.js +460 -0
  106. package/dist/bundle/chunk-NC76INB2.js +27955 -0
  107. package/dist/bundle/chunk-NHXJYS4R.js +1334 -0
  108. package/dist/bundle/chunk-NJYAL3UW.js +92 -0
  109. package/dist/bundle/chunk-O2UCU52O.js +4065 -0
  110. package/dist/bundle/chunk-ODNQU7DH.js +1028 -0
  111. package/dist/bundle/chunk-P3WQRTYZ.js +24 -0
  112. package/dist/bundle/chunk-P5LYZRKW.js +63373 -0
  113. package/dist/bundle/chunk-PFO76YFP.js +2003 -0
  114. package/dist/bundle/chunk-PM77PRB6.js +12269 -0
  115. package/dist/bundle/chunk-Q2VNBY4Y.js +38109 -0
  116. package/dist/bundle/chunk-QDMXZZG4.js +604 -0
  117. package/dist/bundle/chunk-QRQYUHCZ.js +761 -0
  118. package/dist/bundle/chunk-RPWAJYI6.js +2336 -0
  119. package/dist/bundle/chunk-SMSTGO2G.js +58 -0
  120. package/dist/bundle/chunk-SZ2V62HB.js +72 -0
  121. package/dist/bundle/chunk-T2UDLX76.js +259 -0
  122. package/dist/bundle/chunk-TGEQNS6G.js +16 -0
  123. package/dist/bundle/chunk-TNUFLULO.js +2333 -0
  124. package/dist/bundle/chunk-TZSUZGWM.js +25 -0
  125. package/dist/bundle/chunk-U7RLVJ34.js +274 -0
  126. package/dist/bundle/chunk-UBRREVLJ.js +72 -0
  127. package/dist/bundle/chunk-ULXQ5MJM.js +76 -0
  128. package/dist/bundle/chunk-UMVRT7VQ.js +46 -0
  129. package/dist/bundle/chunk-V77XNPXG.js +360 -0
  130. package/dist/bundle/chunk-VVHRQ46X.js +193 -0
  131. package/dist/bundle/chunk-VX37MPTJ.js +7 -0
  132. package/dist/bundle/chunk-WCYCUTSK.js +362 -0
  133. package/dist/bundle/chunk-XEFAMLSD.js +288 -0
  134. package/dist/bundle/chunk-XQL7FEF4.js +721 -0
  135. package/dist/bundle/chunk-XRTD2GCU.js +627 -0
  136. package/dist/bundle/chunk-Y37A3232.js +804 -0
  137. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  138. package/dist/bundle/chunk-ZM7I52EP.js +78 -0
  139. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  140. package/dist/bundle/cli-QVWTXADI.js +1193 -0
  141. package/dist/bundle/command-contract-QBUQBXH7.js +39 -0
  142. package/dist/bundle/command-server-entry-5VL5U5EE.js +168 -0
  143. package/dist/bundle/decode-SQ5WGNDX.js +296 -0
  144. package/dist/bundle/dispatch-LA4DFXJD.js +411 -0
  145. package/dist/bundle/dist-T54K3FJV.js +7577 -0
  146. package/dist/bundle/echarts-25Z3RINX.js +42501 -0
  147. package/dist/bundle/embed-BNOTNXMA.js +37 -0
  148. package/dist/bundle/embedder-BCUT7KKV.js +110 -0
  149. package/dist/bundle/failure-PKAC6XCT.js +24 -0
  150. package/dist/bundle/first-run-EO5K5GME.js +28 -0
  151. package/dist/bundle/first-screen-GMN3T6RW.js +39 -0
  152. package/dist/bundle/instructions-VLM3QAYB.js +11 -0
  153. package/dist/bundle/mcp-7ILNMJH5.js +167 -0
  154. package/dist/bundle/meeting-combined-LAMF7S2B.js +24 -0
  155. package/dist/bundle/meeting-model-GHMMUQ34.js +24 -0
  156. package/dist/bundle/meeting-semantic-BMP6323L.js +21 -0
  157. package/dist/bundle/node-CT3N3TNL.js +176 -0
  158. package/dist/bundle/node-P4E63KXA.js +2340 -0
  159. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  160. package/dist/bundle/node-sqlite-MELD2SBX.js +73 -0
  161. package/dist/bundle/oauth-YBH5OKC2.js +19 -0
  162. package/dist/bundle/open-WNSBWTAG.js +22 -0
  163. package/dist/bundle/openai-XSNMNLW6.js +237 -0
  164. package/dist/bundle/process-I2QKOMM7.js +91 -0
  165. package/dist/bundle/program-DV73CIGP.js +4940 -0
  166. package/dist/bundle/prompt-SOG4AKPM.js +16 -0
  167. package/dist/bundle/recognize-WMQLWMXH.js +25 -0
  168. package/dist/bundle/remote-4BTFOLFY.js +30 -0
  169. package/dist/bundle/rerank-LJ3TWRNV.js +51 -0
  170. package/dist/bundle/serve-B6UANKXN.js +198 -0
  171. package/dist/bundle/server-S6XD6V6E.js +77 -0
  172. package/dist/bundle/server-YRH6GJ5Z.js +206 -0
  173. package/dist/bundle/source-DGFTA2TN.js +42 -0
  174. package/dist/bundle/sqlite-runtime-R7QFWFE7.js +19 -0
  175. package/dist/bundle/state-DIJ5YUOE.js +35 -0
  176. package/dist/bundle/store-6WFWW7EC.js +294 -0
  177. package/dist/bundle/store-FJCNZULV.js +32 -0
  178. package/dist/bundle/store-MYTYDV6A.js +177 -0
  179. package/dist/bundle/store-maintenance-command-B5TMKFMG.js +68 -0
  180. package/dist/bundle/writer-GP7VIMAU.js +44 -0
  181. package/dist/commands/account.d.ts +3 -0
  182. package/dist/commands/account.d.ts.map +1 -0
  183. package/dist/commands/account.js +86 -0
  184. package/dist/commands/account.js.map +1 -0
  185. package/dist/commands/api.d.ts +3 -0
  186. package/dist/commands/api.d.ts.map +1 -0
  187. package/dist/commands/api.js +224 -0
  188. package/dist/commands/api.js.map +1 -0
  189. package/dist/commands/crm-shared.d.ts +8 -0
  190. package/dist/commands/crm-shared.d.ts.map +1 -0
  191. package/dist/commands/crm-shared.js +111 -0
  192. package/dist/commands/crm-shared.js.map +1 -0
  193. package/dist/commands/schedule.d.ts +3 -0
  194. package/dist/commands/schedule.d.ts.map +1 -0
  195. package/dist/commands/schedule.js +9 -0
  196. package/dist/commands/schedule.js.map +1 -0
  197. package/dist/commands/session.d.ts +18 -0
  198. package/dist/commands/session.d.ts.map +1 -0
  199. package/dist/commands/session.js +265 -0
  200. package/dist/commands/session.js.map +1 -0
  201. package/dist/commands/write.d.ts +14 -0
  202. package/dist/commands/write.d.ts.map +1 -0
  203. package/dist/commands/write.js +36 -0
  204. package/dist/commands/write.js.map +1 -0
  205. package/dist/config.d.ts +4 -0
  206. package/dist/config.d.ts.map +1 -0
  207. package/dist/config.js +29 -0
  208. package/dist/config.js.map +1 -0
  209. package/dist/context.d.ts +62 -0
  210. package/dist/context.d.ts.map +1 -0
  211. package/dist/context.js +97 -0
  212. package/dist/context.js.map +1 -0
  213. package/dist/crm/activities.d.ts +32 -0
  214. package/dist/crm/activities.d.ts.map +1 -0
  215. package/dist/crm/activities.js +196 -0
  216. package/dist/crm/activities.js.map +1 -0
  217. package/dist/crm/records.d.ts +20 -0
  218. package/dist/crm/records.d.ts.map +1 -0
  219. package/dist/crm/records.js +175 -0
  220. package/dist/crm/records.js.map +1 -0
  221. package/dist/crm/source.d.ts +41 -0
  222. package/dist/crm/source.d.ts.map +1 -0
  223. package/dist/crm/source.js +673 -0
  224. package/dist/crm/source.js.map +1 -0
  225. package/dist/crm/writer.d.ts +14 -0
  226. package/dist/crm/writer.d.ts.map +1 -0
  227. package/dist/crm/writer.js +247 -0
  228. package/dist/crm/writer.js.map +1 -0
  229. package/dist/identity.d.ts +7 -0
  230. package/dist/identity.d.ts.map +1 -0
  231. package/dist/identity.js +33 -0
  232. package/dist/identity.js.map +1 -0
  233. package/dist/index.d.ts +3 -0
  234. package/dist/index.d.ts.map +1 -0
  235. package/dist/index.js +3 -0
  236. package/dist/index.js.map +1 -0
  237. package/dist/program.d.ts +6 -0
  238. package/dist/program.d.ts.map +1 -0
  239. package/dist/program.js +91 -0
  240. package/dist/program.js.map +1 -0
  241. package/dist/reasons.d.ts +10 -0
  242. package/dist/reasons.d.ts.map +1 -0
  243. package/dist/reasons.js +35 -0
  244. package/dist/reasons.js.map +1 -0
  245. package/dist/setup/flow.d.ts +2 -0
  246. package/dist/setup/flow.d.ts.map +1 -0
  247. package/dist/setup/flow.js +127 -0
  248. package/dist/setup/flow.js.map +1 -0
  249. package/dist/setup/texts.en.json +25 -0
  250. package/dist/setup/texts.es.json +25 -0
  251. package/dist/setup/texts.ru.json +25 -0
  252. package/dist/store.d.ts +15 -0
  253. package/dist/store.d.ts.map +1 -0
  254. package/dist/store.js +16 -0
  255. package/dist/store.js.map +1 -0
  256. package/dist/version.d.ts +2 -0
  257. package/dist/version.d.ts.map +1 -0
  258. package/dist/version.js +2 -0
  259. package/dist/version.js.map +1 -0
  260. package/dist/wcat.d.ts +3 -0
  261. package/dist/wcat.d.ts.map +1 -0
  262. package/dist/wcat.js +4 -0
  263. package/dist/wcat.js.map +1 -0
  264. package/dist/whoami.d.ts +24 -0
  265. package/dist/whoami.d.ts.map +1 -0
  266. package/dist/whoami.js +33 -0
  267. package/dist/whoami.js.map +1 -0
  268. package/package.json +85 -4
  269. package/skills/amo-cli/SKILL.md +116 -0
  270. package/skills/amo-cli/references/mcp.md +38 -0
  271. package/skills/amo-cli/references/output.md +42 -0
  272. package/skills/amo-cli/references/reading.md +77 -0
  273. package/skills/amo-cli/references/setup.md +59 -0
  274. package/skills/amo-cli/references/writing.md +86 -0
@@ -0,0 +1,198 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __bundleRequire } from "node:module";
3
+ const require = __bundleRequire(import.meta.url);
4
+ import {
5
+ DESKTOP
6
+ } from "./chunk-2B24PDH7.js";
7
+ import "./chunk-CDY2NJFE.js";
8
+ import "./chunk-Y37A3232.js";
9
+ import "./chunk-VVHRQ46X.js";
10
+ import "./chunk-LSND5QYI.js";
11
+ import "./chunk-EH6ZEJGT.js";
12
+ import {
13
+ installerOf
14
+ } from "./chunk-5RLUHTK6.js";
15
+ import "./chunk-QDMXZZG4.js";
16
+ import "./chunk-PFO76YFP.js";
17
+ import "./chunk-DQV2IKCF.js";
18
+ import "./chunk-TGEQNS6G.js";
19
+ import "./chunk-QRQYUHCZ.js";
20
+ import "./chunk-NJYAL3UW.js";
21
+ import "./chunk-63F65DHU.js";
22
+ import "./chunk-A33TIM5D.js";
23
+ import "./chunk-VX37MPTJ.js";
24
+ import {
25
+ DESCRIBE_FLAG,
26
+ DISPATCH_FLAG,
27
+ PROGRAM_PREFIX,
28
+ SHIM_FORMAT,
29
+ describeAnswer,
30
+ exists,
31
+ fileState,
32
+ shimFiles,
33
+ writeShim
34
+ } from "./chunk-5Z5PEEKP.js";
35
+ import "./chunk-4ZAK773N.js";
36
+ import "./chunk-ESZSMZKT.js";
37
+ import "./chunk-DJD7TBYG.js";
38
+ import {
39
+ catchCrashes
40
+ } from "./chunk-AUBB72VF.js";
41
+ import "./chunk-Y5E2WNWB.js";
42
+ import "./chunk-SZ2V62HB.js";
43
+ import {
44
+ __name
45
+ } from "./chunk-ZVVMGPBJ.js";
46
+
47
+ // dist/bin/amo.js
48
+ import { enableCompileCache } from "node:module";
49
+
50
+ // node_modules/.pnpm/@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
51
+ import { createHash } from "node:crypto";
52
+ import { existsSync, readFileSync as readFileSync2, realpathSync } from "node:fs";
53
+ import { dirname as dirname2, join as join2 } from "node:path";
54
+ import { fileURLToPath } from "node:url";
55
+
56
+ // node_modules/.pnpm/@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/launcher.js
57
+ import { readFileSync } from "node:fs";
58
+ import { basename, dirname, join, resolve } from "node:path";
59
+ var posix = /* @__PURE__ */ __name((path) => path.replaceAll("\\", "/"), "posix");
60
+ var pnpmHome = /* @__PURE__ */ __name((path, env) => {
61
+ const home = env.PNPM_HOME;
62
+ return home && path.startsWith(`${posix(home).replace(/\/+$/, "")}/`) ? home : void 0;
63
+ }, "pnpmHome");
64
+ var layoutFolders = /* @__PURE__ */ __name((script, env) => {
65
+ const path = posix(script);
66
+ const home = pnpmHome(path, env);
67
+ if (home)
68
+ return [join(home, "bin"), home];
69
+ switch (installerOf(script)) {
70
+ case "bun":
71
+ return [`${path.slice(0, path.indexOf("/install/global/node_modules/"))}/bin`];
72
+ case "npm": {
73
+ const root = path.slice(0, path.indexOf("/node_modules/"));
74
+ return [basename(root) === "lib" ? join(dirname(root), "bin") : root];
75
+ }
76
+ default:
77
+ return [];
78
+ }
79
+ }, "layoutFolders");
80
+ var binFolder = /* @__PURE__ */ __name(({ name, argv1, script, env, platform }) => {
81
+ if (!["npm", "pnpm", "bun"].includes(installerOf(script)) && !pnpmHome(posix(script), env))
82
+ return void 0;
83
+ const extensions = platform === "win32" ? [".cmd", ".exe"] : [""];
84
+ const candidates = [argv1 ? dirname(argv1) : void 0, ...layoutFolders(script, env)];
85
+ for (const dir of new Set(candidates)) {
86
+ if (dir === void 0 || basename(dir) === ".bin")
87
+ continue;
88
+ for (const extension of extensions) {
89
+ const program = `${PROGRAM_PREFIX}${name}${extension}`;
90
+ if (exists(join(dir, program)))
91
+ return { dir, program };
92
+ }
93
+ }
94
+ return void 0;
95
+ }, "binFolder");
96
+ var installed = /* @__PURE__ */ __name((dir, program) => {
97
+ if (!exists(join(dir, program)))
98
+ return false;
99
+ if (!program.toLowerCase().endsWith(".exe"))
100
+ return true;
101
+ let script;
102
+ try {
103
+ script = readFileSync(join(dir, `${program.slice(0, -4)}.bunx`)).toString("utf16le").split('"')[0] ?? "";
104
+ } catch {
105
+ return true;
106
+ }
107
+ if (script === "" || exists(resolve(dir, script)))
108
+ return true;
109
+ const at = posix(script).lastIndexOf("/install/global/node_modules/");
110
+ return at < 0 || exists(join(dirname(dir), posix(script).slice(at + 1)));
111
+ }, "installed");
112
+ var NAME = "wcat";
113
+ var ensureLauncher = /* @__PURE__ */ __name(({ dir, program, platform }) => {
114
+ try {
115
+ if (!exists(join(dir, program)))
116
+ return "failed";
117
+ const mine = shimFiles("launcher", { dir, name: NAME, target: program, platform });
118
+ const states = mine.map((file) => fileState(file.path));
119
+ if (states.some((one) => one.state === "foreign"))
120
+ return "foreign";
121
+ const ours = states.flatMap((one) => one.state === "ours" ? [one] : []);
122
+ if (ours.some(({ mark }) => mark.format > SHIM_FORMAT))
123
+ return "newer";
124
+ if (ours.some(({ mark }) => mark.kind !== "launcher"))
125
+ return "foreign";
126
+ const current = ours.find(({ mark }) => installed(dir, mark.target))?.mark.target;
127
+ const wanted = shimFiles("launcher", { dir, name: NAME, target: current ?? program, platform });
128
+ const stale = wanted.filter((file, at) => {
129
+ const state = states[at];
130
+ return state?.state !== "ours" || state.text !== file.text;
131
+ });
132
+ if (stale.length === 0)
133
+ return "kept";
134
+ for (const file of stale)
135
+ writeShim(file);
136
+ return "written";
137
+ } catch {
138
+ return "failed";
139
+ }
140
+ }, "ensureLauncher");
141
+
142
+ // node_modules/.pnpm/@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
143
+ var wcatStart = /* @__PURE__ */ __name(async (tool, io = {}) => {
144
+ const argv = io.argv ?? process.argv;
145
+ const env = io.env ?? process.env;
146
+ const platform = io.platform ?? process.platform;
147
+ const stdout = io.stdout ?? process.stdout;
148
+ const [first, ...rest] = argv.slice(2);
149
+ if (first === DESCRIBE_FLAG) {
150
+ stdout.write(`${JSON.stringify(describeAnswer(tool, shippedManifest(argv[1])))}
151
+ `);
152
+ return { code: 0 };
153
+ }
154
+ if (first === DISPATCH_FLAG) {
155
+ const { runWcat } = await import("./dispatch-LA4DFXJD.js");
156
+ const code = await runWcat(rest, { env, platform, stdout, stderr: io.stderr ?? process.stderr, self: tool });
157
+ return { code };
158
+ }
159
+ const folder = binFolder({
160
+ name: tool.command,
161
+ argv1: argv[1],
162
+ script: io.script ?? fileURLToPath(new URL("wcat/start.js", import.meta.resolve("@wirecat/cli-base")).href),
163
+ env,
164
+ platform
165
+ });
166
+ return folder ? { launcher: ensureLauncher({ ...folder, platform }) } : {};
167
+ }, "wcatStart");
168
+ var shippedManifest = /* @__PURE__ */ __name((bin) => {
169
+ if (!bin)
170
+ return void 0;
171
+ try {
172
+ for (let dir = dirname2(realpathSync(bin)); ; dir = dirname2(dir)) {
173
+ if (existsSync(join2(dir, "package.json"))) {
174
+ const bytes = readFileSync2(join2(dir, "contracts", "wirecat.json"));
175
+ const { wcat_manifest: format, desktop } = JSON.parse(bytes.toString("utf8"));
176
+ if (format !== 2 || typeof desktop !== "object" || desktop === null)
177
+ return void 0;
178
+ return { desktop, sha256: createHash("sha256").update(bytes).digest("hex") };
179
+ }
180
+ if (dirname2(dir) === dir)
181
+ return void 0;
182
+ }
183
+ } catch {
184
+ return void 0;
185
+ }
186
+ }, "shippedManifest");
187
+
188
+ // dist/bin/amo.js
189
+ enableCompileCache();
190
+ var stopCatching = catchCrashes({ cli: DESKTOP.command, interactive: process.stdout.isTTY === true });
191
+ var wcat = await wcatStart(DESKTOP);
192
+ if (wcat.code !== void 0) {
193
+ process.exitCode = wcat.code;
194
+ } else {
195
+ const { run } = await import("./program-DV73CIGP.js");
196
+ process.exitCode = await run(process.argv.slice(2));
197
+ }
198
+ stopCatching();
@@ -0,0 +1,90 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ EmptyAnswer,
5
+ checkedOptions,
6
+ messagesFor,
7
+ systemFor
8
+ } from "./chunk-ULXQ5MJM.js";
9
+ import {
10
+ Anthropic
11
+ } from "./chunk-ADLS6FVG.js";
12
+ import "./chunk-DJD7TBYG.js";
13
+ import {
14
+ array,
15
+ literal,
16
+ optional,
17
+ picklist,
18
+ record,
19
+ strictObject,
20
+ string,
21
+ unknown
22
+ } from "./chunk-AUBB72VF.js";
23
+ import "./chunk-Y5E2WNWB.js";
24
+ import "./chunk-SZ2V62HB.js";
25
+ import {
26
+ __name
27
+ } from "./chunk-ZVVMGPBJ.js";
28
+
29
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/models/anthropic.js
30
+ var options = strictObject({
31
+ stop_sequences: optional(array(string())),
32
+ thinking: optional(strictObject({ type: picklist(["disabled", "adaptive"]) })),
33
+ output_config: optional(strictObject({
34
+ effort: optional(picklist(["low", "medium", "high"])),
35
+ format: optional(strictObject({ type: literal("json_schema"), schema: record(string(), unknown()) }))
36
+ }))
37
+ });
38
+ var anthropic = {
39
+ images: true,
40
+ baseUrl: "https://api.anthropic.com",
41
+ validate: /* @__PURE__ */ __name((given) => checkedOptions("anthropic", options, given), "validate"),
42
+ complete: /* @__PURE__ */ __name(async (target, request, checked, apiKey, fetcher) => {
43
+ const client = new Anthropic({
44
+ apiKey: apiKey ?? "",
45
+ authToken: null,
46
+ fetch: /* @__PURE__ */ __name((input, init) => fetcher(input, { ...init, redirect: "error" }), "fetch"),
47
+ baseURL: target.baseUrl,
48
+ maxRetries: 0,
49
+ logLevel: "off",
50
+ timeout: 12e4
51
+ });
52
+ const response = await client.messages.stream({
53
+ ...checked,
54
+ model: target.model,
55
+ system: systemFor(request),
56
+ messages: [
57
+ ...messagesFor(request),
58
+ ...request.images === void 0 ? [] : [
59
+ {
60
+ role: "user",
61
+ content: [
62
+ { type: "text", text: request.prompt },
63
+ ...request.images.map((image) => ({
64
+ type: "image",
65
+ source: { type: "base64", media_type: image.mimeType, data: image.data }
66
+ }))
67
+ ]
68
+ }
69
+ ]
70
+ ],
71
+ max_tokens: request.maxTokens
72
+ }).finalMessage();
73
+ if (response.stop_reason !== "end_turn")
74
+ throw new Error("incomplete response");
75
+ const text = response.content.filter((block) => block.type === "text").map((block) => block.text).join("");
76
+ if (text.trim() === "")
77
+ throw new EmptyAnswer();
78
+ return {
79
+ text,
80
+ usage: {
81
+ input: response.usage.input_tokens + (response.usage.cache_creation_input_tokens ?? 0) + (response.usage.cache_read_input_tokens ?? 0),
82
+ output: response.usage.output_tokens
83
+ },
84
+ tokens: response.usage.input_tokens + response.usage.output_tokens + (response.usage.cache_creation_input_tokens ?? 0) + (response.usage.cache_read_input_tokens ?? 0)
85
+ };
86
+ }, "complete")
87
+ };
88
+ export {
89
+ anthropic
90
+ };
@@ -0,0 +1,245 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ PER_RUN,
5
+ envelope
6
+ } from "./chunk-DAY6TSPF.js";
7
+ import {
8
+ mcpUrlOf
9
+ } from "./chunk-NHXJYS4R.js";
10
+ import "./chunk-L6AFE73L.js";
11
+ import {
12
+ answered,
13
+ failed,
14
+ registerCommands,
15
+ runCommandForAgent,
16
+ toolsFromCommands
17
+ } from "./chunk-O2UCU52O.js";
18
+ import {
19
+ agentJson,
20
+ skillResources
21
+ } from "./chunk-XRTD2GCU.js";
22
+ import {
23
+ StdioServerTransport,
24
+ answeredWire,
25
+ serveStdio
26
+ } from "./chunk-3IRJDH2U.js";
27
+ import "./chunk-7U5HJEPZ.js";
28
+ import "./chunk-Q2VNBY4Y.js";
29
+ import "./chunk-FKR3M62D.js";
30
+ import "./chunk-2I5UVMLW.js";
31
+ import "./chunk-73CXFE36.js";
32
+ import "./chunk-GNTJMB6X.js";
33
+ import "./chunk-UMVRT7VQ.js";
34
+ import {
35
+ appInstructions
36
+ } from "./chunk-EQ7A6NA6.js";
37
+ import {
38
+ McpServer
39
+ } from "./chunk-5D4AEUVA.js";
40
+ import "./chunk-ULXQ5MJM.js";
41
+ import "./chunk-T2UDLX76.js";
42
+ import "./chunk-V77XNPXG.js";
43
+ import "./chunk-7GTUZY7M.js";
44
+ import {
45
+ mcpHttpMarker
46
+ } from "./chunk-JH3UOHRE.js";
47
+ import "./chunk-5HGGG3QO.js";
48
+ import "./chunk-EROSAUNP.js";
49
+ import {
50
+ DEFAULT_OUTPUT_BYTES,
51
+ changesAuthorityAt,
52
+ describeProgram,
53
+ environmentOf,
54
+ fetchesOnlyAt,
55
+ judgedTargets,
56
+ readOnlyLockOf,
57
+ readsOverMcpAt,
58
+ rootOf2 as rootOf
59
+ } from "./chunk-PM77PRB6.js";
60
+ import "./chunk-WCYCUTSK.js";
61
+ import "./chunk-SMSTGO2G.js";
62
+ import "./chunk-5D4Z2B5B.js";
63
+ import "./chunk-5SBLU7D7.js";
64
+ import "./chunk-JMDLPBXK.js";
65
+ import "./chunk-6RS7OYTD.js";
66
+ import "./chunk-P5LYZRKW.js";
67
+ import "./chunk-TNUFLULO.js";
68
+ import "./chunk-XQL7FEF4.js";
69
+ import "./chunk-BVMNXI53.js";
70
+ import "./chunk-UBRREVLJ.js";
71
+ import "./chunk-EPOV5UIO.js";
72
+ import "./chunk-GQ7VFIYM.js";
73
+ import "./chunk-DOSJONCX.js";
74
+ import "./chunk-ODNQU7DH.js";
75
+ import "./chunk-U7RLVJ34.js";
76
+ import "./chunk-Y37A3232.js";
77
+ import "./chunk-LSND5QYI.js";
78
+ import "./chunk-5RLUHTK6.js";
79
+ import "./chunk-QDMXZZG4.js";
80
+ import "./chunk-PFO76YFP.js";
81
+ import "./chunk-DQV2IKCF.js";
82
+ import "./chunk-TGEQNS6G.js";
83
+ import "./chunk-QRQYUHCZ.js";
84
+ import "./chunk-NJYAL3UW.js";
85
+ import "./chunk-63F65DHU.js";
86
+ import "./chunk-A33TIM5D.js";
87
+ import "./chunk-VX37MPTJ.js";
88
+ import "./chunk-D72URWJE.js";
89
+ import "./chunk-ESZSMZKT.js";
90
+ import "./chunk-5E5R65CA.js";
91
+ import "./chunk-LRBPT7LQ.js";
92
+ import "./chunk-ADEWU4P4.js";
93
+ import "./chunk-DJD7TBYG.js";
94
+ import {
95
+ mcpErrorResult
96
+ } from "./chunk-AUBB72VF.js";
97
+ import "./chunk-Y5E2WNWB.js";
98
+ import {
99
+ CliError
100
+ } from "./chunk-SZ2V62HB.js";
101
+ import "./chunk-LJQUYECN.js";
102
+ import {
103
+ __name
104
+ } from "./chunk-ZVVMGPBJ.js";
105
+
106
+ // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/app-server.js
107
+ var EXCLUDED = [["mcp"]];
108
+ var aliasesOf = /* @__PURE__ */ __name((root, path) => {
109
+ let at = root;
110
+ for (const name of path)
111
+ at = at?.commands.find((child) => child.name() === name);
112
+ const aliases = at?.aliases() ?? [];
113
+ return aliases.length > 0 ? { aliases } : {};
114
+ }, "aliasesOf");
115
+ var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
116
+ const { app } = options;
117
+ const root = rootOf(command);
118
+ const environment = environmentOf(command);
119
+ if (!environment.runCommand)
120
+ throw new Error("the MCP server runs inside run(), which hands it the program");
121
+ const program = { run: environment.runCommand, commands: describeProgram(root) };
122
+ const flags = command.optsWithGlobals();
123
+ const overrides = flags.permission ?? [];
124
+ const { settings } = context;
125
+ const levels = /* @__PURE__ */ __name(() => options.resolveSettings(flags, { env: context.env }).permissions, "levels");
126
+ const readOnly = /* @__PURE__ */ __name(() => readOnlyLockOf(app, context.env) !== void 0, "readOnly");
127
+ const authority = changesAuthorityAt(root);
128
+ const fetches = fetchesOnlyAt(root);
129
+ const targets = judgedTargets(root);
130
+ const passed = Object.fromEntries(Object.entries(environment).filter(([key]) => !PER_RUN.has(key)));
131
+ const tools = toolsFromCommands(program.commands, {
132
+ includeUnavailable: true,
133
+ exclude: EXCLUDED,
134
+ levels: settings.permissions,
135
+ currentLevels: levels,
136
+ readOnly: readOnly(),
137
+ authority,
138
+ fetchOnly: readsOverMcpAt(root),
139
+ fetches,
140
+ permissions: options.permissions
141
+ });
142
+ const availability = /* @__PURE__ */ __name((one) => () => {
143
+ const permitted = one.availability?.() ?? { available: true };
144
+ if (!permitted.available)
145
+ return permitted;
146
+ return options.availability?.(one.path, settings.profile) ?? permitted;
147
+ }, "availability");
148
+ const commands = Object.fromEntries(tools.map((one) => [
149
+ one.command,
150
+ {
151
+ title: one.title,
152
+ description: one.description,
153
+ ...one.keywords ? { keywords: one.keywords } : {},
154
+ ...aliasesOf(root, one.path),
155
+ writes: one.writes,
156
+ availability: availability(one),
157
+ input: one.input,
158
+ run: /* @__PURE__ */ __name(async (input, ctx) => {
159
+ const own = options.availability?.(one.path, settings.profile);
160
+ if (own && !own.available)
161
+ return failed(new CliError("permission_error", `${one.command}: ${own.reason ?? "unavailable for this profile"}`, {
162
+ ...own.permission ? { permission: own.permission } : {}
163
+ }), app.errors);
164
+ const traceparent = ctx?.mcpReq?._meta?.traceparent;
165
+ const env = typeof traceparent === "string" ? { ...context.env, TRACEPARENT: traceparent } : context.env;
166
+ const answer = await runCommandForAgent(program, one.path, input, {
167
+ profile: settings.profile,
168
+ readOnly: readOnly(),
169
+ env,
170
+ levels,
171
+ overrides,
172
+ authority,
173
+ fetches,
174
+ permissions: options.permissions,
175
+ environment: passed
176
+ });
177
+ if ("error" in answer)
178
+ return mcpErrorResult(JSON.parse(agentJson(answer.error)));
179
+ try {
180
+ return answered(envelope(one.command, answer.result), DEFAULT_OUTPUT_BYTES, targets);
181
+ } catch (error) {
182
+ return failed(error, app.errors);
183
+ }
184
+ }, "run")
185
+ }
186
+ ]));
187
+ const skills = options.skill ? skillResources(app, options.skill) : [];
188
+ const skill = skills[0];
189
+ const build = /* @__PURE__ */ __name(() => {
190
+ const server = new McpServer({ name: app.command, version: app.version }, {
191
+ instructions: appInstructions({
192
+ command: app.command,
193
+ name: options.name,
194
+ profile: settings.profile,
195
+ untrusted: options.untrusted,
196
+ ...skill ? { skill: skill.instruction } : {}
197
+ })
198
+ });
199
+ registerCommands(server, app.command, commands, app.errors, void 0, app.messenger);
200
+ for (const { uri, name, title, description, mimeType, read } of skills)
201
+ server.registerResource(name, uri, { title, description, mimeType }, read);
202
+ return server;
203
+ }, "build");
204
+ return { build, offered: Object.keys(commands) };
205
+ }, "createAppServer");
206
+ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options) => {
207
+ const { build } = createAppServer(command, context, options);
208
+ const { stdin, stdout, signal } = environmentOf(command);
209
+ const own = stdin && stdout && stdin !== process.stdin;
210
+ const wire = answeredWire(own ? stdin : process.stdin, own ? stdout : process.stdout);
211
+ const handle = serveStdio(build, {
212
+ transport: new StdioServerTransport(wire.input, wire.output),
213
+ onerror: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onerror")
214
+ });
215
+ await wire.finished(own ? signal : void 0);
216
+ wire.release();
217
+ await handle.close();
218
+ }, "serveAppOverStdio");
219
+ var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
220
+ const { app } = options;
221
+ const { build } = createAppServer(command, context, options);
222
+ const { serveOverHttp } = await import("./serve-B6UANKXN.js");
223
+ const listening = await serveOverHttp(build, {
224
+ ...http,
225
+ appName: app.command,
226
+ reaches: `your ${options.name}`,
227
+ onCode: /* @__PURE__ */ __name((code, expires) => context.renderer.note(context.env[mcpHttpMarker(app.envPrefix)] === void 0 ? `login code for a new browser app: ${code} (until ${expires.toTimeString().slice(0, 5)}; a new one after each login)` : `a new login code for a browser app: \`${app.command} ${context.settings.profile} mcp server status\``), "onCode"),
228
+ onError: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onError")
229
+ }).catch((error) => {
230
+ if (error.code === "EADDRINUSE")
231
+ throw new CliError("configuration_error", `port ${http.port} is in use \u2014 pass another with --port`);
232
+ throw error;
233
+ });
234
+ context.renderer.note(`serving on ${listening.url.href} \u2014 point your tunnel at it; connectors use ${mcpUrlOf(http.publicUrl).href}`);
235
+ await new Promise((resolve) => {
236
+ process.once("SIGINT", resolve);
237
+ process.once("SIGTERM", resolve);
238
+ });
239
+ await listening.close();
240
+ }, "serveAppOverHttp");
241
+ export {
242
+ createAppServer,
243
+ serveAppOverHttp,
244
+ serveAppOverStdio
245
+ };