@wirecat/zoom-cli 0.55.0 → 0.57.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 (170) hide show
  1. package/README.md +4 -4
  2. package/dist/bin/zm.js +35 -5
  3. package/dist/bundle/all-profiles-EKHWTGOY.js +25 -0
  4. package/dist/bundle/answer-policy-KH2IFXPN.js +96 -0
  5. package/dist/bundle/anthropic-VL54IUGF.js +70 -0
  6. package/dist/bundle/bun-ADJVI4HY.js +169 -0
  7. package/dist/bundle/bun-sqlite-2SDA3YOT.js +69 -0
  8. package/dist/bundle/chunk-2IKY7VBH.js +9 -0
  9. package/dist/bundle/chunk-2WOGZDZG.js +431 -0
  10. package/dist/bundle/chunk-4R7HYNZS.js +73 -0
  11. package/dist/bundle/chunk-4VCA7QU3.js +538 -0
  12. package/dist/bundle/chunk-4YLS4YLS.js +29 -0
  13. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  14. package/dist/bundle/chunk-5F7IOESV.js +281 -0
  15. package/dist/bundle/chunk-5QESMCQK.js +122 -0
  16. package/dist/bundle/chunk-6M6FJV5D.js +138 -0
  17. package/dist/bundle/chunk-6MX5T6AQ.js +17 -0
  18. package/dist/bundle/chunk-6P3YHT54.js +385 -0
  19. package/dist/bundle/chunk-7A6PZUDR.js +938 -0
  20. package/dist/bundle/chunk-7GUG6UZS.js +884 -0
  21. package/dist/bundle/chunk-7JZJMHQY.js +487 -0
  22. package/dist/bundle/chunk-A4ETXPMZ.js +98 -0
  23. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  24. package/dist/bundle/chunk-AE4BOXH7.js +5292 -0
  25. package/dist/bundle/chunk-AN3GVZTU.js +76 -0
  26. package/dist/bundle/chunk-BAYNCCNM.js +215 -0
  27. package/dist/bundle/chunk-BW2WPOXP.js +166 -0
  28. package/dist/bundle/chunk-BW52AJ4R.js +3387 -0
  29. package/dist/bundle/chunk-CB5UTASG.js +18 -0
  30. package/dist/bundle/chunk-CLMXBW53.js +1028 -0
  31. package/dist/bundle/chunk-DCTXOMOR.js +35 -0
  32. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  33. package/dist/bundle/chunk-EOQFWJJD.js +1095 -0
  34. package/dist/bundle/chunk-G4R4ZIGD.js +3569 -0
  35. package/dist/bundle/chunk-G4VZDINN.js +161 -0
  36. package/dist/bundle/chunk-GARCOIB6.js +409 -0
  37. package/dist/bundle/chunk-GKMGS7G5.js +1938 -0
  38. package/dist/bundle/chunk-HCNMFFG3.js +82 -0
  39. package/dist/bundle/chunk-HG5KRV55.js +1970 -0
  40. package/dist/bundle/chunk-HKYLSIZ2.js +82 -0
  41. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  42. package/dist/bundle/chunk-I4VQDXFR.js +100 -0
  43. package/dist/bundle/chunk-ICSKEDPI.js +36139 -0
  44. package/dist/bundle/chunk-IP4OK7RQ.js +24 -0
  45. package/dist/bundle/chunk-IVQ6342B.js +2 -0
  46. package/dist/bundle/chunk-K72SEMYI.js +160 -0
  47. package/dist/bundle/chunk-LHRCJYFC.js +19 -0
  48. package/dist/bundle/chunk-LPTIQLDW.js +192 -0
  49. package/dist/bundle/chunk-LQ3T2ZIX.js +124 -0
  50. package/dist/bundle/chunk-LSVI3A5X.js +836 -0
  51. package/dist/bundle/chunk-LW2G4U6W.js +570 -0
  52. package/dist/bundle/chunk-LXB6ONWC.js +3517 -0
  53. package/dist/bundle/chunk-LY26NW3I.js +6848 -0
  54. package/dist/bundle/chunk-MAEFLDHG.js +6092 -0
  55. package/dist/bundle/chunk-MZH4GDR4.js +45 -0
  56. package/dist/bundle/chunk-NN5B24KP.js +1109 -0
  57. package/dist/bundle/chunk-NO7CJEYV.js +22 -0
  58. package/dist/bundle/chunk-NTDWAAGL.js +18435 -0
  59. package/dist/bundle/chunk-NW3X3G5X.js +264 -0
  60. package/dist/bundle/chunk-O66V2WHK.js +48 -0
  61. package/dist/bundle/chunk-OCGPZHXW.js +25 -0
  62. package/dist/bundle/chunk-OIHDCGV4.js +151 -0
  63. package/dist/bundle/chunk-OVSWVPXL.js +8190 -0
  64. package/dist/bundle/chunk-PIN5RZ3D.js +63 -0
  65. package/dist/bundle/chunk-QLIB3PEC.js +1146 -0
  66. package/dist/bundle/chunk-QTR6D5HT.js +58 -0
  67. package/dist/bundle/chunk-QUJPQMHJ.js +2315 -0
  68. package/dist/bundle/chunk-R3HPOCZD.js +188 -0
  69. package/dist/bundle/chunk-RMV4C2YL.js +482 -0
  70. package/dist/bundle/chunk-RRRBMQ2E.js +844 -0
  71. package/dist/bundle/chunk-S4S7E54J.js +60 -0
  72. package/dist/bundle/chunk-SB6WOSHG.js +1109 -0
  73. package/dist/bundle/chunk-SE75DPBY.js +31 -0
  74. package/dist/bundle/chunk-SQJ7EH2D.js +97 -0
  75. package/dist/bundle/chunk-TKCHUT2H.js +422 -0
  76. package/dist/bundle/chunk-TLQUKHEM.js +193 -0
  77. package/dist/bundle/chunk-TZ2MKETI.js +100 -0
  78. package/dist/bundle/chunk-UC44ZMQV.js +78 -0
  79. package/dist/bundle/chunk-UI5UTMSZ.js +275 -0
  80. package/dist/bundle/chunk-VPPYYWOH.js +630 -0
  81. package/dist/bundle/chunk-WJHK5D7Z.js +35612 -0
  82. package/dist/bundle/chunk-WQ24UC44.js +239 -0
  83. package/dist/bundle/chunk-X5DFDGWS.js +2 -0
  84. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  85. package/dist/bundle/chunk-YB4DMKYX.js +119 -0
  86. package/dist/bundle/chunk-Z4TZ6TAF.js +288 -0
  87. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  88. package/dist/bundle/cli-72EQATJF.js +825 -0
  89. package/dist/bundle/command-contract-4MHSZUN3.js +38 -0
  90. package/dist/bundle/config-GFIJK6G2.js +79 -0
  91. package/dist/bundle/dist-IBNHCQXT.js +136 -0
  92. package/dist/bundle/dist-XUFQCJXW.js +7577 -0
  93. package/dist/bundle/echarts-RFTK737T.js +42501 -0
  94. package/dist/bundle/embed-7QYA2ZZE.js +35 -0
  95. package/dist/bundle/embedder-YNN6PCHG.js +108 -0
  96. package/dist/bundle/first-run-EVSRQKZJ.js +23 -0
  97. package/dist/bundle/first-screen-RG4GUKW7.js +36 -0
  98. package/dist/bundle/folders-JEPOMYM4.js +13 -0
  99. package/dist/bundle/instructions-FHNL7CMW.js +9 -0
  100. package/dist/bundle/main-NYGJXPH7.js +130 -0
  101. package/dist/bundle/mcp-IXFC2VVR.js +165 -0
  102. package/dist/bundle/mcp-VGSZDCKK.js +189 -0
  103. package/dist/bundle/mcp-XKP2PXLS.js +92 -0
  104. package/dist/bundle/meetings-IBPI4MM4.js +215 -0
  105. package/dist/bundle/node-P4E63KXA.js +2340 -0
  106. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  107. package/dist/bundle/node-ZMCACJVS.js +176 -0
  108. package/dist/bundle/node-sqlite-ZNGOBA5Q.js +45 -0
  109. package/dist/bundle/oauth-Q6LKF7DB.js +17 -0
  110. package/dist/bundle/open-LJ332Y5O.js +19 -0
  111. package/dist/bundle/output-file-RYQZ3RTE.js +63 -0
  112. package/dist/bundle/process-ZPTLNVQS.js +91 -0
  113. package/dist/bundle/program-IBRQBQ6W.js +5845 -0
  114. package/dist/bundle/prompt-RT7GUUXH.js +12 -0
  115. package/dist/bundle/recognize-QXGE7YJH.js +190 -0
  116. package/dist/bundle/remote-FD4MZQV3.js +26 -0
  117. package/dist/bundle/rerank-V6AVV755.js +49 -0
  118. package/dist/bundle/run-log-RE2EI3UU.js +111 -0
  119. package/dist/bundle/serve-HIJTFAW7.js +19 -0
  120. package/dist/bundle/server-3QOXOYYL.js +53 -0
  121. package/dist/bundle/server-WLJCU7KK.js +812 -0
  122. package/dist/bundle/services-KC5KQFBS.js +330 -0
  123. package/dist/bundle/speech-5JOXLYDA.js +44 -0
  124. package/dist/bundle/state-PPGRB3T6.js +33 -0
  125. package/dist/bundle/store-LODVDPK3.js +141 -0
  126. package/dist/bundle/store-WB5BICTG.js +124 -0
  127. package/dist/bundle/store-connection-EG6Z5ITP.js +76 -0
  128. package/dist/bundle/store-maintenance-command-Q5WMFUZ2.js +54 -0
  129. package/dist/bundle/streaming-UGFFNOXL.js +15 -0
  130. package/dist/bundle/tokens-AF5CPY2F.js +17 -0
  131. package/dist/bundle/zm.js +8 -0
  132. package/dist/commands.js +2 -2
  133. package/dist/commands.js.map +1 -1
  134. package/dist/config-issues.d.ts.map +1 -1
  135. package/dist/config-issues.js +3 -0
  136. package/dist/config-issues.js.map +1 -1
  137. package/dist/config.d.ts +3 -0
  138. package/dist/config.d.ts.map +1 -1
  139. package/dist/config.js +23 -0
  140. package/dist/config.js.map +1 -1
  141. package/dist/contract-overrides.d.ts.map +1 -1
  142. package/dist/contract-overrides.js +34 -45
  143. package/dist/contract-overrides.js.map +1 -1
  144. package/dist/first-screen.js +1 -1
  145. package/dist/first-screen.js.map +1 -1
  146. package/dist/mcp-command.d.ts +5 -3
  147. package/dist/mcp-command.d.ts.map +1 -1
  148. package/dist/mcp-command.js +73 -15
  149. package/dist/mcp-command.js.map +1 -1
  150. package/dist/program-bindings.d.ts.map +1 -1
  151. package/dist/program-bindings.js +1 -0
  152. package/dist/program-bindings.js.map +1 -1
  153. package/dist/recording-archive.d.ts.map +1 -1
  154. package/dist/recording-archive.js +9 -4
  155. package/dist/recording-archive.js.map +1 -1
  156. package/dist/remote-http.d.ts +2 -0
  157. package/dist/remote-http.d.ts.map +1 -1
  158. package/dist/remote-http.js +21 -11
  159. package/dist/remote-http.js.map +1 -1
  160. package/dist/request-events.d.ts +12 -0
  161. package/dist/request-events.d.ts.map +1 -1
  162. package/dist/request-events.js +56 -4
  163. package/dist/request-events.js.map +1 -1
  164. package/dist/run.d.ts.map +1 -1
  165. package/dist/run.js +4 -1
  166. package/dist/run.js.map +1 -1
  167. package/dist/version.d.ts +1 -1
  168. package/dist/version.js +1 -1
  169. package/package.json +7 -5
  170. package/skills/zoom-cli/SKILL.md +3 -1
