@wirecat/attio-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 (242) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +204 -0
  3. package/README.md +248 -2
  4. package/contracts/wirecat.json +2321 -0
  5. package/dist/bin/attio.d.ts +3 -0
  6. package/dist/bin/attio.d.ts.map +1 -0
  7. package/dist/bin/attio.js +40 -0
  8. package/dist/bin/attio.js.map +1 -0
  9. package/dist/bundle/agent-KLBL3FYD.js +37 -0
  10. package/dist/bundle/all-profiles-C2NMRQPE.js +320 -0
  11. package/dist/bundle/anthropic-KOU2ILDK.js +91 -0
  12. package/dist/bundle/app-server-TINV4NNY.js +249 -0
  13. package/dist/bundle/attio.js +183 -0
  14. package/dist/bundle/bun-GVNM6IWY.js +169 -0
  15. package/dist/bundle/bun-sqlite-IF6B3EQI.js +76 -0
  16. package/dist/bundle/chunk-2343HKEW.js +362 -0
  17. package/dist/bundle/chunk-2H2MWGBD.js +988 -0
  18. package/dist/bundle/chunk-2P7ENEQ7.js +288 -0
  19. package/dist/bundle/chunk-4EYKJLWI.js +771 -0
  20. package/dist/bundle/chunk-4HQDT5PF.js +338 -0
  21. package/dist/bundle/chunk-4QE4L7UL.js +142 -0
  22. package/dist/bundle/chunk-4XHWGJXT.js +6848 -0
  23. package/dist/bundle/chunk-5DCRHSBI.js +72 -0
  24. package/dist/bundle/chunk-5ETXE5KF.js +372 -0
  25. package/dist/bundle/chunk-5WAGTWCS.js +156 -0
  26. package/dist/bundle/chunk-6B5PSQQ7.js +319 -0
  27. package/dist/bundle/chunk-6BVPS2YY.js +230 -0
  28. package/dist/bundle/chunk-6L5EUGLP.js +188 -0
  29. package/dist/bundle/chunk-7NFEMS4A.js +1028 -0
  30. package/dist/bundle/chunk-A7YQTQ5U.js +733 -0
  31. package/dist/bundle/chunk-AEPOHR4Z.js +82 -0
  32. package/dist/bundle/chunk-ARRQVUJ2.js +334 -0
  33. package/dist/bundle/chunk-BHNFRL3H.js +95 -0
  34. package/dist/bundle/chunk-CBPL3GID.js +23 -0
  35. package/dist/bundle/chunk-D72URWJE.js +532 -0
  36. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  37. package/dist/bundle/chunk-DVN54VPI.js +16 -0
  38. package/dist/bundle/chunk-DW3V7GTY.js +388 -0
  39. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  40. package/dist/bundle/chunk-ETSOG6TZ.js +65288 -0
  41. package/dist/bundle/chunk-FJV3MO57.js +29 -0
  42. package/dist/bundle/chunk-HLLRNP2G.js +170 -0
  43. package/dist/bundle/chunk-HQJ2TABD.js +18 -0
  44. package/dist/bundle/chunk-ICUXAOEM.js +42063 -0
  45. package/dist/bundle/chunk-IGALQ74S.js +358 -0
  46. package/dist/bundle/chunk-IPHUAWFG.js +100 -0
  47. package/dist/bundle/chunk-IYMWUL6E.js +633 -0
  48. package/dist/bundle/chunk-JKCXDIGC.js +52 -0
  49. package/dist/bundle/chunk-JTOKDROB.js +95 -0
  50. package/dist/bundle/chunk-JZMGOVCZ.js +80 -0
  51. package/dist/bundle/chunk-KB3YJJPN.js +794 -0
  52. package/dist/bundle/chunk-KD4EUUER.js +37 -0
  53. package/dist/bundle/chunk-LB6D4QF2.js +2333 -0
  54. package/dist/bundle/chunk-LWUJZ2E3.js +108 -0
  55. package/dist/bundle/chunk-MCQOXTAL.js +53 -0
  56. package/dist/bundle/chunk-MMGCGPKM.js +3571 -0
  57. package/dist/bundle/chunk-MXDIXBIV.js +24 -0
  58. package/dist/bundle/chunk-MYVWV5L5.js +407 -0
  59. package/dist/bundle/chunk-MZNRIH3T.js +1233 -0
  60. package/dist/bundle/chunk-NEFILPPV.js +353 -0
  61. package/dist/bundle/chunk-O6CVJGGL.js +131 -0
  62. package/dist/bundle/chunk-OPXCRQTV.js +161 -0
  63. package/dist/bundle/chunk-PKNFA5TU.js +38 -0
  64. package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
  65. package/dist/bundle/chunk-PO6PLQYL.js +50 -0
  66. package/dist/bundle/chunk-PWUQC2GI.js +218 -0
  67. package/dist/bundle/chunk-QCEEPJNN.js +185 -0
  68. package/dist/bundle/chunk-QG4WCLGB.js +1332 -0
  69. package/dist/bundle/chunk-QNQ2OF24.js +9578 -0
  70. package/dist/bundle/chunk-RCKRXBJF.js +1392 -0
  71. package/dist/bundle/chunk-RK4GN2II.js +2000 -0
  72. package/dist/bundle/chunk-RRH7UK7L.js +106 -0
  73. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  74. package/dist/bundle/chunk-S7WJXELM.js +58 -0
  75. package/dist/bundle/chunk-SBRFKB77.js +1197 -0
  76. package/dist/bundle/chunk-SP6DPFZ4.js +4072 -0
  77. package/dist/bundle/chunk-SWJDLFDM.js +557 -0
  78. package/dist/bundle/chunk-TWCVCW5T.js +66 -0
  79. package/dist/bundle/chunk-V2R2BJJU.js +63 -0
  80. package/dist/bundle/chunk-V5K3M7FE.js +78 -0
  81. package/dist/bundle/chunk-V6ALLFEE.js +1068 -0
  82. package/dist/bundle/chunk-V6EVJXLO.js +259 -0
  83. package/dist/bundle/chunk-VJ4CPL6F.js +54 -0
  84. package/dist/bundle/chunk-VL25A6V2.js +41 -0
  85. package/dist/bundle/chunk-WBEZZGZE.js +12645 -0
  86. package/dist/bundle/chunk-WIYAMDPP.js +73 -0
  87. package/dist/bundle/chunk-WRJGITBX.js +76 -0
  88. package/dist/bundle/chunk-XHIVZPQ2.js +7 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-XTQIXZVM.js +2788 -0
  91. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  92. package/dist/bundle/chunk-YKN4Y35P.js +206 -0
  93. package/dist/bundle/chunk-ZMJZQGCN.js +46 -0
  94. package/dist/bundle/chunk-ZPSH27BB.js +274 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-3FR7BK72.js +37 -0
  97. package/dist/bundle/command-server-entry-4XR4GDS7.js +166 -0
  98. package/dist/bundle/decode-24EITKP4.js +297 -0
  99. package/dist/bundle/definitions-HU62PG4L.js +43364 -0
  100. package/dist/bundle/dispatch-VE6CXCJW.js +411 -0
  101. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  102. package/dist/bundle/dist-ZSNEZYVF.js +7577 -0
  103. package/dist/bundle/echarts-LEVLEF7L.js +42501 -0
  104. package/dist/bundle/embed-G6FGY3VZ.js +38 -0
  105. package/dist/bundle/embedder-B6LNMXZZ.js +111 -0
  106. package/dist/bundle/failure-ASVFQXMF.js +25 -0
  107. package/dist/bundle/first-run-NVXVVALW.js +29 -0
  108. package/dist/bundle/first-screen-N3IPK5AT.js +37 -0
  109. package/dist/bundle/instructions-F3KPYMJK.js +11 -0
  110. package/dist/bundle/mcp-BUCB5ZPE.js +167 -0
  111. package/dist/bundle/meeting-combined-7FREWXMB.js +24 -0
  112. package/dist/bundle/meeting-model-GJPAIUQL.js +25 -0
  113. package/dist/bundle/meeting-semantic-YWY645AH.js +22 -0
  114. package/dist/bundle/node-KM3CUABH.js +2340 -0
  115. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  116. package/dist/bundle/node-WVUZSDLD.js +176 -0
  117. package/dist/bundle/node-sqlite-V4NNKABG.js +74 -0
  118. package/dist/bundle/oauth-7CENTQIN.js +20 -0
  119. package/dist/bundle/open-OLTONZBG.js +23 -0
  120. package/dist/bundle/openai-M6ES74YN.js +238 -0
  121. package/dist/bundle/process-VFIFK5KO.js +91 -0
  122. package/dist/bundle/program-N72VUDXM.js +33418 -0
  123. package/dist/bundle/prompt-TNWPBEBB.js +17 -0
  124. package/dist/bundle/recognize-PV2WOUWS.js +26 -0
  125. package/dist/bundle/remote-3F6JACS5.js +31 -0
  126. package/dist/bundle/rerank-33C67PIV.js +52 -0
  127. package/dist/bundle/schemas-RLDEALIJ.js +21410 -0
  128. package/dist/bundle/serve-3DEMACSQ.js +199 -0
  129. package/dist/bundle/server-AAK2HWQM.js +79 -0
  130. package/dist/bundle/server-LIBRGMUZ.js +212 -0
  131. package/dist/bundle/sqlite-runtime-SMAREHYG.js +20 -0
  132. package/dist/bundle/state-WPHAVJIU.js +36 -0
  133. package/dist/bundle/store-A7V4FEXE.js +177 -0
  134. package/dist/bundle/store-PMAPJNXT.js +291 -0
  135. package/dist/bundle/store-maintenance-command-QHRHAEYN.js +66 -0
  136. package/dist/bundle/surface-MN4RTNYW.js +65 -0
  137. package/dist/commands/api.d.ts +12 -0
  138. package/dist/commands/api.d.ts.map +1 -0
  139. package/dist/commands/api.js +27 -0
  140. package/dist/commands/api.js.map +1 -0
  141. package/dist/commands/comments.d.ts +3 -0
  142. package/dist/commands/comments.d.ts.map +1 -0
  143. package/dist/commands/comments.js +114 -0
  144. package/dist/commands/comments.js.map +1 -0
  145. package/dist/commands/crm.d.ts +4 -0
  146. package/dist/commands/crm.d.ts.map +1 -0
  147. package/dist/commands/crm.js +66 -0
  148. package/dist/commands/crm.js.map +1 -0
  149. package/dist/commands/session.d.ts +7 -0
  150. package/dist/commands/session.d.ts.map +1 -0
  151. package/dist/commands/session.js +22 -0
  152. package/dist/commands/session.js.map +1 -0
  153. package/dist/config.d.ts +14 -0
  154. package/dist/config.d.ts.map +1 -0
  155. package/dist/config.js +14 -0
  156. package/dist/config.js.map +1 -0
  157. package/dist/context.d.ts +37 -0
  158. package/dist/context.d.ts.map +1 -0
  159. package/dist/context.js +31 -0
  160. package/dist/context.js.map +1 -0
  161. package/dist/generated/definitions.d.ts +3 -0
  162. package/dist/generated/definitions.d.ts.map +1 -0
  163. package/dist/generated/definitions.js +43360 -0
  164. package/dist/generated/definitions.js.map +1 -0
  165. package/dist/generated/manifest.d.ts +6 -0
  166. package/dist/generated/manifest.d.ts.map +1 -0
  167. package/dist/generated/manifest.js +5158 -0
  168. package/dist/generated/manifest.js.map +1 -0
  169. package/dist/generated/schemas.d.ts +383 -0
  170. package/dist/generated/schemas.d.ts.map +1 -0
  171. package/dist/generated/schemas.js +21196 -0
  172. package/dist/generated/schemas.js.map +1 -0
  173. package/dist/generated/types.d.ts +10156 -0
  174. package/dist/generated/types.d.ts.map +1 -0
  175. package/dist/generated/types.js +5 -0
  176. package/dist/generated/types.js.map +1 -0
  177. package/dist/generated/wirecat-config.d.ts +15 -0
  178. package/dist/generated/wirecat-config.d.ts.map +1 -0
  179. package/dist/generated/wirecat-config.js +328 -0
  180. package/dist/generated/wirecat-config.js.map +1 -0
  181. package/dist/hooks.d.ts +3 -0
  182. package/dist/hooks.d.ts.map +1 -0
  183. package/dist/hooks.js +7 -0
  184. package/dist/hooks.js.map +1 -0
  185. package/dist/identity.d.ts +33 -0
  186. package/dist/identity.d.ts.map +1 -0
  187. package/dist/identity.js +31 -0
  188. package/dist/identity.js.map +1 -0
  189. package/dist/index.d.ts +3 -0
  190. package/dist/index.d.ts.map +1 -0
  191. package/dist/index.js +3 -0
  192. package/dist/index.js.map +1 -0
  193. package/dist/program.d.ts +6 -0
  194. package/dist/program.d.ts.map +1 -0
  195. package/dist/program.js +54 -0
  196. package/dist/program.js.map +1 -0
  197. package/dist/sample/comments.d.ts +61 -0
  198. package/dist/sample/comments.d.ts.map +1 -0
  199. package/dist/sample/comments.js +39 -0
  200. package/dist/sample/comments.js.map +1 -0
  201. package/dist/sample/records.d.ts +16 -0
  202. package/dist/sample/records.d.ts.map +1 -0
  203. package/dist/sample/records.js +22 -0
  204. package/dist/sample/records.js.map +1 -0
  205. package/dist/sample/transport.d.ts +42 -0
  206. package/dist/sample/transport.d.ts.map +1 -0
  207. package/dist/sample/transport.js +153 -0
  208. package/dist/sample/transport.js.map +1 -0
  209. package/dist/version.d.ts +2 -0
  210. package/dist/version.d.ts.map +1 -0
  211. package/dist/version.js +2 -0
  212. package/dist/version.js.map +1 -0
  213. package/dist/wcat.d.ts +3 -0
  214. package/dist/wcat.d.ts.map +1 -0
  215. package/dist/wcat.js +4 -0
  216. package/dist/wcat.js.map +1 -0
  217. package/package.json +87 -4
  218. package/skills/attio-cli/SKILL.md +58 -0
  219. package/skills/attio-cli/references/api/api-activities.md +62 -0
  220. package/skills/attio-cli/references/api/api-activity-records.md +96 -0
  221. package/skills/attio-cli/references/api/api-attributes.md +148 -0
  222. package/skills/attio-cli/references/api/api-call-recordings.md +53 -0
  223. package/skills/attio-cli/references/api/api-comments.md +36 -0
  224. package/skills/attio-cli/references/api/api-emails.md +23 -0
  225. package/skills/attio-cli/references/api/api-entries.md +127 -0
  226. package/skills/attio-cli/references/api/api-files.md +63 -0
  227. package/skills/attio-cli/references/api/api-lists.md +44 -0
  228. package/skills/attio-cli/references/api/api-meetings.md +82 -0
  229. package/skills/attio-cli/references/api/api-meta.md +8 -0
  230. package/skills/attio-cli/references/api/api-notes.md +64 -0
  231. package/skills/attio-cli/references/api/api-objects.md +55 -0
  232. package/skills/attio-cli/references/api/api-records.md +168 -0
  233. package/skills/attio-cli/references/api/api-sequences.md +15 -0
  234. package/skills/attio-cli/references/api/api-sql.md +15 -0
  235. package/skills/attio-cli/references/api/api-tasks.md +67 -0
  236. package/skills/attio-cli/references/api/api-threads.md +35 -0
  237. package/skills/attio-cli/references/api/api-transcripts.md +17 -0
  238. package/skills/attio-cli/references/api/api-views.md +133 -0
  239. package/skills/attio-cli/references/api/api-webhooks.md +62 -0
  240. package/skills/attio-cli/references/api/api-workspace-blocklist.md +39 -0
  241. package/skills/attio-cli/references/api/api-workspace-members.md +19 -0
  242. package/skills/attio-cli/references/api.md +35 -0
