@wirecat/cli-core 3.1.0-dev → 3.2.0-dev

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 (351) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/dist/background/daily-archive-timer.d.ts +1 -1
  3. package/dist/bundle/{agent-RMLBQXJF-CuqJBQqf.js → agent-J75WGZEV-K_l-bQ-h.js} +5 -5
  4. package/dist/bundle/{all-profiles-3GEKS7PR-Bi_zb5_-.js → all-profiles-3GEKS7PR-BohqgNvP.js} +6 -6
  5. package/dist/bundle/{anthropic-EVM6I7MZ-BWI01JgC.js → anthropic-EVM6I7MZ-CqB3j7dB.js} +2 -2
  6. package/dist/bundle/{app-server-76XGUZHU-__6SrMhc.js → app-server-5BL62GAL-Osw_tMej.js} +20 -15
  7. package/dist/bundle/{bun-AWMVU72K-COHrAYHA.js → bun-AWMVU72K-Bk0oN5Sm.js} +2 -2
  8. package/dist/bundle/{bun-sqlite-CYFVVXXR-r_kJOwku.js → bun-sqlite-CYFVVXXR-4iGlaI9X.js} +3 -3
  9. package/dist/bundle/{chunk-4ZM6SE7G-DNDxhi8l.js → chunk-4HGRFFTO-fNvELOjI.js} +330 -56
  10. package/dist/bundle/{chunk-6G6TIMKP-CoVYG_I3.js → chunk-6G6TIMKP-Byea1UGV.js} +4 -4
  11. package/dist/bundle/{chunk-M5CHOMME-BIcASmVb.js → chunk-6OLVBOBX-Ch2rblZk.js} +17 -11
  12. package/dist/bundle/{chunk-CCFBHR4O-DAuKd8rI.js → chunk-CCFBHR4O-Bhxq5eaI.js} +1 -1
  13. package/dist/bundle/{chunk-DDXCCEI4-CHLrblc1.js → chunk-DDXCCEI4-CBg_l4Ro.js} +2 -2
  14. package/dist/bundle/{chunk-DZPIGAKP-nrRAPNTz.js → chunk-DZPIGAKP-BZy6DShN.js} +1 -1
  15. package/dist/bundle/{chunk-ERNCGLKE-4JdU74o6.js → chunk-ERNCGLKE-D3HStkJC.js} +1 -1
  16. package/dist/bundle/{chunk-GBNNGOIB-DVUFOYzA.js → chunk-GBNNGOIB-DS3rusdH.js} +5 -5
  17. package/dist/bundle/{chunk-GJTANPFI-5L6Owk-H.js → chunk-GJTANPFI-DlUMnFUQ.js} +3 -3
  18. package/dist/bundle/{chunk-6ZUQA7OL-ofpF0AvH.js → chunk-GRGGW52W-Fkw6omOx.js} +5 -5
  19. package/dist/bundle/{chunk-KSUALCA7-DB6cYuSU.js → chunk-KSUALCA7-SMNQ85c6.js} +1 -1
  20. package/dist/bundle/{chunk-LBVI4Z2X-COUoJmWU.js → chunk-LBVI4Z2X-D9_8iC1S.js} +1 -1
  21. package/dist/bundle/{chunk-M23BPYSL-ChiHsEsy.js → chunk-M23BPYSL-ByTcRixP.js} +3 -3
  22. package/dist/bundle/{chunk-Z3ZVBBWR-whNBW-iH.js → chunk-M4KMNZN6-CBeUwDlF.js} +2 -2
  23. package/dist/bundle/{chunk-NG7F5L7N-BKCEXGxy.js → chunk-NG7F5L7N-Ch_ERSNz.js} +1 -1
  24. package/dist/bundle/{chunk-NX2VS2ER-DS6Urg3e.js → chunk-NX2VS2ER-CWN0zXqZ.js} +1 -1
  25. package/dist/bundle/{chunk-O2HOOK7X-Dboq6vxP.js → chunk-O2HOOK7X-Dyw_Dcql.js} +4 -4
  26. package/dist/bundle/{chunk-PSD6373C-wlicX185.js → chunk-PSD6373C-DgL0rhKe.js} +1 -1
  27. package/dist/bundle/{chunk-RTCT4N7Y-Dn-lP1zF.js → chunk-RTCT4N7Y-BEZ3cJ5d.js} +1 -1
  28. package/dist/bundle/{chunk-S34BE7ZC-p6NeYmqQ.js → chunk-S34BE7ZC-BO0yaVoX.js} +1 -1
  29. package/dist/bundle/{chunk-E6KETVFF-wOOXf4op.js → chunk-SRAGL5LI-CKhhwRrx.js} +5 -5
  30. package/dist/bundle/{chunk-T6V6LFHT-Dwv7XUuC.js → chunk-T6V6LFHT-BazTZ25Y.js} +1 -1
  31. package/dist/bundle/{chunk-ACWFPMZF-DkR70AOW.js → chunk-TFRAD7RO-BVAK9frq.js} +50 -4
  32. package/dist/bundle/{chunk-UH2H3OLE-R_6H5D7o.js → chunk-UH2H3OLE-QNxQo07O.js} +1 -1
  33. package/dist/bundle/{chunk-UQJGYQ56-CANeLx5l.js → chunk-UQJGYQ56-PoYTv6WX.js} +1 -1
  34. package/dist/bundle/{chunk-VKZDPPVI-d7RS_QOW.js → chunk-VKZDPPVI-BOmnhxVJ.js} +2 -2
  35. package/dist/bundle/{chunk-UNGNJ255-CtLEiDap.js → chunk-W3AAOYWE-Cyx1kZsd.js} +7 -7
  36. package/dist/bundle/{chunk-WXEJSLMO-DbSxVCq9.js → chunk-WXEJSLMO-DCjDRcYe.js} +8 -8
  37. package/dist/bundle/{chunk-XW3IHFDH-CjmXc8aI.js → chunk-XW3IHFDH-CA9Bby7o.js} +1 -1
  38. package/dist/bundle/{chunk-YHBBPJW6-jAof9asy.js → chunk-YHBBPJW6-DKIU2gC4.js} +2 -2
  39. package/dist/bundle/{chunk-YITG2CE5-Bg4SA8X1.js → chunk-YITG2CE5-o18mzaka.js} +1 -1
  40. package/dist/bundle/{chunk-ZMRSCVFX-Dwxb-Yg1.js → chunk-ZMRSCVFX-uhwzmZUP.js} +1 -1
  41. package/dist/bundle/chunks.json +83 -83
  42. package/dist/bundle/{command-contract-4X4JDKH7-BsU8tW9N.js → command-contract-DHFUF6RM-Bnc6nJSk.js} +2 -2
  43. package/dist/bundle/{command-server-entry-3JEJBUK5-CF-VyCRd.js → command-server-entry-UQSMAHYK-DzjTaTCZ.js} +2 -2
  44. package/dist/bundle/{decode-KVUA3TLF-Ds0C1R9U.js → decode-KVUA3TLF-BoJfgCpS.js} +2 -2
  45. package/dist/bundle/{dist-TPSNLFVO-D1tJd0aB.js → dist-TPSNLFVO-55jBf4N-.js} +2 -2
  46. package/dist/bundle/documents.js +5 -5
  47. package/dist/bundle/{echarts-6Q4CQ2DC-BvZMDYNl.js → echarts-6Q4CQ2DC-w9WhKUJu.js} +1 -1
  48. package/dist/bundle/{embed-JGGK2WKR-h5ppwooq.js → embed-JGGK2WKR-Cl3meWl4.js} +2 -2
  49. package/dist/bundle/{embedder-5SIVKVWO-D4yt4YCy.js → embedder-5SIVKVWO-DJEa9hBn.js} +2 -2
  50. package/dist/bundle/{first-run-FFHXPGFC-CyHZ4KM3.js → first-run-BT3X33BP-JikrW5_w.js} +2 -2
  51. package/dist/bundle/{first-screen-2NGQNWIN-BkvwnUdE.js → first-screen-KGQQK446-D2MchUuo.js} +2 -2
  52. package/dist/bundle/{hast-util-from-html-WLAUHN53-BfAYjYKc.js → hast-util-from-html-WLAUHN53-BOWgHBLv.js} +4 -4
  53. package/dist/bundle/{hast-util-to-html-PJC36XDP-C8DGIyzU.js → hast-util-to-html-PJC36XDP-QwbM5c4F.js} +5 -5
  54. package/dist/bundle/{hast-util-to-mdast-ZQ5OFYUM-9p6MJEBi.js → hast-util-to-mdast-ZQ5OFYUM-BidjUANu.js} +6 -6
  55. package/dist/bundle/{index-BOgkxLir.js → index-CTvUjqLX.js} +331 -345
  56. package/dist/bundle/index.js +66 -66
  57. package/dist/bundle/install-IPXFNLYZ-BGKW94IA.js +5 -0
  58. package/dist/bundle/{instructions-NHSD6EUE-BfefgySD.js → instructions-34FSWDC6-BR7mbjJH.js} +2 -2
  59. package/dist/bundle/mail.js +3 -3
  60. package/dist/bundle/{mcp-server-5FM4GA2C-CNWjKPAi.js → mcp-server-5FM4GA2C-B4Sqou0Z.js} +2 -2
  61. package/dist/bundle/mcp.js +12 -12
  62. package/dist/bundle/{mdast-util-from-markdown-Y7N3XA5A-ZkhTz5VO.js → mdast-util-from-markdown-Y7N3XA5A-CBCtetYX.js} +8 -8
  63. package/dist/bundle/{mdast-util-gfm-52PMOHWQ-gfhFQVZ5.js → mdast-util-gfm-52PMOHWQ-Bv-Hkixb.js} +12 -12
  64. package/dist/bundle/{mdast-util-to-hast-4MTEM3TB-Bomsq1EU.js → mdast-util-to-hast-4MTEM3TB-40gSN0gV.js} +6 -6
  65. package/dist/bundle/mdast-util-to-markdown-UGCOLDXA-DnYraMQX.js +12 -0
  66. package/dist/bundle/{meeting-combined-G3OVTNM6-CFHWFlT-.js → meeting-combined-G3OVTNM6-C4Jdctiy.js} +2 -2
  67. package/dist/bundle/{meeting-model-RINL42I5-Bab4crMQ.js → meeting-model-RINL42I5-BLAAT6mv.js} +2 -2
  68. package/dist/bundle/meeting-semantic-I7AZQTEI-DQ19wjn5.js +5 -0
  69. package/dist/bundle/{micromark-extension-gfm-FRHRNOIW-81l4O6kr.js → micromark-extension-gfm-FRHRNOIW-BvJCT_wq.js} +6 -6
  70. package/dist/bundle/{node-ZIYT5JOL-WfCpdwZ2.js → node-ZIYT5JOL-DoWqiI0I.js} +2 -2
  71. package/dist/bundle/{node-sqlite-VFGFD4MA-CrKdzJgw.js → node-sqlite-VFGFD4MA-QH9swjUN.js} +3 -3
  72. package/dist/bundle/notes-search-2Q3C65PA-D2HqYyaY.js +5 -0
  73. package/dist/bundle/oauth-TVUNW3GM-uN6u_RWy.js +7 -0
  74. package/dist/bundle/{open-36SZHLGF-kGan0BjP.js → open-36SZHLGF-CPBs6fdy.js} +1 -1
  75. package/dist/bundle/{openai-Z2WIZ6AC-D-aH-As-.js → openai-Z2WIZ6AC-CcEngcFj.js} +2 -2
  76. package/dist/bundle/preload.js +1 -1
  77. package/dist/bundle/{process-KJQOPRSP-C6W_P1_I.js → process-KJQOPRSP-BNqvUqBZ.js} +2 -2
  78. package/dist/bundle/{prompt-S2W33X57-BEDbCA8B.js → prompt-S2W33X57-BiF1939t.js} +2 -2
  79. package/dist/bundle/{recognize-NBWDLXLD-B2LTlDUy.js → recognize-NBWDLXLD-BCqQ8iG1.js} +2 -2
  80. package/dist/bundle/{remote-O54ANXYL-DOEubnhV.js → remote-O54ANXYL-BixLG9XM.js} +2 -2
  81. package/dist/bundle/{rerank-HTCSXPM6-CVIU4cUa.js → rerank-HTCSXPM6-FGYUs2VW.js} +2 -2
  82. package/dist/bundle/serve-7KRXCBBZ-EVSG16Mc.js +8 -0
  83. package/dist/bundle/server-BFD6QUV7-OmgCCeuX.js +11 -0
  84. package/dist/bundle/server-G7VWUBA2-C3Gq_HlM.js +12 -0
  85. package/dist/bundle/{sqlite-runtime-KC3NKKRB-DYslMC-g.js → sqlite-runtime-KC3NKKRB-y_O8PNsQ.js} +1 -1
  86. package/dist/bundle/{start-Dtq56YXe.js → start-CqQGB7xI.js} +5 -5
  87. package/dist/bundle/start.js +1 -1
  88. package/dist/bundle/state-3CFS2SAC-CYYQ103I.js +5 -0
  89. package/dist/bundle/store-BSVRVKTV-Uot4OGm0.js +5 -0
  90. package/dist/bundle/{store-6CM2A3HP-CtnMVUVK.js → store-LGAEGNFF-BzNIKnoK.js} +2 -2
  91. package/dist/bundle/{store-maintenance-command-WYO5PN4V-B0wefBHZ.js → store-maintenance-command-Z27R7URJ-CoJCYGVq.js} +2 -2
  92. package/dist/bundle/surface-ZEEHYD5Q-DRIV3XG3.js +8 -0
  93. package/dist/bundle/testing.js +8 -8
  94. package/dist/cli/app-doctor-command.d.ts +187 -1
  95. package/dist/cli/app-doctor-command.d.ts.map +1 -1
  96. package/dist/cli/app-doctor-command.js +3 -2
  97. package/dist/cli/app-doctor-command.js.map +1 -1
  98. package/dist/cli/app-mcp-command.d.ts +187 -2
  99. package/dist/cli/app-mcp-command.d.ts.map +1 -1
  100. package/dist/cli/app-mcp-command.js +3 -2
  101. package/dist/cli/app-mcp-command.js.map +1 -1
  102. package/dist/cli/built-commands.d.ts +10 -0
  103. package/dist/cli/built-commands.d.ts.map +1 -0
  104. package/dist/cli/built-commands.js +33 -0
  105. package/dist/cli/built-commands.js.map +1 -0
  106. package/dist/cli/commands-command.d.ts.map +1 -1
  107. package/dist/cli/commands-command.js +3 -2
  108. package/dist/cli/commands-command.js.map +1 -1
  109. package/dist/cli/complete-command.d.ts +187 -2
  110. package/dist/cli/complete-command.d.ts.map +1 -1
  111. package/dist/cli/complete-command.js +3 -2
  112. package/dist/cli/complete-command.js.map +1 -1
  113. package/dist/cli/config-command.d.ts +189 -3
  114. package/dist/cli/config-command.d.ts.map +1 -1
  115. package/dist/cli/config-command.js +3 -2
  116. package/dist/cli/config-command.js.map +1 -1
  117. package/dist/cli/context.d.ts +8 -0
  118. package/dist/cli/context.d.ts.map +1 -1
  119. package/dist/cli/context.js +39 -2
  120. package/dist/cli/context.js.map +1 -1
  121. package/dist/cli/documents/words.d.ts +1 -1
  122. package/dist/cli/dry-run-guard.d.ts.map +1 -1
  123. package/dist/cli/dry-run-guard.js +6 -28
  124. package/dist/cli/dry-run-guard.js.map +1 -1
  125. package/dist/cli/first-run.js +1 -1
  126. package/dist/cli/first-run.js.map +1 -1
  127. package/dist/cli/guide.d.ts.map +1 -1
  128. package/dist/cli/guide.js +3 -2
  129. package/dist/cli/guide.js.map +1 -1
  130. package/dist/cli/messenger/archive-commands.d.ts.map +1 -1
  131. package/dist/cli/messenger/archive-commands.js +3 -2
  132. package/dist/cli/messenger/archive-commands.js.map +1 -1
  133. package/dist/cli/messenger/complete-command.d.ts +187 -2
  134. package/dist/cli/messenger/complete-command.d.ts.map +1 -1
  135. package/dist/cli/messenger/complete-command.js +3 -2
  136. package/dist/cli/messenger/complete-command.js.map +1 -1
  137. package/dist/cli/messenger/doctor-command.d.ts.map +1 -1
  138. package/dist/cli/messenger/doctor-command.js +3 -2
  139. package/dist/cli/messenger/doctor-command.js.map +1 -1
  140. package/dist/cli/messenger/flood-command.d.ts.map +1 -1
  141. package/dist/cli/messenger/flood-command.js +3 -2
  142. package/dist/cli/messenger/flood-command.js.map +1 -1
  143. package/dist/cli/messenger/mcp-command.d.ts.map +1 -1
  144. package/dist/cli/messenger/mcp-command.js +3 -2
  145. package/dist/cli/messenger/mcp-command.js.map +1 -1
  146. package/dist/cli/messenger/metadata-command.d.ts.map +1 -1
  147. package/dist/cli/messenger/metadata-command.js +3 -2
  148. package/dist/cli/messenger/metadata-command.js.map +1 -1
  149. package/dist/cli/messenger/models-command.d.ts.map +1 -1
  150. package/dist/cli/messenger/models-command.js +3 -2
  151. package/dist/cli/messenger/models-command.js.map +1 -1
  152. package/dist/cli/messenger/server-command.d.ts +1 -1
  153. package/dist/cli/messenger/server-command.d.ts.map +1 -1
  154. package/dist/cli/messenger/server-command.js +3 -2
  155. package/dist/cli/messenger/server-command.js.map +1 -1
  156. package/dist/cli/messenger/session-commands.d.ts.map +1 -1
  157. package/dist/cli/messenger/session-commands.js +3 -2
  158. package/dist/cli/messenger/session-commands.js.map +1 -1
  159. package/dist/cli/messenger/store-maintenance-command.d.ts.map +1 -1
  160. package/dist/cli/messenger/store-maintenance-command.js +11 -5
  161. package/dist/cli/messenger/store-maintenance-command.js.map +1 -1
  162. package/dist/cli/model-catalogue-command.d.ts.map +1 -1
  163. package/dist/cli/model-catalogue-command.js +3 -2
  164. package/dist/cli/model-catalogue-command.js.map +1 -1
  165. package/dist/cli/oauth-session.d.ts.map +1 -1
  166. package/dist/cli/oauth-session.js +3 -2
  167. package/dist/cli/oauth-session.js.map +1 -1
  168. package/dist/cli/runs/command.d.ts.map +1 -1
  169. package/dist/cli/runs/command.js +3 -2
  170. package/dist/cli/runs/command.js.map +1 -1
  171. package/dist/cli/schedule/schedule-command.d.ts +1 -1
  172. package/dist/cli/schedule/schedule-command.d.ts.map +1 -1
  173. package/dist/cli/schedule/schedule-command.js +5 -3
  174. package/dist/cli/schedule/schedule-command.js.map +1 -1
  175. package/dist/cli/setup-command.d.ts.map +1 -1
  176. package/dist/cli/setup-command.js +3 -2
  177. package/dist/cli/setup-command.js.map +1 -1
  178. package/dist/cli/skill-command.d.ts.map +1 -1
  179. package/dist/cli/skill-command.js +3 -2
  180. package/dist/cli/skill-command.js.map +1 -1
  181. package/dist/cli/store-info.d.ts.map +1 -1
  182. package/dist/cli/store-info.js +5 -4
  183. package/dist/cli/store-info.js.map +1 -1
  184. package/dist/cli/token-session.d.ts.map +1 -1
  185. package/dist/cli/token-session.js +2 -1
  186. package/dist/cli/token-session.js.map +1 -1
  187. package/dist/cli/upgrade-command.d.ts.map +1 -1
  188. package/dist/cli/upgrade-command.js +4 -5
  189. package/dist/cli/upgrade-command.js.map +1 -1
  190. package/dist/cli/upkeep.d.ts +8 -0
  191. package/dist/cli/upkeep.d.ts.map +1 -0
  192. package/dist/cli/upkeep.js +11 -0
  193. package/dist/cli/upkeep.js.map +1 -0
  194. package/dist/entities/attachment.d.ts +0 -8
  195. package/dist/entities/attachment.d.ts.map +1 -1
  196. package/dist/entities/attachment.js +22 -20
  197. package/dist/entities/attachment.js.map +1 -1
  198. package/dist/entities/chat.d.ts +0 -4
  199. package/dist/entities/chat.d.ts.map +1 -1
  200. package/dist/entities/chat.js +6 -10
  201. package/dist/entities/chat.js.map +1 -1
  202. package/dist/entities/contact.d.ts +0 -7
  203. package/dist/entities/contact.d.ts.map +1 -1
  204. package/dist/entities/contact.js +9 -16
  205. package/dist/entities/contact.js.map +1 -1
  206. package/dist/entities/deal.d.ts +0 -36
  207. package/dist/entities/deal.d.ts.map +1 -1
  208. package/dist/entities/deal.js +22 -48
  209. package/dist/entities/deal.js.map +1 -1
  210. package/dist/entities/document.d.ts +0 -2
  211. package/dist/entities/document.d.ts.map +1 -1
  212. package/dist/entities/document.js +3 -5
  213. package/dist/entities/document.js.map +1 -1
  214. package/dist/entities/fields.d.ts +5 -1
  215. package/dist/entities/fields.d.ts.map +1 -1
  216. package/dist/entities/fields.js +6 -2
  217. package/dist/entities/fields.js.map +1 -1
  218. package/dist/entities/hit.d.ts +0 -18
  219. package/dist/entities/hit.d.ts.map +1 -1
  220. package/dist/entities/hit.js +19 -37
  221. package/dist/entities/hit.js.map +1 -1
  222. package/dist/entities/index.d.ts +0 -1
  223. package/dist/entities/index.d.ts.map +1 -1
  224. package/dist/entities/index.js +2 -3
  225. package/dist/entities/index.js.map +1 -1
  226. package/dist/entities/message.d.ts +2 -34
  227. package/dist/entities/message.d.ts.map +1 -1
  228. package/dist/entities/message.js +35 -67
  229. package/dist/entities/message.js.map +1 -1
  230. package/dist/entities/task.d.ts +0 -19
  231. package/dist/entities/task.d.ts.map +1 -1
  232. package/dist/entities/task.js +18 -35
  233. package/dist/entities/task.js.map +1 -1
  234. package/dist/mcp/agent.d.ts +3 -0
  235. package/dist/mcp/agent.d.ts.map +1 -1
  236. package/dist/mcp/agent.js +48 -1
  237. package/dist/mcp/agent.js.map +1 -1
  238. package/dist/mcp/app-server.d.ts.map +1 -1
  239. package/dist/mcp/app-server.js +8 -5
  240. package/dist/mcp/app-server.js.map +1 -1
  241. package/dist/mcp/bot/instructions.js +1 -1
  242. package/dist/mcp/bot/instructions.js.map +1 -1
  243. package/dist/mcp/index.d.ts +4 -0
  244. package/dist/mcp/index.d.ts.map +1 -1
  245. package/dist/mcp/index.js +4 -0
  246. package/dist/mcp/index.js.map +1 -1
  247. package/dist/mcp/instructions.js +4 -4
  248. package/dist/mcp/instructions.js.map +1 -1
  249. package/dist/mcp/lean.d.ts +9 -0
  250. package/dist/mcp/lean.d.ts.map +1 -0
  251. package/dist/mcp/lean.js +7 -0
  252. package/dist/mcp/lean.js.map +1 -0
  253. package/dist/mcp/server.d.ts.map +1 -1
  254. package/dist/mcp/server.js +6 -2
  255. package/dist/mcp/server.js.map +1 -1
  256. package/dist/mcp/surface.d.ts +51 -2
  257. package/dist/mcp/surface.d.ts.map +1 -1
  258. package/dist/mcp/surface.js +379 -52
  259. package/dist/mcp/surface.js.map +1 -1
  260. package/dist/mcp/tool.d.ts +9 -1
  261. package/dist/mcp/tool.d.ts.map +1 -1
  262. package/dist/mcp/tool.js +20 -6
  263. package/dist/mcp/tool.js.map +1 -1
  264. package/dist/output-detail.d.ts +8 -0
  265. package/dist/output-detail.d.ts.map +1 -1
  266. package/dist/output-detail.js +55 -0
  267. package/dist/output-detail.js.map +1 -1
  268. package/dist/services/package-upgrade.d.ts.map +1 -1
  269. package/dist/services/package-upgrade.js +3 -1
  270. package/dist/services/package-upgrade.js.map +1 -1
  271. package/dist/store/compatibility.d.ts +2 -0
  272. package/dist/store/compatibility.d.ts.map +1 -1
  273. package/dist/store/compatibility.js +12 -0
  274. package/dist/store/compatibility.js.map +1 -1
  275. package/dist/store/migrations.d.ts +3 -3
  276. package/dist/store/migrations.js +3 -3
  277. package/dist/store/sqlite/clients.d.ts +6 -0
  278. package/dist/store/sqlite/clients.d.ts.map +1 -1
  279. package/dist/store/sqlite/clients.js +6 -4
  280. package/dist/store/sqlite/clients.js.map +1 -1
  281. package/dist/store/sqlite/manifest.d.ts +4 -0
  282. package/dist/store/sqlite/manifest.d.ts.map +1 -1
  283. package/dist/store/sqlite/manifest.js.map +1 -1
  284. package/package.json +1 -1
  285. package/skills/link-conversations/SKILL.md +1 -1
  286. package/src/cli/app-doctor-command.ts +41 -42
  287. package/src/cli/app-mcp-command.ts +55 -52
  288. package/src/cli/built-commands.ts +32 -0
  289. package/src/cli/commands-command.ts +3 -2
  290. package/src/cli/complete-command.ts +53 -48
  291. package/src/cli/config-command.ts +180 -177
  292. package/src/cli/context.ts +44 -2
  293. package/src/cli/dry-run-guard.ts +11 -23
  294. package/src/cli/first-run.ts +1 -1
  295. package/src/cli/guide.ts +3 -2
  296. package/src/cli/messenger/archive-commands.ts +3 -2
  297. package/src/cli/messenger/complete-command.ts +30 -30
  298. package/src/cli/messenger/doctor-command.ts +3 -2
  299. package/src/cli/messenger/flood-command.ts +3 -2
  300. package/src/cli/messenger/mcp-command.ts +3 -2
  301. package/src/cli/messenger/metadata-command.ts +3 -2
  302. package/src/cli/messenger/models-command.ts +3 -2
  303. package/src/cli/messenger/server-command.ts +3 -2
  304. package/src/cli/messenger/session-commands.ts +3 -2
  305. package/src/cli/messenger/store-maintenance-command.ts +18 -12
  306. package/src/cli/model-catalogue-command.ts +3 -2
  307. package/src/cli/oauth-session.ts +3 -2
  308. package/src/cli/runs/command.ts +3 -2
  309. package/src/cli/schedule/schedule-command.ts +412 -410
  310. package/src/cli/setup-command.ts +3 -2
  311. package/src/cli/skill-command.ts +3 -2
  312. package/src/cli/store-info.ts +21 -16
  313. package/src/cli/token-session.ts +3 -2
  314. package/src/cli/upgrade-command.ts +59 -62
  315. package/src/cli/upkeep.ts +15 -0
  316. package/src/entities/attachment.ts +44 -30
  317. package/src/entities/chat.ts +9 -10
  318. package/src/entities/contact.ts +20 -21
  319. package/src/entities/deal.ts +66 -53
  320. package/src/entities/document.ts +3 -5
  321. package/src/entities/fields.ts +11 -2
  322. package/src/entities/hit.ts +52 -37
  323. package/src/entities/index.ts +2 -3
  324. package/src/entities/message.ts +101 -80
  325. package/src/entities/task.ts +37 -38
  326. package/src/mcp/agent.ts +51 -1
  327. package/src/mcp/app-server.ts +8 -5
  328. package/src/mcp/bot/instructions.ts +1 -1
  329. package/src/mcp/index.ts +4 -0
  330. package/src/mcp/instructions.ts +4 -4
  331. package/src/mcp/lean.ts +8 -0
  332. package/src/mcp/server.ts +6 -2
  333. package/src/mcp/surface.ts +436 -64
  334. package/src/mcp/tool.ts +27 -4
  335. package/src/output-detail.ts +61 -0
  336. package/src/services/package-upgrade.ts +3 -1
  337. package/src/store/compatibility.ts +12 -0
  338. package/src/store/migrations.ts +3 -3
  339. package/src/store/sqlite/clients.ts +17 -6
  340. package/src/store/sqlite/manifest.ts +4 -0
  341. package/dist/bundle/install-IPXFNLYZ-BSWiztYR.js +0 -5
  342. package/dist/bundle/mdast-util-to-markdown-UGCOLDXA-7D6EJn9r.js +0 -12
  343. package/dist/bundle/meeting-semantic-I7AZQTEI-BgZ3ZzQB.js +0 -5
  344. package/dist/bundle/notes-search-2Q3C65PA-CWKHboCy.js +0 -5
  345. package/dist/bundle/oauth-TVUNW3GM-BqlyhUfp.js +0 -7
  346. package/dist/bundle/serve-7KRXCBBZ-BO9BKhWL.js +0 -8
  347. package/dist/bundle/server-PIT6UZRZ-C6I-VrDd.js +0 -11
  348. package/dist/bundle/server-ZL4FMEHH-DP1oYgCn.js +0 -12
  349. package/dist/bundle/state-3CFS2SAC-xptBCfut.js +0 -5
  350. package/dist/bundle/store-ASWYHJ4Q-C7EFfvzB.js +0 -5
  351. package/dist/bundle/surface-DDH4HGT3-CBZnEqH_.js +0 -8
