@wirecat/yandex-disk-cli 0.0.0-stage → 0.1.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 (235) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +204 -0
  3. package/README.md +243 -2
  4. package/contracts/wirecat.json +1554 -0
  5. package/dist/bin/ydisk.d.ts +3 -0
  6. package/dist/bin/ydisk.d.ts.map +1 -0
  7. package/dist/bin/ydisk.js +40 -0
  8. package/dist/bin/ydisk.js.map +1 -0
  9. package/dist/bundle/all-profiles-4OLZF3RT.js +279 -0
  10. package/dist/bundle/anthropic-DKB4OJXZ.js +91 -0
  11. package/dist/bundle/app-server-G4545SSV.js +247 -0
  12. package/dist/bundle/bun-RXEQKFED.js +169 -0
  13. package/dist/bundle/bun-sqlite-VHT5LN7U.js +76 -0
  14. package/dist/bundle/chunk-2BITUXGC.js +12289 -0
  15. package/dist/bundle/chunk-2CLWDQKA.js +39330 -0
  16. package/dist/bundle/chunk-2JFDOPKA.js +9575 -0
  17. package/dist/bundle/chunk-3GVI2MAO.js +106 -0
  18. package/dist/bundle/chunk-3SZBWBMI.js +131 -0
  19. package/dist/bundle/chunk-44VSEXW6.js +4054 -0
  20. package/dist/bundle/chunk-4YPRRQBE.js +95 -0
  21. package/dist/bundle/chunk-5COYRL5B.js +379 -0
  22. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  23. package/dist/bundle/chunk-5DM7DIZL.js +1402 -0
  24. package/dist/bundle/chunk-6R2DVTVZ.js +24 -0
  25. package/dist/bundle/chunk-762BS35H.js +2787 -0
  26. package/dist/bundle/chunk-AG64V7AB.js +1233 -0
  27. package/dist/bundle/chunk-BC5HGIXB.js +334 -0
  28. package/dist/bundle/chunk-BH7LFEX7.js +36 -0
  29. package/dist/bundle/chunk-BLNPGY7N.js +53 -0
  30. package/dist/bundle/chunk-CNIA2LJF.js +372 -0
  31. package/dist/bundle/chunk-COSXMDC7.js +230 -0
  32. package/dist/bundle/chunk-D72URWJE.js +532 -0
  33. package/dist/bundle/chunk-D7FO33KU.js +785 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DJH26PQ3.js +1396 -0
  36. package/dist/bundle/chunk-DJPT7IUC.js +64567 -0
  37. package/dist/bundle/chunk-DTMSCZDW.js +209 -0
  38. package/dist/bundle/chunk-E6LGZ5LX.js +16 -0
  39. package/dist/bundle/chunk-E6YRIHS5.js +92 -0
  40. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  41. package/dist/bundle/chunk-F3DDSZTF.js +78 -0
  42. package/dist/bundle/chunk-F4WWTQNL.js +188 -0
  43. package/dist/bundle/chunk-FDDAUASC.js +1028 -0
  44. package/dist/bundle/chunk-FMNPG6N2.js +170 -0
  45. package/dist/bundle/chunk-FOKJ4POB.js +274 -0
  46. package/dist/bundle/chunk-G22C7JG6.js +731 -0
  47. package/dist/bundle/chunk-GA442SYZ.js +161 -0
  48. package/dist/bundle/chunk-GEBSW7UK.js +6848 -0
  49. package/dist/bundle/chunk-GGRKWAOK.js +594 -0
  50. package/dist/bundle/chunk-HHINRNZA.js +788 -0
  51. package/dist/bundle/chunk-HUZCL33L.js +128 -0
  52. package/dist/bundle/chunk-IALSIQVT.js +142 -0
  53. package/dist/bundle/chunk-IOXR2QBX.js +398 -0
  54. package/dist/bundle/chunk-J5CXR6VX.js +63 -0
  55. package/dist/bundle/chunk-J5PWSTOX.js +82 -0
  56. package/dist/bundle/chunk-J7BVAEHR.js +364 -0
  57. package/dist/bundle/chunk-JH46HMZW.js +1334 -0
  58. package/dist/bundle/chunk-JOBO7F6W.js +52 -0
  59. package/dist/bundle/chunk-JXZ5B3L5.js +2333 -0
  60. package/dist/bundle/chunk-KBIAMDZN.js +66 -0
  61. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  62. package/dist/bundle/chunk-LNHTLSR5.js +288 -0
  63. package/dist/bundle/chunk-M24RAKMJ.js +58 -0
  64. package/dist/bundle/chunk-MDQ57Q3H.js +1197 -0
  65. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  66. package/dist/bundle/chunk-MLXQ4X5L.js +206 -0
  67. package/dist/bundle/chunk-NQAKARHE.js +54 -0
  68. package/dist/bundle/chunk-OF7VVUDQ.js +23 -0
  69. package/dist/bundle/chunk-OQVPE3XK.js +324 -0
  70. package/dist/bundle/chunk-OR3QG7UR.js +259 -0
  71. package/dist/bundle/chunk-OUUYVROP.js +76 -0
  72. package/dist/bundle/chunk-PQBAM64O.js +168 -0
  73. package/dist/bundle/chunk-PYVIA7WF.js +88 -0
  74. package/dist/bundle/chunk-Q6HK3PHE.js +72 -0
  75. package/dist/bundle/chunk-QB3KECV2.js +218 -0
  76. package/dist/bundle/chunk-QGWXSFYN.js +73 -0
  77. package/dist/bundle/chunk-RC5QAAAE.js +29 -0
  78. package/dist/bundle/chunk-RMJ26HLB.js +18 -0
  79. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  80. package/dist/bundle/chunk-T7ZUDA4C.js +72 -0
  81. package/dist/bundle/chunk-TRCSMVV5.js +72 -0
  82. package/dist/bundle/chunk-UD2BQEKA.js +46 -0
  83. package/dist/bundle/chunk-V4TL55GS.js +1068 -0
  84. package/dist/bundle/chunk-VJNWN5VU.js +4072 -0
  85. package/dist/bundle/chunk-VRRNBLMA.js +1227 -0
  86. package/dist/bundle/chunk-WUCMMNFJ.js +771 -0
  87. package/dist/bundle/chunk-XDESE3NY.js +44 -0
  88. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  91. package/dist/bundle/chunk-Z2QEON7B.js +2275 -0
  92. package/dist/bundle/chunk-ZMJ56GME.js +7 -0
  93. package/dist/bundle/chunk-ZTSB3D7Q.js +100 -0
  94. package/dist/bundle/chunk-ZVJWD3FK.js +38 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-YIOYGPJA.js +40 -0
  97. package/dist/bundle/command-server-entry-MHBQDXS4.js +169 -0
  98. package/dist/bundle/decode-NUGJIOUW.js +297 -0
  99. package/dist/bundle/definitions-AILHKEQT.js +2005 -0
  100. package/dist/bundle/dispatch-5LC4UEGY.js +411 -0
  101. package/dist/bundle/dist-4I2W6X2I.js +7577 -0
  102. package/dist/bundle/echarts-MHSH6PGC.js +42501 -0
  103. package/dist/bundle/embed-ZDXTHHYS.js +38 -0
  104. package/dist/bundle/embedder-XFEELFUL.js +111 -0
  105. package/dist/bundle/failure-5S7VPBYK.js +25 -0
  106. package/dist/bundle/first-run-JHCHT3RJ.js +29 -0
  107. package/dist/bundle/first-screen-FHGQ6QRV.js +40 -0
  108. package/dist/bundle/instructions-WKSMBUFX.js +11 -0
  109. package/dist/bundle/mcp-HS2ZDUVR.js +167 -0
  110. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  111. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  112. package/dist/bundle/meeting-combined-K4U4NYRZ.js +25 -0
  113. package/dist/bundle/meeting-model-KCEG6Y5O.js +26 -0
  114. package/dist/bundle/meeting-semantic-VYGSV3H6.js +22 -0
  115. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  116. package/dist/bundle/node-CM6NC6UE.js +176 -0
  117. package/dist/bundle/node-KM3CUABH.js +2340 -0
  118. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  119. package/dist/bundle/node-sqlite-5YDQ3LIJ.js +74 -0
  120. package/dist/bundle/notes-search-PGO7KM2U.js +62 -0
  121. package/dist/bundle/oauth-NY4C5UCK.js +20 -0
  122. package/dist/bundle/open-YNUTA6ZE.js +23 -0
  123. package/dist/bundle/openai-4CVT5PHH.js +241 -0
  124. package/dist/bundle/process-2XT3TL27.js +91 -0
  125. package/dist/bundle/program-FMIVF5T6.js +31904 -0
  126. package/dist/bundle/prompt-VNWY3H6S.js +17 -0
  127. package/dist/bundle/recognize-JS4PBPSZ.js +26 -0
  128. package/dist/bundle/remote-RCLFH4V2.js +32 -0
  129. package/dist/bundle/rerank-EG6VKYGO.js +52 -0
  130. package/dist/bundle/schemas-ED2LHKXK.js +645 -0
  131. package/dist/bundle/serve-AHG25QXB.js +199 -0
  132. package/dist/bundle/server-5FTB7WM3.js +78 -0
  133. package/dist/bundle/server-JNZVSAZE.js +209 -0
  134. package/dist/bundle/sqlite-runtime-XSZOAQPF.js +20 -0
  135. package/dist/bundle/state-XGVAJFF7.js +36 -0
  136. package/dist/bundle/store-OHSCWZEV.js +177 -0
  137. package/dist/bundle/store-PKSPKJXL.js +293 -0
  138. package/dist/bundle/store-maintenance-command-KAWGBSWK.js +69 -0
  139. package/dist/bundle/ydisk.js +183 -0
  140. package/dist/commands/api.d.ts +9 -0
  141. package/dist/commands/api.d.ts.map +1 -0
  142. package/dist/commands/api.js +59 -0
  143. package/dist/commands/api.js.map +1 -0
  144. package/dist/commands/comments.d.ts +3 -0
  145. package/dist/commands/comments.d.ts.map +1 -0
  146. package/dist/commands/comments.js +114 -0
  147. package/dist/commands/comments.js.map +1 -0
  148. package/dist/commands/files.d.ts +3 -0
  149. package/dist/commands/files.d.ts.map +1 -0
  150. package/dist/commands/files.js +272 -0
  151. package/dist/commands/files.js.map +1 -0
  152. package/dist/commands/library.d.ts +13 -0
  153. package/dist/commands/library.d.ts.map +1 -0
  154. package/dist/commands/library.js +118 -0
  155. package/dist/commands/library.js.map +1 -0
  156. package/dist/commands/session.d.ts +3 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +99 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +18 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +62 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +80 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +77 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/generated/definitions.d.ts +3 -0
  169. package/dist/generated/definitions.d.ts.map +1 -0
  170. package/dist/generated/definitions.js +2001 -0
  171. package/dist/generated/definitions.js.map +1 -0
  172. package/dist/generated/manifest.d.ts +6 -0
  173. package/dist/generated/manifest.d.ts.map +1 -0
  174. package/dist/generated/manifest.js +1473 -0
  175. package/dist/generated/manifest.js.map +1 -0
  176. package/dist/generated/schemas.d.ts +127 -0
  177. package/dist/generated/schemas.d.ts.map +1 -0
  178. package/dist/generated/schemas.js +545 -0
  179. package/dist/generated/schemas.js.map +1 -0
  180. package/dist/generated/types.d.ts +829 -0
  181. package/dist/generated/types.d.ts.map +1 -0
  182. package/dist/generated/types.js +5 -0
  183. package/dist/generated/types.js.map +1 -0
  184. package/dist/identity.d.ts +10 -0
  185. package/dist/identity.d.ts.map +1 -0
  186. package/dist/identity.js +33 -0
  187. package/dist/identity.js.map +1 -0
  188. package/dist/index.d.ts +3 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +3 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/program.d.ts +6 -0
  193. package/dist/program.d.ts.map +1 -0
  194. package/dist/program.js +65 -0
  195. package/dist/program.js.map +1 -0
  196. package/dist/sample/comments.d.ts +61 -0
  197. package/dist/sample/comments.d.ts.map +1 -0
  198. package/dist/sample/comments.js +39 -0
  199. package/dist/sample/comments.js.map +1 -0
  200. package/dist/sample/records.d.ts +16 -0
  201. package/dist/sample/records.d.ts.map +1 -0
  202. package/dist/sample/records.js +22 -0
  203. package/dist/sample/records.js.map +1 -0
  204. package/dist/sample/transport.d.ts +42 -0
  205. package/dist/sample/transport.d.ts.map +1 -0
  206. package/dist/sample/transport.js +153 -0
  207. package/dist/sample/transport.js.map +1 -0
  208. package/dist/version.d.ts +2 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +2 -0
  211. package/dist/version.js.map +1 -0
  212. package/dist/wcat.d.ts +3 -0
  213. package/dist/wcat.d.ts.map +1 -0
  214. package/dist/wcat.js +4 -0
  215. package/dist/wcat.js.map +1 -0
  216. package/dist/yandex/source.d.ts +39 -0
  217. package/dist/yandex/source.d.ts.map +1 -0
  218. package/dist/yandex/source.js +189 -0
  219. package/dist/yandex/source.js.map +1 -0
  220. package/dist/yandex/transport.d.ts +41 -0
  221. package/dist/yandex/transport.d.ts.map +1 -0
  222. package/dist/yandex/transport.js +152 -0
  223. package/dist/yandex/transport.js.map +1 -0
  224. package/dist/yandex/writes.d.ts +27 -0
  225. package/dist/yandex/writes.d.ts.map +1 -0
  226. package/dist/yandex/writes.js +61 -0
  227. package/dist/yandex/writes.js.map +1 -0
  228. package/package.json +88 -4
  229. package/skills/yandex-disk-cli/SKILL.md +46 -0
  230. package/skills/yandex-disk-cli/references/api/api-disk-operations-operation-id.md +13 -0
  231. package/skills/yandex-disk-cli/references/api/api-disk-public-resources.md +50 -0
  232. package/skills/yandex-disk-cli/references/api/api-disk-resources.md +171 -0
  233. package/skills/yandex-disk-cli/references/api/api-disk-trash-resources.md +48 -0
  234. package/skills/yandex-disk-cli/references/api/api-disk.md +13 -0
  235. package/skills/yandex-disk-cli/references/api.md +17 -0
