@wirecat/tg-cli 0.132.0 → 0.134.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 (160) hide show
  1. package/README.md +139 -319
  2. package/contracts/wirecat.json +82 -2
  3. package/dist/bin/tg.js +2 -2
  4. package/dist/bot/generated/types.d.ts +188 -0
  5. package/dist/bot/generated/types.d.ts.map +1 -1
  6. package/dist/bundle/{adapter-OXVMOWVE.js → adapter-Y4IXTXAG.js} +104 -68
  7. package/dist/bundle/agent-G7VHOJMS.js +37 -0
  8. package/dist/bundle/{all-profiles-6OQC7PBL.js → all-profiles-SUGID6CX.js} +62 -20
  9. package/dist/bundle/{anthropic-YFMIHFW5.js → anthropic-4QKTXT4B.js} +5 -5
  10. package/dist/bundle/{app-server-S7CJPJXN.js → app-server-TPOD6LIJ.js} +75 -65
  11. package/dist/bundle/{bot-api-KJ6EZ4R6.js → bot-api-KBESP422.js} +73 -91
  12. package/dist/bundle/{bot-history-JYCXDFW4.js → bot-history-3EORA23G.js} +23 -22
  13. package/dist/bundle/{bun-FVTOBYZ2.js → bun-FL76M4M2.js} +2 -2
  14. package/dist/bundle/{bun-sqlite-KDGWBNOR.js → bun-sqlite-H37OSTAJ.js} +6 -6
  15. package/dist/bundle/{chunk-JZJV3DYK.js → chunk-2GT563YH.js} +2 -2
  16. package/dist/bundle/{chunk-EPR67IRV.js → chunk-2JWY7CXJ.js} +4 -4
  17. package/dist/bundle/{chunk-UGD4SCUI.js → chunk-3O25FAPA.js} +3 -4
  18. package/dist/bundle/{chunk-AERP2QR6.js → chunk-3PG6QVQZ.js} +11 -25
  19. package/dist/bundle/{chunk-DXPGMUOR.js → chunk-3QQWTP77.js} +2 -2
  20. package/dist/bundle/{chunk-FIUH52FE.js → chunk-3ZNO27UE.js} +1 -1
  21. package/dist/bundle/{chunk-Y57EKZZK.js → chunk-4R2ZJGFF.js} +3274 -1674
  22. package/dist/bundle/{chunk-6LPUK62N.js → chunk-4S2DHHJM.js} +2 -100
  23. package/dist/bundle/{chunk-LF6FACSW.js → chunk-4X6BX3XP.js} +144 -10
  24. package/dist/bundle/{chunk-LZ3HFDYL.js → chunk-6DGVK5KS.js} +2 -2
  25. package/dist/bundle/chunk-6DJJVFSG.js +388 -0
  26. package/dist/bundle/{chunk-BSXS7VAC.js → chunk-6MEHKUN6.js} +1 -1
  27. package/dist/bundle/{chunk-44A2XRDE.js → chunk-6UNLEQA5.js} +31 -20
  28. package/dist/bundle/{chunk-M2TV6BDB.js → chunk-77E7Q4EQ.js} +7 -7
  29. package/dist/bundle/chunk-7GGDCQJ5.js +353 -0
  30. package/dist/bundle/{chunk-OGZZUDJJ.js → chunk-AHVWZDXO.js} +79 -64
  31. package/dist/bundle/{chunk-YVI5SQPY.js → chunk-ANBI3OXK.js} +1 -1
  32. package/dist/bundle/{chunk-PR4F3TYK.js → chunk-AYWST6NA.js} +60 -51
  33. package/dist/bundle/{chunk-7SEVVE3X.js → chunk-CA7DY2YU.js} +3 -3
  34. package/dist/bundle/{chunk-O43PARFS.js → chunk-CDKXZLMP.js} +273 -176
  35. package/dist/bundle/{chunk-YAPO7QNO.js → chunk-CNGNR4CY.js} +6 -6
  36. package/dist/bundle/{chunk-2UGSIHLV.js → chunk-CSXCCK6J.js} +2 -2
  37. package/dist/bundle/{chunk-N5LZ6L4D.js → chunk-DG35TQ6P.js} +3 -3
  38. package/dist/bundle/{chunk-LMGVPDXN.js → chunk-EXMAWEHC.js} +2 -2
  39. package/dist/bundle/{chunk-A5D3J7XZ.js → chunk-FR3ATU5I.js} +4 -4
  40. package/dist/bundle/{chunk-JDNDWZYS.js → chunk-FR4Y5CGW.js} +4 -4
  41. package/dist/bundle/{chunk-YSNQGOUI.js → chunk-GIGZTI74.js} +2115 -1975
  42. package/dist/bundle/{chunk-3QHKZLBU.js → chunk-H3TLAYGY.js} +4 -4
  43. package/dist/bundle/{chunk-KJICORS4.js → chunk-HD7DV5B2.js} +65 -43
  44. package/dist/bundle/{chunk-NLRGMP7M.js → chunk-HETHFOHC.js} +3 -3
  45. package/dist/bundle/{chunk-4YB7JU2W.js → chunk-HEZK4W3U.js} +6 -6
  46. package/dist/bundle/{chunk-2LZD2VFV.js → chunk-IJ7R2WMK.js} +4 -4
  47. package/dist/bundle/{chunk-4ZTVJHWU.js → chunk-ITJ7DGNA.js} +4 -4
  48. package/dist/bundle/{chunk-5UPEEMEF.js → chunk-J5RB4ASI.js} +142 -372
  49. package/dist/bundle/{chunk-IY7CTAOQ.js → chunk-JAL443BH.js} +9 -9
  50. package/dist/bundle/{chunk-U7PHJSTX.js → chunk-JCDD5T3A.js} +2 -2
  51. package/dist/bundle/{chunk-BLZEQVP4.js → chunk-JHZJBNDO.js} +2 -2
  52. package/dist/bundle/chunk-JWLODUN3.js +555 -0
  53. package/dist/bundle/{chunk-4CKYANQH.js → chunk-JWNSG5GI.js} +1 -1
  54. package/dist/bundle/{chunk-YRXSNH3R.js → chunk-JXEO5EIN.js} +2 -2
  55. package/dist/bundle/{chunk-DSJNZXTP.js → chunk-K5FK6WWN.js} +1 -1
  56. package/dist/bundle/{chunk-LG3K5NHX.js → chunk-L47PFECD.js} +7 -7
  57. package/dist/bundle/{chunk-OIRNHSAH.js → chunk-L4PNDW4S.js} +6 -6
  58. package/dist/bundle/{chunk-WAVRUADL.js → chunk-M323L5SG.js} +30 -15
  59. package/dist/bundle/{chunk-AUZWIBHJ.js → chunk-MMDFPBFZ.js} +43 -64
  60. package/dist/bundle/{chunk-FKGYXIN7.js → chunk-MUV73B5A.js} +7 -7
  61. package/dist/bundle/chunk-MXA3FU2R.js +116 -0
  62. package/dist/bundle/{chunk-42MXCMW6.js → chunk-NUD4CBHK.js} +3 -3
  63. package/dist/bundle/{chunk-PG37E63A.js → chunk-NYEVPAF2.js} +511 -472
  64. package/dist/bundle/{chunk-QS46C5SW.js → chunk-O3QBO6NW.js} +17 -17
  65. package/dist/bundle/{chunk-CFWFESBO.js → chunk-O4ZOQJ6W.js} +9 -9
  66. package/dist/bundle/{chunk-74UPKW7H.js → chunk-OJSPB4LA.js} +2 -2
  67. package/dist/bundle/{chunk-JNWKV3QV.js → chunk-PCBVSHKD.js} +4 -4
  68. package/dist/bundle/{chunk-5RDNBG7D.js → chunk-PK5WEGPJ.js} +2 -2
  69. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  70. package/dist/bundle/{chunk-BMI2NWFI.js → chunk-PRI2XTM7.js} +35 -12
  71. package/dist/bundle/chunk-PRM7GKBV.js +340 -0
  72. package/dist/bundle/{chunk-ZZ32DXTH.js → chunk-PZ2ZFPGO.js} +1 -1
  73. package/dist/bundle/chunk-QYRK4XXH.js +727 -0
  74. package/dist/bundle/{chunk-QNEAPLOP.js → chunk-RVA3CRSY.js} +12 -12
  75. package/dist/bundle/{chunk-4EDJJQJI.js → chunk-SPXNI53Z.js} +38 -9
  76. package/dist/bundle/{chunk-ZRW3DF25.js → chunk-TI5U6AUT.js} +34 -28
  77. package/dist/bundle/{chunk-SMQ45RZX.js → chunk-TKWYXM7L.js} +9 -60
  78. package/dist/bundle/{chunk-ZJIGVT6Z.js → chunk-TZCFJJEU.js} +6 -6
  79. package/dist/bundle/chunk-UTTEAOJ3.js +7 -0
  80. package/dist/bundle/chunk-V6G4LTXU.js +50 -0
  81. package/dist/bundle/{chunk-JMJOWT4N.js → chunk-VH4J7IIS.js} +1 -1
  82. package/dist/bundle/{chunk-UAFSDTID.js → chunk-VNJRWFHP.js} +1 -1
  83. package/dist/bundle/chunk-W2QSDPG6.js +80 -0
  84. package/dist/bundle/{chunk-ESOFH7PA.js → chunk-WGGUKQE7.js} +134 -558
  85. package/dist/bundle/{chunk-NWDADTPE.js → chunk-WPXVJGSL.js} +3 -3
  86. package/dist/bundle/{chunk-NWCFO37P.js → chunk-XLNV3U6N.js} +3 -3
  87. package/dist/bundle/{chunk-JPSRC732.js → chunk-XS4EE7MO.js} +17 -15
  88. package/dist/bundle/{chunk-FPSRT2TX.js → chunk-XVRLD3LN.js} +2 -2
  89. package/dist/bundle/{chunk-O3AM32YN.js → chunk-XZ6XEAJP.js} +18 -18
  90. package/dist/bundle/{chunk-B4LGDOG5.js → chunk-YHTSJMZ5.js} +3734 -3380
  91. package/dist/bundle/chunk-YPJCURT6.js +108 -0
  92. package/dist/bundle/{chunk-HBSKP7OV.js → chunk-Z77R76S2.js} +1 -1
  93. package/dist/bundle/{chunk-PYECFCPD.js → chunk-ZC7OEYDX.js} +1 -1
  94. package/dist/bundle/{chunk-IYJ4B632.js → chunk-ZW2N2GI2.js} +12 -12
  95. package/dist/bundle/command-contract-LEFXJAA3.js +37 -0
  96. package/dist/bundle/{command-server-entry-TM264M2J.js → command-server-entry-WQAE5UGU.js} +27 -27
  97. package/dist/bundle/{decode-RJFOSHCE.js → decode-2J2DOVGV.js} +5 -5
  98. package/dist/bundle/{dispatch-7OZP3X4O.js → dispatch-IZ2TP5GW.js} +8 -8
  99. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  100. package/dist/bundle/{echarts-PYKF4D7B.js → echarts-GFIIHZ4U.js} +2 -2
  101. package/dist/bundle/{embed-JFN6Z5TG.js → embed-AGOXADHW.js} +6 -6
  102. package/dist/bundle/{embedder-WN54JIMY.js → embedder-PCIXGM2Y.js} +9 -9
  103. package/dist/bundle/{entry-Z6LO6N6S.js → entry-HUQXUV52.js} +9 -9
  104. package/dist/bundle/{failure-UONA2IA5.js → failure-JSRHZ2S6.js} +2 -2
  105. package/dist/bundle/{first-run-WQAKES7G.js → first-run-2LXN7B33.js} +12 -12
  106. package/dist/bundle/first-screen-VUE6RCSF.js +37 -0
  107. package/dist/bundle/{instructions-PR4BBBTM.js → instructions-RSLTJVFJ.js} +1 -1
  108. package/dist/bundle/{mcp-O6ACR2DX.js → mcp-MMENCB7I.js} +2 -2
  109. package/dist/bundle/meeting-combined-PBNPHOM3.js +23 -0
  110. package/dist/bundle/{meeting-model-YVTUOM4H.js → meeting-model-SI77WMMK.js} +11 -11
  111. package/dist/bundle/{meeting-semantic-X4KG6RNV.js → meeting-semantic-WRXWUR4M.js} +6 -6
  112. package/dist/bundle/{node-OVS5LTVZ.js → node-5XGMCUGQ.js} +2 -2
  113. package/dist/bundle/{node-sqlite-LC44SM4Z.js → node-sqlite-ES7SQSIC.js} +7 -7
  114. package/dist/bundle/{oauth-NSVUFQCW.js → oauth-QFM4Y6N7.js} +8 -8
  115. package/dist/bundle/{open-XN5SJFVY.js → open-2MD2DKGQ.js} +5 -5
  116. package/dist/bundle/{openai-WOYZHJNL.js → openai-6TMKJKYO.js} +15 -15
  117. package/dist/bundle/{process-UFBRGTQC.js → process-VA2DP7MY.js} +1 -1
  118. package/dist/bundle/{program-RAGBRRQH.js → program-K3SLEA42.js} +70 -63
  119. package/dist/bundle/{prompt-6HAKBUQN.js → prompt-VZSPCE6E.js} +5 -5
  120. package/dist/bundle/{proxy-transport-5EJVFUTC.js → proxy-transport-OJU2EOOC.js} +5 -5
  121. package/dist/bundle/{recognize-CN5COBVJ.js → recognize-LH3ZZEIL.js} +4 -4
  122. package/dist/bundle/{remote-STX5AMGE.js → remote-JNW5HN2I.js} +9 -9
  123. package/dist/bundle/{rerank-ZCOWTXIJ.js → rerank-P23UJMII.js} +7 -7
  124. package/dist/bundle/{serve-XMQEOIG2.js → serve-VSLLMILH.js} +15 -15
  125. package/dist/bundle/{server-PGGUD3DM.js → server-FBRRRKCS.js} +68 -57
  126. package/dist/bundle/server-TA4QP7PG.js +78 -0
  127. package/dist/bundle/{sqlite-runtime-PS4DSOIU.js → sqlite-runtime-LWATDAAU.js} +6 -6
  128. package/dist/bundle/{state-GL4ZC57O.js → state-3AFJL2EL.js} +6 -6
  129. package/dist/bundle/{store-VISFXSHL.js → store-6TLYL2VU.js} +30 -17
  130. package/dist/bundle/{store-HJ76TLWD.js → store-PEXV5DNA.js} +24 -19
  131. package/dist/bundle/store-maintenance-command-IYJLUQ5X.js +65 -0
  132. package/dist/bundle/surface-L4VY4WFG.js +64 -0
  133. package/dist/bundle/tg.js +13 -13
  134. package/dist/telegram/adapter.d.ts +9 -2
  135. package/dist/telegram/adapter.d.ts.map +1 -1
  136. package/dist/telegram/adapter.js +5 -6
  137. package/dist/telegram/adapter.js.map +1 -1
  138. package/dist/telegram/messages.d.ts +12 -0
  139. package/dist/telegram/messages.d.ts.map +1 -1
  140. package/dist/telegram/messages.js +40 -0
  141. package/dist/telegram/messages.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/skills/tg-cli/SKILL.md +80 -576
  146. package/skills/tg-cli/references/files.md +64 -0
  147. package/skills/tg-cli/references/history.md +22 -0
  148. package/skills/tg-cli/references/mcp-and-bots.md +54 -0
  149. package/skills/tg-cli/references/messages.md +115 -0
  150. package/skills/tg-cli/references/people.md +85 -0
  151. package/skills/tg-cli/references/search.md +132 -0
  152. package/skills/tg-cli/references/setup.md +91 -0
  153. package/skills/tg-cli/references/stats.md +45 -0
  154. package/skills/tg-cli/references/tasks.md +54 -0
  155. package/dist/bundle/chunk-VKE77B3F.js +0 -2
  156. package/dist/bundle/command-contract-FRH7LBGE.js +0 -37
  157. package/dist/bundle/first-screen-4RFG22SA.js +0 -35
  158. package/dist/bundle/meeting-combined-MHWTZOF2.js +0 -23
  159. package/dist/bundle/server-WTNYWCZ4.js +0 -69
  160. package/dist/bundle/store-maintenance-command-SMARMN5C.js +0 -60
