@wirecat/attio-cli 0.9.0 → 0.11.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 (206) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/contracts/wirecat.json +1 -0
  3. package/dist/bin/attio.js +11 -11
  4. package/dist/bundle/attio.js +5 -166
  5. package/dist/bundle/{chunk-6E5QWCBK.js → chunk-OFEXB726.js} +2 -1
  6. package/dist/bundle/chunk-TQAECZFO.js +13 -0
  7. package/dist/bundle/{definitions-FODOIPM2.js → definitions-J73IBAHT.js} +1 -1
  8. package/dist/bundle/program-4R7RYWV3.js +6210 -0
  9. package/dist/bundle/{schemas-YGSTNU6F.js → schemas-G3HFAS45.js} +576 -29
  10. package/dist/commands/api.js +1 -2
  11. package/dist/commands/crm.js +12 -4
  12. package/dist/commands/schedule.js +1 -1
  13. package/dist/commands/session.js +1 -2
  14. package/dist/config.js +1 -2
  15. package/dist/context.js +1 -1
  16. package/dist/identity.js +1 -0
  17. package/dist/program.js +1 -2
  18. package/dist/version.js +1 -1
  19. package/package.json +3 -3
  20. package/dist/activities.d.ts +0 -4
  21. package/dist/activities.d.ts.map +0 -1
  22. package/dist/activities.js.map +0 -1
  23. package/dist/bin/attio.d.ts +0 -3
  24. package/dist/bin/attio.d.ts.map +0 -1
  25. package/dist/bin/attio.js.map +0 -1
  26. package/dist/bundle/agent-C3SZOGZS.js +0 -38
  27. package/dist/bundle/all-profiles-673VSTRG.js +0 -320
  28. package/dist/bundle/anthropic-V4RZS5XM.js +0 -91
  29. package/dist/bundle/app-server-CTEDPA5H.js +0 -249
  30. package/dist/bundle/bun-F4M4KCNA.js +0 -169
  31. package/dist/bundle/bun-sqlite-33JTNHCK.js +0 -76
  32. package/dist/bundle/chunk-2R2EX5I6.js +0 -54
  33. package/dist/bundle/chunk-5EH7S4RM.js +0 -362
  34. package/dist/bundle/chunk-5N2V6XO7.js +0 -119
  35. package/dist/bundle/chunk-5WY6RURV.js +0 -161
  36. package/dist/bundle/chunk-6V7ZUJI6.js +0 -4072
  37. package/dist/bundle/chunk-AOKAYQSJ.js +0 -2338
  38. package/dist/bundle/chunk-AQ5RIOUE.js +0 -633
  39. package/dist/bundle/chunk-B4DVW2BA.js +0 -185
  40. package/dist/bundle/chunk-C7JPYWYQ.js +0 -77
  41. package/dist/bundle/chunk-D72URWJE.js +0 -532
  42. package/dist/bundle/chunk-DBHZ7TQ7.js +0 -69828
  43. package/dist/bundle/chunk-DFDN6AUB.js +0 -21
  44. package/dist/bundle/chunk-DNCLQPOM.js +0 -7
  45. package/dist/bundle/chunk-DPV53EZC.js +0 -206
  46. package/dist/bundle/chunk-E2L4R6EI.js +0 -388
  47. package/dist/bundle/chunk-EDWRHVHD.js +0 -218
  48. package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
  49. package/dist/bundle/chunk-EV6B3GHM.js +0 -323
  50. package/dist/bundle/chunk-FBWECICU.js +0 -259
  51. package/dist/bundle/chunk-FFER7KJI.js +0 -407
  52. package/dist/bundle/chunk-FTH6WGYO.js +0 -24
  53. package/dist/bundle/chunk-G3PK5BZB.js +0 -1222
  54. package/dist/bundle/chunk-G46PNDWL.js +0 -58
  55. package/dist/bundle/chunk-G6NY7LFB.js +0 -230
  56. package/dist/bundle/chunk-GLU36VKA.js +0 -52
  57. package/dist/bundle/chunk-GZ7WBU5Y.js +0 -18
  58. package/dist/bundle/chunk-HMYBAVIE.js +0 -86
  59. package/dist/bundle/chunk-HOJJPSLU.js +0 -288
  60. package/dist/bundle/chunk-HUAHLO6N.js +0 -29
  61. package/dist/bundle/chunk-ISQ23VKV.js +0 -123
  62. package/dist/bundle/chunk-J2LSOG3A.js +0 -12766
  63. package/dist/bundle/chunk-K5L77R7P.js +0 -66
  64. package/dist/bundle/chunk-KKRFVN4X.js +0 -1835
  65. package/dist/bundle/chunk-KLRCTMES.js +0 -100
  66. package/dist/bundle/chunk-KYRYD4CR.js +0 -38
  67. package/dist/bundle/chunk-L5QLKUQR.js +0 -794
  68. package/dist/bundle/chunk-MFSWMNSZ.js +0 -334
  69. package/dist/bundle/chunk-MYK2F5LD.js +0 -1251
  70. package/dist/bundle/chunk-NBNQLNVV.js +0 -388
  71. package/dist/bundle/chunk-O3DZDITT.js +0 -274
  72. package/dist/bundle/chunk-OEEWVKJX.js +0 -53
  73. package/dist/bundle/chunk-P5XYQZVW.js +0 -80
  74. package/dist/bundle/chunk-P6OJKJJS.js +0 -1197
  75. package/dist/bundle/chunk-P6S3ZRVW.js +0 -106
  76. package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
  77. package/dist/bundle/chunk-QBJRK733.js +0 -1068
  78. package/dist/bundle/chunk-QBYE26ZC.js +0 -131
  79. package/dist/bundle/chunk-QPPOIWPY.js +0 -1246
  80. package/dist/bundle/chunk-R2CEA7MK.js +0 -743
  81. package/dist/bundle/chunk-S4UUN6LD.js +0 -1410
  82. package/dist/bundle/chunk-S6JG4YUH.js +0 -72
  83. package/dist/bundle/chunk-SKUY7JDA.js +0 -164
  84. package/dist/bundle/chunk-T35IOBPJ.js +0 -1341
  85. package/dist/bundle/chunk-T3W4V4A6.js +0 -63
  86. package/dist/bundle/chunk-TB3LN5G2.js +0 -50
  87. package/dist/bundle/chunk-TCT5D2X2.js +0 -6848
  88. package/dist/bundle/chunk-TES7MB6I.js +0 -82
  89. package/dist/bundle/chunk-TXDR6YSF.js +0 -23
  90. package/dist/bundle/chunk-TY7NDMFY.js +0 -46
  91. package/dist/bundle/chunk-U7UTYALA.js +0 -353
  92. package/dist/bundle/chunk-UOWHMOU3.js +0 -188
  93. package/dist/bundle/chunk-UXDUWGX6.js +0 -2791
  94. package/dist/bundle/chunk-V5I3QHDU.js +0 -558
  95. package/dist/bundle/chunk-VCDIKCFE.js +0 -1007
  96. package/dist/bundle/chunk-VJHUMB7U.js +0 -338
  97. package/dist/bundle/chunk-W4KLHM2K.js +0 -95
  98. package/dist/bundle/chunk-W5LKEOGN.js +0 -142
  99. package/dist/bundle/chunk-WLDZWHSF.js +0 -170
  100. package/dist/bundle/chunk-WQEEYEWO.js +0 -3752
  101. package/dist/bundle/chunk-WRF6TY63.js +0 -1521
  102. package/dist/bundle/chunk-WXYOELRI.js +0 -108
  103. package/dist/bundle/chunk-WZBPUOWM.js +0 -76
  104. package/dist/bundle/chunk-XGNZD52X.js +0 -592
  105. package/dist/bundle/chunk-XQUUANA2.js +0 -24600
  106. package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
  107. package/dist/bundle/chunk-YQH4J6YZ.js +0 -358
  108. package/dist/bundle/chunk-Z7Y2I5YR.js +0 -44045
  109. package/dist/bundle/chunk-ZBCC7MBN.js +0 -9671
  110. package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
  111. package/dist/bundle/command-contract-ZL67KMYL.js +0 -37
  112. package/dist/bundle/command-server-entry-COR2VDRU.js +0 -166
  113. package/dist/bundle/decode-33SGRQM6.js +0 -297
  114. package/dist/bundle/dispatch-2FTOHA5D.js +0 -411
  115. package/dist/bundle/dist-EM7KLEG4.js +0 -7577
  116. package/dist/bundle/dist-PAKDDIBT.js +0 -191
  117. package/dist/bundle/echarts-QMAA7HH5.js +0 -42501
  118. package/dist/bundle/embed-W4ZBXPWD.js +0 -38
  119. package/dist/bundle/embedder-73CCZC52.js +0 -111
  120. package/dist/bundle/failure-OHIXWTR6.js +0 -25
  121. package/dist/bundle/first-run-MOSUMMVX.js +0 -28
  122. package/dist/bundle/first-screen-GUXBF3SL.js +0 -38
  123. package/dist/bundle/instructions-4H7UREH2.js +0 -11
  124. package/dist/bundle/mcp-5HFPWC3W.js +0 -167
  125. package/dist/bundle/meeting-combined-QMIZOBBJ.js +0 -24
  126. package/dist/bundle/meeting-model-2UYVGXD5.js +0 -25
  127. package/dist/bundle/meeting-semantic-LEJPUIN3.js +0 -22
  128. package/dist/bundle/node-KM3CUABH.js +0 -2340
  129. package/dist/bundle/node-P3PUHKYH.js +0 -176
  130. package/dist/bundle/node-TLZSIHIJ.js +0 -21
  131. package/dist/bundle/node-sqlite-UHPODTKB.js +0 -74
  132. package/dist/bundle/oauth-T3DWL7OV.js +0 -20
  133. package/dist/bundle/open-ODWX32PF.js +0 -23
  134. package/dist/bundle/openai-GSXXHKPX.js +0 -238
  135. package/dist/bundle/process-AFIXYXWL.js +0 -91
  136. package/dist/bundle/program-SXSUG335.js +0 -35250
  137. package/dist/bundle/prompt-GVTYTFK7.js +0 -17
  138. package/dist/bundle/recognize-XDSZEZP5.js +0 -26
  139. package/dist/bundle/remote-ZWZKMEY6.js +0 -31
  140. package/dist/bundle/rerank-OBZQ54NL.js +0 -52
  141. package/dist/bundle/serve-NY5MUTNW.js +0 -199
  142. package/dist/bundle/server-JK334V5Y.js +0 -212
  143. package/dist/bundle/server-VOPYQCUD.js +0 -79
  144. package/dist/bundle/sqlite-runtime-2NHF4S6G.js +0 -20
  145. package/dist/bundle/state-YGWZZWPM.js +0 -36
  146. package/dist/bundle/store-LRQUTFJR.js +0 -306
  147. package/dist/bundle/store-ND6KU4RI.js +0 -181
  148. package/dist/bundle/store-maintenance-command-GLYGQM2V.js +0 -66
  149. package/dist/bundle/surface-P53WLLXP.js +0 -65
  150. package/dist/commands/api.d.ts +0 -12
  151. package/dist/commands/api.d.ts.map +0 -1
  152. package/dist/commands/api.js.map +0 -1
  153. package/dist/commands/crm.d.ts +0 -7
  154. package/dist/commands/crm.d.ts.map +0 -1
  155. package/dist/commands/crm.js.map +0 -1
  156. package/dist/commands/schedule.d.ts +0 -3
  157. package/dist/commands/schedule.d.ts.map +0 -1
  158. package/dist/commands/schedule.js.map +0 -1
  159. package/dist/commands/session.d.ts +0 -8
  160. package/dist/commands/session.d.ts.map +0 -1
  161. package/dist/commands/session.js.map +0 -1
  162. package/dist/config.d.ts +0 -13
  163. package/dist/config.d.ts.map +0 -1
  164. package/dist/config.js.map +0 -1
  165. package/dist/context.d.ts +0 -37
  166. package/dist/context.d.ts.map +0 -1
  167. package/dist/context.js.map +0 -1
  168. package/dist/generated/definitions.d.ts +0 -3
  169. package/dist/generated/definitions.d.ts.map +0 -1
  170. package/dist/generated/definitions.js.map +0 -1
  171. package/dist/generated/manifest.d.ts +0 -6
  172. package/dist/generated/manifest.d.ts.map +0 -1
  173. package/dist/generated/manifest.js.map +0 -1
  174. package/dist/generated/schemas.d.ts +0 -383
  175. package/dist/generated/schemas.d.ts.map +0 -1
  176. package/dist/generated/schemas.js.map +0 -1
  177. package/dist/generated/types.d.ts +0 -10166
  178. package/dist/generated/types.d.ts.map +0 -1
  179. package/dist/generated/types.js.map +0 -1
  180. package/dist/generated/wirecat-config.d.ts +0 -15
  181. package/dist/generated/wirecat-config.d.ts.map +0 -1
  182. package/dist/generated/wirecat-config.js.map +0 -1
  183. package/dist/hooks.d.ts +0 -33
  184. package/dist/hooks.d.ts.map +0 -1
  185. package/dist/hooks.js.map +0 -1
  186. package/dist/identity.d.ts +0 -33
  187. package/dist/identity.d.ts.map +0 -1
  188. package/dist/identity.js.map +0 -1
  189. package/dist/index.d.ts +0 -3
  190. package/dist/index.d.ts.map +0 -1
  191. package/dist/index.js.map +0 -1
  192. package/dist/links.d.ts +0 -10
  193. package/dist/links.d.ts.map +0 -1
  194. package/dist/links.js.map +0 -1
  195. package/dist/meetings.d.ts +0 -57
  196. package/dist/meetings.d.ts.map +0 -1
  197. package/dist/meetings.js.map +0 -1
  198. package/dist/program.d.ts +0 -6
  199. package/dist/program.d.ts.map +0 -1
  200. package/dist/program.js.map +0 -1
  201. package/dist/version.d.ts +0 -2
  202. package/dist/version.d.ts.map +0 -1
  203. package/dist/version.js.map +0 -1
  204. package/dist/wcat.d.ts +0 -3
  205. package/dist/wcat.d.ts.map +0 -1
  206. package/dist/wcat.js.map +0 -1
