@openacp/cli 0.6.10 → 2026.326.3

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 (256) hide show
  1. package/dist/{action-detect-P7ZE4NEM.js → action-detect-QPA775HB.js} +2 -2
  2. package/dist/adapter-6ANPBSVU.js +16 -0
  3. package/dist/{discord-OMC52Y54.js → adapter-77ZCVABT.js} +520 -365
  4. package/dist/adapter-77ZCVABT.js.map +1 -0
  5. package/dist/{adapter-ZOANORGM.js → adapter-PQGHVG4K.js} +300 -93
  6. package/dist/adapter-PQGHVG4K.js.map +1 -0
  7. package/dist/{admin-6SYB6XCZ.js → admin-GBPZFFAU.js} +3 -3
  8. package/dist/agent-catalog-YHBFERYO.js +11 -0
  9. package/dist/{agent-dependencies-4OWBMZWZ.js → agent-dependencies-WS7Z2DFW.js} +2 -2
  10. package/dist/agent-registry-5LZT7CUB.js +9 -0
  11. package/dist/agent-store-VSHNY5GT.js +9 -0
  12. package/dist/{agents-QO7DKARJ.js → agents-BWU4MRRD.js} +3 -3
  13. package/dist/{api-client-CFQT5U7D.js → api-client-AQPNKXI2.js} +2 -2
  14. package/dist/api-server-3PYLRBCN.js +8 -0
  15. package/dist/api-server-CHVSUDBX.js +11 -0
  16. package/dist/{autostart-X33OGMX6.js → autostart-6JS565RY.js} +3 -3
  17. package/dist/chunk-2CX4IEEC.js +124 -0
  18. package/dist/chunk-2CX4IEEC.js.map +1 -0
  19. package/dist/{chunk-O7CPGUAI.js → chunk-4KGLKKQK.js} +4 -4
  20. package/dist/chunk-4KGLKKQK.js.map +1 -0
  21. package/dist/{chunk-W3EYKZNQ.js → chunk-4WXALZA3.js} +2 -2
  22. package/dist/chunk-4WXALZA3.js.map +1 -0
  23. package/dist/chunk-5OCGO27U.js +125 -0
  24. package/dist/chunk-5OCGO27U.js.map +1 -0
  25. package/dist/{chunk-OWP7RZ62.js → chunk-5ZOFBTOR.js} +118 -262
  26. package/dist/chunk-5ZOFBTOR.js.map +1 -0
  27. package/dist/chunk-6RXVEXF3.js +23 -0
  28. package/dist/chunk-6RXVEXF3.js.map +1 -0
  29. package/dist/{chunk-34M4OS5P.js → chunk-A6Y4GZM3.js} +3 -3
  30. package/dist/chunk-A6Y4GZM3.js.map +1 -0
  31. package/dist/chunk-AD3X6DGK.js +166 -0
  32. package/dist/chunk-AD3X6DGK.js.map +1 -0
  33. package/dist/{chunk-7QJS2XBD.js → chunk-AFKX424Q.js} +2 -2
  34. package/dist/chunk-AFKX424Q.js.map +1 -0
  35. package/dist/chunk-APS6UEFU.js +259 -0
  36. package/dist/chunk-APS6UEFU.js.map +1 -0
  37. package/dist/chunk-BLQUXO7S.js +113 -0
  38. package/dist/chunk-BLQUXO7S.js.map +1 -0
  39. package/dist/{chunk-WTZDAYZX.js → chunk-BQ6FR32N.js} +3 -3
  40. package/dist/chunk-BQ6FR32N.js.map +1 -0
  41. package/dist/chunk-FNRSWA2K.js +1 -0
  42. package/dist/chunk-FQEBWOZR.js +3557 -0
  43. package/dist/chunk-FQEBWOZR.js.map +1 -0
  44. package/dist/{chunk-4CTX774K.js → chunk-GJOY37U7.js} +4 -4
  45. package/dist/chunk-GJOY37U7.js.map +1 -0
  46. package/dist/{chunk-I7WC6E5S.js → chunk-HVBNCPAY.js} +2 -2
  47. package/dist/chunk-HVBNCPAY.js.map +1 -0
  48. package/dist/{chunk-2HMQOC7N.js → chunk-I3CGU5W7.js} +4 -4
  49. package/dist/chunk-I3CGU5W7.js.map +1 -0
  50. package/dist/{chunk-NVPG6JCL.js → chunk-L7YNNBI5.js} +3 -3
  51. package/dist/chunk-L7YNNBI5.js.map +1 -0
  52. package/dist/chunk-LGFWH3AE.js +26 -0
  53. package/dist/chunk-LGFWH3AE.js.map +1 -0
  54. package/dist/chunk-MLF4W5R6.js +101 -0
  55. package/dist/chunk-MLF4W5R6.js.map +1 -0
  56. package/dist/{chunk-KIRH7TUJ.js → chunk-MTSDOSXS.js} +3 -3
  57. package/dist/chunk-MTSDOSXS.js.map +1 -0
  58. package/dist/{chunk-J4SJTKIK.js → chunk-NAM4ERUW.js} +3 -3
  59. package/dist/chunk-NAM4ERUW.js.map +1 -0
  60. package/dist/{chunk-MKHUZLII.js → chunk-NBFIBGAT.js} +39 -25
  61. package/dist/chunk-NBFIBGAT.js.map +1 -0
  62. package/dist/{chunk-BNLGTZ34.js → chunk-O5RG4YZY.js} +3 -3
  63. package/dist/chunk-O5RG4YZY.js.map +1 -0
  64. package/dist/{chunk-JHYXKVV2.js → chunk-ODUM3D6X.js} +2 -2
  65. package/dist/chunk-ODUM3D6X.js.map +1 -0
  66. package/dist/chunk-OYSAN7UX.js +15 -0
  67. package/dist/chunk-OYSAN7UX.js.map +1 -0
  68. package/dist/chunk-P4SNGQNI.js +158 -0
  69. package/dist/chunk-P4SNGQNI.js.map +1 -0
  70. package/dist/{chunk-2CJ46J3C.js → chunk-PPSMUECX.js} +3 -3
  71. package/dist/chunk-PPSMUECX.js.map +1 -0
  72. package/dist/chunk-Q6ZXJTZB.js +56 -0
  73. package/dist/chunk-Q6ZXJTZB.js.map +1 -0
  74. package/dist/{chunk-XANPHG7W.js → chunk-QSDZDHNS.js} +7 -7
  75. package/dist/chunk-QSDZDHNS.js.map +1 -0
  76. package/dist/{chunk-33RP6K2O.js → chunk-QVMEF6FB.js} +6 -6
  77. package/dist/chunk-QVMEF6FB.js.map +1 -0
  78. package/dist/chunk-QWP76EBW.js +536 -0
  79. package/dist/chunk-QWP76EBW.js.map +1 -0
  80. package/dist/{chunk-V5GZQEIY.js → chunk-RBYBSSGO.js} +4 -4
  81. package/dist/chunk-RBYBSSGO.js.map +1 -0
  82. package/dist/{chunk-CS3KCJ5D.js → chunk-RKB2ZK6S.js} +555 -383
  83. package/dist/chunk-RKB2ZK6S.js.map +1 -0
  84. package/dist/{chunk-UKT3G5IA.js → chunk-SHTGQGAU.js} +7 -7
  85. package/dist/chunk-SHTGQGAU.js.map +1 -0
  86. package/dist/chunk-SNPYTMPR.js +51 -0
  87. package/dist/chunk-SNPYTMPR.js.map +1 -0
  88. package/dist/chunk-UB2QB6DE.js +124 -0
  89. package/dist/chunk-UB2QB6DE.js.map +1 -0
  90. package/dist/chunk-UNJUWWQO.js +1108 -0
  91. package/dist/chunk-UNJUWWQO.js.map +1 -0
  92. package/dist/chunk-V2M243KZ.js +445 -0
  93. package/dist/chunk-V2M243KZ.js.map +1 -0
  94. package/dist/chunk-V5JT5TPD.js +97 -0
  95. package/dist/chunk-V5JT5TPD.js.map +1 -0
  96. package/dist/chunk-W26AUH5B.js +61 -0
  97. package/dist/chunk-W26AUH5B.js.map +1 -0
  98. package/dist/chunk-WAAD23KY.js +222 -0
  99. package/dist/chunk-WAAD23KY.js.map +1 -0
  100. package/dist/chunk-WIIZNPCR.js +150 -0
  101. package/dist/chunk-WIIZNPCR.js.map +1 -0
  102. package/dist/chunk-WQCJTU2C.js +84 -0
  103. package/dist/chunk-WQCJTU2C.js.map +1 -0
  104. package/dist/chunk-WVLDNYOJ.js +150 -0
  105. package/dist/chunk-WVLDNYOJ.js.map +1 -0
  106. package/dist/chunk-WXVT3AOY.js +22 -0
  107. package/dist/chunk-WXVT3AOY.js.map +1 -0
  108. package/dist/{chunk-GAK6PIBW.js → chunk-XMMAGAT4.js} +2 -2
  109. package/dist/chunk-XMMAGAT4.js.map +1 -0
  110. package/dist/chunk-Y64XWMJ4.js +212 -0
  111. package/dist/chunk-Y64XWMJ4.js.map +1 -0
  112. package/dist/chunk-YEULD3SG.js +62 -0
  113. package/dist/chunk-YEULD3SG.js.map +1 -0
  114. package/dist/chunk-ZHGPZBS4.js +49 -0
  115. package/dist/chunk-ZHGPZBS4.js.map +1 -0
  116. package/dist/{chunk-JKBFUAJK.js → chunk-ZSLHHQPQ.js} +2 -2
  117. package/dist/chunk-ZSLHHQPQ.js.map +1 -0
  118. package/dist/cli.js +496 -150
  119. package/dist/cli.js.map +1 -1
  120. package/dist/{config-6S355X75.js → config-I4FMCJGZ.js} +3 -3
  121. package/dist/config-editor-HNEKXRLQ.js +11 -0
  122. package/dist/{config-registry-AHYI4MYL.js → config-registry-CUMNXFGK.js} +2 -2
  123. package/dist/context-XM6E22LM.js +10 -0
  124. package/dist/core-plugins-VEUNFTMB.js +27 -0
  125. package/dist/{daemon-4CS6HMB5.js → daemon-PXO5QPCR.js} +4 -4
  126. package/dist/dev-loader-RDC5E2CW.js +50 -0
  127. package/dist/dev-loader-RDC5E2CW.js.map +1 -0
  128. package/dist/discord-NOJQ5PZO.js +8 -0
  129. package/dist/doctor-H72BZOPA.js +10 -0
  130. package/dist/{doctor-OLYBO3V3.js → doctor-RF6BHMCC.js} +5 -5
  131. package/dist/file-service-EUODJAIT.js +9 -0
  132. package/dist/file-service-EUODJAIT.js.map +1 -0
  133. package/dist/index.d.ts +1293 -188
  134. package/dist/index.js +387 -48
  135. package/dist/index.js.map +1 -1
  136. package/dist/{install-cloudflared-Z7VCGOVG.js → install-cloudflared-AN24L4DP.js} +5 -5
  137. package/dist/install-cloudflared-AN24L4DP.js.map +1 -0
  138. package/dist/install-context-XPWTFT3J.js +78 -0
  139. package/dist/install-context-XPWTFT3J.js.map +1 -0
  140. package/dist/{install-jq-HUYSQWKR.js → install-jq-CRVDJGF3.js} +5 -5
  141. package/dist/install-jq-CRVDJGF3.js.map +1 -0
  142. package/dist/{integrate-PNEHRY2I.js → integrate-5C6KSU6D.js} +2 -2
  143. package/dist/integrate-5C6KSU6D.js.map +1 -0
  144. package/dist/{log-NXABYJTT.js → log-LZ7FTRKG.js} +2 -2
  145. package/dist/log-LZ7FTRKG.js.map +1 -0
  146. package/dist/main-T5WVCCFN.js +715 -0
  147. package/dist/main-T5WVCCFN.js.map +1 -0
  148. package/dist/{menu-YY5MKHEK.js → menu-YDQ2LWAR.js} +2 -2
  149. package/dist/menu-YDQ2LWAR.js.map +1 -0
  150. package/dist/{new-session-FEO4J4VU.js → new-session-AVQCNXRG.js} +5 -5
  151. package/dist/new-session-AVQCNXRG.js.map +1 -0
  152. package/dist/notifications-D5BRDNSU.js +9 -0
  153. package/dist/notifications-D5BRDNSU.js.map +1 -0
  154. package/dist/plugin-create-LYF5PP5W.js +327 -0
  155. package/dist/plugin-create-LYF5PP5W.js.map +1 -0
  156. package/dist/plugin-registry-WB3DR67H.js +8 -0
  157. package/dist/plugin-registry-WB3DR67H.js.map +1 -0
  158. package/dist/{post-upgrade-CJG5I7M2.js → post-upgrade-XLHZ6ZB7.js} +8 -8
  159. package/dist/post-upgrade-XLHZ6ZB7.js.map +1 -0
  160. package/dist/read-text-file-IRZM3QLM.js +8 -0
  161. package/dist/read-text-file-IRZM3QLM.js.map +1 -0
  162. package/dist/security-YNRBW6S7.js +9 -0
  163. package/dist/security-YNRBW6S7.js.map +1 -0
  164. package/dist/{session-IUSI7P5S.js → session-KZFA6Z26.js} +4 -4
  165. package/dist/session-KZFA6Z26.js.map +1 -0
  166. package/dist/{settings-RQPAM4KC.js → settings-MFYM7CZO.js} +4 -4
  167. package/dist/settings-MFYM7CZO.js.map +1 -0
  168. package/dist/settings-manager-MD2U4ZV2.js +8 -0
  169. package/dist/settings-manager-MD2U4ZV2.js.map +1 -0
  170. package/dist/{chunk-LCRLAV4G.js → setup-BAI2F24H.js} +154 -492
  171. package/dist/setup-BAI2F24H.js.map +1 -0
  172. package/dist/slack-KH7E3VBS.js +8 -0
  173. package/dist/slack-KH7E3VBS.js.map +1 -0
  174. package/dist/speech-2GHQNRIO.js +9 -0
  175. package/dist/speech-2GHQNRIO.js.map +1 -0
  176. package/dist/telegram-ZDC3JQF2.js +8 -0
  177. package/dist/telegram-ZDC3JQF2.js.map +1 -0
  178. package/dist/tunnel-M47I7H4B.js +8 -0
  179. package/dist/tunnel-M47I7H4B.js.map +1 -0
  180. package/dist/{tunnel-service-CJLUH6SZ.js → tunnel-service-WADYHREX.js} +17 -17
  181. package/dist/tunnel-service-WADYHREX.js.map +1 -0
  182. package/dist/usage-WYNK6ZC5.js +10 -0
  183. package/dist/usage-WYNK6ZC5.js.map +1 -0
  184. package/dist/validators-6CLEZUBD.js +8 -0
  185. package/dist/validators-6CLEZUBD.js.map +1 -0
  186. package/dist/validators-WSTBNKRW.js +12 -0
  187. package/dist/validators-WSTBNKRW.js.map +1 -0
  188. package/package.json +1 -1
  189. package/dist/adapter-ZOANORGM.js.map +0 -1
  190. package/dist/agent-catalog-FC3HGDEQ.js +0 -11
  191. package/dist/agent-registry-WT4NXPYG.js +0 -9
  192. package/dist/agent-store-VZLFPTZU.js +0 -9
  193. package/dist/chunk-2CJ46J3C.js.map +0 -1
  194. package/dist/chunk-2HMQOC7N.js.map +0 -1
  195. package/dist/chunk-33RP6K2O.js.map +0 -1
  196. package/dist/chunk-34M4OS5P.js.map +0 -1
  197. package/dist/chunk-4CTX774K.js.map +0 -1
  198. package/dist/chunk-7QJS2XBD.js.map +0 -1
  199. package/dist/chunk-BNLGTZ34.js.map +0 -1
  200. package/dist/chunk-CS3KCJ5D.js.map +0 -1
  201. package/dist/chunk-GAK6PIBW.js.map +0 -1
  202. package/dist/chunk-I7WC6E5S.js.map +0 -1
  203. package/dist/chunk-J4SJTKIK.js.map +0 -1
  204. package/dist/chunk-JHYXKVV2.js.map +0 -1
  205. package/dist/chunk-JKBFUAJK.js.map +0 -1
  206. package/dist/chunk-KIRH7TUJ.js.map +0 -1
  207. package/dist/chunk-LBIKITQT.js +0 -22
  208. package/dist/chunk-LBIKITQT.js.map +0 -1
  209. package/dist/chunk-LCRLAV4G.js.map +0 -1
  210. package/dist/chunk-LGP2YGRL.js +0 -4880
  211. package/dist/chunk-LGP2YGRL.js.map +0 -1
  212. package/dist/chunk-MKHUZLII.js.map +0 -1
  213. package/dist/chunk-NAMYZIS5.js +0 -1
  214. package/dist/chunk-NVPG6JCL.js.map +0 -1
  215. package/dist/chunk-O7CPGUAI.js.map +0 -1
  216. package/dist/chunk-OWP7RZ62.js.map +0 -1
  217. package/dist/chunk-UKT3G5IA.js.map +0 -1
  218. package/dist/chunk-V5GZQEIY.js.map +0 -1
  219. package/dist/chunk-VOIJ6OY4.js +0 -63
  220. package/dist/chunk-VOIJ6OY4.js.map +0 -1
  221. package/dist/chunk-W3EYKZNQ.js.map +0 -1
  222. package/dist/chunk-WTZDAYZX.js.map +0 -1
  223. package/dist/chunk-XANPHG7W.js.map +0 -1
  224. package/dist/config-editor-QQTZMWGD.js +0 -13
  225. package/dist/discord-OMC52Y54.js.map +0 -1
  226. package/dist/doctor-HZZ5BSHB.js +0 -10
  227. package/dist/install-cloudflared-Z7VCGOVG.js.map +0 -1
  228. package/dist/install-jq-HUYSQWKR.js.map +0 -1
  229. package/dist/integrate-PNEHRY2I.js.map +0 -1
  230. package/dist/main-XOZCLFUK.js +0 -238
  231. package/dist/main-XOZCLFUK.js.map +0 -1
  232. package/dist/post-upgrade-CJG5I7M2.js.map +0 -1
  233. package/dist/setup-XHS4OMPM.js +0 -37
  234. package/dist/tunnel-service-CJLUH6SZ.js.map +0 -1
  235. /package/dist/{action-detect-P7ZE4NEM.js.map → action-detect-QPA775HB.js.map} +0 -0
  236. /package/dist/{admin-6SYB6XCZ.js.map → adapter-6ANPBSVU.js.map} +0 -0
  237. /package/dist/{agent-catalog-FC3HGDEQ.js.map → admin-GBPZFFAU.js.map} +0 -0
  238. /package/dist/{agent-dependencies-4OWBMZWZ.js.map → agent-catalog-YHBFERYO.js.map} +0 -0
  239. /package/dist/{agent-registry-WT4NXPYG.js.map → agent-dependencies-WS7Z2DFW.js.map} +0 -0
  240. /package/dist/{agent-store-VZLFPTZU.js.map → agent-registry-5LZT7CUB.js.map} +0 -0
  241. /package/dist/{agents-QO7DKARJ.js.map → agent-store-VSHNY5GT.js.map} +0 -0
  242. /package/dist/{api-client-CFQT5U7D.js.map → agents-BWU4MRRD.js.map} +0 -0
  243. /package/dist/{autostart-X33OGMX6.js.map → api-client-AQPNKXI2.js.map} +0 -0
  244. /package/dist/{chunk-NAMYZIS5.js.map → api-server-3PYLRBCN.js.map} +0 -0
  245. /package/dist/{config-6S355X75.js.map → api-server-CHVSUDBX.js.map} +0 -0
  246. /package/dist/{config-editor-QQTZMWGD.js.map → autostart-6JS565RY.js.map} +0 -0
  247. /package/dist/{config-registry-AHYI4MYL.js.map → chunk-FNRSWA2K.js.map} +0 -0
  248. /package/dist/{daemon-4CS6HMB5.js.map → config-I4FMCJGZ.js.map} +0 -0
  249. /package/dist/{doctor-HZZ5BSHB.js.map → config-editor-HNEKXRLQ.js.map} +0 -0
  250. /package/dist/{doctor-OLYBO3V3.js.map → config-registry-CUMNXFGK.js.map} +0 -0
  251. /package/dist/{log-NXABYJTT.js.map → context-XM6E22LM.js.map} +0 -0
  252. /package/dist/{menu-YY5MKHEK.js.map → core-plugins-VEUNFTMB.js.map} +0 -0
  253. /package/dist/{new-session-FEO4J4VU.js.map → daemon-PXO5QPCR.js.map} +0 -0
  254. /package/dist/{session-IUSI7P5S.js.map → discord-NOJQ5PZO.js.map} +0 -0
  255. /package/dist/{settings-RQPAM4KC.js.map → doctor-H72BZOPA.js.map} +0 -0
  256. /package/dist/{setup-XHS4OMPM.js.map → doctor-RF6BHMCC.js.map} +0 -0