@@ -1,70 +1,35 @@
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
- commandAvailability,
9
- failureContext
10
- } from "./chunk-5UPEEMEF.js";
4
+ commandAvailability
5
+ } from "./chunk-V6G4LTXU.js";
11
6
  import {
12
- callerOf
13
- } from "./chunk-6LPUK62N.js";
7
+ lentConnection
8
+ } from "./chunk-PRM7GKBV.js";
14
9
  import {
15
- QUERY_ARGUMENT,
16
- lentConnection,
17
- onlineDeps,
18
- refuseLacking,
19
- servicesFor,
20
- storeModeDeps
21
- } from "./chunk-B4LGDOG5.js";
10
+ QUERY_ARGUMENT
11
+ } from "./chunk-QYRK4XXH.js";
22
12
  import {
23
- MAX_BUFFERED_INPUT
24
- } from "./chunk-YRXSNH3R.js";
25
- import {
26
- DEFAULT_OUTPUT_BYTES,
27
- ENTITIES,
28
- LOCAL_WRITE,
29
- REMOTE_WRITE,
30
- answerSchema,
31
13
  authorityAllowed,
32
14
  botApiAllowed,
33
15
  changesMessenger,
34
- fetchesAt,
35
- flatten,
36
- judgedAnswer,
37
- judgedEffects,
38
- keyForCommand,
39
- levelFor,
40
- listOf,
41
- readKeysForCommand,
42
- refuseStoreChange,
43
- sealed,
44
- startRecording
45
- } from "./chunk-O43PARFS.js";
16
+ flatten
17
+ } from "./chunk-CDKXZLMP.js";
46
18
  import {
47
- currentCaller,
48
- keepsSuccess,
49
- runContextOf,
50
- withCaller
51
- } from "./chunk-LG3K5NHX.js";
19
+ currentCaller
20
+ } from "./chunk-L47PFECD.js";
52
21
  import {
53
22
  enclosingTraceId,
54
23
  inRun,
55
24
  newRunId,
56
25
  traceOf
57
- } from "./chunk-KJICORS4.js";
58
- import {
59
- storeDamaged
60
- } from "./chunk-NWDADTPE.js";
26
+ } from "./chunk-HD7DV5B2.js";
61
27
  import {
62
28
  queryDescription
63
- } from "./chunk-PG37E63A.js";
29
+ } from "./chunk-NYEVPAF2.js";
64
30
  import {
65
- captureStreams,
66
- traceIdOf
67
- } from "./chunk-44A2XRDE.js";
31
+ captureStreams
32
+ } from "./chunk-6UNLEQA5.js";
68
33
  import {
69
34
  COMPACT_FLAG,
70
35
  SNAKE_CASE,
@@ -75,13 +40,7 @@ import {
75
40
  errorObjectOf,
76
41
  integer,
77
42
  isoDate,
78
- itemEnvelopeSchema,
79
- listEnvelopeSchema,
80
43
  literal,
81
- looseObject,
82
- maxLength,
83
- maxValue,
84
- mcpErrorResult,
85
44
  minLength,
86
45
  minValue,
87
46
  number,
@@ -92,30 +51,25 @@ import {
92
51
  pipe,
93
52
  record,
94
53
  regex,
95
- safeParse,
96
54
  strictObject,
97
55
  string,
98
- summarize,
99
56
  text,
100
- toJsonSchema,
101
- toStandardJsonSchema,
102
57
  union,
103
58
  unknown,
104
59
  word,
105
60
  writes
106
- } from "./chunk-4EDJJQJI.js";
61
+ } from "./chunk-SPXNI53Z.js";
107
62
  import {
108
- CliError,
109
- errorCodes
110
- } from "./chunk-5RDNBG7D.js";
63
+ CliError
64
+ } from "./chunk-PK5WEGPJ.js";
111
65
  import {
112
66
  __name
113
67
  } from "./chunk-ZVVMGPBJ.js";