@@ -1,323 +0,0 @@
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-ISQ23VKV.js";
9
- import {
10
- hasOwnAction,
11
- isHidden
12
- } from "./chunk-HUAHLO6N.js";
13
- import {
14
- commandPathOf,
15
- outputOf
16
- } from "./chunk-QBYE26ZC.js";
17
- import {
18
- Command,
19
- Help,
20
- NO_EFFECTS,
21
- Option,
22
- annotate,
23
- commandAt,
24
- environmentOf,
25
- metaOf,
26
- takesProfile
27
- } from "./chunk-J2LSOG3A.js";
28
- import {
29
- writes
30
- } from "./chunk-QPPOIWPY.js";
31
- import {
32
- CliError
33
- } from "./chunk-S6JG4YUH.js";
34
- import {
35
- __name
36
- } from "./chunk-ZVVMGPBJ.js";
37
-
38
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
39
- var ARGUMENT_KINDS = {
40
- chat: "chat",
41
- chats: "chat",
42
- message: "message",
43
- messages: "message",
44
- post: "message",
45
- person: "person",
46
- people: "person",
47
- task: "task",
48
- meeting: "meeting",
49
- folder: "folder",
50
- folders: "folder",
51
- topic: "topic",
52
- note: "note",
53
- document: "document",
54
- model: "model"
55
- };
56
- var ENTITY_KINDS = {
57
- message: "message",
58
- message_link: "message",
59
- chat: "chat",
60
- contact: "person",
61
- member: "person",
62
- person: "person",
63
- task: "task",
64
- meeting: "meeting",
65
- meeting_details: "meeting",
66
- meeting_hit: "meeting",
67
- meeting_summary: "meeting",
68
- folder: "folder",
69
- topic: "topic",
70
- note: "note",
71
- document: "document",
72
- model: "model"
73
- };
74
- var HOME = {
75
- chat: "chats",
76
- message: "messages",
77
- person: "contacts",
78
- task: "tasks",
79
- meeting: "meetings",
80
- folder: "folders",
81
- topic: "topics",
82
- note: "notes",
83
- document: "documents",
84
- model: "models"
85
- };
86
- var SAMPLES = {
87
- chat: "Team",
88
- message: "1234",
89
- post: "1234",
90
- person: "Anna",
91
- people: "Anna",
92
- task: "12",
93
- meeting: "123",
94
- folder: "Work",
95
- topic: "General",
96
- model: "default",
97
- query: '"invoice"',
98
- text: '"on my way"',
99
- title: '"Weekly sync"',
100
- name: "daily",
101
- id: "1",
102
- file: "./report.pdf",
103
- link: "https://example.com/join/abc",
104
- url: "https://example.com",
105
- since: "1d",
106
- duration: "1d",
107
- limit: "20"
108
- };
109
- var MAX_NEXT = 3;
110
- var choices = /* @__PURE__ */ new WeakMap();
111
- var kindOfArgument = /* @__PURE__ */ __name((argument) => ARGUMENT_KINDS[argument.name()], "kindOfArgument");
112
- var runs = /* @__PURE__ */ __name((command) => command.commands.length === 0 || hasOwnAction(command), "runs");
113
- var leaves = /* @__PURE__ */ __name((command) => command.commands.filter((child) => !isHidden(child)).flatMap((child) => [...runs(child) ? [child] : [], ...leaves(child)]), "leaves");
114
- var rootOf = /* @__PURE__ */ __name((command) => {
115
- let at = command;
116
- while (at.parent)
117
- at = at.parent;
118
- return at;
119
- }, "rootOf");
120
- var call = /* @__PURE__ */ __name((command) => [
121
- rootOf(command).name(),
122
- ...commandPathOf(command),
123
- ...command.registeredArguments.map((one) => one.required ? `<${one.name()}>` : `[${one.name()}]`)
124
- ].join(" "), "call");
125
- var fieldsOf = /* @__PURE__ */ __name((schema) => {
126
- const variants = schema.anyOf;
127
- if (variants)
128
- return variants.flatMap(fieldsOf);
129
- const required = schema.required ?? [];
130
- return [...required, ...Object.keys(schema.properties ?? {})];
131
- }, "fieldsOf");
132
- var returnsOf = /* @__PURE__ */ __name((command) => {
133
- const output = metaOf(command).output;
134
- const { item, coverage } = outputOf(command);
135
- if (!output || coverage !== "declared-entity")
136
- return "";
137
- const fields = [...new Set(fieldsOf(item))];
138
- const noun = (output.view ? `${output.entity} ${output.view}` : output.entity).replaceAll("_", " ");
139
- const more = fields.length > 8 ? `, and ${fields.length - 8} more` : "";
140
- const root = rootOf(command);
141
- const schema = commandAt(root, "commands info") ? `; every field: ${root.name()} commands info ${commandPathOf(command).join(" ")}` : "";
142
- return `${noun} \u2014 ${fields.slice(0, 8).join(", ")}${more}${schema}`;
143
- }, "returnsOf");
144
- var nextOf = /* @__PURE__ */ __name((command) => {
145
- const root = rootOf(command);
146
- const choice = choices.get(command) ?? {};
147
- const drop = new Set(choice.drop ?? []);
148
- const pinned = (choice.pin ?? []).flatMap((path) => commandAt(root, path) ?? []);
149
- const output = metaOf(command).output;
150
- const kind = output ? ENTITY_KINDS[output.entity] : void 0;
151
- const all = leaves(root);
152
- 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) => {
153
- const rank = /* @__PURE__ */ __name((other) => [
154
- Number(writes(metaOf(other).effects)),
155
- Number(!other.registeredArguments.some((one) => one.required && kindOfArgument(one) === kind)),
156
- Number(commandPathOf(other)[0] !== HOME[kind]),
157
- Number(other.parent !== command.parent)
158
- ], "rank");
159
- const [left, right] = [rank(a.other), rank(b.other)];
160
- return left.reduce((found, value, at) => found || value - (right[at] ?? 0), 0) || a.order - b.order;
161
- }).map(({ other }) => other) : [];
162
- return [...pinned, ...derived].filter((other) => !drop.has(commandPathOf(other).join(" "))).slice(0, MAX_NEXT);
163
- }, "nextOf");
164
- var sample = /* @__PURE__ */ __name((name) => SAMPLES[name] ?? `<${name}>`, "sample");
165
- var generatedExample = /* @__PURE__ */ __name((command) => {
166
- const { query } = metaOf(command);
167
- const words = command.registeredArguments.flatMap((argument) => {
168
- const name = argument.name();
169
- if (name === "query" && query)
170
- return [];
171
- if (!argument.required && SAMPLES[name] === void 0)
172
- return [];
173
- return [argument.argChoices?.[0] ?? sample(name)];
174
- });
175
- const options = command.options.filter((option) => option.mandatory).flatMap((option) => {
176
- const flag = option.long ?? option.short ?? option.flags;
177
- const placeholder = /[<[]([^>\]]+)[>\]]/.exec(option.flags)?.[1];
178
- if (!(option.required || option.optional))
179
- return [flag];
180
- return [flag, option.argChoices?.[0] ?? sample(placeholder ?? option.attributeName())];
181
- });
182
- return [rootOf(command).name(), ...commandPathOf(command), ...words, ...options].join(" ");
183
- }, "generatedExample");
184
- var profiled = /* @__PURE__ */ new WeakSet();
185
- var EXAMPLE_PROFILE = "personal";
186
- var withProfile = /* @__PURE__ */ __name((command, example) => {
187
- const root = rootOf(command);
188
- const top = commandPathOf(command)[0];
189
- if (!profiled.has(root) || top === void 0 || !takesProfile(command))
190
- return example;
191
- if (example.split(" ").includes("--profiles"))
192
- return example;
193
- const prefix = `${root.name()} ${top}`;
194
- return example === prefix || example.startsWith(`${prefix} `) ? `${root.name()} ${EXAMPLE_PROFILE} ${example.slice(root.name().length + 1)}` : example;
195
- }, "withProfile");
196
- var commandHelp = /* @__PURE__ */ __name((command) => {
197
- const written = metaOf(command).examples ?? [];
198
- return {
199
- returns: returnsOf(command),
200
- next: nextOf(command).map(call),
201
- examples: (written.length > 0 ? written : [generatedExample(command)]).map((one) => withProfile(command, one)),
202
- origin: written.length > 0 ? "written" : "generated"
203
- };
204
- }, "commandHelp");
205
- var LABEL = 15;
206
- var commandHelpText = /* @__PURE__ */ __name((command) => {
207
- const { returns, next, examples } = commandHelp(command);
208
- const rows = /* @__PURE__ */ __name((label, values) => values.map((value, at) => `${(at === 0 ? label : "").padEnd(LABEL)}${value}`), "rows");
209
- const availability = environmentOf(command).discoveryAvailability?.({
210
- ...metaOf(command),
211
- path: commandPathOf(command)
212
- });
213
- const profileMatters = profiled.has(rootOf(command)) && takesProfile(command);
214
- const access = !availability ? [] : availability.available ? profileMatters ? rows("Availability:", ["available for this profile"]) : [] : rows("Availability:", [`unavailable \u2014 ${availability.reason}`]);
215
- return [
216
- "",
217
- ...access,
218
- ...rows("Returns:", returns ? [returns] : []),
219
- ...rows("Next usually:", next),
220
- ...rows("Example:", examples),
221
- ""
222
- ].join("\n");
223
- }, "commandHelpText");
224
- var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {}) => {
225
- if (profile)
226
- profiled.add(program);
227
- for (const command of leaves(program))
228
- command.addHelpText("after", () => commandHelpText(command));
229
- }, "installCommandHelp");
230
-
231
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
232
- var WIDTH = 100;
233
- var widest = /* @__PURE__ */ __name((texts) => texts.reduce((most, text) => Math.max(most, text.length), 0), "widest");
234
- var block = /* @__PURE__ */ __name((title, rows, column) => rows.length === 0 ? [] : ["", `${title}:`, ...rows.map(([left, right]) => ` ${left.padEnd(column)}${right}`)], "block");
235
- var TOPICS = [
236
- ["--json", "output"],
237
- ["--offline", "offline"],
238
- ["--timeout", "timeouts"],
239
- ["--dry-run", "dry run"]
240
- ];
241
- var optionTopics = /* @__PURE__ */ __name((program) => {
242
- const longs = new Set(program.options.map((option) => option.long));
243
- const topics = TOPICS.filter(([long]) => longs.has(long)).map(([, topic]) => topic);
244
- return topics.length > 0 ? topics.join(", ") : "the options every command takes";
245
- }, "optionTopics");
246
- var pointers = /* @__PURE__ */ __name((program, cli, start, profile) => {
247
- const has = /* @__PURE__ */ __name((path) => commandAt(program, path) !== void 0, "has");
248
- const next = [
249
- has("commands") ? [`${cli} commands`, "every command, by section"] : void 0,
250
- has("guide") ? [`${cli} guide`, "scenarios: command sequences for common tasks"] : void 0,
251
- [`${cli} help options`, optionTopics(program)]
252
- ].filter((row) => row !== void 0);
253
- const rows = [
254
- ...start ? [["Start here:", start, profile ? "(any profile name works)" : ""]] : [],
255
- ...has("session list") ? [["", `${cli} session list`, "your profiles and their logged-in accounts"]] : [],
256
- ...next.map(([command = "", does = ""], at) => [at === 0 ? "Next:" : "", command, does]),
257
- ...has("skill show") ? [["For agents:", `${cli} skill show`, "rules and the discovery loop"]] : []
258
- ];
259
- const width = widest(rows.map(([, command]) => command)) + 2;
260
- return ["", ...rows.map(([label, command, does]) => `${label.padEnd(14)}${command.padEnd(width)}${does}`.trimEnd())];
261
- }, "pointers");
262
- var firstScreen = /* @__PURE__ */ __name((program, screen = {}) => {
263
- const cli = program.name();
264
- const profile = screen.profile !== false;
265
- const pitch = screen.pitch ?? program.description().split("\n")[0] ?? "";
266
- const can = (screen.can ?? []).map(({ command, does }) => [command, does]);
267
- const works = WIRECAT_TOOLS.filter((tool) => tool.command !== cli).map(({ command, shown, does }) => [shown ?? command, does]);
268
- const column = Math.max(22, widest([...can, ...works].map(([left]) => left))) + 2;
269
- const start = screen.start ?? (commandAt(program, "setup") ? `${cli} ${EXAMPLE_PROFILE} setup` : void 0);
270
- return [
271
- wrapAnsi(`${cli} \u2014 ${pitch}`, WIDTH),
272
- "",
273
- `Usage: ${cli} ${profile ? "<profile> " : ""}<command> [options]`,
274
- ...profile ? ["Account commands start with your profile, a name you choose; none is ever assumed."] : [],
275
- ...block("What you can do", can, column),
276
- ...block("Works with", works, column),
277
- ...pointers(program, cli, start, profile),
278
- ""
279
- ].join("\n");
280
- }, "firstScreen");
281
- var optionsScreen = /* @__PURE__ */ __name((program) => {
282
- const helper = program.createHelp();
283
- const width = helper.longestOptionTermLength(program, helper);
284
- return [
285
- `Options for every ${program.name()} command:`,
286
- ...helper.visibleOptions(program).map((option) => helper.formatItem(helper.optionTerm(option), width, helper.optionDescription(option), helper)),
287
- ""
288
- ].join("\n");
289
- }, "optionsScreen");
290
- var installHelp = /* @__PURE__ */ __name((program, screen = {}) => {
291
- let full = false;
292
- const own = program.configureHelp();
293
- program.configureHelp({
294
- ...own,
295
- // Commander copies this configuration to children made with `.command()`, so only the root gets the screen.
296
- formatHelp: /* @__PURE__ */ __name((command, helper) => command === program && !full ? firstScreen(program, screen) : (own.formatHelp ?? Help.prototype.formatHelp).call(helper, command, helper), "formatHelp")
297
- });
298
- installCommandHelp(program, { profile: screen.profile !== false });
299
- program.addOption(new Option("--help-all", "the full help: every command and option").hideHelp());
300
- program.on("option:help-all", () => {
301
- full = true;
302
- program.help();
303
- });
304
- if (program.commands.some((command) => command.name() === "help"))
305
- return program;
306
- 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) => {
307
- if (topic.length === 0)
308
- return program.outputHelp();
309
- if (topic.length === 1 && topic[0] === "options")
310
- return program.configureOutput().writeOut?.(optionsScreen(program));
311
- const command = commandAt(program, topic.join(" "));
312
- if (!command)
313
- 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") });
314
- command.outputHelp();
315
- });
316
- program.addCommand(help, { hidden: true });
317
- return program;
318
- }, "installHelp");
319
-
320
- export {
321
- firstScreen,
322
- installHelp
323
- };
@@ -1,259 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- textModel,
5
- vectorModelKey
6
- } from "./chunk-MFSWMNSZ.js";
7
- import {
8
- OPENAI_URL,
9
- openRemote,
10
- remoteKey,
11
- remoteModel
12
- } from "./chunk-B4DVW2BA.js";
13
- import {
14
- endpointFetch
15
- } from "./chunk-NBNQLNVV.js";
16
- import {
17
- isTextModelInstalled,
18
- openEmbedder,
19
- textModelsDirectory
20
- } from "./chunk-VCDIKCFE.js";
21
- import {
22
- CliError
23
- } from "./chunk-S6JG4YUH.js";
24
- import {
25
- __name
26
- } from "./chunk-ZVVMGPBJ.js";
27
-
28
- // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
29
- var integer = /* @__PURE__ */ __name((value, name, max) => {
30
- if (!Number.isSafeInteger(value) || value < 1 || value > max)
31
- throw new CliError("validation_error", `Invalid ${name}`);
32
- return value;
33
- }, "integer");
34
- var cancelled = /* @__PURE__ */ __name((signal) => {
35
- if (signal?.aborted)
36
- throw new CliError("cancelled", "Meeting embedding was cancelled");
37
- }, "cancelled");
38
- var validatedRemote = /* @__PURE__ */ __name((remote) => {
39
- let url;
40
- try {
41
- url = new URL(remote.baseUrl);
42
- } catch {
43
- throw new CliError("validation_error", "Invalid embedding endpoint");
44
- }
45
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
46
- throw new CliError("validation_error", "Embedding endpoint requires HTTP/S without credentials, query or fragment");
47
- if (typeof remote.model !== "string" || !/^[\w./:-]{1,200}$/.test(remote.model))
48
- throw new CliError("validation_error", "Invalid embedding model name");
49
- const dims = integer(remote.dims, "embedding dimensions", 8192);
50
- const baseUrl = remote.baseUrl.replace(/\/+$/, "");
51
- const result = remoteModel({ model: remote.model, dims, ...baseUrl === OPENAI_URL ? {} : { baseUrl } });
52
- return result;
53
- }, "validatedRemote");
54
- var meetingEmbeddingModel = /* @__PURE__ */ __name((choice, env) => {
55
- if (typeof choice === "string") {
56
- const model = textModel(choice, env);
57
- return { key: vectorModelKey(model), dims: model.dims, kind: "local", model: model.id };
58
- }
59
- if (!choice || typeof choice !== "object" || !choice.remote)
60
- throw new CliError("validation_error", "An explicit embedding model is required");
61
- const remote = validatedRemote(choice.remote);
62
- if (choice.concurrency !== void 0 && choice.concurrency !== 1)
63
- throw new CliError("validation_error", "Meeting embedding supports one remote request worker");
64
- return { key: remoteKey(remote), dims: remote.dims, kind: "remote", model: remote.model };
65
- }, "meetingEmbeddingModel");
66
- var createMeetingRemoteModel = /* @__PURE__ */ __name((input) => {
67
- try {
68
- return validatedRemote(remoteModel(input));
69
- } catch (error) {
70
- if (error instanceof CliError)
71
- throw error;
72
- throw new CliError("validation_error", "Invalid embedding endpoint");
73
- }
74
- }, "createMeetingRemoteModel");
75
- var withAbort = /* @__PURE__ */ __name(async (pending, signal) => {
76
- cancelled(signal);
77
- if (!signal)
78
- return pending;
79
- let onAbort = /* @__PURE__ */ __name(() => {
80
- }, "onAbort");
81
- const interrupted = new Promise((_, reject) => {
82
- onAbort = /* @__PURE__ */ __name(() => reject(new CliError("cancelled", "Meeting embedding was cancelled")), "onAbort");
83
- signal.addEventListener("abort", onAbort, { once: true });
84
- });
85
- try {
86
- return await Promise.race([pending, interrupted]);
87
- } finally {
88
- signal.removeEventListener("abort", onAbort);
89
- }
90
- }, "withAbort");
91
- var boundedResponse = /* @__PURE__ */ __name(async (response, maxBytes, signal) => {
92
- const length = response.headers.get("content-length");
93
- if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
94
- void response.body?.cancel().catch(() => {
95
- });
96
- throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
97
- }
98
- if (!response.body)
99
- throw new CliError("invalid_response", "Embedding response has no body");
100
- const reader = response.body.getReader();
101
- const chunks = [];
102
- let bytes = 0;
103
- try {
104
- for (; ; ) {
105
- cancelled(signal);
106
- const part = await withAbort(reader.read(), signal);
107
- cancelled(signal);
108
- if (part.done)
109
- break;
110
- bytes += part.value.byteLength;
111
- if (bytes > maxBytes)
112
- throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
113
- chunks.push(part.value);
114
- }
115
- const body = Buffer.concat(chunks, bytes).toString("utf8");
116
- try {
117
- return JSON.parse(body);
118
- } catch {
119
- throw new CliError("invalid_response", "Embedding response is not JSON");
120
- }
121
- } finally {
122
- void reader.cancel().catch(() => {
123
- });
124
- reader.releaseLock();
125
- }
126
- }, "boundedResponse");
127
- var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) => {
128
- const descriptor = meetingEmbeddingModel(choice, options.env);
129
- const { signal } = options;
130
- cancelled(signal);
131
- const maxInputBytes = integer(options.maxInputBytes ?? 1024 * 1024, "input byte budget", 16 * 1024 * 1024);
132
- const maxResponseBytes = integer(options.maxResponseBytes ?? 8 * 1024 * 1024, "response byte budget", 64 * 1024 * 1024);
133
- if (options.threads !== void 0)
134
- integer(options.threads, "embedding threads", 128);
135
- let engine;
136
- let remoteFailure;
137
- if (typeof choice === "string") {
138
- const model = textModel(choice, options.env);
139
- const directory = options.directory ?? textModelsDirectory(options.env);
140
- if (!isTextModelInstalled(model, directory))
141
- throw new CliError("configuration_error", "The explicit local embedding model is not installed");
142
- engine = await openEmbedder(model, directory, {
143
- ...options.threads === void 0 ? {} : { threads: options.threads }
144
- });
145
- } else {
146
- const remote = validatedRemote(choice.remote);
147
- const key = choice.apiKey ?? (remote.provider === "openai" ? (options.env ?? process.env).OPENAI_API_KEY : void 0);
148
- if (remote.provider === "openai" && !key)
149
- throw new CliError("authentication_error", "The explicit remote embedding model requires an API key");
150
- const post = options.fetch ?? endpointFetch(remote.baseUrl, 12e4);
151
- const guarded = /* @__PURE__ */ __name(async (url, init) => {
152
- try {
153
- cancelled(signal);
154
- const responseTask = post(url, { ...init, redirect: "manual", ...signal ? { signal } : {} }).then((response2) => {
155
- if (signal?.aborted) {
156
- void response2.body?.cancel().catch(() => {
157
- });
158
- cancelled(signal);
159
- }
160
- return response2;
161
- });
162
- const response = await withAbort(responseTask, signal);
163
- if (signal?.aborted) {
164
- void response.body?.cancel().catch(() => {
165
- });
166
- cancelled(signal);
167
- }
168
- if (response.status >= 300 && response.status < 400) {
169
- void response.body?.cancel().catch(() => {
170
- });
171
- throw new CliError("invalid_response", "Embedding redirects are refused");
172
- }
173
- if (!response.ok) {
174
- void response.body?.cancel().catch(() => {
175
- });
176
- return new Response("{}", { status: response.status });
177
- }
178
- const body = await boundedResponse(response, maxResponseBytes, signal);
179
- if (!body || typeof body !== "object" || !("data" in body) || !Array.isArray(body.data) || body.data.length > 256)
180
- throw new CliError("invalid_response", "Embedding response lacks vector data");
181
- for (const entry of body.data) {
182
- if (!entry || typeof entry !== "object" || !Number.isSafeInteger(entry.index) || entry.index < 0 || !Array.isArray(entry.embedding) || entry.embedding.length !== remote.dims || entry.embedding.some((value) => typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(Math.fround(value))))
183
- throw new CliError("invalid_response", "Embedding response contains invalid vectors");
184
- }
185
- const indices = body.data.map((entry) => entry.index).sort((a, b) => a - b);
186
- if (indices.some((index, position) => index !== position))
187
- throw new CliError("invalid_response", "Embedding response contains invalid vector indices");
188
- return new Response(JSON.stringify({ data: body.data.map((entry) => ({ index: entry.index, embedding: entry.embedding })) }), { status: response.status });
189
- } catch (error) {
190
- remoteFailure = error;
191
- throw error;
192
- }
193
- }, "guarded");
194
- engine = openRemote(remote, key, { concurrency: 1, fetch: guarded, tries: 1, env: options.env ?? process.env });
195
- }
196
- if (signal?.aborted) {
197
- await engine.close();
198
- cancelled(signal);
199
- }
200
- let closed = false;
201
- let running = false;
202
- let active = null;
203
- let closing = null;
204
- return {
205
- ...descriptor,
206
- async embed(texts, kind) {
207
- cancelled(signal);
208
- if (closed)
209
- throw new CliError("configuration_error", "Meeting embedder is closed");
210
- if (!Array.isArray(texts) || texts.length > 1e3 || texts.some((text) => typeof text !== "string") || !["query", "passage"].includes(kind))
211
- throw new CliError("validation_error", "Invalid meeting embedding inputs");
212
- if (Buffer.byteLength(JSON.stringify(texts), "utf8") > maxInputBytes || texts.length * descriptor.dims * 4 > maxResponseBytes)
213
- throw new CliError("validation_error", "Meeting embedding input or vector payload exceeds its byte budget");
214
- if (running)
215
- throw new CliError("validation_error", "A meeting embedding request is already running");
216
- running = true;
217
- let settled = /* @__PURE__ */ __name(() => {
218
- }, "settled");
219
- active = new Promise((resolve) => {
220
- settled = resolve;
221
- });
222
- remoteFailure = void 0;
223
- try {
224
- const vectors = await engine.embed([...texts], kind);
225
- cancelled(signal);
226
- if (vectors.length !== texts.length || vectors.some((vector) => vector.length !== descriptor.dims || !vector.some((value) => value !== 0) || [...vector].some((value) => !Number.isFinite(value))))
227
- throw new CliError("invalid_response", "Meeting embedder returned invalid vectors");
228
- return vectors;
229
- } catch (error) {
230
- cancelled(signal);
231
- if (remoteFailure instanceof CliError)
232
- throw remoteFailure;
233
- if (error instanceof CliError)
234
- throw error;
235
- throw new CliError("provider_error", "Meeting embedding failed");
236
- } finally {
237
- running = false;
238
- settled();
239
- active = null;
240
- }
241
- },
242
- async close() {
243
- if (!closing) {
244
- closed = true;
245
- closing = (async () => {
246
- await active;
247
- await engine.close();
248
- })();
249
- }
250
- await closing;
251
- }
252
- };
253
- }, "openMeetingEmbedder");
254
-
255
- export {
256
- meetingEmbeddingModel,
257
- createMeetingRemoteModel,
258
- openMeetingEmbedder
259
- };