@wirecat/mail-cli 0.34.0 → 0.35.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 (150) hide show
  1. package/CHANGELOG.md +23 -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-KWLCQCSC.js +39 -0
  6. package/dist/bundle/{all-profiles-2KUKROHY.js → all-profiles-6BDSMVOO.js} +63 -21
  7. package/dist/bundle/{anthropic-E5KRCEVC.js → anthropic-C3XUXUCJ.js} +5 -5
  8. package/dist/bundle/{app-server-HIQ3QO5K.js → app-server-GUHDK4OR.js} +81 -71
  9. package/dist/bundle/{bun-KARJPE5D.js → bun-FN7AM4AG.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-NHGX6ZUN.js → bun-sqlite-56IVBF22.js} +6 -6
  11. package/dist/bundle/{chunk-R2GS3GBJ.js → chunk-2B67TUIF.js} +96 -66
  12. package/dist/bundle/{chunk-4SKE5GYA.js → chunk-2UNQTKRH.js} +1 -1
  13. package/dist/bundle/{chunk-QXLYLVEC.js → chunk-3ACF6TIV.js} +1 -1
  14. package/dist/bundle/chunk-3EV2B7KZ.js +726 -0
  15. package/dist/bundle/chunk-3KAJCOJP.js +109 -0
  16. package/dist/bundle/{chunk-NAENYLIO.js → chunk-3WAZKCDF.js} +2 -2
  17. package/dist/bundle/{chunk-V43KEZYA.js → chunk-46SBNO67.js} +9 -60
  18. package/dist/bundle/{chunk-A2Y2RFNW.js → chunk-4IASS7NQ.js} +57 -4
  19. package/dist/bundle/{chunk-OOYRMTX5.js → chunk-4U5ODZO7.js} +12 -26
  20. package/dist/bundle/{chunk-DYQGEZA2.js → chunk-5WYBI35N.js} +3 -3
  21. package/dist/bundle/{chunk-QFJC6POK.js → chunk-5XQI7WCJ.js} +1 -1
  22. package/dist/bundle/{chunk-2SCQ7Z4I.js → chunk-635AFLZO.js} +4 -4
  23. package/dist/bundle/{chunk-OJ3BI2U4.js → chunk-6B4WZVLN.js} +34 -28
  24. package/dist/bundle/{chunk-FNYWC6A3.js → chunk-6Q5THDNW.js} +3 -3
  25. package/dist/bundle/{chunk-CKVWAUBW.js → chunk-6VARUB3J.js} +12 -12
  26. package/dist/bundle/{chunk-EZAX77SM.js → chunk-7FXZKQAC.js} +86 -75
  27. package/dist/bundle/{chunk-H77ALM2Y.js → chunk-7JVKQ6NM.js} +4 -4
  28. package/dist/bundle/{chunk-HH647UBC.js → chunk-7KMI47AP.js} +104 -255
  29. package/dist/bundle/{chunk-DZRP4UCK.js → chunk-7PXAUMK5.js} +30 -15
  30. package/dist/bundle/{chunk-KGYK3OI3.js → chunk-7YMLEWTX.js} +43 -64
  31. package/dist/bundle/{chunk-OG5QO5RR.js → chunk-AISQNKT7.js} +8 -8
  32. package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
  33. package/dist/bundle/{chunk-QOQF2TX3.js → chunk-AXKIXVQA.js} +338 -299
  34. package/dist/bundle/{chunk-ZGZADWD7.js → chunk-CDGVYQXG.js} +1 -1
  35. package/dist/bundle/{chunk-Z6A6QPPW.js → chunk-CFQQTDSA.js} +1 -1
  36. package/dist/bundle/{chunk-QXYNDMA6.js → chunk-CMGZXBJW.js} +6 -6
  37. package/dist/bundle/{chunk-4URI6EAV.js → chunk-DD2P67NP.js} +3 -3
  38. package/dist/bundle/{chunk-X6IGETU6.js → chunk-DFHUJTP5.js} +2 -2
  39. package/dist/bundle/{chunk-WYGDALB3.js → chunk-DREU6TN6.js} +18 -18
  40. package/dist/bundle/{chunk-TZJC4AOK.js → chunk-DZHEVVXA.js} +53 -33
  41. package/dist/bundle/{chunk-RPNQXWRS.js → chunk-E6HSSKRX.js} +2 -2
  42. package/dist/bundle/{chunk-6LFRZDPV.js → chunk-EHAXFDDP.js} +1 -1
  43. package/dist/bundle/chunk-EU4J6GCJ.js +52 -0
  44. package/dist/bundle/{chunk-NJVJH5MH.js → chunk-EX4Z7CCO.js} +3245 -1644
  45. package/dist/bundle/chunk-G662S2M4.js +559 -0
  46. package/dist/bundle/{chunk-JVGVLRBA.js → chunk-GG634DR3.js} +5 -5
  47. package/dist/bundle/{chunk-IMQ4CVZJ.js → chunk-GU3PYIV2.js} +2 -2
  48. package/dist/bundle/{chunk-LKTDW5LH.js → chunk-HF5QWKK2.js} +18 -8
  49. package/dist/bundle/chunk-HJDIMVFW.js +108 -0
  50. package/dist/bundle/{chunk-FORAOCZ3.js → chunk-HKWZG7CZ.js} +6 -6
  51. package/dist/bundle/{chunk-QQGPV3QN.js → chunk-HM6AMYHR.js} +2 -2
  52. package/dist/bundle/{chunk-AGZ7SNFF.js → chunk-HVXOA4FO.js} +1 -1
  53. package/dist/bundle/{chunk-NHD5BOJU.js → chunk-I3QZCQJT.js} +6 -6
  54. package/dist/bundle/{chunk-OX5MCGXL.js → chunk-ILEKGH44.js} +63 -54
  55. package/dist/bundle/{chunk-I3MS74OF.js → chunk-J5ULUTWE.js} +4 -4
  56. package/dist/bundle/{chunk-26DYRMXE.js → chunk-L4RCWRWS.js} +1 -1
  57. package/dist/bundle/chunk-MCJYJIH5.js +192 -0
  58. package/dist/bundle/{chunk-NWD7AFOR.js → chunk-NEDS4ORI.js} +2 -2
  59. package/dist/bundle/{chunk-VRGEDK4T.js → chunk-ODQCRZX5.js} +35 -12
  60. package/dist/bundle/chunk-OO4OKMNB.js +80 -0
  61. package/dist/bundle/{chunk-T2EE5M7O.js → chunk-OOQFBRNR.js} +144 -10
  62. package/dist/bundle/{chunk-PA4GEJXQ.js → chunk-OTP2HJ67.js} +9 -9
  63. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  64. package/dist/bundle/{chunk-6G4VQFVX.js → chunk-PQDQCCGG.js} +17 -17
  65. package/dist/bundle/{chunk-KLI5FKZ2.js → chunk-Q5U2HIBJ.js} +7 -7
  66. package/dist/bundle/{chunk-HRDCH2VB.js → chunk-QFMKCU42.js} +3664 -3339
  67. package/dist/bundle/{chunk-VBVR6JRC.js → chunk-QYCMB7JY.js} +269 -173
  68. package/dist/bundle/{chunk-6GGMFL7J.js → chunk-RBV2AM52.js} +2 -100
  69. package/dist/bundle/{chunk-XIF75Z7D.js → chunk-RJNKM3CQ.js} +1 -1
  70. package/dist/bundle/{chunk-SK3N4CK5.js → chunk-RQHWSNX4.js} +4 -4
  71. package/dist/bundle/{chunk-4VHK5UBM.js → chunk-RQJGX7F7.js} +3 -3
  72. package/dist/bundle/{chunk-PC3N3LH3.js → chunk-TARNPINT.js} +3 -3
  73. package/dist/bundle/{chunk-5GANGHQI.js → chunk-TP2BCK2Z.js} +9 -9
  74. package/dist/bundle/{chunk-ZZEWQR43.js → chunk-TP766H4O.js} +14 -14
  75. package/dist/bundle/{chunk-PVZMN3UZ.js → chunk-UHGKN5US.js} +8 -8
  76. package/dist/bundle/{chunk-4VM3UCSO.js → chunk-UWDRU3R6.js} +2 -2
  77. package/dist/bundle/{chunk-KNVTBDTE.js → chunk-V4O47JV6.js} +3 -3
  78. package/dist/bundle/{chunk-MGXYIVVJ.js → chunk-W4JYGMTU.js} +12 -12
  79. package/dist/bundle/{chunk-2GDLJKPT.js → chunk-W7ICCFG5.js} +1 -1
  80. package/dist/bundle/{chunk-KF6O4RZO.js → chunk-WDEVKKAD.js} +3 -3
  81. package/dist/bundle/{chunk-YWX5X5RI.js → chunk-WZKM5I7B.js} +19 -17
  82. package/dist/bundle/{chunk-MDISZMK4.js → chunk-XKKYRMGG.js} +4 -4
  83. package/dist/bundle/chunk-XQNKAM26.js +338 -0
  84. package/dist/bundle/{chunk-LOSYDRJU.js → chunk-YA44BG3N.js} +38 -9
  85. package/dist/bundle/{chunk-2VBEBPGX.js → chunk-YCIWSKOH.js} +9 -9
  86. package/dist/bundle/{chunk-NXERDBEK.js → chunk-YQTRKNZQ.js} +4 -4
  87. package/dist/bundle/chunk-YRAJFTFU.js +353 -0
  88. package/dist/bundle/{chunk-XWU3A7H6.js → chunk-YTI533XF.js} +2 -2
  89. package/dist/bundle/{chunk-PRDKEVUL.js → chunk-ZMYRPMAJ.js} +1 -1
  90. package/dist/bundle/{chunk-EGQJDEFY.js → chunk-ZX7HZDD6.js} +144 -562
  91. package/dist/bundle/{chunk-NI4GCP2T.js → chunk-ZYEU35MB.js} +2 -2
  92. package/dist/bundle/command-contract-D5UXWHMS.js +39 -0
  93. package/dist/bundle/{command-server-entry-NF45UPEV.js → command-server-entry-TPJ47FYS.js} +28 -28
  94. package/dist/bundle/{decode-DUZA3EHC.js → decode-XHUASXQK.js} +5 -5
  95. package/dist/bundle/{dispatch-CDJZAMVP.js → dispatch-MQZHGGVP.js} +8 -8
  96. package/dist/bundle/{dist-RH7EMC4J.js → dist-BAE4IQ52.js} +23 -23
  97. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  98. package/dist/bundle/{echarts-GZHZBNRA.js → echarts-U7Z2PKIG.js} +2 -2
  99. package/dist/bundle/{embed-VE3CSJN4.js → embed-W7GPB6EI.js} +6 -6
  100. package/dist/bundle/{embedder-DSJ77DX5.js → embedder-T72XLFQ5.js} +9 -9
  101. package/dist/bundle/{failure-YH6HAGFT.js → failure-MP6VKL5Y.js} +2 -2
  102. package/dist/bundle/{first-run-3L7HLYTI.js → first-run-C44TJXRI.js} +12 -12
  103. package/dist/bundle/first-screen-IESI7DAU.js +39 -0
  104. package/dist/bundle/{instructions-OZK3BLIO.js → instructions-WGMWQNPP.js} +1 -1
  105. package/dist/bundle/mail.js +12 -12
  106. package/dist/bundle/{mcp-YUG4YR4R.js → mcp-YGOAUNC3.js} +2 -2
  107. package/dist/bundle/meeting-combined-XGZBSWIQ.js +24 -0
  108. package/dist/bundle/{meeting-model-U7LW5WEN.js → meeting-model-QVHLD4WI.js} +11 -11
  109. package/dist/bundle/{meeting-semantic-64IOIQRR.js → meeting-semantic-QKQHUHXX.js} +6 -6
  110. package/dist/bundle/{node-OS3VWBUZ.js → node-WANDMJJQ.js} +2 -2
  111. package/dist/bundle/{node-sqlite-RQ623VFA.js → node-sqlite-NM5XA4DR.js} +7 -7
  112. package/dist/bundle/{oauth-CBPAG734.js → oauth-6E63ELEE.js} +8 -8
  113. package/dist/bundle/{open-H4DGOMBC.js → open-5542RTLE.js} +5 -5
  114. package/dist/bundle/{openai-EMWRGR54.js → openai-NOYNPFB5.js} +15 -15
  115. package/dist/bundle/{process-3TOIYASI.js → process-7AEXXSBX.js} +1 -1
  116. package/dist/bundle/{program-WA6RGAJL.js → program-VMA5CGNR.js} +3184 -2163
  117. package/dist/bundle/{prompt-22KNCMBI.js → prompt-WYYO4AJL.js} +5 -5
  118. package/dist/bundle/{recognize-UWD4RSCZ.js → recognize-UGCCOMAS.js} +4 -4
  119. package/dist/bundle/{remote-LJY7MF2E.js → remote-VZS6BNQB.js} +9 -9
  120. package/dist/bundle/{rerank-JJ6KNJFB.js → rerank-O46D5GJ2.js} +7 -7
  121. package/dist/bundle/{serve-3EPLJYVZ.js → serve-QAAF2LCW.js} +10 -10
  122. package/dist/bundle/server-456MYK3X.js +84 -0
  123. package/dist/bundle/{server-5JOFO4V4.js → server-Q3PUZLLX.js} +75 -64
  124. package/dist/bundle/{sqlite-runtime-MGJA5E27.js → sqlite-runtime-EQBCDO2U.js} +6 -6
  125. package/dist/bundle/{state-UCRDOWOP.js → state-XIOHYXCR.js} +6 -6
  126. package/dist/bundle/{store-HS272YSA.js → store-OXJZZUR7.js} +34 -21
  127. package/dist/bundle/{store-265VRRQV.js → store-VJBL5XKR.js} +28 -23
  128. package/dist/bundle/store-maintenance-command-D7XYIX52.js +71 -0
  129. package/dist/bundle/surface-N7LK7PKN.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/sync.d.ts +2 -1
  135. package/dist/commands/sync.d.ts.map +1 -1
  136. package/dist/commands/sync.js +16 -9
  137. package/dist/commands/sync.js.map +1 -1
  138. package/dist/config.d.ts +5 -0
  139. package/dist/config.d.ts.map +1 -1
  140. package/dist/config.js +16 -1
  141. package/dist/config.js.map +1 -1
  142. package/dist/version.d.ts +1 -1
  143. package/dist/version.js +1 -1
  144. package/package.json +3 -3
  145. package/dist/bundle/chunk-FEBUZHU3.js +0 -2
  146. package/dist/bundle/command-contract-PZ7VOOXP.js +0 -39
  147. package/dist/bundle/first-screen-MY5KID77.js +0 -37
  148. package/dist/bundle/meeting-combined-RYMUPY54.js +0 -24
  149. package/dist/bundle/server-EOQNS7B7.js +0 -75
  150. 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-EU4J6GCJ.js";
