@openacp/cli 2026.331.1 → 2026.331.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 (182) hide show
  1. package/README.md +2 -1
  2. package/dist/cli.js +24987 -270
  3. package/dist/cli.js.map +1 -1
  4. package/dist/data/registry-snapshot.json +1 -1
  5. package/dist/index.d.ts +10 -0
  6. package/dist/index.js +17669 -406
  7. package/dist/index.js.map +1 -1
  8. package/package.json +2 -2
  9. package/dist/adapter-ELG3VRZ3.js +0 -14
  10. package/dist/adapter-ELG3VRZ3.js.map +0 -1
  11. package/dist/agent-catalog-UYD26QDK.js +0 -10
  12. package/dist/agent-catalog-UYD26QDK.js.map +0 -1
  13. package/dist/agent-dependencies-ED2ZTUHG.js +0 -23
  14. package/dist/agent-dependencies-ED2ZTUHG.js.map +0 -1
  15. package/dist/agent-registry-YOGP656W.js +0 -8
  16. package/dist/agent-registry-YOGP656W.js.map +0 -1
  17. package/dist/agent-store-5UHZH2XI.js +0 -8
  18. package/dist/agent-store-5UHZH2XI.js.map +0 -1
  19. package/dist/api-client-PEMHYL5U.js +0 -13
  20. package/dist/api-client-PEMHYL5U.js.map +0 -1
  21. package/dist/api-server-DATG2KBR.js +0 -10
  22. package/dist/api-server-DATG2KBR.js.map +0 -1
  23. package/dist/api-server-L5Z7XACW.js +0 -7
  24. package/dist/api-server-L5Z7XACW.js.map +0 -1
  25. package/dist/autostart-CUPZMKKC.js +0 -22
  26. package/dist/autostart-CUPZMKKC.js.map +0 -1
  27. package/dist/chunk-23SRIVG4.js +0 -50
  28. package/dist/chunk-23SRIVG4.js.map +0 -1
  29. package/dist/chunk-2KT6TROD.js +0 -129
  30. package/dist/chunk-2KT6TROD.js.map +0 -1
  31. package/dist/chunk-2R5XM3ES.js +0 -154
  32. package/dist/chunk-2R5XM3ES.js.map +0 -1
  33. package/dist/chunk-3EWTPOF7.js +0 -51
  34. package/dist/chunk-3EWTPOF7.js.map +0 -1
  35. package/dist/chunk-566W6INH.js +0 -83
  36. package/dist/chunk-566W6INH.js.map +0 -1
  37. package/dist/chunk-5WGVYX3C.js +0 -55
  38. package/dist/chunk-5WGVYX3C.js.map +0 -1
  39. package/dist/chunk-7GXEMMEV.js +0 -44
  40. package/dist/chunk-7GXEMMEV.js.map +0 -1
  41. package/dist/chunk-7U6IZIJP.js +0 -186
  42. package/dist/chunk-7U6IZIJP.js.map +0 -1
  43. package/dist/chunk-7YIKTRSM.js +0 -105
  44. package/dist/chunk-7YIKTRSM.js.map +0 -1
  45. package/dist/chunk-7ZCQF6QM.js +0 -27
  46. package/dist/chunk-7ZCQF6QM.js.map +0 -1
  47. package/dist/chunk-AFKX424Q.js +0 -92
  48. package/dist/chunk-AFKX424Q.js.map +0 -1
  49. package/dist/chunk-BYCJQPMN.js +0 -543
  50. package/dist/chunk-BYCJQPMN.js.map +0 -1
  51. package/dist/chunk-CDAUYTVP.js +0 -41
  52. package/dist/chunk-CDAUYTVP.js.map +0 -1
  53. package/dist/chunk-EWVXSTQK.js +0 -6544
  54. package/dist/chunk-EWVXSTQK.js.map +0 -1
  55. package/dist/chunk-FNRSWA2K.js +0 -1
  56. package/dist/chunk-FNRSWA2K.js.map +0 -1
  57. package/dist/chunk-FPKQYCQS.js +0 -776
  58. package/dist/chunk-FPKQYCQS.js.map +0 -1
  59. package/dist/chunk-IZ5UEZF7.js +0 -138
  60. package/dist/chunk-IZ5UEZF7.js.map +0 -1
  61. package/dist/chunk-K6UY5M75.js +0 -653
  62. package/dist/chunk-K6UY5M75.js.map +0 -1
  63. package/dist/chunk-KGAQW6F4.js +0 -106
  64. package/dist/chunk-KGAQW6F4.js.map +0 -1
  65. package/dist/chunk-LGFWH3AE.js +0 -26
  66. package/dist/chunk-LGFWH3AE.js.map +0 -1
  67. package/dist/chunk-LRV56K2M.js +0 -4106
  68. package/dist/chunk-LRV56K2M.js.map +0 -1
  69. package/dist/chunk-MDJHCCFS.js +0 -485
  70. package/dist/chunk-MDJHCCFS.js.map +0 -1
  71. package/dist/chunk-MLF4W5R6.js +0 -101
  72. package/dist/chunk-MLF4W5R6.js.map +0 -1
  73. package/dist/chunk-NHD5XDD2.js +0 -686
  74. package/dist/chunk-NHD5XDD2.js.map +0 -1
  75. package/dist/chunk-NJX75BLK.js +0 -259
  76. package/dist/chunk-NJX75BLK.js.map +0 -1
  77. package/dist/chunk-NOEAJNTK.js +0 -156
  78. package/dist/chunk-NOEAJNTK.js.map +0 -1
  79. package/dist/chunk-ON7HB5O7.js +0 -58
  80. package/dist/chunk-ON7HB5O7.js.map +0 -1
  81. package/dist/chunk-OSBZXY2W.js +0 -126
  82. package/dist/chunk-OSBZXY2W.js.map +0 -1
  83. package/dist/chunk-OYSAN7UX.js +0 -15
  84. package/dist/chunk-OYSAN7UX.js.map +0 -1
  85. package/dist/chunk-P3HHJANC.js +0 -209
  86. package/dist/chunk-P3HHJANC.js.map +0 -1
  87. package/dist/chunk-R2YLDQLI.js +0 -1115
  88. package/dist/chunk-R2YLDQLI.js.map +0 -1
  89. package/dist/chunk-R6KZYF7D.js +0 -231
  90. package/dist/chunk-R6KZYF7D.js.map +0 -1
  91. package/dist/chunk-S64CB6J3.js +0 -98
  92. package/dist/chunk-S64CB6J3.js.map +0 -1
  93. package/dist/chunk-SSLVNCEA.js +0 -236
  94. package/dist/chunk-SSLVNCEA.js.map +0 -1
  95. package/dist/chunk-TGP34LQN.js +0 -681
  96. package/dist/chunk-TGP34LQN.js.map +0 -1
  97. package/dist/chunk-VUSCVRJL.js +0 -229
  98. package/dist/chunk-VUSCVRJL.js.map +0 -1
  99. package/dist/chunk-W26AUH5B.js +0 -61
  100. package/dist/chunk-W26AUH5B.js.map +0 -1
  101. package/dist/chunk-WQCJTU2C.js +0 -84
  102. package/dist/chunk-WQCJTU2C.js.map +0 -1
  103. package/dist/chunk-XRJUS6FE.js +0 -53
  104. package/dist/chunk-XRJUS6FE.js.map +0 -1
  105. package/dist/chunk-YZCKSNRN.js +0 -453
  106. package/dist/chunk-YZCKSNRN.js.map +0 -1
  107. package/dist/chunk-ZIRH6QWW.js +0 -69
  108. package/dist/chunk-ZIRH6QWW.js.map +0 -1
  109. package/dist/chunk-ZSLHHQPQ.js +0 -282
  110. package/dist/chunk-ZSLHHQPQ.js.map +0 -1
  111. package/dist/config-X4UP7H6R.js +0 -13
  112. package/dist/config-X4UP7H6R.js.map +0 -1
  113. package/dist/config-editor-7BENRVG5.js +0 -11
  114. package/dist/config-editor-7BENRVG5.js.map +0 -1
  115. package/dist/config-registry-M3FFWEVM.js +0 -18
  116. package/dist/config-registry-M3FFWEVM.js.map +0 -1
  117. package/dist/context-FVGCU5TI.js +0 -9
  118. package/dist/context-FVGCU5TI.js.map +0 -1
  119. package/dist/core-plugins-JSY2I44L.js +0 -25
  120. package/dist/core-plugins-JSY2I44L.js.map +0 -1
  121. package/dist/daemon-UOSRDEXW.js +0 -34
  122. package/dist/daemon-UOSRDEXW.js.map +0 -1
  123. package/dist/dev-loader-7P3HZCIA.js +0 -37
  124. package/dist/dev-loader-7P3HZCIA.js.map +0 -1
  125. package/dist/doctor-6DLACBR4.js +0 -10
  126. package/dist/doctor-6DLACBR4.js.map +0 -1
  127. package/dist/file-service-FQQYME7M.js +0 -8
  128. package/dist/file-service-FQQYME7M.js.map +0 -1
  129. package/dist/install-cloudflared-LNS5L5FR.js +0 -33
  130. package/dist/install-cloudflared-LNS5L5FR.js.map +0 -1
  131. package/dist/install-context-KZO5FR4D.js +0 -78
  132. package/dist/install-context-KZO5FR4D.js.map +0 -1
  133. package/dist/install-jq-SN4IA5K4.js +0 -31
  134. package/dist/install-jq-SN4IA5K4.js.map +0 -1
  135. package/dist/instance-context-FLCE7VZ4.js +0 -13
  136. package/dist/instance-context-FLCE7VZ4.js.map +0 -1
  137. package/dist/instance-registry-SW5FWKHO.js +0 -7
  138. package/dist/instance-registry-SW5FWKHO.js.map +0 -1
  139. package/dist/integrate-JIEZYDOR.js +0 -371
  140. package/dist/integrate-JIEZYDOR.js.map +0 -1
  141. package/dist/log-YZ243M5G.js +0 -25
  142. package/dist/log-YZ243M5G.js.map +0 -1
  143. package/dist/main-D7M2AKRM.js +0 -697
  144. package/dist/main-D7M2AKRM.js.map +0 -1
  145. package/dist/menu-ALFN37IR.js +0 -15
  146. package/dist/menu-ALFN37IR.js.map +0 -1
  147. package/dist/notifications-MO23S7S3.js +0 -8
  148. package/dist/notifications-MO23S7S3.js.map +0 -1
  149. package/dist/plugin-create-HFKS23JY.js +0 -968
  150. package/dist/plugin-create-HFKS23JY.js.map +0 -1
  151. package/dist/plugin-installer-VSTYZSXC.js +0 -9
  152. package/dist/plugin-installer-VSTYZSXC.js.map +0 -1
  153. package/dist/plugin-registry-6J3YSFHF.js +0 -7
  154. package/dist/plugin-registry-6J3YSFHF.js.map +0 -1
  155. package/dist/plugin-search-MGKAL5JM.js +0 -39
  156. package/dist/plugin-search-MGKAL5JM.js.map +0 -1
  157. package/dist/post-upgrade-F4YPMTUT.js +0 -79
  158. package/dist/post-upgrade-F4YPMTUT.js.map +0 -1
  159. package/dist/read-text-file-DJBTITIB.js +0 -7
  160. package/dist/read-text-file-DJBTITIB.js.map +0 -1
  161. package/dist/registry-client-GTBWLXYU.js +0 -7
  162. package/dist/registry-client-GTBWLXYU.js.map +0 -1
  163. package/dist/security-O4XGN2CM.js +0 -8
  164. package/dist/security-O4XGN2CM.js.map +0 -1
  165. package/dist/settings-manager-B4UN2LAC.js +0 -7
  166. package/dist/settings-manager-B4UN2LAC.js.map +0 -1
  167. package/dist/setup-44WLBIOT.js +0 -989
  168. package/dist/setup-44WLBIOT.js.map +0 -1
  169. package/dist/speech-GHTSWDAN.js +0 -9
  170. package/dist/speech-GHTSWDAN.js.map +0 -1
  171. package/dist/suggest-RST5VOHB.js +0 -36
  172. package/dist/suggest-RST5VOHB.js.map +0 -1
  173. package/dist/telegram-D7ASLVEB.js +0 -7
  174. package/dist/telegram-D7ASLVEB.js.map +0 -1
  175. package/dist/tunnel-ALJDPFDQ.js +0 -10
  176. package/dist/tunnel-ALJDPFDQ.js.map +0 -1
  177. package/dist/tunnel-service-TBAHDXMF.js +0 -755
  178. package/dist/tunnel-service-TBAHDXMF.js.map +0 -1
  179. package/dist/validators-GITLOFXC.js +0 -11
  180. package/dist/validators-GITLOFXC.js.map +0 -1
  181. package/dist/version-AXXV6IV2.js +0 -15
  182. package/dist/version-AXXV6IV2.js.map +0 -1