@@ -0,0 +1,319 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ wrapAnsi
5
+ } from "./chunk-EH6ZEJGT.js";
6
+ import {
7
+ WIRECAT_TOOLS
8
+ } from "./chunk-BHNFRL3H.js";
9
+ import {
10
+ commandPathOf,
11
+ outputOf
12
+ } from "./chunk-O6CVJGGL.js";
13
+ import {
14
+ Command,
15
+ Help,
16
+ NO_EFFECTS,
17
+ Option,
18
+ annotate,
19
+ commandAt,
20
+ environmentOf,
21
+ metaOf,
22
+ takesProfile
23
+ } from "./chunk-WBEZZGZE.js";
24
+ import {
25
+ writes
26
+ } from "./chunk-MZNRIH3T.js";
27
+ import {
28
+ CliError
29
+ } from "./chunk-5DCRHSBI.js";
30
+ import {
31
+ __name
32
+ } from "./chunk-ZVVMGPBJ.js";
33
+
34
+ // node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
35
+ var ARGUMENT_KINDS = {
36
+ chat: "chat",
37
+ chats: "chat",
38
+ message: "message",
39
+ messages: "message",
40
+ post: "message",
41
+ person: "person",
42
+ people: "person",
43
+ task: "task",
44
+ meeting: "meeting",
45
+ folder: "folder",
46
+ folders: "folder",
47
+ topic: "topic",
48
+ note: "note",
49
+ document: "document",
50
+ model: "model"
51
+ };
52
+ var ENTITY_KINDS = {
53
+ message: "message",
54
+ message_link: "message",
55
+ chat: "chat",
56
+ contact: "person",
57
+ member: "person",
58
+ person: "person",
59
+ task: "task",
60
+ meeting: "meeting",
61
+ meeting_details: "meeting",
62
+ meeting_hit: "meeting",
63
+ meeting_summary: "meeting",
64
+ folder: "folder",
65
+ topic: "topic",
66
+ note: "note",
67
+ document: "document",
68
+ model: "model"
69
+ };
70
+ var HOME = {
71
+ chat: "chats",
72
+ message: "messages",
73
+ person: "contacts",
74
+ task: "tasks",
75
+ meeting: "meetings",
76
+ folder: "folders",
77
+ topic: "topics",
78
+ note: "notes",
79
+ document: "documents",
80
+ model: "models"
81
+ };
82
+ var SAMPLES = {
83
+ chat: "Team",
84
+ message: "1234",
85
+ post: "1234",
86
+ person: "Anna",
87
+ people: "Anna",
88
+ task: "12",
89
+ meeting: "123",
90
+ folder: "Work",
91
+ topic: "General",
92
+ model: "default",
93
+ query: '"invoice"',
94
+ text: '"on my way"',
95
+ title: '"Weekly sync"',
96
+ name: "daily",
97
+ id: "1",
98
+ file: "./report.pdf",
99
+ link: "https://example.com/join/abc",
100
+ url: "https://example.com",
101
+ since: "1d",
102
+ duration: "1d",
103
+ limit: "20"
104
+ };
105
+ var MAX_NEXT = 3;
106
+ var choices = /* @__PURE__ */ new WeakMap();
107
+ var kindOfArgument = /* @__PURE__ */ __name((argument) => ARGUMENT_KINDS[argument.name()], "kindOfArgument");
108
+ var runs = /* @__PURE__ */ __name((command) => command.commands.length === 0 || Boolean(command._actionHandler), "runs");
109
+ var leaves = /* @__PURE__ */ __name((command) => command.commands.filter((child) => !child._hidden).flatMap((child) => [...runs(child) ? [child] : [], ...leaves(child)]), "leaves");
110
+ var rootOf = /* @__PURE__ */ __name((command) => {
111
+ let at = command;
112
+ while (at.parent)
113
+ at = at.parent;
114
+ return at;
115
+ }, "rootOf");
116
+ var call = /* @__PURE__ */ __name((command) => [
117
+ rootOf(command).name(),
118
+ ...commandPathOf(command),
119
+ ...command.registeredArguments.map((one) => one.required ? `<${one.name()}>` : `[${one.name()}]`)
120
+ ].join(" "), "call");
121
+ var fieldsOf = /* @__PURE__ */ __name((schema) => {
122
+ const variants = schema.anyOf;
123
+ if (variants)
124
+ return variants.flatMap(fieldsOf);
125
+ const required = schema.required ?? [];
126
+ return [...required, ...Object.keys(schema.properties ?? {})];
127
+ }, "fieldsOf");
128
+ var returnsOf = /* @__PURE__ */ __name((command) => {
129
+ const output = metaOf(command).output;
130
+ const { item, coverage } = outputOf(command);
131
+ if (!output || coverage !== "declared-entity")
132
+ return "";
133
+ const fields = [...new Set(fieldsOf(item))];
134
+ const noun = (output.view ? `${output.entity} ${output.view}` : output.entity).replaceAll("_", " ");
135
+ const more = fields.length > 8 ? `, and ${fields.length - 8} more` : "";
136
+ const root = rootOf(command);
137
+ const schema = commandAt(root, "commands info") ? `; every field: ${root.name()} commands info ${commandPathOf(command).join(" ")}` : "";
138
+ return `${noun} \u2014 ${fields.slice(0, 8).join(", ")}${more}${schema}`;
139
+ }, "returnsOf");
140
+ var nextOf = /* @__PURE__ */ __name((command) => {
141
+ const root = rootOf(command);
142
+ const choice = choices.get(command) ?? {};
143
+ const drop = new Set(choice.drop ?? []);
144
+ const pinned = (choice.pin ?? []).flatMap((path) => commandAt(root, path) ?? []);
145
+ const output = metaOf(command).output;
146
+ const kind = output ? ENTITY_KINDS[output.entity] : void 0;
147
+ const all = leaves(root);
148
+ const derived = kind ? all.filter((other) => other !== command && !pinned.includes(other)).filter((other) => other.registeredArguments.some((argument) => kindOfArgument(argument) === kind)).map((other, order) => ({ other, order })).sort((a, b) => {
149
+ const rank = /* @__PURE__ */ __name((other) => [
150
+ Number(writes(metaOf(other).effects)),
151
+ Number(!other.registeredArguments.some((one) => one.required && kindOfArgument(one) === kind)),
152
+ Number(commandPathOf(other)[0] !== HOME[kind]),
153
+ Number(other.parent !== command.parent)
154
+ ], "rank");
155
+ const [left, right] = [rank(a.other), rank(b.other)];
156
+ return left.reduce((found, value, at) => found || value - (right[at] ?? 0), 0) || a.order - b.order;
157
+ }).map(({ other }) => other) : [];
158
+ return [...pinned, ...derived].filter((other) => !drop.has(commandPathOf(other).join(" "))).slice(0, MAX_NEXT);
159
+ }, "nextOf");
160
+ var sample = /* @__PURE__ */ __name((name) => SAMPLES[name] ?? `<${name}>`, "sample");
161
+ var generatedExample = /* @__PURE__ */ __name((command) => {
162
+ const { query } = metaOf(command);
163
+ const words = command.registeredArguments.flatMap((argument) => {
164
+ const name = argument.name();
165
+ if (name === "query" && query)
166
+ return [];
167
+ if (!argument.required && SAMPLES[name] === void 0)
168
+ return [];
169
+ return [argument.argChoices?.[0] ?? sample(name)];
170
+ });
171
+ const options = command.options.filter((option) => option.mandatory).flatMap((option) => {
172
+ const flag = option.long ?? option.short ?? option.flags;
173
+ const placeholder = /[<[]([^>\]]+)[>\]]/.exec(option.flags)?.[1];
174
+ if (!(option.required || option.optional))
175
+ return [flag];
176
+ return [flag, option.argChoices?.[0] ?? sample(placeholder ?? option.attributeName())];
177
+ });
178
+ return [rootOf(command).name(), ...commandPathOf(command), ...words, ...options].join(" ");
179
+ }, "generatedExample");
180
+ var profiled = /* @__PURE__ */ new WeakSet();
181
+ var EXAMPLE_PROFILE = "personal";
182
+ var withProfile = /* @__PURE__ */ __name((command, example) => {
183
+ const root = rootOf(command);
184
+ const top = commandPathOf(command)[0];
185
+ if (!profiled.has(root) || top === void 0 || !takesProfile(command))
186
+ return example;
187
+ if (example.split(" ").includes("--profiles"))
188
+ return example;
189
+ const prefix = `${root.name()} ${top}`;
190
+ return example === prefix || example.startsWith(`${prefix} `) ? `${root.name()} ${EXAMPLE_PROFILE} ${example.slice(root.name().length + 1)}` : example;
191
+ }, "withProfile");
192
+ var commandHelp = /* @__PURE__ */ __name((command) => {
193
+ const written = metaOf(command).examples ?? [];
194
+ return {
195
+ returns: returnsOf(command),
196
+ next: nextOf(command).map(call),
197
+ examples: (written.length > 0 ? written : [generatedExample(command)]).map((one) => withProfile(command, one)),
198
+ origin: written.length > 0 ? "written" : "generated"
199
+ };
200
+ }, "commandHelp");
201
+ var LABEL = 15;
202
+ var commandHelpText = /* @__PURE__ */ __name((command) => {
203
+ const { returns, next, examples } = commandHelp(command);
204
+ const rows = /* @__PURE__ */ __name((label, values) => values.map((value, at) => `${(at === 0 ? label : "").padEnd(LABEL)}${value}`), "rows");
205
+ const availability = environmentOf(command).discoveryAvailability?.({
206
+ ...metaOf(command),
207
+ path: commandPathOf(command)
208
+ });
209
+ const profileMatters = profiled.has(rootOf(command)) && takesProfile(command);
210
+ const access = !availability ? [] : availability.available ? profileMatters ? rows("Availability:", ["available for this profile"]) : [] : rows("Availability:", [`unavailable \u2014 ${availability.reason}`]);
211
+ return [
212
+ "",
213
+ ...access,
214
+ ...rows("Returns:", returns ? [returns] : []),
215
+ ...rows("Next usually:", next),
216
+ ...rows("Example:", examples),
217
+ ""
218
+ ].join("\n");
219
+ }, "commandHelpText");
220
+ var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {}) => {
221
+ if (profile)
222
+ profiled.add(program);
223
+ for (const command of leaves(program))
224
+ command.addHelpText("after", () => commandHelpText(command));
225
+ }, "installCommandHelp");
226
+
227
+ // node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
228
+ var WIDTH = 100;
229
+ var widest = /* @__PURE__ */ __name((texts) => texts.reduce((most, text) => Math.max(most, text.length), 0), "widest");
230
+ var block = /* @__PURE__ */ __name((title, rows, column) => rows.length === 0 ? [] : ["", `${title}:`, ...rows.map(([left, right]) => ` ${left.padEnd(column)}${right}`)], "block");
231
+ var TOPICS = [
232
+ ["--json", "output"],
233
+ ["--offline", "offline"],
234
+ ["--timeout", "timeouts"],
235
+ ["--dry-run", "dry run"]
236
+ ];
237
+ var optionTopics = /* @__PURE__ */ __name((program) => {
238
+ const longs = new Set(program.options.map((option) => option.long));
239
+ const topics = TOPICS.filter(([long]) => longs.has(long)).map(([, topic]) => topic);
240
+ return topics.length > 0 ? topics.join(", ") : "the options every command takes";
241
+ }, "optionTopics");
242
+ var pointers = /* @__PURE__ */ __name((program, cli, start, profile) => {
243
+ const has = /* @__PURE__ */ __name((path) => commandAt(program, path) !== void 0, "has");
244
+ const next = [
245
+ has("commands") ? [`${cli} commands`, "every command, by section"] : void 0,
246
+ has("guide") ? [`${cli} guide`, "scenarios: command sequences for common tasks"] : void 0,
247
+ [`${cli} help options`, optionTopics(program)]
248
+ ].filter((row) => row !== void 0);
249
+ const rows = [
250
+ ...start ? [["Start here:", start, profile ? "(any profile name works)" : ""]] : [],
251
+ ...has("account list") ? [["", `${cli} account list`, "your profiles and their logged-in accounts"]] : [],
252
+ ...next.map(([command = "", does = ""], at) => [at === 0 ? "Next:" : "", command, does]),
253
+ ...has("skill show") ? [["For agents:", `${cli} skill show`, "rules and the discovery loop"]] : []
254
+ ];
255
+ const width = widest(rows.map(([, command]) => command)) + 2;
256
+ return ["", ...rows.map(([label, command, does]) => `${label.padEnd(14)}${command.padEnd(width)}${does}`.trimEnd())];
257
+ }, "pointers");
258
+ var firstScreen = /* @__PURE__ */ __name((program, screen = {}) => {
259
+ const cli = program.name();
260
+ const profile = screen.profile !== false;
261
+ const pitch = screen.pitch ?? program.description().split("\n")[0] ?? "";
262
+ const can = (screen.can ?? []).map(({ command, does }) => [command, does]);
263
+ const works = WIRECAT_TOOLS.filter((tool) => tool.command !== cli).map(({ command, shown, does }) => [shown ?? command, does]);
264
+ const column = Math.max(22, widest([...can, ...works].map(([left]) => left))) + 2;
265
+ const start = screen.start ?? (commandAt(program, "setup") ? `${cli} ${EXAMPLE_PROFILE} setup` : void 0);
266
+ return [
267
+ wrapAnsi(`${cli} \u2014 ${pitch}`, WIDTH),
268
+ "",
269
+ `Usage: ${cli} ${profile ? "<profile> " : ""}<command> [options]`,
270
+ ...profile ? ["Account commands start with your profile, a name you choose; none is ever assumed."] : [],
271
+ ...block("What you can do", can, column),
272
+ ...block("Works with", works, column),
273
+ ...pointers(program, cli, start, profile),
274
+ ""
275
+ ].join("\n");
276
+ }, "firstScreen");
277
+ var optionsScreen = /* @__PURE__ */ __name((program) => {
278
+ const helper = program.createHelp();
279
+ const width = helper.longestOptionTermLength(program, helper);
280
+ return [
281
+ `Options for every ${program.name()} command:`,
282
+ ...helper.visibleOptions(program).map((option) => helper.formatItem(helper.optionTerm(option), width, helper.optionDescription(option), helper)),
283
+ ""
284
+ ].join("\n");
285
+ }, "optionsScreen");
286
+ var installHelp = /* @__PURE__ */ __name((program, screen = {}) => {
287
+ let full = false;
288
+ const own = program.configureHelp();
289
+ program.configureHelp({
290
+ ...own,
291
+ // Commander copies this configuration to children made with `.command()`, so only the root gets the screen.
292
+ formatHelp: /* @__PURE__ */ __name((command, helper) => command === program && !full ? firstScreen(program, screen) : (own.formatHelp ?? Help.prototype.formatHelp).call(helper, command, helper), "formatHelp")
293
+ });
294
+ installCommandHelp(program, { profile: screen.profile !== false });
295
+ program.addOption(new Option("--help-all", "the full help: every command and option").hideHelp());
296
+ program.on("option:help-all", () => {
297
+ full = true;
298
+ program.help();
299
+ });
300
+ if (program.commands.some((command) => command.name() === "help"))
301
+ return program;
302
+ const help = annotate(new Command("help"), { effects: NO_EFFECTS, mcp: false }).description("this screen; help options: the options for every command; help <command>: that command's help").argument("[topic...]", "options, or a command path").action((topic) => {
303
+ if (topic.length === 0)
304
+ return program.outputHelp();
305
+ if (topic.length === 1 && topic[0] === "options")
306
+ return program.configureOutput().writeOut?.(optionsScreen(program));
307
+ const command = commandAt(program, topic.join(" "));
308
+ if (!command)
309
+ throw new CliError("validation_error", `no command "${topic.join(" ")}" \u2014 run \`${program.name()} help\`, or \`${program.name()} help options\``, { available: program.commands.map((one) => one.name()).filter((name) => name !== "help") });
310
+ command.outputHelp();
311
+ });
312
+ program.addCommand(help, { hidden: true });
313
+ return program;
314
+ }, "installHelp");
315
+
316
+ export {
317
+ firstScreen,
318
+ installHelp
319
+ };
@@ -0,0 +1,230 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ importFrom
5
+ } from "./chunk-Y5E2WNWB.js";
6
+ import {
7
+ CliError
8
+ } from "./chunk-5DCRHSBI.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/speech/recognize.js
14
+ import { createRequire } from "node:module";
15
+
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
17
+ var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
18
+ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
19
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
20
+ let offset = 0;
21
+ let serial;
22
+ let packet = 0;
23
+ let length = 0;
24
+ const prefix = [];
25
+ while (offset < bytes.length) {
26
+ if (offset + 27 > bytes.length || view.getUint32(offset, false) !== 1332176723 || bytes[offset + 4] !== 0)
27
+ throw invalid();
28
+ const stream = view.getUint32(offset + 14, true);
29
+ if (serial !== void 0 && serial !== stream)
30
+ throw invalid();
31
+ serial = stream;
32
+ const segments = bytes[offset + 26] ?? 0;
33
+ let data = offset + 27 + segments;
34
+ if (data > bytes.length || Boolean((bytes[offset + 5] ?? 0) & 1) !== length > 0)
35
+ throw invalid();
36
+ for (let index = 0; index < segments; index++) {
37
+ const size = bytes[offset + 27 + index] ?? 0;
38
+ if (data + size > bytes.length)
39
+ throw invalid();
40
+ const take = Math.min(size, 19 - prefix.length);
41
+ for (let i = 0; i < take; i++)
42
+ prefix.push(bytes[data + i] ?? 0);
43
+ length += size;
44
+ data += size;
45
+ if (size === 255)
46
+ continue;
47
+ if (packet === 0) {
48
+ if (length < 19 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusHead" || ![1, 2].includes(prefix[9] ?? 0) || prefix[18] !== 0)
49
+ throw invalid();
50
+ } else if (packet === 1) {
51
+ if (length < 8 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusTags")
52
+ throw invalid();
53
+ } else {
54
+ if (length < 1)
55
+ throw invalid();
56
+ const toc = prefix[0] ?? 0;
57
+ const config = toc >> 3;
58
+ const frame = config >= 16 ? 120 << (config & 3) : config >= 12 ? 480 << (config & 1) : (config & 3) === 3 ? 2880 : 480 << (config & 3);
59
+ const count = (toc & 3) === 0 ? 1 : (toc & 3) === 3 ? length >= 2 ? (prefix[1] ?? 0) & 63 : 0 : 2;
60
+ if (count < 1 || frame * count > 5760)
61
+ throw invalid();
62
+ }
63
+ packet++;
64
+ length = 0;
65
+ prefix.length = 0;
66
+ }
67
+ offset = data;
68
+ }
69
+ if (length !== 0 || packet < 3)
70
+ throw invalid();
71
+ }, "checkOggDuration");
72
+
73
+ // node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/speech/recognize.js
74
+ var SAMPLE_RATE = 16e3;
75
+ var LEAD = SAMPLE_RATE / 2;
76
+ var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
77
+ const step = rate / SAMPLE_RATE;
78
+ const length = Math.floor(samples.length / step);
79
+ const pcm = new Float32Array(LEAD + length);
80
+ for (let i = 0; i < length; i++) {
81
+ const from = Math.floor(i * step);
82
+ const to = Math.max(from + 1, Math.floor((i + 1) * step));
83
+ let sum = 0;
84
+ for (let j = from; j < to; j++)
85
+ sum += samples[j] ?? 0;
86
+ pcm[LEAD + i] = sum / (to - from);
87
+ }
88
+ return pcm;
89
+ }, "toModelRate");
90
+ var decodeOgg = /* @__PURE__ */ __name(async (bytes) => {
91
+ checkOggDuration(bytes);
92
+ const { OggOpusDecoder } = await importFrom(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href, "ogg-opus-decoder");
93
+ const decoder = new OggOpusDecoder();
94
+ await decoder.ready;
95
+ try {
96
+ const { channelData, sampleRate, samplesDecoded } = await decoder.decodeFile(bytes);
97
+ if (!channelData[0] || samplesDecoded === 0)
98
+ throw new Error("no Ogg Opus audio in it");
99
+ return channelData.map((samples) => ({ samples, rate: sampleRate }));
100
+ } finally {
101
+ decoder.free();
102
+ }
103
+ }, "decodeOgg");
104
+ var WINDOW = 512;
105
+ var detector = /* @__PURE__ */ __name((vadModel) => ({
106
+ sileroVad: {
107
+ model: vadModel,
108
+ // At the default 0.5 a quietly spoken stretch in the middle of a voice message never counted as
109
+ // speech and was lost; 0.3 keeps it for both models and changes nothing on clear speech (126508, 2026-09-30).
110
+ threshold: 0.3,
111
+ minSilenceDuration: 0.5,
112
+ minSpeechDuration: 0.25,
113
+ maxSpeechDuration: 20,
114
+ windowSize: WINDOW
115
+ },
116
+ sampleRate: SAMPLE_RATE,
117
+ numThreads: 1,
118
+ provider: "cpu",
119
+ debug: 0,
120
+ bufferSizeInSeconds: 30
121
+ }), "detector");
122
+ var cut = /* @__PURE__ */ __name((vad, pcm, each) => {
123
+ vad.reset();
124
+ const last = Math.max(0, pcm.length - LEAD);
125
+ const drain = /* @__PURE__ */ __name(() => {
126
+ for (; !vad.isEmpty(); vad.pop()) {
127
+ const { start, samples } = vad.front();
128
+ each({
129
+ start: Math.min(last, Math.max(0, start - LEAD)) / SAMPLE_RATE,
130
+ end: Math.min(last, Math.max(0, start + samples.length - LEAD)) / SAMPLE_RATE,
131
+ samples
132
+ });
133
+ }
134
+ }, "drain");
135
+ for (let i = 0; i + WINDOW <= pcm.length; i += WINDOW) {
136
+ vad.acceptWaveform(pcm.subarray(i, i + WINDOW));
137
+ drain();
138
+ }
139
+ vad.flush();
140
+ drain();
141
+ }, "cut");
142
+ var openSpeechCutter = /* @__PURE__ */ __name((vadModel) => {
143
+ const vad = loadSherpa().createVad(detector(vadModel));
144
+ return {
145
+ cut: /* @__PURE__ */ __name((pcm) => {
146
+ const spans = [];
147
+ cut(vad, pcm, ({ start, end }) => spans.push({ start, end }));
148
+ return spans;
149
+ }, "cut"),
150
+ free: /* @__PURE__ */ __name(() => vad.free(), "free")
151
+ };
152
+ }, "openSpeechCutter");
153
+ var loaded;
154
+ var loadSherpa = /* @__PURE__ */ __name(() => {
155
+ if (loaded)
156
+ return loaded;
157
+ const load = createRequire(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href);
158
+ const wasm = {};
159
+ load("sherpa-onnx/sherpa-onnx-wasm-nodejs.js")(wasm);
160
+ const stdout = wasm.FS?.getStream(1);
161
+ if (stdout)
162
+ stdout.nfd = 2;
163
+ const asr = load("sherpa-onnx/sherpa-onnx-asr.js");
164
+ const vad = load("sherpa-onnx/sherpa-onnx-vad.js");
165
+ loaded = {
166
+ createOfflineRecognizer: /* @__PURE__ */ __name((config) => new asr.OfflineRecognizer(config, wasm), "createOfflineRecognizer"),
167
+ createVad: /* @__PURE__ */ __name((config) => vad.createVad(wasm, config), "createVad")
168
+ };
169
+ return loaded;
170
+ }, "loadSherpa");
171
+ var openRecognizer = /* @__PURE__ */ __name((model, path, vadModel) => {
172
+ const sherpa = loadSherpa();
173
+ const engine = sherpa.createOfflineRecognizer({
174
+ featConfig: { sampleRate: SAMPLE_RATE, featureDim: model.featureDim },
175
+ modelConfig: { ...model.config(path), numThreads: 1, provider: "cpu", debug: 0 },
176
+ decodingMethod: "greedy_search"
177
+ });
178
+ const vad = sherpa.createVad(detector(vadModel));
179
+ const piece = /* @__PURE__ */ __name((samples) => {
180
+ const stream = engine.createStream();
181
+ try {
182
+ stream.acceptWaveform(SAMPLE_RATE, samples);
183
+ engine.decode(stream);
184
+ return engine.getResult(stream).text.trim();
185
+ } finally {
186
+ stream.free();
187
+ }
188
+ }, "piece");
189
+ const pieces = /* @__PURE__ */ __name((pcm) => {
190
+ const heard = [];
191
+ cut(vad, pcm, ({ start, end, samples }) => {
192
+ const text = piece(samples);
193
+ if (text)
194
+ heard.push({ start, end, text });
195
+ });
196
+ return heard;
197
+ }, "pieces");
198
+ const piecesUntil = /* @__PURE__ */ __name(async (pcm, signal) => {
199
+ const spans = [];
200
+ cut(vad, pcm, (span) => spans.push(span));
201
+ const heard = [];
202
+ for (const { start, end, samples } of spans) {
203
+ await new Promise((resolve) => setImmediate(resolve));
204
+ signal.throwIfAborted();
205
+ const text = piece(samples);
206
+ if (text)
207
+ heard.push({ start, end, text });
208
+ }
209
+ return heard;
210
+ }, "piecesUntil");
211
+ return {
212
+ recognize: /* @__PURE__ */ __name((pcm) => pieces(pcm).map(({ text }) => text).join(" "), "recognize"),
213
+ pieces,
214
+ piecesUntil,
215
+ free: /* @__PURE__ */ __name(() => {
216
+ vad.free();
217
+ engine.free();
218
+ }, "free")
219
+ };
220
+ }, "openRecognizer");
221
+
222
+ export {
223
+ SAMPLE_RATE,
224
+ toModelRate,
225
+ decodeOgg,
226
+ detector,
227
+ openSpeechCutter,
228
+ loadSherpa,
229
+ openRecognizer
230
+ };