10
6
  import {
11
- failureContext
12
- } from "./chunk-A2Y2RFNW.js";
7
+ lentConnection
8
+ } from "./chunk-XQNKAM26.js";
13
9
  import {
14
- callerOf
15
- } from "./chunk-6GGMFL7J.js";
10
+ QUERY_ARGUMENT
11
+ } from "./chunk-3EV2B7KZ.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-QYCMB7JY.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-HF5QWKK2.js";
53
20
  import {
54
- MAX_BUFFERED_INPUT
55
- } from "./chunk-NWD7AFOR.js";
21
+ currentCaller
22
+ } from "./chunk-UHGKN5US.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-DZHEVVXA.js";
65
29
  import {
66
30
  queryDescription
67
- } from "./chunk-QOQF2TX3.js";
31
+ } from "./chunk-AXKIXVQA.js";
68
32
  import {
69
- captureStreams,
70
- traceIdOf
71
- } from "./chunk-EZAX77SM.js";
33
+ captureStreams
34
+ } from "./chunk-7FXZKQAC.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-YA44BG3N.js";
111
64
  import {
112
- CliError,
113
- errorCodes
114
- } from "./chunk-QQGPV3QN.js";
65
+ CliError
66
+ } from "./chunk-HM6AMYHR.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.709.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_d98198650466e0f5373009c2596db072/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.124.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
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.124.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
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,58 @@ 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
+ // notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
363
+ // its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
364
+ // and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
400
365
  {
401
366
  name: "shared-roots",
402
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion"],
367
+ members: [
368
+ "tg",
369
+ "max",
370
+ "memo",
371
+ "drive",
372
+ "zm",
373
+ "wa",
374
+ "b24",
375
+ "beeline",
376
+ "pbx",
377
+ "notion",
378
+ "amo",
379
+ "hubspot",
380
+ "attio",
381
+ "ydisk",
382
+ "wordpress"
383
+ ],
403
384
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
404
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
385
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
386
+ },
387
+ // The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet and hubspot-cli is
388
+ // not in the family packages, so `audit --family` skips them, as beeline. Only b24 and hubspot have `leads` (amoCRM
389
+ // has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
390
+ // API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
391
+ // no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
392
+ // `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
393
+ // commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
394
+ {
395
+ name: "crm",
396
+ members: ["b24", "amo", "hubspot", "attio"],
397
+ covers: ["deals", "sync", "search", "store", "schedule", "account"],
398
+ differences: [
399
+ {
400
+ rule: "same-path-contract",
401
+ target: "schedule: summary",
402
+ differs: "hubspot",
403
+ 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",
404
+ review_after: "2026-12-01"
405
+ }
406
+ ]
405
407
  }
