@wirecat/notion-cli 0.4.0 → 0.6.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 (229) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +5 -0
  3. package/contracts/wirecat.json +55 -2
  4. package/dist/bin/notion.js +2 -2
  5. package/dist/bundle/agent-ILG6AH7S.js +42 -0
  6. package/dist/bundle/{all-profiles-4IONYZB6.js → all-profiles-AELHUTFU.js} +64 -21
  7. package/dist/bundle/{anthropic-OXF74J4P.js → anthropic-3CCYAGO3.js} +6 -6
  8. package/dist/bundle/{app-server-M2VF6ABM.js → app-server-DJ6P4NY4.js} +86 -65
  9. package/dist/bundle/{bun-DLA6QRLL.js → bun-2FLR4IV4.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-F4BYLW3F.js → bun-sqlite-QB6CU6TH.js} +7 -7
  11. package/dist/bundle/chunk-2CMLY2X3.js +72 -0
  12. package/dist/bundle/{chunk-TZ2QJ53V.js → chunk-2XUV7HNE.js} +2 -2
  13. package/dist/bundle/{chunk-6JBLIQQN.js → chunk-2Z7UOXFC.js} +1 -1
  14. package/dist/bundle/{chunk-6GN7KU7X.js → chunk-3LMW7U7F.js} +22 -10
  15. package/dist/bundle/chunk-3MYN2RMG.js +398 -0
  16. package/dist/bundle/{chunk-YFWLHTNO.js → chunk-3UX4VJWD.js} +1 -1
  17. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  18. package/dist/bundle/{chunk-4KUJTSHG.js → chunk-4RFR4J2O.js} +2 -2
  19. package/dist/bundle/{chunk-OCDJ4FFA.js → chunk-4VXXOJ2F.js} +4 -4
  20. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  21. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  22. package/dist/bundle/{chunk-P3P6DA6K.js → chunk-5OJLUUOJ.js} +6 -6
  23. package/dist/bundle/{chunk-T5UNSFES.js → chunk-5XPHFV7H.js} +35 -12
  24. package/dist/bundle/{chunk-KL3P5TQK.js → chunk-6EJCI47L.js} +4 -4
  25. package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
  26. package/dist/bundle/{chunk-IJMFG7HB.js → chunk-6YOMPW7Y.js} +10 -8
  27. package/dist/bundle/{chunk-7NF3V5L2.js → chunk-7JVKQ6NM.js} +4 -4
  28. package/dist/bundle/chunk-7L2XOKDZ.js +353 -0
  29. package/dist/bundle/{chunk-TXONV3HW.js → chunk-A42T4YX7.js} +3 -3
  30. package/dist/bundle/chunk-AE4VW4NB.js +50 -0
  31. package/dist/bundle/chunk-AV2ZJ4WX.js +7 -0
  32. package/dist/bundle/{chunk-L6H7PY4X.js → chunk-AZLDR36U.js} +3 -3
  33. package/dist/bundle/{chunk-TFNRCCGR.js → chunk-BAXNAOOL.js} +4 -4
  34. package/dist/bundle/{chunk-QX3TPFEX.js → chunk-BEV5LO4D.js} +110 -862
  35. package/dist/bundle/{chunk-UROEWCOG.js → chunk-BQBC2WIG.js} +1 -65
  36. package/dist/bundle/{chunk-NO2LIHWA.js → chunk-CFQQTDSA.js} +1 -1
  37. package/dist/bundle/chunk-CHPWBQUK.js +39 -0
  38. package/dist/bundle/chunk-CL3YNUCC.js +388 -0
  39. package/dist/bundle/{chunk-WHJWURZB.js → chunk-DGMTSDKB.js} +6 -6
  40. package/dist/bundle/{chunk-HTKSCSJU.js → chunk-DHVVXQEL.js} +4 -4
  41. package/dist/bundle/chunk-DIU2QJJF.js +785 -0
  42. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  43. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  44. package/dist/bundle/{chunk-Z53LYX4M.js → chunk-EHW45LLT.js} +3 -3
  45. package/dist/bundle/{chunk-XCTOCVMW.js → chunk-ERN53B3Z.js} +32 -24
  46. package/dist/bundle/{chunk-CDGZZNGY.js → chunk-ESZHGC4Q.js} +38 -8
  47. package/dist/bundle/{chunk-RMJMID5D.js → chunk-EZMG5QXB.js} +8 -8
  48. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  49. package/dist/bundle/{chunk-Y5LAJWR5.js → chunk-F5ZAN7OC.js} +1 -1
  50. package/dist/bundle/{chunk-2MHMKNWD.js → chunk-FMMYBVCH.js} +1 -1
  51. package/dist/bundle/{chunk-WZEEEQGC.js → chunk-FRB2L7OE.js} +3 -3
  52. package/dist/bundle/chunk-FV4WTZCU.js +561 -0
  53. package/dist/bundle/{chunk-BEPFGITI.js → chunk-G4ZU73SD.js} +101 -80
  54. package/dist/bundle/{chunk-5XP4KQ2F.js → chunk-GCAJW4SR.js} +1 -1
  55. package/dist/bundle/{chunk-FEMHUSGO.js → chunk-GPRJXJC7.js} +15 -1
  56. package/dist/bundle/chunk-GUIQJUJV.js +340 -0
  57. package/dist/bundle/{chunk-M2EEIYBU.js → chunk-HHEWTLAT.js} +2 -2
  58. package/dist/bundle/{chunk-LIQMUDIZ.js → chunk-HM6AMYHR.js} +2 -2
  59. package/dist/bundle/{chunk-TJCPTRYD.js → chunk-HOVHE3A3.js} +7 -7
  60. package/dist/bundle/{chunk-YAPDU3SV.js → chunk-HVXOA4FO.js} +1 -1
  61. package/dist/bundle/{chunk-D6RCRBDH.js → chunk-IJVTN5L3.js} +2 -2
  62. package/dist/bundle/{chunk-CIVXTBJY.js → chunk-IURYZSG3.js} +39 -52
  63. package/dist/bundle/chunk-JFSVAOA7.js +108 -0
  64. package/dist/bundle/{chunk-FSJHASRQ.js → chunk-JVESLS7B.js} +611 -572
  65. package/dist/bundle/chunk-K5IC4FZN.js +36 -0
  66. package/dist/bundle/chunk-KB35BVTG.js +30 -0
  67. package/dist/bundle/chunk-KGAUINBO.js +594 -0
  68. package/dist/bundle/{chunk-AYU5TFDU.js → chunk-KNCPBX5P.js} +85 -76
  69. package/dist/bundle/{chunk-GSNE7OB4.js → chunk-KZJQPJK5.js} +4 -4
  70. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  71. package/dist/bundle/{chunk-M6DGZ2O6.js → chunk-LC6WE6JS.js} +9 -9
  72. package/dist/bundle/{chunk-YGCI3DHS.js → chunk-LECMHK2F.js} +1 -1
  73. package/dist/bundle/chunk-LQVDFD65.js +72 -0
  74. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  75. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  76. package/dist/bundle/{chunk-K5I64ZVI.js → chunk-NSR43UEW.js} +7 -64
  77. package/dist/bundle/{chunk-GK4GLPG2.js → chunk-OEQNP56V.js} +2 -100
  78. package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
  79. package/dist/bundle/{chunk-MRA62W5K.js → chunk-P27NDZQR.js} +255 -563
  80. package/dist/bundle/{chunk-GBFEEHQC.js → chunk-PHKED7AG.js} +8 -225
  81. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  82. package/dist/bundle/{chunk-JODE2XED.js → chunk-Q7EIL6VU.js} +43 -33
  83. package/dist/bundle/{chunk-4TQVZXOV.js → chunk-QEJFBORC.js} +3 -3
  84. package/dist/bundle/{chunk-ZC6ZQQ55.js → chunk-QGGRFRMP.js} +65 -49
  85. package/dist/bundle/{chunk-JIRRF6BM.js → chunk-RD7BKTWV.js} +4 -4
  86. package/dist/bundle/chunk-RXU5T5NM.js +714 -0
  87. package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
  88. package/dist/bundle/{chunk-7NGFGFE5.js → chunk-SAPP2LEH.js} +10 -10
  89. package/dist/bundle/{chunk-COH7OEER.js → chunk-SEAGUFBX.js} +12 -12
  90. package/dist/bundle/{chunk-5LBJNTEJ.js → chunk-STTO2MSY.js} +43 -64
  91. package/dist/bundle/{chunk-5UA2TYMI.js → chunk-T37TAXVL.js} +2 -2
  92. package/dist/bundle/{chunk-R6SDRSZK.js → chunk-T6XIBULH.js} +139 -571
  93. package/dist/bundle/chunk-TFT4FVRU.js +67 -0
  94. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  95. package/dist/bundle/{chunk-KFVDL2QS.js → chunk-UC7JLE6J.js} +1 -89
  96. package/dist/bundle/{chunk-SGBS5QCU.js → chunk-UOC52GCB.js} +4 -4
  97. package/dist/bundle/chunk-UPL474OW.js +94 -0
  98. package/dist/bundle/chunk-VH7526NL.js +80 -0
  99. package/dist/bundle/chunk-VNWF4I7E.js +34 -0
  100. package/dist/bundle/chunk-W2VQDIU5.js +221 -0
  101. package/dist/bundle/{chunk-EQPAZ33O.js → chunk-WAGADES3.js} +19 -19
  102. package/dist/bundle/{chunk-WU3XHGOB.js → chunk-WAU5LSHP.js} +81 -438
  103. package/dist/bundle/{chunk-FIHXADRF.js → chunk-WB2KSQIP.js} +4 -4
  104. package/dist/bundle/{chunk-OI5DWZJG.js → chunk-WGZH2M64.js} +3 -3
  105. package/dist/bundle/chunk-WVN2KTNS.js +52 -0
  106. package/dist/bundle/{chunk-UKE3CGHK.js → chunk-XYQVVW4R.js} +1 -1
  107. package/dist/bundle/{chunk-7NVPM55S.js → chunk-YDDI4QIT.js} +2203 -1808
  108. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  109. package/dist/bundle/{chunk-7YZPBAQX.js → chunk-YUDVRFXN.js} +1 -1
  110. package/dist/bundle/{chunk-EY6S7FV3.js → chunk-YXYZAWWW.js} +6 -6
  111. package/dist/bundle/{chunk-GCCPFKSU.js → chunk-YYQ5GKAI.js} +9532 -10735
  112. package/dist/bundle/chunk-ZDYEOE7L.js +2366 -0
  113. package/dist/bundle/command-contract-L2FASWD6.js +41 -0
  114. package/dist/bundle/{command-server-entry-2SORMVRM.js → command-server-entry-VUR6WL77.js} +30 -27
  115. package/dist/bundle/{decode-5O7IEFPN.js → decode-I64PF2RM.js} +6 -6
  116. package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
  117. package/dist/bundle/{dispatch-YHQX6FEJ.js → dispatch-JQBAZWCL.js} +8 -8
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/{echarts-ARLMVQC7.js → echarts-YRRVLEX3.js} +2 -2
  120. package/dist/bundle/{embed-FUDUKQ3K.js → embed-BLXLKMK2.js} +7 -7
  121. package/dist/bundle/{embedder-HDRV7GX3.js → embedder-JYGF6R7I.js} +10 -10
  122. package/dist/bundle/{failure-JHXICWIL.js → failure-I6AAF5R5.js} +3 -3
  123. package/dist/bundle/first-run-YLDOZGY6.js +29 -0
  124. package/dist/bundle/first-screen-GZH3LMLZ.js +41 -0
  125. package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
  126. package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
  127. package/dist/bundle/hast-util-to-mdast-3CSMIWK2.js +2272 -0
  128. package/dist/bundle/{instructions-MEFIKCDI.js → instructions-AG7SRWTR.js} +1 -1
  129. package/dist/bundle/{mcp-VMS6PBCU.js → mcp-YGOAUNC3.js} +2 -2
  130. package/dist/bundle/{mdast-util-from-markdown-R66F4HZA.js → mdast-util-from-markdown-XCR5KW5S.js} +138 -195
  131. package/dist/bundle/{mdast-util-gfm-LN2ELINH.js → mdast-util-gfm-JO7PHUIB.js} +28 -357
  132. package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
  133. package/dist/bundle/mdast-util-to-markdown-DOXGHRI7.js +1854 -0
  134. package/dist/bundle/meeting-combined-OFQSGKBG.js +25 -0
  135. package/dist/bundle/meeting-model-K6NSX3O5.js +27 -0
  136. package/dist/bundle/{meeting-semantic-R4CSLVRG.js → meeting-semantic-3DZPHM7L.js} +7 -7
  137. package/dist/bundle/{micromark-extension-gfm-5X7YT43T.js → micromark-extension-gfm-PQ7DWZM7.js} +12 -78
  138. package/dist/bundle/{node-MAQALPLA.js → node-GJQYN4FT.js} +2 -2
  139. package/dist/bundle/{node-sqlite-J7IJYNBO.js → node-sqlite-7VXIRQPH.js} +8 -8
  140. package/dist/bundle/notes-search-ACDOPTNH.js +64 -0
  141. package/dist/bundle/notion.js +14 -14
  142. package/dist/bundle/oauth-N67CH2TK.js +20 -0
  143. package/dist/bundle/{open-AB27MTGR.js → open-JGXVHIKO.js} +6 -6
  144. package/dist/bundle/{openai-D77MU5XV.js → openai-PFQJTF4H.js} +21 -18
  145. package/dist/bundle/{process-SIOWTRJ6.js → process-MEKCZMX3.js} +1 -1
  146. package/dist/bundle/{program-7K34KI27.js → program-DUJYLJH5.js} +6947 -6532
  147. package/dist/bundle/{prompt-W77YDHA6.js → prompt-FW44QDHD.js} +6 -6
  148. package/dist/bundle/{recognize-3JAXQQ36.js → recognize-62TDQ6A7.js} +5 -5
  149. package/dist/bundle/{remote-PSOJXCXO.js → remote-7ONFD7GG.js} +12 -11
  150. package/dist/bundle/{rerank-EE44ZTGL.js → rerank-YOHQQJS4.js} +8 -8
  151. package/dist/bundle/{schemas-LBYUMBC6.js → schemas-IIGJ7DOP.js} +39 -60
  152. package/dist/bundle/{serve-XJMGAMFW.js → serve-ZCXGT5RB.js} +11 -11
  153. package/dist/bundle/{server-ASU6CP5R.js → server-RQ74M637.js} +78 -56
  154. package/dist/bundle/server-XMZF57WM.js +90 -0
  155. package/dist/bundle/{services-PT4PA4J6.js → services-FWBRZ57M.js} +105 -90
  156. package/dist/bundle/{sqlite-runtime-YHXRTVXE.js → sqlite-runtime-ZZBNGV5L.js} +7 -7
  157. package/dist/bundle/{state-T6ZKFWGD.js → state-GDDFO62Y.js} +7 -7
  158. package/dist/bundle/{store-E5EE25FY.js → store-D2LRIWEI.js} +24 -20
  159. package/dist/bundle/{store-3MUCZEI3.js → store-KQCLR57N.js} +32 -18
  160. package/dist/bundle/store-maintenance-command-CK2MU5M6.js +77 -0
  161. package/dist/bundle/surface-K4TPIQW7.js +76 -0
  162. package/dist/commands/account.d.ts +3 -0
  163. package/dist/commands/account.d.ts.map +1 -0
  164. package/dist/commands/account.js +22 -0
  165. package/dist/commands/account.js.map +1 -0
  166. package/dist/commands/api.d.ts +7 -2
  167. package/dist/commands/api.d.ts.map +1 -1
  168. package/dist/commands/api.js +19 -119
  169. package/dist/commands/api.js.map +1 -1
  170. package/dist/commands/library.d.ts.map +1 -1
  171. package/dist/commands/library.js +16 -5
  172. package/dist/commands/library.js.map +1 -1
  173. package/dist/config.d.ts +11 -13
  174. package/dist/config.d.ts.map +1 -1
  175. package/dist/config.js +63 -54
  176. package/dist/config.js.map +1 -1
  177. package/dist/generated/definitions.d.ts.map +1 -1
  178. package/dist/generated/definitions.js +72 -18
  179. package/dist/generated/definitions.js.map +1 -1
  180. package/dist/generated/manifest.d.ts +4 -1
  181. package/dist/generated/manifest.d.ts.map +1 -1
  182. package/dist/generated/manifest.js +69 -0
  183. package/dist/generated/manifest.js.map +1 -1
  184. package/dist/generated/schemas.d.ts.map +1 -1
  185. package/dist/generated/schemas.js +32 -32
  186. package/dist/generated/schemas.js.map +1 -1
  187. package/dist/generated/types.d.ts +125 -25
  188. package/dist/generated/types.d.ts.map +1 -1
  189. package/dist/knowledge.d.ts +1 -0
  190. package/dist/knowledge.d.ts.map +1 -1
  191. package/dist/knowledge.js +68 -2
  192. package/dist/knowledge.js.map +1 -1
  193. package/dist/library.d.ts +12 -1
  194. package/dist/library.d.ts.map +1 -1
  195. package/dist/library.js +35 -1
  196. package/dist/library.js.map +1 -1
  197. package/dist/notion/port.d.ts.map +1 -1
  198. package/dist/notion/port.js +1 -0
  199. package/dist/notion/port.js.map +1 -1
  200. package/dist/notion/reads.d.ts +13 -1
  201. package/dist/notion/reads.d.ts.map +1 -1
  202. package/dist/notion/reads.js +1 -1
  203. package/dist/program.d.ts.map +1 -1
  204. package/dist/program.js +19 -2
  205. package/dist/program.js.map +1 -1
  206. package/dist/sync/files.d.ts +19 -0
  207. package/dist/sync/files.d.ts.map +1 -1
  208. package/dist/sync/files.js.map +1 -1
  209. package/dist/sync/source.d.ts +1 -1
  210. package/dist/sync/source.d.ts.map +1 -1
  211. package/dist/sync/source.js +60 -55
  212. package/dist/sync/source.js.map +1 -1
  213. package/dist/sync/users.d.ts +22 -0
  214. package/dist/sync/users.d.ts.map +1 -0
  215. package/dist/sync/users.js +111 -0
  216. package/dist/sync/users.js.map +1 -0
  217. package/dist/version.d.ts +1 -1
  218. package/dist/version.js +1 -1
  219. package/package.json +4 -4
  220. package/dist/bundle/chunk-L62XTC7N.js +0 -726
  221. package/dist/bundle/chunk-SHTHNBHG.js +0 -2
  222. package/dist/bundle/command-contract-UBXS6NHI.js +0 -38
  223. package/dist/bundle/first-run-BGEFTXOE.js +0 -29
  224. package/dist/bundle/first-screen-F5F3VS6Y.js +0 -38
  225. package/dist/bundle/meeting-combined-HNSS3FQY.js +0 -24
  226. package/dist/bundle/meeting-model-REZVYGQW.js +0 -26
  227. package/dist/bundle/oauth-AMV4YGJD.js +0 -20
  228. package/dist/bundle/server-WSPQ5EOA.js +0 -72
  229. package/dist/bundle/store-maintenance-command-ZZ55BBBG.js +0 -63
