@wirecat/notion-cli 0.5.0 → 0.7.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 (241) hide show
  1. package/CHANGELOG.md +47 -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-AILW4JPO.js +42 -0
  6. package/dist/bundle/{all-profiles-V37KCXH3.js → all-profiles-CKOACXTW.js} +64 -21
  7. package/dist/bundle/{anthropic-Q4S3BYXD.js → anthropic-DWBBVTU3.js} +6 -6
  8. package/dist/bundle/{app-server-43SR3ACI.js → app-server-BHFYNCDE.js} +86 -65
  9. package/dist/bundle/{bun-M3J2QTR3.js → bun-ICK2XT7J.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-EJ3W2PSV.js → bun-sqlite-LU5V5Y4A.js} +7 -7
  11. package/dist/bundle/{chunk-KHWOLBHQ.js → chunk-2OZVCNU5.js} +2 -2
  12. package/dist/bundle/{chunk-O5YB7FQD.js → chunk-2RNJ2JP3.js} +4 -4
  13. package/dist/bundle/{chunk-TP7GDWVF.js → chunk-364ET7LV.js} +1 -1
  14. package/dist/bundle/{chunk-TDNURSU6.js → chunk-3AKMIKND.js} +19 -19
  15. package/dist/bundle/{chunk-O3DYRCIT.js → chunk-3DGHBXH2.js} +1 -1
  16. package/dist/bundle/chunk-3KOJNZH3.js +80 -0
  17. package/dist/bundle/{chunk-DSP36YHQ.js → chunk-3T3OAYL4.js} +2 -2
  18. package/dist/bundle/{chunk-W7HM2VGO.js → chunk-3YXYA6HB.js} +1 -1
  19. package/dist/bundle/chunk-3ZSUVFR7.js +398 -0
  20. package/dist/bundle/{chunk-GCZ6MAEN.js → chunk-46JBCXLI.js} +43 -64
  21. package/dist/bundle/{chunk-DB2XKHI4.js → chunk-4FHKSSXQ.js} +2 -2
  22. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  23. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  24. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  25. package/dist/bundle/{chunk-BNEE35WD.js → chunk-5NFIUY2P.js} +4 -4
  26. package/dist/bundle/{chunk-E5WLE7BM.js → chunk-63SW4UXG.js} +3 -4
  27. package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-64IK7JFO.js} +2 -2
  28. package/dist/bundle/{chunk-HZRQLAHO.js → chunk-6MQSBWWF.js} +1 -1
  29. package/dist/bundle/{chunk-2FJNMADN.js → chunk-6UZ5D2WP.js} +10 -10
  30. package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
  31. package/dist/bundle/chunk-7COTHS6G.js +388 -0
  32. package/dist/bundle/{chunk-TOSCB4SO.js → chunk-A3RJ6FD5.js} +29 -10
  33. package/dist/bundle/chunk-ADCAWRRX.js +2366 -0
  34. package/dist/bundle/{chunk-PPHBRESD.js → chunk-ALAPDLCP.js} +2 -2
  35. package/dist/bundle/{chunk-ONZVPE24.js → chunk-B6DJQBZI.js} +6 -6
  36. package/dist/bundle/{chunk-N2XADGL4.js → chunk-BFCRGLOF.js} +4 -4
  37. package/dist/bundle/{chunk-5P5TXU2K.js → chunk-BFHPT67P.js} +9581 -10764
  38. package/dist/bundle/{chunk-NA6QLHBZ.js → chunk-BQ6CXCLP.js} +10 -8
  39. package/dist/bundle/{chunk-JCKWQGCD.js → chunk-BXXHUO7Y.js} +110 -862
  40. package/dist/bundle/chunk-DCSPCOPB.js +221 -0
  41. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  42. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  43. package/dist/bundle/chunk-EMIJVLOA.js +30 -0
  44. package/dist/bundle/{chunk-DFCHHR5M.js → chunk-EUF5JNPG.js} +1 -1
  45. package/dist/bundle/{chunk-RIGE67FR.js → chunk-EWXMIKZN.js} +43 -33
  46. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  47. package/dist/bundle/{chunk-QYXWRKNA.js → chunk-FHYV4VWY.js} +16 -9
  48. package/dist/bundle/{chunk-WE4UFASG.js → chunk-FNESLLZS.js} +29 -1
  49. package/dist/bundle/chunk-FO3XY2Y2.js +108 -0
  50. package/dist/bundle/chunk-HJDQTM3T.js +353 -0
  51. package/dist/bundle/chunk-HOO53OYK.js +561 -0
  52. package/dist/bundle/{chunk-KHZ2RGXI.js → chunk-HSVKU4OJ.js} +153 -572
  53. package/dist/bundle/{chunk-CDK5E45T.js → chunk-IEY7KS6Q.js} +2 -100
  54. package/dist/bundle/{chunk-RJMQGG3P.js → chunk-ITW26OBI.js} +65 -49
  55. package/dist/bundle/{chunk-FBZI4Z3Z.js → chunk-ITWINZ6R.js} +13 -26
  56. package/dist/bundle/{chunk-J3NKZ6MO.js → chunk-IYZWHCZJ.js} +155 -435
  57. package/dist/bundle/{chunk-W53EJOFQ.js → chunk-J3DZVB67.js} +1 -1
  58. package/dist/bundle/{chunk-FKA7DOCK.js → chunk-JEZJFQQW.js} +1 -1
  59. package/dist/bundle/chunk-JPGN473W.js +50 -0
  60. package/dist/bundle/{chunk-NTG657MI.js → chunk-JVRBW5LH.js} +7 -64
  61. package/dist/bundle/chunk-KBY42GKW.js +785 -0
  62. package/dist/bundle/{chunk-DO7BLXO3.js → chunk-KWBLDSRV.js} +16 -3
  63. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  64. package/dist/bundle/{chunk-PWRRDDMZ.js → chunk-LBRTLZHI.js} +249 -555
  65. package/dist/bundle/{chunk-B3FSLAIU.js → chunk-LEPPRULN.js} +20 -6
  66. package/dist/bundle/{chunk-WPP76PSX.js → chunk-LVAFTQ45.js} +32 -24
  67. package/dist/bundle/{chunk-PAW6RRCW.js → chunk-MB4HXDBT.js} +8 -210
  68. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  69. package/dist/bundle/{chunk-UZSBGECU.js → chunk-N3NJPHZB.js} +1 -65
  70. package/dist/bundle/{chunk-BWLBSQSU.js → chunk-NCCRLAAI.js} +4 -4
  71. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  72. package/dist/bundle/{chunk-H3E2PZ5Y.js → chunk-NV7NNL5T.js} +7 -7
  73. package/dist/bundle/chunk-OALFRUMI.js +67 -0
  74. package/dist/bundle/{chunk-CWXOXIWS.js → chunk-OCGNOJYD.js} +1 -1
  75. package/dist/bundle/chunk-OFMCU3BH.js +72 -0
  76. package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
  77. package/dist/bundle/{chunk-E2AFUJDR.js → chunk-OP2BH55P.js} +3 -3
  78. package/dist/bundle/{chunk-P5BHKKBI.js → chunk-OS4WPXPZ.js} +4 -4
  79. package/dist/bundle/{chunk-XUPN2EHR.js → chunk-OW5HW3TD.js} +23 -7
  80. package/dist/bundle/{chunk-ECC2UX7X.js → chunk-PDVXG3T3.js} +6 -6
  81. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  82. package/dist/bundle/{chunk-G2MJYXZG.js → chunk-PSMRUOII.js} +4 -4
  83. package/dist/bundle/{chunk-DBEQI5YM.js → chunk-QK52ARAU.js} +3 -3
  84. package/dist/bundle/{chunk-QWYMXFKM.js → chunk-QMNEDK7Z.js} +3 -3
  85. package/dist/bundle/chunk-R4JV3VLU.js +714 -0
  86. package/dist/bundle/{chunk-C32AKHTY.js → chunk-REOBWSGV.js} +35 -12
  87. package/dist/bundle/{chunk-X2M6NIQG.js → chunk-RNVYNPXT.js} +1 -1
  88. package/dist/bundle/{chunk-HHVFIXDO.js → chunk-RXGX2CZX.js} +399 -399
  89. package/dist/bundle/{chunk-W5JZMXGW.js → chunk-S35UJBFZ.js} +75 -75
  90. package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
  91. package/dist/bundle/chunk-S5P7THM5.js +72 -0
  92. package/dist/bundle/{chunk-NE43YXKL.js → chunk-SRVTGI3M.js} +3 -3
  93. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  94. package/dist/bundle/chunk-TWY543BS.js +39 -0
  95. package/dist/bundle/{chunk-KFVDL2QS.js → chunk-UC7JLE6J.js} +1 -89
  96. package/dist/bundle/{chunk-3RL2MIUF.js → chunk-UO4O6WQ4.js} +8 -8
  97. package/dist/bundle/chunk-UPL474OW.js +94 -0
  98. package/dist/bundle/chunk-UQVUXG7H.js +594 -0
  99. package/dist/bundle/chunk-UYEDQGMI.js +340 -0
  100. package/dist/bundle/chunk-VNWF4I7E.js +34 -0
  101. package/dist/bundle/{chunk-FPUGMDJV.js → chunk-VRBEYOJL.js} +1 -1
  102. package/dist/bundle/{chunk-BBSFQ3PU.js → chunk-VXKD533R.js} +1646 -1337
  103. package/dist/bundle/{chunk-ECEZOLOD.js → chunk-VYZ2J7DT.js} +4 -4
  104. package/dist/bundle/{chunk-TD2JZ25O.js → chunk-WJFQMOVM.js} +113 -80
  105. package/dist/bundle/{chunk-MNRMKWCN.js → chunk-WUNEJRLJ.js} +6 -6
  106. package/dist/bundle/chunk-WVN2KTNS.js +52 -0
  107. package/dist/bundle/{chunk-GTY6N5KZ.js → chunk-X5LUHN62.js} +2 -2
  108. package/dist/bundle/{chunk-LBYGJKXW.js → chunk-X737FHZP.js} +4 -4
  109. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  110. package/dist/bundle/chunk-YSF5JBRA.js +36 -0
  111. package/dist/bundle/{chunk-QIG55MZH.js → chunk-ZGUUP2T3.js} +12 -12
  112. package/dist/bundle/{chunk-AT5I34AN.js → chunk-ZMKAI3F3.js} +3 -3
  113. package/dist/bundle/command-contract-C2CF4QAH.js +41 -0
  114. package/dist/bundle/{command-server-entry-LJ627ZUA.js → command-server-entry-F3B2KSPO.js} +30 -27
  115. package/dist/bundle/{decode-PX2LZ5Y2.js → decode-FDHFF7GC.js} +6 -6
  116. package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
  117. package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-IXKG5Z5Y.js} +8 -8
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/{echarts-FVTUDXDU.js → echarts-PGJPVPA4.js} +2 -2
  120. package/dist/bundle/{embed-CCSDK43I.js → embed-U6X7CNNK.js} +7 -7
  121. package/dist/bundle/{embedder-VHI4DHB7.js → embedder-3ROL6ROQ.js} +10 -10
  122. package/dist/bundle/{failure-FZ6VYKEQ.js → failure-IYMRXM2X.js} +3 -3
  123. package/dist/bundle/first-run-PNVNHGR7.js +29 -0
  124. package/dist/bundle/first-screen-DEDD64YH.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-HET7BCYK.js → instructions-MJQWRI2D.js} +1 -1
  129. package/dist/bundle/{mcp-RGNRW77S.js → mcp-JNHOSK4L.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-HEC25QPY.js +25 -0
  135. package/dist/bundle/meeting-model-R7QPDNZZ.js +27 -0
  136. package/dist/bundle/{meeting-semantic-UD26T37N.js → meeting-semantic-7WPLMBNT.js} +7 -7
  137. package/dist/bundle/{micromark-extension-gfm-5X7YT43T.js → micromark-extension-gfm-PQ7DWZM7.js} +12 -78
  138. package/dist/bundle/{node-CXZIFHZC.js → node-3UXNV3CD.js} +2 -2
  139. package/dist/bundle/{node-sqlite-ME7KMORI.js → node-sqlite-ULWDWM3I.js} +8 -8
  140. package/dist/bundle/notes-search-7PE3E3C7.js +64 -0
  141. package/dist/bundle/notion.js +14 -14
  142. package/dist/bundle/oauth-LNUZMA72.js +20 -0
  143. package/dist/bundle/{open-HA6D3SXR.js → open-HGHC35M4.js} +6 -6
  144. package/dist/bundle/{openai-H5AJPZBX.js → openai-ISSP57MV.js} +21 -18
  145. package/dist/bundle/{process-5RUXWGYS.js → process-PB2WCOR2.js} +1 -1
  146. package/dist/bundle/{program-F3NBTZ7J.js → program-GASBJRMG.js} +7574 -7047
  147. package/dist/bundle/{prompt-6XSUOLHK.js → prompt-3VGQVX2B.js} +6 -6
  148. package/dist/bundle/{recognize-2Y7AUVGG.js → recognize-7Q2P3NME.js} +5 -5
  149. package/dist/bundle/{remote-KCABPXQ3.js → remote-BBAWKVIT.js} +12 -11
  150. package/dist/bundle/{rerank-BTN7LUVA.js → rerank-H4PUS4HV.js} +8 -8
  151. package/dist/bundle/{schemas-VVLTLMXS.js → schemas-TTVUADHT.js} +39 -60
  152. package/dist/bundle/{serve-CYEMVRFC.js → serve-FZNSKY7R.js} +11 -11
  153. package/dist/bundle/{server-WFIICGMI.js → server-BRRNDW6L.js} +78 -56
  154. package/dist/bundle/server-CQJ4LKAZ.js +90 -0
  155. package/dist/bundle/{services-L4W6ZWDG.js → services-PEU557KZ.js} +103 -88
  156. package/dist/bundle/{sqlite-runtime-IKMYLRQC.js → sqlite-runtime-4IZJ4YUM.js} +7 -7
  157. package/dist/bundle/{state-LMUP636P.js → state-MX3JVT5Q.js} +7 -7
  158. package/dist/bundle/{store-W2JC2JP4.js → store-JUT34REM.js} +24 -20
  159. package/dist/bundle/{store-A2QZFBOX.js → store-PP4BPADZ.js} +30 -18
  160. package/dist/bundle/store-maintenance-command-GRFTJBSB.js +77 -0
  161. package/dist/bundle/surface-FPWES3NY.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 -141
  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 +14 -6
  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/context.d.ts +11 -3
  178. package/dist/context.d.ts.map +1 -1
  179. package/dist/context.js +20 -7
  180. package/dist/context.js.map +1 -1
  181. package/dist/generated/definitions.d.ts.map +1 -1
  182. package/dist/generated/definitions.js +72 -18
  183. package/dist/generated/definitions.js.map +1 -1
  184. package/dist/generated/manifest.d.ts.map +1 -1
  185. package/dist/generated/manifest.js +49 -0
  186. package/dist/generated/manifest.js.map +1 -1
  187. package/dist/generated/schemas.d.ts.map +1 -1
  188. package/dist/generated/schemas.js +32 -32
  189. package/dist/generated/schemas.js.map +1 -1
  190. package/dist/generated/types.d.ts +125 -25
  191. package/dist/generated/types.d.ts.map +1 -1
  192. package/dist/generated/wirecat-config.d.ts +13 -0
  193. package/dist/generated/wirecat-config.d.ts.map +1 -0
  194. package/dist/generated/wirecat-config.js +82 -0
  195. package/dist/generated/wirecat-config.js.map +1 -0
  196. package/dist/library.d.ts +3 -0
  197. package/dist/library.d.ts.map +1 -1
  198. package/dist/library.js +11 -1
  199. package/dist/library.js.map +1 -1
  200. package/dist/notion/client.d.ts +2 -6
  201. package/dist/notion/client.d.ts.map +1 -1
  202. package/dist/notion/client.js +7 -8
  203. package/dist/notion/client.js.map +1 -1
  204. package/dist/notion/errors.d.ts +5 -0
  205. package/dist/notion/errors.d.ts.map +1 -1
  206. package/dist/notion/errors.js +21 -1
  207. package/dist/notion/errors.js.map +1 -1
  208. package/dist/notion/port.d.ts +10 -0
  209. package/dist/notion/port.d.ts.map +1 -1
  210. package/dist/notion/port.js +19 -0
  211. package/dist/notion/port.js.map +1 -1
  212. package/dist/program.d.ts.map +1 -1
  213. package/dist/program.js +2 -0
  214. package/dist/program.js.map +1 -1
  215. package/dist/sync/files.d.ts +12 -0
  216. package/dist/sync/files.d.ts.map +1 -1
  217. package/dist/sync/files.js.map +1 -1
  218. package/dist/sync/from-config.d.ts +13 -0
  219. package/dist/sync/from-config.d.ts.map +1 -0
  220. package/dist/sync/from-config.js +32 -0
  221. package/dist/sync/from-config.js.map +1 -0
  222. package/dist/sync/source.d.ts +2 -1
  223. package/dist/sync/source.d.ts.map +1 -1
  224. package/dist/sync/source.js +48 -48
  225. package/dist/sync/source.js.map +1 -1
  226. package/dist/sync/users.d.ts +4 -1
  227. package/dist/sync/users.d.ts.map +1 -1
  228. package/dist/sync/users.js +3 -1
  229. package/dist/sync/users.js.map +1 -1
  230. package/dist/version.d.ts +1 -1
  231. package/dist/version.js +1 -1
  232. package/package.json +8 -8
  233. package/dist/bundle/chunk-6EOZTUHT.js +0 -726
  234. package/dist/bundle/command-contract-TVRFW2IX.js +0 -38
  235. package/dist/bundle/first-run-7JKE5AHN.js +0 -29
  236. package/dist/bundle/first-screen-ZROHOEYJ.js +0 -38
  237. package/dist/bundle/meeting-combined-SSTOJUIJ.js +0 -24
  238. package/dist/bundle/meeting-model-K7TPS4S5.js +0 -26
  239. package/dist/bundle/oauth-XBTROXHB.js +0 -20
  240. package/dist/bundle/server-UC2FNNXX.js +0 -72
  241. package/dist/bundle/store-maintenance-command-LRGQJPSZ.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-J3NKZ6MO.js";
4
+ commandAvailability
5
+ } from "./chunk-JPGN473W.js";
11
6
  import {
12
- callerOf
13
- } from "./chunk-CDK5E45T.js";
7
+ lentConnection
8
+ } from "./chunk-UYEDQGMI.js";
14
9
  import {
15
- lentConnection,
16
- refuseLacking
17
- } from "./chunk-6EOZTUHT.js";
10
+ QUERY_ARGUMENT
11
+ } from "./chunk-R4JV3VLU.js";
18
12
  import {
19
- MAX_BUFFERED_INPUT
20
- } from "./chunk-PPHBRESD.js";
21
- import {
22
- QUERY_ARGUMENT,
23
- onlineDeps,
24
- servicesFor,
25
- storeModeDeps
26
- } from "./chunk-5P5TXU2K.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-PWRRDDMZ.js";
16
+ flatten
17
+ } from "./chunk-LBRTLZHI.js";
48
18
  import {
49
- currentCaller,
50
- keepsSuccess,
51
- runContextOf,
52
- withCaller
53
- } from "./chunk-NA6QLHBZ.js";
19
+ currentCaller
20
+ } from "./chunk-BQ6CXCLP.js";
54
21
  import {
55
22
  enclosingTraceId,
56
23
  inRun,
57
24
  newRunId,
58
25
  traceOf
59
- } from "./chunk-JCKWQGCD.js";
60
- import {
61
- storeDamaged
62
- } from "./chunk-UZSBGECU.js";
26
+ } from "./chunk-BXXHUO7Y.js";
63
27
  import {
64
28
  queryDescription
65
- } from "./chunk-HHVFIXDO.js";
29
+ } from "./chunk-RXGX2CZX.js";
66
30
  import {
67
- captureStreams,
68
- traceIdOf
69
- } from "./chunk-W5JZMXGW.js";
31
+ captureStreams
32
+ } from "./chunk-S35UJBFZ.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-TOSCB4SO.js";
42
+ } from "./chunk-A3RJ6FD5.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-DB2XKHI4.js";
65
+ CliError
66
+ } from "./chunk-4FHKSSXQ.js";
115
67
  import {
116
68
  __name
117
69
  } from "./chunk-ZVVMGPBJ.js";