406
408
  ]);
409
+ var SHARED_DIFFERENCES = [
410
+ ...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()
411
+ ];
407
412
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
408
413
  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
414
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -415,7 +420,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
415
420
  { path: ["upgrade"], meaning: "updates the CLI" }
416
421
  ]);
417
422
 
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
423
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
419
424
  var fieldRuleSchema = strictObject({ id: word, rule: text });
420
425
  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
426
  var FIELD_RULES = defineFieldRules([
@@ -431,7 +436,7 @@ var FIELD_RULES = defineFieldRules([
431
436
  }
432
437
  ]);
433
438
 
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
439
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
435
440
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
436
441
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
437
442
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -453,7 +458,7 @@ var IDENTIFIERS = defineIdentifiers([
453
458
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
454
459
  ]);
455
460
 
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
461
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
457
462
  var ACCOUNT_FLAGS = [
458
463
  {
459
464
  name: "--client-id",
@@ -490,7 +495,7 @@ var ACCOUNT_FLAGS = [
490
495
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
491
496
  ];
492
497
 
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
498
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
494
499
  var CALENDAR_FLAGS = [
495
500
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
496
501
  {
@@ -578,7 +583,25 @@ var CALENDAR_FLAGS = [
578
583
  }
579
584
  ];
580
585
 
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
586
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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-content.js
587
+ var CONTENT_FLAGS = [
588
+ { name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
589
+ {
590
+ name: "--tags",
591
+ value: "<ids>",
592
+ role: "value",
593
+ type: "list",
594
+ meaning: "its tags and categories, by comma-separated ids; replaces the ones it has"
595
+ },
596
+ {
597
+ name: "--replace-body",
598
+ role: "mode",
599
+ type: "switch",
600
+ meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show"
601
+ }
602
+ ];
603
+
604
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
582
605
  var CRM_FLAGS = [
583
606
  {
584
607
  name: "--email",
@@ -742,7 +765,7 @@ var CRM_FLAGS = [
742
765
  }
743
766
  ];
744
767
 
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
768
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
746
769
  var HOW_FLAGS = [
747
770
  {
748
771
  name: "--limit",
@@ -1122,13 +1145,7 @@ var HOW_FLAGS = [
1122
1145
  type: "string",
1123
1146
  meaning: "a person whose reply counts as an answer; repeat it for more"
1124
1147
  },
1125
- {
1126
- name: "--browser",
1127
- value: "<program>",
1128
- role: "mode",
1129
- type: "string",
1130
- meaning: "the browser program to open for sign-in"
1131
- },
1148
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1132
1149
  {
1133
1150
  name: "--credential-storage",
1134
1151
  value: "<storage>",
@@ -1137,6 +1154,8 @@ var HOW_FLAGS = [
1137
1154
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1138
1155
  },
1139
1156
  { name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
1157
+ { name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
1158
+ { name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
1140
1159
  {
1141
1160
  name: "--expected-event-id",
1142
1161
  value: "<id>",
@@ -1739,7 +1758,7 @@ var HOW_FLAGS = [
1739
1758
  }
1740
1759
  ];
1741
1760
 
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
1761
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
1743
1762
  var KNOWLEDGE_FLAGS = [
1744
1763
  {
1745
1764
  name: "--accept-terms",
@@ -1775,6 +1794,13 @@ var KNOWLEDGE_FLAGS = [
1775
1794
  meaning: "at most this many characters read",
1776
1795
  unit: "characters"
1777
1796
  },
1797
+ {
1798
+ name: "--tab",
1799
+ value: "<id>",
1800
+ role: "target",
1801
+ type: "id",
1802
+ meaning: "one tab of a document, by its id: only its text is read"
1803
+ },
1778
1804
  {
1779
1805
  name: "--tag",
1780
1806
  value: "<name>",
@@ -1791,7 +1817,7 @@ var KNOWLEDGE_FLAGS = [
1791
1817
  }
1792
1818
  ];
1793
1819
 
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
1820
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
1795
1821
  var MAIL_FLAGS = [
1796
1822
  {
1797
1823
  name: "--cc",
@@ -1821,7 +1847,7 @@ var MAIL_FLAGS = [
1821
1847
  }
1822
1848
  ];
1823
1849
 
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
1850
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
1825
1851
  var PRIVACY_FLAGS = [
1826
1852
  {
1827
1853
  name: "--about-text",
@@ -1882,7 +1908,7 @@ var PRIVACY_FLAGS = [
1882
1908
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1883
1909
  ];
1884
1910
 
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
1911
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
1886
1912
  var SCHEDULE_FLAGS = [
1887
1913
  {
1888
1914
  name: "--locale",
@@ -1915,7 +1941,7 @@ var SCHEDULE_FLAGS = [
1915
1941
  }
1916
1942
  ];
1917
1943
 
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
1944
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
1919
1945
  var WHAT_FLAGS = [
1920
1946
  {
1921
1947
  name: "--analysis-provider",
@@ -2912,7 +2938,7 @@ var WHAT_FLAGS = [
2912
2938
  }
2913
2939
  ];
2914
2940
 
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
2941
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.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
2916
2942
  var FLAG_TYPES = [
2917
2943
  "switch",
2918
2944
  "count",
@@ -3042,6 +3068,10 @@ var verbs = [
3042
3068
  ["export", "write from the store to a file"],
3043
3069
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
3044
3070
  ["download", "save a file from the source to this machine"],
3071
+ ["upload", "put a file from this machine on the source"],
3072
+ ["publish", "open a thing to anyone who has its public link"],
3073
+ ["unpublish", "close a thing's public link"],
3074
+ ["stale", "mark a saved memory as out of date, keeping it"],
3045
3075
  ["transcribe", "turn speech into text"],
3046
3076
  ["extract", "read the text inside files already on this machine into the store"],
3047
3077
  ["migrate", "bring a file up to this build's schema"],
@@ -3138,6 +3168,8 @@ var collections = [
3138
3168
  ["messages", "posts in a messenger chat, or emails"],
3139
3169
  ["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
3140
3170
  ["polls", "polls in a chat"],
3171
+ ["posts", "posts and pages on a site or blog the owner publishes"],
3172
+ ["channels", "the sites and social accounts the owner publishes posts on"],
3141
3173
  ["reactions", "reactions to a message"],
3142
3174
  ["recipients", "who a message goes to"],
3143
3175
  ["replies", "the automatic replies of a profile"],
@@ -3184,6 +3216,10 @@ var collections = [
3184
3216
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3185
3217
  ["splits", "parts of one transaction, each with its own amount and category"],
3186
3218
  ["users", "people who work in the owner's account at a service, such as a CRM's employees"],
3219
+ ["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
3220
+ ["teams", "groups in a tracker that own issues, states and labels"],
3221
+ ["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
3222
+ ["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
3187
3223
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3188
3224
  ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3189
3225
  ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
@@ -3252,6 +3288,10 @@ var singulars = [
3252
3288
  ["privacy", "who may find, see, call or add the account"],
3253
3289
  ["metadata", "a profile's cached source attributes"],
3254
3290
  ["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
3291
+ [
3292
+ "scheduled",
3293
+ "a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
3294
+ ],
3255
3295
  [
3256
3296
  "schedule",
3257
3297
  "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 +3299,7 @@ var singulars = [
3259
3299
  ];
3260
3300
  var views = [
3261
3301
  ["tree", "the parent and child hierarchy of stored sources"],
3302
+ ["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
3262
3303
  ["logs", "the log of a running process"],
3263
3304
  ["events", "what happened in a thing over time"],
3264
3305
  ["scheduled", "what is scheduled to happen"],
@@ -3271,6 +3312,7 @@ var views = [
3271
3312
  ["transcript", "the text of speech: a voice message or a meeting recording"],
3272
3313
  ["evidence", "the stored messages or lines a result or a reference rests on"],
3273
3314
  ["passage", "a cited transcript line with bounded surrounding lines from the same revision"],
3315
+ ["invitation", "the text that invites people to a meeting: how to join it and when"],
3274
3316
  ["agenda", "what needs a look today"],
3275
3317
  ["busy", "when calendars or people are taken, without what takes them"],
3276
3318
  ["categories", "the categories a thing takes, with what each means"],
@@ -3330,11 +3372,12 @@ var VOCABULARY = defineVocabulary({
3330
3372
  ...MAIL_FLAGS,
3331
3373
  ...KNOWLEDGE_FLAGS,
3332
3374
  ...CRM_FLAGS,
3333
- ...SCHEDULE_FLAGS
3375
+ ...SCHEDULE_FLAGS,
3376
+ ...CONTENT_FLAGS
3334
3377
  ]
3335
3378
  });
3336
3379
 
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
3380
+ // node_modules/.pnpm/@wirecat+cli-core@0.709.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_d98198650466e0f5373009c2596db072/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3338
3381
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3339
3382
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3340
3383
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3505,7 +3548,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3505
3548
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3506
3549
  const lend = ctx.connection;
3507
3550
  let borrowed;
3508
- let answered2 = false;
3551
+ let answered = false;
3509
3552
  let result;
3510
3553
  let failure;
3511
3554
  const streams = captureStreams();
@@ -3527,7 +3570,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3527
3570
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3528
3571
  agent: {
3529
3572
  result: /* @__PURE__ */ __name((value) => {
3530
- answered2 = true;
3573
+ answered = true;
3531
3574
  result = value;
3532
3575
  }, "result"),
3533
3576
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3549,7 +3592,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3549
3592
  }));
3550
3593
  if (failure)
3551
3594
  return { error: failure };
3552
- if (answered2)
3595
+ if (answered)
3553
3596
  return { result };
3554
3597
  if (code !== 0)
3555
3598
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3561,468 +3604,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3561
3604
  }
3562
3605
  }, "runCommandForAgent");
3563
3606
 
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
3607
  export {
4009
3608
  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
3609
+ runCommandForAgent
4028
3610
  };