@wirecat/amo-cli 0.2.0 → 0.4.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 (183) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +19 -14
  3. package/contracts/wirecat.json +58 -19
  4. package/dist/amo/button.d.ts +53 -0
  5. package/dist/amo/button.d.ts.map +1 -0
  6. package/dist/amo/button.js +234 -0
  7. package/dist/amo/button.js.map +1 -0
  8. package/dist/amo/oauth.d.ts +12 -3
  9. package/dist/amo/oauth.d.ts.map +1 -1
  10. package/dist/amo/oauth.js +19 -6
  11. package/dist/amo/oauth.js.map +1 -1
  12. package/dist/bin/amo.js +2 -2
  13. package/dist/bundle/agent-43BMVBX2.js +40 -0
  14. package/dist/bundle/{all-profiles-3KQVWDV4.js → all-profiles-PRNXEZRH.js} +63 -21
  15. package/dist/bundle/amo.js +28 -26
  16. package/dist/bundle/{anthropic-N5NOX7K7.js → anthropic-FDI24DU2.js} +5 -5
  17. package/dist/bundle/{app-server-2MST5EZ5.js → app-server-WAKJVDLN.js} +79 -68
  18. package/dist/bundle/{bun-4NHWOFX2.js → bun-YPXUXMBI.js} +2 -2
  19. package/dist/bundle/{bun-sqlite-DRSXPWPR.js → bun-sqlite-UBQ5M47X.js} +6 -6
  20. package/dist/bundle/chunk-23AQD7JU.js +559 -0
  21. package/dist/bundle/{chunk-2I5UVMLW.js → chunk-2AIG2SSJ.js} +1733 -1160
  22. package/dist/bundle/{chunk-DQV2IKCF.js → chunk-2UJ7ZZZC.js} +10 -3
  23. package/dist/bundle/{chunk-ODNQU7DH.js → chunk-3K6T2G52.js} +43 -64
  24. package/dist/bundle/chunk-3PCVQCCV.js +108 -0
  25. package/dist/bundle/{chunk-UMVRT7VQ.js → chunk-3WG4MTQI.js} +1 -1
  26. package/dist/bundle/chunk-4PQECIU2.js +30 -0
  27. package/dist/bundle/{chunk-T2UDLX76.js → chunk-5HZMXHRH.js} +6 -6
  28. package/dist/bundle/{chunk-P3WQRTYZ.js → chunk-5II6TAJE.js} +1 -1
  29. package/dist/bundle/{chunk-RPWAJYI6.js → chunk-5SJEJYQZ.js} +3 -3
  30. package/dist/bundle/{chunk-5QFHNBGB.js → chunk-6PILR4AX.js} +2 -2
  31. package/dist/bundle/{chunk-TNUFLULO.js → chunk-6QMSKJB4.js} +8 -8
  32. package/dist/bundle/{chunk-5RLUHTK6.js → chunk-745FMNI5.js} +1 -1
  33. package/dist/bundle/{chunk-AUBB72VF.js → chunk-7OVTUADG.js} +41 -10
  34. package/dist/bundle/{chunk-7U5HJEPZ.js → chunk-A4W7J6VN.js} +34 -22
  35. package/dist/bundle/chunk-ABMPZL2P.js +734 -0
  36. package/dist/bundle/{chunk-EROSAUNP.js → chunk-AN6IJYH3.js} +5 -5
  37. package/dist/bundle/{chunk-SZ2V62HB.js → chunk-AP3CWDRK.js} +2 -2
  38. package/dist/bundle/{chunk-ESZSMZKT.js → chunk-ASU63X5C.js} +2 -2
  39. package/dist/bundle/{chunk-EPOV5UIO.js → chunk-BCIZAUDV.js} +11 -11
  40. package/dist/bundle/{chunk-7PKFYX7V.js → chunk-CEBX63XY.js} +8 -8
  41. package/dist/bundle/{chunk-7GTUZY7M.js → chunk-CYHIM5SL.js} +3 -3
  42. package/dist/bundle/chunk-DWA5TZMP.js +209 -0
  43. package/dist/bundle/{chunk-LDEBZ3IX.js → chunk-DWD3KDJA.js} +1 -1
  44. package/dist/bundle/{chunk-GQ7VFIYM.js → chunk-E3EWS6DF.js} +23 -7
  45. package/dist/bundle/{chunk-NJYAL3UW.js → chunk-EAX5RO7S.js} +1 -1
  46. package/dist/bundle/{chunk-LJQUYECN.js → chunk-EBNCUQLV.js} +1 -1
  47. package/dist/bundle/{chunk-UBRREVLJ.js → chunk-ELAKOEIO.js} +2 -2
  48. package/dist/bundle/{chunk-DAY6TSPF.js → chunk-FEUNZG7U.js} +62 -50
  49. package/dist/bundle/{chunk-63F65DHU.js → chunk-FQRP6JWX.js} +2 -2
  50. package/dist/bundle/{chunk-SMSTGO2G.js → chunk-G3LAYJJJ.js} +4 -4
  51. package/dist/bundle/{chunk-LGQXGOPJ.js → chunk-GBQ76X6T.js} +2 -2
  52. package/dist/bundle/{chunk-CHUKWON6.js → chunk-GJBOZAUD.js} +3 -3
  53. package/dist/bundle/{chunk-A33TIM5D.js → chunk-GMHRPX5M.js} +225 -225
  54. package/dist/bundle/{chunk-O2UCU52O.js → chunk-GQKEMBM6.js} +171 -569
  55. package/dist/bundle/{chunk-EQUKVVHX.js → chunk-HDZNSOV5.js} +7 -7
  56. package/dist/bundle/{chunk-ZM7I52EP.js → chunk-HZZ56JO7.js} +3 -4
  57. package/dist/bundle/{chunk-XQL7FEF4.js → chunk-IBEHYGG6.js} +9 -9
  58. package/dist/bundle/{chunk-U7RLVJ34.js → chunk-IPNIF5JE.js} +4 -4
  59. package/dist/bundle/{chunk-QDMXZZG4.js → chunk-KBAOJISR.js} +18 -8
  60. package/dist/bundle/{chunk-ADEWU4P4.js → chunk-KORZEYZN.js} +1 -1
  61. package/dist/bundle/{chunk-JMDLPBXK.js → chunk-KQZTX4LM.js} +17 -17
  62. package/dist/bundle/{chunk-NHXJYS4R.js → chunk-KRD375P7.js} +32 -28
  63. package/dist/bundle/{chunk-ULXQ5MJM.js → chunk-LAR2DLTI.js} +4 -4
  64. package/dist/bundle/{chunk-NC76INB2.js → chunk-LZ4IWN43.js} +3088 -2266
  65. package/dist/bundle/{chunk-BVMNXI53.js → chunk-M33XHJTM.js} +25 -25
  66. package/dist/bundle/{chunk-WCYCUTSK.js → chunk-M54YKD3I.js} +7 -7
  67. package/dist/bundle/{chunk-LSND5QYI.js → chunk-MW7HUD6R.js} +9 -9
  68. package/dist/bundle/{chunk-AHJ4W2IL.js → chunk-NFWD4QX3.js} +2 -2
  69. package/dist/bundle/{chunk-PM77PRB6.js → chunk-NKYWQTS2.js} +189 -163
  70. package/dist/bundle/{chunk-LRBPT7LQ.js → chunk-NXNUCGGO.js} +6 -6
  71. package/dist/bundle/{chunk-5D4Z2B5B.js → chunk-O3WE5IGP.js} +9 -9
  72. package/dist/bundle/chunk-OYMHPQF7.js +52 -0
  73. package/dist/bundle/{chunk-VVHRQ46X.js → chunk-PIOR6PIO.js} +2 -2
  74. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  75. package/dist/bundle/{chunk-XEFAMLSD.js → chunk-PL7TNKAY.js} +3 -3
  76. package/dist/bundle/chunk-PLU2IQXC.js +80 -0
  77. package/dist/bundle/{chunk-73CXFE36.js → chunk-QGFURWEP.js} +29 -1
  78. package/dist/bundle/{chunk-CDY2NJFE.js → chunk-RQPB2BSH.js} +2 -2
  79. package/dist/bundle/{chunk-QRQYUHCZ.js → chunk-S6DTLAOB.js} +12 -12
  80. package/dist/bundle/{chunk-DJD7TBYG.js → chunk-SCMB4LI6.js} +76 -74
  81. package/dist/bundle/{chunk-TGEQNS6G.js → chunk-SFZVMKB6.js} +1 -1
  82. package/dist/bundle/{chunk-PFO76YFP.js → chunk-SHOSFYI7.js} +18 -18
  83. package/dist/bundle/{chunk-5SBLU7D7.js → chunk-SMM7GS4Q.js} +1 -1
  84. package/dist/bundle/{chunk-EQ7A6NA6.js → chunk-SNBYFQHT.js} +1 -1
  85. package/dist/bundle/{chunk-GNTJMB6X.js → chunk-SZX7EPPY.js} +4 -4
  86. package/dist/bundle/{chunk-VX37MPTJ.js → chunk-TCSVW7BA.js} +1 -1
  87. package/dist/bundle/{chunk-P5LYZRKW.js → chunk-TEGQVVCZ.js} +1992 -885
  88. package/dist/bundle/{chunk-Q2VNBY4Y.js → chunk-TIR3AB35.js} +758 -1205
  89. package/dist/bundle/{chunk-5HGGG3QO.js → chunk-U46RNOEQ.js} +16 -3
  90. package/dist/bundle/{chunk-Y37A3232.js → chunk-UCM7C773.js} +130 -8
  91. package/dist/bundle/{chunk-L6AFE73L.js → chunk-UEN5NWNW.js} +1 -1
  92. package/dist/bundle/{chunk-6RS7OYTD.js → chunk-V2QWX6B3.js} +3 -3
  93. package/dist/bundle/{chunk-3IRJDH2U.js → chunk-V5SETIQK.js} +2 -100
  94. package/dist/bundle/{chunk-JR6TSMFX.js → chunk-VEFAYLKX.js} +103 -70
  95. package/dist/bundle/{chunk-CUZRHF34.js → chunk-VG26HDKH.js} +4 -4
  96. package/dist/bundle/{chunk-4ZAK773N.js → chunk-VG2ERHFJ.js} +3 -3
  97. package/dist/bundle/{chunk-CHH42KI4.js → chunk-WAFB3IWJ.js} +8 -8
  98. package/dist/bundle/{chunk-5Z5PEEKP.js → chunk-WASBOYI2.js} +4 -4
  99. package/dist/bundle/{chunk-DXGGCGRP.js → chunk-WEWJA42Q.js} +14 -14
  100. package/dist/bundle/chunk-WR2FPZTE.js +353 -0
  101. package/dist/bundle/chunk-XEYT2EQT.js +338 -0
  102. package/dist/bundle/{chunk-DOSJONCX.js → chunk-YFRTEJ6V.js} +7 -7
  103. package/dist/bundle/{chunk-XRTD2GCU.js → chunk-YHVHDRED.js} +19 -258
  104. package/dist/bundle/{chunk-JH3UOHRE.js → chunk-YREKMP24.js} +4 -4
  105. package/dist/bundle/{chunk-V77XNPXG.js → chunk-Z2B3VNRI.js} +11 -11
  106. package/dist/bundle/{chunk-FKR3M62D.js → chunk-ZJC2XJQC.js} +13 -13
  107. package/dist/bundle/{chunk-5E5R65CA.js → chunk-ZKRWNL4T.js} +2 -2
  108. package/dist/bundle/{cli-QVWTXADI.js → cli-QDPKC2HJ.js} +150 -103
  109. package/dist/bundle/command-contract-KWNCP3MQ.js +39 -0
  110. package/dist/bundle/{command-server-entry-5VL5U5EE.js → command-server-entry-TX7WNN7G.js} +28 -28
  111. package/dist/bundle/{decode-SQ5WGNDX.js → decode-BLPC7OYE.js} +5 -5
  112. package/dist/bundle/{dispatch-LA4DFXJD.js → dispatch-5JUT55CS.js} +8 -8
  113. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  114. package/dist/bundle/{echarts-25Z3RINX.js → echarts-54D3FOCL.js} +2 -2
  115. package/dist/bundle/{embed-BNOTNXMA.js → embed-O7KMDYM7.js} +6 -6
  116. package/dist/bundle/{embedder-BCUT7KKV.js → embedder-4PE67CLX.js} +9 -9
  117. package/dist/bundle/{failure-PKAC6XCT.js → failure-NNQYTB3Z.js} +2 -2
  118. package/dist/bundle/{first-run-EO5K5GME.js → first-run-EAU5SHBI.js} +12 -12
  119. package/dist/bundle/first-screen-APSNGZYZ.js +39 -0
  120. package/dist/bundle/{instructions-VLM3QAYB.js → instructions-ONXP5DZQ.js} +1 -1
  121. package/dist/bundle/{mcp-7ILNMJH5.js → mcp-ZNULRPZ4.js} +2 -2
  122. package/dist/bundle/meeting-combined-W2XIYXFU.js +24 -0
  123. package/dist/bundle/{meeting-model-GHMMUQ34.js → meeting-model-FWIZRKVN.js} +11 -11
  124. package/dist/bundle/{meeting-semantic-BMP6323L.js → meeting-semantic-M4YVJ57W.js} +6 -6
  125. package/dist/bundle/{node-CT3N3TNL.js → node-UTQCYQF5.js} +2 -2
  126. package/dist/bundle/{node-sqlite-MELD2SBX.js → node-sqlite-APJG6MGL.js} +7 -7
  127. package/dist/bundle/{oauth-YBH5OKC2.js → oauth-TY7RMIBL.js} +8 -8
  128. package/dist/bundle/{open-WNSBWTAG.js → open-WDVEQL75.js} +5 -5
  129. package/dist/bundle/{openai-XSNMNLW6.js → openai-H5UJHSEZ.js} +15 -15
  130. package/dist/bundle/{process-I2QKOMM7.js → process-MGMXXPMY.js} +1 -1
  131. package/dist/bundle/{program-G6O3IJR2.js → program-IF36C6VR.js} +969 -1127
  132. package/dist/bundle/{prompt-SOG4AKPM.js → prompt-4RLIWLMF.js} +5 -5
  133. package/dist/bundle/{recognize-WMQLWMXH.js → recognize-UIRTMWM4.js} +4 -4
  134. package/dist/bundle/{remote-4BTFOLFY.js → remote-L3MNWZQK.js} +9 -9
  135. package/dist/bundle/{rerank-LJ3TWRNV.js → rerank-F4KZQTY6.js} +7 -7
  136. package/dist/bundle/{serve-B6UANKXN.js → serve-37AUYTWS.js} +10 -10
  137. package/dist/bundle/server-CRF4QSZR.js +86 -0
  138. package/dist/bundle/{server-YRH6GJ5Z.js → server-UBG676ZJ.js} +73 -61
  139. package/dist/bundle/source-Z7GH7T4B.js +44 -0
  140. package/dist/bundle/{sqlite-runtime-R7QFWFE7.js → sqlite-runtime-CI3RW7VA.js} +6 -6
  141. package/dist/bundle/{state-DIJ5YUOE.js → state-JOHLSLUO.js} +6 -6
  142. package/dist/bundle/{store-MYTYDV6A.js → store-2MBG4IUS.js} +28 -21
  143. package/dist/bundle/{store-6WFWW7EC.js → store-OSOUXBYL.js} +28 -23
  144. package/dist/bundle/store-SNW6U32Y.js +34 -0
  145. package/dist/bundle/store-maintenance-command-W7V54SLT.js +73 -0
  146. package/dist/bundle/surface-ESJS2FUI.js +72 -0
  147. package/dist/bundle/writer-BJDQMKUV.js +46 -0
  148. package/dist/commands/account.d.ts +3 -2
  149. package/dist/commands/account.d.ts.map +1 -1
  150. package/dist/commands/account.js +38 -77
  151. package/dist/commands/account.js.map +1 -1
  152. package/dist/commands/crm-shared.d.ts.map +1 -1
  153. package/dist/commands/crm-shared.js +2 -0
  154. package/dist/commands/crm-shared.js.map +1 -1
  155. package/dist/commands/session.d.ts +23 -6
  156. package/dist/commands/session.d.ts.map +1 -1
  157. package/dist/commands/session.js +122 -77
  158. package/dist/commands/session.js.map +1 -1
  159. package/dist/identity.js +1 -1
  160. package/dist/identity.js.map +1 -1
  161. package/dist/program.d.ts.map +1 -1
  162. package/dist/program.js +0 -2
  163. package/dist/program.js.map +1 -1
  164. package/dist/reasons.js +2 -2
  165. package/dist/reasons.js.map +1 -1
  166. package/dist/setup/flow.d.ts.map +1 -1
  167. package/dist/setup/flow.js +74 -4
  168. package/dist/setup/flow.js.map +1 -1
  169. package/dist/setup/texts.en.json +22 -1
  170. package/dist/setup/texts.es.json +22 -1
  171. package/dist/setup/texts.ru.json +22 -1
  172. package/dist/version.d.ts +1 -1
  173. package/dist/version.js +1 -1
  174. package/package.json +3 -3
  175. package/skills/amo-cli/references/setup.md +8 -2
  176. package/dist/bundle/command-contract-QBUQBXH7.js +0 -39
  177. package/dist/bundle/first-screen-GMN3T6RW.js +0 -39
  178. package/dist/bundle/meeting-combined-LAMF7S2B.js +0 -24
  179. package/dist/bundle/server-S6XD6V6E.js +0 -77
  180. package/dist/bundle/source-DGFTA2TN.js +0 -42
  181. package/dist/bundle/store-CHWY2USQ.js +0 -32
  182. package/dist/bundle/store-maintenance-command-B5TMKFMG.js +0 -68
  183. package/dist/bundle/writer-GP7VIMAU.js +0 -44