@@ -1,87 +1,45 @@
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-WU3XHGOB.js";
4
+ commandAvailability
5
+ } from "./chunk-AE4VW4NB.js";
11
6
  import {
12
- callerOf
13
- } from "./chunk-GK4GLPG2.js";
7
+ lentConnection
8
+ } from "./chunk-GUIQJUJV.js";
14
9
  import {
15
- lentConnection,
16
- refuseLacking
17
- } from "./chunk-L62XTC7N.js";
10
+ QUERY_ARGUMENT
11
+ } from "./chunk-RXU5T5NM.js";
18
12
  import {
19
- MAX_BUFFERED_INPUT
20
- } from "./chunk-D6RCRBDH.js";
21
- import {
22
- QUERY_ARGUMENT,
23
- onlineDeps,
24
- servicesFor,
25
- storeModeDeps
26
- } from "./chunk-GCCPFKSU.js";
27
- import {
28
- DEFAULT_OUTPUT_BYTES,
29
- ENTITIES,
30
- LOCAL_WRITE,
31
- REMOTE_WRITE,
32
- answerSchema,
33
13
  authorityAllowed,
34
14
  botApiAllowed,
35
15
  changesMessenger,
36
- fetchesAt,
37
- flatten,
38
- judgedAnswer,
39
- judgedEffects,
40
- keyForCommand,
41
- levelFor,
42
- listOf,
43
- readKeysForCommand,
44
- refuseStoreChange,
45
- sealed,
46
- startRecording
47
- } from "./chunk-MRA62W5K.js";
16
+ flatten
17
+ } from "./chunk-P27NDZQR.js";
48
18
  import {
49
- currentCaller,
50
- keepsSuccess,
51
- runContextOf,
52
- withCaller
53
- } from "./chunk-IJMFG7HB.js";
19
+ currentCaller
20
+ } from "./chunk-6YOMPW7Y.js";
54
21
  import {
55
22
  enclosingTraceId,
56
23
  inRun,
57
24
  newRunId,
58
25
  traceOf
59
- } from "./chunk-QX3TPFEX.js";
60
- import {
61
- storeDamaged
62
- } from "./chunk-UROEWCOG.js";
26
+ } from "./chunk-BEV5LO4D.js";
63
27
  import {
64
28
  queryDescription
65
- } from "./chunk-FSJHASRQ.js";
29
+ } from "./chunk-JVESLS7B.js";
66
30
  import {
67
- captureStreams,
68
- traceIdOf
69
- } from "./chunk-AYU5TFDU.js";
31
+ captureStreams
32
+ } from "./chunk-KNCPBX5P.js";
70
33
  import {
71
34
  COMPACT_FLAG,
72
35
  SNAKE_CASE,
73
36
  duplicates,
74
37
  errorObjectOf,
75
- itemEnvelopeSchema,
76
- listEnvelopeSchema,
77
- mcpErrorResult,
78
38
  parseRegistry,
79
39
  text,
80
- toJsonSchema,
81
- toStandardJsonSchema,
82
40
  word,
83
41
  writes
84
- } from "./chunk-6GN7KU7X.js";
42
+ } from "./chunk-3LMW7U7F.js";
85
43
  import {
86
44
  array,
87
45
  boolean,
@@ -89,9 +47,6 @@ import {
89
47
  integer,
90
48
  isoDate,
91
49
  literal,
92
- looseObject,
93
- maxLength,
94
- maxValue,
95
50
  minLength,
96
51
  minValue,
97
52
  number,
@@ -101,25 +56,22 @@ import {
101
56
  pipe,
102
57
  record,
103
58
  regex,
104
- safeParse,
105
59
  strictObject,
106
60
  string,
107
- summarize,
108
61
  union,
109
62
  unknown
110
- } from "./chunk-MVA5HVKL.js";
63
+ } from "./chunk-S4UUN6LD.js";
111
64
  import {
112
- CliError,
113
- errorCodes
114
- } from "./chunk-LIQMUDIZ.js";
65
+ CliError
66
+ } from "./chunk-HM6AMYHR.js";
115
67
  import {
116
68
  __name
117
69
  } from "./chunk-ZVVMGPBJ.js";