118
70
 
119
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/agent.js
71
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typ_cfff6f86942c54bd7564e982a7834a83/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.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
74
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
220
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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,28 +357,60 @@ var PARITY_GROUPS = defineParityGroups([
396
357
  },
397
358
  // bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
398
359
  // recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
399
- // amo-cli shares them too, and its CRM commands are compared with b24 in `crm` below.
400
- // notion-cli joins here until its documents commands ship; then it moves next to drive.
360
+ // amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
361
+ // wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
362
+ // linear-cli shares only these roots too: it is the first tracker CLI, so its issues commands have no group yet.
363
+ // notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
364
+ // its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
365
+ // and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
401
366
  {
402
367
  name: "shared-roots",
403
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion", "amo"],
368
+ members: [
369
+ "tg",
370
+ "max",
371
+ "memo",
372
+ "drive",
373
+ "zm",
374
+ "wa",
375
+ "b24",
376
+ "beeline",
377
+ "pbx",
378
+ "notion",
379
+ "amo",
380
+ "hubspot",
381
+ "attio",
382
+ "ydisk",
383
+ "wordpress",
384
+ "linear"
385
+ ],
404
386
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
405
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
387
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
406
388
  },
407
- // The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet, so `audit --family`
408
- // skips it, as beeline. Only b24 has `leads` (amoCRM has no lead apart from a deal), `products` (amo leaves them for
409
- // later) and `deals delete` (amoCRM's API v4 cannot delete a lead,
410
- // https://www.amocrm.ru/developers/content/crm_platform/leads-api); a list of roots does not compare presence, so
411
- // these need no difference. `people`, `organizations`, `users`, `api` and `session` join once b24's released tree
412
- // is on cli-core's shared people and organizations commands: measured against b24 0.23.0 on 2026-11-16 they differ
413
- // in options, outputs and summaries.
389
+ // The CRM CLIs on cli-core's shared CRM commands. hubspot-cli is not in the family packages, so `audit --family`
390
+ // skips it, as beeline. Only b24 and hubspot have `leads` (amoCRM
391
+ // has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
392
+ // API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
393
+ // no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
394
+ // `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
395
+ // commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
414
396
  {
415
397
  name: "crm",
416
- members: ["b24", "amo"],
398
+ members: ["b24", "amo", "hubspot", "attio"],
417
399
  covers: ["deals", "sync", "search", "store", "schedule", "account"],
418
- differences: []
400
+ differences: [
401
+ {
402
+ rule: "same-path-contract",
403
+ target: "schedule: summary",
404
+ differs: "hubspot",
405
+ reason: "cli-core cuts the summary to a fixed width after it puts in the CLI's name (src/cli/help/commands-text.ts), so hubspot's longer name ends it a word earlier than b24's and amo's",
406
+ review_after: "2026-12-01"
407
+ }
408
+ ]
419
409
  }
420
410
  ]);