@@ -1,76 +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-XRTD2GCU.js";
5
+ } from "./chunk-OYMHPQF7.js";
10
6
  import {
11
- callerOf
12
- } from "./chunk-3IRJDH2U.js";
13
- import {
14
- lentConnection,
15
- onlineDeps,
16
- refuseLacking,
17
- servicesFor,
18
- storeModeDeps
19
- } from "./chunk-Q2VNBY4Y.js";
7
+ lentConnection
8
+ } from "./chunk-XEYT2EQT.js";
20
9
  import {
21
10
  QUERY_ARGUMENT
22
- } from "./chunk-2I5UVMLW.js";
11
+ } from "./chunk-ABMPZL2P.js";
23
12
  import {
24
- DEFAULT_OUTPUT_BYTES,
25
- ENTITIES,
26
- LOCAL_WRITE,
27
- REMOTE_WRITE,
28
- answerSchema,
29
13
  changesMessenger,
30
- flatten,
31
- judgedAnswer,
32
- judgedEffects,
33
- listOf,
34
- refuseStoreChange,
35
- sealed,
36
- startRecording
37
- } from "./chunk-PM77PRB6.js";
14
+ flatten
15
+ } from "./chunk-NKYWQTS2.js";
38
16
  import {
39
- currentCaller,
40
- keepsSuccess,
41
- runContextOf,
42
- withCaller
43
- } from "./chunk-WCYCUTSK.js";
17
+ currentCaller
18
+ } from "./chunk-M54YKD3I.js";
44
19
  import {
45
20
  enclosingTraceId,
46
21
  inRun,
47
22
  newRunId,
48
23
  traceOf
49
- } from "./chunk-BVMNXI53.js";
50
- import {
51
- storeDamaged
52
- } from "./chunk-UBRREVLJ.js";
53
- import {
54
- failureContext
55
- } from "./chunk-Y37A3232.js";
24
+ } from "./chunk-M33XHJTM.js";
56
25
  import {
57
26
  authorityAllowed,
58
- botApiAllowed,
59
- fetchesAt,
60
- keyForCommand,
61
- levelFor,
62
- readKeysForCommand
63
- } from "./chunk-QDMXZZG4.js";
27
+ botApiAllowed
28
+ } from "./chunk-KBAOJISR.js";
64
29
  import {
65
30
  queryDescription
66
- } from "./chunk-A33TIM5D.js";
31
+ } from "./chunk-GMHRPX5M.js";
67
32
  import {
68
- MAX_BUFFERED_INPUT
69
- } from "./chunk-ESZSMZKT.js";
70
- import {
71
- captureStreams,
72
- traceIdOf
73
- } from "./chunk-DJD7TBYG.js";
33
+ captureStreams
34
+ } from "./chunk-SCMB4LI6.js";
74
35
  import {
75
36
  COMPACT_FLAG,
76
37
  SNAKE_CASE,
@@ -81,13 +42,7 @@ import {
81
42
  errorObjectOf,
82
43
  integer,
83
44
  isoDate,
84
- itemEnvelopeSchema,
85
- listEnvelopeSchema,
86
45
  literal,
87
- looseObject,
88
- maxLength,
89
- maxValue,
90
- mcpErrorResult,
91
46
  minLength,
92
47
  minValue,
93
48
  number,
@@ -98,30 +53,25 @@ import {
98
53
  pipe,
99
54
  record,
100
55
  regex,
101
- safeParse,
102
56
  strictObject,
103
57
  string,
104
- summarize,
105
58
  text,
106
- toJsonSchema,
107
- toStandardJsonSchema,
108
59
  union,
109
60
  unknown,
110
61
  word,
111
62
  writes
112
- } from "./chunk-AUBB72VF.js";
63
+ } from "./chunk-7OVTUADG.js";
113
64
  import {
114
- CliError,
115
- errorCodes
116
- } from "./chunk-SZ2V62HB.js";
65
+ CliError
66
+ } from "./chunk-AP3CWDRK.js";
117
67
  import {
118
68
  __name
119
69
  } from "./chunk-ZVVMGPBJ.js";