118
70
 
119
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/mcp/agent.js
71
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/agent.js
120
72
  import { Readable } from "node:stream";
121
73
 
122
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
74
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
123
75
  var LINT_SEVERITIES = ["high", "medium", "low"];
124
76
  var lintRuleSchema = strictObject({
125
77
  id: word,
@@ -265,7 +217,7 @@ var overrideSchema = strictObject({
265
217
  });
266
218
  var overridesSchema = array(overrideSchema);
267
219
 
268
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
220
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
269
221
  var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
270
222
  var defineAuditRules = /* @__PURE__ */ __name((input) => parseRegistry("audit rules", array(auditRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineAuditRules");
271
223
  var AUDIT_RULES = defineAuditRules([
@@ -320,17 +272,20 @@ var parityGroupSchema = strictObject({
320
272
  absent: optional(word),
321
273
  /** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
322
274
  only: optional(word),
275
+ /** The one CLI whose value (a summary, a value name) differs by design; every other CLI compared must agree. */
276
+ differs: optional(word),
323
277
  reason: pipe(text, minLength(10, "say why, in a sentence")),
324
278
  /** Warns from 14 days before and fails 14 days after, as a lint override does. */
325
279
  review_after: optional(pipe(string(), isoDate("a date, YYYY-MM-DD")))
326
280
  }))
327
281
  });
282
+ var kindOf = /* @__PURE__ */ __name((entry) => ["absent", "only", "differs"].filter((one) => entry[one] !== void 0), "kindOf");
328
283
  var defineParityGroups = /* @__PURE__ */ __name((input) => parseRegistry("parity groups", array(parityGroupSchema), input, (groups) => [
329
284
  ...duplicates(groups.map((group) => group.name)).map((name) => `"${name}" is listed twice`),
330
285
  ...groups.flatMap((group) => [
331
286
  ...duplicates(group.differences.map((entry) => `${entry.rule} ${entry.target}`)).map((both) => `${group.name}: "${both}" is listed twice`),
332
- ...group.differences.filter((entry) => (entry.absent || entry.only) && entry.expected).map((entry) => `${group.name}: "${entry.target}" has \`${entry.absent ? "absent" : "only"}\`, which measures the values itself; drop \`expected\``),
333
- ...group.differences.filter((entry) => entry.absent && entry.only).map((entry) => `${group.name}: "${entry.target}" has both \`absent\` and \`only\`; keep one`)
287
+ ...group.differences.filter((entry) => kindOf(entry).length === 1 && entry.expected).map((entry) => `${group.name}: "${entry.target}" has \`${kindOf(entry)[0]}\`, which measures the values itself; drop \`expected\``),
288
+ ...group.differences.filter((entry) => kindOf(entry).length > 1).map((entry) => `${group.name}: "${entry.target}" has ${kindOf(entry).map((one) => `\`${one}\``).join(" and ")}; keep one`)
334
289
  ])
335
290
  ]), "defineParityGroups");
336
291
  var MEMO_HAS_NO_PROFILES = [
@@ -345,6 +300,12 @@ var MEMO_HAS_NO_PROFILES = [
345
300
  absent: "memo",
346
301
  reason: "memo has no profiles: it reads other CLIs' stores and selects their accounts with --source and --account (https://github.com/WireCatLabs/cli-base/issues/390)"
347
302
  }));
303
+ var MEMO_MCP_SUMMARIES = ["mcp", "mcp serve"].map((path) => ({
304
+ rule: "same-path-contract",
305
+ target: `${path}: summary`,
306
+ differs: "memo",
307
+ reason: "memo has no profiles, so its mcp commands serve memo's commands rather than a profile's"
308
+ }));
348
309
  var MEMO_DOCTOR_DEEP = {
349
310
  rule: "same-path-contract",
350
311
  target: "doctor --deep",
@@ -375,7 +336,7 @@ var PARITY_GROUPS = defineParityGroups([
375
336
  name: "all",
376
337
  members: ["tg", "max", "memo", "drive", "zm", "wa"],
377
338
  covers: ["commands", "doctor", "skill", "mcp", "upgrade", "search", "notes", "meetings"],
378
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
339
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
379
340
  },
380
341
  // mail's `search messages` is cli-core's mail search, not the messengers' command: --complete took their 20-odd
381
342
  // differences as inherited (https://github.com/WireCatLabs/cli-base/issues/390). mail is compared everywhere else
@@ -384,7 +345,7 @@ var PARITY_GROUPS = defineParityGroups([
384
345
  name: "mail-shared",
385
346
  members: ["tg", "max", "memo", "drive", "zm", "wa", "mail"],
386
347
  covers: ["commands", "doctor", "skill", "mcp", "upgrade", "notes", "meetings"],
387
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
348
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
388
349
  },
389
350
  // gcal is compared on what it already shares with every CLI; doctor, mcp, search and skill wait until the published
390
351
  // CLIs agree there (https://github.com/WireCatLabs/cli-base/issues/390), then gcal moves back into "all".
@@ -396,27 +357,58 @@ var PARITY_GROUPS = defineParityGroups([
396
357
  },
397
358
  // bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
398
359
  // recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
399
- // notion-cli joins here until its documents commands ship; then it moves next to drive.
360
+ // amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
361
+ // wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
362
+ // notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
363
+ // its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
364
+ // and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
400
365
  {
401
366
  name: "shared-roots",
402
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion"],
367
+ members: [
368
+ "tg",
369
+ "max",
370
+ "memo",
371
+ "drive",
372
+ "zm",
373
+ "wa",
374
+ "b24",
375
+ "beeline",
376
+ "pbx",
377
+ "notion",
378
+ "amo",
379
+ "hubspot",
380
+ "attio",
381
+ "ydisk",
382
+ "wordpress"
383
+ ],
403
384
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
404
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
385
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
405
386
  },
406
- // The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet, so `audit --family`
407
- // skips it, as beeline. Only b24 has `leads` (amoCRM has no lead apart from a deal), `products` (amo leaves them for
408
- // later) and `deals delete` (amoCRM's API v4 cannot delete a lead,
409
- // https://www.amocrm.ru/developers/content/crm_platform/leads-api); a list of roots does not compare presence, so
410
- // these need no difference. `people`, `organizations`, `users`, `api` and `session` join once b24's released tree
411
- // is on cli-core's shared people and organizations commands: measured against b24 0.23.0 on 2026-11-16 they differ
412
- // in options, outputs and summaries.
387
+ // The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet and hubspot-cli is
388
+ // not in the family packages, so `audit --family` skips them, as beeline. Only b24 and hubspot have `leads` (amoCRM
389
+ // has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
390
+ // API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
391
+ // no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
392
+ // `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
393
+ // commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
413
394
  {
414
395
  name: "crm",
415
- members: ["b24", "amo"],
396
+ members: ["b24", "amo", "hubspot", "attio"],
416
397
  covers: ["deals", "sync", "search", "store", "schedule", "account"],
417
- differences: []
398
+ differences: [
399
+ {
400
+ rule: "same-path-contract",
401
+ target: "schedule: summary",
402
+ differs: "hubspot",
403
+ reason: "cli-core cuts the summary to a fixed width after it puts in the CLI's name (src/cli/help/commands-text.ts), so hubspot's longer name ends it a word earlier than b24's and amo's",
404
+ review_after: "2026-12-01"
405
+ }
406
+ ]
418
407
  }
419
408
  ]);
409
+ var SHARED_DIFFERENCES = [
410
+ ...new Map(PARITY_GROUPS.flatMap((group) => group.differences).filter((entry) => entry.rule === "same-entity-schema" || entry.rule === "same-error-reason").map((entry) => [`${entry.rule} ${entry.target}`, entry])).values()
411
+ ];
420
412
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
421
413
  var defineRequiredRoots = /* @__PURE__ */ __name((input) => parseRegistry("required roots", array(requiredRootSchema), input, (roots2) => duplicates(roots2.map((root) => root.path.join(" "))).map((path) => `"${path}" is listed twice`)), "defineRequiredRoots");
422
414
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -428,7 +420,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
428
420
  { path: ["upgrade"], meaning: "updates the CLI" }
429
421
  ]);
430
422
 
431
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
423
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
432
424
  var fieldRuleSchema = strictObject({ id: word, rule: text });
433
425
  var defineFieldRules = /* @__PURE__ */ __name((input) => parseRegistry("output field rules", array(fieldRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineFieldRules");
434
426
  var FIELD_RULES = defineFieldRules([
@@ -444,7 +436,7 @@ var FIELD_RULES = defineFieldRules([
444
436
  }
445
437
  ]);
446
438
 
447
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
439
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
448
440
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
449
441
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
450
442
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -466,7 +458,7 @@ var IDENTIFIERS = defineIdentifiers([
466
458
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
467
459
  ]);
468
460
 
469
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
461
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
470
462
  var ACCOUNT_FLAGS = [
471
463
  {
472
464
  name: "--client-id",
@@ -503,7 +495,7 @@ var ACCOUNT_FLAGS = [
503
495
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
504
496
  ];
505
497
 
506
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
498
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
507
499
  var CALENDAR_FLAGS = [
508
500
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
509
501
  {
@@ -591,7 +583,25 @@ var CALENDAR_FLAGS = [
591
583
  }
592
584
  ];
593
585
 
594
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
586
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-content.js
587
+ var CONTENT_FLAGS = [
588
+ { name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
589
+ {
590
+ name: "--tags",
591
+ value: "<ids>",
592
+ role: "value",
593
+ type: "list",
594
+ meaning: "its tags and categories, by comma-separated ids; replaces the ones it has"
595
+ },
596
+ {
597
+ name: "--replace-body",
598
+ role: "mode",
599
+ type: "switch",
600
+ meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show"
601
+ }
602
+ ];
603
+
604
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
595
605
  var CRM_FLAGS = [
596
606
  {
597
607
  name: "--email",
@@ -755,7 +765,7 @@ var CRM_FLAGS = [
755
765
  }
756
766
  ];
757
767
 
758
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
768
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
759
769
  var HOW_FLAGS = [
760
770
  {
761
771
  name: "--limit",
@@ -1135,13 +1145,7 @@ var HOW_FLAGS = [
1135
1145
  type: "string",
1136
1146
  meaning: "a person whose reply counts as an answer; repeat it for more"
1137
1147
  },
1138
- {
1139
- name: "--browser",
1140
- value: "<program>",
1141
- role: "mode",
1142
- type: "string",
1143
- meaning: "the browser program to open for sign-in"
1144
- },
1148
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1145
1149
  {
1146
1150
  name: "--credential-storage",
1147
1151
  value: "<storage>",
@@ -1150,6 +1154,8 @@ var HOW_FLAGS = [
1150
1154
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1151
1155
  },
1152
1156
  { name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
1157
+ { name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
1158
+ { name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
1153
1159
  {
1154
1160
  name: "--expected-event-id",
1155
1161
  value: "<id>",
@@ -1752,7 +1758,7 @@ var HOW_FLAGS = [
1752
1758
  }
1753
1759
  ];
1754
1760
 
1755
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
1761
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
1756
1762
  var KNOWLEDGE_FLAGS = [
1757
1763
  {
1758
1764
  name: "--accept-terms",
@@ -1788,6 +1794,13 @@ var KNOWLEDGE_FLAGS = [
1788
1794
  meaning: "at most this many characters read",
1789
1795
  unit: "characters"
1790
1796
  },
1797
+ {
1798
+ name: "--tab",
1799
+ value: "<id>",
1800
+ role: "target",
1801
+ type: "id",
1802
+ meaning: "one tab of a document, by its id: only its text is read"
1803
+ },
1791
1804
  {
1792
1805
  name: "--tag",
1793
1806
  value: "<name>",
@@ -1804,7 +1817,7 @@ var KNOWLEDGE_FLAGS = [
1804
1817
  }
1805
1818
  ];
1806
1819
 
1807
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
1820
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
1808
1821
  var MAIL_FLAGS = [
1809
1822
  {
1810
1823
  name: "--cc",
@@ -1834,7 +1847,7 @@ var MAIL_FLAGS = [
1834
1847
  }
1835
1848
  ];
1836
1849
 
1837
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
1850
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
1838
1851
  var PRIVACY_FLAGS = [
1839
1852
  {
1840
1853
  name: "--about-text",
@@ -1895,7 +1908,7 @@ var PRIVACY_FLAGS = [
1895
1908
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1896
1909
  ];
1897
1910
 
1898
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
1911
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
1899
1912
  var SCHEDULE_FLAGS = [
1900
1913
  {
1901
1914
  name: "--locale",
@@ -1928,7 +1941,7 @@ var SCHEDULE_FLAGS = [
1928
1941
  }
1929
1942
  ];
1930
1943
 
1931
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
1944
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
1932
1945
  var WHAT_FLAGS = [
1933
1946
  {
1934
1947
  name: "--analysis-provider",
@@ -2925,7 +2938,7 @@ var WHAT_FLAGS = [
2925
2938
  }
2926
2939
  ];
2927
2940
 
2928
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
2941
+ // node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
2929
2942
  var FLAG_TYPES = [
2930
2943
  "switch",
2931
2944
  "count",
@@ -3055,6 +3068,10 @@ var verbs = [
3055
3068
  ["export", "write from the store to a file"],
3056
3069
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
3057
3070
  ["download", "save a file from the source to this machine"],
3071
+ ["upload", "put a file from this machine on the source"],
3072
+ ["publish", "open a thing to anyone who has its public link"],
3073
+ ["unpublish", "close a thing's public link"],
3074
+ ["stale", "mark a saved memory as out of date, keeping it"],
3058
3075
  ["transcribe", "turn speech into text"],
3059
3076
  ["extract", "read the text inside files already on this machine into the store"],
3060
3077
  ["migrate", "bring a file up to this build's schema"],
@@ -3151,6 +3168,8 @@ var collections = [
3151
3168
  ["messages", "posts in a messenger chat, or emails"],
3152
3169
  ["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
3153
3170
  ["polls", "polls in a chat"],
3171
+ ["posts", "posts and pages on a site or blog the owner publishes"],
3172
+ ["channels", "the sites and social accounts the owner publishes posts on"],
3154
3173
  ["reactions", "reactions to a message"],
3155
3174
  ["recipients", "who a message goes to"],
3156
3175
  ["replies", "the automatic replies of a profile"],
@@ -3197,6 +3216,10 @@ var collections = [
3197
3216
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3198
3217
  ["splits", "parts of one transaction, each with its own amount and category"],
3199
3218
  ["users", "people who work in the owner's account at a service, such as a CRM's employees"],
3219
+ ["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
3220
+ ["teams", "groups in a tracker that own issues, states and labels"],
3221
+ ["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
3222
+ ["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
3200
3223
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3201
3224
  ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3202
3225
  ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
@@ -3265,6 +3288,10 @@ var singulars = [
3265
3288
  ["privacy", "who may find, see, call or add the account"],
3266
3289
  ["metadata", "a profile's cached source attributes"],
3267
3290
  ["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
3291
+ [
3292
+ "scheduled",
3293
+ "a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
3294
+ ],
3268
3295
  [
3269
3296
  "schedule",
3270
3297
  "a profile's timers the owner saved, each running a command of this tool or an agent; the tool's own background work is jobs"
@@ -3272,6 +3299,7 @@ var singulars = [
3272
3299
  ];
3273
3300
  var views = [
3274
3301
  ["tree", "the parent and child hierarchy of stored sources"],
3302
+ ["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
3275
3303
  ["logs", "the log of a running process"],
3276
3304
  ["events", "what happened in a thing over time"],
3277
3305
  ["scheduled", "what is scheduled to happen"],
@@ -3344,11 +3372,12 @@ var VOCABULARY = defineVocabulary({
3344
3372
  ...MAIL_FLAGS,
3345
3373
  ...KNOWLEDGE_FLAGS,
3346
3374
  ...CRM_FLAGS,
3347
- ...SCHEDULE_FLAGS
3375
+ ...SCHEDULE_FLAGS,
3376
+ ...CONTENT_FLAGS
3348
3377
  ]
3349
3378
  });
3350
3379
 
3351
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3380
+ // node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3352
3381
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3353
3382
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3354
3383
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3519,7 +3548,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3519
3548
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3520
3549
  const lend = ctx.connection;
3521
3550
  let borrowed;
3522
- let answered2 = false;
3551
+ let answered = false;
3523
3552
  let result;
3524
3553
  let failure;
3525
3554
  const streams = captureStreams();
@@ -3541,7 +3570,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3541
3570
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3542
3571
  agent: {
3543
3572
  result: /* @__PURE__ */ __name((value) => {
3544
- answered2 = true;
3573
+ answered = true;
3545
3574
  result = value;
3546
3575
  }, "result"),
3547
3576
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3563,7 +3592,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3563
3592
  }));
3564
3593
  if (failure)
3565
3594
  return { error: failure };
3566
- if (answered2)
3595
+ if (answered)
3567
3596
  return { result };
3568
3597
  if (code !== 0)
3569
3598
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3575,468 +3604,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3575
3604
  }
3576
3605
  }, "runCommandForAgent");
3577
3606
 
3578
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/mcp/tool.js
3579
- var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
3580
- var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
3581
- var message = pipe(
3582
- string(),
3583
- maxLength(256),
3584
- // biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
3585
- regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
3586
- description("message id")
3587
- );
3588
- var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
3589
- var WRITE = {
3590
- readOnlyHint: false,
3591
- destructiveHint: true,
3592
- idempotentHint: false,
3593
- openWorldHint: true
3594
- };
3595
- var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
3596
- var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
3597
- var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
3598
- if (definition.annotations.readOnlyHint === true)
3599
- return "read";
3600
- if (/^admin|_admin/.test(key2))
3601
- return "admin";
3602
- if (/delete|ban|kick|remove|purge|block/.test(key2))
3603
- return "destructive";
3604
- if (/draft/.test(key2))
3605
- return "draft";
3606
- if (key2 === "messages_pin" && messenger?.quietPins === false)
3607
- return "write-public";
3608
- if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
3609
- return "write-private";
3610
- return "write-public";
3611
- }, "tierOf");
3612
- var effectsOf = /* @__PURE__ */ __name((definition) => {
3613
- if (definition.effects)
3614
- return definition.effects;
3615
- const { readOnlyHint, openWorldHint } = definition.annotations;
3616
- if (readOnlyHint === true)
3617
- return { remote: openWorldHint === false ? "none" : "read", local: "read" };
3618
- return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
3619
- }, "effectsOf");
3620
- var outcomeOf = /* @__PURE__ */ __name((result) => {
3621
- if (!result.isError)
3622
- return { status: "ok" };
3623
- const code = result.structuredContent?.error?.code;
3624
- const error = typeof code === "string" ? code : "generic_failure";
3625
- return { status: error === "permission_error" ? "refused" : "failed", error };
3626
- }, "outcomeOf");
3627
- var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
3628
- var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
3629
- 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");
3630
- var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
3631
- const permissions = defaults.settings.permissions ?? {};
3632
- const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
3633
- return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
3634
- }, "syncAllowedFor");
3635
- var entryRunner = /* @__PURE__ */ __name((registration) => {
3636
- const run = callRunner(registration);
3637
- const { log } = registration;
3638
- return async (key2, definition, args, ctx) => {
3639
- const startedAt = Date.now();
3640
- const command = `mcp ${commandOf(key2, definition)}`;
3641
- const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
3642
- const app = registration.messenger?.app;
3643
- const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
3644
- const env = registration.defaults.env ?? process.env;
3645
- const settings = registration.defaults.settings;
3646
- const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
3647
- app,
3648
- command,
3649
- ...settings.profile === void 0 ? {} : { profile: settings.profile },
3650
- env,
3651
- record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
3652
- keepFailed: true,
3653
- trace: false,
3654
- format: "json",
3655
- context: runContextOf({ bin: app.command, command, env, caller }),
3656
- ...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
3657
- ...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
3658
- ...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
3659
- ...traceId === void 0 ? {} : { traceId }
3660
- }) : void 0;
3661
- const profile = registration.defaults.settings.profile;
3662
- const scope = {
3663
- runId: recording?.runId ?? newRunId(new Date(startedAt), command),
3664
- command,
3665
- startedAt,
3666
- ...profile === void 0 ? {} : { profile },
3667
- ...traceId === void 0 ? {} : { traceId },
3668
- ...recording ? { events: recording.events } : {}
3669
- };
3670
- const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
3671
- const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
3672
- const parsed = safeParse(input, args);
3673
- return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
3674
- arguments: toJsonSchema(input)
3675
- }), app?.errors);
3676
- }), "work");
3677
- const result = await (caller ? withCaller(caller, work) : work());
3678
- if (recording) {
3679
- if (result.isError) {
3680
- const error = result.structuredContent?.error;
3681
- const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
3682
- await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
3683
- } else
3684
- await recording.succeed(result.structuredContent).catch(() => void 0);
3685
- }
3686
- await log?.({
3687
- tool: key2,
3688
- tier: tierOf(key2, definition, registration.messenger),
3689
- ...outcomeOf(result),
3690
- startedAt,
3691
- finishedAt: Date.now()
3692
- }, caller)?.catch(() => void 0);
3693
- return result;
3694
- };
3695
- }, "entryRunner");
3696
- var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
3697
- const where = {
3698
- profile: defaults.settings.profile,
3699
- env: defaults.env,
3700
- pictures: defaults.settings.pictureSearch,
3701
- reranker: defaults.settings.searchReranker
3702
- };
3703
- return async (key2, definition, args, ctx) => {
3704
- const path = commandOf(key2, definition).split(" ");
3705
- const run = `mcp ${path.join(" ")}`;
3706
- try {
3707
- const execute = /* @__PURE__ */ __name(async () => {
3708
- const syncAllowed = syncAllowedFor(key2, defaults);
3709
- if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
3710
- throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
3711
- reason: "input.too-large",
3712
- max_bytes: MAX_BUFFERED_INPUT,
3713
- retryable: false
3714
- });
3715
- definition.check?.(args);
3716
- if (definition.changesStore)
3717
- refuseStoreChange(messenger.app, defaults.env);
3718
- refuseLacking(messenger, path);
3719
- for (const permission of readKeysForCommand(path)) {
3720
- if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
3721
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
3722
- }
3723
- if (args.sync_first && !syncAllowed)
3724
- throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
3725
- if (definition.custom) {
3726
- const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
3727
- return answered(result2, definition.outputLimit?.(args, defaults), targets);
3728
- }
3729
- if (definition.local)
3730
- return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
3731
- const { online, stored: local, served } = definition;
3732
- const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
3733
- const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
3734
- name: run
3735
- }) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
3736
- ...storeModeDeps(messenger, store, account, defaults.guard),
3737
- ...where,
3738
- embedders: defaults.embedders
3739
- }), args, defaults, (work) => session.use(run, async (adapter, release) => {
3740
- try {
3741
- return await work(adapter);
3742
- } finally {
3743
- await release();
3744
- }
3745
- })), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
3746
- try {
3747
- return await work(adapter);
3748
- } finally {
3749
- await release();
3750
- }
3751
- })())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
3752
- return answered(result, definition.outputLimit?.(args, defaults), targets);
3753
- }, "execute");
3754
- return around ? await around(key2, definition, execute) : await execute();
3755
- } catch (error) {
3756
- return failed(error, messenger?.app?.errors, effectsOf(definition));
3757
- }
3758
- };
3759
- }, "callRunner");
3760
- var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
3761
- if (!definition.output)
3762
- return looseObject({});
3763
- const entity = ENTITIES[definition.output.entity];
3764
- return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
3765
- }, "outputSchemaOf");
3766
- var Picture = class {
3767
- static {
3768
- __name(this, "Picture");
3769
- }
3770
- bytes;
3771
- mimeType;
3772
- about;
3773
- constructor(bytes, mimeType, about) {
3774
- this.bytes = bytes;
3775
- this.mimeType = mimeType;
3776
- this.about = about;
3777
- }
3778
- };
3779
- var BinaryResource = class {
3780
- static {
3781
- __name(this, "BinaryResource");
3782
- }
3783
- base64;
3784
- mimeType;
3785
- uri;
3786
- about;
3787
- constructor(base64, mimeType, uri, about) {
3788
- this.base64 = base64;
3789
- this.mimeType = mimeType;
3790
- this.uri = uri;
3791
- this.about = about;
3792
- }
3793
- };
3794
- var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
3795
- const bounded = /* @__PURE__ */ __name((result) => {
3796
- if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
3797
- 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 });
3798
- return result;
3799
- }, "bounded");
3800
- if (answer === null || Array.isArray(answer) || typeof answer !== "object")
3801
- throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
3802
- const objectBody = /* @__PURE__ */ __name((value) => {
3803
- const serialized = JSON.parse(agentJson(value));
3804
- if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
3805
- throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
3806
- return serialized;
3807
- }, "objectBody");
3808
- if (answer instanceof BinaryResource) {
3809
- const about = sealed(answer.about);
3810
- return bounded({
3811
- structuredContent: objectBody(about),
3812
- content: [
3813
- { type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
3814
- { type: "text", text: agentJson(about) }
3815
- ]
3816
- });
3817
- }
3818
- if (answer instanceof Picture) {
3819
- const about = sealed(answer.about);
3820
- return bounded({
3821
- structuredContent: objectBody(about),
3822
- content: [
3823
- { type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
3824
- { type: "text", text: agentJson(about) }
3825
- ]
3826
- });
3827
- }
3828
- const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
3829
- return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
3830
- }, "answered");
3831
- var failed = /* @__PURE__ */ __name((error, errors, effects) => {
3832
- const judged = judgedEffects(effects);
3833
- const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
3834
- return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
3835
- }, "failed");
3836
-
3837
- // node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/mcp/surface.js
3838
- import { randomUUID } from "node:crypto";
3839
- var MATCHES = 8;
3840
- var ANSWER = answerSchema();
3841
- var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
3842
- const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
3843
- const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
3844
- return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
3845
- items: optional(array(unknown())),
3846
- item: optional(unknown()),
3847
- page: optional(looseObject({ has_more: boolean() })),
3848
- next,
3849
- missing: optional(array(looseObject({ field: string(), why: string() }))),
3850
- meta
3851
- });
3852
- }, "agentAnswer");
3853
- var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
3854
- const checked = toStandardJsonSchema(ANSWER);
3855
- const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
3856
- return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
3857
- }, "listedAs");
3858
- var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
3859
- 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(" "));
3860
- var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
3861
- var stem = /* @__PURE__ */ __name((word2) => {
3862
- const bare = word2.replace(/'s$/u, "");
3863
- if (bare.length > 4 && bare.endsWith("ies"))
3864
- return `${bare.slice(0, -3)}y`;
3865
- for (const ending of ["ing", "ed", "es", "s"])
3866
- if (bare.length - ending.length >= 3 && bare.endsWith(ending))
3867
- return bare.slice(0, -ending.length);
3868
- return bare;
3869
- }, "stem");
3870
- var sameWord = /* @__PURE__ */ __name((asked, known) => {
3871
- if (asked === known)
3872
- return true;
3873
- const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
3874
- return short.length >= 3 && long.startsWith(short);
3875
- }, "sameWord");
3876
- var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
3877
- [4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
3878
- [2, wordsOf(one.title)],
3879
- [1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
3880
- ].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
3881
- var search = /* @__PURE__ */ __name((commands, query) => {
3882
- const named = normal(query);
3883
- const all = Object.entries(commands);
3884
- if (!named)
3885
- return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
3886
- const words = [
3887
- ...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
3888
- ];
3889
- return all.map((entry) => {
3890
- const fields = fieldsOf2(entry[0], entry[1]);
3891
- const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
3892
- const matched = weights.filter((weight) => weight > 0).length;
3893
- const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
3894
- return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
3895
- }).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
3896
- }, "search");
3897
- var nearest = /* @__PURE__ */ __name((commands, asked) => {
3898
- const words = normal(asked).split(" ");
3899
- 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);
3900
- }, "nearest");
3901
- var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
3902
- const body = result.structuredContent;
3903
- if (result.isError || !Array.isArray(body?.next))
3904
- return result;
3905
- const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
3906
- const { next: _, ...rest } = body;
3907
- const kept = next.length > 0 ? { ...rest, next } : rest;
3908
- return {
3909
- ...result,
3910
- structuredContent: kept,
3911
- content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
3912
- };
3913
- }, "runnableOnly");
3914
- var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
3915
- var sampleOf = /* @__PURE__ */ __name((commands) => {
3916
- const reading = Object.entries(commands).filter(([, one]) => !one.writes);
3917
- const bare = reading.filter(([, one]) => takesNothing(one));
3918
- return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
3919
- }, "sampleOf");
3920
- var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
3921
- const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
3922
- const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
3923
- const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
3924
- const sample = messenger ? "messages list" : sampleOf(commands);
3925
- const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
3926
- server.registerTool(`${prefix}_tools_search`, {
3927
- outputSchema: toStandardJsonSchema(looseObject({})),
3928
- title: "Find a command",
3929
- 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.`,
3930
- inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
3931
- annotations: { ...READ, openWorldHint: false, idempotentHint: true }
3932
- }, async ({ query }) => {
3933
- const found = search(commands, query ?? "");
3934
- const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
3935
- command,
3936
- title: one.title,
3937
- description: one.description,
3938
- writes: one.writes,
3939
- availability: one.availability?.() ?? { available: true },
3940
- arguments: toJsonSchema(one.input),
3941
- output: toJsonSchema(one.output ?? ANSWER)
3942
- })) : found.map(([command, one]) => ({
3943
- command,
3944
- title: one.title,
3945
- writes: one.writes,
3946
- availability: one.availability?.() ?? { available: true }
3947
- }));
3948
- const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
3949
- items,
3950
- limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
3951
- has_more: found.length > items.length
3952
- });
3953
- return answered(list);
3954
- });
3955
- const callers = {
3956
- env: process.env,
3957
- client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
3958
- connectionId: randomUUID()
3959
- };
3960
- const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
3961
- try {
3962
- const command = byNormal.get(normal(asked));
3963
- const one = command === void 0 ? void 0 : commands[command];
3964
- if (command === void 0 || !one) {
3965
- withheld?.(normal(asked));
3966
- const near = nearest(commands, asked);
3967
- 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`);
3968
- }
3969
- if (one.writes !== writing)
3970
- throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
3971
- const args = writing ? agentArguments(given ?? {}) : given ?? {};
3972
- const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
3973
- if (one.checked)
3974
- return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
3975
- const parsed = safeParse(strictObject(one.input.entries), args);
3976
- if (!parsed.success)
3977
- throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
3978
- arguments: toJsonSchema(one.input)
3979
- });
3980
- return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
3981
- } catch (error) {
3982
- return failed(error, errors);
3983
- }
3984
- }, "runner");
3985
- const call = strictObject({
3986
- command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
3987
- arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
3988
- });
3989
- server.registerTool(`${prefix}_read`, {
3990
- outputSchema: listedAs(prefix, false),
3991
- title: "Run a reading command",
3992
- description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
3993
- inputSchema: toStandardJsonSchema(call),
3994
- annotations: READ
3995
- }, runner(false));
3996
- if (Object.values(commands).some((one) => one.writes))
3997
- server.registerTool(`${prefix}_write`, {
3998
- outputSchema: listedAs(prefix, true),
3999
- title: "Run a writing command",
4000
- 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}`,
4001
- inputSchema: toStandardJsonSchema(call),
4002
- annotations: WRITE
4003
- }, runner(true));
4004
- }, "registerCommands");
4005
- var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
4006
- const run = entryRunner(registration);
4007
- return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
4008
- commandOf(key2, definition),
4009
- {
4010
- title: definition.title,
4011
- description: definition.description,
4012
- writes: definition.annotations.readOnlyHint !== true,
4013
- input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
4014
- ...definition.output ? { output: outputSchemaOf(definition) } : {},
4015
- checked: true,
4016
- run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
4017
- }
4018
- ]));
4019
- }, "surfaceCommands");
4020
- var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
4021
-
4022
3607
  export {
4023
3608
  toolsFromCommands,
4024
- runCommandForAgent,
4025
- message,
4026
- READ,
4027
- WRITE,
4028
- tool,
4029
- chatOf,
4030
- tierOf,
4031
- outcomeOf,
4032
- commandOf,
4033
- toolKey,
4034
- Picture,
4035
- BinaryResource,
4036
- answered,
4037
- failed,
4038
- normal,
4039
- registerCommands,
4040
- surfaceCommands,
4041
- outputOf
3609
+ runCommandForAgent
4042
3610
  };