114
68
 
115
- // node_modules/.pnpm/@wirecat+cli-core@0.675.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.102.1_commander@15_4538b457841b7e7d546b8c440ab6644a/node_modules/@wirecat/cli-core/dist/mcp/agent.js
69
+ // node_modules/.pnpm/@wirecat+cli-core@0.714.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.122.0_commander@15_dd9fedf917a0d541ef7fdcdb0be0e64b/node_modules/@wirecat/cli-core/dist/mcp/agent.js
116
70
  import { Readable } from "node:stream";
117
71
 
118
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
72
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
119
73
  var LINT_SEVERITIES = ["high", "medium", "low"];
120
74
  var lintRuleSchema = strictObject({
121
75
  id: word,
@@ -261,7 +215,7 @@ var overrideSchema = strictObject({
261
215
  });
262
216
  var overridesSchema = array(overrideSchema);
263
217
 
264
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
218
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
265
219
  var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
266
220
  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");
267
221
  var AUDIT_RULES = defineAuditRules([
@@ -316,17 +270,20 @@ var parityGroupSchema = strictObject({
316
270
  absent: optional(word),
317
271
  /** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
318
272
  only: optional(word),
273
+ /** The one CLI whose value (a summary, a value name) differs by design; every other CLI compared must agree. */
274
+ differs: optional(word),
319
275
  reason: pipe(text, minLength(10, "say why, in a sentence")),
320
276
  /** Warns from 14 days before and fails 14 days after, as a lint override does. */
321
277
  review_after: optional(pipe(string(), isoDate("a date, YYYY-MM-DD")))
322
278
  }))
323
279
  });
280
+ var kindOf = /* @__PURE__ */ __name((entry) => ["absent", "only", "differs"].filter((one) => entry[one] !== void 0), "kindOf");
324
281
  var defineParityGroups = /* @__PURE__ */ __name((input) => parseRegistry("parity groups", array(parityGroupSchema), input, (groups) => [
325
282
  ...duplicates(groups.map((group) => group.name)).map((name) => `"${name}" is listed twice`),
326
283
  ...groups.flatMap((group) => [
327
284
  ...duplicates(group.differences.map((entry) => `${entry.rule} ${entry.target}`)).map((both) => `${group.name}: "${both}" is listed twice`),
328
- ...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\``),
329
- ...group.differences.filter((entry) => entry.absent && entry.only).map((entry) => `${group.name}: "${entry.target}" has both \`absent\` and \`only\`; keep one`)
285
+ ...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\``),
286
+ ...group.differences.filter((entry) => kindOf(entry).length > 1).map((entry) => `${group.name}: "${entry.target}" has ${kindOf(entry).map((one) => `\`${one}\``).join(" and ")}; keep one`)
330
287
  ])
331
288
  ]), "defineParityGroups");
332
289
  var MEMO_HAS_NO_PROFILES = [
@@ -341,6 +298,12 @@ var MEMO_HAS_NO_PROFILES = [
341
298
  absent: "memo",
342
299
  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)"
343
300
  }));
301
+ var MEMO_MCP_SUMMARIES = ["mcp", "mcp serve"].map((path) => ({
302
+ rule: "same-path-contract",
303
+ target: `${path}: summary`,
304
+ differs: "memo",
305
+ reason: "memo has no profiles, so its mcp commands serve memo's commands rather than a profile's"
306
+ }));
344
307
  var MEMO_DOCTOR_DEEP = {
345
308
  rule: "same-path-contract",
346
309
  target: "doctor --deep",
@@ -371,7 +334,7 @@ var PARITY_GROUPS = defineParityGroups([
371
334
  name: "all",
372
335
  members: ["tg", "max", "memo", "drive", "zm", "wa"],
373
336
  covers: ["commands", "doctor", "skill", "mcp", "upgrade", "search", "notes", "meetings"],
374
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
337
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
375
338
  },
376
339
  // mail's `search messages` is cli-core's mail search, not the messengers' command: --complete took their 20-odd
377
340
  // differences as inherited (https://github.com/WireCatLabs/cli-base/issues/390). mail is compared everywhere else
@@ -380,7 +343,7 @@ var PARITY_GROUPS = defineParityGroups([
380
343
  name: "mail-shared",
381
344
  members: ["tg", "max", "memo", "drive", "zm", "wa", "mail"],
382
345
  covers: ["commands", "doctor", "skill", "mcp", "upgrade", "notes", "meetings"],
383
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
346
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
384
347
  },
385
348
  // gcal is compared on what it already shares with every CLI; doctor, mcp, search and skill wait until the published
386
349
  // CLIs agree there (https://github.com/WireCatLabs/cli-base/issues/390), then gcal moves back into "all".
@@ -392,14 +355,56 @@ var PARITY_GROUPS = defineParityGroups([
392
355
  },
393
356
  // bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
394
357
  // recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
395
- // notion-cli joins here until its documents commands ship; then it moves next to drive.
358
+ // amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
359
+ // notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
360
+ // its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
361
+ // and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
396
362
  {
397
363
  name: "shared-roots",
398
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion"],
364
+ members: [
365
+ "tg",
366
+ "max",
367
+ "memo",
368
+ "drive",
369
+ "zm",
370
+ "wa",
371
+ "b24",
372
+ "beeline",
373
+ "pbx",
374
+ "notion",
375
+ "amo",
376
+ "hubspot",
377
+ "attio",
378
+ "ydisk"
379
+ ],
399
380
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
400
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
381
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
382
+ },
383
+ // The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet and hubspot-cli is
384
+ // not in the family packages, so `audit --family` skips them, as beeline. Only b24 and hubspot have `leads` (amoCRM
385
+ // has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
386
+ // API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
387
+ // no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
388
+ // `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
389
+ // commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
390
+ {
391
+ name: "crm",
392
+ members: ["b24", "amo", "hubspot", "attio"],
393
+ covers: ["deals", "sync", "search", "store", "schedule", "account"],
394
+ differences: [
395
+ {
396
+ rule: "same-path-contract",
397
+ target: "schedule: summary",
398
+ differs: "hubspot",
399
+ 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",
400
+ review_after: "2026-12-01"
401
+ }
402
+ ]
401
403
  }
402
404
  ]);
405
+ var SHARED_DIFFERENCES = [
406
+ ...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()
407
+ ];
403
408
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
404
409
  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");
405
410
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -411,7 +416,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
411
416
  { path: ["upgrade"], meaning: "updates the CLI" }
412
417
  ]);
