@wirecat/mail-cli 0.34.0 → 0.36.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 (155) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +4 -1
  3. package/contracts/wirecat.json +52 -2
  4. package/dist/bin/mail.js +2 -2
  5. package/dist/bundle/agent-MW7YWUIY.js +39 -0
  6. package/dist/bundle/{all-profiles-2KUKROHY.js → all-profiles-RS6OV3YO.js} +63 -21
  7. package/dist/bundle/{anthropic-E5KRCEVC.js → anthropic-PPQ7DTXN.js} +5 -5
  8. package/dist/bundle/{app-server-HIQ3QO5K.js → app-server-EBFBMFQC.js} +81 -71
  9. package/dist/bundle/{bun-KARJPE5D.js → bun-J7HAT7MW.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-NHGX6ZUN.js → bun-sqlite-PCSNAXIQ.js} +6 -6
  11. package/dist/bundle/{chunk-WYGDALB3.js → chunk-2RV4V55B.js} +18 -18
  12. package/dist/bundle/{chunk-QXYNDMA6.js → chunk-2UNZ3L2H.js} +6 -6
  13. package/dist/bundle/{chunk-DYQGEZA2.js → chunk-2VEFNFYZ.js} +3 -3
  14. package/dist/bundle/chunk-3BYKGMRM.js +338 -0
  15. package/dist/bundle/{chunk-PRDKEVUL.js → chunk-3NOXZZJV.js} +1 -1
  16. package/dist/bundle/{chunk-4VM3UCSO.js → chunk-3ZKNXKM7.js} +2 -2
  17. package/dist/bundle/{chunk-JVGVLRBA.js → chunk-42XY6D5C.js} +5 -5
  18. package/dist/bundle/{chunk-A2Y2RFNW.js → chunk-437UHSIO.js} +123 -6
  19. package/dist/bundle/{chunk-FNYWC6A3.js → chunk-4WSTWZUB.js} +3 -3
  20. package/dist/bundle/{chunk-V43KEZYA.js → chunk-5G4MDFZ2.js} +9 -60
  21. package/dist/bundle/{chunk-ZZEWQR43.js → chunk-5JEKBYIH.js} +14 -14
  22. package/dist/bundle/{chunk-CKVWAUBW.js → chunk-5TIWO6AR.js} +12 -12
  23. package/dist/bundle/{chunk-X6IGETU6.js → chunk-5VPLQS4S.js} +2 -2
  24. package/dist/bundle/chunk-645FQC4G.js +559 -0
  25. package/dist/bundle/{chunk-PA4GEJXQ.js → chunk-6FZPFNEU.js} +9 -9
  26. package/dist/bundle/{chunk-XWU3A7H6.js → chunk-6LJIENVT.js} +2 -2
  27. package/dist/bundle/{chunk-2GDLJKPT.js → chunk-6NDPOY4N.js} +1 -1
  28. package/dist/bundle/{chunk-QXLYLVEC.js → chunk-6PKMUKUF.js} +1 -1
  29. package/dist/bundle/{chunk-TZJC4AOK.js → chunk-6TT62IUW.js} +53 -33
  30. package/dist/bundle/chunk-6UYIWQLU.js +52 -0
  31. package/dist/bundle/{chunk-MGXYIVVJ.js → chunk-6VMJLOYO.js} +12 -12
  32. package/dist/bundle/{chunk-ZGZADWD7.js → chunk-774VG5WZ.js} +1 -1
  33. package/dist/bundle/chunk-AVR4FPYG.js +192 -0
  34. package/dist/bundle/{chunk-KF6O4RZO.js → chunk-BBQERXQX.js} +3 -3
  35. package/dist/bundle/{chunk-LOSYDRJU.js → chunk-C3JSQ7UJ.js} +53 -11
  36. package/dist/bundle/{chunk-OJ3BI2U4.js → chunk-CJHO6B3M.js} +34 -28
  37. package/dist/bundle/{chunk-VRGEDK4T.js → chunk-CJMZQ2MZ.js} +35 -12
  38. package/dist/bundle/{chunk-4SKE5GYA.js → chunk-CMOO4INK.js} +1 -1
  39. package/dist/bundle/{chunk-DZRP4UCK.js → chunk-DVJPEZGV.js} +30 -15
  40. package/dist/bundle/{chunk-H77ALM2Y.js → chunk-EGR3YUWD.js} +4 -4
  41. package/dist/bundle/{chunk-4VHK5UBM.js → chunk-GBZIWCEP.js} +3 -3
  42. package/dist/bundle/{chunk-2SCQ7Z4I.js → chunk-GCTHVCJU.js} +4 -4
  43. package/dist/bundle/{chunk-4URI6EAV.js → chunk-GEU3WR75.js} +3 -3
  44. package/dist/bundle/{chunk-OX5MCGXL.js → chunk-GI6DNX7Q.js} +63 -54
  45. package/dist/bundle/{chunk-KLI5FKZ2.js → chunk-HH34WRQE.js} +7 -7
  46. package/dist/bundle/chunk-HPSESLOZ.js +7 -0
  47. package/dist/bundle/{chunk-6LFRZDPV.js → chunk-IBOWSQ7X.js} +3 -4
  48. package/dist/bundle/{chunk-XIF75Z7D.js → chunk-JCILSTFK.js} +1 -1
  49. package/dist/bundle/{chunk-OOYRMTX5.js → chunk-KLPFPNZP.js} +12 -26
  50. package/dist/bundle/{chunk-6G4VQFVX.js → chunk-KP7JHJVP.js} +17 -17
  51. package/dist/bundle/chunk-KTVQIKU5.js +726 -0
  52. package/dist/bundle/{chunk-2VBEBPGX.js → chunk-KVFBSOCV.js} +9 -9
  53. package/dist/bundle/{chunk-KGYK3OI3.js → chunk-L4QLZDBZ.js} +43 -64
  54. package/dist/bundle/{chunk-R2GS3GBJ.js → chunk-LQQIYBHN.js} +100 -66
  55. package/dist/bundle/{chunk-I3MS74OF.js → chunk-MQ6DQRRI.js} +4 -4
  56. package/dist/bundle/{chunk-FORAOCZ3.js → chunk-MRWV5VNQ.js} +6 -6
  57. package/dist/bundle/{chunk-NJVJH5MH.js → chunk-MT3LYU4T.js} +3245 -1644
  58. package/dist/bundle/{chunk-5GANGHQI.js → chunk-NCY55XIT.js} +9 -9
  59. package/dist/bundle/{chunk-QFJC6POK.js → chunk-NJZR3OFK.js} +1 -1
  60. package/dist/bundle/chunk-NSH2UHJR.js +353 -0
  61. package/dist/bundle/chunk-NTUP5RCP.js +116 -0
  62. package/dist/bundle/chunk-NYR7PIAG.js +80 -0
  63. package/dist/bundle/{chunk-PC3N3LH3.js → chunk-NYYMMIVW.js} +3 -3
  64. package/dist/bundle/{chunk-NXERDBEK.js → chunk-OEL4DQTT.js} +4 -4
  65. package/dist/bundle/{chunk-RPNQXWRS.js → chunk-PF7ZNIVP.js} +2 -2
  66. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  67. package/dist/bundle/{chunk-QQGPV3QN.js → chunk-PMGAU6AP.js} +2 -2
  68. package/dist/bundle/{chunk-PVZMN3UZ.js → chunk-PMSZBUC7.js} +8 -8
  69. package/dist/bundle/{chunk-HH647UBC.js → chunk-PPIMXOBT.js} +104 -255
  70. package/dist/bundle/{chunk-YWX5X5RI.js → chunk-Q6TPXXOS.js} +19 -17
  71. package/dist/bundle/{chunk-Z6A6QPPW.js → chunk-QDNYJOWJ.js} +1 -1
  72. package/dist/bundle/{chunk-OG5QO5RR.js → chunk-QI2XGTFH.js} +8 -8
  73. package/dist/bundle/{chunk-T2EE5M7O.js → chunk-REWV37HQ.js} +144 -10
  74. package/dist/bundle/{chunk-LKTDW5LH.js → chunk-RJUVWJTA.js} +18 -8
  75. package/dist/bundle/{chunk-MDISZMK4.js → chunk-RMWS7IQ4.js} +4 -4
  76. package/dist/bundle/{chunk-VBVR6JRC.js → chunk-ROK7Z5LQ.js} +275 -174
  77. package/dist/bundle/{chunk-HRDCH2VB.js → chunk-SCJVKWMV.js} +3665 -3339
  78. package/dist/bundle/{chunk-NAENYLIO.js → chunk-SJNFPBPF.js} +2 -2
  79. package/dist/bundle/{chunk-6GGMFL7J.js → chunk-TV634B6T.js} +2 -100
  80. package/dist/bundle/{chunk-26DYRMXE.js → chunk-U3BO342P.js} +1 -1
  81. package/dist/bundle/{chunk-KNVTBDTE.js → chunk-U67XMAEE.js} +3 -3
  82. package/dist/bundle/chunk-V5I7QP4T.js +108 -0
  83. package/dist/bundle/{chunk-NI4GCP2T.js → chunk-VIDPFLFM.js} +2 -2
  84. package/dist/bundle/{chunk-AGZ7SNFF.js → chunk-VIJV474N.js} +1 -1
  85. package/dist/bundle/{chunk-QOQF2TX3.js → chunk-WNQECDIP.js} +338 -299
  86. package/dist/bundle/{chunk-SK3N4CK5.js → chunk-WPPPO427.js} +4 -4
  87. package/dist/bundle/{chunk-EZAX77SM.js → chunk-WZFGZBGD.js} +86 -75
  88. package/dist/bundle/{chunk-EGQJDEFY.js → chunk-XRVZMM5B.js} +158 -562
  89. package/dist/bundle/{chunk-NWD7AFOR.js → chunk-YPB5BEAD.js} +2 -2
  90. package/dist/bundle/{chunk-NHD5BOJU.js → chunk-ZRSLG3B3.js} +6 -6
  91. package/dist/bundle/{chunk-IMQ4CVZJ.js → chunk-ZV57PIPE.js} +2 -2
  92. package/dist/bundle/command-contract-WFTIRPL5.js +39 -0
  93. package/dist/bundle/{command-server-entry-NF45UPEV.js → command-server-entry-73RJELAV.js} +28 -28
  94. package/dist/bundle/{decode-DUZA3EHC.js → decode-7BUWBDPT.js} +5 -5
  95. package/dist/bundle/{dispatch-CDJZAMVP.js → dispatch-IBOMVWZA.js} +8 -8
  96. package/dist/bundle/{dist-RH7EMC4J.js → dist-MULVCVSR.js} +25 -23
  97. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  98. package/dist/bundle/{echarts-GZHZBNRA.js → echarts-VLWFC322.js} +2 -2
  99. package/dist/bundle/{embed-VE3CSJN4.js → embed-W3VH4HPY.js} +6 -6
  100. package/dist/bundle/{embedder-DSJ77DX5.js → embedder-I7ERQZJV.js} +9 -9
  101. package/dist/bundle/{failure-YH6HAGFT.js → failure-QMAPSQ7X.js} +2 -2
  102. package/dist/bundle/{first-run-3L7HLYTI.js → first-run-LCVER6QN.js} +12 -12
  103. package/dist/bundle/first-screen-DCTHI4NQ.js +39 -0
  104. package/dist/bundle/{instructions-OZK3BLIO.js → instructions-BNCVLSYQ.js} +1 -1
  105. package/dist/bundle/mail.js +12 -12
  106. package/dist/bundle/{mcp-YUG4YR4R.js → mcp-Z2KZNCXB.js} +2 -2
  107. package/dist/bundle/meeting-combined-ITU7SZ7E.js +24 -0
  108. package/dist/bundle/{meeting-model-U7LW5WEN.js → meeting-model-BWLSTNXA.js} +11 -11
  109. package/dist/bundle/{meeting-semantic-64IOIQRR.js → meeting-semantic-ZIEHXN2R.js} +6 -6
  110. package/dist/bundle/{node-OS3VWBUZ.js → node-RYFTRSG4.js} +2 -2
  111. package/dist/bundle/{node-sqlite-RQ623VFA.js → node-sqlite-XCHVNTGQ.js} +7 -7
  112. package/dist/bundle/{oauth-CBPAG734.js → oauth-FNUJSKKJ.js} +8 -8
  113. package/dist/bundle/{open-H4DGOMBC.js → open-WVWSJ3WI.js} +5 -5
  114. package/dist/bundle/{openai-EMWRGR54.js → openai-QOUTYYTF.js} +15 -15
  115. package/dist/bundle/{process-3TOIYASI.js → process-W5KPID53.js} +1 -1
  116. package/dist/bundle/{program-WA6RGAJL.js → program-L5UANM3I.js} +3397 -2219
  117. package/dist/bundle/{prompt-22KNCMBI.js → prompt-JSBAPNJE.js} +5 -5
  118. package/dist/bundle/{recognize-UWD4RSCZ.js → recognize-FDX4SJ6Q.js} +4 -4
  119. package/dist/bundle/{remote-LJY7MF2E.js → remote-MYOXOQHM.js} +9 -9
  120. package/dist/bundle/{rerank-JJ6KNJFB.js → rerank-NY5MSZCR.js} +7 -7
  121. package/dist/bundle/{serve-3EPLJYVZ.js → serve-URI6NZA3.js} +10 -10
  122. package/dist/bundle/{server-5JOFO4V4.js → server-HQ25RHQM.js} +75 -64
  123. package/dist/bundle/server-UVYFU2JN.js +84 -0
  124. package/dist/bundle/{sqlite-runtime-MGJA5E27.js → sqlite-runtime-6UUPSSKG.js} +6 -6
  125. package/dist/bundle/{state-UCRDOWOP.js → state-NDDVFPCI.js} +6 -6
  126. package/dist/bundle/{store-265VRRQV.js → store-2RDOICVN.js} +28 -23
  127. package/dist/bundle/{store-HS272YSA.js → store-PKYWPKKR.js} +34 -21
  128. package/dist/bundle/store-maintenance-command-Y5XTO47X.js +71 -0
  129. package/dist/bundle/surface-3XKM3MQ2.js +70 -0
  130. package/dist/commands/read.d.ts +2 -2
  131. package/dist/commands/read.d.ts.map +1 -1
  132. package/dist/commands/read.js +5 -4
  133. package/dist/commands/read.js.map +1 -1
  134. package/dist/commands/session-start.js +1 -1
  135. package/dist/commands/session-start.js.map +1 -1
  136. package/dist/commands/sync.d.ts +2 -1
  137. package/dist/commands/sync.d.ts.map +1 -1
  138. package/dist/commands/sync.js +16 -9
  139. package/dist/commands/sync.js.map +1 -1
  140. package/dist/config.d.ts +5 -0
  141. package/dist/config.d.ts.map +1 -1
  142. package/dist/config.js +16 -1
  143. package/dist/config.js.map +1 -1
  144. package/dist/oauth.d.ts.map +1 -1
  145. package/dist/oauth.js +2 -1
  146. package/dist/oauth.js.map +1 -1
  147. package/dist/version.d.ts +1 -1
  148. package/dist/version.js +1 -1
  149. package/package.json +3 -3
  150. package/dist/bundle/chunk-FEBUZHU3.js +0 -2
  151. package/dist/bundle/command-contract-PZ7VOOXP.js +0 -39
  152. package/dist/bundle/first-screen-MY5KID77.js +0 -37
  153. package/dist/bundle/meeting-combined-RYMUPY54.js +0 -24
  154. package/dist/bundle/server-EOQNS7B7.js +0 -75
  155. package/dist/bundle/store-maintenance-command-IKZM5NRP.js +0 -66
