@wirecat/hubspot-cli 0.0.0-stage → 0.2.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 (261) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +204 -0
  3. package/README.md +280 -2
  4. package/contracts/wirecat.json +3270 -0
  5. package/dist/bin/hubspot.d.ts +3 -0
  6. package/dist/bin/hubspot.d.ts.map +1 -0
  7. package/dist/bin/hubspot.js +40 -0
  8. package/dist/bin/hubspot.js.map +1 -0
  9. package/dist/bundle/all-profiles-64JAUYW4.js +279 -0
  10. package/dist/bundle/anthropic-VJOS4OUM.js +91 -0
  11. package/dist/bundle/app-server-GXV2OFML.js +245 -0
  12. package/dist/bundle/bun-M3J2QTR3.js +169 -0
  13. package/dist/bundle/bun-sqlite-IX3XYA5F.js +76 -0
  14. package/dist/bundle/chunk-24ERVFJP.js +73 -0
  15. package/dist/bundle/chunk-2QZK5BEP.js +392 -0
  16. package/dist/bundle/chunk-2UOJ7DLZ.js +46 -0
  17. package/dist/bundle/chunk-2VGD63G6.js +604 -0
  18. package/dist/bundle/chunk-2VGZRYEH.js +334 -0
  19. package/dist/bundle/chunk-36ITRDYY.js +63116 -0
  20. package/dist/bundle/chunk-3WLYWRGG.js +1395 -0
  21. package/dist/bundle/chunk-43EKCUBJ.js +72 -0
  22. package/dist/bundle/chunk-4W6BMH45.js +731 -0
  23. package/dist/bundle/chunk-5A6ZYNAQ.js +2003 -0
  24. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  25. package/dist/bundle/chunk-5GBUCHRU.js +274 -0
  26. package/dist/bundle/chunk-5K7QLJMM.js +4072 -0
  27. package/dist/bundle/chunk-65TWQ7BV.js +54 -0
  28. package/dist/bundle/chunk-7ELMWE3P.js +12066 -0
  29. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  30. package/dist/bundle/chunk-B3MANLNK.js +602 -0
  31. package/dist/bundle/chunk-C32AKHTY.js +2310 -0
  32. package/dist/bundle/chunk-CLAN3FES.js +1246 -0
  33. package/dist/bundle/chunk-CWXOXIWS.js +46 -0
  34. package/dist/bundle/chunk-D72URWJE.js +532 -0
  35. package/dist/bundle/chunk-DB2XKHI4.js +72 -0
  36. package/dist/bundle/chunk-DBEQI5YM.js +100 -0
  37. package/dist/bundle/chunk-DFCHHR5M.js +38 -0
  38. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  39. package/dist/bundle/chunk-DRWWJLI6.js +188 -0
  40. package/dist/bundle/chunk-DSP36YHQ.js +29 -0
  41. package/dist/bundle/chunk-E52JAS35.js +1028 -0
  42. package/dist/bundle/chunk-E5WLE7BM.js +78 -0
  43. package/dist/bundle/chunk-ECEZOLOD.js +230 -0
  44. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  45. package/dist/bundle/chunk-FBCCBCFH.js +288 -0
  46. package/dist/bundle/chunk-FKA7DOCK.js +53 -0
  47. package/dist/bundle/chunk-FOZYMDRL.js +259 -0
  48. package/dist/bundle/chunk-FPUGMDJV.js +7 -0
  49. package/dist/bundle/chunk-FTFV3HFW.js +721 -0
  50. package/dist/bundle/chunk-GPYCBYX5.js +218 -0
  51. package/dist/bundle/chunk-H3TNVEQX.js +782 -0
  52. package/dist/bundle/chunk-HC5ZWE5X.js +193 -0
  53. package/dist/bundle/chunk-HCAZV5NP.js +95 -0
  54. package/dist/bundle/chunk-HZRQLAHO.js +16 -0
  55. package/dist/bundle/chunk-IJADZW42.js +195 -0
  56. package/dist/bundle/chunk-IMJQRPLN.js +92 -0
  57. package/dist/bundle/chunk-JLDBMEKZ.js +106 -0
  58. package/dist/bundle/chunk-LOBVOGOE.js +66 -0
  59. package/dist/bundle/chunk-LXZ66MCH.js +1328 -0
  60. package/dist/bundle/chunk-MFNMKHML.js +26462 -0
  61. package/dist/bundle/chunk-MVA5HVKL.js +1392 -0
  62. package/dist/bundle/chunk-N2XADGL4.js +76 -0
  63. package/dist/bundle/chunk-NHHJHXMQ.js +58 -0
  64. package/dist/bundle/chunk-NUU4WZVL.js +52 -0
  65. package/dist/bundle/chunk-NWHEHV3K.js +133 -0
  66. package/dist/bundle/chunk-NXERIDPJ.js +319 -0
  67. package/dist/bundle/chunk-O3DYRCIT.js +23 -0
  68. package/dist/bundle/chunk-O55RWNSH.js +161 -0
  69. package/dist/bundle/chunk-P5BHKKBI.js +206 -0
  70. package/dist/bundle/chunk-PPHBRESD.js +82 -0
  71. package/dist/bundle/chunk-PVKF24ZW.js +364 -0
  72. package/dist/bundle/chunk-Q2OLOMHL.js +4045 -0
  73. package/dist/bundle/chunk-QGFX5MXL.js +460 -0
  74. package/dist/bundle/chunk-QJW35N5V.js +761 -0
  75. package/dist/bundle/chunk-QU25DA5N.js +360 -0
  76. package/dist/bundle/chunk-RMIYKDUL.js +1068 -0
  77. package/dist/bundle/chunk-RR5MX5TM.js +142 -0
  78. package/dist/bundle/chunk-SDQGB4KB.js +185 -0
  79. package/dist/bundle/chunk-TBJYLC5K.js +2788 -0
  80. package/dist/bundle/chunk-TI46WQXQ.js +1197 -0
  81. package/dist/bundle/chunk-TKVL2C3B.js +170 -0
  82. package/dist/bundle/chunk-TLKEPUAV.js +786 -0
  83. package/dist/bundle/chunk-TOSCB4SO.js +1227 -0
  84. package/dist/bundle/chunk-TP7GDWVF.js +6848 -0
  85. package/dist/bundle/chunk-URX6YDUL.js +9393 -0
  86. package/dist/bundle/chunk-UUMUL4L3.js +72 -0
  87. package/dist/bundle/chunk-VOH7S5M4.js +40963 -0
  88. package/dist/bundle/chunk-W53EJOFQ.js +63 -0
  89. package/dist/bundle/chunk-W7HM2VGO.js +24 -0
  90. package/dist/bundle/chunk-WE4UFASG.js +88 -0
  91. package/dist/bundle/chunk-X2M6NIQG.js +18 -0
  92. package/dist/bundle/chunk-XRREFEIW.js +372 -0
  93. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  94. package/dist/bundle/chunk-YMCY7VRE.js +1846 -0
  95. package/dist/bundle/chunk-Z73OL5HV.js +41 -0
  96. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  97. package/dist/bundle/command-contract-C6CBFXZF.js +40 -0
  98. package/dist/bundle/command-server-entry-DJKVVZCQ.js +169 -0
  99. package/dist/bundle/decode-FC65Y4IV.js +297 -0
  100. package/dist/bundle/definitions-MVPICAWV.js +2991 -0
  101. package/dist/bundle/dispatch-KOISQ5QJ.js +411 -0
  102. package/dist/bundle/dist-7TGU56B2.js +7577 -0
  103. package/dist/bundle/echarts-FVTUDXDU.js +42501 -0
  104. package/dist/bundle/embed-VNBZFPYH.js +38 -0
  105. package/dist/bundle/embedder-6U4NOFRO.js +111 -0
  106. package/dist/bundle/failure-FZ6VYKEQ.js +25 -0
  107. package/dist/bundle/first-run-UWAFSINQ.js +29 -0
  108. package/dist/bundle/first-screen-RTVMGHAE.js +40 -0
  109. package/dist/bundle/hubspot.js +198 -0
  110. package/dist/bundle/instructions-HET7BCYK.js +11 -0
  111. package/dist/bundle/mcp-RGNRW77S.js +167 -0
  112. package/dist/bundle/meeting-combined-L5AGBPYX.js +25 -0
  113. package/dist/bundle/meeting-model-NTB4RK3F.js +25 -0
  114. package/dist/bundle/meeting-semantic-JY3OGCBS.js +22 -0
  115. package/dist/bundle/node-CXZIFHZC.js +176 -0
  116. package/dist/bundle/node-P4E63KXA.js +2340 -0
  117. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  118. package/dist/bundle/node-sqlite-P3O7XN7Q.js +74 -0
  119. package/dist/bundle/oauth-HNCY4B2S.js +20 -0
  120. package/dist/bundle/open-F4P6YV54.js +23 -0
  121. package/dist/bundle/openai-4AICLIK3.js +238 -0
  122. package/dist/bundle/process-5RUXWGYS.js +91 -0
  123. package/dist/bundle/program-XA4C44Z4.js +9374 -0
  124. package/dist/bundle/prompt-NFMDVBZ4.js +17 -0
  125. package/dist/bundle/recognize-DKN3RY4V.js +26 -0
  126. package/dist/bundle/remote-6QHAGQWY.js +31 -0
  127. package/dist/bundle/rerank-M4KHEHUZ.js +52 -0
  128. package/dist/bundle/schemas-JRL3DLMP.js +952 -0
  129. package/dist/bundle/serve-DNU43ND6.js +199 -0
  130. package/dist/bundle/server-ATG5KY7K.js +207 -0
  131. package/dist/bundle/server-VNWVVH7A.js +77 -0
  132. package/dist/bundle/source-54HR4IWG.js +661 -0
  133. package/dist/bundle/sqlite-runtime-EMQAC63N.js +20 -0
  134. package/dist/bundle/state-T45CX7VY.js +36 -0
  135. package/dist/bundle/store-6LCEVBAZ.js +176 -0
  136. package/dist/bundle/store-6TZ2FCVA.js +295 -0
  137. package/dist/bundle/store-DXWYNVVB.js +32 -0
  138. package/dist/bundle/store-maintenance-command-J57HCJYY.js +68 -0
  139. package/dist/bundle/writer-NLLI5YRM.js +79 -0
  140. package/dist/commands/account.d.ts +3 -0
  141. package/dist/commands/account.d.ts.map +1 -0
  142. package/dist/commands/account.js +87 -0
  143. package/dist/commands/account.js.map +1 -0
  144. package/dist/commands/api.d.ts +9 -0
  145. package/dist/commands/api.d.ts.map +1 -0
  146. package/dist/commands/api.js +70 -0
  147. package/dist/commands/api.js.map +1 -0
  148. package/dist/commands/crm-shared.d.ts +8 -0
  149. package/dist/commands/crm-shared.d.ts.map +1 -0
  150. package/dist/commands/crm-shared.js +109 -0
  151. package/dist/commands/crm-shared.js.map +1 -0
  152. package/dist/commands/schedule.d.ts +3 -0
  153. package/dist/commands/schedule.d.ts.map +1 -0
  154. package/dist/commands/schedule.js +9 -0
  155. package/dist/commands/schedule.js.map +1 -0
  156. package/dist/commands/session.d.ts +14 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +164 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +60 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +153 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +88 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +137 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/crm/activities.d.ts +24 -0
  169. package/dist/crm/activities.d.ts.map +1 -0
  170. package/dist/crm/activities.js +214 -0
  171. package/dist/crm/activities.js.map +1 -0
  172. package/dist/crm/associations.d.ts +20 -0
  173. package/dist/crm/associations.d.ts.map +1 -0
  174. package/dist/crm/associations.js +47 -0
  175. package/dist/crm/associations.js.map +1 -0
  176. package/dist/crm/records.d.ts +63 -0
  177. package/dist/crm/records.d.ts.map +1 -0
  178. package/dist/crm/records.js +333 -0
  179. package/dist/crm/records.js.map +1 -0
  180. package/dist/crm/search.d.ts +57 -0
  181. package/dist/crm/search.d.ts.map +1 -0
  182. package/dist/crm/search.js +47 -0
  183. package/dist/crm/search.js.map +1 -0
  184. package/dist/crm/source.d.ts +37 -0
  185. package/dist/crm/source.d.ts.map +1 -0
  186. package/dist/crm/source.js +366 -0
  187. package/dist/crm/source.js.map +1 -0
  188. package/dist/crm/writer.d.ts +15 -0
  189. package/dist/crm/writer.d.ts.map +1 -0
  190. package/dist/crm/writer.js +199 -0
  191. package/dist/crm/writer.js.map +1 -0
  192. package/dist/generated/definitions.d.ts +3 -0
  193. package/dist/generated/definitions.d.ts.map +1 -0
  194. package/dist/generated/definitions.js +2987 -0
  195. package/dist/generated/definitions.js.map +1 -0
  196. package/dist/generated/manifest.d.ts +6 -0
  197. package/dist/generated/manifest.d.ts.map +1 -0
  198. package/dist/generated/manifest.js +6504 -0
  199. package/dist/generated/manifest.js.map +1 -0
  200. package/dist/generated/schemas.d.ts +205 -0
  201. package/dist/generated/schemas.d.ts.map +1 -0
  202. package/dist/generated/schemas.js +810 -0
  203. package/dist/generated/schemas.js.map +1 -0
  204. package/dist/generated/types.d.ts +1114 -0
  205. package/dist/generated/types.d.ts.map +1 -0
  206. package/dist/generated/types.js +5 -0
  207. package/dist/generated/types.js.map +1 -0
  208. package/dist/hubspot/account.d.ts +12 -0
  209. package/dist/hubspot/account.d.ts.map +1 -0
  210. package/dist/hubspot/account.js +23 -0
  211. package/dist/hubspot/account.js.map +1 -0
  212. package/dist/hubspot/transport.d.ts +81 -0
  213. package/dist/hubspot/transport.d.ts.map +1 -0
  214. package/dist/hubspot/transport.js +354 -0
  215. package/dist/hubspot/transport.js.map +1 -0
  216. package/dist/identity.d.ts +7 -0
  217. package/dist/identity.d.ts.map +1 -0
  218. package/dist/identity.js +32 -0
  219. package/dist/identity.js.map +1 -0
  220. package/dist/index.d.ts +3 -0
  221. package/dist/index.d.ts.map +1 -0
  222. package/dist/index.js +3 -0
  223. package/dist/index.js.map +1 -0
  224. package/dist/program.d.ts +6 -0
  225. package/dist/program.d.ts.map +1 -0
  226. package/dist/program.js +78 -0
  227. package/dist/program.js.map +1 -0
  228. package/dist/reasons.d.ts +10 -0
  229. package/dist/reasons.d.ts.map +1 -0
  230. package/dist/reasons.js +33 -0
  231. package/dist/reasons.js.map +1 -0
  232. package/dist/setup/flow.d.ts +2 -0
  233. package/dist/setup/flow.d.ts.map +1 -0
  234. package/dist/setup/flow.js +97 -0
  235. package/dist/setup/flow.js.map +1 -0
  236. package/dist/setup/texts.en.json +19 -0
  237. package/dist/setup/texts.es.json +19 -0
  238. package/dist/setup/texts.ru.json +19 -0
  239. package/dist/store.d.ts +16 -0
  240. package/dist/store.d.ts.map +1 -0
  241. package/dist/store.js +34 -0
  242. package/dist/store.js.map +1 -0
  243. package/dist/version.d.ts +2 -0
  244. package/dist/version.d.ts.map +1 -0
  245. package/dist/version.js +2 -0
  246. package/dist/version.js.map +1 -0
  247. package/dist/wcat.d.ts +3 -0
  248. package/dist/wcat.d.ts.map +1 -0
  249. package/dist/wcat.js +4 -0
  250. package/dist/wcat.js.map +1 -0
  251. package/dist/whoami.d.ts +19 -0
  252. package/dist/whoami.d.ts.map +1 -0
  253. package/dist/whoami.js +15 -0
  254. package/dist/whoami.js.map +1 -0
  255. package/package.json +98 -4
  256. package/skills/hubspot-cli/SKILL.md +102 -0
  257. package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
  258. package/skills/hubspot-cli/references/api/api-basic.md +1064 -0
  259. package/skills/hubspot-cli/references/api/api-batch.md +724 -0
  260. package/skills/hubspot-cli/references/api/api-search.md +147 -0
  261. package/skills/hubspot-cli/references/api.md +16 -0
@@ -0,0 +1,364 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ isCliFailure
5
+ } from "./chunk-UUMUL4L3.js";
6
+ import {
7
+ secretNamed,
8
+ withoutSecrets
9
+ } from "./chunk-IMJQRPLN.js";
10
+ import {
11
+ isContentKey
12
+ } from "./chunk-TBJYLC5K.js";
13
+ import {
14
+ __name
15
+ } from "./chunk-ZVVMGPBJ.js";
16
+
17
+ // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/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.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/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.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/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.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/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.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/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
+ };