@@ -0,0 +1,63 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/background/processes.js
8
+ import { execFileSync } from "node:child_process";
9
+ import { readdirSync, readFileSync, readlinkSync } from "node:fs";
10
+ var alive = /* @__PURE__ */ __name((pid) => {
11
+ try {
12
+ process.kill(pid, 0);
13
+ return true;
14
+ } catch (error) {
15
+ return error.code === "EPERM";
16
+ }
17
+ }, "alive");
18
+ var carries = /* @__PURE__ */ __name((pid, marker) => {
19
+ if (pid <= 0 || !alive(pid))
20
+ return false;
21
+ try {
22
+ if (process.platform === "linux") {
23
+ return readFileSync(`/proc/${pid}/environ`, "latin1").split("\0").some((entry) => entry.endsWith(marker));
24
+ }
25
+ if (process.platform === "darwin") {
26
+ return execFileSync("ps", ["eww", "-o", "command=", "-p", String(pid)], { encoding: "utf8" }).includes(marker);
27
+ }
28
+ } catch {
29
+ return false;
30
+ }
31
+ return false;
32
+ }, "carries");
33
+ var holdersOf = /* @__PURE__ */ __name((paths) => {
34
+ if (process.platform === "linux") {
35
+ const wanted = new Set(paths);
36
+ return readdirSync("/proc").filter((entry) => /^\d+$/.test(entry) && Number(entry) !== process.pid).filter((pid) => {
37
+ try {
38
+ return readdirSync(`/proc/${pid}/fd`).some((fd) => {
39
+ try {
40
+ return wanted.has(readlinkSync(`/proc/${pid}/fd/${fd}`));
41
+ } catch {
42
+ return false;
43
+ }
44
+ });
45
+ } catch {
46
+ return false;
47
+ }
48
+ }).map(Number);
49
+ }
50
+ const pids = /* @__PURE__ */ __name((listed) => listed.split("\n").filter(Boolean).map(Number).filter((pid) => pid !== process.pid), "pids");
51
+ try {
52
+ return pids(execFileSync("lsof", ["-t", "--", ...paths], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }));
53
+ } catch (error) {
54
+ const { status, stdout } = error;
55
+ return status === 1 ? pids(stdout ?? "") : void 0;
56
+ }
57
+ }, "holdersOf");
58
+
59
+ export {
60
+ alive,
61
+ carries,
62
+ holdersOf
63
+ };
@@ -0,0 +1,82 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError
5
+ } from "./chunk-T7ZUDA4C.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-ZVVMGPBJ.js";
9
+
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
11
+ var MAX_BUFFERED_INPUT = 16 * 1024 * 1024;
12
+ var MAX_SECRET_INPUT = 64 * 1024;
13
+ var policies = /* @__PURE__ */ new WeakMap();
14
+ var inputPolicy = /* @__PURE__ */ __name((input) => policies.get(input) ?? {}, "inputPolicy");
15
+ var provideInputPolicy = /* @__PURE__ */ __name((input, policy) => {
16
+ const previous = policies.get(input);
17
+ policies.set(input, policy);
18
+ return () => {
19
+ if (previous)
20
+ policies.set(input, previous);
21
+ else
22
+ policies.delete(input);
23
+ };
24
+ }, "provideInputPolicy");
25
+ var bufferedInput = /* @__PURE__ */ __name((input, options = {}) => {
26
+ const policy = inputPolicy(input);
27
+ const maxBytes = options.maxBytes ?? policy.maxBytes ?? MAX_BUFFERED_INPUT;
28
+ const signals = [options.signal, policy.signal].filter((one) => one !== void 0);
29
+ const signal = signals.length ? AbortSignal.any(signals) : void 0;
30
+ const state = input;
31
+ if (state.readableEnded)
32
+ return Promise.resolve(Buffer.alloc(0));
33
+ if (state.destroyed)
34
+ return Promise.reject(new CliError("validation_error", "input closed before EOF", { reason: "input.closed" }));
35
+ return new Promise((resolve, reject) => {
36
+ const chunks = [];
37
+ let bytes = 0;
38
+ const cleanup = /* @__PURE__ */ __name(() => {
39
+ input.off("data", data).off("end", end).off("error", error).off("close", closed);
40
+ signal?.removeEventListener("abort", aborted);
41
+ input.pause();
42
+ }, "cleanup");
43
+ const error = /* @__PURE__ */ __name((cause) => {
44
+ cleanup();
45
+ reject(cause);
46
+ }, "error");
47
+ const aborted = /* @__PURE__ */ __name(() => error(new CliError("cancelled", "input cancelled", { retryable: false })), "aborted");
48
+ const closed = /* @__PURE__ */ __name(() => error(new CliError("validation_error", "input closed before EOF", { reason: "input.closed" })), "closed");
49
+ const end = /* @__PURE__ */ __name(() => {
50
+ cleanup();
51
+ resolve(Buffer.concat(chunks, bytes));
52
+ }, "end");
53
+ const data = /* @__PURE__ */ __name((chunk) => {
54
+ const buffer = Buffer.from(chunk);
55
+ bytes += buffer.length;
56
+ if (bytes > maxBytes) {
57
+ error(new CliError("validation_error", `buffered input exceeds ${maxBytes} bytes \u2014 use a smaller input or --max-input-bytes`, {
58
+ reason: "input.too-large",
59
+ max_bytes: maxBytes,
60
+ retryable: false
61
+ }));
62
+ return;
63
+ }
64
+ chunks.push(buffer);
65
+ }, "data");
66
+ if (signal?.aborted) {
67
+ aborted();
68
+ return;
69
+ }
70
+ input.on("data", data).once("end", end).once("error", error).once("close", closed);
71
+ signal?.addEventListener("abort", aborted, { once: true });
72
+ input.resume();
73
+ });
74
+ }, "bufferedInput");
75
+
76
+ export {
77
+ MAX_BUFFERED_INPUT,
78
+ MAX_SECRET_INPUT,
79
+ inputPolicy,
80
+ provideInputPolicy,
81
+ bufferedInput
82
+ };
@@ -0,0 +1,364 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ secretNamed,
5
+ withoutSecrets
6
+ } from "./chunk-E6YRIHS5.js";
7
+ import {
8
+ isCliFailure
9
+ } from "./chunk-TRCSMVV5.js";
10
+ import {
11
+ isContentKey
12
+ } from "./chunk-762BS35H.js";
13
+ import {
14
+ __name
15
+ } from "./chunk-ZVVMGPBJ.js";
16
+
17
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/runs/run-context.js
18
+ import { AsyncLocalStorage } from "node:async_hooks";
19
+ import { createHash } from "node:crypto";
20
+
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
22
+ import { homedir } from "node:os";
23
+
24
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/runs/events.js
25
+ var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
26
+ var renderEvent = /* @__PURE__ */ __name((event) => {
27
+ if (event.event === "store")
28
+ return `${MARK.store} ${event.operation.padEnd(16)} ${event.table} ${event.op} ${event.n}`;
29
+ if (event.event === "progress")
30
+ return `${MARK.progress} ${event.operation.padEnd(16)} ${Object.entries(event.counts).map(([field, count]) => `${count} ${field}`).join(" ")}`;
31
+ if (event.event === "warning") {
32
+ const counts = Object.entries(event.counts ?? {}).map(([field, count]) => `${count} ${field}`);
33
+ return [`${MARK.warning} ${(event.operation ?? "").padEnd(16)} ${event.code}`, ...counts, event.detail].filter(Boolean).join(" ");
34
+ }
35
+ const parts = [];
36
+ if (event.event === "cache") {
37
+ parts.push(event.reason);
38
+ if (event.ageMs !== void 0)
39
+ parts.push(`cached ${age(event.ageMs)}`);
40
+ } else {
41
+ if (event.opcode !== void 0)
42
+ parts.push(`op ${event.opcode}`, `seq ${event.seq}`);
43
+ if (event.method !== void 0 || event.endpointTemplate !== void 0)
44
+ parts.push([event.method, event.endpointTemplate].filter(Boolean).join(" "));
45
+ if (event.status !== void 0)
46
+ parts.push(`${event.status}`);
47
+ if (event.attempt !== void 0 && event.attempt > 1)
48
+ parts.push(`attempt ${event.attempt}`);
49
+ if (event.waitMs !== void 0)
50
+ parts.push(`waited ${age(event.waitMs)}`);
51
+ }
52
+ if (event.ids)
53
+ for (const [name, value] of Object.entries(event.ids))
54
+ parts.push(`${name} ${value}`);
55
+ if (event.event !== "cache") {
56
+ if (event.durationMs !== void 0)
57
+ parts.push(`${event.durationMs}ms`);
58
+ if (event.bytes !== void 0)
59
+ parts.push(size(event.bytes));
60
+ }
61
+ if (event.counts)
62
+ for (const [field, count] of Object.entries(event.counts))
63
+ parts.push(`${count} ${field}`);
64
+ if (event.event !== "cache") {
65
+ if (event.errorCode)
66
+ parts.push(event.errorCode);
67
+ if (event.providerError)
68
+ parts.push(event.providerError);
69
+ }
70
+ return `${MARK[event.event]} ${event.operation.padEnd(16)} ${parts.join(" ")}`.trimEnd();
71
+ }, "renderEvent");
72
+ var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!", store: "+", progress: "\u2026" };
73
+ var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
74
+ var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
75
+
76
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
77
+ var MESSAGE_AT_MOST = 500;
78
+ var CAUSES_AT_MOST = 5;
79
+ var FRAMES_AT_MOST = 15;
80
+ var errorDetailOf = /* @__PURE__ */ __name((error, response) => {
81
+ const details = isCliFailure(error) ? { ...error.details } : {};
82
+ const thrown = error instanceof Error ? error : void 0;
83
+ const code = isCliFailure(error) ? error.code : codeOf(error);
84
+ const reason = typeof details.reason === "string" ? details.reason : void 0;
85
+ const causeCode = typeof details.cause_code === "string" && /^[A-Za-z0-9_.-]{1,40}$/.test(details.cause_code) ? details.cause_code : void 0;
86
+ const message = thrown ? redactText(thrown.message) : void 0;
87
+ const operation = stringOf(details.operation) ?? response?.operation;
88
+ const status = numberOf(details.status) ?? response?.status;
89
+ const method = stringOf(details.method) ?? response?.method;
90
+ const endpoint = stringOf(details.endpoint) ?? response?.endpointTemplate;
91
+ const key = providerErrorKey(details.provider_error) ?? providerErrorKey(response?.providerError);
92
+ const protocol = key !== void 0 && method === void 0 && endpoint === void 0;
93
+ const http = method !== void 0 || endpoint !== void 0 || status !== void 0 && !protocol ? {
94
+ ...method === void 0 ? {} : { method: method.toUpperCase().slice(0, 16) },
95
+ ...endpoint === void 0 ? {} : { endpoint_template: endpointTemplate(endpoint) },
96
+ ...status === void 0 ? {} : { status }
97
+ } : void 0;
98
+ const causes = causesOf(thrown?.cause ?? details.cause);
99
+ const stack = framesOf(thrown);
100
+ return {
101
+ class: classOf(error),
102
+ ...code === void 0 ? {} : { code },
103
+ ...reason === void 0 ? {} : { reason },
104
+ ...causeCode === void 0 ? {} : { cause_code: causeCode },
105
+ ...message ? { message } : {},
106
+ ...operation === void 0 ? {} : { operation },
107
+ ...http ? { http } : {},
108
+ ...key === void 0 ? {} : { provider: { key, ...protocol && status !== void 0 ? { code: status } : {} } },
109
+ ...causes.length > 0 ? { causes } : {},
110
+ ...stack.length > 0 ? { stack } : {}
111
+ };
112
+ }, "errorDetailOf");
113
+ var stringOf = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0, "stringOf");
114
+ var numberOf = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isInteger(value) ? value : void 0, "numberOf");
115
+ var classOf = /* @__PURE__ */ __name((error) => {
116
+ if (!(error instanceof Error))
117
+ return error === null ? "null" : typeof error;
118
+ const constructed = error.constructor?.name;
119
+ return constructed && constructed !== "Error" && constructed !== error.name ? constructed : error.name;
120
+ }, "classOf");
121
+ var codeOf = /* @__PURE__ */ __name((error) => {
122
+ const code = error?.code;
123
+ return typeof code === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(code) ? code : void 0;
124
+ }, "codeOf");
125
+ var causesOf = /* @__PURE__ */ __name((first) => {
126
+ const causes = [];
127
+ const seen = /* @__PURE__ */ new Set();
128
+ for (let cause = first; cause !== void 0 && cause !== null && causes.length < CAUSES_AT_MOST; ) {
129
+ if (seen.has(cause))
130
+ break;
131
+ seen.add(cause);
132
+ const message = cause instanceof Error ? redactText(cause.message) : void 0;
133
+ causes.push({ class: classOf(cause), ...message ? { message } : {} });
134
+ cause = cause instanceof Error ? cause.cause : void 0;
135
+ }
136
+ return causes;
137
+ }, "causesOf");
138
+ var framesOf = /* @__PURE__ */ __name((error, limit = FRAMES_AT_MOST) => {
139
+ const stack = error instanceof Error && typeof error.stack === "string" ? error.stack : "";
140
+ return stack.split("\n").filter((line) => line.trimStart().startsWith("at ")).flatMap((line) => {
141
+ const match = /^\s*at (?:async )?(?:(.+?) \()?(.+?):(\d+):\d+\)?$/.exec(line);
142
+ if (!match)
143
+ return [];
144
+ const [, fn, path = "", lineNumber] = match;
145
+ if (path.startsWith("node:"))
146
+ return [];
147
+ return [`${fn ?? "<anonymous>"} ${fileOf(path)}:${lineNumber}`];
148
+ }).slice(0, limit);
149
+ }, "framesOf");
150
+ var fileOf = /* @__PURE__ */ __name((path) => {
151
+ const plain = path.replace(/^file:\/\//, "");
152
+ const packaged = /\/node_modules\/((?:@[^/]+\/)?[^/]+\/.+)$/.exec(plain)?.[1];
153
+ if (packaged)
154
+ return packaged.replace(/\/(?:dist|src)\//, "/");
155
+ return /(?:^|\/)(?:dist|src)\/(.+)$/.exec(plain)?.[1] ?? plain.split("/").at(-1) ?? "?";
156
+ }, "fileOf");
157
+ var endpointTemplate = /* @__PURE__ */ __name((raw) => {
158
+ const trimmed = raw.trim().split(/[?#]/)[0] ?? "";
159
+ const origin = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/]*@)?([^/]*)/i.exec(trimmed);
160
+ const path = origin ? trimmed.slice(origin[0].length) : trimmed;
161
+ const scheme = origin ? `${trimmed.slice(0, trimmed.indexOf("://"))}://${origin[1]}` : "";
162
+ const parts = path.split("/");
163
+ const segments = parts.map((segment, at) => {
164
+ if (segment === "" || /^[:{].+/.test(segment))
165
+ return segment;
166
+ if (at >= 2 && parts[at - 2] === "rest" && /^\d+$/.test(parts[at - 1] ?? ""))
167
+ return ":token";
168
+ if (/^bot\d+:/.test(segment) || /^\d{6,}:[\w-]{20,}$/.test(segment))
169
+ return ":token";
170
+ if (/^-?\d+$/.test(segment) || /^[0-9a-f-]{16,}$/i.test(segment))
171
+ return ":id";
172
+ if (!/^[A-Za-z0-9._~-]{1,40}$/.test(segment))
173
+ return ":value";
174
+ return segment;
175
+ });
176
+ return `${scheme}${segments.join("/")}`.slice(0, 300);
177
+ }, "endpointTemplate");
178
+ var INTERNATIONAL_PHONE = /\+\d[\d\s()-]{6,}\d/.source;
179
+ var BARE_PHONE = /(^|[^\w-])\d{11,15}\b/.source;
180
+ var MESSENGER_ID = /\b\d+(?:-\d+)?(?::\d+)?@(?:s\.whatsapp\.net|g\.us|c\.us|lid|broadcast|newsletter)\b/g;
181
+ var redactText = /* @__PURE__ */ __name((text) => {
182
+ const home = homedir();
183
+ let out = home && home !== "/" ? text.split(home).join("~") : text;
184
+ out = withoutSecrets(out.replace(/"[^"\n]*"|“[^”\n]*”|«[^»\n]*»/g, '"[redacted]"')).replace(/\b(bearer|basic|token|key|password|secret)(\s*[:=]\s*|\s+)[^\s'"]+/gi, "$1$2[redacted]").replace(MESSENGER_ID, "[id]").replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g, "[email]").replace(new RegExp(INTERNATIONAL_PHONE, "g"), "[number]").replace(new RegExp(BARE_PHONE, "g"), "$1[number]").replace(/\bbot\d+:[\w-]+/g, "bot[token]").replace(/\b\d{6,}:[\w-]{20,}\b/g, "[token]").replace(/(\?|&)[^\s#]*/g, "$1[redacted]").replace(/\b[A-Za-z0-9_-]{40,}\b/g, "[redacted]");
185
+ return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
186
+ }, "redactText");
187
+
188
+ // node_modules/.pnpm/@wirecat+cli-core@0.692.0_@wirecat+cli-base@0.110.0_@scalar+openapi-upgrader@0.4.6_comm_daa46dda8170ab81fe68d59b38277e40/node_modules/@wirecat/cli-core/dist/runs/run-context.js
189
+ var REDACTED = "[redacted]";
190
+ var keepsSuccess = /* @__PURE__ */ __name(({ record, fromFlag, env, caller, persistent = false }) => {
191
+ if (!record)
192
+ return false;
193
+ if (fromFlag)
194
+ return true;
195
+ if (persistent)
196
+ return false;
197
+ return caller !== void 0 || viaOf(env) !== "desktop";
198
+ }, "keepsSuccess");
199
+ var calls = new AsyncLocalStorage();
200
+ var withCaller = /* @__PURE__ */ __name((caller, work) => calls.run(caller, work), "withCaller");
201
+ var currentCaller = /* @__PURE__ */ __name(() => calls.getStore(), "currentCaller");
202
+ var clientHash = /* @__PURE__ */ __name((id) => createHash("sha256").update(id).digest("hex").slice(0, 8), "clientHash");
203
+ var viaOf = /* @__PURE__ */ __name((env) => env.WIRECAT_CALLER?.trim() === "desktop" ? "desktop" : "cli", "viaOf");
204
+ var agentOf = /* @__PURE__ */ __name((env) => {
205
+ const named = env.AI_AGENT?.trim().split("_")[0];
206
+ const kind = (named && plainWord(named) ? named.toLowerCase() : void 0) ?? (env.CLAUDECODE ? "claude-code" : void 0) ?? (env.CODEX_THREAD_ID || env.CODEX_SESSION_ID || env.CODEX_SANDBOX ? "codex" : void 0) ?? (env.GEMINI_CLI ? "gemini-cli" : void 0) ?? (env.OPENCODE ? "opencode" : void 0) ?? (env.CURSOR_AGENT ? "cursor" : void 0) ?? // Only `exec` is the agent's own command: OpenClaw also sets `tui-local` for what the owner types in its TUI.
207
+ (env.OPENCLAW_SHELL?.trim() === "exec" ? "openclaw" : void 0);
208
+ if (!kind)
209
+ return void 0;
210
+ const session = sessionOf(kind, env);
211
+ return {
212
+ kind,
213
+ session_id: session && SESSION.test(session) ? session : null,
214
+ // OpenClaw passes the sender and chat ids of a chat-started run in this variable; only its presence is kept.
215
+ ...kind === "openclaw" && env.OPENCLAW_CHANNEL_CONTEXT?.trim() ? { from_chat: true } : {}
216
+ };
217
+ }, "agentOf");
218
+ var SESSION = /^[A-Za-z0-9._:-]{1,128}$/;
219
+ var SESSION_VARIABLE = {
220
+ "claude-code": "CLAUDE_CODE_SESSION_ID",
221
+ codex: "CODEX_THREAD_ID",
222
+ opencode: "OPENCODE_SESSION_ID",
223
+ "hermes-agent": "HERMES_SESSION_ID"
224
+ };
225
+ var sessionOf = /* @__PURE__ */ __name((kind, env) => {
226
+ const variable = SESSION_VARIABLE[kind];
227
+ return (variable === void 0 ? void 0 : env[variable]?.trim()) || void 0;
228
+ }, "sessionOf");
229
+ var plainWord = /* @__PURE__ */ __name((word) => /^[A-Za-z][A-Za-z0-9.-]{0,39}$/.test(word), "plainWord");
230
+ var secretInputs = /* @__PURE__ */ new WeakSet();
231
+ var secretInput = /* @__PURE__ */ __name((input) => {
232
+ secretInputs.add(input);
233
+ return input;
234
+ }, "secretInput");
235
+ var secretShaped = /* @__PURE__ */ __name((word) => /:\/\/[^/@\s:]+:[^/@\s]+@/.test(word) || /(^|[^A-Za-z0-9_-])[A-Za-z0-9_-]{40,}($|[^A-Za-z0-9_-])/.test(word), "secretShaped");
236
+ var withoutPhones = /* @__PURE__ */ __name((word) => word.replace(new RegExp(INTERNATIONAL_PHONE, "g"), REDACTED).replace(new RegExp(BARE_PHONE, "g"), `$1${REDACTED}`), "withoutPhones");
237
+ var maskArgv = /* @__PURE__ */ __name((program, words, { keep = false } = {}) => {
238
+ const argv = [];
239
+ let unknownCommand;
240
+ let current = program;
241
+ let positional = 0;
242
+ let profileSeen = false;
243
+ let lost = false;
244
+ const raw = /* @__PURE__ */ __name((word) => keep && !secretShaped(word) ? withoutPhones(withoutSecrets(word, REDACTED)) : REDACTED, "raw");
245
+ const keptValue = /* @__PURE__ */ __name((name, value, input) => keep ? input && secretInputs.has(input) || secretNamed(name) ? REDACTED : raw(value) : maskedValue(name, value, input?.argChoices), "keptValue");
246
+ const optionFor = /* @__PURE__ */ __name((flag) => {
247
+ for (let at = current; at; at = at.parent) {
248
+ const found = at.options.find((option) => option.long === flag || option.short === flag);
249
+ if (found)
250
+ return found;
251
+ }
252
+ return void 0;
253
+ }, "optionFor");
254
+ for (let at = 0; at < words.length; at++) {
255
+ const word = words[at];
256
+ if (word === "--") {
257
+ argv.push("--");
258
+ for (let after = at + 1; after < words.length; after++)
259
+ argv.push(raw(words[after]));
260
+ break;
261
+ }
262
+ if (word.startsWith("-") && word.length > 1 && !NUMBER.test(word)) {
263
+ const equals = word.indexOf("=");
264
+ const flag = equals > 0 ? word.slice(0, equals) : word;
265
+ if (!/^--?[A-Za-z0-9][A-Za-z0-9-]*$/.test(flag)) {
266
+ argv.push(raw(word));
267
+ continue;
268
+ }
269
+ const option = optionFor(flag);
270
+ const name = option?.attributeName() ?? flag.replace(/^-+/, "");
271
+ if (equals > 0) {
272
+ argv.push(`${flag}=${keptValue(name, word.slice(equals + 1), option)}`);
273
+ continue;
274
+ }
275
+ argv.push(flag);
276
+ if (!option && keep && secretNamed(name) && words[at + 1] !== void 0 && !words[at + 1]?.startsWith("-")) {
277
+ at += 1;
278
+ argv.push(REDACTED);
279
+ continue;
280
+ }
281
+ if (!option || !(option.required || option.optional))
282
+ continue;
283
+ const takes = /* @__PURE__ */ __name((next) => next !== void 0 && (option.required || !next.startsWith("-") || NUMBER.test(next)), "takes");
284
+ if (takes(words[at + 1])) {
285
+ at += 1;
286
+ argv.push(keptValue(name, words[at], option));
287
+ while (option.variadic && words[at + 1] !== void 0 && !words[at + 1].startsWith("-")) {
288
+ at += 1;
289
+ argv.push(keptValue(name, words[at], option));
290
+ }
291
+ }
292
+ continue;
293
+ }
294
+ if (!lost && positional === 0) {
295
+ const sub = current.commands.find((one) => one.name() === word || one.aliases().includes(word));
296
+ if (sub) {
297
+ argv.push(word);
298
+ current = sub;
299
+ continue;
300
+ }
301
+ if (current === program && !profileSeen) {
302
+ profileSeen = true;
303
+ argv.push(keep ? raw(word) : PROFILE.test(word) && withoutPhones(withoutSecrets(word)) === word ? word : REDACTED);
304
+ continue;
305
+ }
306
+ if (current.commands.length > 0 && current.registeredArguments.length === 0) {
307
+ lost = true;
308
+ unknownCommand = commandLike(word);
309
+ argv.push(keep ? raw(word) : unknownCommand);
310
+ continue;
311
+ }
312
+ }
313
+ const declared = lost ? void 0 : current.registeredArguments;
314
+ const argument = declared?.[Math.min(positional, declared.length - 1)];
315
+ positional += 1;
316
+ argv.push(secretInputs.has(current) ? REDACTED : argument ? keptValue(argument.name(), word, argument) : raw(word));
317
+ }
318
+ return { argv, ...unknownCommand === void 0 ? {} : { unknownCommand } };
319
+ }, "maskArgv");
320
+ var NUMBER = /^-?\d+(\.\d+)?$/;
321
+ var PROFILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
322
+ var commandLike = /* @__PURE__ */ __name((word) => /^[a-z][a-z0-9-]{0,31}$/i.test(word) && withoutSecrets(word) === word ? word : REDACTED, "commandLike");
323
+ var maskedValue = /* @__PURE__ */ __name((name, value, choices) => {
324
+ if (isContentKey(name))
325
+ return REDACTED;
326
+ if (name === "profile")
327
+ return PROFILE.test(value) ? value : REDACTED;
328
+ if (name === "json" || name === "fields")
329
+ return /^[a-z0-9_.,]{1,200}$/.test(value) ? value : REDACTED;
330
+ if (choices?.includes(value))
331
+ return value;
332
+ return safeShape(value) ? value : REDACTED;
333
+ }, "maskedValue");
334
+ var safeShape = /* @__PURE__ */ __name((value) => NUMBER.test(value) && !/^\d{11,}$/.test(value) || /^\d+(ms|s|m|h|d|w)$/.test(value) || /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/.test(value) || value === "true" || value === "false", "safeShape");
335
+ var runContextOf = /* @__PURE__ */ __name(({ bin, command, program, argv, env, recordInput = false, caller }) => {
336
+ const masked = program && argv ? maskArgv(program, argv, { keep: recordInput === true }) : void 0;
337
+ const ifFailed = program && argv && recordInput === "failed" ? maskArgv(program, argv, { keep: true }) : void 0;
338
+ const agent = caller ? caller.agent : agentOf(env);
339
+ return {
340
+ cliCommand: command ? `${bin} ${command}` : bin,
341
+ ...masked ? { argv: masked.argv } : {},
342
+ ...ifFailed ? { argvIfFailed: ifFailed.argv } : {},
343
+ ...masked?.unknownCommand === void 0 ? {} : { unknownCommand: masked.unknownCommand },
344
+ ...agent ? { agent } : {},
345
+ via: caller?.via ?? viaOf(env),
346
+ ...caller?.mcp ? { mcp: caller.mcp } : {}
347
+ };
348
+ }, "runContextOf");
349
+
350
+ export {
351
+ providerErrorKey,
352
+ renderEvent,
353
+ errorDetailOf,
354
+ framesOf,
355
+ endpointTemplate,
356
+ keepsSuccess,
357
+ withCaller,
358
+ currentCaller,
359
+ clientHash,
360
+ agentOf,
361
+ secretInput,
362
+ maskArgv,
363
+ runContextOf
364
+ };