413
418
 
414
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
415
420
  var fieldRuleSchema = strictObject({ id: word, rule: text });
416
421
  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");
417
422
  var FIELD_RULES = defineFieldRules([
@@ -427,7 +432,7 @@ var FIELD_RULES = defineFieldRules([
427
432
  }
428
433
  ]);
429
434
 
430
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
431
436
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
432
437
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
433
438
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -449,7 +454,7 @@ var IDENTIFIERS = defineIdentifiers([
449
454
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
450
455
  ]);
451
456
 
452
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
453
458
  var ACCOUNT_FLAGS = [
454
459
  {
455
460
  name: "--client-id",
@@ -486,7 +491,7 @@ var ACCOUNT_FLAGS = [
486
491
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
487
492
  ];
488
493
 
489
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
490
495
  var CALENDAR_FLAGS = [
491
496
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
492
497
  {
@@ -574,8 +579,22 @@ var CALENDAR_FLAGS = [
574
579
  }
575
580
  ];
576
581
 
577
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
578
583
  var CRM_FLAGS = [
584
+ {
585
+ name: "--email",
586
+ value: "<address>",
587
+ role: "value",
588
+ type: "string",
589
+ meaning: "an e-mail address to give it; repeat it for more"
590
+ },
591
+ {
592
+ name: "--phone",
593
+ value: "<phone>",
594
+ role: "value",
595
+ type: "string",
596
+ meaning: "a phone number to give it, in international form starting with +; repeat it for more"
597
+ },
579
598
  {
580
599
  name: "--pipeline",
581
600
  value: "<pipeline>",
@@ -724,7 +743,7 @@ var CRM_FLAGS = [
724
743
  }
725
744
  ];
726
745
 
727
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
728
747
  var HOW_FLAGS = [
729
748
  {
730
749
  name: "--limit",
@@ -1104,13 +1123,7 @@ var HOW_FLAGS = [
1104
1123
  type: "string",
1105
1124
  meaning: "a person whose reply counts as an answer; repeat it for more"
1106
1125
  },
1107
- {
1108
- name: "--browser",
1109
- value: "<program>",
1110
- role: "mode",
1111
- type: "string",
1112
- meaning: "the browser program to open for sign-in"
1113
- },
1126
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1114
1127
  {
1115
1128
  name: "--credential-storage",
1116
1129
  value: "<storage>",
@@ -1119,6 +1132,8 @@ var HOW_FLAGS = [
1119
1132
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1120
1133
  },
1121
1134
  { name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
1135
+ { name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
1136
+ { name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
1122
1137
  {
1123
1138
  name: "--expected-event-id",
1124
1139
  value: "<id>",
@@ -1721,7 +1736,7 @@ var HOW_FLAGS = [
1721
1736
  }
1722
1737
  ];
1723
1738
 
1724
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
1739
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
1725
1740
  var KNOWLEDGE_FLAGS = [
1726
1741
  {
1727
1742
  name: "--accept-terms",
@@ -1757,6 +1772,13 @@ var KNOWLEDGE_FLAGS = [
1757
1772
  meaning: "at most this many characters read",
1758
1773
  unit: "characters"
1759
1774
  },
1775
+ {
1776
+ name: "--tab",
1777
+ value: "<id>",
1778
+ role: "target",
1779
+ type: "id",
1780
+ meaning: "one tab of a document, by its id: only its text is read"
1781
+ },
1760
1782
  {
1761
1783
  name: "--tag",
1762
1784
  value: "<name>",
@@ -1773,7 +1795,7 @@ var KNOWLEDGE_FLAGS = [
1773
1795
  }
1774
1796
  ];
1775
1797
 
1776
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
1798
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
1777
1799
  var MAIL_FLAGS = [
1778
1800
  {
1779
1801
  name: "--cc",
@@ -1803,7 +1825,7 @@ var MAIL_FLAGS = [
1803
1825
  }
1804
1826
  ];
1805
1827
 
1806
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
1828
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
1807
1829
  var PRIVACY_FLAGS = [
1808
1830
  {
1809
1831
  name: "--about-text",
@@ -1864,7 +1886,7 @@ var PRIVACY_FLAGS = [
1864
1886
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1865
1887
  ];
1866
1888
 
1867
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
1889
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
1868
1890
  var SCHEDULE_FLAGS = [
1869
1891
  {
1870
1892
  name: "--locale",
@@ -1897,7 +1919,7 @@ var SCHEDULE_FLAGS = [
1897
1919
  }
1898
1920
  ];
1899
1921
 
1900
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
1922
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
1901
1923
  var WHAT_FLAGS = [
1902
1924
  {
1903
1925
  name: "--analysis-provider",
@@ -2894,7 +2916,7 @@ var WHAT_FLAGS = [
2894
2916
  }
2895
2917
  ];
2896
2918
 
2897
- // node_modules/.pnpm/@wirecat+cli-base@0.102.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
2919
+ // node_modules/.pnpm/@wirecat+cli-base@0.122.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
2898
2920
  var FLAG_TYPES = [
2899
2921
  "switch",
2900
2922
  "count",
@@ -3024,6 +3046,10 @@ var verbs = [
3024
3046
  ["export", "write from the store to a file"],
3025
3047
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
3026
3048
  ["download", "save a file from the source to this machine"],
3049
+ ["upload", "put a file from this machine on the source"],
3050
+ ["publish", "open a thing to anyone who has its public link"],
3051
+ ["unpublish", "close a thing's public link"],
3052
+ ["stale", "mark a saved memory as out of date, keeping it"],
3027
3053
  ["transcribe", "turn speech into text"],
3028
3054
  ["extract", "read the text inside files already on this machine into the store"],
3029
3055
  ["migrate", "bring a file up to this build's schema"],
@@ -3166,7 +3192,13 @@ var collections = [
3166
3192
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3167
3193
  ["splits", "parts of one transaction, each with its own amount and category"],
3168
3194
  ["users", "people who work in the owner's account at a service, such as a CRM's employees"],
3195
+ ["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
3196
+ ["teams", "groups in a tracker that own issues, states and labels"],
3197
+ ["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
3198
+ ["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
3169
3199
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3200
+ ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3201
+ ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
3170
3202
  [
3171
3203
  "identities",
3172
3204
  "ways to reach a person or an organization: an account in one messenger or mailbox, an e-mail address, a phone"
@@ -3232,6 +3264,10 @@ var singulars = [
3232
3264
  ["privacy", "who may find, see, call or add the account"],
3233
3265
  ["metadata", "a profile's cached source attributes"],
3234
3266
  ["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
3267
+ [
3268
+ "scheduled",
3269
+ "a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
3270
+ ],
3235
3271
  [
3236
3272
  "schedule",
3237
3273
  "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"
@@ -3251,6 +3287,7 @@ var views = [
3251
3287
  ["transcript", "the text of speech: a voice message or a meeting recording"],
3252
3288
  ["evidence", "the stored messages or lines a result or a reference rests on"],
3253
3289
  ["passage", "a cited transcript line with bounded surrounding lines from the same revision"],
3290
+ ["invitation", "the text that invites people to a meeting: how to join it and when"],
3254
3291
  ["agenda", "what needs a look today"],
3255
3292
  ["busy", "when calendars or people are taken, without what takes them"],
3256
3293
  ["categories", "the categories a thing takes, with what each means"],
@@ -3314,7 +3351,7 @@ var VOCABULARY = defineVocabulary({
3314
3351
  ]
3315
3352
  });
3316
3353
 
3317
- // node_modules/.pnpm/@wirecat+cli-core@0.675.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.102.1_commander@15_4538b457841b7e7d546b8c440ab6644a/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3354
+ // node_modules/.pnpm/@wirecat+cli-core@0.714.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.122.0_commander@15_dd9fedf917a0d541ef7fdcdb0be0e64b/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3318
3355
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3319
3356
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3320
3357
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3485,7 +3522,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3485
3522
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3486
3523
  const lend = ctx.connection;
3487
3524
  let borrowed;
3488
- let answered2 = false;
3525
+ let answered = false;
3489
3526
  let result;
3490
3527
  let failure;
3491
3528
  const streams = captureStreams();
@@ -3507,7 +3544,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3507
3544
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3508
3545
  agent: {
3509
3546
  result: /* @__PURE__ */ __name((value) => {
3510
- answered2 = true;
3547
+ answered = true;
3511
3548
  result = value;
3512
3549
  }, "result"),
3513
3550
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3529,7 +3566,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3529
3566
  }));
3530
3567
  if (failure)
3531
3568
  return { error: failure };
3532
- if (answered2)
3569
+ if (answered)
3533
3570
  return { result };
3534
3571
  if (code !== 0)
3535
3572
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3541,468 +3578,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3541
3578
  }
3542
3579
  }, "runCommandForAgent");
3543
3580
 
3544
- // node_modules/.pnpm/@wirecat+cli-core@0.675.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.102.1_commander@15_4538b457841b7e7d546b8c440ab6644a/node_modules/@wirecat/cli-core/dist/mcp/tool.js
3545
- var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
3546
- var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
3547
- var message = pipe(
3548
- string(),
3549
- maxLength(256),
3550
- // biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
3551
- regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
3552
- description("message id")
3553
- );
3554
- var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
3555
- var WRITE = {
3556
- readOnlyHint: false,
3557
- destructiveHint: true,
3558
- idempotentHint: false,
3559
- openWorldHint: true
3560
- };
3561
- var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
3562
- var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
3563
- var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
3564
- if (definition.annotations.readOnlyHint === true)
3565
- return "read";
3566
- if (/^admin|_admin/.test(key2))
3567
- return "admin";
3568
- if (/delete|ban|kick|remove|purge|block/.test(key2))
3569
- return "destructive";
3570
- if (/draft/.test(key2))
3571
- return "draft";
3572
- if (key2 === "messages_pin" && messenger?.quietPins === false)
3573
- return "write-public";
3574
- if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
3575
- return "write-private";
3576
- return "write-public";
3577
- }, "tierOf");
3578
- var effectsOf = /* @__PURE__ */ __name((definition) => {
3579
- if (definition.effects)
3580
- return definition.effects;
3581
- const { readOnlyHint, openWorldHint } = definition.annotations;
3582
- if (readOnlyHint === true)
3583
- return { remote: openWorldHint === false ? "none" : "read", local: "read" };
3584
- return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
3585
- }, "effectsOf");
3586
- var outcomeOf = /* @__PURE__ */ __name((result) => {
3587
- if (!result.isError)
3588
- return { status: "ok" };
3589
- const code = result.structuredContent?.error?.code;
3590
- const error = typeof code === "string" ? code : "generic_failure";
3591
- return { status: error === "permission_error" ? "refused" : "failed", error };
3592
- }, "outcomeOf");
3593
- var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
3594
- var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
3595
- 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");
3596
- var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
3597
- const permissions = defaults.settings.permissions ?? {};
3598
- const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
3599
- return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
3600
- }, "syncAllowedFor");
3601
- var entryRunner = /* @__PURE__ */ __name((registration) => {
3602
- const run = callRunner(registration);
3603
- const { log } = registration;
3604
- return async (key2, definition, args, ctx) => {
3605
- const startedAt = Date.now();
3606
- const command = `mcp ${commandOf(key2, definition)}`;
3607
- const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
3608
- const app = registration.messenger?.app;
3609
- const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
3610
- const env = registration.defaults.env ?? process.env;
3611
- const settings = registration.defaults.settings;
3612
- const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
3613
- app,
3614
- command,
3615
- ...settings.profile === void 0 ? {} : { profile: settings.profile },
3616
- env,
3617
- record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
3618
- keepFailed: true,
3619
- trace: false,
3620
- format: "json",
3621
- context: runContextOf({ bin: app.command, command, env, caller }),
3622
- ...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
3623
- ...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
3624
- ...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
3625
- ...traceId === void 0 ? {} : { traceId }
3626
- }) : void 0;
3627
- const profile = registration.defaults.settings.profile;
3628
- const scope = {
3629
- runId: recording?.runId ?? newRunId(new Date(startedAt), command),
3630
- command,
3631
- startedAt,
3632
- ...profile === void 0 ? {} : { profile },
3633
- ...traceId === void 0 ? {} : { traceId },
3634
- ...recording ? { events: recording.events } : {}
3635
- };
3636
- const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
3637
- const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
3638
- const parsed = safeParse(input, args);
3639
- return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
3640
- arguments: toJsonSchema(input)
3641
- }), app?.errors);
3642
- }), "work");
3643
- const result = await (caller ? withCaller(caller, work) : work());
3644
- if (recording) {
3645
- if (result.isError) {
3646
- const error = result.structuredContent?.error;
3647
- const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
3648
- await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
3649
- } else
3650
- await recording.succeed(result.structuredContent).catch(() => void 0);
3651
- }
3652
- await log?.({
3653
- tool: key2,
3654
- tier: tierOf(key2, definition, registration.messenger),
3655
- ...outcomeOf(result),
3656
- startedAt,
3657
- finishedAt: Date.now()
3658
- }, caller)?.catch(() => void 0);
3659
- return result;
3660
- };
3661
- }, "entryRunner");
3662
- var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
3663
- const where = {
3664
- profile: defaults.settings.profile,
3665
- env: defaults.env,
3666
- pictures: defaults.settings.pictureSearch,
3667
- reranker: defaults.settings.searchReranker
3668
- };
3669
- return async (key2, definition, args, ctx) => {
3670
- const path = commandOf(key2, definition).split(" ");
3671
- const run = `mcp ${path.join(" ")}`;
3672
- try {
3673
- const execute = /* @__PURE__ */ __name(async () => {
3674
- const syncAllowed = syncAllowedFor(key2, defaults);
3675
- if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
3676
- throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
3677
- reason: "input.too-large",
3678
- max_bytes: MAX_BUFFERED_INPUT,
3679
- retryable: false
3680
- });
3681
- definition.check?.(args);
3682
- if (definition.changesStore)
3683
- refuseStoreChange(messenger.app, defaults.env);
3684
- refuseLacking(messenger, path);
3685
- for (const permission of readKeysForCommand(path)) {
3686
- if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
3687
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
3688
- }
3689
- if (args.sync_first && !syncAllowed)
3690
- throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
3691
- if (definition.custom) {
3692
- const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
3693
- return answered(result2, definition.outputLimit?.(args, defaults), targets);
3694
- }
3695
- if (definition.local)
3696
- return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
3697
- const { online, stored: local, served } = definition;
3698
- const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
3699
- const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
3700
- name: run
3701
- }) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
3702
- ...storeModeDeps(messenger, store, account, defaults.guard),
3703
- ...where,
3704
- embedders: defaults.embedders
3705
- }), args, defaults, (work) => session.use(run, async (adapter, release) => {
3706
- try {
3707
- return await work(adapter);
3708
- } finally {
3709
- await release();
3710
- }
3711
- })), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
3712
- try {
3713
- return await work(adapter);
3714
- } finally {
3715
- await release();
3716
- }
3717
- })())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
3718
- return answered(result, definition.outputLimit?.(args, defaults), targets);
3719
- }, "execute");
3720
- return around ? await around(key2, definition, execute) : await execute();
3721
- } catch (error) {
3722
- return failed(error, messenger?.app?.errors, effectsOf(definition));
3723
- }
3724
- };
3725
- }, "callRunner");
3726
- var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
3727
- if (!definition.output)
3728
- return looseObject({});
3729
- const entity = ENTITIES[definition.output.entity];
3730
- return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
3731
- }, "outputSchemaOf");
3732
- var Picture = class {
3733
- static {
3734
- __name(this, "Picture");
3735
- }
3736
- bytes;
3737
- mimeType;
3738
- about;
3739
- constructor(bytes, mimeType, about) {
3740
- this.bytes = bytes;
3741
- this.mimeType = mimeType;
3742
- this.about = about;
3743
- }
3744
- };
3745
- var BinaryResource = class {
3746
- static {
3747
- __name(this, "BinaryResource");
3748
- }
3749
- base64;
3750
- mimeType;
3751
- uri;
3752
- about;
3753
- constructor(base64, mimeType, uri, about) {
3754
- this.base64 = base64;
3755
- this.mimeType = mimeType;
3756
- this.uri = uri;
3757
- this.about = about;
3758
- }
3759
- };
3760
- var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
3761
- const bounded = /* @__PURE__ */ __name((result) => {
3762
- if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
3763
- 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 });
3764
- return result;
3765
- }, "bounded");
3766
- if (answer === null || Array.isArray(answer) || typeof answer !== "object")
3767
- throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
3768
- const objectBody = /* @__PURE__ */ __name((value) => {
3769
- const serialized = JSON.parse(agentJson(value));
3770
- if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
3771
- throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
3772
- return serialized;
3773
- }, "objectBody");
3774
- if (answer instanceof BinaryResource) {
3775
- const about = sealed(answer.about);
3776
- return bounded({
3777
- structuredContent: objectBody(about),
3778
- content: [
3779
- { type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
3780
- { type: "text", text: agentJson(about) }
3781
- ]
3782
- });
3783
- }
3784
- if (answer instanceof Picture) {
3785
- const about = sealed(answer.about);
3786
- return bounded({
3787
- structuredContent: objectBody(about),
3788
- content: [
3789
- { type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
3790
- { type: "text", text: agentJson(about) }
3791
- ]
3792
- });
3793
- }
3794
- const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
3795
- return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
3796
- }, "answered");
3797
- var failed = /* @__PURE__ */ __name((error, errors, effects) => {
3798
- const judged = judgedEffects(effects);
3799
- const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
3800
- return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
3801
- }, "failed");
3802
-
3803
- // node_modules/.pnpm/@wirecat+cli-core@0.675.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.102.1_commander@15_4538b457841b7e7d546b8c440ab6644a/node_modules/@wirecat/cli-core/dist/mcp/surface.js
3804
- import { randomUUID } from "node:crypto";
3805
- var MATCHES = 8;
3806
- var ANSWER = answerSchema();
3807
- var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
3808
- const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
3809
- const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
3810
- return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
3811
- items: optional(array(unknown())),
3812
- item: optional(unknown()),
3813
- page: optional(looseObject({ has_more: boolean() })),
3814
- next,
3815
- missing: optional(array(looseObject({ field: string(), why: string() }))),
3816
- meta
3817
- });
3818
- }, "agentAnswer");
3819
- var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
3820
- const checked = toStandardJsonSchema(ANSWER);
3821
- const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
3822
- return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
3823
- }, "listedAs");
3824
- var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
3825
- 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(" "));
3826
- var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
3827
- var stem = /* @__PURE__ */ __name((word2) => {
3828
- const bare = word2.replace(/'s$/u, "");
3829
- if (bare.length > 4 && bare.endsWith("ies"))
3830
- return `${bare.slice(0, -3)}y`;
3831
- for (const ending of ["ing", "ed", "es", "s"])
3832
- if (bare.length - ending.length >= 3 && bare.endsWith(ending))
3833
- return bare.slice(0, -ending.length);
3834
- return bare;
3835
- }, "stem");
3836
- var sameWord = /* @__PURE__ */ __name((asked, known) => {
3837
- if (asked === known)
3838
- return true;
3839
- const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
3840
- return short.length >= 3 && long.startsWith(short);
3841
- }, "sameWord");
3842
- var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
3843
- [4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
3844
- [2, wordsOf(one.title)],
3845
- [1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
3846
- ].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
3847
- var search = /* @__PURE__ */ __name((commands, query) => {
3848
- const named = normal(query);
3849
- const all = Object.entries(commands);
3850
- if (!named)
3851
- return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
3852
- const words = [
3853
- ...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
3854
- ];
3855
- return all.map((entry) => {
3856
- const fields = fieldsOf2(entry[0], entry[1]);
3857
- const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
3858
- const matched = weights.filter((weight) => weight > 0).length;
3859
- const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
3860
- return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
3861
- }).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
3862
- }, "search");
3863
- var nearest = /* @__PURE__ */ __name((commands, asked) => {
3864
- const words = normal(asked).split(" ");
3865
- 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);
3866
- }, "nearest");
3867
- var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
3868
- const body = result.structuredContent;
3869
- if (result.isError || !Array.isArray(body?.next))
3870
- return result;
3871
- const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
3872
- const { next: _, ...rest } = body;
3873
- const kept = next.length > 0 ? { ...rest, next } : rest;
3874
- return {
3875
- ...result,
3876
- structuredContent: kept,
3877
- content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
3878
- };
3879
- }, "runnableOnly");
3880
- var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
3881
- var sampleOf = /* @__PURE__ */ __name((commands) => {
3882
- const reading = Object.entries(commands).filter(([, one]) => !one.writes);
3883
- const bare = reading.filter(([, one]) => takesNothing(one));
3884
- return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
3885
- }, "sampleOf");
3886
- var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
3887
- const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
3888
- const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
3889
- const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
3890
- const sample = messenger ? "messages list" : sampleOf(commands);
3891
- const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
3892
- server.registerTool(`${prefix}_tools_search`, {
3893
- outputSchema: toStandardJsonSchema(looseObject({})),
3894
- title: "Find a command",
3895
- 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.`,
3896
- inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
3897
- annotations: { ...READ, openWorldHint: false, idempotentHint: true }
3898
- }, async ({ query }) => {
3899
- const found = search(commands, query ?? "");
3900
- const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
3901
- command,
3902
- title: one.title,
3903
- description: one.description,
3904
- writes: one.writes,
3905
- availability: one.availability?.() ?? { available: true },
3906
- arguments: toJsonSchema(one.input),
3907
- output: toJsonSchema(one.output ?? ANSWER)
3908
- })) : found.map(([command, one]) => ({
3909
- command,
3910
- title: one.title,
3911
- writes: one.writes,
3912
- availability: one.availability?.() ?? { available: true }
3913
- }));
3914
- const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
3915
- items,
3916
- limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
3917
- has_more: found.length > items.length
3918
- });
3919
- return answered(list);
3920
- });
3921
- const callers = {
3922
- env: process.env,
3923
- client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
3924
- connectionId: randomUUID()
3925
- };
3926
- const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
3927
- try {
3928
- const command = byNormal.get(normal(asked));
3929
- const one = command === void 0 ? void 0 : commands[command];
3930
- if (command === void 0 || !one) {
3931
- withheld?.(normal(asked));
3932
- const near = nearest(commands, asked);
3933
- 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`);
3934
- }
3935
- if (one.writes !== writing)
3936
- throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
3937
- const args = writing ? agentArguments(given ?? {}) : given ?? {};
3938
- const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
3939
- if (one.checked)
3940
- return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
3941
- const parsed = safeParse(strictObject(one.input.entries), args);
3942
- if (!parsed.success)
3943
- throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
3944
- arguments: toJsonSchema(one.input)
3945
- });
3946
- return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
3947
- } catch (error) {
3948
- return failed(error, errors);
3949
- }
3950
- }, "runner");
3951
- const call = strictObject({
3952
- command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
3953
- arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
3954
- });
3955
- server.registerTool(`${prefix}_read`, {
3956
- outputSchema: listedAs(prefix, false),
3957
- title: "Run a reading command",
3958
- description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
3959
- inputSchema: toStandardJsonSchema(call),
3960
- annotations: READ
3961
- }, runner(false));
3962
- if (Object.values(commands).some((one) => one.writes))
3963
- server.registerTool(`${prefix}_write`, {
3964
- outputSchema: listedAs(prefix, true),
3965
- title: "Run a writing command",
3966
- 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}`,
3967
- inputSchema: toStandardJsonSchema(call),
3968
- annotations: WRITE
3969
- }, runner(true));
3970
- }, "registerCommands");
3971
- var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
3972
- const run = entryRunner(registration);
3973
- return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
3974
- commandOf(key2, definition),
3975
- {
3976
- title: definition.title,
3977
- description: definition.description,
3978
- writes: definition.annotations.readOnlyHint !== true,
3979
- input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
3980
- ...definition.output ? { output: outputSchemaOf(definition) } : {},
3981
- checked: true,
3982
- run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
3983
- }
3984
- ]));
3985
- }, "surfaceCommands");
3986
- var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
3987
-
3988
3581
  export {
3989
3582
  toolsFromCommands,
3990
- runCommandForAgent,
3991
- message,
3992
- READ,
3993
- WRITE,
3994
- tool,
3995
- chatOf,
3996
- tierOf,
3997
- outcomeOf,
3998
- commandOf,
3999
- toolKey,
4000
- Picture,
4001
- BinaryResource,
4002
- answered,
4003
- failed,
4004
- normal,
4005
- registerCommands,
4006
- surfaceCommands,
4007
- outputOf
3583
+ runCommandForAgent
4008
3584
  };