120
70
 
121
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/agent.js
71
+ // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/mcp/agent.js
122
72
  import { Readable } from "node:stream";
123
73
 
124
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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.127.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
125
75
  var LINT_SEVERITIES = ["high", "medium", "low"];
126
76
  var lintRuleSchema = strictObject({
127
77
  id: word,
@@ -267,7 +217,7 @@ var overrideSchema = strictObject({
267
217
  });
268
218
  var overridesSchema = array(overrideSchema);
269
219
 
270
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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.127.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
271
221
  var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
272
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");
273
223
  var AUDIT_RULES = defineAuditRules([
@@ -378,7 +328,13 @@ var FAMILY_SINCE_0_98 = [
378
328
  review(ENTITY, "entity lead", "b24's CRM lead and memo's differ (measured 2026-11-13)"),
379
329
  review(ENTITY, "entity product", "b24's CRM product and memo's differ (measured 2026-11-13)"),
380
330
  review(REASON, "reason ai.address-refused=model.address-refused", "one failure under two names; cli-core 0.650.0 keeps one"),
381
- review(REASON, "reason profile.unknown: code", "b24 gives it not_found, drive validation_error (measured 2026-11-13)")
331
+ review(REASON, "reason profile.unknown: code", "b24 gives it not_found, drive validation_error (measured 2026-11-13)"),
332
+ {
333
+ rule: REASON,
334
+ target: "reason account-remove.unknown-profile=account-rename.unknown-profile",
335
+ reason: "one failure under two names in cli-core 0.715\u20130.716; 0.717.0 gives account rename profile.unknown",
336
+ review_after: "2026-12-10"
337
+ }
382
338
  ];
383
339
  var PARITY_GROUPS = defineParityGroups([
384
340
  { name: "messengers", members: ["tg", "max"], covers: "tree", differences: MESSENGERS_SINCE_0_98 },
@@ -407,28 +363,60 @@ var PARITY_GROUPS = defineParityGroups([
407
363
  },
408
364
  // bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
409
365
  // recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
410
- // amo-cli shares them too, and its CRM commands are compared with b24 in `crm` below.
411
- // notion-cli joins here until its documents commands ship; then it moves next to drive.
366
+ // amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
367
+ // wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
368
+ // linear-cli shares only these roots too: it is the first tracker CLI, so its issues commands have no group yet.
369
+ // notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
370
+ // its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
371
+ // and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
412
372
  {
413
373
  name: "shared-roots",
414
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion", "amo"],
374
+ members: [
375
+ "tg",
376
+ "max",
377
+ "memo",
378
+ "drive",
379
+ "zm",
380
+ "wa",
381
+ "b24",
382
+ "beeline",
383
+ "pbx",
384
+ "notion",
385
+ "amo",
386
+ "hubspot",
387
+ "attio",
388
+ "ydisk",
389
+ "wordpress",
390
+ "linear"
391
+ ],
415
392
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
416
393
  differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
417
394
  },
418
- // The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet, so `audit --family`
419
- // skips it, as beeline. Only b24 has `leads` (amoCRM has no lead apart from a deal), `products` (amo leaves them for
420
- // later) and `deals delete` (amoCRM's API v4 cannot delete a lead,
421
- // https://www.amocrm.ru/developers/content/crm_platform/leads-api); a list of roots does not compare presence, so
422
- // these need no difference. `people`, `organizations`, `users`, `api` and `session` join once b24's released tree
423
- // is on cli-core's shared people and organizations commands: measured against b24 0.23.0 on 2026-11-16 they differ
424
- // in options, outputs and summaries.
395
+ // The CRM CLIs on cli-core's shared CRM commands. hubspot-cli is not in the family packages, so `audit --family`
396
+ // skips it, as beeline. Only b24 and hubspot have `leads` (amoCRM
397
+ // has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
398
+ // API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
399
+ // no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
400
+ // `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
401
+ // commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
425
402
  {
426
403
  name: "crm",
427
- members: ["b24", "amo"],
404
+ members: ["b24", "amo", "hubspot", "attio"],
428
405
  covers: ["deals", "sync", "search", "store", "schedule", "account"],
429
- differences: []
406
+ differences: [
407
+ {
408
+ rule: "same-path-contract",
409
+ target: "schedule: summary",
410
+ differs: "hubspot",
411
+ 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",
412
+ review_after: "2026-12-01"
413
+ }
414
+ ]
430
415
  }
431
416
  ]);
417
+ var SHARED_DIFFERENCES = [
418
+ ...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()
419
+ ];
432
420
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
433
421
  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");
434
422
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -440,7 +428,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
440
428
  { path: ["upgrade"], meaning: "updates the CLI" }
441
429
  ]);
442
430
 
443
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
431
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
444
432
  var fieldRuleSchema = strictObject({ id: word, rule: text });
445
433
  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");
446
434
  var FIELD_RULES = defineFieldRules([
@@ -456,7 +444,7 @@ var FIELD_RULES = defineFieldRules([
456
444
  }
457
445
  ]);
458
446
 
459
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
447
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
460
448
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
461
449
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
462
450
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -478,7 +466,7 @@ var IDENTIFIERS = defineIdentifiers([
478
466
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
479
467
  ]);
480
468
 
481
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
469
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
482
470
  var ACCOUNT_FLAGS = [
483
471
  {
484
472
  name: "--client-id",
@@ -515,7 +503,7 @@ var ACCOUNT_FLAGS = [
515
503
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
516
504
  ];
517
505
 
518
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
506
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
519
507
  var CALENDAR_FLAGS = [
520
508
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
521
509
  {
@@ -603,7 +591,25 @@ var CALENDAR_FLAGS = [
603
591
  }
604
592
  ];
605
593
 
606
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
594
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
595
+ var CONTENT_FLAGS = [
596
+ { name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
597
+ {
598
+ name: "--tags",
599
+ value: "<ids>",
600
+ role: "value",
601
+ type: "list",
602
+ meaning: "its tags and categories, by comma-separated ids; replaces the ones it has"
603
+ },
604
+ {
605
+ name: "--replace-body",
606
+ role: "mode",
607
+ type: "switch",
608
+ meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show"
609
+ }
610
+ ];
611
+
612
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
607
613
  var CRM_FLAGS = [
608
614
  {
609
615
  name: "--email",
@@ -767,7 +773,7 @@ var CRM_FLAGS = [
767
773
  }
768
774
  ];
769
775
 
770
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
776
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
771
777
  var HOW_FLAGS = [
772
778
  {
773
779
  name: "--limit",
@@ -1147,13 +1153,7 @@ var HOW_FLAGS = [
1147
1153
  type: "string",
1148
1154
  meaning: "a person whose reply counts as an answer; repeat it for more"
1149
1155
  },
1150
- {
1151
- name: "--browser",
1152
- value: "<program>",
1153
- role: "mode",
1154
- type: "string",
1155
- meaning: "the browser program to open for sign-in"
1156
- },
1156
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1157
1157
  {
1158
1158
  name: "--credential-storage",
1159
1159
  value: "<storage>",
@@ -1162,6 +1162,8 @@ var HOW_FLAGS = [
1162
1162
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1163
1163
  },
1164
1164
  { name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
1165
+ { name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
1166
+ { name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
1165
1167
  {
1166
1168
  name: "--expected-event-id",
1167
1169
  value: "<id>",
@@ -1764,7 +1766,7 @@ var HOW_FLAGS = [
1764
1766
  }
1765
1767
  ];
1766
1768
 
1767
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
1769
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
1768
1770
  var KNOWLEDGE_FLAGS = [
1769
1771
  {
1770
1772
  name: "--accept-terms",
@@ -1823,7 +1825,7 @@ var KNOWLEDGE_FLAGS = [
1823
1825
  }
1824
1826
  ];
1825
1827
 
1826
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
1828
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
1827
1829
  var MAIL_FLAGS = [
1828
1830
  {
1829
1831
  name: "--cc",
@@ -1853,7 +1855,38 @@ var MAIL_FLAGS = [
1853
1855
  }
1854
1856
  ];
1855
1857
 
1856
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
1858
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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-mirror.js
1859
+ var MIRROR_FLAGS = [
1860
+ {
1861
+ name: "--keep",
1862
+ value: "<side>",
1863
+ role: "mode",
1864
+ type: "choice",
1865
+ meaning: "settle a conflict with one side: local, the remote by its own name (disk, drive), or both, the other kept as a conflict copy"
1866
+ },
1867
+ {
1868
+ name: "--allow-deletions",
1869
+ value: "<count>",
1870
+ role: "mode",
1871
+ type: "count",
1872
+ meaning: "let this run delete up to this many files when the mirror's guard stops it; owner only"
1873
+ },
1874
+ {
1875
+ name: "--allow-replacements",
1876
+ value: "<count>",
1877
+ role: "mode",
1878
+ type: "count",
1879
+ meaning: "let this run overwrite up to this many existing files when the mirror's guard stops it; owner only"
1880
+ },
1881
+ {
1882
+ name: "--repin",
1883
+ role: "mode",
1884
+ type: "switch",
1885
+ meaning: "accept that a replaced local or remote folder is the mirror's folder now, and sync it; owner only"
1886
+ }
1887
+ ];
1888
+
1889
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
1857
1890
  var PRIVACY_FLAGS = [
1858
1891
  {
1859
1892
  name: "--about-text",
@@ -1914,7 +1947,7 @@ var PRIVACY_FLAGS = [
1914
1947
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1915
1948
  ];
1916
1949
 
1917
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
1950
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
1918
1951
  var SCHEDULE_FLAGS = [
1919
1952
  {
1920
1953
  name: "--locale",
@@ -1947,7 +1980,18 @@ var SCHEDULE_FLAGS = [
1947
1980
  }
1948
1981
  ];
1949
1982
 
1950
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
1983
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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-search.js
1984
+ var SEARCH_FLAGS = [
1985
+ {
1986
+ name: "--like",
1987
+ value: "<text>",
1988
+ role: "query",
1989
+ type: "string",
1990
+ meaning: "a made-up example of the text sought, such as a reply that would answer the question, searched by meaning beside the query"
1991
+ }
1992
+ ];
1993
+
1994
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
1951
1995
  var WHAT_FLAGS = [
1952
1996
  {
1953
1997
  name: "--analysis-provider",
@@ -2944,7 +2988,7 @@ var WHAT_FLAGS = [
2944
2988
  }
2945
2989
  ];
2946
2990
 
2947
- // node_modules/.pnpm/@wirecat+cli-base@0.113.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
2991
+ // node_modules/.pnpm/@wirecat+cli-base@0.127.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
2948
2992
  var FLAG_TYPES = [
2949
2993
  "switch",
2950
2994
  "count",
@@ -3174,6 +3218,8 @@ var collections = [
3174
3218
  ["messages", "posts in a messenger chat, or emails"],
3175
3219
  ["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
3176
3220
  ["polls", "polls in a chat"],
3221
+ ["posts", "posts and pages on a site or blog the owner publishes"],
3222
+ ["channels", "the sites and social accounts the owner publishes posts on"],
3177
3223
  ["reactions", "reactions to a message"],
3178
3224
  ["recipients", "who a message goes to"],
3179
3225
  ["replies", "the automatic replies of a profile"],
@@ -3220,6 +3266,10 @@ var collections = [
3220
3266
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3221
3267
  ["splits", "parts of one transaction, each with its own amount and category"],
3222
3268
  ["users", "people who work in the owner's account at a service, such as a CRM's employees"],
3269
+ ["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
3270
+ ["teams", "groups in a tracker that own issues, states and labels"],
3271
+ ["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
3272
+ ["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
3223
3273
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3224
3274
  ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3225
3275
  ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
@@ -3233,6 +3283,11 @@ var collections = [
3233
3283
  ["roles", "the parts a person plays in a relationship, built in or the owner's own"],
3234
3284
  ["sheets", "remote spreadsheets and their cell ranges, read or changed through a provider"],
3235
3285
  ["files", "files in the source, such as Google Drive, read and changed there"],
3286
+ ["mirrors", "saved pairings of a local folder and a folder in the source, which sync keeps the same both ways"],
3287
+ [
3288
+ "conflicts",
3289
+ "files a mirror's sync found changed on both sides and could not merge, each waiting for a side or a final file"
3290
+ ],
3236
3291
  ["comments", "comments people left on a thing in the source: a channel post or a file"],
3237
3292
  ["meetings", "stored meetings, from Zoom or another provider"],
3238
3293
  ["calls", "phone calls a phone system recorded, stored as meetings with their transcripts"],
@@ -3288,6 +3343,10 @@ var singulars = [
3288
3343
  ["privacy", "who may find, see, call or add the account"],
3289
3344
  ["metadata", "a profile's cached source attributes"],
3290
3345
  ["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
3346
+ [
3347
+ "scheduled",
3348
+ "a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
3349
+ ],
3291
3350
  [
3292
3351
  "schedule",
3293
3352
  "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"
@@ -3295,6 +3354,7 @@ var singulars = [
3295
3354
  ];
3296
3355
  var views = [
3297
3356
  ["tree", "the parent and child hierarchy of stored sources"],
3357
+ ["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
3298
3358
  ["logs", "the log of a running process"],
3299
3359
  ["events", "what happened in a thing over time"],
3300
3360
  ["scheduled", "what is scheduled to happen"],
@@ -3367,11 +3427,14 @@ var VOCABULARY = defineVocabulary({
3367
3427
  ...MAIL_FLAGS,
3368
3428
  ...KNOWLEDGE_FLAGS,
3369
3429
  ...CRM_FLAGS,
3370
- ...SCHEDULE_FLAGS
3430
+ ...SCHEDULE_FLAGS,
3431
+ ...CONTENT_FLAGS,
3432
+ ...SEARCH_FLAGS,
3433
+ ...MIRROR_FLAGS
3371
3434
  ]
3372
3435
  });
3373
3436
 
3374
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3437
+ // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3375
3438
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3376
3439
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3377
3440
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3542,7 +3605,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3542
3605
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3543
3606
  const lend = ctx.connection;
3544
3607
  let borrowed;
3545
- let answered2 = false;
3608
+ let answered = false;
3546
3609
  let result;
3547
3610
  let failure;
3548
3611
  const streams = captureStreams();
@@ -3564,7 +3627,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3564
3627
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3565
3628
  agent: {
3566
3629
  result: /* @__PURE__ */ __name((value) => {
3567
- answered2 = true;
3630
+ answered = true;
3568
3631
  result = value;
3569
3632
  }, "result"),
3570
3633
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3586,7 +3649,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3586
3649
  }));
3587
3650
  if (failure)
3588
3651
  return { error: failure };
3589
- if (answered2)
3652
+ if (answered)
3590
3653
  return { result };
3591
3654
  if (code !== 0)
3592
3655
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3598,468 +3661,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3598
3661
  }
3599
3662
  }, "runCommandForAgent");
3600
3663
 
3601
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/tool.js
3602
- var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
3603
- var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
3604
- var message = pipe(
3605
- string(),
3606
- maxLength(256),
3607
- // biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
3608
- regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
3609
- description("message id")
3610
- );
3611
- var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
3612
- var WRITE = {
3613
- readOnlyHint: false,
3614
- destructiveHint: true,
3615
- idempotentHint: false,
3616
- openWorldHint: true
3617
- };
3618
- var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
3619
- var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
3620
- var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
3621
- if (definition.annotations.readOnlyHint === true)
3622
- return "read";
3623
- if (/^admin|_admin/.test(key2))
3624
- return "admin";
3625
- if (/delete|ban|kick|remove|purge|block/.test(key2))
3626
- return "destructive";
3627
- if (/draft/.test(key2))
3628
- return "draft";
3629
- if (key2 === "messages_pin" && messenger?.quietPins === false)
3630
- return "write-public";
3631
- if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
3632
- return "write-private";
3633
- return "write-public";
3634
- }, "tierOf");
3635
- var effectsOf = /* @__PURE__ */ __name((definition) => {
3636
- if (definition.effects)
3637
- return definition.effects;
3638
- const { readOnlyHint, openWorldHint } = definition.annotations;
3639
- if (readOnlyHint === true)
3640
- return { remote: openWorldHint === false ? "none" : "read", local: "read" };
3641
- return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
3642
- }, "effectsOf");
3643
- var outcomeOf = /* @__PURE__ */ __name((result) => {
3644
- if (!result.isError)
3645
- return { status: "ok" };
3646
- const code = result.structuredContent?.error?.code;
3647
- const error = typeof code === "string" ? code : "generic_failure";
3648
- return { status: error === "permission_error" ? "refused" : "failed", error };
3649
- }, "outcomeOf");
3650
- var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
3651
- var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
3652
- 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");
3653
- var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
3654
- const permissions = defaults.settings.permissions ?? {};
3655
- const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
3656
- return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
3657
- }, "syncAllowedFor");
3658
- var entryRunner = /* @__PURE__ */ __name((registration) => {
3659
- const run = callRunner(registration);
3660
- const { log } = registration;
3661
- return async (key2, definition, args, ctx) => {
3662
- const startedAt = Date.now();
3663
- const command = `mcp ${commandOf(key2, definition)}`;
3664
- const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
3665
- const app = registration.messenger?.app;
3666
- const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
3667
- const env = registration.defaults.env ?? process.env;
3668
- const settings = registration.defaults.settings;
3669
- const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
3670
- app,
3671
- command,
3672
- ...settings.profile === void 0 ? {} : { profile: settings.profile },
3673
- env,
3674
- record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
3675
- keepFailed: true,
3676
- trace: false,
3677
- format: "json",
3678
- context: runContextOf({ bin: app.command, command, env, caller }),
3679
- ...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
3680
- ...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
3681
- ...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
3682
- ...traceId === void 0 ? {} : { traceId }
3683
- }) : void 0;
3684
- const profile = registration.defaults.settings.profile;
3685
- const scope = {
3686
- runId: recording?.runId ?? newRunId(new Date(startedAt), command),
3687
- command,
3688
- startedAt,
3689
- ...profile === void 0 ? {} : { profile },
3690
- ...traceId === void 0 ? {} : { traceId },
3691
- ...recording ? { events: recording.events } : {}
3692
- };
3693
- const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
3694
- const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
3695
- const parsed = safeParse(input, args);
3696
- return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
3697
- arguments: toJsonSchema(input)
3698
- }), app?.errors);
3699
- }), "work");
3700
- const result = await (caller ? withCaller(caller, work) : work());
3701
- if (recording) {
3702
- if (result.isError) {
3703
- const error = result.structuredContent?.error;
3704
- const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
3705
- await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
3706
- } else
3707
- await recording.succeed(result.structuredContent).catch(() => void 0);
3708
- }
3709
- await log?.({
3710
- tool: key2,
3711
- tier: tierOf(key2, definition, registration.messenger),
3712
- ...outcomeOf(result),
3713
- startedAt,
3714
- finishedAt: Date.now()
3715
- }, caller)?.catch(() => void 0);
3716
- return result;
3717
- };
3718
- }, "entryRunner");
3719
- var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
3720
- const where = {
3721
- profile: defaults.settings.profile,
3722
- env: defaults.env,
3723
- pictures: defaults.settings.pictureSearch,
3724
- reranker: defaults.settings.searchReranker
3725
- };
3726
- return async (key2, definition, args, ctx) => {
3727
- const path = commandOf(key2, definition).split(" ");
3728
- const run = `mcp ${path.join(" ")}`;
3729
- try {
3730
- const execute = /* @__PURE__ */ __name(async () => {
3731
- const syncAllowed = syncAllowedFor(key2, defaults);
3732
- if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
3733
- throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
3734
- reason: "input.too-large",
3735
- max_bytes: MAX_BUFFERED_INPUT,
3736
- retryable: false
3737
- });
3738
- definition.check?.(args);
3739
- if (definition.changesStore)
3740
- refuseStoreChange(messenger.app, defaults.env);
3741
- refuseLacking(messenger, path);
3742
- for (const permission of readKeysForCommand(path)) {
3743
- if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
3744
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
3745
- }
3746
- if (args.sync_first && !syncAllowed)
3747
- throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
3748
- if (definition.custom) {
3749
- const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
3750
- return answered(result2, definition.outputLimit?.(args, defaults), targets);
3751
- }
3752
- if (definition.local)
3753
- return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
3754
- const { online, stored: local, served } = definition;
3755
- const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
3756
- const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
3757
- name: run
3758
- }) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
3759
- ...storeModeDeps(messenger, store, account, defaults.guard),
3760
- ...where,
3761
- embedders: defaults.embedders
3762
- }), args, defaults, (work) => session.use(run, async (adapter, release) => {
3763
- try {
3764
- return await work(adapter);
3765
- } finally {
3766
- await release();
3767
- }
3768
- })), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
3769
- try {
3770
- return await work(adapter);
3771
- } finally {
3772
- await release();
3773
- }
3774
- })())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
3775
- return answered(result, definition.outputLimit?.(args, defaults), targets);
3776
- }, "execute");
3777
- return around ? await around(key2, definition, execute) : await execute();
3778
- } catch (error) {
3779
- return failed(error, messenger?.app?.errors, effectsOf(definition));
3780
- }
3781
- };
3782
- }, "callRunner");
3783
- var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
3784
- if (!definition.output)
3785
- return looseObject({});
3786
- const entity = ENTITIES[definition.output.entity];
3787
- return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
3788
- }, "outputSchemaOf");
3789
- var Picture = class {
3790
- static {
3791
- __name(this, "Picture");
3792
- }
3793
- bytes;
3794
- mimeType;
3795
- about;
3796
- constructor(bytes, mimeType, about) {
3797
- this.bytes = bytes;
3798
- this.mimeType = mimeType;
3799
- this.about = about;
3800
- }
3801
- };
3802
- var BinaryResource = class {
3803
- static {
3804
- __name(this, "BinaryResource");
3805
- }
3806
- base64;
3807
- mimeType;
3808
- uri;
3809
- about;
3810
- constructor(base64, mimeType, uri, about) {
3811
- this.base64 = base64;
3812
- this.mimeType = mimeType;
3813
- this.uri = uri;
3814
- this.about = about;
3815
- }
3816
- };
3817
- var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
3818
- const bounded = /* @__PURE__ */ __name((result) => {
3819
- if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
3820
- 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 });
3821
- return result;
3822
- }, "bounded");
3823
- if (answer === null || Array.isArray(answer) || typeof answer !== "object")
3824
- throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
3825
- const objectBody = /* @__PURE__ */ __name((value) => {
3826
- const serialized = JSON.parse(agentJson(value));
3827
- if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
3828
- throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
3829
- return serialized;
3830
- }, "objectBody");
3831
- if (answer instanceof BinaryResource) {
3832
- const about = sealed(answer.about);
3833
- return bounded({
3834
- structuredContent: objectBody(about),
3835
- content: [
3836
- { type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
3837
- { type: "text", text: agentJson(about) }
3838
- ]
3839
- });
3840
- }
3841
- if (answer instanceof Picture) {
3842
- const about = sealed(answer.about);
3843
- return bounded({
3844
- structuredContent: objectBody(about),
3845
- content: [
3846
- { type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
3847
- { type: "text", text: agentJson(about) }
3848
- ]
3849
- });
3850
- }
3851
- const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
3852
- return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
3853
- }, "answered");
3854
- var failed = /* @__PURE__ */ __name((error, errors, effects) => {
3855
- const judged = judgedEffects(effects);
3856
- const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
3857
- return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
3858
- }, "failed");
3859
-
3860
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/surface.js
3861
- import { randomUUID } from "node:crypto";
3862
- var MATCHES = 8;
3863
- var ANSWER = answerSchema();
3864
- var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
3865
- const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
3866
- const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
3867
- return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
3868
- items: optional(array(unknown())),
3869
- item: optional(unknown()),
3870
- page: optional(looseObject({ has_more: boolean() })),
3871
- next,
3872
- missing: optional(array(looseObject({ field: string(), why: string() }))),
3873
- meta
3874
- });
3875
- }, "agentAnswer");
3876
- var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
3877
- const checked = toStandardJsonSchema(ANSWER);
3878
- const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
3879
- return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
3880
- }, "listedAs");
3881
- var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
3882
- 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(" "));
3883
- var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
3884
- var stem = /* @__PURE__ */ __name((word2) => {
3885
- const bare = word2.replace(/'s$/u, "");
3886
- if (bare.length > 4 && bare.endsWith("ies"))
3887
- return `${bare.slice(0, -3)}y`;
3888
- for (const ending of ["ing", "ed", "es", "s"])
3889
- if (bare.length - ending.length >= 3 && bare.endsWith(ending))
3890
- return bare.slice(0, -ending.length);
3891
- return bare;
3892
- }, "stem");
3893
- var sameWord = /* @__PURE__ */ __name((asked, known) => {
3894
- if (asked === known)
3895
- return true;
3896
- const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
3897
- return short.length >= 3 && long.startsWith(short);
3898
- }, "sameWord");
3899
- var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
3900
- [4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
3901
- [2, wordsOf(one.title)],
3902
- [1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
3903
- ].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
3904
- var search = /* @__PURE__ */ __name((commands, query) => {
3905
- const named = normal(query);
3906
- const all = Object.entries(commands);
3907
- if (!named)
3908
- return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
3909
- const words = [
3910
- ...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
3911
- ];
3912
- return all.map((entry) => {
3913
- const fields = fieldsOf2(entry[0], entry[1]);
3914
- const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
3915
- const matched = weights.filter((weight) => weight > 0).length;
3916
- const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
3917
- return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
3918
- }).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
3919
- }, "search");
3920
- var nearest = /* @__PURE__ */ __name((commands, asked) => {
3921
- const words = normal(asked).split(" ");
3922
- 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);
3923
- }, "nearest");
3924
- var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
3925
- const body = result.structuredContent;
3926
- if (result.isError || !Array.isArray(body?.next))
3927
- return result;
3928
- const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
3929
- const { next: _, ...rest } = body;
3930
- const kept = next.length > 0 ? { ...rest, next } : rest;
3931
- return {
3932
- ...result,
3933
- structuredContent: kept,
3934
- content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
3935
- };
3936
- }, "runnableOnly");
3937
- var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
3938
- var sampleOf = /* @__PURE__ */ __name((commands) => {
3939
- const reading = Object.entries(commands).filter(([, one]) => !one.writes);
3940
- const bare = reading.filter(([, one]) => takesNothing(one));
3941
- return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
3942
- }, "sampleOf");
3943
- var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
3944
- const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
3945
- const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
3946
- const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
3947
- const sample = messenger ? "messages list" : sampleOf(commands);
3948
- const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
3949
- server.registerTool(`${prefix}_tools_search`, {
3950
- outputSchema: toStandardJsonSchema(looseObject({})),
3951
- title: "Find a command",
3952
- 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.`,
3953
- inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
3954
- annotations: { ...READ, openWorldHint: false, idempotentHint: true }
3955
- }, async ({ query }) => {
3956
- const found = search(commands, query ?? "");
3957
- const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
3958
- command,
3959
- title: one.title,
3960
- description: one.description,
3961
- writes: one.writes,
3962
- availability: one.availability?.() ?? { available: true },
3963
- arguments: toJsonSchema(one.input),
3964
- output: toJsonSchema(one.output ?? ANSWER)
3965
- })) : found.map(([command, one]) => ({
3966
- command,
3967
- title: one.title,
3968
- writes: one.writes,
3969
- availability: one.availability?.() ?? { available: true }
3970
- }));
3971
- const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
3972
- items,
3973
- limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
3974
- has_more: found.length > items.length
3975
- });
3976
- return answered(list);
3977
- });
3978
- const callers = {
3979
- env: process.env,
3980
- client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
3981
- connectionId: randomUUID()
3982
- };
3983
- const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
3984
- try {
3985
- const command = byNormal.get(normal(asked));
3986
- const one = command === void 0 ? void 0 : commands[command];
3987
- if (command === void 0 || !one) {
3988
- withheld?.(normal(asked));
3989
- const near = nearest(commands, asked);
3990
- 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`);
3991
- }
3992
- if (one.writes !== writing)
3993
- throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
3994
- const args = writing ? agentArguments(given ?? {}) : given ?? {};
3995
- const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
3996
- if (one.checked)
3997
- return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
3998
- const parsed = safeParse(strictObject(one.input.entries), args);
3999
- if (!parsed.success)
4000
- throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
4001
- arguments: toJsonSchema(one.input)
4002
- });
4003
- return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
4004
- } catch (error) {
4005
- return failed(error, errors);
4006
- }
4007
- }, "runner");
4008
- const call = strictObject({
4009
- command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
4010
- arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
4011
- });
4012
- server.registerTool(`${prefix}_read`, {
4013
- outputSchema: listedAs(prefix, false),
4014
- title: "Run a reading command",
4015
- description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
4016
- inputSchema: toStandardJsonSchema(call),
4017
- annotations: READ
4018
- }, runner(false));
4019
- if (Object.values(commands).some((one) => one.writes))
4020
- server.registerTool(`${prefix}_write`, {
4021
- outputSchema: listedAs(prefix, true),
4022
- title: "Run a writing command",
4023
- 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}`,
4024
- inputSchema: toStandardJsonSchema(call),
4025
- annotations: WRITE
4026
- }, runner(true));
4027
- }, "registerCommands");
4028
- var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
4029
- const run = entryRunner(registration);
4030
- return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
4031
- commandOf(key2, definition),
4032
- {
4033
- title: definition.title,
4034
- description: definition.description,
4035
- writes: definition.annotations.readOnlyHint !== true,
4036
- input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
4037
- ...definition.output ? { output: outputSchemaOf(definition) } : {},
4038
- checked: true,
4039
- run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
4040
- }
4041
- ]));
4042
- }, "surfaceCommands");
4043
- var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
4044
-
4045
3664
  export {
4046
3665
  toolsFromCommands,
4047
- runCommandForAgent,
4048
- message,
4049
- READ,
4050
- WRITE,
4051
- tool,
4052
- chatOf,
4053
- tierOf,
4054
- outcomeOf,
4055
- commandOf,
4056
- toolKey,
4057
- Picture,
4058
- BinaryResource,
4059
- answered,
4060
- failed,
4061
- normal,
4062
- registerCommands,
4063
- surfaceCommands,
4064
- outputOf
3666
+ runCommandForAgent
4065
3667
  };