@@ -29,6 +29,7 @@ import {
29
29
  storeSettings,
30
30
  storeSettingsOf,
31
31
  } from "./store-settings.js"
32
+ import { upkeepCommand } from "./upkeep.js"
32
33
 
33
34
  /**
34
35
  * The settings in force and where each came from, and changing them. Printed whole: no field the
@@ -45,206 +46,208 @@ export interface OwnerOnlySettings {
45
46
  permissions?: readonly string[]
46
47
  }
47
48
 
48
- export const configCommand = (
49
- app: AppIdentity,
50
- config: Configuration,
51
- {
52
- permissionKey = config.permissions,
53
- ownerOnly = {},
54
- }: { permissionKey?: PermissionKeySource | undefined; ownerOnly?: OwnerOnlySettings } = {},
55
- ): Command => {
56
- const command = new Command("config").description("the settings in force, and where each one came from")
49
+ export const configCommand = upkeepCommand(
50
+ (
51
+ app: AppIdentity,
52
+ config: Configuration,
53
+ {
54
+ permissionKey = config.permissions,
55
+ ownerOnly = {},
56
+ }: { permissionKey?: PermissionKeySource | undefined; ownerOnly?: OwnerOnlySettings } = {},
57
+ ): Command => {
58
+ const command = new Command("config").description("the settings in force, and where each one came from")
57
59
 
58
- // Only a messenger has bots, and with them the personal and bot sections of the file. Elsewhere the options stay
59
- // accepted, so a script that passes one still runs, but help, `commands --json` and MCP leave them out.
60
- const bots = app.messenger !== false
61
- const kindOption = (flags: string, description: string) => new Option(flags, description).hideHelp(!bots)
62
- const show = annotate(command.command("show"), {
63
- effects: LOCAL_READ,
64
- examples: [`${app.command} personal config show`],
65
- }).description("the profile, the profiles that exist, and each setting with where it came from")
66
- show.addOption(
67
- kindOption("--bot", "the settings a bot command on this profile gets, rather than the personal account's"),
68
- )
69
- show.action(async function (this: Command) {
70
- const bot = this.opts<{ bot?: boolean }>().bot === true
71
- const context = baseContext(this, (flags, options) =>
72
- config.resolveSettings(flags, {
73
- ...options,
74
- readOnly: true,
75
- needsProfile: false,
76
- withIssues: true,
77
- ...(bot ? { kind: "bot" } : {}),
78
- }),
79
- )
80
- const { settings, renderer, env } = context
81
- const overridden = pathsAreOverridden({ appName: app.appName, prefix: app.envPrefix, env })
82
-
83
- renderAnswer(
84
- this,
85
- context,
86
- itemOf({
87
- profile: settings.sources.profile === NONE_NAMED ? null : settings.profile,
88
- profile_from: settings.sources.profile,
89
- kind: settings.kind,
90
- permissions: settings.permissions,
91
- permission_sources: settings.permissionSources,
92
- profiles: settings.profilesHere,
93
- config_file: settings.configPath,
94
- config_found: settings.configFound,
95
- paths_overridden: overridden,
96
- settings: [...config.allSettings, "command_timeout_ms"]
97
- .filter((setting) => bot || setting !== "read_other_bots")
98
- .map((setting) => {
99
- const declared = config.declaredSettings.find(({ key }) => key === `defaults.${setting}`)
100
- return {
101
- ...sourced(settings, setting),
102
- ...(declared ? { default: declared.default, description: declared.description } : {}),
103
- }
104
- }),
105
- store_settings: (await storeSettings(env)).filter(({ setting }) => offersStoreSetting(app, setting)),
106
- }),
60
+ // Only a messenger has bots, and with them the personal and bot sections of the file. Elsewhere the options stay
61
+ // accepted, so a script that passes one still runs, but help, `commands --json` and MCP leave them out.
62
+ const bots = app.messenger !== false
63
+ const kindOption = (flags: string, description: string) => new Option(flags, description).hideHelp(!bots)
64
+ const show = annotate(command.command("show"), {
65
+ effects: LOCAL_READ,
66
+ examples: [`${app.command} personal config show`],
67
+ }).description("the profile, the profiles that exist, and each setting with where it came from")
68
+ show.addOption(
69
+ kindOption("--bot", "the settings a bot command on this profile gets, rather than the personal account's"),
107
70
  )
71
+ show.action(async function (this: Command) {
72
+ const bot = this.opts<{ bot?: boolean }>().bot === true
73
+ const context = baseContext(this, (flags, options) =>
74
+ config.resolveSettings(flags, {
75
+ ...options,
76
+ readOnly: true,
77
+ needsProfile: false,
78
+ withIssues: true,
79
+ ...(bot ? { kind: "bot" } : {}),
80
+ }),
81
+ )
82
+ const { settings, renderer, env } = context
83
+ const overridden = pathsAreOverridden({ appName: app.appName, prefix: app.envPrefix, env })
108
84
 
109
- for (const issue of [
110
- ...(settings.configIssues ?? []),
111
- ...unknownPermissionIssues(this, settings, app.command, permissionKey),
112
- ])
113
- renderer.warn(`${issue.what}, so it is left out${issue.fix ? ` — \`${issue.fix}\` ${fixVerb(issue)}s it` : ""}`)
114
- if (overridden) {
115
- renderer.note(
116
- `${envName(app, "CONFIG_DIR")}, ${envName(app, "STATE_DIR")} or ${envName(app, "CACHE_DIR")} is set — ` +
117
- "a session is still read from the usual keyring entry, but a sign-in made with them is kept apart, in a " +
118
- "temporary entry that session end removes",
85
+ renderAnswer(
86
+ this,
87
+ context,
88
+ itemOf({
89
+ profile: settings.sources.profile === NONE_NAMED ? null : settings.profile,
90
+ profile_from: settings.sources.profile,
91
+ kind: settings.kind,
92
+ permissions: settings.permissions,
93
+ permission_sources: settings.permissionSources,
94
+ profiles: settings.profilesHere,
95
+ config_file: settings.configPath,
96
+ config_found: settings.configFound,
97
+ paths_overridden: overridden,
98
+ settings: [...config.allSettings, "command_timeout_ms"]
99
+ .filter((setting) => bot || setting !== "read_other_bots")
100
+ .map((setting) => {
101
+ const declared = config.declaredSettings.find(({ key }) => key === `defaults.${setting}`)
102
+ return {
103
+ ...sourced(settings, setting),
104
+ ...(declared ? { default: declared.default, description: declared.description } : {}),
105
+ }
106
+ }),
107
+ store_settings: (await storeSettings(env)).filter(({ setting }) => offersStoreSetting(app, setting)),
108
+ }),
119
109
  )
120
- }
121
- })
122
110
 
123
- for (const action of ["set", "unset"] as const) {
124
- const sub = grantsAuthority(
125
- annotate(command.command(action), {
126
- effects: LOCAL_WRITE,
127
- examples: [`${app.command} personal config ${action} limit${action === "set" ? " 20" : ""}`],
128
- }),
129
- )
130
- .argument("<setting>", `one of: ${[...config.allSettings, ...storeSettingsOf(app)].join(", ")}`)
131
- .option("--defaults", "change what every profile gets, rather than this profile")
132
- .addOption(kindOption("--personal", "only for personal accounts — the personal section of the file"))
133
- .addOption(kindOption("--bot", "only for bots — the bot section of the file"))
134
- if (action === "set")
135
- sub
136
- .argument("<value>", "a number, true or false; for a group tg:work,max:Alice,email:me@x")
137
- .description("save a setting to the configuration file")
138
- else sub.description("remove a setting from the configuration file")
111
+ for (const issue of [
112
+ ...(settings.configIssues ?? []),
113
+ ...unknownPermissionIssues(this, settings, app.command, permissionKey),
114
+ ])
115
+ renderer.warn(`${issue.what}, so it is left out${issue.fix ? ` — \`${issue.fix}\` ${fixVerb(issue)}s it` : ""}`)
116
+ if (overridden) {
117
+ renderer.note(
118
+ `${envName(app, "CONFIG_DIR")}, ${envName(app, "STATE_DIR")} or ${envName(app, "CACHE_DIR")} is set — ` +
119
+ "a session is still read from the usual keyring entry, but a sign-in made with them is kept apart, in a " +
120
+ "temporary entry that session end removes",
121
+ )
122
+ }
123
+ })
139
124
 
140
- sub.action(async function (this: Command, setting: string, given: unknown) {
141
- const {
142
- defaults: everyone,
143
- personal,
144
- bot,
145
- } = this.opts<{ defaults?: boolean; personal?: boolean; bot?: boolean }>()
146
- const context = baseContext(this, (flags, options) =>
147
- config.resolveSettings(flags, { ...options, needsProfile: false, withIssues: true }),
125
+ for (const action of ["set", "unset"] as const) {
126
+ const sub = grantsAuthority(
127
+ annotate(command.command(action), {
128
+ effects: LOCAL_WRITE,
129
+ examples: [`${app.command} personal config ${action} limit${action === "set" ? " 20" : ""}`],
130
+ }),
148
131
  )
149
- const { settings, renderer, env } = context
150
- if (isStoreSetting(setting) && !offersStoreSetting(app, setting))
151
- throw new CliError(
152
- "validation_error",
153
- `no setting called "${setting}" here — it belongs to the messenger CLIs; one of: ${[...config.allSettings, ...storeSettingsOf(app)].join(", ")}`,
132
+ .argument("<setting>", `one of: ${[...config.allSettings, ...storeSettingsOf(app)].join(", ")}`)
133
+ .option("--defaults", "change what every profile gets, rather than this profile")
134
+ .addOption(kindOption("--personal", "only for personal accounts — the personal section of the file"))
135
+ .addOption(kindOption("--bot", "only for bots — the bot section of the file"))
136
+ if (action === "set")
137
+ sub
138
+ .argument("<value>", "a number, true or false; for a group tg:work,max:Alice,email:me@x")
139
+ .description("save a setting to the configuration file")
140
+ else sub.description("remove a setting from the configuration file")
141
+
142
+ sub.action(async function (this: Command, setting: string, given: unknown) {
143
+ const {
144
+ defaults: everyone,
145
+ personal,
146
+ bot,
147
+ } = this.opts<{ defaults?: boolean; personal?: boolean; bot?: boolean }>()
148
+ const context = baseContext(this, (flags, options) =>
149
+ config.resolveSettings(flags, { ...options, needsProfile: false, withIssues: true }),
154
150
  )
155
- if (isStoreSetting(setting)) {
156
- // A guard against a change by mistake, not a boundary: an agent can drop its markers or write the store file.
157
- if (isOwnerOnlyStoreSetting(setting) && (environmentOf(this).agent || agentOf(env)))
158
- throw new CliError(
159
- "permission_error",
160
- `${setting} is the owner's to set, in a terminal: an agent's run is stopped from changing it by mistake`,
161
- {
162
- setting,
163
- },
164
- )
165
- if (everyone || personal || bot)
151
+ const { settings, renderer, env } = context
152
+ if (isStoreSetting(setting) && !offersStoreSetting(app, setting))
166
153
  throw new CliError(
167
154
  "validation_error",
168
- `${setting} is store-wide — --defaults, --personal and --bot do not apply`,
155
+ `no setting called "${setting}" here — it belongs to the messenger CLIs; one of: ${[...config.allSettings, ...storeSettingsOf(app)].join(", ")}`,
156
+ )
157
+ if (isStoreSetting(setting)) {
158
+ // A guard against a change by mistake, not a boundary: an agent can drop its markers or write the store file.
159
+ if (isOwnerOnlyStoreSetting(setting) && (environmentOf(this).agent || agentOf(env)))
160
+ throw new CliError(
161
+ "permission_error",
162
+ `${setting} is the owner's to set, in a terminal: an agent's run is stopped from changing it by mistake`,
163
+ {
164
+ setting,
165
+ },
166
+ )
167
+ if (everyone || personal || bot)
168
+ throw new CliError(
169
+ "validation_error",
170
+ `${setting} is store-wide — --defaults, --personal and --bot do not apply`,
171
+ )
172
+ const lock = envName(app, "PROFILE_LOCK")
173
+ if (env[lock]) {
174
+ throw new CliError(
175
+ "permission_error",
176
+ `this process is locked to profile ${settings.profile} (${lock}) — ${setting} changes every profile, tg and MAX`,
177
+ )
178
+ }
179
+ const changed = await changeStoreSetting(app, env, setting, action === "set" ? String(given) : undefined)
180
+ renderAnswer(
181
+ this,
182
+ context,
183
+ itemOf(changed.result, {
184
+ next:
185
+ "reindex" in changed
186
+ ? [nextStep("store.reindex", { args: {} })]
187
+ : "rebuild" in changed
188
+ ? [nextStep("mentions.rebuild", { args: { kind: "phone" } })]
189
+ : [],
190
+ }),
169
191
  )
192
+ renderer.note(changed.note)
193
+ return
194
+ }
195
+ const defaults = everyone === true
196
+ // The unset `doctor` gives for a problem outside any profile: one with no profile typed reaches it, whatever
197
+ // profile the environment names.
198
+ const root =
199
+ action === "unset" &&
200
+ !defaults &&
201
+ !personal &&
202
+ !bot &&
203
+ settings.sources.profile !== "first word" &&
204
+ (settings.configIssues ?? []).some((issue) => issue.fix === `${app.command} config unset ${setting}`)
205
+ if (!root && !defaults && settings.sources.profile === NONE_NAMED)
206
+ config.resolveSettings(this.optsWithGlobals(), { env, withIssues: true })
207
+ if (personal && bot)
208
+ throw new CliError("validation_error", "--personal and --bot name different sections; use one")
209
+ const kind = bot ? "bot" : personal ? "personal" : undefined
170
210
  const lock = envName(app, "PROFILE_LOCK")
171
- if (env[lock]) {
211
+ if ((defaults || root) && env[lock]) {
212
+ // The defaults are every other profile's settings too, and the top of the file is everyone's.
172
213
  throw new CliError(
173
214
  "permission_error",
174
- `this process is locked to profile ${settings.profile} (${lock}) — ${setting} changes every profile, tg and MAX`,
215
+ `this process is locked to profile ${settings.profile} (${lock}) — ${root ? setting : "--defaults"} changes other profiles`,
175
216
  )
176
217
  }
177
- const changed = await changeStoreSetting(app, env, setting, action === "set" ? String(given) : undefined)
218
+ // An agent's own shell counts too: Hermes and OpenClaw run the tool there for anyone their chat accepts (SEC-116).
219
+ if (environmentOf(this).agent || agentOf(env)) {
220
+ refuseGuardedKey(setting, action === "set" ? String(given) : undefined, ownerOnly)
221
+ refuseLoosening(settings.permissions, setting, action === "set" ? String(given) : undefined, {
222
+ wide: Boolean(everyone || root || personal || bot),
223
+ })
224
+ }
225
+ if (action === "set") refuseUnknownKey(this, setting, String(given), permissionKey)
226
+ const saved = config.changeSetting(settings.configPath, {
227
+ profile: defaults || root ? undefined : settings.profile,
228
+ setting,
229
+ value: action === "set" ? String(given) : undefined,
230
+ kind,
231
+ root,
232
+ })
178
233
  renderAnswer(
179
234
  this,
180
235
  context,
181
- itemOf(changed.result, {
182
- next:
183
- "reindex" in changed
184
- ? [nextStep("store.reindex", { args: {} })]
185
- : "rebuild" in changed
186
- ? [nextStep("mentions.rebuild", { args: { kind: "phone" } })]
187
- : [],
236
+ itemOf({
237
+ config_file: settings.configPath,
238
+ scope: root ? "file" : scopeOf(kind, defaults ? undefined : settings.profile),
239
+ setting,
240
+ value: saved,
188
241
  }),
189
242
  )
190
- renderer.note(changed.note)
191
- return
192
- }
193
- const defaults = everyone === true
194
- // The unset `doctor` gives for a problem outside any profile: one with no profile typed reaches it, whatever
195
- // profile the environment names.
196
- const root =
197
- action === "unset" &&
198
- !defaults &&
199
- !personal &&
200
- !bot &&
201
- settings.sources.profile !== "first word" &&
202
- (settings.configIssues ?? []).some((issue) => issue.fix === `${app.command} config unset ${setting}`)
203
- if (!root && !defaults && settings.sources.profile === NONE_NAMED)
204
- config.resolveSettings(this.optsWithGlobals(), { env, withIssues: true })
205
- if (personal && bot)
206
- throw new CliError("validation_error", "--personal and --bot name different sections; use one")
207
- const kind = bot ? "bot" : personal ? "personal" : undefined
208
- const lock = envName(app, "PROFILE_LOCK")
209
- if ((defaults || root) && env[lock]) {
210
- // The defaults are every other profile's settings too, and the top of the file is everyone's.
211
- throw new CliError(
212
- "permission_error",
213
- `this process is locked to profile ${settings.profile} (${lock}) — ${root ? setting : "--defaults"} changes other profiles`,
214
- )
215
- }
216
- // An agent's own shell counts too: Hermes and OpenClaw run the tool there for anyone their chat accepts (SEC-116).
217
- if (environmentOf(this).agent || agentOf(env)) {
218
- refuseGuardedKey(setting, action === "set" ? String(given) : undefined, ownerOnly)
219
- refuseLoosening(settings.permissions, setting, action === "set" ? String(given) : undefined, {
220
- wide: Boolean(everyone || root || personal || bot),
221
- })
222
- }
223
- if (action === "set") refuseUnknownKey(this, setting, String(given), permissionKey)
224
- const saved = config.changeSetting(settings.configPath, {
225
- profile: defaults || root ? undefined : settings.profile,
226
- setting,
227
- value: action === "set" ? String(given) : undefined,
228
- kind,
229
- root,
230
243
  })
231
- renderAnswer(
232
- this,
233
- context,
234
- itemOf({
235
- config_file: settings.configPath,
236
- scope: root ? "file" : scopeOf(kind, defaults ? undefined : settings.profile),
237
- setting,
238
- value: saved,
239
- }),
240
- )
241
- })
242
- }
244
+ }
243
245
 
244
- command.addCommand(migrateCommand(app, config))
245
- command.addCommand(repairCommand(app, config))
246
- return command
247
- }
246
+ command.addCommand(migrateCommand(app, config))
247
+ command.addCommand(repairCommand(app, config))
248
+ return command
249
+ },
250
+ )
248
251
 
249
252
  const migrateCommand = (app: AppIdentity, config: Configuration): Command =>
250
253
  profileFree(
@@ -5,6 +5,7 @@ import { type Command, Option } from "commander"
5
5
  import { type Deadline, type RunBudget, runBudget } from "../background/budget.js"
6
6
  import type { MessageEvent } from "../domain/models.js"
7
7
  import { resolveOutput } from "../output.js"
8
+ import { type AgentViewOptions, agentView } from "../output-detail.js"
8
9
  import type { AppIdentity } from "../ports/app.js"
9
10
  import type { MessengerAdapter } from "../ports/messenger.js"
10
11
  import type { EventSink } from "../runs/events.js"
@@ -111,6 +112,8 @@ export interface AgentRun {
111
112
  botApi?: boolean
112
113
  /** Who made the MCP call, as the server received it; the run records it instead of the server's environment. */
