@wirecat/notion-cli 0.5.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 (216) hide show
  1. package/CHANGELOG.md +35 -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-V37KCXH3.js → all-profiles-AELHUTFU.js} +64 -21
  7. package/dist/bundle/{anthropic-Q4S3BYXD.js → anthropic-3CCYAGO3.js} +6 -6
  8. package/dist/bundle/{app-server-43SR3ACI.js → app-server-DJ6P4NY4.js} +86 -65
  9. package/dist/bundle/{bun-M3J2QTR3.js → bun-2FLR4IV4.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-EJ3W2PSV.js → bun-sqlite-QB6CU6TH.js} +7 -7
  11. package/dist/bundle/chunk-2CMLY2X3.js +72 -0
  12. package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-2XUV7HNE.js} +2 -2
  13. package/dist/bundle/{chunk-HZRQLAHO.js → chunk-2Z7UOXFC.js} +1 -1
  14. package/dist/bundle/{chunk-TOSCB4SO.js → chunk-3LMW7U7F.js} +16 -10
  15. package/dist/bundle/chunk-3MYN2RMG.js +398 -0
  16. package/dist/bundle/{chunk-E5WLE7BM.js → chunk-3UX4VJWD.js} +1 -1
  17. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  18. package/dist/bundle/{chunk-KHWOLBHQ.js → chunk-4RFR4J2O.js} +2 -2
  19. package/dist/bundle/{chunk-G2MJYXZG.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-ECC2UX7X.js → chunk-5OJLUUOJ.js} +6 -6
  23. package/dist/bundle/{chunk-C32AKHTY.js → chunk-5XPHFV7H.js} +35 -12
  24. package/dist/bundle/{chunk-O5YB7FQD.js → chunk-6EJCI47L.js} +4 -4
  25. package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
  26. package/dist/bundle/{chunk-NA6QLHBZ.js → chunk-6YOMPW7Y.js} +10 -8
  27. package/dist/bundle/{chunk-P5BHKKBI.js → chunk-7JVKQ6NM.js} +4 -4
  28. package/dist/bundle/chunk-7L2XOKDZ.js +353 -0
  29. package/dist/bundle/{chunk-NE43YXKL.js → chunk-A42T4YX7.js} +3 -3
  30. package/dist/bundle/chunk-AE4VW4NB.js +50 -0
  31. package/dist/bundle/{chunk-FPUGMDJV.js → chunk-AV2ZJ4WX.js} +1 -1
  32. package/dist/bundle/{chunk-QWYMXFKM.js → chunk-AZLDR36U.js} +3 -3
  33. package/dist/bundle/{chunk-N2XADGL4.js → chunk-BAXNAOOL.js} +4 -4
  34. package/dist/bundle/{chunk-JCKWQGCD.js → chunk-BEV5LO4D.js} +110 -862
  35. package/dist/bundle/{chunk-UZSBGECU.js → chunk-BQBC2WIG.js} +1 -65
  36. package/dist/bundle/{chunk-CWXOXIWS.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-ONZVPE24.js → chunk-DGMTSDKB.js} +6 -6
  40. package/dist/bundle/{chunk-BWLBSQSU.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-DBEQI5YM.js → chunk-EHW45LLT.js} +3 -3
  45. package/dist/bundle/{chunk-WPP76PSX.js → chunk-ERN53B3Z.js} +32 -24
  46. package/dist/bundle/{chunk-XUPN2EHR.js → chunk-ESZHGC4Q.js} +23 -7
  47. package/dist/bundle/{chunk-3RL2MIUF.js → chunk-EZMG5QXB.js} +8 -8
  48. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  49. package/dist/bundle/{chunk-TP7GDWVF.js → chunk-F5ZAN7OC.js} +1 -1
  50. package/dist/bundle/{chunk-DFCHHR5M.js → chunk-FMMYBVCH.js} +1 -1
  51. package/dist/bundle/{chunk-E2AFUJDR.js → chunk-FRB2L7OE.js} +3 -3
  52. package/dist/bundle/chunk-FV4WTZCU.js +561 -0
  53. package/dist/bundle/{chunk-TD2JZ25O.js → chunk-G4ZU73SD.js} +98 -80
  54. package/dist/bundle/{chunk-FKA7DOCK.js → chunk-GCAJW4SR.js} +1 -1
  55. package/dist/bundle/{chunk-WE4UFASG.js → chunk-GPRJXJC7.js} +15 -1
  56. package/dist/bundle/chunk-GUIQJUJV.js +340 -0
  57. package/dist/bundle/{chunk-GTY6N5KZ.js → chunk-HHEWTLAT.js} +2 -2
  58. package/dist/bundle/{chunk-DB2XKHI4.js → chunk-HM6AMYHR.js} +2 -2
  59. package/dist/bundle/{chunk-H3E2PZ5Y.js → chunk-HOVHE3A3.js} +7 -7
  60. package/dist/bundle/{chunk-O3DYRCIT.js → chunk-HVXOA4FO.js} +1 -1
  61. package/dist/bundle/{chunk-PPHBRESD.js → chunk-IJVTN5L3.js} +2 -2
  62. package/dist/bundle/{chunk-FBZI4Z3Z.js → chunk-IURYZSG3.js} +13 -26
  63. package/dist/bundle/chunk-JFSVAOA7.js +108 -0
  64. package/dist/bundle/{chunk-HHVFIXDO.js → chunk-JVESLS7B.js} +399 -399
  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-W5JZMXGW.js → chunk-KNCPBX5P.js} +75 -75
  69. package/dist/bundle/{chunk-ECEZOLOD.js → chunk-KZJQPJK5.js} +4 -4
  70. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  71. package/dist/bundle/{chunk-QYXWRKNA.js → chunk-LC6WE6JS.js} +9 -9
  72. package/dist/bundle/{chunk-X2M6NIQG.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-NTG657MI.js → chunk-NSR43UEW.js} +7 -64
  77. package/dist/bundle/{chunk-CDK5E45T.js → chunk-OEQNP56V.js} +2 -100
  78. package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
  79. package/dist/bundle/{chunk-PWRRDDMZ.js → chunk-P27NDZQR.js} +232 -552
  80. package/dist/bundle/{chunk-PAW6RRCW.js → chunk-PHKED7AG.js} +8 -210
  81. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  82. package/dist/bundle/{chunk-RIGE67FR.js → chunk-Q7EIL6VU.js} +43 -33
  83. package/dist/bundle/{chunk-AT5I34AN.js → chunk-QEJFBORC.js} +3 -3
  84. package/dist/bundle/{chunk-RJMQGG3P.js → chunk-QGGRFRMP.js} +65 -49
  85. package/dist/bundle/{chunk-BNEE35WD.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-2FJNMADN.js → chunk-SAPP2LEH.js} +10 -10
  89. package/dist/bundle/{chunk-QIG55MZH.js → chunk-SEAGUFBX.js} +12 -12
  90. package/dist/bundle/{chunk-GCZ6MAEN.js → chunk-STTO2MSY.js} +43 -64
  91. package/dist/bundle/{chunk-DSP36YHQ.js → chunk-T37TAXVL.js} +2 -2
  92. package/dist/bundle/{chunk-KHZ2RGXI.js → chunk-T6XIBULH.js} +139 -572
  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-LBYGJKXW.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-TDNURSU6.js → chunk-WAGADES3.js} +19 -19
  102. package/dist/bundle/{chunk-J3NKZ6MO.js → chunk-WAU5LSHP.js} +79 -438
  103. package/dist/bundle/{chunk-B3FSLAIU.js → chunk-WB2KSQIP.js} +4 -4
  104. package/dist/bundle/{chunk-DO7BLXO3.js → chunk-WGZH2M64.js} +3 -3
  105. package/dist/bundle/chunk-WVN2KTNS.js +52 -0
  106. package/dist/bundle/{chunk-W7HM2VGO.js → chunk-XYQVVW4R.js} +1 -1
  107. package/dist/bundle/{chunk-BBSFQ3PU.js → chunk-YDDI4QIT.js} +1473 -1292
  108. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  109. package/dist/bundle/{chunk-W53EJOFQ.js → chunk-YUDVRFXN.js} +1 -1
  110. package/dist/bundle/{chunk-MNRMKWCN.js → chunk-YXYZAWWW.js} +6 -6
  111. package/dist/bundle/{chunk-5P5TXU2K.js → chunk-YYQ5GKAI.js} +9509 -10782
  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-LJ627ZUA.js → command-server-entry-VUR6WL77.js} +30 -27
  115. package/dist/bundle/{decode-PX2LZ5Y2.js → decode-I64PF2RM.js} +6 -6
  116. package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
  117. package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-JQBAZWCL.js} +8 -8
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/{echarts-FVTUDXDU.js → echarts-YRRVLEX3.js} +2 -2
  120. package/dist/bundle/{embed-CCSDK43I.js → embed-BLXLKMK2.js} +7 -7
  121. package/dist/bundle/{embedder-VHI4DHB7.js → embedder-JYGF6R7I.js} +10 -10
  122. package/dist/bundle/{failure-FZ6VYKEQ.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-HET7BCYK.js → instructions-AG7SRWTR.js} +1 -1
  129. package/dist/bundle/{mcp-RGNRW77S.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-UD26T37N.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-CXZIFHZC.js → node-GJQYN4FT.js} +2 -2
  139. package/dist/bundle/{node-sqlite-ME7KMORI.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-HA6D3SXR.js → open-JGXVHIKO.js} +6 -6
  144. package/dist/bundle/{openai-H5AJPZBX.js → openai-PFQJTF4H.js} +21 -18
  145. package/dist/bundle/{process-5RUXWGYS.js → process-MEKCZMX3.js} +1 -1
  146. package/dist/bundle/{program-F3NBTZ7J.js → program-DUJYLJH5.js} +6373 -6588
  147. package/dist/bundle/{prompt-6XSUOLHK.js → prompt-FW44QDHD.js} +6 -6
  148. package/dist/bundle/{recognize-2Y7AUVGG.js → recognize-62TDQ6A7.js} +5 -5
  149. package/dist/bundle/{remote-KCABPXQ3.js → remote-7ONFD7GG.js} +12 -11
  150. package/dist/bundle/{rerank-BTN7LUVA.js → rerank-YOHQQJS4.js} +8 -8
  151. package/dist/bundle/{schemas-VVLTLMXS.js → schemas-IIGJ7DOP.js} +39 -60
  152. package/dist/bundle/{serve-CYEMVRFC.js → serve-ZCXGT5RB.js} +11 -11
  153. package/dist/bundle/{server-WFIICGMI.js → server-RQ74M637.js} +78 -56
  154. package/dist/bundle/server-XMZF57WM.js +90 -0
  155. package/dist/bundle/{services-L4W6ZWDG.js → services-FWBRZ57M.js} +103 -88
  156. package/dist/bundle/{sqlite-runtime-IKMYLRQC.js → sqlite-runtime-ZZBNGV5L.js} +7 -7
  157. package/dist/bundle/{state-LMUP636P.js → state-GDDFO62Y.js} +7 -7
  158. package/dist/bundle/{store-W2JC2JP4.js → store-D2LRIWEI.js} +24 -20
  159. package/dist/bundle/{store-A2QZFBOX.js → store-KQCLR57N.js} +30 -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 +8 -2
  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.map +1 -1
  181. package/dist/generated/manifest.js +49 -0
  182. package/dist/generated/manifest.js.map +1 -1
  183. package/dist/generated/schemas.d.ts.map +1 -1
  184. package/dist/generated/schemas.js +32 -32
  185. package/dist/generated/schemas.js.map +1 -1
  186. package/dist/generated/types.d.ts +125 -25
  187. package/dist/generated/types.d.ts.map +1 -1
  188. package/dist/library.d.ts +8 -0
  189. package/dist/library.d.ts.map +1 -1
  190. package/dist/library.js +24 -1
  191. package/dist/library.js.map +1 -1
  192. package/dist/program.d.ts.map +1 -1
  193. package/dist/program.js +2 -0
  194. package/dist/program.js.map +1 -1
  195. package/dist/sync/files.d.ts +12 -0
  196. package/dist/sync/files.d.ts.map +1 -1
  197. package/dist/sync/files.js.map +1 -1
  198. package/dist/sync/source.d.ts.map +1 -1
  199. package/dist/sync/source.js +53 -37
  200. package/dist/sync/source.js.map +1 -1
  201. package/dist/sync/users.d.ts +15 -2
  202. package/dist/sync/users.d.ts.map +1 -1
  203. package/dist/sync/users.js +36 -1
  204. package/dist/sync/users.js.map +1 -1
  205. package/dist/version.d.ts +1 -1
  206. package/dist/version.js +1 -1
  207. package/package.json +4 -4
  208. package/dist/bundle/chunk-6EOZTUHT.js +0 -726
  209. package/dist/bundle/command-contract-TVRFW2IX.js +0 -38
  210. package/dist/bundle/first-run-7JKE5AHN.js +0 -29
  211. package/dist/bundle/first-screen-ZROHOEYJ.js +0 -38
  212. package/dist/bundle/meeting-combined-SSTOJUIJ.js +0 -24
  213. package/dist/bundle/meeting-model-K7TPS4S5.js +0 -26
  214. package/dist/bundle/oauth-XBTROXHB.js +0 -20
  215. package/dist/bundle/server-UC2FNNXX.js +0 -72
  216. 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-AE4VW4NB.js";