@@ -1,74 +1,37 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
- UNTRUSTED,
5
- UNTRUSTED_NEUTRAL,
6
- agentArguments,
7
- agentJson,
8
4
  commandAvailability
9
- } from "./chunk-HH647UBC.js";
5
+ } from "./chunk-6UYIWQLU.js";
10
6
  import {
11
- failureContext
12
- } from "./chunk-A2Y2RFNW.js";
7
+ lentConnection
8
+ } from "./chunk-3BYKGMRM.js";
13
9
  import {
14
- callerOf
15
- } from "./chunk-6GGMFL7J.js";
10
+ QUERY_ARGUMENT
11
+ } from "./chunk-KTVQIKU5.js";
16
12
  import {
17
- QUERY_ARGUMENT,
18
- lentConnection,
19
- onlineDeps,
20
- refuseLacking,
21
- servicesFor,
22
- storeModeDeps
23
- } from "./chunk-HRDCH2VB.js";
24
- import {
25
- DEFAULT_OUTPUT_BYTES,
26
- ENTITIES,
27
- LOCAL_WRITE,
28
- REMOTE_WRITE,
29
- answerSchema,
30
13
  changesMessenger,
31
- flatten,
32
- judgedAnswer,
33
- judgedEffects,
34
- listOf,
35
- refuseStoreChange,
36
- sealed,
37
- startRecording
38
- } from "./chunk-VBVR6JRC.js";
14
+ flatten
15
+ } from "./chunk-ROK7Z5LQ.js";
39
16
  import {
40
17
  authorityAllowed,
41
- botApiAllowed,
42
- fetchesAt,
43
- keyForCommand,
44
- levelFor,
45
- readKeysForCommand
46
- } from "./chunk-LKTDW5LH.js";
47
- import {
48
- currentCaller,
49
- keepsSuccess,
50
- runContextOf,
51
- withCaller
52
- } from "./chunk-PVZMN3UZ.js";
18
+ botApiAllowed
19
+ } from "./chunk-RJUVWJTA.js";
53
20
  import {
54
- MAX_BUFFERED_INPUT
55
- } from "./chunk-NWD7AFOR.js";
21
+ currentCaller
22
+ } from "./chunk-PMSZBUC7.js";
56
23
  import {
57
24
  enclosingTraceId,
58
25
  inRun,
59
26
  newRunId,
60
27
  traceOf
61
- } from "./chunk-TZJC4AOK.js";
62
- import {
63
- storeDamaged
64
- } from "./chunk-4VM3UCSO.js";
28
+ } from "./chunk-6TT62IUW.js";
65
29
  import {
66
30
  queryDescription
67
- } from "./chunk-QOQF2TX3.js";
31
+ } from "./chunk-WNQECDIP.js";
68
32
  import {
69
- captureStreams,
70
- traceIdOf
71
- } from "./chunk-EZAX77SM.js";
33
+ captureStreams
34
+ } from "./chunk-WZFGZBGD.js";
72
35
  import {
73
36
  COMPACT_FLAG,
74
37
  SNAKE_CASE,
@@ -79,13 +42,7 @@ import {
79
42
  errorObjectOf,
80
43
  integer,
81
44
  isoDate,
82
- itemEnvelopeSchema,
83
- listEnvelopeSchema,
84
45
  literal,
85
- looseObject,
86
- maxLength,
87
- maxValue,
88
- mcpErrorResult,
89
46
  minLength,
90
47
  minValue,
91
48
  number,
@@ -96,30 +53,25 @@ import {
96
53
  pipe,
97
54
  record,
98
55
  regex,
99
- safeParse,
100
56
  strictObject,
101
57
  string,
102
- summarize,
103
58
  text,
104
- toJsonSchema,
105
- toStandardJsonSchema,
106
59
  union,
107
60
  unknown,
108
61
  word,
109
62
  writes
110
- } from "./chunk-LOSYDRJU.js";
63
+ } from "./chunk-C3JSQ7UJ.js";
111
64
  import {
112
- CliError,
113
- errorCodes
114
- } from "./chunk-QQGPV3QN.js";
65
+ CliError
66
+ } from "./chunk-PMGAU6AP.js";
115
67
  import {
116
68
  __name
117
69
  } from "./chunk-ZVVMGPBJ.js";