113
114
  caller?: RunCaller
115
+ /** Set by cli-core's own servers on a read: the answer goes out lean (`agentView`). */
116
+ view?: AgentViewOptions
114
117
  }
115
118
 
116
119
  export interface RelayedRun {
@@ -208,6 +211,45 @@ export const outputFieldsOf = (command: Command): { fields?: string } => {
208
211
  /** Whether the run asked for one line per item (WC-OUT-24). */
209
212
  export const compactOf = (command: Command): boolean => command.optsWithGlobals()[COMPACT_KEY] === true
210
213
 
214
+ /**
215
+ * The entities whose records an agent's read gets lean: a message, a chat, a person, a deal — not a report, a check
216
+ * or a count, whose empty fields and lists are the answer, even when it carries a `ref`.
217
+ */
218
+ export const RECORD_ENTITIES: ReadonlySet<string> = new Set([
219
+ "message",
220
+ "chat",
221
+ "contact",
222
+ "member",
223
+ "topic",
224
+ "attachment",
225
+ "hit",
226
+ "meeting_hit",
227
+ "conversation_hit",
228
+ "mention",
229
+ "note",
230
+ "document",
231
+ "document_entry",
232
+ "deal",
233
+ "lead",
234
+ "crm_person",
235
+ "crm_organization",
236
+ "task",
237
+ "task_card",
238
+ "meeting",
239
+ "event",
240
+ ])
241
+
242
+ /**
243
+ * Where an agent's run takes its answer: lean (`agentView`) for a read whose declared entity is a record entity
244
+ * (`RECORD_ENTITIES`), unless `--full` or `--json=a,b` asks for every field; as it is for any other answer.
245
+ */
246
+ const captureFor = (command: Command, agent: AgentRun): ((value: unknown) => void) => {
247
+ const whole =
248
+ command.optsWithGlobals<{ full?: boolean }>().full === true || outputFieldsOf(command).fields !== undefined
249
+ const records = RECORD_ENTITIES.has(metaOf(command).output?.entity ?? "")
250
+ return agent.view && records && !whole ? (value) => agent.result(agentView(value)) : agent.result
251
+ }
252
+
211
253
  /** For the commands that print but never need settings or a connection. */
212
254
  export const outputFor = (command: Command) => {
213
255
  const { streams, tty, env, agent } = environmentOf(command)
@@ -217,7 +259,7 @@ export const outputFor = (command: Command) => {
217
259
  ...outputFieldsOf(command),
218
260
  ...detailOf(command.optsWithGlobals<{ brief?: boolean; full?: boolean }>()),
219
261
  compact: compactOf(command),
220
- ...(agent ? { capture: agent.result } : {}),
262
+ ...(agent ? { capture: captureFor(command, agent) } : {}),
221
263
  ...(streams ? { streams } : {}),
222
264
  ...(env ? { env } : {}),
223
265
  ...(tty === undefined ? {} : { tty }),
@@ -262,7 +304,7 @@ export const baseContext = (command: Command, resolveSettings: Resolve): BaseCon
262
304
  compact: compactOf(command),
263
305
  ...detailOf(command.optsWithGlobals<{ brief?: boolean; full?: boolean }>()),
264
306
  ...outputFieldsOf(command),
265
- ...(environment.agent ? { capture: environment.agent.result } : {}),
307
+ ...(environment.agent ? { capture: captureFor(command, environment.agent) } : {}),
266
308
  ...(environment.streams ? { streams: environment.streams } : {}),
267
309
  ...(environment.tty === undefined ? {} : { tty: environment.tty }),
268
310
  })
@@ -1,18 +1,13 @@
1
1
  import { metaOf } from "@wirecat/cli-base/commands"
2
2
  import { writes } from "@wirecat/cli-base/standards"
3
- import { Command } from "commander"
3
+ import type { Command } from "commander"
4
+ import { onBuilt } from "./built-commands.js"
4
5
  import { outputFor } from "./context.js"
5
6
  import { changesAuthority } from "./effects.js"
6
7
  import { itemOf, renderAnswer, snakeKeys } from "./envelope.js"
7
8
  import { previewBody } from "./preview.js"
8
9
  import { shareShadowedOptions } from "./shadowed-options.js"
9
10
 
10
- const descendants = (command: Command, into = new Set<Command>()): Set<Command> => {
11
- into.add(command)
12
- for (const child of command.commands) descendants(child, into)
13
- return into
14
- }
15
-
16
11
  /**
17
12
  * `run` previews a `--dry-run` before any action; a CLI with its own program may let a command through to its
18
13
  * action, as drive does for `upgrade`. This keeps a shared command that writes from writing there. Under `run`
@@ -47,19 +42,12 @@ const identityIn = (args: readonly unknown[]): Identity | undefined => {
47
42
  }
48
43
 
49
44
  /** Wraps a shared command's factory so every command it builds or adds honours a global `--dry-run`. */
50
- export const honoursDryRun =
51
- <A extends unknown[], R>(factory: (...args: A) => R) =>
52
- (...args: A): R => {
53
- const first = args[0]
54
- const before = first instanceof Command ? descendants(first) : new Set<Command>()
55
- const result = factory(...args)
56
- const roots = new Set<Command>()
57
- if (result instanceof Command) roots.add(result)
58
- else if (Array.isArray(result)) for (const one of result) if (one instanceof Command) roots.add(one)
59
- if (first instanceof Command)
60
- for (const command of descendants(first))
61
- if (!before.has(command) && command.parent && before.has(command.parent)) roots.add(command)
62
- const hook = previewWrites(identityIn(args)?.messenger !== false)
63
- for (const root of roots) for (const command of descendants(root)) command.hook("preAction", hook)
64
- return result
65
- }
45
+ export const honoursDryRun = <A extends unknown[], R>(factory: (...args: A) => R) =>
46
+ onBuilt(
47
+ factory,
48
+ (command, args) => {
49
+ command.hook("preAction", previewWrites(identityIn(args)?.messenger !== false))
50
+ },
51
+ // A factory that returns the program it was given has every command of it honour the flag, as it always did.
52
+ { returned: true },
53
+ )
@@ -201,7 +201,7 @@ const askTools = async (run: FirstRun) => {
201
201
  const tool = missing[number - 1] as (typeof missing)[number]
202
202
  const argv = updateCommand(installer, tool.package)
203
203
  if (!argv) {
204
- io.say(`Install ${tool.command} with \`npm install -g ${tool.package}\`.`)
204
+ io.say(`Install ${tool.command} with \`pnpm add -g ${tool.package}\` (or \`npm install -g ${tool.package}\`).`)
205
205
  continue
206
206
  }
207
207
  io.say(`Installing ${tool.command}: ${argv.join(" ")}`)
package/src/cli/guide.ts CHANGED
@@ -9,6 +9,7 @@ import { environmentOf, outputFor } from "./context.js"
9
9
  import { NO_EFFECTS } from "./effects.js"
10
10
  import { itemOf, listOf, renderAnswer } from "./envelope.js"
11
11
  import { commandWords, PROFILE_FREE, usableProfileName } from "./profile.js"
12
+ import { upkeepCommand } from "./upkeep.js"
12
13
 
13
14
  export interface GuideStep {
14
15
  /** The command as a person types it: the tool's name first, no profile — `tg review --since 1d`. */
@@ -168,7 +169,7 @@ const scenarioText = (cli: string, scenario: Scenario, profile: boolean): string
168
169
  * each step as a command and why, and what to look at. The files are parsed when the command runs, never when the
169
170
  * program is built. `checkGuide` validates them in the tool's CI.
170
171
  */
171
- export const guideCommand = (app: Pick<AppIdentity, "command">, options: GuideOptions): Command => {
172
+ export const guideCommand = upkeepCommand((app: Pick<AppIdentity, "command">, options: GuideOptions): Command => {
172
173
  const first = firstScenarioName(options.directory)
173
174
  const command = annotate(new Command("guide"), {
174
175
  effects: NO_EFFECTS,
@@ -216,7 +217,7 @@ export const guideCommand = (app: Pick<AppIdentity, "command">, options: GuideOp
216
217
  })
217
218
  guides.set(command, options)
218
219
  return command
219
- }
220
+ })
220
221
 
221
222
  const OPERATORS: Record<string, string> = {
222
223
  ">": "redirects output to a file",
@@ -15,6 +15,7 @@ import type { LeftChat } from "../../store/chats.js"
15
15
  import { destroysNothing, LOCAL_READ, LOCAL_WRITE, ownerOnlyOption } from "../effects.js"
16
16
  import { itemOf, listOf, renderAnswer, snakeKeys } from "../envelope.js"
17
17
  import { commandAt, lineOf } from "../steps.js"
18
+ import { upkeepCommand } from "../upkeep.js"
18
19
  import { jobsCommand } from "./backfill-command.js"
19
20
  import { type Messenger, messengerContext } from "./context.js"
20
21
  import { admitPassword, linesOf, openFolder, runFileFor, saveManifest, sealRun, writeChanges } from "./export-folder.js"
@@ -26,7 +27,7 @@ import { storeImportCommand } from "./store-import-command.js"
26
27
  import { addStoreMaintenanceCommands } from "./store-maintenance-command.js"
27
28
 
28
29
  /** `store`: the local store of messages — what it holds, filling it, reading it out, and looking after the file. */
29
- export const storeCommand = (messenger: Messenger): Command => {
30
+ export const storeCommand = upkeepCommand((messenger: Messenger): Command => {
30
31
  const store = new Command("store")
31
32
  .description("the local store of messages")
32
33
  .addCommand(statusCommand(messenger))
@@ -56,7 +57,7 @@ export const storeCommand = (messenger: Messenger): Command => {
56
57
  if (command) annotate(command, { examples: [`${messenger.app.command} personal store ${path} ${args}`.trimEnd()] })
57
58
  }
58
59
  return store
59
- }
60
+ })
60
61
 
61
62
  /**
62
63
  * What the local store holds, per chat — read from the store alone. Whether a fetch reached a