@@ -0,0 +1,431 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ isCliFailure
5
+ } from "./chunk-NO7CJEYV.js";
6
+ import {
7
+ isContentKey
8
+ } from "./chunk-AE4BOXH7.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/runs/events.js
14
+ var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
15
+ var renderEvent = /* @__PURE__ */ __name((event) => {
16
+ if (event.event === "warning") {
17
+ const counts = Object.entries(event.counts ?? {}).map(([field, count]) => `${count} ${field}`);
18
+ return [`${MARK.warning} ${(event.operation ?? "").padEnd(16)} ${event.code}`, ...counts, event.detail].filter(Boolean).join(" ");
19
+ }
20
+ const parts = [];
21
+ if (event.event === "cache") {
22
+ parts.push(event.reason);
23
+ if (event.ageMs !== void 0)
24
+ parts.push(`cached ${age(event.ageMs)}`);
25
+ } else {
26
+ if (event.opcode !== void 0)
27
+ parts.push(`op ${event.opcode}`, `seq ${event.seq}`);
28
+ if (event.method !== void 0 || event.endpointTemplate !== void 0)
29
+ parts.push([event.method, event.endpointTemplate].filter(Boolean).join(" "));
30
+ if (event.status !== void 0)
31
+ parts.push(`${event.status}`);
32
+ if (event.attempt !== void 0 && event.attempt > 1)
33
+ parts.push(`attempt ${event.attempt}`);
34
+ if (event.waitMs !== void 0)
35
+ parts.push(`waited ${age(event.waitMs)}`);
36
+ }
37
+ if (event.ids)
38
+ for (const [name, value] of Object.entries(event.ids))
39
+ parts.push(`${name} ${value}`);
40
+ if (event.event !== "cache") {
41
+ if (event.durationMs !== void 0)
42
+ parts.push(`${event.durationMs}ms`);
43
+ if (event.bytes !== void 0)
44
+ parts.push(size(event.bytes));
45
+ }
46
+ if (event.counts)
47
+ for (const [field, count] of Object.entries(event.counts))
48
+ parts.push(`${count} ${field}`);
49
+ if (event.event !== "cache") {
50
+ if (event.errorCode)
51
+ parts.push(event.errorCode);
52
+ if (event.providerError)
53
+ parts.push(event.providerError);
54
+ }
55
+ return `${MARK[event.event]} ${event.operation.padEnd(16)} ${parts.join(" ")}`.trimEnd();
56
+ }, "renderEvent");
57
+ var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!" };
58
+ var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
59
+ var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
60
+
61
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/runs/run-context.js
62
+ import { AsyncLocalStorage } from "node:async_hooks";
63
+ import { createHash } from "node:crypto";
64
+
65
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
66
+ import { homedir } from "node:os";
67
+
68
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/runs/secrets.js
69
+ var SECRET_WORDS = /* @__PURE__ */ new Set([
70
+ "authorization",
71
+ "cookie",
72
+ "credential",
73
+ "credentials",
74
+ "passphrase",
75
+ "password",
76
+ "passwd",
77
+ "pwd",
78
+ "pass",
79
+ "passcode",
80
+ "pin",
81
+ "otp",
82
+ "2fa",
83
+ "secret",
84
+ "token",
85
+ "contrase\xF1a",
86
+ "contrasena",
87
+ "clave",
88
+ "\u043F\u0430\u0440\u043E\u043B\u044C",
89
+ "\u043F\u0438\u043D",
90
+ "\u043A\u043E\u0434",
91
+ ...["api", "auth", "service", "account", "db", "database", "priv", "private", "client"].map((word) => `${word}key`),
92
+ ...["db", "database", "key"].map((word) => `${word}pass`)
93
+ ]);
94
+ var secretNamed = /* @__PURE__ */ __name((name) => {
95
+ const words = name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_.-]+/).map((word) => word.toLowerCase());
96
+ return words.some((word, at) => SECRET_WORDS.has(word) || SECRET_WORDS.has(word + (words[at + 1] ?? "")));
97
+ }, "secretNamed");
98
+ var START = "(?<![A-Za-z0-9_-])";
99
+ var END = "(?![A-Za-z0-9_-])";
100
+ var KNOWN_TOKENS = new RegExp(`${[
101
+ "gh[pousr]_[A-Za-z0-9]{36,}",
102
+ "github_pat_[A-Za-z0-9_]{22,}",
103
+ "sk-[A-Za-z0-9_-]{20,}",
104
+ "xox[abprs]-[A-Za-z0-9-]{10,}",
105
+ "(?:AKIA|ASIA)[A-Z0-9]{16}",
106
+ "AIza[A-Za-z0-9_-]{35}",
107
+ "(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{10,}",
108
+ "npm_[A-Za-z0-9]{36}",
109
+ "eyJ[A-Za-z0-9_-]{5,}\\.eyJ[A-Za-z0-9_-]{5,}\\.[A-Za-z0-9_-]*"
110
+ ].map((pattern) => `${START}${pattern}${END}`).join("|")}|(?<!\\d)\\d{8,10}:[A-Za-z0-9_-]{35}${END}`, "g");
111
+ var PRIVATE_KEY = /-----BEGIN[A-Z ]* PRIVATE KEY-----[\s\S]*?(?:-----END[A-Z ]* PRIVATE KEY-----|$)/g;
112
+ var SCHEME = /(?<![A-Za-z])(Bearer|Basic)(\s+)(?![A-Z]?[a-z]+(?![A-Za-z0-9]))[A-Za-z0-9._~+/=-]{8,}/g;
113
+ var NAMED_PAIR = /(?<![\p{L}\p{N}])([\p{L}\p{N}_.-]*(?:token|pass|pwd|pin|otp|2fa|secret|credential|cookie|authorization|key|contrase|clave|пароль|пин|код)[\p{L}\p{N}_.-]*)(["']?\s*(?:=>|[:=])\s*["']?|\s+(?![\p{L}]+(?![\p{L}\p{N}])))((?:Bearer\s+|Basic\s+)?)([^\s"'&,;]+)/giu;
114
+ var looksRandom = /* @__PURE__ */ __name((run) => {
115
+ if (run.length < 20)
116
+ return false;
117
+ const classes = [/[a-z]/, /[A-Z]/, /\d/, /[^A-Za-z0-9]/].filter((kind) => kind.test(run)).length;
118
+ if (classes < 3)
119
+ return false;
120
+ let switches = 0;
121
+ for (let at = 1; at < run.length; at++) {
122
+ const [before, after] = [run[at - 1], run[at]];
123
+ if (/[a-z]/.test(before) && /[A-Z]/.test(after) || /[A-Z]/.test(before) && /[a-z]/.test(after))
124
+ switches += 1;
125
+ }
126
+ if (switches / run.length < 0.15)
127
+ return false;
128
+ const pieces = run.match(/[A-Z]?[a-z]+|[A-Z]+(?![a-z])|\d+/g) ?? [];
129
+ if (pieces.join("").length / Math.max(pieces.length, 1) >= 2.75)
130
+ return false;
131
+ return entropy(run) >= 3.5;
132
+ }, "looksRandom");
133
+ var entropy = /* @__PURE__ */ __name((text) => {
134
+ const counts = /* @__PURE__ */ new Map();
135
+ for (const char of text)
136
+ counts.set(char, (counts.get(char) ?? 0) + 1);
137
+ let bits = 0;
138
+ for (const count of counts.values())
139
+ bits -= count / text.length * Math.log2(count / text.length);
140
+ return bits;
141
+ }, "entropy");
142
+ var withoutSecrets = /* @__PURE__ */ __name((text, mark = "[redacted]") => text.replace(PRIVATE_KEY, mark).replace(KNOWN_TOKENS, mark).replace(SCHEME, `$1$2${mark}`).replace(NAMED_PAIR, (whole, name, separator, scheme) => secretNamed(name) ? `${name}${separator}${scheme}${mark}` : whole).replace(/[!-~]{20,}/g, (token) => (
143
+ // A URL or a path is somebody's address, not a key; a credential in one is caught by the rules above.
144
+ token.includes("://") || /^(?:\/|~\/|\.\.?\/)/.test(token) ? token : token.replace(RUN, (run) => looksRandom(run) ? mark : run.replace(HEX, (hex) => entropy(hex) >= 3 ? mark : hex))
145
+ )), "withoutSecrets");
146
+ var RUN = /(?<![A-Za-z0-9_+/-])[A-Za-z0-9_+/-]{20,}/g;
147
+ var HEX = /(?<![A-Za-z0-9])(?=[0-9]*[a-f])[0-9a-f]{20,}(?![A-Za-z0-9])/g;
148
+
149
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
150
+ var MESSAGE_AT_MOST = 500;
151
+ var CAUSES_AT_MOST = 5;
152
+ var FRAMES_AT_MOST = 15;
153
+ var errorDetailOf = /* @__PURE__ */ __name((error, response) => {
154
+ const details = isCliFailure(error) ? { ...error.details } : {};
155
+ const thrown = error instanceof Error ? error : void 0;
156
+ const code = isCliFailure(error) ? error.code : codeOf(error);
157
+ const reason = typeof details.reason === "string" ? details.reason : void 0;
158
+ const message = thrown ? redactText(thrown.message) : void 0;
159
+ const operation = stringOf(details.operation) ?? response?.operation;
160
+ const status = numberOf(details.status) ?? response?.status;
161
+ const method = stringOf(details.method) ?? response?.method;
162
+ const endpoint = stringOf(details.endpoint) ?? response?.endpointTemplate;
163
+ const key = providerErrorKey(details.provider_error) ?? providerErrorKey(response?.providerError);
164
+ const protocol = key !== void 0 && method === void 0 && endpoint === void 0;
165
+ const http = method !== void 0 || endpoint !== void 0 || status !== void 0 && !protocol ? {
166
+ ...method === void 0 ? {} : { method: method.toUpperCase().slice(0, 16) },
167
+ ...endpoint === void 0 ? {} : { endpoint_template: endpointTemplate(endpoint) },
168
+ ...status === void 0 ? {} : { status }
169
+ } : void 0;
170
+ const causes = causesOf(thrown?.cause ?? details.cause);
171
+ const stack = framesOf(thrown);
172
+ return {
173
+ class: classOf(error),
174
+ ...code === void 0 ? {} : { code },
175
+ ...reason === void 0 ? {} : { reason },
176
+ ...message ? { message } : {},
177
+ ...operation === void 0 ? {} : { operation },
178
+ ...http ? { http } : {},
179
+ ...key === void 0 ? {} : { provider: { key, ...protocol && status !== void 0 ? { code: status } : {} } },
180
+ ...causes.length > 0 ? { causes } : {},
181
+ ...stack.length > 0 ? { stack } : {}
182
+ };
183
+ }, "errorDetailOf");
184
+ var stringOf = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0, "stringOf");
185
+ var numberOf = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isInteger(value) ? value : void 0, "numberOf");
186
+ var classOf = /* @__PURE__ */ __name((error) => {
187
+ if (!(error instanceof Error))
188
+ return error === null ? "null" : typeof error;
189
+ const constructed = error.constructor?.name;
190
+ return constructed && constructed !== "Error" && constructed !== error.name ? constructed : error.name;
191
+ }, "classOf");
192
+ var codeOf = /* @__PURE__ */ __name((error) => {
193
+ const code = error?.code;
194
+ return typeof code === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(code) ? code : void 0;
195
+ }, "codeOf");
196
+ var causesOf = /* @__PURE__ */ __name((first) => {
197
+ const causes = [];
198
+ const seen = /* @__PURE__ */ new Set();
199
+ for (let cause = first; cause !== void 0 && cause !== null && causes.length < CAUSES_AT_MOST; ) {
200
+ if (seen.has(cause))
201
+ break;
202
+ seen.add(cause);
203
+ const message = cause instanceof Error ? redactText(cause.message) : void 0;
204
+ causes.push({ class: classOf(cause), ...message ? { message } : {} });
205
+ cause = cause instanceof Error ? cause.cause : void 0;
206
+ }
207
+ return causes;
208
+ }, "causesOf");
209
+ var framesOf = /* @__PURE__ */ __name((error, limit = FRAMES_AT_MOST) => {
210
+ const stack = error instanceof Error && typeof error.stack === "string" ? error.stack : "";
211
+ return stack.split("\n").filter((line) => line.trimStart().startsWith("at ")).flatMap((line) => {
212
+ const match = /^\s*at (?:async )?(?:(.+?) \()?(.+?):(\d+):\d+\)?$/.exec(line);
213
+ if (!match)
214
+ return [];
215
+ const [, fn, path = "", lineNumber] = match;
216
+ if (path.startsWith("node:"))
217
+ return [];
218
+ return [`${fn ?? "<anonymous>"} ${fileOf(path)}:${lineNumber}`];
219
+ }).slice(0, limit);
220
+ }, "framesOf");
221
+ var fileOf = /* @__PURE__ */ __name((path) => {
222
+ const plain = path.replace(/^file:\/\//, "");
223
+ const packaged = /\/node_modules\/((?:@[^/]+\/)?[^/]+\/.+)$/.exec(plain)?.[1];
224
+ if (packaged)
225
+ return packaged.replace(/\/(?:dist|src)\//, "/");
226
+ return /(?:^|\/)(?:dist|src)\/(.+)$/.exec(plain)?.[1] ?? plain.split("/").at(-1) ?? "?";
227
+ }, "fileOf");
228
+ var endpointTemplate = /* @__PURE__ */ __name((raw) => {
229
+ const trimmed = raw.trim().split(/[?#]/)[0] ?? "";
230
+ const origin = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/]*@)?([^/]*)/i.exec(trimmed);
231
+ const path = origin ? trimmed.slice(origin[0].length) : trimmed;
232
+ const scheme = origin ? `${trimmed.slice(0, trimmed.indexOf("://"))}://${origin[1]}` : "";
233
+ const segments = path.split("/").map((segment) => {
234
+ if (segment === "" || /^[:{].+/.test(segment))
235
+ return segment;
236
+ if (/^bot\d+:/.test(segment) || /^\d{6,}:[\w-]{20,}$/.test(segment))
237
+ return ":token";
238
+ if (/^-?\d+$/.test(segment) || /^[0-9a-f-]{16,}$/i.test(segment))
239
+ return ":id";
240
+ if (!/^[A-Za-z0-9._~-]{1,40}$/.test(segment))
241
+ return ":value";
242
+ return segment;
243
+ });
244
+ return `${scheme}${segments.join("/")}`.slice(0, 300);
245
+ }, "endpointTemplate");
246
+ var INTERNATIONAL_PHONE = /\+\d[\d\s()-]{6,}\d/.source;
247
+ var BARE_PHONE = /(^|[^\w-])\d{11,15}\b/.source;
248
+ var redactText = /* @__PURE__ */ __name((text) => {
249
+ const home = homedir();
250
+ let out = home && home !== "/" ? text.split(home).join("~") : text;
251
+ 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(/[\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]");
252
+ return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
253
+ }, "redactText");
254
+
255
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/runs/run-context.js
256
+ var REDACTED = "[redacted]";
257
+ var keepsSuccess = /* @__PURE__ */ __name(({ record, fromFlag, env, caller, persistent = false }) => {
258
+ if (!record)
259
+ return false;
260
+ if (fromFlag)
261
+ return true;
262
+ if (persistent)
263
+ return false;
264
+ return caller !== void 0 || viaOf(env) !== "desktop";
265
+ }, "keepsSuccess");
266
+ var calls = new AsyncLocalStorage();
267
+ var withCaller = /* @__PURE__ */ __name((caller, work) => calls.run(caller, work), "withCaller");
268
+ var currentCaller = /* @__PURE__ */ __name(() => calls.getStore(), "currentCaller");
269
+ var clientHash = /* @__PURE__ */ __name((id) => createHash("sha256").update(id).digest("hex").slice(0, 8), "clientHash");
270
+ var viaOf = /* @__PURE__ */ __name((env) => env.WIRECAT_CALLER?.trim() === "desktop" ? "desktop" : "cli", "viaOf");
271
+ var agentOf = /* @__PURE__ */ __name((env) => {
272
+ const named = env.AI_AGENT?.trim().split("_")[0];
273
+ 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.
274
+ (env.OPENCLAW_SHELL?.trim() === "exec" ? "openclaw" : void 0);
275
+ if (!kind)
276
+ return void 0;
277
+ const session = sessionOf(kind, env);
278
+ return {
279
+ kind,
280
+ session_id: session && SESSION.test(session) ? session : null,
281
+ // OpenClaw passes the sender and chat ids of a chat-started run in this variable; only its presence is kept.
282
+ ...kind === "openclaw" && env.OPENCLAW_CHANNEL_CONTEXT?.trim() ? { from_chat: true } : {}
283
+ };
284
+ }, "agentOf");
285
+ var SESSION = /^[A-Za-z0-9._:-]{1,128}$/;
286
+ var SESSION_VARIABLE = {
287
+ "claude-code": "CLAUDE_CODE_SESSION_ID",
288
+ codex: "CODEX_THREAD_ID",
289
+ opencode: "OPENCODE_SESSION_ID",
290
+ "hermes-agent": "HERMES_SESSION_ID"
291
+ };
292
+ var sessionOf = /* @__PURE__ */ __name((kind, env) => {
293
+ const variable = SESSION_VARIABLE[kind];
294
+ return (variable === void 0 ? void 0 : env[variable]?.trim()) || void 0;
295
+ }, "sessionOf");
296
+ var plainWord = /* @__PURE__ */ __name((word) => /^[A-Za-z][A-Za-z0-9.-]{0,39}$/.test(word), "plainWord");
297
+ var secretInputs = /* @__PURE__ */ new WeakSet();
298
+ var secretInput = /* @__PURE__ */ __name((input) => {
299
+ secretInputs.add(input);
300
+ return input;
301
+ }, "secretInput");
302
+ 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");
303
+ var withoutPhones = /* @__PURE__ */ __name((word) => word.replace(new RegExp(INTERNATIONAL_PHONE, "g"), REDACTED).replace(new RegExp(BARE_PHONE, "g"), `$1${REDACTED}`), "withoutPhones");
304
+ var maskArgv = /* @__PURE__ */ __name((program, words, { keep = false } = {}) => {
305
+ const argv = [];
306
+ let unknownCommand;
307
+ let current = program;
308
+ let positional = 0;
309
+ let profileSeen = false;
310
+ let lost = false;
311
+ const raw = /* @__PURE__ */ __name((word) => keep && !secretShaped(word) ? withoutPhones(withoutSecrets(word, REDACTED)) : REDACTED, "raw");
312
+ const keptValue = /* @__PURE__ */ __name((name, value, input) => keep ? input && secretInputs.has(input) || secretNamed(name) ? REDACTED : raw(value) : maskedValue(name, value, input?.argChoices), "keptValue");
313
+ const optionFor = /* @__PURE__ */ __name((flag) => {
314
+ for (let at = current; at; at = at.parent) {
315
+ const found = at.options.find((option) => option.long === flag || option.short === flag);
316
+ if (found)
317
+ return found;
318
+ }
319
+ return void 0;
320
+ }, "optionFor");
321
+ for (let at = 0; at < words.length; at++) {
322
+ const word = words[at];
323
+ if (word === "--") {
324
+ argv.push("--");
325
+ for (let after = at + 1; after < words.length; after++)
326
+ argv.push(raw(words[after]));
327
+ break;
328
+ }
329
+ if (word.startsWith("-") && word.length > 1 && !NUMBER.test(word)) {
330
+ const equals = word.indexOf("=");
331
+ const flag = equals > 0 ? word.slice(0, equals) : word;
332
+ if (!/^--?[A-Za-z0-9][A-Za-z0-9-]*$/.test(flag)) {
333
+ argv.push(raw(word));
334
+ continue;
335
+ }
336
+ const option = optionFor(flag);
337
+ const name = option?.attributeName() ?? flag.replace(/^-+/, "");
338
+ if (equals > 0) {
339
+ argv.push(`${flag}=${keptValue(name, word.slice(equals + 1), option)}`);
340
+ continue;
341
+ }
342
+ argv.push(flag);
343
+ if (!option && keep && secretNamed(name) && words[at + 1] !== void 0 && !words[at + 1]?.startsWith("-")) {
344
+ at += 1;
345
+ argv.push(REDACTED);
346
+ continue;
347
+ }
348
+ if (!option || !(option.required || option.optional))
349
+ continue;
350
+ const takes = /* @__PURE__ */ __name((next) => next !== void 0 && (option.required || !next.startsWith("-") || NUMBER.test(next)), "takes");
351
+ if (takes(words[at + 1])) {
352
+ at += 1;
353
+ argv.push(keptValue(name, words[at], option));
354
+ while (option.variadic && words[at + 1] !== void 0 && !words[at + 1].startsWith("-")) {
355
+ at += 1;
356
+ argv.push(keptValue(name, words[at], option));
357
+ }
358
+ }
359
+ continue;
360
+ }
361
+ if (!lost && positional === 0) {
362
+ const sub = current.commands.find((one) => one.name() === word || one.aliases().includes(word));
363
+ if (sub) {
364
+ argv.push(word);
365
+ current = sub;
366
+ continue;
367
+ }
368
+ if (current === program && !profileSeen) {
369
+ profileSeen = true;
370
+ argv.push(keep ? raw(word) : PROFILE.test(word) && withoutPhones(withoutSecrets(word)) === word ? word : REDACTED);
371
+ continue;
372
+ }
373
+ if (current.commands.length > 0 && current.registeredArguments.length === 0) {
374
+ lost = true;
375
+ unknownCommand = commandLike(word);
376
+ argv.push(keep ? raw(word) : unknownCommand);
377
+ continue;
378
+ }
379
+ }
380
+ const declared = lost ? void 0 : current.registeredArguments;
381
+ const argument = declared?.[Math.min(positional, declared.length - 1)];
382
+ positional += 1;
383
+ argv.push(secretInputs.has(current) ? REDACTED : argument ? keptValue(argument.name(), word, argument) : raw(word));
384
+ }
385
+ return { argv, ...unknownCommand === void 0 ? {} : { unknownCommand } };
386
+ }, "maskArgv");
387
+ var NUMBER = /^-?\d+(\.\d+)?$/;
388
+ var PROFILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
389
+ var commandLike = /* @__PURE__ */ __name((word) => /^[a-z][a-z0-9-]{0,31}$/i.test(word) && withoutSecrets(word) === word ? word : REDACTED, "commandLike");
390
+ var maskedValue = /* @__PURE__ */ __name((name, value, choices) => {
391
+ if (isContentKey(name))
392
+ return REDACTED;
393
+ if (name === "profile")
394
+ return PROFILE.test(value) ? value : REDACTED;
395
+ if (name === "json" || name === "fields")
396
+ return /^[a-z0-9_.,]{1,200}$/.test(value) ? value : REDACTED;
397
+ if (choices?.includes(value))
398
+ return value;
399
+ return safeShape(value) ? value : REDACTED;
400
+ }, "maskedValue");
401
+ 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");
402
+ var runContextOf = /* @__PURE__ */ __name(({ bin, command, program, argv, env, recordInput = false, caller }) => {
403
+ const masked = program && argv ? maskArgv(program, argv, { keep: recordInput === true }) : void 0;
404
+ const ifFailed = program && argv && recordInput === "failed" ? maskArgv(program, argv, { keep: true }) : void 0;
405
+ const agent = caller ? caller.agent : agentOf(env);
406
+ return {
407
+ cliCommand: command ? `${bin} ${command}` : bin,
408
+ ...masked ? { argv: masked.argv } : {},
409
+ ...ifFailed ? { argvIfFailed: ifFailed.argv } : {},
410
+ ...masked?.unknownCommand === void 0 ? {} : { unknownCommand: masked.unknownCommand },
411
+ ...agent ? { agent } : {},
412
+ via: caller?.via ?? viaOf(env),
413
+ ...caller?.mcp ? { mcp: caller.mcp } : {}
414
+ };
415
+ }, "runContextOf");
416
+
417
+ export {
418
+ providerErrorKey,
419
+ renderEvent,
420
+ errorDetailOf,
421
+ framesOf,
422
+ endpointTemplate,
423
+ keepsSuccess,
424
+ withCaller,
425
+ currentCaller,
426
+ clientHash,
427
+ agentOf,
428
+ secretInput,
429
+ maskArgv,
430
+ runContextOf
431
+ };
@@ -0,0 +1,73 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ alive
5
+ } from "./chunk-PIN5RZ3D.js";
6
+ import {
7
+ resolvePaths,
8
+ writeSecurely
9
+ } from "./chunk-AE4BOXH7.js";
10
+ import {
11
+ __name
12
+ } from "./chunk-ZVVMGPBJ.js";
13
+
14
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/background/lock.js
15
+ import { existsSync, linkSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
16
+ import { dirname, join } from "node:path";
17
+ var lockPath = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "serve", `${profile}.lock`), "lockPath");
18
+ var readLock = /* @__PURE__ */ __name((path) => {
19
+ try {
20
+ const lock = JSON.parse(readFileSync(path, "utf8"));
21
+ return typeof lock.pid === "number" && typeof lock.startedAt === "string" ? lock : void 0;
22
+ } catch {
23
+ return void 0;
24
+ }
25
+ }, "readLock");
26
+ var holdLock = /* @__PURE__ */ __name((path, lock) => writeSecurely(path, `${JSON.stringify(lock)}
27
+ `, 384), "holdLock");
28
+ var takeLock = /* @__PURE__ */ __name((path, lock) => {
29
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
30
+ const draft = `${path}.${lock.pid}.tmp`;
31
+ writeFileSync(draft, `${JSON.stringify(lock)}
32
+ `, { mode: 384 });
33
+ try {
34
+ for (let attempt = 0; attempt < 5; attempt++) {
35
+ try {
36
+ linkSync(draft, path);
37
+ return void 0;
38
+ } catch (error) {
39
+ if (error.code !== "EEXIST")
40
+ throw error;
41
+ }
42
+ const held = readLock(path);
43
+ if (held && held.pid !== lock.pid && alive(held.pid))
44
+ return held;
45
+ rmSync(path, { force: true });
46
+ }
47
+ throw new Error(`could not take the lock ${path}: it keeps changing`);
48
+ } finally {
49
+ rmSync(draft, { force: true });
50
+ }
51
+ }, "takeLock");
52
+ var releaseLock = /* @__PURE__ */ __name((path, pid = process.pid) => {
53
+ if (readLock(path)?.pid === pid)
54
+ rmSync(path, { force: true });
55
+ }, "releaseLock");
56
+ var servingProfiles = /* @__PURE__ */ __name((app, env) => {
57
+ const dir = dirname(lockPath(app, "default", env));
58
+ if (!existsSync(dir))
59
+ return [];
60
+ return readdirSync(dir).filter((name) => name.endsWith(".lock")).map((name) => name.slice(0, -".lock".length)).filter((profile) => {
61
+ const lock = readLock(lockPath(app, profile, env));
62
+ return lock !== void 0 && alive(lock.pid);
63
+ });
64
+ }, "servingProfiles");
65
+
66
+ export {
67
+ lockPath,
68
+ readLock,
69
+ holdLock,
70
+ takeLock,
71
+ releaseLock,
72
+ servingProfiles
73
+ };