411
+ var SHARED_DIFFERENCES = [
412
+ ...new Map(PARITY_GROUPS.flatMap((group) => group.differences).filter((entry) => entry.rule === "same-entity-schema" || entry.rule === "same-error-reason").map((entry) => [`${entry.rule} ${entry.target}`, entry])).values()
413
+ ];
421
414
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
422
415
  var defineRequiredRoots = /* @__PURE__ */ __name((input) => parseRegistry("required roots", array(requiredRootSchema), input, (roots2) => duplicates(roots2.map((root) => root.path.join(" "))).map((path) => `"${path}" is listed twice`)), "defineRequiredRoots");
423
416
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -429,7 +422,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
429
422
  { path: ["upgrade"], meaning: "updates the CLI" }
430
423
  ]);
431
424
 
432
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
425
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
433
426
  var fieldRuleSchema = strictObject({ id: word, rule: text });
434
427
  var defineFieldRules = /* @__PURE__ */ __name((input) => parseRegistry("output field rules", array(fieldRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineFieldRules");
435
428
  var FIELD_RULES = defineFieldRules([
@@ -445,7 +438,7 @@ var FIELD_RULES = defineFieldRules([
445
438
  }
446
439
  ]);
447
440
 
448
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
441
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
449
442
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
450
443
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
451
444
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -467,7 +460,7 @@ var IDENTIFIERS = defineIdentifiers([
467
460
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
468
461
  ]);
469
462
 
470
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
463
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
471
464
  var ACCOUNT_FLAGS = [
472
465
  {
473
466
  name: "--client-id",
@@ -504,7 +497,7 @@ var ACCOUNT_FLAGS = [
504
497
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
505
498
  ];
506
499
 
507
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
500
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
508
501
  var CALENDAR_FLAGS = [
509
502
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
510
503
  {
@@ -592,7 +585,25 @@ var CALENDAR_FLAGS = [
592
585
  }
593
586
  ];
594
587
 
595
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
588
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
589
+ var CONTENT_FLAGS = [
590
+ { name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
591
+ {
592
+ name: "--tags",
593
+ value: "<ids>",
594
+ role: "value",
595
+ type: "list",
596
+ meaning: "its tags and categories, by comma-separated ids; replaces the ones it has"
597
+ },
598
+ {
599
+ name: "--replace-body",
600
+ role: "mode",
601
+ type: "switch",
602
+ meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show"
603
+ }
604
+ ];
605
+
606
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
596
607
  var CRM_FLAGS = [
597
608
  {
598
609
  name: "--email",
@@ -756,7 +767,7 @@ var CRM_FLAGS = [
756
767
  }
757
768
  ];
758
769
 
759
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
770
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
760
771
  var HOW_FLAGS = [
761
772
  {
762
773
  name: "--limit",
@@ -1136,13 +1147,7 @@ var HOW_FLAGS = [
1136
1147
  type: "string",
1137
1148
  meaning: "a person whose reply counts as an answer; repeat it for more"
1138
1149
  },
1139
- {
1140
- name: "--browser",
1141
- value: "<program>",
1142
- role: "mode",
1143
- type: "string",
1144
- meaning: "the browser program to open for sign-in"
1145
- },
1150
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1146
1151
  {
1147
1152
  name: "--credential-storage",
1148
1153
  value: "<storage>",
@@ -1151,6 +1156,8 @@ var HOW_FLAGS = [
1151
1156
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1152
1157
  },
1153
1158
  { name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
1159
+ { name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
1160
+ { name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
1154
1161
  {
1155
1162
  name: "--expected-event-id",
1156
1163
  value: "<id>",
@@ -1753,7 +1760,7 @@ var HOW_FLAGS = [
1753
1760
  }
1754
1761
  ];
1755
1762
 
1756
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
1763
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
1757
1764
  var KNOWLEDGE_FLAGS = [
1758
1765
  {
1759
1766
  name: "--accept-terms",
@@ -1789,6 +1796,13 @@ var KNOWLEDGE_FLAGS = [
1789
1796
  meaning: "at most this many characters read",
1790
1797
  unit: "characters"
1791
1798
  },
1799
+ {
1800
+ name: "--tab",
1801
+ value: "<id>",
1802
+ role: "target",
1803
+ type: "id",
1804
+ meaning: "one tab of a document, by its id: only its text is read"
1805
+ },
1792
1806
  {
1793
1807
  name: "--tag",
1794
1808
  value: "<name>",
@@ -1805,7 +1819,7 @@ var KNOWLEDGE_FLAGS = [
1805
1819
  }
1806
1820
  ];
1807
1821
 
1808
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
1822
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
1809
1823
  var MAIL_FLAGS = [
1810
1824
  {
1811
1825
  name: "--cc",
@@ -1835,7 +1849,7 @@ var MAIL_FLAGS = [
1835
1849
  }
1836
1850
  ];
1837
1851
 
1838
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
1852
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
1839
1853
  var PRIVACY_FLAGS = [
1840
1854
  {
1841
1855
  name: "--about-text",
@@ -1896,7 +1910,7 @@ var PRIVACY_FLAGS = [
1896
1910
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1897
1911
  ];
1898
1912
 
1899
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
1913
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
1900
1914
  var SCHEDULE_FLAGS = [
1901
1915
  {
1902
1916
  name: "--locale",
@@ -1929,7 +1943,18 @@ var SCHEDULE_FLAGS = [
1929
1943
  }
1930
1944
  ];
1931
1945
 
1932
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
1946
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
1947
+ var SEARCH_FLAGS = [
1948
+ {
1949
+ name: "--like",
1950
+ value: "<text>",
1951
+ role: "query",
1952
+ type: "string",
1953
+ meaning: "a made-up example of the text sought, such as a reply that would answer the question, searched by meaning beside the query"
1954
+ }
1955
+ ];
1956
+
1957
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
1933
1958
  var WHAT_FLAGS = [
1934
1959
  {
1935
1960
  name: "--analysis-provider",
@@ -2926,7 +2951,7 @@ var WHAT_FLAGS = [
2926
2951
  }
2927
2952
  ];
2928
2953
 
2929
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
2954
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.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
2930
2955
  var FLAG_TYPES = [
2931
2956
  "switch",
2932
2957
  "count",
@@ -3056,6 +3081,10 @@ var verbs = [
3056
3081
  ["export", "write from the store to a file"],
3057
3082
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
3058
3083
  ["download", "save a file from the source to this machine"],
3084
+ ["upload", "put a file from this machine on the source"],
3085
+ ["publish", "open a thing to anyone who has its public link"],
3086
+ ["unpublish", "close a thing's public link"],
3087
+ ["stale", "mark a saved memory as out of date, keeping it"],
3059
3088
  ["transcribe", "turn speech into text"],
3060
3089
  ["extract", "read the text inside files already on this machine into the store"],
3061
3090
  ["migrate", "bring a file up to this build's schema"],
@@ -3152,6 +3181,8 @@ var collections = [
3152
3181
  ["messages", "posts in a messenger chat, or emails"],
3153
3182
  ["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
3154
3183
  ["polls", "polls in a chat"],
3184
+ ["posts", "posts and pages on a site or blog the owner publishes"],
3185
+ ["channels", "the sites and social accounts the owner publishes posts on"],
3155
3186
  ["reactions", "reactions to a message"],
3156
3187
  ["recipients", "who a message goes to"],
3157
3188
  ["replies", "the automatic replies of a profile"],
@@ -3198,6 +3229,10 @@ var collections = [
3198
3229
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3199
3230
  ["splits", "parts of one transaction, each with its own amount and category"],
3200
3231
  ["users", "people who work in the owner's account at a service, such as a CRM's employees"],
3232
+ ["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
3233
+ ["teams", "groups in a tracker that own issues, states and labels"],
3234
+ ["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
3235
+ ["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
3201
3236
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3202
3237
  ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3203
3238
  ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
@@ -3266,6 +3301,10 @@ var singulars = [
3266
3301
  ["privacy", "who may find, see, call or add the account"],
3267
3302
  ["metadata", "a profile's cached source attributes"],
3268
3303
  ["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
3304
+ [
3305
+ "scheduled",
3306
+ "a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
3307
+ ],
3269
3308
  [
3270
3309
  "schedule",
3271
3310
  "a profile's timers the owner saved, each running a command of this tool or an agent; the tool's own background work is jobs"
@@ -3273,6 +3312,7 @@ var singulars = [
3273
3312
  ];
3274
3313
  var views = [
3275
3314
  ["tree", "the parent and child hierarchy of stored sources"],
3315
+ ["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
3276
3316
  ["logs", "the log of a running process"],
3277
3317
  ["events", "what happened in a thing over time"],
3278
3318
  ["scheduled", "what is scheduled to happen"],
@@ -3345,11 +3385,13 @@ var VOCABULARY = defineVocabulary({
3345
3385
  ...MAIL_FLAGS,
3346
3386
  ...KNOWLEDGE_FLAGS,
3347
3387
  ...CRM_FLAGS,
3348
- ...SCHEDULE_FLAGS
3388
+ ...SCHEDULE_FLAGS,
3389
+ ...CONTENT_FLAGS,
3390
+ ...SEARCH_FLAGS
3349
3391
  ]
3350
3392
  });
3351
3393
 
3352
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3394
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typ_cfff6f86942c54bd7564e982a7834a83/node_modules/@wirecat/cli-core/dist/mcp/agent.js
3353
3395
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3354
3396
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3355
3397
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3520,7 +3562,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3520
3562
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3521
3563
  const lend = ctx.connection;
3522
3564
  let borrowed;
3523
- let answered2 = false;
3565
+ let answered = false;
3524
3566
  let result;
3525
3567
  let failure;
3526
3568
  const streams = captureStreams();
@@ -3542,7 +3584,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3542
3584
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3543
3585
  agent: {
3544
3586
  result: /* @__PURE__ */ __name((value) => {
3545
- answered2 = true;
3587
+ answered = true;
3546
3588
  result = value;
3547
3589
  }, "result"),
3548
3590
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3564,7 +3606,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3564
3606
  }));
3565
3607
  if (failure)
3566
3608
  return { error: failure };
3567
- if (answered2)
3609
+ if (answered)
3568
3610
  return { result };
3569
3611
  if (code !== 0)
3570
3612
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3576,468 +3618,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3576
3618
  }
3577
3619
  }, "runCommandForAgent");
3578
3620
 
3579
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/tool.js
3580
- var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
3581
- var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
3582
- var message = pipe(
3583
- string(),
3584
- maxLength(256),
3585
- // biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
3586
- regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
3587
- description("message id")
3588
- );
3589
- var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
3590
- var WRITE = {
3591
- readOnlyHint: false,
3592
- destructiveHint: true,
3593
- idempotentHint: false,
3594
- openWorldHint: true
3595
- };
3596
- var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
3597
- var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
3598
- var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
3599
- if (definition.annotations.readOnlyHint === true)
3600
- return "read";
3601
- if (/^admin|_admin/.test(key2))
3602
- return "admin";
3603
- if (/delete|ban|kick|remove|purge|block/.test(key2))
3604
- return "destructive";
3605
- if (/draft/.test(key2))
3606
- return "draft";
3607
- if (key2 === "messages_pin" && messenger?.quietPins === false)
3608
- return "write-public";
3609
- if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
3610
- return "write-private";
3611
- return "write-public";
3612
- }, "tierOf");
3613
- var effectsOf = /* @__PURE__ */ __name((definition) => {
3614
- if (definition.effects)
3615
- return definition.effects;
3616
- const { readOnlyHint, openWorldHint } = definition.annotations;
3617
- if (readOnlyHint === true)
3618
- return { remote: openWorldHint === false ? "none" : "read", local: "read" };
3619
- return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
3620
- }, "effectsOf");
3621
- var outcomeOf = /* @__PURE__ */ __name((result) => {
3622
- if (!result.isError)
3623
- return { status: "ok" };
3624
- const code = result.structuredContent?.error?.code;
3625
- const error = typeof code === "string" ? code : "generic_failure";
3626
- return { status: error === "permission_error" ? "refused" : "failed", error };
3627
- }, "outcomeOf");
3628
- var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
3629
- var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
3630
- 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");
3631
- var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
3632
- const permissions = defaults.settings.permissions ?? {};
3633
- const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
3634
- return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
3635
- }, "syncAllowedFor");
3636
- var entryRunner = /* @__PURE__ */ __name((registration) => {
3637
- const run = callRunner(registration);
3638
- const { log } = registration;
3639
- return async (key2, definition, args, ctx) => {
3640
- const startedAt = Date.now();
3641
- const command = `mcp ${commandOf(key2, definition)}`;
3642
- const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
3643
- const app = registration.messenger?.app;
3644
- const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
3645
- const env = registration.defaults.env ?? process.env;
3646
- const settings = registration.defaults.settings;
3647
- const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
3648
- app,
3649
- command,
3650
- ...settings.profile === void 0 ? {} : { profile: settings.profile },
3651
- env,
3652
- record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
3653
- keepFailed: true,
3654
- trace: false,
3655
- format: "json",
3656
- context: runContextOf({ bin: app.command, command, env, caller }),
3657
- ...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
3658
- ...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
3659
- ...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
3660
- ...traceId === void 0 ? {} : { traceId }
3661
- }) : void 0;
3662
- const profile = registration.defaults.settings.profile;
3663
- const scope = {
3664
- runId: recording?.runId ?? newRunId(new Date(startedAt), command),
3665
- command,
3666
- startedAt,
3667
- ...profile === void 0 ? {} : { profile },
3668
- ...traceId === void 0 ? {} : { traceId },
3669
- ...recording ? { events: recording.events } : {}
3670
- };
3671
- const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
3672
- const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
3673
- const parsed = safeParse(input, args);
3674
- return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
3675
- arguments: toJsonSchema(input)
3676
- }), app?.errors);
3677
- }), "work");
3678
- const result = await (caller ? withCaller(caller, work) : work());
3679
- if (recording) {
3680
- if (result.isError) {
3681
- const error = result.structuredContent?.error;
3682
- const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
3683
- await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
3684
- } else
3685
- await recording.succeed(result.structuredContent).catch(() => void 0);
3686
- }
3687
- await log?.({
3688
- tool: key2,
3689
- tier: tierOf(key2, definition, registration.messenger),
3690
- ...outcomeOf(result),
3691
- startedAt,
3692
- finishedAt: Date.now()
3693
- }, caller)?.catch(() => void 0);
3694
- return result;
3695
- };
3696
- }, "entryRunner");
3697
- var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
3698
- const where = {
3699
- profile: defaults.settings.profile,
3700
- env: defaults.env,
3701
- pictures: defaults.settings.pictureSearch,
3702
- reranker: defaults.settings.searchReranker
3703
- };
3704
- return async (key2, definition, args, ctx) => {
3705
- const path = commandOf(key2, definition).split(" ");
3706
- const run = `mcp ${path.join(" ")}`;
3707
- try {
3708
- const execute = /* @__PURE__ */ __name(async () => {
3709
- const syncAllowed = syncAllowedFor(key2, defaults);
3710
- if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
3711
- throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
3712
- reason: "input.too-large",
3713
- max_bytes: MAX_BUFFERED_INPUT,
3714
- retryable: false
3715
- });
3716
- definition.check?.(args);
3717
- if (definition.changesStore)
3718
- refuseStoreChange(messenger.app, defaults.env);
3719
- refuseLacking(messenger, path);
3720
- for (const permission of readKeysForCommand(path)) {
3721
- if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
3722
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
3723
- }
3724
- if (args.sync_first && !syncAllowed)
3725
- throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
3726
- if (definition.custom) {
3727
- const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
3728
- return answered(result2, definition.outputLimit?.(args, defaults), targets);
3729
- }
3730
- if (definition.local)
3731
- return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
3732
- const { online, stored: local, served } = definition;
3733
- const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
3734
- const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
3735
- name: run
3736
- }) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
3737
- ...storeModeDeps(messenger, store, account, defaults.guard),
3738
- ...where,
3739
- embedders: defaults.embedders
3740
- }), args, defaults, (work) => session.use(run, async (adapter, release) => {
3741
- try {
3742
- return await work(adapter);
3743
- } finally {
3744
- await release();
3745
- }
3746
- })), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
3747
- try {
3748
- return await work(adapter);
3749
- } finally {
3750
- await release();
3751
- }
3752
- })())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
3753
- return answered(result, definition.outputLimit?.(args, defaults), targets);
3754
- }, "execute");
3755
- return around ? await around(key2, definition, execute) : await execute();
3756
- } catch (error) {
3757
- return failed(error, messenger?.app?.errors, effectsOf(definition));
3758
- }
3759
- };
3760
- }, "callRunner");
3761
- var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
3762
- if (!definition.output)
3763
- return looseObject({});
3764
- const entity = ENTITIES[definition.output.entity];
3765
- return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
3766
- }, "outputSchemaOf");
3767
- var Picture = class {
3768
- static {
3769
- __name(this, "Picture");
3770
- }
3771
- bytes;
3772
- mimeType;
3773
- about;
3774
- constructor(bytes, mimeType, about) {
3775
- this.bytes = bytes;
3776
- this.mimeType = mimeType;
3777
- this.about = about;
3778
- }
3779
- };
3780
- var BinaryResource = class {
3781
- static {
3782
- __name(this, "BinaryResource");
3783
- }
3784
- base64;
3785
- mimeType;
3786
- uri;
3787
- about;
3788
- constructor(base64, mimeType, uri, about) {
3789
- this.base64 = base64;
3790
- this.mimeType = mimeType;
3791
- this.uri = uri;
3792
- this.about = about;
3793
- }
3794
- };
3795
- var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
3796
- const bounded = /* @__PURE__ */ __name((result) => {
3797
- if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
3798
- 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 });
3799
- return result;
3800
- }, "bounded");
3801
- if (answer === null || Array.isArray(answer) || typeof answer !== "object")
3802
- throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
3803
- const objectBody = /* @__PURE__ */ __name((value) => {
3804
- const serialized = JSON.parse(agentJson(value));
3805
- if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
3806
- throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
3807
- return serialized;
3808
- }, "objectBody");
3809
- if (answer instanceof BinaryResource) {
3810
- const about = sealed(answer.about);
3811
- return bounded({
3812
- structuredContent: objectBody(about),
3813
- content: [
3814
- { type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
3815
- { type: "text", text: agentJson(about) }
3816
- ]
3817
- });
3818
- }
3819
- if (answer instanceof Picture) {
3820
- const about = sealed(answer.about);
3821
- return bounded({
3822
- structuredContent: objectBody(about),
3823
- content: [
3824
- { type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
3825
- { type: "text", text: agentJson(about) }
3826
- ]
3827
- });
3828
- }
3829
- const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
3830
- return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
3831
- }, "answered");
3832
- var failed = /* @__PURE__ */ __name((error, errors, effects) => {
3833
- const judged = judgedEffects(effects);
3834
- const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
3835
- return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
3836
- }, "failed");
3837
-
3838
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/surface.js
3839
- import { randomUUID } from "node:crypto";
3840
- var MATCHES = 8;
3841
- var ANSWER = answerSchema();
3842
- var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
3843
- const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
3844
- const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
3845
- return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
3846
- items: optional(array(unknown())),
3847
- item: optional(unknown()),
3848
- page: optional(looseObject({ has_more: boolean() })),
3849
- next,
3850
- missing: optional(array(looseObject({ field: string(), why: string() }))),
3851
- meta
3852
- });
3853
- }, "agentAnswer");
3854
- var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
3855
- const checked = toStandardJsonSchema(ANSWER);
3856
- const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
3857
- return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
3858
- }, "listedAs");
3859
- var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
3860
- 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(" "));
3861
- var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
3862
- var stem = /* @__PURE__ */ __name((word2) => {
3863
- const bare = word2.replace(/'s$/u, "");
3864
- if (bare.length > 4 && bare.endsWith("ies"))
3865
- return `${bare.slice(0, -3)}y`;
3866
- for (const ending of ["ing", "ed", "es", "s"])
3867
- if (bare.length - ending.length >= 3 && bare.endsWith(ending))
3868
- return bare.slice(0, -ending.length);
3869
- return bare;
3870
- }, "stem");
3871
- var sameWord = /* @__PURE__ */ __name((asked, known) => {
3872
- if (asked === known)
3873
- return true;
3874
- const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
3875
- return short.length >= 3 && long.startsWith(short);
3876
- }, "sameWord");
3877
- var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
3878
- [4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
3879
- [2, wordsOf(one.title)],
3880
- [1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
3881
- ].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
3882
- var search = /* @__PURE__ */ __name((commands, query) => {
3883
- const named = normal(query);
3884
- const all = Object.entries(commands);
3885
- if (!named)
3886
- return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
3887
- const words = [
3888
- ...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
3889
- ];
3890
- return all.map((entry) => {
3891
- const fields = fieldsOf2(entry[0], entry[1]);
3892
- const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
3893
- const matched = weights.filter((weight) => weight > 0).length;
3894
- const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
3895
- return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
3896
- }).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
3897
- }, "search");
3898
- var nearest = /* @__PURE__ */ __name((commands, asked) => {
3899
- const words = normal(asked).split(" ");
3900
- 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);
3901
- }, "nearest");
3902
- var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
3903
- const body = result.structuredContent;
3904
- if (result.isError || !Array.isArray(body?.next))
3905
- return result;
3906
- const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
3907
- const { next: _, ...rest } = body;
3908
- const kept = next.length > 0 ? { ...rest, next } : rest;
3909
- return {
3910
- ...result,
3911
- structuredContent: kept,
3912
- content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
3913
- };
3914
- }, "runnableOnly");
3915
- var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
3916
- var sampleOf = /* @__PURE__ */ __name((commands) => {
3917
- const reading = Object.entries(commands).filter(([, one]) => !one.writes);
3918
- const bare = reading.filter(([, one]) => takesNothing(one));
3919
- return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
3920
- }, "sampleOf");
3921
- var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
3922
- const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
3923
- const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
3924
- const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
3925
- const sample = messenger ? "messages list" : sampleOf(commands);
3926
- const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
3927
- server.registerTool(`${prefix}_tools_search`, {
3928
- outputSchema: toStandardJsonSchema(looseObject({})),
3929
- title: "Find a command",
3930
- 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.`,
3931
- inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
3932
- annotations: { ...READ, openWorldHint: false, idempotentHint: true }
3933
- }, async ({ query }) => {
3934
- const found = search(commands, query ?? "");
3935
- const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
3936
- command,
3937
- title: one.title,
3938
- description: one.description,
3939
- writes: one.writes,
3940
- availability: one.availability?.() ?? { available: true },
3941
- arguments: toJsonSchema(one.input),
3942
- output: toJsonSchema(one.output ?? ANSWER)
3943
- })) : found.map(([command, one]) => ({
3944
- command,
3945
- title: one.title,
3946
- writes: one.writes,
3947
- availability: one.availability?.() ?? { available: true }
3948
- }));
3949
- const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
3950
- items,
3951
- limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
3952
- has_more: found.length > items.length
3953
- });
3954
- return answered(list);
3955
- });
3956
- const callers = {
3957
- env: process.env,
3958
- client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
3959
- connectionId: randomUUID()
3960
- };
3961
- const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
3962
- try {
3963
- const command = byNormal.get(normal(asked));
3964
- const one = command === void 0 ? void 0 : commands[command];
3965
- if (command === void 0 || !one) {
3966
- withheld?.(normal(asked));
3967
- const near = nearest(commands, asked);
3968
- 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`);
3969
- }
3970
- if (one.writes !== writing)
3971
- throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
3972
- const args = writing ? agentArguments(given ?? {}) : given ?? {};
3973
- const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
3974
- if (one.checked)
3975
- return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
3976
- const parsed = safeParse(strictObject(one.input.entries), args);
3977
- if (!parsed.success)
3978
- throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
3979
- arguments: toJsonSchema(one.input)
3980
- });
3981
- return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
3982
- } catch (error) {
3983
- return failed(error, errors);
3984
- }
3985
- }, "runner");
3986
- const call = strictObject({
3987
- command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
3988
- arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
3989
- });
3990
- server.registerTool(`${prefix}_read`, {
3991
- outputSchema: listedAs(prefix, false),
3992
- title: "Run a reading command",
3993
- description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
3994
- inputSchema: toStandardJsonSchema(call),
3995
- annotations: READ
3996
- }, runner(false));
3997
- if (Object.values(commands).some((one) => one.writes))
3998
- server.registerTool(`${prefix}_write`, {
3999
- outputSchema: listedAs(prefix, true),
4000
- title: "Run a writing command",
4001
- 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}`,
4002
- inputSchema: toStandardJsonSchema(call),
4003
- annotations: WRITE
4004
- }, runner(true));
4005
- }, "registerCommands");
4006
- var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
4007
- const run = entryRunner(registration);
4008
- return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
4009
- commandOf(key2, definition),
4010
- {
4011
- title: definition.title,
4012
- description: definition.description,
4013
- writes: definition.annotations.readOnlyHint !== true,
4014
- input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
4015
- ...definition.output ? { output: outputSchemaOf(definition) } : {},
4016
- checked: true,
4017
- run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
4018
- }
4019
- ]));
4020
- }, "surfaceCommands");
4021
- var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
4022
-
4023
3621
  export {
4024
3622
  toolsFromCommands,
4025
- runCommandForAgent,
4026
- message,
4027
- READ,
4028
- WRITE,
4029
- tool,
4030
- chatOf,
4031
- tierOf,
4032
- outcomeOf,
4033
- commandOf,
4034
- toolKey,
4035
- Picture,
4036
- BinaryResource,
4037
- answered,
4038
- failed,
4039
- normal,
4040
- registerCommands,
4041
- surfaceCommands,
4042
- outputOf
3623
+ runCommandForAgent
4043
3624
  };