11
6
  import {
12
- callerOf
13
- } from "./chunk-CDK5E45T.js";
7
+ lentConnection
8
+ } from "./chunk-GUIQJUJV.js";
14
9
  import {
15
- lentConnection,
16
- refuseLacking
17
- } from "./chunk-6EOZTUHT.js";
10
+ QUERY_ARGUMENT
11
+ } from "./chunk-RXU5T5NM.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-P27NDZQR.js";
48
18
  import {
49
- currentCaller,
50
- keepsSuccess,
51
- runContextOf,
52
- withCaller
53
- } from "./chunk-NA6QLHBZ.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-JCKWQGCD.js";
60
- import {
61
- storeDamaged
62
- } from "./chunk-UZSBGECU.js";
26
+ } from "./chunk-BEV5LO4D.js";
63
27
  import {
64
28
  queryDescription
65
- } from "./chunk-HHVFIXDO.js";
29
+ } from "./chunk-JVESLS7B.js";
66
30
  import {
67
- captureStreams,
68
- traceIdOf
69
- } from "./chunk-W5JZMXGW.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-TOSCB4SO.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-DB2XKHI4.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.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.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.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.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.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.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,28 +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
- // 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
+ // 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).
401
365
  {
402
366
  name: "shared-roots",
403
- members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion", "amo"],
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
+ ],
404
384
  covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