118
70
 
119
- // node_modules/.pnpm/@wirecat+cli-core@0.674.0_@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typ_fc1e3fbb1256d0776f2342adda6f86ff/node_modules/@wirecat/cli-core/dist/mcp/agent.js
71
+ // node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/mcp/agent.js
120
72
  import { Readable } from "node:stream";
121
73
 
122
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
74
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
123
75
  var LINT_SEVERITIES = ["high", "medium", "low"];
124
76
  var lintRuleSchema = strictObject({
125
77
  id: word,
@@ -265,7 +217,7 @@ var overrideSchema = strictObject({
265
217
  });
266
218
  var overridesSchema = array(overrideSchema);
267
219
 
268
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
220
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
269
221
  var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
270
222
  var defineAuditRules = /* @__PURE__ */ __name((input) => parseRegistry("audit rules", array(auditRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineAuditRules");
271
223
  var AUDIT_RULES = defineAuditRules([
@@ -320,17 +272,20 @@ var parityGroupSchema = strictObject({
320
272
  absent: optional(word),
321
273
  /** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
322
274
  only: optional(word),
275
+ /** The one CLI whose value (a summary, a value name) differs by design; every other CLI compared must agree. */
276
+ differs: optional(word),
323
277
  reason: pipe(text, minLength(10, "say why, in a sentence")),
324
278
  /** Warns from 14 days before and fails 14 days after, as a lint override does. */
325
279
  review_after: optional(pipe(string(), isoDate("a date, YYYY-MM-DD")))
326
280
  }))
327
281
  });
282
+ var kindOf = /* @__PURE__ */ __name((entry) => ["absent", "only", "differs"].filter((one) => entry[one] !== void 0), "kindOf");
328
283
  var defineParityGroups = /* @__PURE__ */ __name((input) => parseRegistry("parity groups", array(parityGroupSchema), input, (groups) => [
329
284
  ...duplicates(groups.map((group) => group.name)).map((name) => `"${name}" is listed twice`),
330
285
  ...groups.flatMap((group) => [
331
286
  ...duplicates(group.differences.map((entry) => `${entry.rule} ${entry.target}`)).map((both) => `${group.name}: "${both}" is listed twice`),
332
- ...group.differences.filter((entry) => (entry.absent || entry.only) && entry.expected).map((entry) => `${group.name}: "${entry.target}" has \`${entry.absent ? "absent" : "only"}\`, which measures the values itself; drop \`expected\``),
333
- ...group.differences.filter((entry) => entry.absent && entry.only).map((entry) => `${group.name}: "${entry.target}" has both \`absent\` and \`only\`; keep one`)
287
+ ...group.differences.filter((entry) => kindOf(entry).length === 1 && entry.expected).map((entry) => `${group.name}: "${entry.target}" has \`${kindOf(entry)[0]}\`, which measures the values itself; drop \`expected\``),
288
+ ...group.differences.filter((entry) => kindOf(entry).length > 1).map((entry) => `${group.name}: "${entry.target}" has ${kindOf(entry).map((one) => `\`${one}\``).join(" and ")}; keep one`)
334
289
  ])
335
290
  ]), "defineParityGroups");
336
291
  var MEMO_HAS_NO_PROFILES = [
@@ -345,6 +300,12 @@ var MEMO_HAS_NO_PROFILES = [
345
300
  absent: "memo",
346
301
  reason: "memo has no profiles: it reads other CLIs' stores and selects their accounts with --source and --account (https://github.com/WireCatLabs/cli-base/issues/390)"
347
302
  }));
303
+ var MEMO_MCP_SUMMARIES = ["mcp", "mcp serve"].map((path) => ({
304
+ rule: "same-path-contract",
305
+ target: `${path}: summary`,
306
+ differs: "memo",
307
+ reason: "memo has no profiles, so its mcp commands serve memo's commands rather than a profile's"
308
+ }));
348
309
  var MEMO_DOCTOR_DEEP = {
349
310
  rule: "same-path-contract",
350
311
  target: "doctor --deep",
@@ -375,7 +336,7 @@ var PARITY_GROUPS = defineParityGroups([
375
336
  name: "all",
376
337
  members: ["tg", "max", "memo", "drive", "zm", "wa"],
377
338
  covers: ["commands", "doctor", "skill", "mcp", "upgrade", "search", "notes", "meetings"],
378
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
339
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
379
340
  },
380
341
  // mail's `search messages` is cli-core's mail search, not the messengers' command: --complete took their 20-odd
381
342
  // differences as inherited (https://github.com/WireCatLabs/cli-base/issues/390). mail is compared everywhere else
@@ -384,7 +345,7 @@ var PARITY_GROUPS = defineParityGroups([
384
345
  name: "mail-shared",
385
346
  members: ["tg", "max", "memo", "drive", "zm", "wa", "mail"],
386
347
  covers: ["commands", "doctor", "skill", "mcp", "upgrade", "notes", "meetings"],
387
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
348
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
388
349
  },
389
350
  // gcal is compared on what it already shares with every CLI; doctor, mcp, search and skill wait until the published
390
351
  // CLIs agree there (https://github.com/WireCatLabs/cli-base/issues/390), then gcal moves back into "all".
@@ -396,14 +357,60 @@ var PARITY_GROUPS = defineParityGroups([
396
357
  },
397
358
  // bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
398
359
  // recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
399
- // notion-cli joins here until its documents commands ship; then it moves next to drive.
360
+ // amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
361
+ // wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
362
+ // linear-cli shares only these roots too: it is the first tracker CLI, so its issues commands have no group yet.
363
+ // notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
364
+ // its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
365
+ // and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
400
366
  {
401
367
  name: "shared-roots",
402
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion"],
368
+ members: [
369
+ "tg",
370
+ "max",
371
+ "memo",
372
+ "drive",
373
+ "zm",
374
+ "wa",
375
+ "b24",
376
+ "beeline",
377
+ "pbx",
378
+ "notion",
379
+ "amo",
380
+ "hubspot",
381
+ "attio",
382
+ "ydisk",
383
+ "wordpress",
384
+ "linear"
385
+ ],
403
386
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
404
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
387
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
388
+ },
389
+ // The CRM CLIs on cli-core's shared CRM commands. hubspot-cli is not in the family packages, so `audit --family`
390
+ // skips it, as beeline. Only b24 and hubspot have `leads` (amoCRM
391
+ // has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
392
+ // API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
393
+ // no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
394
+ // `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
395
+ // commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
396
+ {
397
+ name: "crm",
398
+ members: ["b24", "amo", "hubspot", "attio"],
399
+ covers: ["deals", "sync", "search", "store", "schedule", "account"],
400
+ differences: [
401
+ {
402
+ rule: "same-path-contract",
403
+ target: "schedule: summary",
404
+ differs: "hubspot",
405
+ reason: "cli-core cuts the summary to a fixed width after it puts in the CLI's name (src/cli/help/commands-text.ts), so hubspot's longer name ends it a word earlier than b24's and amo's",
406
+ review_after: "2026-12-01"
407
+ }
408
+ ]
405
409
  }
406
410
  ]);
411
+ var SHARED_DIFFERENCES = [
412
+ ...new Map(PARITY_GROUPS.flatMap((group) => group.differences).filter((entry) => entry.rule === "same-entity-schema" || entry.rule === "same-error-reason").map((entry) => [`${entry.rule} ${entry.target}`, entry])).values()
413
+ ];
407
414
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
408
415
  var defineRequiredRoots = /* @__PURE__ */ __name((input) => parseRegistry("required roots", array(requiredRootSchema), input, (roots2) => duplicates(roots2.map((root) => root.path.join(" "))).map((path) => `"${path}" is listed twice`)), "defineRequiredRoots");
409
416
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -415,7 +422,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
415
422
  { path: ["upgrade"], meaning: "updates the CLI" }
416
423
  ]);
417
424
 
418
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
425
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
419
426
  var fieldRuleSchema = strictObject({ id: word, rule: text });
420
427
  var defineFieldRules = /* @__PURE__ */ __name((input) => parseRegistry("output field rules", array(fieldRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineFieldRules");
421
428
  var FIELD_RULES = defineFieldRules([
@@ -431,7 +438,7 @@ var FIELD_RULES = defineFieldRules([
431
438
  }
432
439
  ]);
433
440
 
434
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
441
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
435
442
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
436
443
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
437
444
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -453,7 +460,7 @@ var IDENTIFIERS = defineIdentifiers([
453
460
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
454
461
  ]);
455
462
 
456
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
463
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
457
464
  var ACCOUNT_FLAGS = [
458
465
  {
459
466
  name: "--client-id",
@@ -490,7 +497,7 @@ var ACCOUNT_FLAGS = [
490
497
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
491
498
  ];
492
499
 
493
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
500
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
494
501
  var CALENDAR_FLAGS = [
495
502
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
496
503
  {
@@ -578,7 +585,25 @@ var CALENDAR_FLAGS = [
578
585
  }
579
586
  ];
580
587
 
581
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
588
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-content.js
589
+ var CONTENT_FLAGS = [
590
+ { name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
591
+ {
592
+ name: "--tags",
593
+ value: "<ids>",
594
+ role: "value",
595
+ type: "list",
596
+ meaning: "its tags and categories, by comma-separated ids; replaces the ones it has"
597
+ },
598
+ {
599
+ name: "--replace-body",
600
+ role: "mode",
601
+ type: "switch",
602
+ meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show"
603
+ }
604
+ ];
605
+
606
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
582
607
  var CRM_FLAGS = [
583
608
  {
584
609
  name: "--email",
@@ -742,7 +767,7 @@ var CRM_FLAGS = [
742
767
  }
743
768
  ];
744
769
 
745
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
770
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
746
771
  var HOW_FLAGS = [
747
772
  {
748
773
  name: "--limit",
@@ -1122,13 +1147,7 @@ var HOW_FLAGS = [
1122
1147
  type: "string",
1123
1148
  meaning: "a person whose reply counts as an answer; repeat it for more"
1124
1149
  },
1125
- {
1126
- name: "--browser",
1127
- value: "<program>",
1128
- role: "mode",
1129
- type: "string",
1130
- meaning: "the browser program to open for sign-in"
1131
- },
1150
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1132
1151
  {
1133
1152
  name: "--credential-storage",
1134
1153
  value: "<storage>",
@@ -1137,6 +1156,8 @@ var HOW_FLAGS = [
1137
1156
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1138
1157
  },
1139
1158
  { name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
1159
+ { name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
1160
+ { name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
1140
1161
  {
1141
1162
  name: "--expected-event-id",
1142
1163
  value: "<id>",
@@ -1739,7 +1760,7 @@ var HOW_FLAGS = [
1739
1760
  }
1740
1761
  ];
1741
1762
 
1742
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
1763
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
1743
1764
  var KNOWLEDGE_FLAGS = [
1744
1765
  {
1745
1766
  name: "--accept-terms",
@@ -1775,6 +1796,13 @@ var KNOWLEDGE_FLAGS = [
1775
1796
  meaning: "at most this many characters read",
1776
1797
  unit: "characters"
1777
1798
  },
1799
+ {
1800
+ name: "--tab",
1801
+ value: "<id>",
1802
+ role: "target",
1803
+ type: "id",
1804
+ meaning: "one tab of a document, by its id: only its text is read"
1805
+ },
1778
1806
  {
1779
1807
  name: "--tag",
1780
1808
  value: "<name>",
@@ -1791,7 +1819,7 @@ var KNOWLEDGE_FLAGS = [
1791
1819
  }
1792
1820
  ];
1793
1821
 
1794
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
1822
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
1795
1823
  var MAIL_FLAGS = [
1796
1824
  {
1797
1825
  name: "--cc",
@@ -1821,7 +1849,7 @@ var MAIL_FLAGS = [
1821
1849
  }
1822
1850
  ];
1823
1851
 
1824
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
1852
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
1825
1853
  var PRIVACY_FLAGS = [
1826
1854
  {
1827
1855
  name: "--about-text",
@@ -1882,7 +1910,7 @@ var PRIVACY_FLAGS = [
1882
1910
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1883
1911
  ];
1884
1912
 
1885
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
1913
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
1886
1914
  var SCHEDULE_FLAGS = [
1887
1915
  {
1888
1916
  name: "--locale",
@@ -1915,7 +1943,18 @@ var SCHEDULE_FLAGS = [
1915
1943
  }
1916
1944
  ];
1917
1945
 
1918
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
1946
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-search.js
1947
+ var SEARCH_FLAGS = [
1948
+ {
1949
+ name: "--like",
1950
+ value: "<text>",
1951
+ role: "query",
1952
+ type: "string",
1953
+ meaning: "a made-up example of the text sought, such as a reply that would answer the question, searched by meaning beside the query"
1954
+ }
1955
+ ];
1956
+
1957
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
1919
1958
  var WHAT_FLAGS = [
1920
1959
  {
1921
1960
  name: "--analysis-provider",
@@ -2912,7 +2951,7 @@ var WHAT_FLAGS = [
2912
2951
  }
2913
2952
  ];
2914
2953
 
2915
- // node_modules/.pnpm/@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
2954
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
2916
2955
  var FLAG_TYPES = [
2917
2956
  "switch",
2918
2957
  "count",
@@ -3042,6 +3081,10 @@ var verbs = [
3042
3081
  ["export", "write from the store to a file"],
3043
3082
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
3044
3083
  ["download", "save a file from the source to this machine"],
3084
+ ["upload", "put a file from this machine on the source"],
3085
+ ["publish", "open a thing to anyone who has its public link"],
3086
+ ["unpublish", "close a thing's public link"],
3087
+ ["stale", "mark a saved memory as out of date, keeping it"],
3045
3088
  ["transcribe", "turn speech into text"],
3046
3089
  ["extract", "read the text inside files already on this machine into the store"],
3047
3090
  ["migrate", "bring a file up to this build's schema"],
@@ -3138,6 +3181,8 @@ var collections = [
3138
3181
  ["messages", "posts in a messenger chat, or emails"],
3139
3182
  ["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
3140
3183
  ["polls", "polls in a chat"],
3184
+ ["posts", "posts and pages on a site or blog the owner publishes"],
3185
+ ["channels", "the sites and social accounts the owner publishes posts on"],
3141
3186
  ["reactions", "reactions to a message"],
3142
3187
  ["recipients", "who a message goes to"],
3143
3188
  ["replies", "the automatic replies of a profile"],
@@ -3184,6 +3229,10 @@ var collections = [
3184
3229
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3185
3230
  ["splits", "parts of one transaction, each with its own amount and category"],
3186
3231
  ["users", "people who work in the owner's account at a service, such as a CRM's employees"],
3232
+ ["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
3233
+ ["teams", "groups in a tracker that own issues, states and labels"],
3234
+ ["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
3235
+ ["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
3187
3236
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3188
3237
  ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3189
3238
  ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
@@ -3252,6 +3301,10 @@ var singulars = [
3252
3301
  ["privacy", "who may find, see, call or add the account"],
3253
3302
  ["metadata", "a profile's cached source attributes"],
3254
3303
  ["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
3304
+ [
3305
+ "scheduled",
3306
+ "a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
3307
+ ],
3255
3308
  [
3256
3309
  "schedule",
3257
3310
  "a profile's timers the owner saved, each running a command of this tool or an agent; the tool's own background work is jobs"
@@ -3259,6 +3312,7 @@ var singulars = [
3259
3312
  ];
3260
3313
  var views = [
3261
3314
  ["tree", "the parent and child hierarchy of stored sources"],
3315
+ ["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
3262
3316
  ["logs", "the log of a running process"],
3263
3317
  ["events", "what happened in a thing over time"],
3264
3318
  ["scheduled", "what is scheduled to happen"],
@@ -3271,6 +3325,7 @@ var views = [
3271
3325
  ["transcript", "the text of speech: a voice message or a meeting recording"],
3272
3326
  ["evidence", "the stored messages or lines a result or a reference rests on"],
3273
3327
  ["passage", "a cited transcript line with bounded surrounding lines from the same revision"],
3328
+ ["invitation", "the text that invites people to a meeting: how to join it and when"],
3274
3329
  ["agenda", "what needs a look today"],
3275
3330
  ["busy", "when calendars or people are taken, without what takes them"],
3276
3331
  ["categories", "the categories a thing takes, with what each means"],
@@ -3330,11 +3385,13 @@ var VOCABULARY = defineVocabulary({
3330
3385
  ...MAIL_FLAGS,
3331
3386
  ...KNOWLEDGE_FLAGS,
3332
3387
  ...CRM_FLAGS,
3333
- ...SCHEDULE_FLAGS
3388
+ ...SCHEDULE_FLAGS,
3389
+ ...CONTENT_FLAGS,
3390
+ ...SEARCH_FLAGS
3334
3391
  ]
3335
3392
  });
3336
3393
 
3337
- // node_modules/.pnpm/@wirecat+cli-core@0.674.0_@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typ_fc1e3fbb1256d0776f2342adda6f86ff/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3394
+ // node_modules/.pnpm/@wirecat+cli-core@0.713.0_@wirecat+cli-base@0.125.1_commander@15.0.0_esbuild@0.28.2_typ_29dc9b659505b9f83a43774498347dd2/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3338
3395
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3339
3396
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3340
3397
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3505,7 +3562,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3505
3562
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3506
3563
  const lend = ctx.connection;
3507
3564
  let borrowed;
3508
- let answered2 = false;
3565
+ let answered = false;
3509
3566
  let result;
3510
3567
  let failure;
3511
3568
  const streams = captureStreams();
@@ -3527,7 +3584,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3527
3584
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3528
3585
  agent: {
3529
3586
  result: /* @__PURE__ */ __name((value) => {
3530
- answered2 = true;
3587
+ answered = true;
3531
3588
  result = value;
3532
3589
  }, "result"),
3533
3590
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3549,7 +3606,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3549
3606
  }));
3550
3607
  if (failure)
3551
3608
  return { error: failure };
3552
- if (answered2)
3609
+ if (answered)
3553
3610
  return { result };
3554
3611
  if (code !== 0)
3555
3612
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3561,468 +3618,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3561
3618
  }
3562
3619
  }, "runCommandForAgent");
3563
3620
 
3564
- // node_modules/.pnpm/@wirecat+cli-core@0.674.0_@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typ_fc1e3fbb1256d0776f2342adda6f86ff/node_modules/@wirecat/cli-core/dist/mcp/tool.js
3565
- var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
3566
- var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
3567
- var message = pipe(
3568
- string(),
3569
- maxLength(256),
3570
- // biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
3571
- regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
3572
- description("message id")
3573
- );
3574
- var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
3575
- var WRITE = {
3576
- readOnlyHint: false,
3577
- destructiveHint: true,
3578
- idempotentHint: false,
3579
- openWorldHint: true
3580
- };
3581
- var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
3582
- var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
3583
- var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
3584
- if (definition.annotations.readOnlyHint === true)
3585
- return "read";
3586
- if (/^admin|_admin/.test(key2))
3587
- return "admin";
3588
- if (/delete|ban|kick|remove|purge|block/.test(key2))
3589
- return "destructive";
3590
- if (/draft/.test(key2))
3591
- return "draft";
3592
- if (key2 === "messages_pin" && messenger?.quietPins === false)
3593
- return "write-public";
3594
- if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
3595
- return "write-private";
3596
- return "write-public";
3597
- }, "tierOf");
3598
- var effectsOf = /* @__PURE__ */ __name((definition) => {
3599
- if (definition.effects)
3600
- return definition.effects;
3601
- const { readOnlyHint, openWorldHint } = definition.annotations;
3602
- if (readOnlyHint === true)
3603
- return { remote: openWorldHint === false ? "none" : "read", local: "read" };
3604
- return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
3605
- }, "effectsOf");
3606
- var outcomeOf = /* @__PURE__ */ __name((result) => {
3607
- if (!result.isError)
3608
- return { status: "ok" };
3609
- const code = result.structuredContent?.error?.code;
3610
- const error = typeof code === "string" ? code : "generic_failure";
3611
- return { status: error === "permission_error" ? "refused" : "failed", error };
3612
- }, "outcomeOf");
3613
- var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
3614
- var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
3615
- var inputOf = /* @__PURE__ */ __name((definition, syncAllowed) => strictObject(syncAllowed || !("sync_first" in definition.input.entries) ? definition.input.entries : Object.fromEntries(Object.entries(definition.input.entries).filter(([name]) => !["sync_first", "sync_time", "max_chats", "max_messages"].includes(name)))), "inputOf");
3616
- var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
3617
- const permissions = defaults.settings.permissions ?? {};
3618
- const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
3619
- return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
3620
- }, "syncAllowedFor");
3621
- var entryRunner = /* @__PURE__ */ __name((registration) => {
3622
- const run = callRunner(registration);
3623
- const { log } = registration;
3624
- return async (key2, definition, args, ctx) => {
3625
- const startedAt = Date.now();
3626
- const command = `mcp ${commandOf(key2, definition)}`;
3627
- const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
3628
- const app = registration.messenger?.app;
3629
- const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
3630
- const env = registration.defaults.env ?? process.env;
3631
- const settings = registration.defaults.settings;
3632
- const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
3633
- app,
3634
- command,
3635
- ...settings.profile === void 0 ? {} : { profile: settings.profile },
3636
- env,
3637
- record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
3638
- keepFailed: true,
3639
- trace: false,
3640
- format: "json",
3641
- context: runContextOf({ bin: app.command, command, env, caller }),
3642
- ...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
3643
- ...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
3644
- ...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
3645
- ...traceId === void 0 ? {} : { traceId }
3646
- }) : void 0;
3647
- const profile = registration.defaults.settings.profile;
3648
- const scope = {
3649
- runId: recording?.runId ?? newRunId(new Date(startedAt), command),
3650
- command,
3651
- startedAt,
3652
- ...profile === void 0 ? {} : { profile },
3653
- ...traceId === void 0 ? {} : { traceId },
3654
- ...recording ? { events: recording.events } : {}
3655
- };
3656
- const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
3657
- const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
3658
- const parsed = safeParse(input, args);
3659
- return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
3660
- arguments: toJsonSchema(input)
3661
- }), app?.errors);
3662
- }), "work");
3663
- const result = await (caller ? withCaller(caller, work) : work());
3664
- if (recording) {
3665
- if (result.isError) {
3666
- const error = result.structuredContent?.error;
3667
- const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
3668
- await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
3669
- } else
3670
- await recording.succeed(result.structuredContent).catch(() => void 0);
3671
- }
3672
- await log?.({
3673
- tool: key2,
3674
- tier: tierOf(key2, definition, registration.messenger),
3675
- ...outcomeOf(result),
3676
- startedAt,
3677
- finishedAt: Date.now()
3678
- }, caller)?.catch(() => void 0);
3679
- return result;
3680
- };
3681
- }, "entryRunner");
3682
- var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
3683
- const where = {
3684
- profile: defaults.settings.profile,
3685
- env: defaults.env,
3686
- pictures: defaults.settings.pictureSearch,
3687
- reranker: defaults.settings.searchReranker
3688
- };
3689
- return async (key2, definition, args, ctx) => {
3690
- const path = commandOf(key2, definition).split(" ");
3691
- const run = `mcp ${path.join(" ")}`;
3692
- try {
3693
- const execute = /* @__PURE__ */ __name(async () => {
3694
- const syncAllowed = syncAllowedFor(key2, defaults);
3695
- if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
3696
- throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
3697
- reason: "input.too-large",
3698
- max_bytes: MAX_BUFFERED_INPUT,
3699
- retryable: false
3700
- });
3701
- definition.check?.(args);
3702
- if (definition.changesStore)
3703
- refuseStoreChange(messenger.app, defaults.env);
3704
- refuseLacking(messenger, path);
3705
- for (const permission of readKeysForCommand(path)) {
3706
- if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
3707
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
3708
- }
3709
- if (args.sync_first && !syncAllowed)
3710
- throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
3711
- if (definition.custom) {
3712
- const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
3713
- return answered(result2, definition.outputLimit?.(args, defaults), targets);
3714
- }
3715
- if (definition.local)
3716
- return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
3717
- const { online, stored: local, served } = definition;
3718
- const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
3719
- const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
3720
- name: run
3721
- }) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
3722
- ...storeModeDeps(messenger, store, account, defaults.guard),
3723
- ...where,
3724
- embedders: defaults.embedders
3725
- }), args, defaults, (work) => session.use(run, async (adapter, release) => {
3726
- try {
3727
- return await work(adapter);
3728
- } finally {
3729
- await release();
3730
- }
3731
- })), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
3732
- try {
3733
- return await work(adapter);
3734
- } finally {
3735
- await release();
3736
- }
3737
- })())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
3738
- return answered(result, definition.outputLimit?.(args, defaults), targets);
3739
- }, "execute");
3740
- return around ? await around(key2, definition, execute) : await execute();
3741
- } catch (error) {
3742
- return failed(error, messenger?.app?.errors, effectsOf(definition));
3743
- }
3744
- };
3745
- }, "callRunner");
3746
- var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
3747
- if (!definition.output)
3748
- return looseObject({});
3749
- const entity = ENTITIES[definition.output.entity];
3750
- return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
3751
- }, "outputSchemaOf");
3752
- var Picture = class {
3753
- static {
3754
- __name(this, "Picture");
3755
- }
3756
- bytes;
3757
- mimeType;
3758
- about;
3759
- constructor(bytes, mimeType, about) {
3760
- this.bytes = bytes;
3761
- this.mimeType = mimeType;
3762
- this.about = about;
3763
- }
3764
- };
3765
- var BinaryResource = class {
3766
- static {
3767
- __name(this, "BinaryResource");
3768
- }
3769
- base64;
3770
- mimeType;
3771
- uri;
3772
- about;
3773
- constructor(base64, mimeType, uri, about) {
3774
- this.base64 = base64;
3775
- this.mimeType = mimeType;
3776
- this.uri = uri;
3777
- this.about = about;
3778
- }
3779
- };
3780
- var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
3781
- const bounded = /* @__PURE__ */ __name((result) => {
3782
- if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
3783
- throw new CliError("invalid_response", "tool output exceeds its byte limit \u2014 reduce limit or use a narrower request", { reason: "output.too-large", max_bytes: maxBytes, retryable: false });
3784
- return result;
3785
- }, "bounded");
3786
- if (answer === null || Array.isArray(answer) || typeof answer !== "object")
3787
- throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
3788
- const objectBody = /* @__PURE__ */ __name((value) => {
3789
- const serialized = JSON.parse(agentJson(value));
3790
- if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
3791
- throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
3792
- return serialized;
3793
- }, "objectBody");
3794
- if (answer instanceof BinaryResource) {
3795
- const about = sealed(answer.about);
3796
- return bounded({
3797
- structuredContent: objectBody(about),
3798
- content: [
3799
- { type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
3800
- { type: "text", text: agentJson(about) }
3801
- ]
3802
- });
3803
- }
3804
- if (answer instanceof Picture) {
3805
- const about = sealed(answer.about);
3806
- return bounded({
3807
- structuredContent: objectBody(about),
3808
- content: [
3809
- { type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
3810
- { type: "text", text: agentJson(about) }
3811
- ]
3812
- });
3813
- }
3814
- const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
3815
- return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
3816
- }, "answered");
3817
- var failed = /* @__PURE__ */ __name((error, errors, effects) => {
3818
- const judged = judgedEffects(effects);
3819
- const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
3820
- return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
3821
- }, "failed");
3822
-
3823
- // node_modules/.pnpm/@wirecat+cli-core@0.674.0_@wirecat+cli-base@0.103.0_commander@15.0.0_esbuild@0.28.2_typ_fc1e3fbb1256d0776f2342adda6f86ff/node_modules/@wirecat/cli-core/dist/mcp/surface.js
3824
- import { randomUUID } from "node:crypto";
3825
- var MATCHES = 8;
3826
- var ANSWER = answerSchema();
3827
- var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
3828
- const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
3829
- const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
3830
- return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
3831
- items: optional(array(unknown())),
3832
- item: optional(unknown()),
3833
- page: optional(looseObject({ has_more: boolean() })),
3834
- next,
3835
- missing: optional(array(looseObject({ field: string(), why: string() }))),
3836
- meta
3837
- });
3838
- }, "agentAnswer");
3839
- var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
3840
- const checked = toStandardJsonSchema(ANSWER);
3841
- const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
3842
- return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
3843
- }, "listedAs");
3844
- var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
3845
- var STOP_WORDS = new Set("a an the to of in on at by for from with into out about and or but is are be been was were it its this that these those which who whom whose what when where how do does did can could should would will my our your their his her them they we you i one some any all each every another other".split(" "));
3846
- var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
3847
- var stem = /* @__PURE__ */ __name((word2) => {
3848
- const bare = word2.replace(/'s$/u, "");
3849
- if (bare.length > 4 && bare.endsWith("ies"))
3850
- return `${bare.slice(0, -3)}y`;
3851
- for (const ending of ["ing", "ed", "es", "s"])
3852
- if (bare.length - ending.length >= 3 && bare.endsWith(ending))
3853
- return bare.slice(0, -ending.length);
3854
- return bare;
3855
- }, "stem");
3856
- var sameWord = /* @__PURE__ */ __name((asked, known) => {
3857
- if (asked === known)
3858
- return true;
3859
- const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
3860
- return short.length >= 3 && long.startsWith(short);
3861
- }, "sameWord");
3862
- var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
3863
- [4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
3864
- [2, wordsOf(one.title)],
3865
- [1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
3866
- ].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
3867
- var search = /* @__PURE__ */ __name((commands, query) => {
3868
- const named = normal(query);
3869
- const all = Object.entries(commands);
3870
- if (!named)
3871
- return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
3872
- const words = [
3873
- ...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
3874
- ];
3875
- return all.map((entry) => {
3876
- const fields = fieldsOf2(entry[0], entry[1]);
3877
- const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
3878
- const matched = weights.filter((weight) => weight > 0).length;
3879
- const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
3880
- return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
3881
- }).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
3882
- }, "search");
3883
- var nearest = /* @__PURE__ */ __name((commands, asked) => {
3884
- const words = normal(asked).split(" ");
3885
- return Object.keys(commands).map((one) => ({ one, shared: words.filter((word2) => normal(one).split(" ").includes(word2)).length })).filter(({ shared }) => shared > 0).sort((a, b) => b.shared - a.shared).slice(0, 3).map(({ one }) => one);
3886
- }, "nearest");
3887
- var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
3888
- const body = result.structuredContent;
3889
- if (result.isError || !Array.isArray(body?.next))
3890
- return result;
3891
- const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
3892
- const { next: _, ...rest } = body;
3893
- const kept = next.length > 0 ? { ...rest, next } : rest;
3894
- return {
3895
- ...result,
3896
- structuredContent: kept,
3897
- content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
3898
- };
3899
- }, "runnableOnly");
3900
- var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
3901
- var sampleOf = /* @__PURE__ */ __name((commands) => {
3902
- const reading = Object.entries(commands).filter(([, one]) => !one.writes);
3903
- const bare = reading.filter(([, one]) => takesNothing(one));
3904
- return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
3905
- }, "sampleOf");
3906
- var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
3907
- const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
3908
- const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
3909
- const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
3910
- const sample = messenger ? "messages list" : sampleOf(commands);
3911
- const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
3912
- server.registerTool(`${prefix}_tools_search`, {
3913
- outputSchema: toStandardJsonSchema(looseObject({})),
3914
- title: "Find a command",
3915
- description: `Find the command for a task \u2014 ${tasks} \u2014 before calling ${prefix}_read or ${prefix}_write with it. Each match gives its command, whether it writes, its arguments and the shape of its answer. With no words, lists every command and title, without arguments.`,
3916
- inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
3917
- annotations: { ...READ, openWorldHint: false, idempotentHint: true }
3918
- }, async ({ query }) => {
3919
- const found = search(commands, query ?? "");
3920
- const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
3921
- command,
3922
- title: one.title,
3923
- description: one.description,
3924
- writes: one.writes,
3925
- availability: one.availability?.() ?? { available: true },
3926
- arguments: toJsonSchema(one.input),
3927
- output: toJsonSchema(one.output ?? ANSWER)
3928
- })) : found.map(([command, one]) => ({
3929
- command,
3930
- title: one.title,
3931
- writes: one.writes,
3932
- availability: one.availability?.() ?? { available: true }
3933
- }));
3934
- const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
3935
- items,
3936
- limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
3937
- has_more: found.length > items.length
3938
- });
3939
- return answered(list);
3940
- });
3941
- const callers = {
3942
- env: process.env,
3943
- client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
3944
- connectionId: randomUUID()
3945
- };
3946
- const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
3947
- try {
3948
- const command = byNormal.get(normal(asked));
3949
- const one = command === void 0 ? void 0 : commands[command];
3950
- if (command === void 0 || !one) {
3951
- withheld?.(normal(asked));
3952
- const near = nearest(commands, asked);
3953
- throw new CliError("validation_error", `no command "${asked}" here${near.length ? ` \u2014 did you mean ${near.map((name) => `"${name}"`).join(", ")}?` : ""}; ${prefix}_tools_search finds one`);
3954
- }
3955
- if (one.writes !== writing)
3956
- throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
3957
- const args = writing ? agentArguments(given ?? {}) : given ?? {};
3958
- const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
3959
- if (one.checked)
3960
- return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
3961
- const parsed = safeParse(strictObject(one.input.entries), args);
3962
- if (!parsed.success)
3963
- throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
3964
- arguments: toJsonSchema(one.input)
3965
- });
3966
- return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
3967
- } catch (error) {
3968
- return failed(error, errors);
3969
- }
3970
- }, "runner");
3971
- const call = strictObject({
3972
- command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
3973
- arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
3974
- });
3975
- server.registerTool(`${prefix}_read`, {
3976
- outputSchema: listedAs(prefix, false),
3977
- title: "Run a reading command",
3978
- description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
3979
- inputSchema: toStandardJsonSchema(call),
3980
- annotations: READ
3981
- }, runner(false));
3982
- if (Object.values(commands).some((one) => one.writes))
3983
- server.registerTool(`${prefix}_write`, {
3984
- outputSchema: listedAs(prefix, true),
3985
- title: "Run a writing command",
3986
- description: `Run one command that changes something \u2014 ${messenger ? "sends, edits, deletes, joins" : "creates, edits, deletes"} \u2014 with the arguments ${prefix}_tools_search showed. ${untrusted}`,
3987
- inputSchema: toStandardJsonSchema(call),
3988
- annotations: WRITE
3989
- }, runner(true));
3990
- }, "registerCommands");
3991
- var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
3992
- const run = entryRunner(registration);
3993
- return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
3994
- commandOf(key2, definition),
3995
- {
3996
- title: definition.title,
3997
- description: definition.description,
3998
- writes: definition.annotations.readOnlyHint !== true,
3999
- input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
4000
- ...definition.output ? { output: outputSchemaOf(definition) } : {},
4001
- checked: true,
4002
- run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
4003
- }
4004
- ]));
4005
- }, "surfaceCommands");
4006
- var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
4007
-
4008
3621
  export {
4009
3622
  toolsFromCommands,
4010
- runCommandForAgent,
4011
- message,
4012
- READ,
4013
- WRITE,
4014
- tool,
4015
- chatOf,
4016
- tierOf,
4017
- outcomeOf,
4018
- commandOf,
4019
- toolKey,
4020
- Picture,
4021
- BinaryResource,
4022
- answered,
4023
- failed,
4024
- normal,
4025
- registerCommands,
4026
- surfaceCommands,
4027
- outputOf
3623
+ runCommandForAgent
4028
3624
  };