@@ -1,989 +0,0 @@
1
- import {
2
- validateBotAdmin,
3
- validateBotToken,
4
- validateChatId
5
- } from "./chunk-WQCJTU2C.js";
6
- import {
7
- InstanceRegistry
8
- } from "./chunk-23SRIVG4.js";
9
- import {
10
- expandHome
11
- } from "./chunk-YZCKSNRN.js";
12
- import "./chunk-R6KZYF7D.js";
13
- import {
14
- commandExists
15
- } from "./chunk-ZSLHHQPQ.js";
16
- import {
17
- generateSlug,
18
- getGlobalRoot
19
- } from "./chunk-ON7HB5O7.js";
20
- import {
21
- RegistryClient
22
- } from "./chunk-CDAUYTVP.js";
23
-
24
- // src/core/setup/wizard.ts
25
- import * as path3 from "path";
26
- import * as fs2 from "fs";
27
- import * as clack7 from "@clack/prompts";
28
-
29
- // src/core/setup/types.ts
30
- var ONBOARD_SECTION_OPTIONS = [
31
- { value: "channels", label: "Channels", hint: "Link/update messaging platforms" },
32
- { value: "agents", label: "Agents", hint: "Install agents, change default" },
33
- { value: "workspace", label: "Workspace", hint: "Set workspace directory" },
34
- { value: "runMode", label: "Run mode", hint: "Foreground/daemon, auto-start" },
35
- { value: "integrations", label: "Integrations", hint: "Claude CLI session transfer" }
36
- ];
37
- var CHANNEL_META = {
38
- telegram: { label: "Telegram", method: "Bot API" },
39
- discord: { label: "Discord", method: "Bot API" }
40
- };
41
-
42
- // src/core/setup/helpers.ts
43
- import * as clack from "@clack/prompts";
44
- var c = {
45
- reset: "\x1B[0m",
46
- bold: "\x1B[1m",
47
- dim: "\x1B[2m",
48
- green: "\x1B[32m",
49
- yellow: "\x1B[33m",
50
- red: "\x1B[31m",
51
- cyan: "\x1B[36m",
52
- white: "\x1B[37m"
53
- };
54
- var ok = (msg) => `${c.green}${c.bold}\u2713${c.reset} ${c.green}${msg}${c.reset}`;
55
- var warn = (msg) => `${c.yellow}\u26A0 ${msg}${c.reset}`;
56
- var fail = (msg) => `${c.red}\u2717 ${msg}${c.reset}`;
57
- var step = (n, total, title) => `
58
- ${c.cyan}${c.bold}[${n}/${total}]${c.reset} ${c.bold}${title}${c.reset}
59
- `;
60
- var dim = (msg) => `${c.dim}${msg}${c.reset}`;
61
- function guardCancel(value) {
62
- if (clack.isCancel(value)) {
63
- clack.cancel("Setup cancelled.");
64
- process.exit(0);
65
- }
66
- return value;
67
- }
68
- function applyGradient(text3) {
69
- const colors = [135, 99, 63, 33, 39, 44, 44];
70
- const lines = text3.split("\n");
71
- return lines.map((line, i) => {
72
- const colorIdx = Math.min(i, colors.length - 1);
73
- return `\x1B[38;5;${colors[colorIdx]}m${line}\x1B[0m`;
74
- }).join("\n");
75
- }
76
- var BANNER = `
77
- \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557
78
- \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
79
- \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
80
- \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u255D
81
- \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551
82
- \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D
83
- `;
84
- async function printStartBanner() {
85
- let version = "0.0.0";
86
- try {
87
- const { getCurrentVersion } = await import("./version-AXXV6IV2.js");
88
- version = getCurrentVersion();
89
- } catch {
90
- }
91
- console.log(applyGradient(BANNER));
92
- console.log(`${c.dim} AI coding agents, anywhere. v${version}${c.reset}
93
- `);
94
- }
95
- function summarizeConfig(config) {
96
- const lines = [];
97
- const channelStatuses = [];
98
- for (const [id, meta] of Object.entries({
99
- telegram: "Telegram",
100
- discord: "Discord"
101
- })) {
102
- const ch = config.channels[id];
103
- if (ch?.enabled) {
104
- channelStatuses.push(`${meta} (enabled)`);
105
- } else if (ch && Object.keys(ch).length > 1) {
106
- channelStatuses.push(`${meta} (disabled)`);
107
- } else {
108
- channelStatuses.push(`${meta} (not configured)`);
109
- }
110
- }
111
- lines.push(`Channels: ${channelStatuses.join(", ")}`);
112
- lines.push(`Default agent: ${config.defaultAgent}`);
113
- lines.push(`Workspace: ${config.workspace.baseDir}`);
114
- lines.push(`Run mode: ${config.runMode}${config.autoStart ? " (auto-start)" : ""}`);
115
- return lines.join("\n");
116
- }
117
-
118
- // src/core/setup/setup-agents.ts
119
- import { execFileSync } from "child_process";
120
- import * as clack2 from "@clack/prompts";
121
- var KNOWN_AGENTS = [
122
- // claude-agent-acp is bundled as a dependency — no detection needed, but
123
- // kept here so detectAgents() still returns it for display purposes.
124
- { name: "claude", commands: ["claude-agent-acp"] },
125
- { name: "codex", commands: ["codex"] }
126
- ];
127
- async function detectAgents() {
128
- const found = [];
129
- for (const agent of KNOWN_AGENTS) {
130
- const available = [];
131
- for (const cmd of agent.commands) {
132
- if (commandExists(cmd)) {
133
- available.push(cmd);
134
- }
135
- }
136
- if (available.length > 0) {
137
- found.push({ name: agent.name, command: available[0] });
138
- }
139
- }
140
- return found;
141
- }
142
- async function validateAgentCommand(command) {
143
- try {
144
- execFileSync("which", [command], { stdio: "pipe" });
145
- return true;
146
- } catch {
147
- return false;
148
- }
149
- }
150
- async function setupAgents() {
151
- const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
152
- const { muteLogger, unmuteLogger } = await import("./log-YZ243M5G.js");
153
- muteLogger();
154
- const catalog = new AgentCatalog();
155
- catalog.load();
156
- const s = clack2.spinner();
157
- s.start("Checking available agents...");
158
- await catalog.refreshRegistryIfStale();
159
- if (!catalog.getInstalledAgent("claude")) {
160
- const claudeRegistry = catalog.findRegistryAgent("claude-acp");
161
- if (claudeRegistry) {
162
- await catalog.install("claude-acp");
163
- } else {
164
- const { AgentStore } = await import("./agent-store-5UHZH2XI.js");
165
- const store = new AgentStore();
166
- store.load();
167
- store.addAgent("claude", {
168
- registryId: "claude-acp",
169
- name: "Claude Agent",
170
- version: "bundled",
171
- distribution: "npx",
172
- command: "npx",
173
- args: ["@zed-industries/claude-agent-acp"],
174
- env: {},
175
- installedAt: (/* @__PURE__ */ new Date()).toISOString(),
176
- binaryPath: null
177
- });
178
- }
179
- }
180
- s.stop(ok("Claude Agent ready"));
181
- unmuteLogger();
182
- const available = catalog.getAvailable();
183
- const installed = available.filter((a) => a.installed);
184
- const installable = available.filter((a) => !a.installed && a.available);
185
- if (installed.length > 0 || installable.length > 0) {
186
- const seen = /* @__PURE__ */ new Set();
187
- const options = [];
188
- for (const a of installed) {
189
- const dedupeKey = `${a.key}::${a.name}`;
190
- if (seen.has(dedupeKey)) continue;
191
- seen.add(dedupeKey);
192
- options.push({
193
- label: `${a.name} (installed)`,
194
- value: a.key
195
- });
196
- }
197
- for (const a of installable) {
198
- const dedupeKey = `${a.key}::${a.name}`;
199
- if (seen.has(dedupeKey)) continue;
200
- seen.add(dedupeKey);
201
- options.push({
202
- label: `${a.name} (${a.distribution})`,
203
- value: a.key
204
- });
205
- }
206
- const installedKeys = installed.map((a) => a.key);
207
- const selected = guardCancel(
208
- await clack2.autocompleteMultiselect({
209
- message: "Install additional agents? (type to search, Space to select)",
210
- options,
211
- initialValues: installedKeys,
212
- required: false
213
- })
214
- );
215
- for (const key of selected) {
216
- const regAgent = catalog.findRegistryAgent(key);
217
- if (regAgent) {
218
- const installSpinner = clack2.spinner();
219
- installSpinner.start(`Installing ${regAgent.name}...`);
220
- muteLogger();
221
- const result = await catalog.install(key);
222
- unmuteLogger();
223
- if (result.ok) {
224
- installSpinner.stop(ok("done"));
225
- } else {
226
- installSpinner.stop(warn(`skipped: ${result.error}`));
227
- }
228
- }
229
- }
230
- }
231
- const installedAgents = Object.keys(catalog.getInstalledEntries());
232
- let defaultAgent = "claude";
233
- if (installedAgents.length > 1) {
234
- defaultAgent = guardCancel(
235
- await clack2.select({
236
- message: "Which agent should be the default?",
237
- options: installedAgents.map((key) => {
238
- const agent = catalog.getInstalledAgent(key);
239
- return { label: `${agent.name} (${key})`, value: key };
240
- }),
241
- initialValue: "claude"
242
- })
243
- );
244
- }
245
- console.log(ok(`Default agent: ${c.bold}${defaultAgent}${c.reset}`));
246
- return { defaultAgent };
247
- }
248
-
249
- // src/core/setup/setup-workspace.ts
250
- import * as clack3 from "@clack/prompts";
251
- async function setupWorkspace(opts) {
252
- const { existing, stepNum, totalSteps } = opts ?? {};
253
- if (stepNum != null && totalSteps != null) {
254
- console.log(step(stepNum, totalSteps, "Workspace"));
255
- }
256
- const baseDir = guardCancel(
257
- await clack3.text({
258
- message: "Base directory for workspaces:",
259
- initialValue: existing ?? "~/openacp-workspace",
260
- validate: (val) => (val ?? "").toString().trim().length > 0 ? void 0 : "Path cannot be empty"
261
- })
262
- );
263
- return { baseDir: baseDir.trim().replace(/^['"]|['"]$/g, "") };
264
- }
265
-
266
- // src/core/setup/setup-run-mode.ts
267
- import * as clack4 from "@clack/prompts";
268
- async function setupRunMode(opts) {
269
- const { existing, stepNum, totalSteps } = opts ?? {};
270
- if (stepNum != null && totalSteps != null) {
271
- console.log(step(stepNum, totalSteps, "Run Mode"));
272
- }
273
- if (process.platform === "win32") {
274
- console.log(dim(" (Daemon mode not available on Windows)"));
275
- return { runMode: "foreground", autoStart: false };
276
- }
277
- const initialValue = existing?.runMode === "daemon" ? "daemon" : "foreground";
278
- const mode = guardCancel(
279
- await clack4.select({
280
- message: "How would you like to run OpenACP?",
281
- options: [
282
- {
283
- label: "Background (daemon)",
284
- value: "daemon",
285
- hint: "Runs silently, auto-starts on boot. Manage with: openacp status | stop | logs"
286
- },
287
- {
288
- label: "Foreground (terminal)",
289
- value: "foreground",
290
- hint: "Runs in current terminal session. Start with: openacp"
291
- }
292
- ],
293
- initialValue
294
- })
295
- );
296
- const wasDaemon = existing?.runMode === "daemon";
297
- if (mode === "daemon") {
298
- const { installAutoStart, isAutoStartSupported } = await import("./autostart-CUPZMKKC.js");
299
- const { muteLogger, unmuteLogger } = await import("./log-YZ243M5G.js");
300
- const autoStart = isAutoStartSupported();
301
- if (autoStart) {
302
- muteLogger();
303
- const result = installAutoStart(expandHome("~/.openacp/logs"));
304
- unmuteLogger();
305
- if (result.success) {
306
- console.log(ok("Auto-start on boot enabled"));
307
- } else {
308
- console.log(warn(`Auto-start failed: ${result.error}`));
309
- }
310
- }
311
- return { runMode: "daemon", autoStart };
312
- }
313
- if (wasDaemon) {
314
- const { muteLogger, unmuteLogger } = await import("./log-YZ243M5G.js");
315
- muteLogger();
316
- try {
317
- const { stopDaemon } = await import("./daemon-UOSRDEXW.js");
318
- const result = await stopDaemon();
319
- unmuteLogger();
320
- if (result.stopped) {
321
- console.log(ok(`Daemon stopped (was PID ${result.pid})`));
322
- }
323
- } catch {
324
- unmuteLogger();
325
- }
326
- muteLogger();
327
- try {
328
- const { uninstallAutoStart } = await import("./autostart-CUPZMKKC.js");
329
- uninstallAutoStart();
330
- unmuteLogger();
331
- } catch {
332
- unmuteLogger();
333
- }
334
- }
335
- return { runMode: "foreground", autoStart: false };
336
- }
337
-
338
- // src/core/setup/setup-integrations.ts
339
- import * as clack5 from "@clack/prompts";
340
- async function setupIntegrations(config) {
341
- const claudeIntegration = config?.integrations?.claude;
342
- const isInstalled = claudeIntegration?.installed === true;
343
- const installClaude = guardCancel(
344
- await clack5.confirm({
345
- message: isInstalled ? "Claude CLI integration is installed. Reinstall?" : "Install session transfer for Claude? (enables /openacp:handoff in your terminal)",
346
- initialValue: !isInstalled
347
- })
348
- );
349
- if (installClaude) {
350
- try {
351
- const { getIntegration } = await import("./integrate-JIEZYDOR.js");
352
- const integration = getIntegration("claude");
353
- if (integration) {
354
- for (const item of integration.items) {
355
- const result = await item.install();
356
- for (const log of result.logs) console.log(` ${log}`);
357
- }
358
- }
359
- console.log("Claude CLI integration installed.\n");
360
- } catch (err) {
361
- console.log(`Could not install Claude CLI integration: ${err instanceof Error ? err.message : err}`);
362
- console.log(" You can install it later with: openacp integrate claude\n");
363
- }
364
- }
365
- }
366
-
367
- // src/core/setup/setup-channels.ts
368
- import * as path from "path";
369
- import * as clack6 from "@clack/prompts";
370
- function getChannelStatuses(config) {
371
- const statuses = [];
372
- for (const [id, meta] of Object.entries(CHANNEL_META)) {
373
- const ch = config.channels[id];
374
- const enabled = ch?.enabled === true;
375
- const configured = !!ch && Object.keys(ch).length > 1;
376
- let hint;
377
- if (id === "telegram" && ch?.botToken && typeof ch.botToken === "string" && ch.botToken !== "YOUR_BOT_TOKEN_HERE") {
378
- hint = `Chat ID: ${ch.chatId}`;
379
- }
380
- if (id === "discord" && ch?.guildId) {
381
- hint = `Guild: ${ch.guildId}`;
382
- }
383
- statuses.push({ id, label: meta.label, configured, enabled, hint });
384
- }
385
- return statuses;
386
- }
387
- function noteChannelStatus(config) {
388
- const statuses = getChannelStatuses(config);
389
- const lines = statuses.map((s) => {
390
- const status = s.enabled ? "enabled" : s.configured ? "disabled" : "not configured";
391
- const hintStr = s.hint ? ` \u2014 ${s.hint}` : "";
392
- return ` ${s.label}: ${status}${hintStr}`;
393
- });
394
- console.log("");
395
- console.log(`${c.bold} Channel status${c.reset}`);
396
- for (const line of lines) console.log(line);
397
- console.log("");
398
- }
399
- async function promptConfiguredAction(label) {
400
- return guardCancel(
401
- await clack6.select({
402
- message: `${label} already configured. What do you want to do?`,
403
- options: [
404
- { value: "modify", label: "Modify settings" },
405
- { value: "disable", label: "Disable bot" },
406
- { value: "delete", label: "Delete config" },
407
- { value: "skip", label: "Skip (leave as-is)" }
408
- ],
409
- initialValue: "modify"
410
- })
411
- );
412
- }
413
- async function configureViaPlugin(channelId) {
414
- const pluginMap = {
415
- telegram: { importPath: "../../plugins/telegram/index.js", name: "@openacp/telegram" }
416
- };
417
- const pluginInfo = pluginMap[channelId];
418
- let plugin;
419
- if (pluginInfo) {
420
- const pluginModule = await import(pluginInfo.importPath);
421
- plugin = pluginModule.default;
422
- } else {
423
- try {
424
- const pluginModule = await import(channelId);
425
- plugin = pluginModule.default;
426
- } catch (err) {
427
- console.log(`Could not load plugin "${channelId}": ${err.message}`);
428
- return;
429
- }
430
- }
431
- if (plugin?.configure) {
432
- const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
433
- const { createInstallContext } = await import("./install-context-KZO5FR4D.js");
434
- const basePath = path.join(getGlobalRoot(), "plugins", "data");
435
- const settingsManager = new SettingsManager(basePath);
436
- const ctx = createInstallContext({
437
- pluginName: plugin.name,
438
- settingsManager,
439
- basePath
440
- });
441
- await plugin.configure(ctx);
442
- }
443
- }
444
- async function configureChannels(config) {
445
- const next = structuredClone(config);
446
- let changed = false;
447
- noteChannelStatus(next);
448
- while (true) {
449
- const statuses = getChannelStatuses(next);
450
- const options = statuses.map((s) => {
451
- const status = s.enabled ? "enabled" : s.configured ? "disabled" : "not configured";
452
- return {
453
- value: s.id,
454
- label: `${s.label} (${CHANNEL_META[s.id].method})`,
455
- hint: status + (s.hint ? ` \xB7 ${s.hint}` : "")
456
- };
457
- });
458
- const choice = guardCancel(
459
- await clack6.select({
460
- message: "Select a channel",
461
- options: [
462
- ...options,
463
- { value: "__done__", label: "Finished" }
464
- ]
465
- })
466
- );
467
- if (choice === "__done__") break;
468
- const channelId = choice;
469
- const meta = CHANNEL_META[channelId];
470
- const existing = next.channels[channelId];
471
- const isConfigured = !!existing && Object.keys(existing).length > 1;
472
- if (isConfigured) {
473
- const action = await promptConfiguredAction(meta.label);
474
- if (action === "skip") continue;
475
- if (action === "disable") {
476
- next.channels[channelId].enabled = false;
477
- changed = true;
478
- console.log(ok(`${meta.label} disabled`));
479
- continue;
480
- }
481
- if (action === "delete") {
482
- const confirmed = guardCancel(
483
- await clack6.confirm({
484
- message: `Delete ${meta.label} config? This cannot be undone.`,
485
- initialValue: false
486
- })
487
- );
488
- if (confirmed) {
489
- delete next.channels[channelId];
490
- changed = true;
491
- console.log(ok(`${meta.label} config deleted`));
492
- }
493
- continue;
494
- }
495
- }
496
- await configureViaPlugin(channelId);
497
- changed = true;
498
- }
499
- return { config: next, changed };
500
- }
501
-
502
- // src/core/instance-copy.ts
503
- import fs from "fs";
504
- import path2 from "path";
505
- async function copyInstance(src, dst, opts) {
506
- const { inheritableKeys = {}, onProgress } = opts;
507
- fs.mkdirSync(dst, { recursive: true });
508
- const configSrc = path2.join(src, "config.json");
509
- if (fs.existsSync(configSrc)) {
510
- onProgress?.("Configuration", "start");
511
- const config = JSON.parse(fs.readFileSync(configSrc, "utf-8"));
512
- delete config.instanceName;
513
- if (config.api) delete config.api.port;
514
- if (config.tunnel) delete config.tunnel.port;
515
- fs.writeFileSync(path2.join(dst, "config.json"), JSON.stringify(config, null, 2));
516
- onProgress?.("Configuration", "done");
517
- }
518
- const pluginsSrc = path2.join(src, "plugins.json");
519
- if (fs.existsSync(pluginsSrc)) {
520
- onProgress?.("Plugin list", "start");
521
- fs.copyFileSync(pluginsSrc, path2.join(dst, "plugins.json"));
522
- onProgress?.("Plugin list", "done");
523
- }
524
- const pluginsDir = path2.join(src, "plugins");
525
- if (fs.existsSync(pluginsDir)) {
526
- onProgress?.("Plugins", "start");
527
- const dstPlugins = path2.join(dst, "plugins");
528
- fs.mkdirSync(dstPlugins, { recursive: true });
529
- const pkgJson = path2.join(pluginsDir, "package.json");
530
- if (fs.existsSync(pkgJson)) fs.copyFileSync(pkgJson, path2.join(dstPlugins, "package.json"));
531
- const nodeModules = path2.join(pluginsDir, "node_modules");
532
- if (fs.existsSync(nodeModules)) fs.cpSync(nodeModules, path2.join(dstPlugins, "node_modules"), { recursive: true });
533
- onProgress?.("Plugins", "done");
534
- }
535
- const agentsJson = path2.join(src, "agents.json");
536
- if (fs.existsSync(agentsJson)) {
537
- onProgress?.("Agents", "start");
538
- fs.copyFileSync(agentsJson, path2.join(dst, "agents.json"));
539
- const agentsDir = path2.join(src, "agents");
540
- if (fs.existsSync(agentsDir)) fs.cpSync(agentsDir, path2.join(dst, "agents"), { recursive: true });
541
- onProgress?.("Agents", "done");
542
- }
543
- const binDir = path2.join(src, "bin");
544
- if (fs.existsSync(binDir)) {
545
- onProgress?.("Tools", "start");
546
- fs.cpSync(binDir, path2.join(dst, "bin"), { recursive: true });
547
- onProgress?.("Tools", "done");
548
- }
549
- const pluginDataSrc = path2.join(src, "plugins", "data");
550
- if (fs.existsSync(pluginDataSrc)) {
551
- onProgress?.("Preferences", "start");
552
- copyPluginSettings(pluginDataSrc, path2.join(dst, "plugins", "data"), inheritableKeys);
553
- onProgress?.("Preferences", "done");
554
- }
555
- }
556
- function copyPluginSettings(srcData, dstData, inheritableKeys) {
557
- walkPluginDirs(srcData, (pluginName, settingsPath) => {
558
- const allowedKeys = inheritableKeys[pluginName];
559
- if (!allowedKeys || allowedKeys.length === 0) return;
560
- try {
561
- const settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
562
- const filtered = {};
563
- for (const key of allowedKeys) {
564
- if (key in settings) filtered[key] = settings[key];
565
- }
566
- if (Object.keys(filtered).length > 0) {
567
- const relative = path2.relative(srcData, path2.dirname(settingsPath));
568
- const dstDir = path2.join(dstData, relative);
569
- fs.mkdirSync(dstDir, { recursive: true });
570
- fs.writeFileSync(path2.join(dstDir, "settings.json"), JSON.stringify(filtered, null, 2));
571
- }
572
- } catch {
573
- }
574
- });
575
- }
576
- function walkPluginDirs(base, cb) {
577
- if (!fs.existsSync(base)) return;
578
- for (const entry of fs.readdirSync(base, { withFileTypes: true })) {
579
- if (!entry.isDirectory()) continue;
580
- if (entry.name.startsWith("@")) {
581
- const scopeDir = path2.join(base, entry.name);
582
- for (const sub of fs.readdirSync(scopeDir, { withFileTypes: true })) {
583
- if (!sub.isDirectory()) continue;
584
- const pluginName = `${entry.name}/${sub.name}`;
585
- const settingsPath = path2.join(scopeDir, sub.name, "settings.json");
586
- if (fs.existsSync(settingsPath)) cb(pluginName, settingsPath);
587
- }
588
- } else {
589
- const settingsPath = path2.join(base, entry.name, "settings.json");
590
- if (fs.existsSync(settingsPath)) cb(entry.name, settingsPath);
591
- }
592
- }
593
- }
594
-
595
- // src/core/setup/wizard.ts
596
- async function fetchCommunityAdapters() {
597
- try {
598
- const client = new RegistryClient();
599
- const registry = await client.getRegistry();
600
- return registry.plugins.filter((p) => p.category === "adapter" && p.verified).map((p) => ({
601
- name: p.npm,
602
- displayName: p.displayName ?? p.name,
603
- icon: p.icon,
604
- verified: p.verified
605
- }));
606
- } catch {
607
- return [];
608
- }
609
- }
610
- async function runSetup(configManager, opts) {
611
- await printStartBanner();
612
- clack7.intro("Let's set up OpenACP");
613
- const { settingsManager, pluginRegistry } = opts ?? {};
614
- try {
615
- if (!settingsManager || !pluginRegistry) {
616
- console.log(fail("Plugin system not initialized. Cannot set up channels."));
617
- return false;
618
- }
619
- const instanceRoot = opts?.instanceRoot ?? getGlobalRoot();
620
- const isGlobal = instanceRoot === getGlobalRoot();
621
- let instanceName = opts?.instanceName;
622
- if (!instanceName) {
623
- const defaultName = isGlobal ? "Main" : `openacp-${Date.now()}`;
624
- const nameResult = await clack7.text({
625
- message: "Give this setup a name",
626
- defaultValue: defaultName,
627
- validate: (v) => !v?.trim() ? "Name cannot be empty" : void 0
628
- });
629
- if (clack7.isCancel(nameResult)) return false;
630
- instanceName = nameResult.trim();
631
- }
632
- const globalRoot = getGlobalRoot();
633
- const registryPath = path3.join(globalRoot, "instances.json");
634
- const instanceRegistry = new InstanceRegistry(registryPath);
635
- await instanceRegistry.load();
636
- let didCopy = false;
637
- if (opts?.from) {
638
- const fromRoot = path3.join(opts.from, ".openacp");
639
- if (fs2.existsSync(path3.join(fromRoot, "config.json"))) {
640
- const inheritableMap = buildInheritableKeysMap();
641
- await copyInstance(fromRoot, instanceRoot, { inheritableKeys: inheritableMap });
642
- didCopy = true;
643
- } else {
644
- console.error(`No OpenACP setup found at ${fromRoot}`);
645
- return false;
646
- }
647
- }
648
- if (!didCopy) {
649
- const existingInstances = instanceRegistry.list().filter(
650
- (e) => fs2.existsSync(path3.join(e.root, "config.json")) && e.root !== instanceRoot
651
- );
652
- if (existingInstances.length > 0) {
653
- const shouldCopy = await clack7.confirm({
654
- message: "Use settings from an existing setup as a starting point?",
655
- initialValue: true
656
- });
657
- if (clack7.isCancel(shouldCopy)) return false;
658
- if (shouldCopy === true) {
659
- let sourceRoot;
660
- if (existingInstances.length === 1) {
661
- sourceRoot = existingInstances[0].root;
662
- } else {
663
- const choice = await clack7.select({
664
- message: "Which setup to copy from?",
665
- options: existingInstances.map((e) => {
666
- let name = e.id;
667
- try {
668
- const cfg = JSON.parse(fs2.readFileSync(path3.join(e.root, "config.json"), "utf-8"));
669
- if (cfg.instanceName) name = cfg.instanceName;
670
- } catch {
671
- }
672
- const displayPath = e.root.replace(/\/.openacp$/, "");
673
- return { value: e.root, label: `${name} (${displayPath})` };
674
- })
675
- });
676
- if (clack7.isCancel(choice)) return false;
677
- sourceRoot = choice;
678
- }
679
- const inheritableMap = buildInheritableKeysMap();
680
- await copyInstance(sourceRoot, instanceRoot, {
681
- inheritableKeys: inheritableMap,
682
- onProgress: (step2, status) => {
683
- if (status === "done") console.log(` \u2713 ${step2}`);
684
- }
685
- });
686
- didCopy = true;
687
- }
688
- }
689
- }
690
- if (didCopy && await configManager.exists()) {
691
- await configManager.load();
692
- }
693
- const communityAdapters = await fetchCommunityAdapters();
694
- const builtInOptions = [
695
- { label: "Telegram", value: "telegram" }
696
- ];
697
- const communityOptions = communityAdapters.map((a) => ({
698
- label: `${a.icon} ${a.displayName}${a.verified ? " (verified)" : ""}`,
699
- value: `community:${a.name}`
700
- }));
701
- const channelChoices = guardCancel(
702
- await clack7.multiselect({
703
- message: "Which channels do you want to set up?",
704
- options: [
705
- ...builtInOptions.map((o) => ({ value: o.value, label: o.label, hint: "built-in" })),
706
- ...communityOptions.length > 0 ? communityOptions.map((o) => ({ value: o.value, label: o.label, hint: "from plugin registry" })) : []
707
- ],
708
- required: true,
709
- initialValues: ["telegram"]
710
- })
711
- );
712
- const channelSteps = channelChoices.length;
713
- const runModeSteps = opts?.skipRunMode ? 0 : 1;
714
- const totalSteps = channelSteps + 1 + runModeSteps;
715
- let currentStep = 0;
716
- const { createInstallContext } = await import("./install-context-KZO5FR4D.js");
717
- for (const channelId of channelChoices) {
718
- currentStep++;
719
- if (channelId === "telegram") {
720
- const telegramPlugin = (await import("./telegram-D7ASLVEB.js")).default;
721
- const ctx = createInstallContext({
722
- pluginName: telegramPlugin.name,
723
- settingsManager,
724
- basePath: settingsManager.getBasePath()
725
- });
726
- await telegramPlugin.install(ctx);
727
- pluginRegistry.register(telegramPlugin.name, {
728
- version: telegramPlugin.version,
729
- source: "builtin",
730
- enabled: true,
731
- settingsPath: settingsManager.getSettingsPath(telegramPlugin.name),
732
- description: telegramPlugin.description
733
- });
734
- }
735
- if (channelId.startsWith("community:")) {
736
- const npmPackage = channelId.slice("community:".length);
737
- const { execFileSync: execFileSync2 } = await import("child_process");
738
- const pluginsDir = path3.join(getGlobalRoot(), "plugins");
739
- const nodeModulesDir = path3.join(pluginsDir, "node_modules");
740
- try {
741
- execFileSync2("npm", ["install", npmPackage, "--prefix", pluginsDir, "--save"], {
742
- stdio: "inherit",
743
- timeout: 6e4
744
- });
745
- } catch {
746
- console.log(fail(`Failed to install ${npmPackage}.`));
747
- return false;
748
- }
749
- try {
750
- const { readFileSync: readFileSync2 } = await import("fs");
751
- const installedPkgPath = path3.join(nodeModulesDir, npmPackage, "package.json");
752
- const installedPkg = JSON.parse(readFileSync2(installedPkgPath, "utf-8"));
753
- const pluginModule = await import(path3.join(nodeModulesDir, npmPackage, installedPkg.main ?? "dist/index.js"));
754
- const plugin = pluginModule.default;
755
- if (plugin?.install) {
756
- const installCtx = createInstallContext({
757
- pluginName: plugin.name ?? npmPackage,
758
- settingsManager,
759
- basePath: settingsManager.getBasePath()
760
- });
761
- await plugin.install(installCtx);
762
- }
763
- pluginRegistry.register(plugin?.name ?? npmPackage, {
764
- version: installedPkg.version,
765
- source: "npm",
766
- enabled: true,
767
- settingsPath: settingsManager.getSettingsPath(plugin?.name ?? npmPackage),
768
- description: plugin?.description ?? installedPkg.description
769
- });
770
- } catch (err) {
771
- console.log(fail(`Failed to load ${npmPackage}: ${err.message}`));
772
- pluginRegistry.register(npmPackage, {
773
- version: "unknown",
774
- source: "npm",
775
- enabled: false,
776
- settingsPath: settingsManager.getSettingsPath(npmPackage)
777
- });
778
- }
779
- }
780
- }
781
- await pluginRegistry.save();
782
- const { defaultAgent } = await setupAgents();
783
- await setupIntegrations();
784
- currentStep++;
785
- const workspace = await setupWorkspace({ stepNum: currentStep, totalSteps });
786
- let runMode = "foreground";
787
- let autoStart = false;
788
- if (!opts?.skipRunMode) {
789
- currentStep++;
790
- const result = await setupRunMode({ stepNum: currentStep, totalSteps });
791
- runMode = result.runMode;
792
- autoStart = result.autoStart;
793
- }
794
- const security = {
795
- allowedUserIds: [],
796
- maxConcurrentSessions: 20,
797
- sessionTimeoutMinutes: 60
798
- };
799
- const config = {
800
- instanceName,
801
- channels: {},
802
- agents: {},
803
- defaultAgent,
804
- workspace,
805
- security,
806
- logging: {
807
- level: "info",
808
- logDir: "~/.openacp/logs",
809
- maxFileSize: "10m",
810
- maxFiles: 7,
811
- sessionLogRetentionDays: 30
812
- },
813
- runMode,
814
- autoStart,
815
- api: {
816
- port: 21420,
817
- host: "127.0.0.1"
818
- },
819
- sessionStore: { ttlDays: 30 },
820
- tunnel: {
821
- enabled: true,
822
- port: 3100,
823
- provider: "cloudflare",
824
- options: {},
825
- maxUserTunnels: 5,
826
- storeTtlMinutes: 60,
827
- auth: { enabled: false }
828
- },
829
- usage: {
830
- enabled: true,
831
- warningThreshold: 0.8,
832
- currency: "USD",
833
- retentionDays: 90
834
- },
835
- integrations: {},
836
- speech: {
837
- stt: { provider: null, providers: {} },
838
- tts: { provider: null, providers: {} }
839
- },
840
- agentSwitch: { labelHistory: true }
841
- };
842
- try {
843
- await configManager.writeNew(config);
844
- } catch (writeErr) {
845
- console.log(
846
- fail(`Could not save config: ${writeErr.message}`)
847
- );
848
- return false;
849
- }
850
- if (settingsManager && pluginRegistry) {
851
- await registerBuiltinPlugins(settingsManager, pluginRegistry);
852
- await pluginRegistry.save();
853
- }
854
- const id = instanceRegistry.uniqueId(generateSlug(instanceName));
855
- instanceRegistry.register(id, instanceRoot);
856
- await instanceRegistry.save();
857
- clack7.outro(`Config saved to ${configManager.getConfigPath()}`);
858
- if (!opts?.skipRunMode) {
859
- console.log(ok("Starting OpenACP..."));
860
- console.log("");
861
- }
862
- return true;
863
- } catch (err) {
864
- if (err.name === "ExitPromptError") {
865
- clack7.cancel("Setup cancelled.");
866
- return false;
867
- }
868
- throw err;
869
- }
870
- }
871
- async function registerBuiltinPlugins(settingsManager, pluginRegistry) {
872
- const builtinPlugins = [
873
- { name: "@openacp/security", version: "1.0.0", description: "User access control and session limits" },
874
- { name: "@openacp/file-service", version: "1.0.0", description: "File storage and management" },
875
- { name: "@openacp/context", version: "1.0.0", description: "Conversation context management" },
876
- { name: "@openacp/speech", version: "1.0.0", description: "Text-to-speech and speech-to-text" },
877
- { name: "@openacp/notifications", version: "1.0.0", description: "Cross-session notification routing" },
878
- { name: "@openacp/tunnel", version: "1.0.0", description: "Expose local services via tunnel" },
879
- { name: "@openacp/api-server", version: "1.0.0", description: "REST API + SSE streaming server" }
880
- ];
881
- for (const p of builtinPlugins) {
882
- if (!pluginRegistry.get(p.name)) {
883
- pluginRegistry.register(p.name, {
884
- version: p.version,
885
- source: "builtin",
886
- enabled: true,
887
- settingsPath: settingsManager.getSettingsPath(p.name),
888
- description: p.description
889
- });
890
- }
891
- }
892
- }
893
- function buildInheritableKeysMap() {
894
- return {
895
- "@openacp/tunnel": ["provider", "maxUserTunnels", "auth"],
896
- "@openacp/api-server": ["host"],
897
- "@openacp/security": ["allowedUsers", "maxSessionsPerUser", "rateLimits"],
898
- "@openacp/usage": ["budget"],
899
- "@openacp/speech": ["tts"]
900
- };
901
- }
902
- async function selectSection(hasSelection) {
903
- return guardCancel(
904
- await clack7.select({
905
- message: "Select sections to configure",
906
- options: [
907
- ...ONBOARD_SECTION_OPTIONS,
908
- {
909
- value: "__continue",
910
- label: "Continue",
911
- hint: hasSelection ? "Done" : "Skip for now"
912
- }
913
- ],
914
- initialValue: ONBOARD_SECTION_OPTIONS[0].value
915
- })
916
- );
917
- }
918
- async function runReconfigure(configManager) {
919
- await printStartBanner();
920
- clack7.intro("OpenACP \u2014 Reconfigure");
921
- try {
922
- await configManager.load();
923
- let config = configManager.get();
924
- clack7.note(summarizeConfig(config), "Current configuration");
925
- let ranSection = false;
926
- while (true) {
927
- const choice = await selectSection(ranSection);
928
- if (choice === "__continue") break;
929
- ranSection = true;
930
- if (choice === "channels") {
931
- const result = await configureChannels(config);
932
- if (result.changed) {
933
- config = { ...config, channels: result.config.channels };
934
- await configManager.writeNew(config);
935
- }
936
- }
937
- if (choice === "agents") {
938
- const { defaultAgent } = await setupAgents();
939
- await configManager.save({ defaultAgent });
940
- config = configManager.get();
941
- }
942
- if (choice === "workspace") {
943
- const { baseDir } = await setupWorkspace({
944
- existing: config.workspace.baseDir
945
- });
946
- await configManager.save({ workspace: { baseDir } });
947
- config = configManager.get();
948
- }
949
- if (choice === "runMode") {
950
- const result = await setupRunMode({
951
- existing: { runMode: config.runMode, autoStart: config.autoStart }
952
- });
953
- await configManager.save({
954
- runMode: result.runMode,
955
- autoStart: result.autoStart
956
- });
957
- config = configManager.get();
958
- }
959
- if (choice === "integrations") {
960
- await setupIntegrations(config);
961
- }
962
- }
963
- if (!ranSection) {
964
- clack7.outro("No changes made.");
965
- return;
966
- }
967
- clack7.outro(`Config saved to ${configManager.getConfigPath()}`);
968
- } catch (err) {
969
- if (err.name === "ExitPromptError") {
970
- clack7.cancel("Setup cancelled.");
971
- return;
972
- }
973
- throw err;
974
- }
975
- }
976
- export {
977
- detectAgents,
978
- printStartBanner,
979
- runReconfigure,
980
- runSetup,
981
- setupAgents,
982
- setupRunMode,
983
- setupWorkspace,
984
- validateAgentCommand,
985
- validateBotAdmin,
986
- validateBotToken,
987
- validateChatId
988
- };
989
- //# sourceMappingURL=setup-44WLBIOT.js.map