405
- differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
385
+ differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
406
386
  },
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.
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.
414
394
  {
415
395
  name: "crm",
416
- members: ["b24", "amo"],
396
+ members: ["b24", "amo", "hubspot", "attio"],
417
397
  covers: ["deals", "sync", "search", "store", "schedule", "account"],
418
- 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
+ ]
419
407
  }
420
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
+ ];
421
412
  var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
422
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");
423
414
  var REQUIRED_ROOTS = defineRequiredRoots([
@@ -429,7 +420,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
429
420
  { path: ["upgrade"], meaning: "updates the CLI" }
430
421
  ]);
431
422
 
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
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
433
424
  var fieldRuleSchema = strictObject({ id: word, rule: text });
434
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");
435
426
  var FIELD_RULES = defineFieldRules([
@@ -445,7 +436,7 @@ var FIELD_RULES = defineFieldRules([
445
436
  }
446
437
  ]);
447
438
 
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
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
449
440
  var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
450
441
  var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
451
442
  var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
@@ -467,7 +458,7 @@ var IDENTIFIERS = defineIdentifiers([
467
458
  { key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
468
459
  ]);
469
460
 
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
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
471
462
  var ACCOUNT_FLAGS = [
472
463
  {
473
464
  name: "--client-id",
@@ -504,7 +495,7 @@ var ACCOUNT_FLAGS = [
504
495
  { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
505
496
  ];
506
497
 
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
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
508
499
  var CALENDAR_FLAGS = [
509
500
  { name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
510
501
  {
@@ -592,7 +583,25 @@ var CALENDAR_FLAGS = [
592
583
  }
593
584
  ];
594
585
 
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
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
596
605
  var CRM_FLAGS = [
597
606
  {
598
607
  name: "--email",
@@ -756,7 +765,7 @@ var CRM_FLAGS = [
756
765
  }
757
766
  ];
758
767
 
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
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
760
769
  var HOW_FLAGS = [
761
770
  {
762
771
  name: "--limit",
@@ -1136,13 +1145,7 @@ var HOW_FLAGS = [
1136
1145
  type: "string",
1137
1146
  meaning: "a person whose reply counts as an answer; repeat it for more"
1138
1147
  },
1139
- {
1140
- name: "--browser",
1141
- value: "<program>",
1142
- role: "mode",
1143
- type: "string",
1144
- meaning: "the browser program to open for sign-in"
1145
- },
1148
+ { name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
1146
1149
  {
1147
1150
  name: "--credential-storage",
1148
1151
  value: "<storage>",
@@ -1151,6 +1154,8 @@ var HOW_FLAGS = [
1151
1154
  meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
1152
1155
  },
1153
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" },
1154
1159
  {
1155
1160
  name: "--expected-event-id",
1156
1161
  value: "<id>",
@@ -1753,7 +1758,7 @@ var HOW_FLAGS = [
1753
1758
  }
1754
1759
  ];
1755
1760
 
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
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
1757
1762
  var KNOWLEDGE_FLAGS = [
1758
1763
  {
1759
1764
  name: "--accept-terms",
@@ -1789,6 +1794,13 @@ var KNOWLEDGE_FLAGS = [
1789
1794
  meaning: "at most this many characters read",
1790
1795
  unit: "characters"
1791
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
+ },
1792
1804
  {
1793
1805
  name: "--tag",
1794
1806
  value: "<name>",
@@ -1805,7 +1817,7 @@ var KNOWLEDGE_FLAGS = [
1805
1817
  }
1806
1818
  ];
1807
1819
 
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
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
1809
1821
  var MAIL_FLAGS = [
1810
1822
  {
1811
1823
  name: "--cc",
@@ -1835,7 +1847,7 @@ var MAIL_FLAGS = [
1835
1847
  }
1836
1848
  ];
1837
1849
 
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
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
1839
1851
  var PRIVACY_FLAGS = [
1840
1852
  {
1841
1853
  name: "--about-text",
@@ -1896,7 +1908,7 @@ var PRIVACY_FLAGS = [
1896
1908
  { name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
1897
1909
  ];
1898
1910
 
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
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
1900
1912
  var SCHEDULE_FLAGS = [
1901
1913
  {
1902
1914
  name: "--locale",
@@ -1929,7 +1941,7 @@ var SCHEDULE_FLAGS = [
1929
1941
  }
1930
1942
  ];
1931
1943
 
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
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
1933
1945
  var WHAT_FLAGS = [
1934
1946
  {
1935
1947
  name: "--analysis-provider",
@@ -2926,7 +2938,7 @@ var WHAT_FLAGS = [
2926
2938
  }
2927
2939
  ];
2928
2940
 
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
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
2930
2942
  var FLAG_TYPES = [
2931
2943
  "switch",
2932
2944
  "count",
@@ -3056,6 +3068,10 @@ var verbs = [
3056
3068
  ["export", "write from the store to a file"],
3057
3069
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
3058
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"],
3059
3075
  ["transcribe", "turn speech into text"],
3060
3076
  ["extract", "read the text inside files already on this machine into the store"],
3061
3077
  ["migrate", "bring a file up to this build's schema"],
@@ -3152,6 +3168,8 @@ var collections = [
3152
3168
  ["messages", "posts in a messenger chat, or emails"],
3153
3169
  ["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
3154
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"],
3155
3173
  ["reactions", "reactions to a message"],
3156
3174
  ["recipients", "who a message goes to"],
3157
3175
  ["replies", "the automatic replies of a profile"],
@@ -3198,6 +3216,10 @@ var collections = [
3198
3216
  ["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
3199
3217
  ["splits", "parts of one transaction, each with its own amount and category"],
3200
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"],
3201
3223
  ["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
3202
3224
  ["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
3203
3225
  ["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
@@ -3266,6 +3288,10 @@ var singulars = [
3266
3288
  ["privacy", "who may find, see, call or add the account"],
3267
3289
  ["metadata", "a profile's cached source attributes"],
3268
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
+ ],
3269
3295
  [
3270
3296
  "schedule",
3271
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"
@@ -3273,6 +3299,7 @@ var singulars = [
3273
3299
  ];
3274
3300
  var views = [
3275
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"],
3276
3303
  ["logs", "the log of a running process"],
3277
3304
  ["events", "what happened in a thing over time"],
3278
3305
  ["scheduled", "what is scheduled to happen"],
@@ -3345,11 +3372,12 @@ var VOCABULARY = defineVocabulary({
3345
3372
  ...MAIL_FLAGS,
3346
3373
  ...KNOWLEDGE_FLAGS,
3347
3374
  ...CRM_FLAGS,
3348
- ...SCHEDULE_FLAGS
3375
+ ...SCHEDULE_FLAGS,
3376
+ ...CONTENT_FLAGS
3349
3377
  ]
3350
3378
  });
3351
3379
 
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
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
3353
3381
  var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
3354
3382
  var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
3355
3383
  var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
@@ -3520,7 +3548,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3520
3548
  const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
3521
3549
  const lend = ctx.connection;
3522
3550
  let borrowed;
3523
- let answered2 = false;
3551
+ let answered = false;
3524
3552
  let result;
3525
3553
  let failure;
3526
3554
  const streams = captureStreams();
@@ -3542,7 +3570,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3542
3570
  answer: /* @__PURE__ */ __name(() => null, "answer"),
3543
3571
  agent: {
3544
3572
  result: /* @__PURE__ */ __name((value) => {
3545
- answered2 = true;
3573
+ answered = true;
3546
3574
  result = value;
3547
3575
  }, "result"),
3548
3576
  failure: /* @__PURE__ */ __name((object2) => {
@@ -3564,7 +3592,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3564
3592
  }));
3565
3593
  if (failure)
3566
3594
  return { error: failure };
3567
- if (answered2)
3595
+ if (answered)
3568
3596
  return { result };
3569
3597
  if (code !== 0)
3570
3598
  throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
@@ -3576,468 +3604,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
3576
3604
  }
3577
3605
  }, "runCommandForAgent");
3578
3606
 
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
3607
  export {
4024
3608
  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
3609
+ runCommandForAgent
4043
3610
  };