@@ -1,12 +1,22 @@
1
+ import {
2
+ validateDiscordToken
3
+ } from "./chunk-6RXVEXF3.js";
4
+ import {
5
+ validateBotAdmin,
6
+ validateBotToken,
7
+ validateChatId
8
+ } from "./chunk-WQCJTU2C.js";
1
9
  import {
2
10
  commandExists
3
- } from "./chunk-JKBFUAJK.js";
11
+ } from "./chunk-ZSLHHQPQ.js";
4
12
  import {
5
13
  expandHome
6
- } from "./chunk-33RP6K2O.js";
14
+ } from "./chunk-QVMEF6FB.js";
15
+ import "./chunk-XMMAGAT4.js";
16
+ import "./chunk-VUNV25KB.js";
7
17
 
8
18
  // src/core/setup/wizard.ts
9
- import * as clack9 from "@clack/prompts";
19
+ import * as clack7 from "@clack/prompts";
10
20
 
11
21
  // src/core/setup/types.ts
12
22
  var ONBOARD_SECTION_OPTIONS = [
@@ -47,9 +57,9 @@ function guardCancel(value) {
47
57
  }
48
58
  return value;
49
59
  }
50
- function applyGradient(text4) {
60
+ function applyGradient(text2) {
51
61
  const colors = [135, 99, 63, 33, 39, 44, 44];
52
- const lines = text4.split("\n");
62
+ const lines = text2.split("\n");
53
63
  return lines.map((line, i) => {
54
64
  const colorIdx = Math.min(i, colors.length - 1);
55
65
  return `\x1B[38;5;${colors[colorIdx]}m${line}\x1B[0m`;
@@ -97,428 +107,9 @@ function summarizeConfig(config) {
97
107
  return lines.join("\n");
98
108
  }
99
109
 
100
- // src/core/setup/setup-telegram.ts
101
- import * as clack2 from "@clack/prompts";
102
-
103
- // src/core/setup/validation.ts
104
- async function validateBotToken(token) {
105
- try {
106
- const res = await fetch(`https://api.telegram.org/bot${token}/getMe`);
107
- const data = await res.json();
108
- if (data.ok && data.result) {
109
- return {
110
- ok: true,
111
- botName: data.result.first_name,
112
- botUsername: data.result.username
113
- };
114
- }
115
- return { ok: false, error: data.description || "Invalid token" };
116
- } catch (err) {
117
- return { ok: false, error: err.message };
118
- }
119
- }
120
- async function validateChatId(token, chatId) {
121
- try {
122
- const res = await fetch(`https://api.telegram.org/bot${token}/getChat`, {
123
- method: "POST",
124
- headers: { "Content-Type": "application/json" },
125
- body: JSON.stringify({ chat_id: chatId })
126
- });
127
- const data = await res.json();
128
- if (!data.ok || !data.result) {
129
- return { ok: false, error: data.description || "Invalid chat ID" };
130
- }
131
- if (data.result.type !== "supergroup") {
132
- return {
133
- ok: false,
134
- error: `Chat is "${data.result.type}", must be a supergroup`
135
- };
136
- }
137
- return {
138
- ok: true,
139
- title: data.result.title,
140
- isForum: data.result.is_forum === true
141
- };
142
- } catch (err) {
143
- return { ok: false, error: err.message };
144
- }
145
- }
146
- async function validateBotAdmin(token, chatId) {
147
- try {
148
- const meRes = await fetch(`https://api.telegram.org/bot${token}/getMe`);
149
- const meData = await meRes.json();
150
- if (!meData.ok || !meData.result) {
151
- return { ok: false, error: "Could not retrieve bot info" };
152
- }
153
- const res = await fetch(
154
- `https://api.telegram.org/bot${token}/getChatMember`,
155
- {
156
- method: "POST",
157
- headers: { "Content-Type": "application/json" },
158
- body: JSON.stringify({ chat_id: chatId, user_id: meData.result.id })
159
- }
160
- );
161
- const data = await res.json();
162
- if (!data.ok || !data.result) {
163
- return {
164
- ok: false,
165
- error: data.description || "Could not check bot membership"
166
- };
167
- }
168
- const { status } = data.result;
169
- if (status === "administrator" || status === "creator") {
170
- return { ok: true };
171
- }
172
- return {
173
- ok: false,
174
- error: `Bot is "${status}" in this group. It must be an admin. Please promote the bot to admin in group settings.`
175
- };
176
- } catch (err) {
177
- return { ok: false, error: err.message };
178
- }
179
- }
180
- async function validateDiscordToken(token) {
181
- try {
182
- const res = await fetch("https://discord.com/api/v10/users/@me", {
183
- headers: { Authorization: `Bot ${token}` }
184
- });
185
- if (res.status === 200) {
186
- const data = await res.json();
187
- return { ok: true, username: data.username, id: data.id };
188
- }
189
- if (res.status === 401) {
190
- return { ok: false, error: "Token rejected by Discord (401 Unauthorized)" };
191
- }
192
- return { ok: false, error: `Discord API returned ${res.status}` };
193
- } catch (err) {
194
- return { ok: false, error: err.message };
195
- }
196
- }
197
-
198
- // src/core/setup/setup-telegram.ts
199
- async function promptManualChatId() {
200
- const val = guardCancel(
201
- await clack2.text({
202
- message: "Supergroup chat ID (e.g. -1001234567890):",
203
- validate: (val2) => {
204
- const n = Number((val2 ?? "").toString().trim());
205
- if (isNaN(n) || !Number.isInteger(n)) return "Chat ID must be an integer";
206
- return void 0;
207
- }
208
- })
209
- );
210
- return Number(val.trim());
211
- }
212
- async function detectChatId(token) {
213
- let lastUpdateId = 0;
214
- try {
215
- const clearRes = await fetch(
216
- `https://api.telegram.org/bot${token}/getUpdates?offset=-1`
217
- );
218
- const clearData = await clearRes.json();
219
- if (clearData.ok && clearData.result?.length) {
220
- lastUpdateId = clearData.result[clearData.result.length - 1].update_id;
221
- }
222
- } catch {
223
- }
224
- console.log("");
225
- console.log(` ${c.bold}If you don't have a supergroup yet:${c.reset}`);
226
- console.log(dim(" 1. Open Telegram \u2192 New Group \u2192 add your bot"));
227
- console.log(dim(" 2. Group Settings \u2192 convert to Supergroup"));
228
- console.log(dim(" 3. Enable Topics in group settings"));
229
- console.log("");
230
- console.log(` ${c.bold}Then send "hi" in the group.${c.reset}`);
231
- console.log(
232
- dim(
233
- ` Listening... press ${c.reset}${c.yellow}m${c.reset}${c.dim} to enter ID manually`
234
- )
235
- );
236
- console.log("");
237
- const MAX_ATTEMPTS = 120;
238
- const POLL_INTERVAL = 1e3;
239
- let cancelled = false;
240
- const onKeypress = (data) => {
241
- const key = data.toString();
242
- if (key === "m" || key === "M") {
243
- cancelled = true;
244
- }
245
- };
246
- if (process.stdin.isTTY) {
247
- process.stdin.setRawMode(true);
248
- process.stdin.resume();
249
- process.stdin.on("data", onKeypress);
250
- }
251
- const cleanup = () => {
252
- if (process.stdin.isTTY) {
253
- process.stdin.removeListener("data", onKeypress);
254
- process.stdin.setRawMode(false);
255
- process.stdin.pause();
256
- }
257
- };
258
- try {
259
- for (let i = 0; i < MAX_ATTEMPTS; i++) {
260
- if (cancelled) {
261
- cleanup();
262
- return promptManualChatId();
263
- }
264
- try {
265
- const offset = lastUpdateId ? lastUpdateId + 1 : 0;
266
- const res = await fetch(
267
- `https://api.telegram.org/bot${token}/getUpdates?offset=${offset}&timeout=1`
268
- );
269
- const data = await res.json();
270
- if (!data.ok || !data.result?.length) {
271
- await new Promise((r) => setTimeout(r, POLL_INTERVAL));
272
- continue;
273
- }
274
- const groups = /* @__PURE__ */ new Map();
275
- for (const update of data.result) {
276
- lastUpdateId = update.update_id;
277
- const chat = update.message?.chat ?? update.my_chat_member?.chat;
278
- if (chat && (chat.type === "supergroup" || chat.type === "group")) {
279
- groups.set(chat.id, chat.title ?? String(chat.id));
280
- }
281
- }
282
- if (groups.size === 1) {
283
- const [id, title] = [...groups.entries()][0];
284
- console.log(
285
- ok(`Group detected: ${c.bold}${title}${c.reset}${c.green} (${id})`)
286
- );
287
- cleanup();
288
- return id;
289
- }
290
- if (groups.size > 1) {
291
- cleanup();
292
- const options = [...groups.entries()].map(([id, title]) => ({
293
- label: `${title} (${id})`,
294
- value: id
295
- }));
296
- return guardCancel(
297
- await clack2.select({
298
- message: "Multiple groups found. Pick one:",
299
- options
300
- })
301
- );
302
- }
303
- } catch {
304
- }
305
- await new Promise((r) => setTimeout(r, POLL_INTERVAL));
306
- }
307
- console.log(warn("Timed out waiting for messages."));
308
- cleanup();
309
- return promptManualChatId();
310
- } catch (err) {
311
- cleanup();
312
- throw err;
313
- }
314
- }
315
- async function detectAndValidateChatId(botToken) {
316
- while (true) {
317
- const chatId = await detectChatId(botToken);
318
- const chatResult = await validateChatId(botToken, chatId);
319
- if (!chatResult.ok) {
320
- console.log(fail(chatResult.error));
321
- console.log("");
322
- console.log(` ${c.bold}How to fix:${c.reset}`);
323
- console.log(dim(" 1. Make sure the bot is added to the group"));
324
- console.log(dim(" 2. The group must be a Supergroup (Group Settings \u2192 convert)"));
325
- console.log(dim(" 3. Send a message in the group after adding the bot"));
326
- console.log("");
327
- guardCancel(await clack2.text({ message: "Press Enter to try again..." }));
328
- continue;
329
- }
330
- console.log(
331
- ok(
332
- `Group: ${c.bold}${chatResult.title}${c.reset}${c.green}${chatResult.isForum ? " (Topics enabled)" : ""}`
333
- )
334
- );
335
- const adminResult = await validateBotAdmin(botToken, chatId);
336
- if (!adminResult.ok) {
337
- console.log(fail(adminResult.error));
338
- console.log("");
339
- console.log(` ${c.bold}How to fix:${c.reset}`);
340
- console.log(dim(" 1. Open the group in Telegram"));
341
- console.log(dim(" 2. Go to Group Settings \u2192 Administrators"));
342
- console.log(dim(" 3. Add the bot as an administrator"));
343
- console.log("");
344
- guardCancel(await clack2.text({ message: "Press Enter to check again..." }));
345
- continue;
346
- }
347
- console.log(ok("Bot has admin privileges"));
348
- return chatId;
349
- }
350
- }
351
- async function setupTelegram(opts) {
352
- const { existing, stepNum, totalSteps } = opts ?? {};
353
- if (stepNum != null && totalSteps != null) {
354
- console.log(step(stepNum, totalSteps, "Telegram Bot"));
355
- }
356
- let botToken = "";
357
- const existingToken = existing?.botToken;
358
- while (true) {
359
- const tokenInput = guardCancel(
360
- await clack2.text({
361
- message: existingToken ? "Bot token (from @BotFather) \u2014 leave blank to keep current:" : "Bot token (from @BotFather):",
362
- ...existingToken ? { placeholder: "Leave blank to keep current" } : {},
363
- validate: (val) => {
364
- if (existingToken && (val ?? "").toString().trim().length === 0) return void 0;
365
- if ((val ?? "").toString().trim().length > 0) return void 0;
366
- return "Token cannot be empty";
367
- }
368
- })
369
- );
370
- const keptExisting = existingToken && !tokenInput.trim();
371
- botToken = tokenInput.trim() || existingToken || "";
372
- if (!botToken) continue;
373
- if (keptExisting) {
374
- console.log(ok("Keeping current bot token"));
375
- break;
376
- }
377
- const s = clack2.spinner();
378
- s.start("Validating token...");
379
- const result = await validateBotToken(botToken);
380
- s.stop("Token validated");
381
- if (result.ok) {
382
- console.log(ok(`Connected to @${result.botUsername}`));
383
- break;
384
- }
385
- console.log(fail(result.error));
386
- const action = guardCancel(
387
- await clack2.select({
388
- message: "What to do?",
389
- options: [
390
- { label: "Re-enter token", value: "retry" },
391
- { label: "Use as-is (skip validation)", value: "skip" }
392
- ]
393
- })
394
- );
395
- if (action === "skip") break;
396
- }
397
- let chatId;
398
- const existingChatId = existing?.chatId;
399
- if (existingChatId && existingChatId !== 0) {
400
- const chatIdAction = guardCancel(
401
- await clack2.select({
402
- message: `Group chat ID: ${existingChatId}`,
403
- options: [
404
- { value: "keep", label: "Keep current" },
405
- { value: "manual", label: "Enter new chat ID" },
406
- { value: "detect", label: "Auto-detect from group" }
407
- ],
408
- initialValue: "keep"
409
- })
410
- );
411
- if (chatIdAction === "keep") {
412
- chatId = existingChatId;
413
- console.log(ok("Keeping current group chat ID"));
414
- } else if (chatIdAction === "manual") {
415
- chatId = await promptManualChatId();
416
- const chatResult = await validateChatId(botToken, chatId);
417
- if (chatResult.ok) {
418
- console.log(ok(`Group: ${c.bold}${chatResult.title}${c.reset}${c.green}${chatResult.isForum ? " (Topics enabled)" : ""}`));
419
- } else {
420
- console.log(fail(chatResult.error));
421
- }
422
- } else {
423
- chatId = await detectAndValidateChatId(botToken);
424
- }
425
- } else {
426
- chatId = await detectAndValidateChatId(botToken);
427
- }
428
- return {
429
- enabled: true,
430
- botToken,
431
- chatId,
432
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
433
- notificationTopicId: existing?.notificationTopicId ?? null,
434
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
435
- assistantTopicId: existing?.assistantTopicId ?? null
436
- };
437
- }
438
-
439
- // src/core/setup/setup-discord.ts
440
- import * as clack3 from "@clack/prompts";
441
- async function setupDiscord(opts) {
442
- const { existing } = opts ?? {};
443
- console.log("\nDiscord Setup\n");
444
- console.log(` ${c.bold}Quick setup:${c.reset}`);
445
- console.log(dim(" 1. Create app at https://discord.com/developers/applications"));
446
- console.log(dim(" 2. Go to Bot \u2192 Reset Token \u2192 copy it"));
447
- console.log(dim(" 3. Enable Message Content Intent (Bot \u2192 Privileged Intents)"));
448
- console.log(dim(" 4. OAuth2 \u2192 URL Generator \u2192 scopes: bot + applications.commands"));
449
- console.log(dim(" 5. Bot Permissions: Manage Channels, Send Messages, Manage Threads, Attach Files"));
450
- console.log(dim(" 6. Open generated URL \u2192 invite bot to your server"));
451
- console.log("");
452
- console.log(dim(` Detailed guide: https://github.com/Open-ACP/OpenACP/blob/main/docs/guide/discord-setup.md`));
453
- console.log("");
454
- let botToken = "";
455
- const existingToken = existing?.botToken;
456
- while (true) {
457
- const tokenInput = guardCancel(
458
- await clack3.text({
459
- message: existingToken ? "Bot token (from Discord Developer Portal) \u2014 leave blank to keep current:" : "Bot token (from Discord Developer Portal):",
460
- ...existingToken ? { placeholder: "Leave blank to keep current" } : {},
461
- validate: (val) => {
462
- if (existingToken && (val ?? "").toString().trim().length === 0) return void 0;
463
- if ((val ?? "").toString().trim().length > 0) return void 0;
464
- return "Token cannot be empty";
465
- }
466
- })
467
- );
468
- const keptExisting = existingToken && !tokenInput.trim();
469
- botToken = tokenInput.trim() || existingToken || "";
470
- if (!botToken) continue;
471
- if (keptExisting) {
472
- console.log(ok("Keeping current bot token"));
473
- break;
474
- }
475
- const s = clack3.spinner();
476
- s.start("Validating token...");
477
- const result = await validateDiscordToken(botToken);
478
- s.stop("Token validated");
479
- if (result.ok) {
480
- console.log(ok(`Connected as @${result.username} (id: ${result.id})`));
481
- break;
482
- }
483
- console.log(fail(result.error));
484
- const action = guardCancel(
485
- await clack3.select({
486
- message: "What to do?",
487
- options: [
488
- { label: "Re-enter token", value: "retry" },
489
- { label: "Use as-is (skip validation)", value: "skip" }
490
- ]
491
- })
492
- );
493
- if (action === "skip") break;
494
- }
495
- const guildIdInput = guardCancel(
496
- await clack3.text({
497
- message: existing?.guildId ? "Guild (server) ID \u2014 leave blank to keep current:" : "Guild (server) ID:",
498
- ...existing?.guildId ? { placeholder: `Current: ${existing.guildId}` } : {},
499
- validate: (val) => {
500
- const trimmed = (val ?? "").toString().trim();
501
- if (existing?.guildId && !trimmed) return void 0;
502
- if (!trimmed) return "Guild ID cannot be empty";
503
- if (!/^\d{17,20}$/.test(trimmed)) return "Guild ID must be a numeric Discord snowflake (17-20 digits)";
504
- return void 0;
505
- }
506
- })
507
- );
508
- const guildId = guildIdInput.trim() || existing?.guildId || "";
509
- return {
510
- enabled: true,
511
- botToken,
512
- guildId: guildId.trim(),
513
- forumChannelId: existing?.forumChannelId ?? null,
514
- notificationChannelId: existing?.notificationChannelId ?? null,
515
- assistantThreadId: existing?.assistantThreadId ?? null
516
- };
517
- }
518
-
519
110
  // src/core/setup/setup-agents.ts
520
111
  import { execFileSync } from "child_process";
521
- import * as clack4 from "@clack/prompts";
112
+ import * as clack2 from "@clack/prompts";
522
113
  var KNOWN_AGENTS = [
523
114
  // claude-agent-acp is bundled as a dependency — no detection needed, but
524
115
  // kept here so detectAgents() still returns it for display purposes.
@@ -549,12 +140,12 @@ async function validateAgentCommand(command) {
549
140
  }
550
141
  }
551
142
  async function setupAgents() {
552
- const { AgentCatalog } = await import("./agent-catalog-FC3HGDEQ.js");
553
- const { muteLogger, unmuteLogger } = await import("./log-NXABYJTT.js");
143
+ const { AgentCatalog } = await import("./agent-catalog-YHBFERYO.js");
144
+ const { muteLogger, unmuteLogger } = await import("./log-LZ7FTRKG.js");
554
145
  muteLogger();
555
146
  const catalog = new AgentCatalog();
556
147
  catalog.load();
557
- const s = clack4.spinner();
148
+ const s = clack2.spinner();
558
149
  s.start("Checking available agents...");
559
150
  await catalog.refreshRegistryIfStale();
560
151
  if (!catalog.getInstalledAgent("claude")) {
@@ -562,7 +153,7 @@ async function setupAgents() {
562
153
  if (claudeRegistry) {
563
154
  await catalog.install("claude-acp");
564
155
  } else {
565
- const { AgentStore } = await import("./agent-store-VZLFPTZU.js");
156
+ const { AgentStore } = await import("./agent-store-VSHNY5GT.js");
566
157
  const store = new AgentStore();
567
158
  store.load();
568
159
  store.addAgent("claude", {
@@ -606,7 +197,7 @@ async function setupAgents() {
606
197
  }
607
198
  const installedKeys = installed.map((a) => a.key);
608
199
  const selected = guardCancel(
609
- await clack4.autocompleteMultiselect({
200
+ await clack2.autocompleteMultiselect({
610
201
  message: "Install additional agents? (type to search, Space to select)",
611
202
  options,
612
203
  initialValues: installedKeys,
@@ -616,7 +207,7 @@ async function setupAgents() {
616
207
  for (const key of selected) {
617
208
  const regAgent = catalog.findRegistryAgent(key);
618
209
  if (regAgent) {
619
- const installSpinner = clack4.spinner();
210
+ const installSpinner = clack2.spinner();
620
211
  installSpinner.start(`Installing ${regAgent.name}...`);
621
212
  muteLogger();
622
213
  const result = await catalog.install(key);
@@ -633,7 +224,7 @@ async function setupAgents() {
633
224
  let defaultAgent = "claude";
634
225
  if (installedAgents.length > 1) {
635
226
  defaultAgent = guardCancel(
636
- await clack4.select({
227
+ await clack2.select({
637
228
  message: "Which agent should be the default?",
638
229
  options: installedAgents.map((key) => {
639
230
  const agent = catalog.getInstalledAgent(key);
@@ -648,14 +239,14 @@ async function setupAgents() {
648
239
  }
649
240
 
650
241
  // src/core/setup/setup-workspace.ts
651
- import * as clack5 from "@clack/prompts";
242
+ import * as clack3 from "@clack/prompts";
652
243
  async function setupWorkspace(opts) {
653
244
  const { existing, stepNum, totalSteps } = opts ?? {};
654
245
  if (stepNum != null && totalSteps != null) {
655
246
  console.log(step(stepNum, totalSteps, "Workspace"));
656
247
  }
657
248
  const baseDir = guardCancel(
658
- await clack5.text({
249
+ await clack3.text({
659
250
  message: "Base directory for workspaces:",
660
251
  initialValue: existing ?? "~/openacp-workspace",
661
252
  validate: (val) => (val ?? "").toString().trim().length > 0 ? void 0 : "Path cannot be empty"
@@ -665,7 +256,7 @@ async function setupWorkspace(opts) {
665
256
  }
666
257
 
667
258
  // src/core/setup/setup-run-mode.ts
668
- import * as clack6 from "@clack/prompts";
259
+ import * as clack4 from "@clack/prompts";
669
260
  async function setupRunMode(opts) {
670
261
  const { existing, stepNum, totalSteps } = opts ?? {};
671
262
  if (stepNum != null && totalSteps != null) {
@@ -677,7 +268,7 @@ async function setupRunMode(opts) {
677
268
  }
678
269
  const initialValue = existing?.runMode === "daemon" ? "daemon" : "foreground";
679
270
  const mode = guardCancel(
680
- await clack6.select({
271
+ await clack4.select({
681
272
  message: "How would you like to run OpenACP?",
682
273
  options: [
683
274
  {
@@ -696,8 +287,8 @@ async function setupRunMode(opts) {
696
287
  );
697
288
  const wasDaemon = existing?.runMode === "daemon";
698
289
  if (mode === "daemon") {
699
- const { installAutoStart, isAutoStartSupported } = await import("./autostart-X33OGMX6.js");
700
- const { muteLogger, unmuteLogger } = await import("./log-NXABYJTT.js");
290
+ const { installAutoStart, isAutoStartSupported } = await import("./autostart-6JS565RY.js");
291
+ const { muteLogger, unmuteLogger } = await import("./log-LZ7FTRKG.js");
701
292
  const autoStart = isAutoStartSupported();
702
293
  if (autoStart) {
703
294
  muteLogger();
@@ -712,10 +303,10 @@ async function setupRunMode(opts) {
712
303
  return { runMode: "daemon", autoStart };
713
304
  }
714
305
  if (wasDaemon) {
715
- const { muteLogger, unmuteLogger } = await import("./log-NXABYJTT.js");
306
+ const { muteLogger, unmuteLogger } = await import("./log-LZ7FTRKG.js");
716
307
  muteLogger();
717
308
  try {
718
- const { stopDaemon } = await import("./daemon-4CS6HMB5.js");
309
+ const { stopDaemon } = await import("./daemon-PXO5QPCR.js");
719
310
  const result = await stopDaemon();
720
311
  unmuteLogger();
721
312
  if (result.stopped) {
@@ -726,7 +317,7 @@ async function setupRunMode(opts) {
726
317
  }
727
318
  muteLogger();
728
319
  try {
729
- const { uninstallAutoStart } = await import("./autostart-X33OGMX6.js");
320
+ const { uninstallAutoStart } = await import("./autostart-6JS565RY.js");
730
321
  uninstallAutoStart();
731
322
  unmuteLogger();
732
323
  } catch {
@@ -737,19 +328,19 @@ async function setupRunMode(opts) {
737
328
  }
738
329
 
739
330
  // src/core/setup/setup-integrations.ts
740
- import * as clack7 from "@clack/prompts";
331
+ import * as clack5 from "@clack/prompts";
741
332
  async function setupIntegrations(config) {
742
333
  const claudeIntegration = config?.integrations?.claude;
743
334
  const isInstalled = claudeIntegration?.installed === true;
744
335
  const installClaude = guardCancel(
745
- await clack7.confirm({
336
+ await clack5.confirm({
746
337
  message: isInstalled ? "Claude CLI integration is installed. Reinstall?" : "Install session transfer for Claude? (enables /openacp:handoff in your terminal)",
747
338
  initialValue: !isInstalled
748
339
  })
749
340
  );
750
341
  if (installClaude) {
751
342
  try {
752
- const { getIntegration } = await import("./integrate-PNEHRY2I.js");
343
+ const { getIntegration } = await import("./integrate-5C6KSU6D.js");
753
344
  const integration = getIntegration("claude");
754
345
  if (integration) {
755
346
  for (const item of integration.items) {
@@ -766,7 +357,9 @@ async function setupIntegrations(config) {
766
357
  }
767
358
 
768
359
  // src/core/setup/setup-channels.ts
769
- import * as clack8 from "@clack/prompts";
360
+ import * as os from "os";
361
+ import * as path from "path";
362
+ import * as clack6 from "@clack/prompts";
770
363
  function getChannelStatuses(config) {
771
364
  const statuses = [];
772
365
  for (const [id, meta] of Object.entries(CHANNEL_META)) {
@@ -798,7 +391,7 @@ function noteChannelStatus(config) {
798
391
  }
799
392
  async function promptConfiguredAction(label) {
800
393
  return guardCancel(
801
- await clack8.select({
394
+ await clack6.select({
802
395
  message: `${label} already configured. What do you want to do?`,
803
396
  options: [
804
397
  { value: "modify", label: "Modify settings" },
@@ -810,6 +403,28 @@ async function promptConfiguredAction(label) {
810
403
  })
811
404
  );
812
405
  }
406
+ async function configureViaPlugin(channelId) {
407
+ const pluginMap = {
408
+ telegram: { importPath: "../../plugins/telegram/index.js", name: "@openacp/telegram" },
409
+ discord: { importPath: "../../plugins/discord/index.js", name: "@openacp/discord" }
410
+ };
411
+ const pluginInfo = pluginMap[channelId];
412
+ if (!pluginInfo) return;
413
+ const { SettingsManager } = await import("./settings-manager-MD2U4ZV2.js");
414
+ const { createInstallContext } = await import("./install-context-XPWTFT3J.js");
415
+ const basePath = path.join(os.homedir(), ".openacp", "plugins");
416
+ const settingsManager = new SettingsManager(basePath);
417
+ const pluginModule = await import(pluginInfo.importPath);
418
+ const plugin = pluginModule.default;
419
+ if (plugin?.configure) {
420
+ const ctx = createInstallContext({
421
+ pluginName: plugin.name,
422
+ settingsManager,
423
+ basePath
424
+ });
425
+ await plugin.configure(ctx);
426
+ }
427
+ }
813
428
  async function configureChannels(config) {
814
429
  const next = structuredClone(config);
815
430
  let changed = false;
@@ -825,7 +440,7 @@ async function configureChannels(config) {
825
440
  };
826
441
  });
827
442
  const choice = guardCancel(
828
- await clack8.select({
443
+ await clack6.select({
829
444
  message: "Select a channel",
830
445
  options: [
831
446
  ...options,
@@ -849,7 +464,7 @@ async function configureChannels(config) {
849
464
  }
850
465
  if (action === "delete") {
851
466
  const confirmed = guardCancel(
852
- await clack8.confirm({
467
+ await clack6.confirm({
853
468
  message: `Delete ${meta.label} config? This cannot be undone.`,
854
469
  initialValue: false
855
470
  })
@@ -862,19 +477,8 @@ async function configureChannels(config) {
862
477
  continue;
863
478
  }
864
479
  }
865
- if (channelId === "telegram") {
866
- const result = await setupTelegram({
867
- existing: isConfigured ? existing : void 0
868
- });
869
- next.channels.telegram = result;
870
- changed = true;
871
- } else if (channelId === "discord") {
872
- const result = await setupDiscord({
873
- existing: isConfigured ? existing : void 0
874
- });
875
- next.channels.discord = result;
876
- changed = true;
877
- }
480
+ await configureViaPlugin(channelId);
481
+ changed = true;
878
482
  }
879
483
  return { config: next, changed };
880
484
  }
@@ -882,10 +486,11 @@ async function configureChannels(config) {
882
486
  // src/core/setup/wizard.ts
883
487
  async function runSetup(configManager, opts) {
884
488
  await printStartBanner();
885
- clack9.intro("Let's set up OpenACP");
489
+ clack7.intro("Let's set up OpenACP");
490
+ const { settingsManager, pluginRegistry } = opts ?? {};
886
491
  try {
887
492
  const channelChoice = guardCancel(
888
- await clack9.select({
493
+ await clack7.select({
889
494
  message: "Which messaging platform do you want to use?",
890
495
  options: [
891
496
  { label: "Telegram", value: "telegram" },
@@ -894,19 +499,55 @@ async function runSetup(configManager, opts) {
894
499
  ]
895
500
  })
896
501
  );
897
- let telegram;
898
- let discord;
899
502
  const channelSteps = channelChoice === "both" ? 2 : 1;
900
503
  const runModeSteps = opts?.skipRunMode ? 0 : 1;
901
504
  const totalSteps = channelSteps + 1 + runModeSteps;
902
505
  let currentStep = 0;
903
506
  if (channelChoice === "telegram" || channelChoice === "both") {
904
507
  currentStep++;
905
- telegram = await setupTelegram({ stepNum: currentStep, totalSteps });
508
+ if (settingsManager && pluginRegistry) {
509
+ const { createInstallContext } = await import("./install-context-XPWTFT3J.js");
510
+ const telegramPlugin = (await import("./telegram-ZDC3JQF2.js")).default;
511
+ const ctx = createInstallContext({
512
+ pluginName: telegramPlugin.name,
513
+ settingsManager,
514
+ basePath: settingsManager.getBasePath()
515
+ });
516
+ await telegramPlugin.install(ctx);
517
+ pluginRegistry.register(telegramPlugin.name, {
518
+ version: telegramPlugin.version,
519
+ source: "builtin",
520
+ enabled: true,
521
+ settingsPath: settingsManager.getSettingsPath(telegramPlugin.name),
522
+ description: telegramPlugin.description
523
+ });
524
+ } else {
525
+ console.log(fail("Plugin system not initialized. Cannot set up Telegram."));
526
+ return false;
527
+ }
906
528
  }
907
529
  if (channelChoice === "discord" || channelChoice === "both") {
908
530
  currentStep++;
909
- discord = await setupDiscord();
531
+ if (settingsManager && pluginRegistry) {
532
+ const { createInstallContext } = await import("./install-context-XPWTFT3J.js");
533
+ const discordPlugin = (await import("./discord-NOJQ5PZO.js")).default;
534
+ const ctx = createInstallContext({
535
+ pluginName: discordPlugin.name,
536
+ settingsManager,
537
+ basePath: settingsManager.getBasePath()
538
+ });
539
+ await discordPlugin.install(ctx);
540
+ pluginRegistry.register(discordPlugin.name, {
541
+ version: discordPlugin.version,
542
+ source: "builtin",
543
+ enabled: true,
544
+ settingsPath: settingsManager.getSettingsPath(discordPlugin.name),
545
+ description: discordPlugin.description
546
+ });
547
+ } else {
548
+ console.log(fail("Plugin system not initialized. Cannot set up Discord."));
549
+ return false;
550
+ }
910
551
  }
911
552
  const { defaultAgent } = await setupAgents();
912
553
  await setupIntegrations();
@@ -925,11 +566,8 @@ async function runSetup(configManager, opts) {
925
566
  maxConcurrentSessions: 20,
926
567
  sessionTimeoutMinutes: 60
927
568
  };
928
- const channels = {};
929
- if (telegram) channels.telegram = telegram;
930
- if (discord) channels.discord = discord;
931
569
  const config = {
932
- channels,
570
+ channels: {},
933
571
  agents: {},
934
572
  defaultAgent,
935
573
  workspace,
@@ -977,7 +615,11 @@ async function runSetup(configManager, opts) {
977
615
  );
978
616
  return false;
979
617
  }
980
- clack9.outro(`Config saved to ${configManager.getConfigPath()}`);
618
+ if (settingsManager && pluginRegistry) {
619
+ await registerBuiltinPlugins(settingsManager, pluginRegistry);
620
+ await pluginRegistry.save();
621
+ }
622
+ clack7.outro(`Config saved to ${configManager.getConfigPath()}`);
981
623
  if (!opts?.skipRunMode) {
982
624
  console.log(ok("Starting OpenACP..."));
983
625
  console.log("");
@@ -985,15 +627,38 @@ async function runSetup(configManager, opts) {
985
627
  return true;
986
628
  } catch (err) {
987
629
  if (err.name === "ExitPromptError") {
988
- clack9.cancel("Setup cancelled.");
630
+ clack7.cancel("Setup cancelled.");
989
631
  return false;
990
632
  }
991
633
  throw err;
992
634
  }
993
635
  }
636
+ async function registerBuiltinPlugins(settingsManager, pluginRegistry) {
637
+ const builtinPlugins = [
638
+ { name: "@openacp/security", version: "1.0.0", description: "User access control and session limits" },
639
+ { name: "@openacp/file-service", version: "1.0.0", description: "File storage and management" },
640
+ { name: "@openacp/context", version: "1.0.0", description: "Conversation context management" },
641
+ { name: "@openacp/usage", version: "1.0.0", description: "Token usage tracking and budget enforcement" },
642
+ { name: "@openacp/speech", version: "1.0.0", description: "Text-to-speech and speech-to-text" },
643
+ { name: "@openacp/notifications", version: "1.0.0", description: "Cross-session notification routing" },
644
+ { name: "@openacp/tunnel", version: "1.0.0", description: "Expose local services via tunnel" },
645
+ { name: "@openacp/api-server", version: "1.0.0", description: "REST API + SSE streaming server" }
646
+ ];
647
+ for (const p of builtinPlugins) {
648
+ if (!pluginRegistry.get(p.name)) {
649
+ pluginRegistry.register(p.name, {
650
+ version: p.version,
651
+ source: "builtin",
652
+ enabled: true,
653
+ settingsPath: settingsManager.getSettingsPath(p.name),
654
+ description: p.description
655
+ });
656
+ }
657
+ }
658
+ }
994
659
  async function selectSection(hasSelection) {
995
660
  return guardCancel(
996
- await clack9.select({
661
+ await clack7.select({
997
662
  message: "Select sections to configure",
998
663
  options: [
999
664
  ...ONBOARD_SECTION_OPTIONS,
@@ -1009,11 +674,11 @@ async function selectSection(hasSelection) {
1009
674
  }
1010
675
  async function runReconfigure(configManager) {
1011
676
  await printStartBanner();
1012
- clack9.intro("OpenACP \u2014 Reconfigure");
677
+ clack7.intro("OpenACP \u2014 Reconfigure");
1013
678
  try {
1014
679
  await configManager.load();
1015
680
  let config = configManager.get();
1016
- clack9.note(summarizeConfig(config), "Current configuration");
681
+ clack7.note(summarizeConfig(config), "Current configuration");
1017
682
  let ranSection = false;
1018
683
  while (true) {
1019
684
  const choice = await selectSection(ranSection);
@@ -1053,33 +718,30 @@ async function runReconfigure(configManager) {
1053
718
  }
1054
719
  }
1055
720
  if (!ranSection) {
1056
- clack9.outro("No changes made.");
721
+ clack7.outro("No changes made.");
1057
722
  return;
1058
723
  }
1059
- clack9.outro(`Config saved to ${configManager.getConfigPath()}`);
724
+ clack7.outro(`Config saved to ${configManager.getConfigPath()}`);
1060
725
  } catch (err) {
1061
726
  if (err.name === "ExitPromptError") {
1062
- clack9.cancel("Setup cancelled.");
727
+ clack7.cancel("Setup cancelled.");
1063
728
  return;
1064
729
  }
1065
730
  throw err;
1066
731
  }
1067
732
  }
1068
-
1069
733
  export {
1070
- printStartBanner,
1071
- validateBotToken,
1072
- validateChatId,
1073
- validateBotAdmin,
1074
- validateDiscordToken,
1075
- setupTelegram,
1076
- setupDiscord,
1077
734
  detectAgents,
1078
- validateAgentCommand,
735
+ printStartBanner,
736
+ runReconfigure,
737
+ runSetup,
1079
738
  setupAgents,
1080
- setupWorkspace,
1081
739
  setupRunMode,
1082
- runSetup,
1083
- runReconfigure
740
+ setupWorkspace,
741
+ validateAgentCommand,
742
+ validateBotAdmin,
743
+ validateBotToken,
744
+ validateChatId,
745
+ validateDiscordToken
1084
746
  };
1085
- //# sourceMappingURL=chunk-LCRLAV4G.js.map
747
+ //# sourceMappingURL=setup-BAI2F24H.js.map