@wirecat/amo-cli 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -2
  3. package/contracts/wirecat.json +14 -0
  4. package/dist/amo/button.js +1 -1
  5. package/dist/amo/json.js +1 -1
  6. package/dist/amo/oauth.js +3 -5
  7. package/dist/amo/transport.js +3 -7
  8. package/dist/api-keys.js +1 -1
  9. package/dist/bin/amo.js +11 -11
  10. package/dist/bundle/amo.js +5 -183
  11. package/dist/bundle/{chunk-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
  12. package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
  13. package/dist/bundle/chunk-AEWYRB6F.js +8 -0
  14. package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
  15. package/dist/bundle/chunk-N2UB32VN.js +76 -0
  16. package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
  17. package/dist/bundle/program-SQH3SPOW.js +2352 -0
  18. package/dist/bundle/{instructions-AMH5RWVJ.js → source-C65ZJUTW.js} +5 -6
  19. package/dist/bundle/store-SJ2TOUGU.js +12 -0
  20. package/dist/bundle/writer-I7GBI3VE.js +12 -0
  21. package/dist/commands/account.js +1 -1
  22. package/dist/commands/api.js +1 -3
  23. package/dist/commands/crm-shared.js +2 -3
  24. package/dist/commands/schedule.js +1 -1
  25. package/dist/commands/session.js +1 -8
  26. package/dist/commands/write.js +1 -2
  27. package/dist/config.js +1 -2
  28. package/dist/context.js +1 -2
  29. package/dist/crm/activities.js +1 -1
  30. package/dist/crm/records.js +1 -1
  31. package/dist/crm/source.js +1 -1
  32. package/dist/crm/writer.js +1 -1
  33. package/dist/identity.js +4 -0
  34. package/dist/program.js +1 -2
  35. package/dist/setup/flow.js +1 -1
  36. package/dist/store.js +1 -1
  37. package/dist/version.js +1 -1
  38. package/dist/whoami.js +1 -1
  39. package/package.json +3 -3
  40. package/scenarios/first-sync.md +13 -11
  41. package/scenarios/keep-in-sync.md +7 -6
  42. package/scenarios/safe-agent-writes.md +10 -9
  43. package/dist/amo/account.d.ts +0 -18
  44. package/dist/amo/account.d.ts.map +0 -1
  45. package/dist/amo/account.js.map +0 -1
  46. package/dist/amo/allow-list.d.ts +0 -31
  47. package/dist/amo/allow-list.d.ts.map +0 -1
  48. package/dist/amo/allow-list.js.map +0 -1
  49. package/dist/amo/button.d.ts +0 -53
  50. package/dist/amo/button.d.ts.map +0 -1
  51. package/dist/amo/button.js.map +0 -1
  52. package/dist/amo/errors.d.ts +0 -12
  53. package/dist/amo/errors.d.ts.map +0 -1
  54. package/dist/amo/errors.js.map +0 -1
  55. package/dist/amo/json.d.ts +0 -3
  56. package/dist/amo/json.d.ts.map +0 -1
  57. package/dist/amo/json.js.map +0 -1
  58. package/dist/amo/oauth.d.ts +0 -64
  59. package/dist/amo/oauth.d.ts.map +0 -1
  60. package/dist/amo/oauth.js.map +0 -1
  61. package/dist/amo/operation.d.ts +0 -45
  62. package/dist/amo/operation.d.ts.map +0 -1
  63. package/dist/amo/operation.js.map +0 -1
  64. package/dist/amo/operations.d.ts +0 -3
  65. package/dist/amo/operations.d.ts.map +0 -1
  66. package/dist/amo/operations.js.map +0 -1
  67. package/dist/amo/routes.d.ts +0 -67
  68. package/dist/amo/routes.d.ts.map +0 -1
  69. package/dist/amo/routes.js.map +0 -1
  70. package/dist/amo/transport.d.ts +0 -62
  71. package/dist/amo/transport.d.ts.map +0 -1
  72. package/dist/amo/transport.js.map +0 -1
  73. package/dist/api-keys.d.ts +0 -47
  74. package/dist/api-keys.d.ts.map +0 -1
  75. package/dist/api-keys.js.map +0 -1
  76. package/dist/bin/amo.d.ts +0 -3
  77. package/dist/bin/amo.d.ts.map +0 -1
  78. package/dist/bin/amo.js.map +0 -1
  79. package/dist/bundle/agent-EFMUK732.js +0 -41
  80. package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
  81. package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
  82. package/dist/bundle/app-server-QRBQODF2.js +0 -257
  83. package/dist/bundle/areas-QVHVU57Z.js +0 -63
  84. package/dist/bundle/bun-OPDGMZZQ.js +0 -169
  85. package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
  86. package/dist/bundle/chunk-2JHVQMVC.js +0 -16
  87. package/dist/bundle/chunk-2XBDILVW.js +0 -53
  88. package/dist/bundle/chunk-3DEQUYEG.js +0 -185
  89. package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
  90. package/dist/bundle/chunk-3HC5F3P7.js +0 -24
  91. package/dist/bundle/chunk-3YM4B2GT.js +0 -63
  92. package/dist/bundle/chunk-43OW5NTG.js +0 -338
  93. package/dist/bundle/chunk-43PMSR33.js +0 -357
  94. package/dist/bundle/chunk-4N7PP76S.js +0 -6848
  95. package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
  96. package/dist/bundle/chunk-57HFPNMF.js +0 -189
  97. package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
  98. package/dist/bundle/chunk-633NQY2R.js +0 -80
  99. package/dist/bundle/chunk-63N46DJU.js +0 -12278
  100. package/dist/bundle/chunk-6D4VWSJD.js +0 -259
  101. package/dist/bundle/chunk-6JTHXWPE.js +0 -64
  102. package/dist/bundle/chunk-6QGUK3H7.js +0 -161
  103. package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
  104. package/dist/bundle/chunk-7IR2G5XY.js +0 -559
  105. package/dist/bundle/chunk-7IWIFVXH.js +0 -52
  106. package/dist/bundle/chunk-ABX7BBS4.js +0 -388
  107. package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
  108. package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
  109. package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
  110. package/dist/bundle/chunk-BIKOE2IW.js +0 -614
  111. package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
  112. package/dist/bundle/chunk-CGW5R4UD.js +0 -362
  113. package/dist/bundle/chunk-D4NE7EON.js +0 -170
  114. package/dist/bundle/chunk-D72URWJE.js +0 -532
  115. package/dist/bundle/chunk-DFDN6AUB.js +0 -21
  116. package/dist/bundle/chunk-DNCLQPOM.js +0 -7
  117. package/dist/bundle/chunk-DPV53EZC.js +0 -206
  118. package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
  119. package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
  120. package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
  121. package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
  122. package/dist/bundle/chunk-EHK73OSW.js +0 -2017
  123. package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
  124. package/dist/bundle/chunk-FV4GQNIK.js +0 -136
  125. package/dist/bundle/chunk-G2TU5RYY.js +0 -332
  126. package/dist/bundle/chunk-GDK7ETSB.js +0 -218
  127. package/dist/bundle/chunk-GGMAIIVE.js +0 -38
  128. package/dist/bundle/chunk-GLYWZQY4.js +0 -86
  129. package/dist/bundle/chunk-H4AFNENN.js +0 -1343
  130. package/dist/bundle/chunk-HOF7GQWW.js +0 -142
  131. package/dist/bundle/chunk-HSPEU6S7.js +0 -209
  132. package/dist/bundle/chunk-IA7LLLEI.js +0 -100
  133. package/dist/bundle/chunk-IB55P46L.js +0 -334
  134. package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
  135. package/dist/bundle/chunk-JG6LCSEX.js +0 -407
  136. package/dist/bundle/chunk-JLXXUEAM.js +0 -72
  137. package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
  138. package/dist/bundle/chunk-K7YY6SXR.js +0 -738
  139. package/dist/bundle/chunk-KEKXERBE.js +0 -67181
  140. package/dist/bundle/chunk-KZN2BG3P.js +0 -721
  141. package/dist/bundle/chunk-LKH3UKLO.js +0 -230
  142. package/dist/bundle/chunk-LZPKBN3C.js +0 -193
  143. package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
  144. package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
  145. package/dist/bundle/chunk-NISH4UXM.js +0 -58
  146. package/dist/bundle/chunk-NSKMNIY6.js +0 -460
  147. package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
  148. package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
  149. package/dist/bundle/chunk-Q7ICVP25.js +0 -18
  150. package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
  151. package/dist/bundle/chunk-R53XXHEI.js +0 -76
  152. package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
  153. package/dist/bundle/chunk-RN6RT5CB.js +0 -58
  154. package/dist/bundle/chunk-RRTMPSQR.js +0 -29
  155. package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
  156. package/dist/bundle/chunk-S6JG4YUH.js +0 -72
  157. package/dist/bundle/chunk-TAVI73RW.js +0 -288
  158. package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
  159. package/dist/bundle/chunk-TXDR6YSF.js +0 -23
  160. package/dist/bundle/chunk-TY7NDMFY.js +0 -46
  161. package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
  162. package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
  163. package/dist/bundle/chunk-V2CNGXWX.js +0 -798
  164. package/dist/bundle/chunk-VB7FZOYX.js +0 -633
  165. package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
  166. package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
  167. package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
  168. package/dist/bundle/chunk-WOPVBRPV.js +0 -29
  169. package/dist/bundle/chunk-WXJYMMEL.js +0 -95
  170. package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
  171. package/dist/bundle/chunk-XEQQJBBO.js +0 -92
  172. package/dist/bundle/chunk-XUT7DSM5.js +0 -108
  173. package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
  174. package/dist/bundle/chunk-YWDFYQOU.js +0 -82
  175. package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
  176. package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
  177. package/dist/bundle/cli-3NXOSENF.js +0 -1239
  178. package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
  179. package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
  180. package/dist/bundle/decode-K7U7X5EL.js +0 -296
  181. package/dist/bundle/dispatch-56FECRCU.js +0 -411
  182. package/dist/bundle/dist-PAKDDIBT.js +0 -191
  183. package/dist/bundle/dist-T54K3FJV.js +0 -7577
  184. package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
  185. package/dist/bundle/embed-SWLVG73O.js +0 -37
  186. package/dist/bundle/embedder-EJN75BPV.js +0 -110
  187. package/dist/bundle/failure-WDSX6H3B.js +0 -24
  188. package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
  189. package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
  190. package/dist/bundle/mcp-5HFPWC3W.js +0 -167
  191. package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
  192. package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
  193. package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
  194. package/dist/bundle/node-EGMCBAO7.js +0 -176
  195. package/dist/bundle/node-P4E63KXA.js +0 -2340
  196. package/dist/bundle/node-TLZSIHIJ.js +0 -21
  197. package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
  198. package/dist/bundle/oauth-2SNRBIJM.js +0 -19
  199. package/dist/bundle/open-ABCPY5IH.js +0 -22
  200. package/dist/bundle/openai-4D6PXJR7.js +0 -237
  201. package/dist/bundle/process-SGHEN6MQ.js +0 -91
  202. package/dist/bundle/program-CBDQBZZ3.js +0 -4971
  203. package/dist/bundle/prompt-2QUK5QST.js +0 -16
  204. package/dist/bundle/recognize-QMQSJRIH.js +0 -25
  205. package/dist/bundle/remote-U7TC2BLZ.js +0 -30
  206. package/dist/bundle/rerank-5UPVXGVV.js +0 -51
  207. package/dist/bundle/serve-VX6GUM6J.js +0 -198
  208. package/dist/bundle/server-FOPC6DJ3.js +0 -219
  209. package/dist/bundle/server-OIVNOMVK.js +0 -87
  210. package/dist/bundle/source-HWS5SJIV.js +0 -46
  211. package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
  212. package/dist/bundle/state-X2HU6GB2.js +0 -35
  213. package/dist/bundle/store-2U4U6KL4.js +0 -184
  214. package/dist/bundle/store-3CHPHFP7.js +0 -301
  215. package/dist/bundle/store-Z3747L5F.js +0 -34
  216. package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
  217. package/dist/bundle/surface-MUT72QON.js +0 -73
  218. package/dist/bundle/writer-RBKQ64ZM.js +0 -48
  219. package/dist/commands/account.d.ts +0 -4
  220. package/dist/commands/account.d.ts.map +0 -1
  221. package/dist/commands/account.js.map +0 -1
  222. package/dist/commands/api.d.ts +0 -3
  223. package/dist/commands/api.d.ts.map +0 -1
  224. package/dist/commands/api.js.map +0 -1
  225. package/dist/commands/crm-shared.d.ts +0 -8
  226. package/dist/commands/crm-shared.d.ts.map +0 -1
  227. package/dist/commands/crm-shared.js.map +0 -1
  228. package/dist/commands/schedule.d.ts +0 -3
  229. package/dist/commands/schedule.d.ts.map +0 -1
  230. package/dist/commands/schedule.js.map +0 -1
  231. package/dist/commands/session.d.ts +0 -35
  232. package/dist/commands/session.d.ts.map +0 -1
  233. package/dist/commands/session.js.map +0 -1
  234. package/dist/commands/write.d.ts +0 -14
  235. package/dist/commands/write.d.ts.map +0 -1
  236. package/dist/commands/write.js.map +0 -1
  237. package/dist/config.d.ts +0 -4
  238. package/dist/config.d.ts.map +0 -1
  239. package/dist/config.js.map +0 -1
  240. package/dist/context.d.ts +0 -62
  241. package/dist/context.d.ts.map +0 -1
  242. package/dist/context.js.map +0 -1
  243. package/dist/crm/activities.d.ts +0 -32
  244. package/dist/crm/activities.d.ts.map +0 -1
  245. package/dist/crm/activities.js.map +0 -1
  246. package/dist/crm/records.d.ts +0 -20
  247. package/dist/crm/records.d.ts.map +0 -1
  248. package/dist/crm/records.js.map +0 -1
  249. package/dist/crm/source.d.ts +0 -41
  250. package/dist/crm/source.d.ts.map +0 -1
  251. package/dist/crm/source.js.map +0 -1
  252. package/dist/crm/writer.d.ts +0 -14
  253. package/dist/crm/writer.d.ts.map +0 -1
  254. package/dist/crm/writer.js.map +0 -1
  255. package/dist/identity.d.ts +0 -7
  256. package/dist/identity.d.ts.map +0 -1
  257. package/dist/identity.js.map +0 -1
  258. package/dist/index.d.ts +0 -3
  259. package/dist/index.d.ts.map +0 -1
  260. package/dist/index.js.map +0 -1
  261. package/dist/program.d.ts +0 -6
  262. package/dist/program.d.ts.map +0 -1
  263. package/dist/program.js.map +0 -1
  264. package/dist/reasons.d.ts +0 -10
  265. package/dist/reasons.d.ts.map +0 -1
  266. package/dist/reasons.js.map +0 -1
  267. package/dist/setup/flow.d.ts +0 -2
  268. package/dist/setup/flow.d.ts.map +0 -1
  269. package/dist/setup/flow.js.map +0 -1
  270. package/dist/store.d.ts +0 -15
  271. package/dist/store.d.ts.map +0 -1
  272. package/dist/store.js.map +0 -1
  273. package/dist/version.d.ts +0 -2
  274. package/dist/version.d.ts.map +0 -1
  275. package/dist/version.js.map +0 -1
  276. package/dist/wcat.d.ts +0 -3
  277. package/dist/wcat.d.ts.map +0 -1
  278. package/dist/wcat.js.map +0 -1
  279. package/dist/whoami.d.ts +0 -24
  280. package/dist/whoami.d.ts.map +0 -1
  281. package/dist/whoami.js.map +0 -1
@@ -1,614 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- createRenderer,
5
- fieldsOf,
6
- processStreams,
7
- projectFields
8
- } from "./chunk-WIHN3ELW.js";
9
- import {
10
- COMPACT_FLAG
11
- } from "./chunk-QFOP3KUP.js";
12
- import {
13
- CliError,
14
- singleLine
15
- } from "./chunk-S6JG4YUH.js";
16
- import {
17
- __name
18
- } from "./chunk-ZVVMGPBJ.js";
19
-
20
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/sends/permissions.js
21
- var LEVELS = ["deny", "readonly", "ask", "allow"];
22
- var DANGEROUS = /* @__PURE__ */ new Set([
23
- "messages.delete",
24
- "messages.scheduled.cancel",
25
- "bot.messages.delete",
26
- "topics.delete",
27
- "chats.delete",
28
- "chats.clear"
29
- ]);
30
- var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
31
- var DEFAULT_PERMISSIONS = {
32
- // Owner, 2026-11-14: deleting a message does not ask; a profile that wants the question sets `ask`.
33
- "messages.delete": "allow",
34
- "account.sessions.end": "ask",
35
- "bot.messages.delete": "allow",
36
- "topics.enable": "ask",
37
- "topics.delete": "ask",
38
- "chats.delete": "ask",
39
- "chats.clear": "ask",
40
- // Owner, 2026-11-14 (replaces NEED-568): a rule the owner enabled may send; `deny` stops every automatic reply.
41
- "replies.send": "allow",
42
- // NEED-1662: an agent that changes settings, schedules or recipients could lift its own limits; the owner opts in.
43
- "mcp.authority": "deny",
44
- // NEED-1663: writes no level stopped before, so MCP could not offer them; over MCP `ask` goes ahead.
45
- "store.backup": "ask",
46
- "store.restore": "ask",
47
- "store.migrate": "ask",
48
- "store.repair": "ask",
49
- "store.reset": "ask",
50
- "store.import": "ask",
51
- "store.clear": "ask",
52
- "store.decrypt": "ask",
53
- "store.copies.delete": "ask",
54
- "store.recover.run": "ask",
55
- "server.start": "ask",
56
- "server.stop": "ask",
57
- "server.restart": "ask",
58
- "models.download": "ask",
59
- // NEED-2357.f: many MCP clients (ChatGPT) cannot answer a question, and a switch deletes nothing; kept as a key so a
60
- // profile can still deny it.
61
- "models.set": "allow",
62
- "models.add": "ask",
63
- "images.models.download": "ask",
64
- "schedule.run": "ask",
65
- "schedule.exec": "ask",
66
- "doctor.reports.create": "ask",
67
- // A meeting changed on the service reaches its invitees: asked first, as zoom's `remote-meetings` was.
68
- "meetings.create": "ask",
69
- "meetings.update": "ask",
70
- "meetings.cancel": "ask"
71
- };
72
- var KEYED_UNDER_HOUSEKEEPING = new Set(Object.keys(DEFAULT_PERMISSIONS).filter((key) => /^(store|server|models|images|schedule|doctor)\./.test(key)));
73
- var AUTHORITY_KEY = "mcp.authority";
74
- var authorityAllowed = /* @__PURE__ */ __name((levels) => {
75
- const { level } = levelFor(levels, AUTHORITY_KEY);
76
- return level === "allow" || level === "ask";
77
- }, "authorityAllowed");
78
- var BOT_API_KEY = "bot.api";
79
- var isBotApi = /* @__PURE__ */ __name((path) => path[0] === "bot" && path[1] === "api", "isBotApi");
80
- var botApiAllowed = /* @__PURE__ */ __name((levels) => {
81
- const { level } = levelFor(levels, BOT_API_KEY, { ...DEFAULT_PERMISSIONS, [BOT_API_KEY]: "deny" });
82
- return level === "allow" || level === "ask";
83
- }, "botApiAllowed");
84
- var RESOURCES = [
85
- "messages",
86
- "drafts",
87
- "reactions",
88
- "polls",
89
- "topics",
90
- "chats",
91
- "contacts",
92
- "account",
93
- "bot",
94
- "conversations",
95
- "tags",
96
- "mentions",
97
- "search",
98
- "searches",
99
- "tasks",
100
- "replies",
101
- "attachments",
102
- "stats",
103
- "store",
104
- "metadata",
105
- "mcp",
106
- "server",
107
- "models",
108
- "schedule",
109
- "doctor",
110
- "images"
111
- ];
112
- var layerPermissions = /* @__PURE__ */ __name((layers) => {
113
- const levels = {};
114
- const sources = {};
115
- for (const [from, layer] of layers) {
116
- const nearer = Object.keys(levels);
117
- for (const [key, level] of Object.entries(layer ?? {})) {
118
- if (nearer.some((named2) => key === named2 || key.startsWith(`${named2}.`)))
119
- continue;
120
- levels[key] = level;
121
- sources[key] = from;
122
- }
123
- }
124
- return { levels, sources };
125
- }, "layerPermissions");
126
- var CEILING_KEY = "*";
127
- var STORE_ONLY_KEYS = /* @__PURE__ */ new Set([
128
- "attachments.extract",
129
- "conversations.embeddings",
130
- "conversations.links",
131
- "messages.server-search",
132
- "messages.sync-first",
133
- "metadata.sync",
134
- "stats.contacts.top.sync-first",
135
- "stats.messages.counters.sync",
136
- "stats.messages.show.sync-first",
137
- "stats.messages.top.sync-first",
138
- "store.gaps.repair"
139
- ]);
140
- var FETCH_KEYS = new Set([...STORE_ONLY_KEYS].filter((key) => !["attachments.extract", "conversations.embeddings", "conversations.links"].includes(key)));
141
- var fetchesUnder = /* @__PURE__ */ __name((level, key) => level === "readonly" && FETCH_KEYS.has(key), "fetchesUnder");
142
- var fetchesAt = /* @__PURE__ */ __name((level) => level === "allow" || level === "readonly", "fetchesAt");
143
- var stops = /* @__PURE__ */ __name((level, key) => level === "deny" || level === "readonly" && !FETCH_KEYS.has(key), "stops");
144
- var ALLOWED = { level: "allow", key: null };
145
- var ORDER = { deny: 0, readonly: 1, ask: 2, allow: 3 };
146
- var nearest = /* @__PURE__ */ __name((levels, key) => {
147
- for (let parts = key.split("."); parts.length > 0; parts = parts.slice(0, -1)) {
148
- const named2 = parts.join(".");
149
- const level = levels[named2];
150
- if (level)
151
- return { level, key: named2, depth: parts.length };
152
- }
153
- return void 0;
154
- }, "nearest");
155
- var levelFor = /* @__PURE__ */ __name((permissions, key, defaults = DEFAULT_PERMISSIONS) => {
156
- const found = profileLevel(permissions, key, defaults);
157
- const ceiling = permissions[CEILING_KEY];
158
- return ceiling && ORDER[ceiling] < ORDER[found.level] ? { level: ceiling, key: CEILING_KEY } : found;
159
- }, "levelFor");
160
- var profileLevel = /* @__PURE__ */ __name((permissions, key, defaults) => {
161
- const own = nearest(permissions, key);
162
- const builtIn = nearest(defaults, key);
163
- if (!builtIn || own && own.depth >= builtIn.depth)
164
- return own ? { level: own.level, key: own.key } : ALLOWED;
165
- if (!own || ORDER[builtIn.level] <= ORDER[own.level])
166
- return { level: builtIn.level, key: builtIn.key };
167
- return { level: own.level, key: own.key };
168
- }, "profileLevel");
169
- var CHAT_KEYS = {
170
- settings: "chats.update",
171
- "requests.accept": "chats.requests.confirm",
172
- "requests.decline": "chats.requests.reject",
173
- "link.create": "chats.links.create",
174
- "link.reset": "chats.links.reset",
175
- "link.revoke": "chats.links.remove",
176
- "link.update": "chats.links.update"
177
- };
178
- var ACCOUNT_KEYS = {
179
- "contact-add": "contacts.add",
180
- "contact-remove": "contacts.remove",
181
- "contact-import": "contacts.import",
182
- "contact-rename": "contacts.rename",
183
- "contact-block": "contacts.block",
184
- "contact-unblock": "contacts.unblock",
185
- profile: "account.update",
186
- "folder-create": "chats.folders.create",
187
- "folder-update": "chats.folders.update",
188
- "folder-delete": "chats.folders.delete",
189
- "folder-order": "chats.folders.order",
190
- "folder-join": "chats.folders.join",
191
- "sessions-end": "account.sessions.end",
192
- "chat-mute": "chats.mute",
193
- "chat-unmute": "chats.unmute",
194
- "chat-archive": "chats.archive",
195
- "chat-unarchive": "chats.unarchive",
196
- "chat-pin": "chats.pin",
197
- "chat-unpin": "chats.unpin",
198
- "chat-mark-unread": "chats.mark-unread",
199
- "message-star": "messages.star",
200
- "message-unstar": "messages.unstar",
201
- // A mail CLI names its own key on every write; these only answer `keyForWrite` when one is left out.
202
- "message-flag": "messages.update",
203
- "message-move": "messages.move",
204
- "message-copy": "messages.copy",
205
- "message-delete": "messages.trash",
206
- "message-restore": "messages.restore",
207
- privacy: "account.privacy.set"
208
- };
209
- var KIND_KEYS = {
210
- message: "messages.send",
211
- forward: "messages.forward",
212
- edit: "messages.edit",
213
- pin: "messages.pin",
214
- reaction: "reactions",
215
- read: "chats.mark-read",
216
- delete: "messages.delete"
217
- };
218
- var keyForWrite = /* @__PURE__ */ __name((kind, action) => {
219
- if (kind === "chat")
220
- return CHAT_KEYS[action] ?? `chats.${action ?? "update"}`;
221
- if (kind === "account") {
222
- const key = ACCOUNT_KEYS[action];
223
- if (!key)
224
- throw new Error(`an account change without a known action: ${action}`);
225
- return key;
226
- }
227
- return KIND_KEYS[kind];
228
- }, "keyForWrite");
229
- var writeOfKey = /* @__PURE__ */ __name((key) => {
230
- const account = Object.entries(ACCOUNT_KEYS).find(([, named2]) => named2 === key)?.[0];
231
- if (account)
232
- return { kind: "account", action: account };
233
- const kind = Object.entries(KIND_KEYS).find(([, named2]) => named2 === key || key.startsWith(`${named2}.`))?.[0];
234
- if (kind)
235
- return { kind };
236
- if (key === "messages.unpin")
237
- return { kind: "pin" };
238
- if (key.startsWith("chats.")) {
239
- const action = Object.entries(CHAT_KEYS).find(([, named2]) => named2 === key)?.[0] ?? key.slice("chats.".length);
240
- return { kind: "chat", action };
241
- }
242
- return {};
243
- }, "writeOfKey");
244
- var NAMED_WRITE_KEYS = [
245
- "drafts",
246
- "store.gaps.repair",
247
- "messages.sync-first",
248
- "messages.server-search",
249
- "messages.press",
250
- "messages.scheduled.cancel",
251
- "messages.scheduled.edit",
252
- "messages.scheduled.send",
253
- "chats.start",
254
- "chats.app",
255
- "stats.messages.counters.sync",
256
- "stats.messages.show.sync-first",
257
- "stats.messages.top.sync-first",
258
- "stats.contacts.top.sync-first",
259
- "account.sessions.list",
260
- "attachments.extract",
261
- "attachments.move",
262
- "attachments.update",
263
- "bot.callbacks.answer",
264
- "bot.chats.action",
265
- "bot.chats.admins.add",
266
- "bot.chats.admins.remove",
267
- "bot.chats.leave",
268
- "bot.chats.members.remove",
269
- "bot.chats.moderate",
270
- "bot.messages.delete",
271
- "bot.messages.edit",
272
- "bot.messages.pin",
273
- "bot.messages.send",
274
- "bot.messages.unpin",
275
- "chats.admins.add",
276
- "chats.admins.remove",
277
- "chats.links.create",
278
- "chats.links.reset",
279
- "chats.links.remove",
280
- "chats.links.update",
281
- "chats.members.add",
282
- "chats.members.remove",
283
- "chats.moderate",
284
- "conversations.embeddings",
285
- "conversations.links",
286
- "polls.close",
287
- "polls.create",
288
- "polls.vote",
289
- "searches.clear",
290
- "searches.create",
291
- "searches.delete",
292
- "contacts.aliases.set",
293
- "contacts.aliases.remove",
294
- "contacts.notes.add",
295
- "contacts.notes.edit",
296
- "contacts.notes.remove",
297
- "tags.rebuild",
298
- "metadata.sync",
299
- "mentions.rebuild",
300
- "mentions.confirm",
301
- "mentions.reject",
302
- "tags.add",
303
- "tags.remove",
304
- "tasks.acknowledge",
305
- "tasks.add",
306
- "tasks.claim",
307
- "tasks.close",
308
- "tasks.duplicates.defer",
309
- "tasks.duplicates.reject",
310
- "tasks.link",
311
- "tasks.merge",
312
- "tasks.update",
313
- "tasks.release",
314
- "tasks.scan",
315
- "tasks.unmerge",
316
- "topics.create",
317
- "topics.edit",
318
- "topics.enable"
319
- ];
320
- var WRITE_KEYS = [
321
- .../* @__PURE__ */ new Set([
322
- ...NAMED_WRITE_KEYS,
323
- ...Object.keys(DEFAULT_PERMISSIONS),
324
- ...Object.values(KIND_KEYS),
325
- ...Object.values(ACCOUNT_KEYS),
326
- ...Object.values(CHAT_KEYS)
327
- ])
328
- ];
329
- var HOUSEKEEPING = /* @__PURE__ */ new Set([
330
- "help",
331
- "guide",
332
- "config",
333
- "session",
334
- "doctor",
335
- "commands",
336
- "complete",
337
- "upgrade",
338
- "skill",
339
- "models",
340
- "server",
341
- // What a schedule runs is checked by its own key when it runs; an agent runs read-only.
342
- "schedule",
343
- "runs",
344
- "sends",
345
- "recipients",
346
- "flood",
347
- "mcp",
348
- // Its commands read the rules or flip the pause switch; what a rule sends is checked as `replies.send`.
349
- "replies"
350
- ]);
351
- var BOT_HOUSEKEEPING = /* @__PURE__ */ new Set(["auth", "list", "sends", "recipients", "mcp"]);
352
- var STORE_MAINTENANCE = /* @__PURE__ */ new Set(["info", "check", "copies"]);
353
- var SHOW_MESSAGES = /* @__PURE__ */ new Set(["inbox", "review", "watch", "serve", "store", "conversations", "projects"]);
354
- var readKeysForCommand = /* @__PURE__ */ __name((path) => {
355
- if (path[0] === "bot")
356
- return readKeysForCommand(path.slice(1)).map((key2) => `bot.${key2}`);
357
- const key = keyForCommand(path);
358
- if (!key)
359
- return [];
360
- if (path[0] === "attachments" && path[1] === "download")
361
- return [key, "messages", "chats"];
362
- if (path[0] === "attachments" && (path[1] === "extract" || path[1] === "show"))
363
- return [key, "messages"];
364
- if (path[0] === "store" && path[1] === "gaps" && path[2] === "repair")
365
- return [key, "messages"];
366
- if (path[0] === "store" && ["reset", "clear", "decrypt"].includes(path[1] ?? ""))
367
- return [key, "messages"];
368
- if (key === "store.recover.run")
369
- return [key, "messages"];
370
- if (path[0] === "search") {
371
- if (path[1] === "notes")
372
- return [key];
373
- if (path[1] === "topics")
374
- return [key, "topics"];
375
- if (path[1] === "conversations")
376
- return [key, "messages", "conversations"];
377
- return [key, "messages"];
378
- }
379
- if (path[0] !== "stats")
380
- return [key];
381
- const resource = path[1] === "charts" ? "chats" : path[1];
382
- return [
383
- .../* @__PURE__ */ new Set([
384
- key,
385
- "messages",
386
- ...["chats", "contacts", "tasks"].includes(resource ?? "") ? [resource] : []
387
- ])
388
- ];
389
- }, "readKeysForCommand");
390
- var keyForCommand = /* @__PURE__ */ __name((path) => {
391
- if (path.length === 0)
392
- return null;
393
- const [top, next] = path;
394
- if (top === "bot") {
395
- if (next === void 0 || BOT_HOUSEKEEPING.has(next))
396
- return null;
397
- const inner = keyForCommand(path.slice(1));
398
- return `bot.${inner ?? path.slice(1).join(".")}`;
399
- }
400
- if (KEYED_UNDER_HOUSEKEEPING.has(path.join(".")))
401
- return path.join(".");
402
- if (top === void 0 || HOUSEKEEPING.has(top) || top === "search" && next === "runs")
403
- return null;
404
- if (top === "images" && next === "models")
405
- return null;
406
- if (top === "attachments" && (next === "check" || next === "jobs"))
407
- return null;
408
- if (top === "attachments" && next === "download")
409
- return "messages";
410
- if (top === "store" && next !== void 0 && STORE_MAINTENANCE.has(next))
411
- return null;
412
- if (top === "conversations" && next === "links")
413
- return path[2] === "rebuild" ? "conversations.links.rebuild" : "conversations.links";
414
- if (top === "conversations" && (next === "embeddings" || next === "embed") || top === "images" && next === "embed" || top === "conversations" && next === "rebuild")
415
- return "conversations.embeddings";
416
- if (top === "attachments" && next === "list" || top === "chats" && next === "documents")
417
- return "messages";
418
- if (top === "mentions")
419
- return next === "rebuild" || next === "confirm" || next === "reject" ? `mentions.${next}` : "messages";
420
- if (top === "store" && (next === "gaps" || next === "jobs"))
421
- return path.join(".");
422
- if (SHOW_MESSAGES.has(top) || top === "contacts" && (next === "context" || next === "prepare" || next === "events"))
423
- return "messages";
424
- if (RESOURCES.includes(top))
425
- return path.join(".");
426
- return void 0;
427
- }, "keyForCommand");
428
- var RESOURCE_KEY = new RegExp(`^(${RESOURCES.join("|")})(\\.[a-z][a-z-]*)*$`);
429
- var COMMAND_PATH_KEY = /^[a-z][a-z-]*(\.[a-zA-Z][a-zA-Z-]*)*$/;
430
- var permissionOverrides = /* @__PURE__ */ __name((entries = [], shape = RESOURCE_KEY) => {
431
- const levels = {};
432
- const example = shape === RESOURCE_KEY ? "messages.send=allow" : "api=readonly";
433
- for (const entry of entries) {
434
- const [key = "", level = "", extra] = entry.split("=");
435
- if (!shape.test(key) || !LEVELS.includes(level) || extra !== void 0)
436
- throw new CliError("validation_error", `--permission takes a command path and level, e.g. ${example} (deny, readonly, ask, allow)`);
437
- levels[key] = level;
438
- }
439
- return levels;
440
- }, "permissionOverrides");
441
- var assertOverridesTighten = /* @__PURE__ */ __name((overrides, profile, defaults = DEFAULT_PERMISSIONS) => {
442
- for (const [key, level] of Object.entries(overrides)) {
443
- const under = Object.keys(profile).filter((named2) => named2.startsWith(`${key}.`));
444
- const lifted = [key, ...under].find((named2) => ORDER[level] > ORDER[levelFor(profile, named2, defaults).level]);
445
- if (lifted !== void 0)
446
- throw new CliError("validation_error", `--permission ${key}=${level} would loosen ${lifted} from ${levelFor(profile, lifted, defaults).level}; it only tightens \u2014 change the profile's permissions to loosen it`, { key, lifted });
447
- }
448
- }, "assertOverridesTighten");
449
- var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
450
- for (const permission of ["stats.chats.retention", "chats"]) {
451
- if (levelFor(permissions, permission).level === "deny")
452
- throw new CliError("permission_error", `profile denies ${permission}`, { permission });
453
- }
454
- }, "assertRetentionEvidenceRead");
455
-
456
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
457
- var named = /* @__PURE__ */ __name((work) => {
458
- try {
459
- return work();
460
- } catch (error) {
461
- if (error instanceof CliError && error.code === "validation_error")
462
- throw new CliError("validation_error", "--json takes comma-separated field paths, for example --json=id,text", {
463
- param: "--json"
464
- });
465
- throw error;
466
- }
467
- }, "named");
468
- var fieldsOf2 = /* @__PURE__ */ __name((value) => named(() => fieldsOf(value)), "fieldsOf");
469
- var projectCommands = /* @__PURE__ */ __name((commands, fields) => commands.map((command) => ({
470
- ...projectFields(command, fields),
471
- path: command.path,
472
- name: command.name,
473
- origin: command.origin,
474
- effects: command.effects,
475
- commands: projectCommands(command.commands, fields)
476
- })), "projectCommands");
477
- var projectFields2 = /* @__PURE__ */ __name((value, fields) => named(() => {
478
- if (value && typeof value === "object" && "cli" in value && typeof value.cli === "string" && "contract" in value && "commands" in value && Array.isArray(value.commands))
479
- return { ...value, commands: projectCommands(value.commands, fields) };
480
- return projectFields(value, fields);
481
- }), "projectFields");
482
-
483
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/output-detail.js
484
- var RARELY_SET = ["editedAt", "replyTo", "forwardedFrom", "reactions"];
485
- var BRIEF = ["locator", "chatTitle", "timestamp", "senderName", "excerpt", "score"];
486
- var SNAKE_BRIEF = ["ref", "chat_title", "timestamp", "sender_name", "excerpt", "score"];
487
- var isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null, "isRecord");
488
- var isSnakeHit = /* @__PURE__ */ __name((value) => isRecord(value) && typeof value.ref === "string" && typeof value.excerpt === "string", "isSnakeHit");
489
- var isHit = /* @__PURE__ */ __name((value) => isSnakeHit(value) || isRecord(value) && typeof value.locator === "string" && typeof value.text === "string", "isHit");
490
- var picked = /* @__PURE__ */ __name((hit, keys) => Object.fromEntries(keys.flatMap((key) => hit[key] === void 0 || hit[key] === null ? [] : [[key, hit[key]]])), "picked");
491
- var shaped = /* @__PURE__ */ __name((hit, detail) => {
492
- if (isSnakeHit(hit))
493
- return detail === "brief" ? picked(hit, SNAKE_BRIEF) : hit;
494
- if (detail === "brief")
495
- return picked(hit, BRIEF);
496
- const { text, providerMetadata, ...rest } = hit;
497
- for (const key of RARELY_SET)
498
- if (rest[key] === null)
499
- delete rest[key];
500
- const metadata = rest.email ? void 0 : providerMetadata;
501
- return {
502
- ...rest,
503
- ...typeof rest.excerpt === "string" ? {} : { text },
504
- ...metadata === void 0 ? {} : { providerMetadata: metadata }
505
- };
506
- }, "shaped");
507
- var atDetail = /* @__PURE__ */ __name((value, detail = "default") => {
508
- if (detail === "full")
509
- return value;
510
- if (Array.isArray(value))
511
- return value.map((item) => isHit(item) ? shaped(item, detail) : item);
512
- if (isHit(value))
513
- return shaped(value, detail);
514
- if (typeof value === "object" && value !== null && Array.isArray(value.items))
515
- return { ...value, items: atDetail(value.items, detail) };
516
- return value;
517
- }, "atDetail");
518
-
519
- // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/output.js
520
- var refuseCompact = /* @__PURE__ */ __name(({ json, jsonl, fields, hitDetail }) => {
521
- const other = jsonl ? "--jsonl" : fields !== void 0 ? "--json=\u2026" : json ? "--json" : hitDetail === "brief" ? "--brief" : "";
522
- if (other)
523
- throw new CliError("validation_error", `${COMPACT_FLAG} and ${other} ask for different output \u2014 pick one`, {
524
- reason: "output.conflict",
525
- param: COMPACT_FLAG
526
- });
527
- }, "refuseCompact");
528
- var resolveOutput = /* @__PURE__ */ __name(({ json, jsonl, quiet, streams = processStreams, tty, color, fields, hitDetail, env = process.env, capture, compact } = {}) => {
529
- if (compact)
530
- refuseCompact({ json, jsonl, fields, hitDetail });
531
- const interactive = tty ?? process.stdout.isTTY === true;
532
- const format = jsonl ? "jsonl" : json || compact || !interactive ? "json" : "pretty";
533
- const painted = format === "pretty" && (color ?? (env.NO_COLOR === void 0 && env.TERM !== "dumb" && !env.CI));
534
- const printing = createRenderer({ format, color: painted, streams });
535
- const rendered = capture ? { ...printing, result: capture, stream: /* @__PURE__ */ __name((items) => capture([...items]), "stream") } : printing;
536
- const level = hitDetail ?? (fields === void 0 ? "default" : "full");
537
- const standard = format === "pretty" ? rendered : {
538
- ...rendered,
539
- result: /* @__PURE__ */ __name((value) => rendered.result(atDetail(value, level)), "result"),
540
- stream: /* @__PURE__ */ __name((items) => rendered.stream(atDetail([...items], level)), "stream")
541
- };
542
- const created = standard;
543
- const paths = fields === void 0 ? void 0 : fieldsOf2(fields);
544
- const renderer = format === "pretty" ? oneLineFields(created) : paths ? {
545
- ...created,
546
- result: /* @__PURE__ */ __name((value) => created.result(projectFields2(value, paths)), "result"),
547
- stream: /* @__PURE__ */ __name((items) => created.stream([...items].map((item) => projectFields2(item, paths))), "stream")
548
- } : created;
549
- return {
550
- format,
551
- color: painted,
552
- streams,
553
- renderer: quiet ? silence(renderer) : renderer,
554
- ...compact ? { compact: true, full: hitDetail === "full" } : {}
555
- };
556
- }, "resolveOutput");
557
- var MULTI_LINE = /* @__PURE__ */ new Set(["text", "description"]);
558
- var oneLineFields = /* @__PURE__ */ __name((renderer) => ({
559
- ...renderer,
560
- result: /* @__PURE__ */ __name((value) => renderer.result(oneLine(value)), "result"),
561
- stream: /* @__PURE__ */ __name((items) => renderer.stream([...items].map((item) => oneLine(item))), "stream")
562
- }), "oneLineFields");
563
- var oneLine = /* @__PURE__ */ __name((value, key) => {
564
- if (typeof value === "string")
565
- return key !== void 0 && MULTI_LINE.has(key) ? value : singleLine(value);
566
- if (Array.isArray(value))
567
- return value.map((item) => oneLine(item, key));
568
- if (value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
569
- return Object.fromEntries(Object.entries(value).map(([field, item]) => [field, oneLine(item, field)]));
570
- }
571
- return value;
572
- }, "oneLine");
573
- var silence = /* @__PURE__ */ __name((renderer) => ({
574
- ...renderer,
575
- note: /* @__PURE__ */ __name(() => {
576
- }, "note"),
577
- success: /* @__PURE__ */ __name(() => {
578
- }, "success"),
579
- warn: /* @__PURE__ */ __name(() => {
580
- }, "warn")
581
- }), "silence");
582
-
583
- export {
584
- LEVELS,
585
- skipFlagFor,
586
- DEFAULT_PERMISSIONS,
587
- KEYED_UNDER_HOUSEKEEPING,
588
- AUTHORITY_KEY,
589
- authorityAllowed,
590
- BOT_API_KEY,
591
- isBotApi,
592
- botApiAllowed,
593
- RESOURCES,
594
- layerPermissions,
595
- CEILING_KEY,
596
- STORE_ONLY_KEYS,
597
- fetchesUnder,
598
- fetchesAt,
599
- stops,
600
- levelFor,
601
- keyForWrite,
602
- writeOfKey,
603
- WRITE_KEYS,
604
- readKeysForCommand,
605
- keyForCommand,
606
- RESOURCE_KEY,
607
- COMMAND_PATH_KEY,
608
- permissionOverrides,
609
- assertOverridesTighten,
610
- assertRetentionEvidenceRead,
611
- fieldsOf2 as fieldsOf,
612
- projectFields2 as projectFields,
613
- resolveOutput
614
- };