@openacp/cli 2026.330.3 → 2026.331.2

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 (173) hide show
  1. package/README.md +19 -1
  2. package/dist/cli.d.ts +11 -0
  3. package/dist/cli.js +25134 -278
  4. package/dist/cli.js.map +1 -1
  5. package/dist/data/registry-snapshot.json +1 -1
  6. package/dist/index.d.ts +259 -30
  7. package/dist/index.js +17632 -404
  8. package/dist/index.js.map +1 -1
  9. package/package.json +2 -2
  10. package/dist/adapter-AWSI4GML.js +0 -13
  11. package/dist/adapter-AWSI4GML.js.map +0 -1
  12. package/dist/agent-catalog-SZQQERV7.js +0 -10
  13. package/dist/agent-catalog-SZQQERV7.js.map +0 -1
  14. package/dist/agent-dependencies-ED2ZTUHG.js +0 -23
  15. package/dist/agent-dependencies-ED2ZTUHG.js.map +0 -1
  16. package/dist/agent-registry-YOGP656W.js +0 -8
  17. package/dist/agent-registry-YOGP656W.js.map +0 -1
  18. package/dist/agent-store-5UHZH2XI.js +0 -8
  19. package/dist/agent-store-5UHZH2XI.js.map +0 -1
  20. package/dist/api-client-XTLRRFPX.js +0 -13
  21. package/dist/api-client-XTLRRFPX.js.map +0 -1
  22. package/dist/api-server-5VNYFWJE.js +0 -7
  23. package/dist/api-server-5VNYFWJE.js.map +0 -1
  24. package/dist/api-server-JLBDKCU4.js +0 -10
  25. package/dist/api-server-JLBDKCU4.js.map +0 -1
  26. package/dist/autostart-CUPZMKKC.js +0 -22
  27. package/dist/autostart-CUPZMKKC.js.map +0 -1
  28. package/dist/chunk-237WYH6H.js +0 -235
  29. package/dist/chunk-237WYH6H.js.map +0 -1
  30. package/dist/chunk-2HEFALTZ.js +0 -44
  31. package/dist/chunk-2HEFALTZ.js.map +0 -1
  32. package/dist/chunk-2KT6TROD.js +0 -129
  33. package/dist/chunk-2KT6TROD.js.map +0 -1
  34. package/dist/chunk-2R5XM3ES.js +0 -154
  35. package/dist/chunk-2R5XM3ES.js.map +0 -1
  36. package/dist/chunk-3EWTPOF7.js +0 -51
  37. package/dist/chunk-3EWTPOF7.js.map +0 -1
  38. package/dist/chunk-3NAFXVQM.js +0 -67
  39. package/dist/chunk-3NAFXVQM.js.map +0 -1
  40. package/dist/chunk-4WXALZA3.js +0 -45
  41. package/dist/chunk-4WXALZA3.js.map +0 -1
  42. package/dist/chunk-566W6INH.js +0 -83
  43. package/dist/chunk-566W6INH.js.map +0 -1
  44. package/dist/chunk-5HKQCYOI.js +0 -145
  45. package/dist/chunk-5HKQCYOI.js.map +0 -1
  46. package/dist/chunk-5OCGO27U.js +0 -125
  47. package/dist/chunk-5OCGO27U.js.map +0 -1
  48. package/dist/chunk-5WGVYX3C.js +0 -55
  49. package/dist/chunk-5WGVYX3C.js.map +0 -1
  50. package/dist/chunk-7ZCQF6QM.js +0 -27
  51. package/dist/chunk-7ZCQF6QM.js.map +0 -1
  52. package/dist/chunk-AFKX424Q.js +0 -92
  53. package/dist/chunk-AFKX424Q.js.map +0 -1
  54. package/dist/chunk-APS6UEFU.js +0 -259
  55. package/dist/chunk-APS6UEFU.js.map +0 -1
  56. package/dist/chunk-BTJHGSLM.js +0 -1116
  57. package/dist/chunk-BTJHGSLM.js.map +0 -1
  58. package/dist/chunk-CDAUYTVP.js +0 -41
  59. package/dist/chunk-CDAUYTVP.js.map +0 -1
  60. package/dist/chunk-FCTC7KDT.js +0 -101
  61. package/dist/chunk-FCTC7KDT.js.map +0 -1
  62. package/dist/chunk-FNRSWA2K.js +0 -1
  63. package/dist/chunk-FNRSWA2K.js.map +0 -1
  64. package/dist/chunk-GEOXPGCO.js +0 -650
  65. package/dist/chunk-GEOXPGCO.js.map +0 -1
  66. package/dist/chunk-IZ5UEZF7.js +0 -138
  67. package/dist/chunk-IZ5UEZF7.js.map +0 -1
  68. package/dist/chunk-KDU3ZEWT.js +0 -97
  69. package/dist/chunk-KDU3ZEWT.js.map +0 -1
  70. package/dist/chunk-LGFWH3AE.js +0 -26
  71. package/dist/chunk-LGFWH3AE.js.map +0 -1
  72. package/dist/chunk-MITTQMGZ.js +0 -543
  73. package/dist/chunk-MITTQMGZ.js.map +0 -1
  74. package/dist/chunk-MLF4W5R6.js +0 -101
  75. package/dist/chunk-MLF4W5R6.js.map +0 -1
  76. package/dist/chunk-MPGEHTGE.js +0 -679
  77. package/dist/chunk-MPGEHTGE.js.map +0 -1
  78. package/dist/chunk-OYSAN7UX.js +0 -15
  79. package/dist/chunk-OYSAN7UX.js.map +0 -1
  80. package/dist/chunk-PA6MNBG4.js +0 -190
  81. package/dist/chunk-PA6MNBG4.js.map +0 -1
  82. package/dist/chunk-QWVHCTCA.js +0 -172
  83. package/dist/chunk-QWVHCTCA.js.map +0 -1
  84. package/dist/chunk-R6KZYF7D.js +0 -231
  85. package/dist/chunk-R6KZYF7D.js.map +0 -1
  86. package/dist/chunk-S64CB6J3.js +0 -98
  87. package/dist/chunk-S64CB6J3.js.map +0 -1
  88. package/dist/chunk-TMVTSWVH.js +0 -228
  89. package/dist/chunk-TMVTSWVH.js.map +0 -1
  90. package/dist/chunk-UCIZM5SW.js +0 -3917
  91. package/dist/chunk-UCIZM5SW.js.map +0 -1
  92. package/dist/chunk-UWH7KIAA.js +0 -701
  93. package/dist/chunk-UWH7KIAA.js.map +0 -1
  94. package/dist/chunk-V2YZWYXT.js +0 -484
  95. package/dist/chunk-V2YZWYXT.js.map +0 -1
  96. package/dist/chunk-W26AUH5B.js +0 -61
  97. package/dist/chunk-W26AUH5B.js.map +0 -1
  98. package/dist/chunk-W4LK6WJP.js +0 -446
  99. package/dist/chunk-W4LK6WJP.js.map +0 -1
  100. package/dist/chunk-WQCJTU2C.js +0 -84
  101. package/dist/chunk-WQCJTU2C.js.map +0 -1
  102. package/dist/chunk-XBZIHNKV.js +0 -6410
  103. package/dist/chunk-XBZIHNKV.js.map +0 -1
  104. package/dist/chunk-ZSLHHQPQ.js +0 -282
  105. package/dist/chunk-ZSLHHQPQ.js.map +0 -1
  106. package/dist/config-KN6NKKPF.js +0 -20
  107. package/dist/config-KN6NKKPF.js.map +0 -1
  108. package/dist/config-editor-76RVZS4B.js +0 -10
  109. package/dist/config-editor-76RVZS4B.js.map +0 -1
  110. package/dist/config-registry-ZXAIJNYB.js +0 -17
  111. package/dist/config-registry-ZXAIJNYB.js.map +0 -1
  112. package/dist/context-NXXW62NJ.js +0 -9
  113. package/dist/context-NXXW62NJ.js.map +0 -1
  114. package/dist/core-plugins-BPZY7SEB.js +0 -22
  115. package/dist/core-plugins-BPZY7SEB.js.map +0 -1
  116. package/dist/daemon-XFEMMJSZ.js +0 -29
  117. package/dist/daemon-XFEMMJSZ.js.map +0 -1
  118. package/dist/dev-loader-7P3HZCIA.js +0 -37
  119. package/dist/dev-loader-7P3HZCIA.js.map +0 -1
  120. package/dist/doctor-AV6AUO22.js +0 -9
  121. package/dist/doctor-AV6AUO22.js.map +0 -1
  122. package/dist/file-service-HHB3JQIO.js +0 -8
  123. package/dist/file-service-HHB3JQIO.js.map +0 -1
  124. package/dist/install-cloudflared-JRJ4BSOM.js +0 -32
  125. package/dist/install-cloudflared-JRJ4BSOM.js.map +0 -1
  126. package/dist/install-context-EHYV5WRY.js +0 -77
  127. package/dist/install-context-EHYV5WRY.js.map +0 -1
  128. package/dist/install-jq-ISTGT263.js +0 -31
  129. package/dist/install-jq-ISTGT263.js.map +0 -1
  130. package/dist/integrate-JIEZYDOR.js +0 -371
  131. package/dist/integrate-JIEZYDOR.js.map +0 -1
  132. package/dist/log-YZ243M5G.js +0 -25
  133. package/dist/log-YZ243M5G.js.map +0 -1
  134. package/dist/main-VEJCG5PY.js +0 -654
  135. package/dist/main-VEJCG5PY.js.map +0 -1
  136. package/dist/menu-ALFN37IR.js +0 -15
  137. package/dist/menu-ALFN37IR.js.map +0 -1
  138. package/dist/notifications-MO23S7S3.js +0 -8
  139. package/dist/notifications-MO23S7S3.js.map +0 -1
  140. package/dist/plugin-create-EHL76ZZG.js +0 -966
  141. package/dist/plugin-create-EHL76ZZG.js.map +0 -1
  142. package/dist/plugin-installer-VSTYZSXC.js +0 -9
  143. package/dist/plugin-installer-VSTYZSXC.js.map +0 -1
  144. package/dist/plugin-registry-6J3YSFHF.js +0 -7
  145. package/dist/plugin-registry-6J3YSFHF.js.map +0 -1
  146. package/dist/plugin-search-MGKAL5JM.js +0 -39
  147. package/dist/plugin-search-MGKAL5JM.js.map +0 -1
  148. package/dist/post-upgrade-Y26S2ZQ7.js +0 -79
  149. package/dist/post-upgrade-Y26S2ZQ7.js.map +0 -1
  150. package/dist/read-text-file-DJBTITIB.js +0 -7
  151. package/dist/read-text-file-DJBTITIB.js.map +0 -1
  152. package/dist/registry-client-GTBWLXYU.js +0 -7
  153. package/dist/registry-client-GTBWLXYU.js.map +0 -1
  154. package/dist/security-2BA265LN.js +0 -8
  155. package/dist/security-2BA265LN.js.map +0 -1
  156. package/dist/settings-manager-B4UN2LAC.js +0 -7
  157. package/dist/settings-manager-B4UN2LAC.js.map +0 -1
  158. package/dist/setup-DISPNDEK.js +0 -802
  159. package/dist/setup-DISPNDEK.js.map +0 -1
  160. package/dist/speech-SG62JYIF.js +0 -9
  161. package/dist/speech-SG62JYIF.js.map +0 -1
  162. package/dist/suggest-RST5VOHB.js +0 -36
  163. package/dist/suggest-RST5VOHB.js.map +0 -1
  164. package/dist/telegram-L3YM6SQJ.js +0 -7
  165. package/dist/telegram-L3YM6SQJ.js.map +0 -1
  166. package/dist/tunnel-HWJ27WDH.js +0 -7
  167. package/dist/tunnel-HWJ27WDH.js.map +0 -1
  168. package/dist/tunnel-service-ZMO4THKE.js +0 -1261
  169. package/dist/tunnel-service-ZMO4THKE.js.map +0 -1
  170. package/dist/validators-GITLOFXC.js +0 -11
  171. package/dist/validators-GITLOFXC.js.map +0 -1
  172. package/dist/version-AXXV6IV2.js +0 -15
  173. package/dist/version-AXXV6IV2.js.map +0 -1
@@ -1,802 +0,0 @@
1
- import {
2
- validateBotAdmin,
3
- validateBotToken,
4
- validateChatId
5
- } from "./chunk-WQCJTU2C.js";
6
- import {
7
- commandExists
8
- } from "./chunk-ZSLHHQPQ.js";
9
- import {
10
- expandHome
11
- } from "./chunk-W4LK6WJP.js";
12
- import "./chunk-R6KZYF7D.js";
13
- import {
14
- RegistryClient
15
- } from "./chunk-CDAUYTVP.js";
16
-
17
- // src/core/setup/wizard.ts
18
- import * as os2 from "os";
19
- import * as path2 from "path";
20
- import * as clack7 from "@clack/prompts";
21
-
22
- // src/core/setup/types.ts
23
- var ONBOARD_SECTION_OPTIONS = [
24
- { value: "channels", label: "Channels", hint: "Link/update messaging platforms" },
25
- { value: "agents", label: "Agents", hint: "Install agents, change default" },
26
- { value: "workspace", label: "Workspace", hint: "Set workspace directory" },
27
- { value: "runMode", label: "Run mode", hint: "Foreground/daemon, auto-start" },
28
- { value: "integrations", label: "Integrations", hint: "Claude CLI session transfer" }
29
- ];
30
- var CHANNEL_META = {
31
- telegram: { label: "Telegram", method: "Bot API" },
32
- discord: { label: "Discord", method: "Bot API" }
33
- };
34
-
35
- // src/core/setup/helpers.ts
36
- import * as clack from "@clack/prompts";
37
- var c = {
38
- reset: "\x1B[0m",
39
- bold: "\x1B[1m",
40
- dim: "\x1B[2m",
41
- green: "\x1B[32m",
42
- yellow: "\x1B[33m",
43
- red: "\x1B[31m",
44
- cyan: "\x1B[36m",
45
- white: "\x1B[37m"
46
- };
47
- var ok = (msg) => `${c.green}${c.bold}\u2713${c.reset} ${c.green}${msg}${c.reset}`;
48
- var warn = (msg) => `${c.yellow}\u26A0 ${msg}${c.reset}`;
49
- var fail = (msg) => `${c.red}\u2717 ${msg}${c.reset}`;
50
- var step = (n, total, title) => `
51
- ${c.cyan}${c.bold}[${n}/${total}]${c.reset} ${c.bold}${title}${c.reset}
52
- `;
53
- var dim = (msg) => `${c.dim}${msg}${c.reset}`;
54
- function guardCancel(value) {
55
- if (clack.isCancel(value)) {
56
- clack.cancel("Setup cancelled.");
57
- process.exit(0);
58
- }
59
- return value;
60
- }
61
- function applyGradient(text2) {
62
- const colors = [135, 99, 63, 33, 39, 44, 44];
63
- const lines = text2.split("\n");
64
- return lines.map((line, i) => {
65
- const colorIdx = Math.min(i, colors.length - 1);
66
- return `\x1B[38;5;${colors[colorIdx]}m${line}\x1B[0m`;
67
- }).join("\n");
68
- }
69
- var BANNER = `
70
- \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
71
- \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
72
- \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
73
- \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
74
- \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
75
- \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
76
- `;
77
- async function printStartBanner() {
78
- let version = "0.0.0";
79
- try {
80
- const { getCurrentVersion } = await import("./version-AXXV6IV2.js");
81
- version = getCurrentVersion();
82
- } catch {
83
- }
84
- console.log(applyGradient(BANNER));
85
- console.log(`${c.dim} AI coding agents, anywhere. v${version}${c.reset}
86
- `);
87
- }
88
- function summarizeConfig(config) {
89
- const lines = [];
90
- const channelStatuses = [];
91
- for (const [id, meta] of Object.entries({
92
- telegram: "Telegram",
93
- discord: "Discord"
94
- })) {
95
- const ch = config.channels[id];
96
- if (ch?.enabled) {
97
- channelStatuses.push(`${meta} (enabled)`);
98
- } else if (ch && Object.keys(ch).length > 1) {
99
- channelStatuses.push(`${meta} (disabled)`);
100
- } else {
101
- channelStatuses.push(`${meta} (not configured)`);
102
- }
103
- }
104
- lines.push(`Channels: ${channelStatuses.join(", ")}`);
105
- lines.push(`Default agent: ${config.defaultAgent}`);
106
- lines.push(`Workspace: ${config.workspace.baseDir}`);
107
- lines.push(`Run mode: ${config.runMode}${config.autoStart ? " (auto-start)" : ""}`);
108
- return lines.join("\n");
109
- }
110
-
111
- // src/core/setup/setup-agents.ts
112
- import { execFileSync } from "child_process";
113
- import * as clack2 from "@clack/prompts";
114
- var KNOWN_AGENTS = [
115
- // claude-agent-acp is bundled as a dependency — no detection needed, but
116
- // kept here so detectAgents() still returns it for display purposes.
117
- { name: "claude", commands: ["claude-agent-acp"] },
118
- { name: "codex", commands: ["codex"] }
119
- ];
120
- async function detectAgents() {
121
- const found = [];
122
- for (const agent of KNOWN_AGENTS) {
123
- const available = [];
124
- for (const cmd of agent.commands) {
125
- if (commandExists(cmd)) {
126
- available.push(cmd);
127
- }
128
- }
129
- if (available.length > 0) {
130
- found.push({ name: agent.name, command: available[0] });
131
- }
132
- }
133
- return found;
134
- }
135
- async function validateAgentCommand(command) {
136
- try {
137
- execFileSync("which", [command], { stdio: "pipe" });
138
- return true;
139
- } catch {
140
- return false;
141
- }
142
- }
143
- async function setupAgents() {
144
- const { AgentCatalog } = await import("./agent-catalog-SZQQERV7.js");
145
- const { muteLogger, unmuteLogger } = await import("./log-YZ243M5G.js");
146
- muteLogger();
147
- const catalog = new AgentCatalog();
148
- catalog.load();
149
- const s = clack2.spinner();
150
- s.start("Checking available agents...");
151
- await catalog.refreshRegistryIfStale();
152
- if (!catalog.getInstalledAgent("claude")) {
153
- const claudeRegistry = catalog.findRegistryAgent("claude-acp");
154
- if (claudeRegistry) {
155
- await catalog.install("claude-acp");
156
- } else {
157
- const { AgentStore } = await import("./agent-store-5UHZH2XI.js");
158
- const store = new AgentStore();
159
- store.load();
160
- store.addAgent("claude", {
161
- registryId: "claude-acp",
162
- name: "Claude Agent",
163
- version: "bundled",
164
- distribution: "npx",
165
- command: "npx",
166
- args: ["@zed-industries/claude-agent-acp"],
167
- env: {},
168
- installedAt: (/* @__PURE__ */ new Date()).toISOString(),
169
- binaryPath: null
170
- });
171
- }
172
- }
173
- s.stop(ok("Claude Agent ready"));
174
- unmuteLogger();
175
- const available = catalog.getAvailable();
176
- const installed = available.filter((a) => a.installed);
177
- const installable = available.filter((a) => !a.installed && a.available);
178
- if (installed.length > 0 || installable.length > 0) {
179
- const seen = /* @__PURE__ */ new Set();
180
- const options = [];
181
- for (const a of installed) {
182
- const dedupeKey = `${a.key}::${a.name}`;
183
- if (seen.has(dedupeKey)) continue;
184
- seen.add(dedupeKey);
185
- options.push({
186
- label: `${a.name} (installed)`,
187
- value: a.key
188
- });
189
- }
190
- for (const a of installable) {
191
- const dedupeKey = `${a.key}::${a.name}`;
192
- if (seen.has(dedupeKey)) continue;
193
- seen.add(dedupeKey);
194
- options.push({
195
- label: `${a.name} (${a.distribution})`,
196
- value: a.key
197
- });
198
- }
199
- const installedKeys = installed.map((a) => a.key);
200
- const selected = guardCancel(
201
- await clack2.autocompleteMultiselect({
202
- message: "Install additional agents? (type to search, Space to select)",
203
- options,
204
- initialValues: installedKeys,
205
- required: false
206
- })
207
- );
208
- for (const key of selected) {
209
- const regAgent = catalog.findRegistryAgent(key);
210
- if (regAgent) {
211
- const installSpinner = clack2.spinner();
212
- installSpinner.start(`Installing ${regAgent.name}...`);
213
- muteLogger();
214
- const result = await catalog.install(key);
215
- unmuteLogger();
216
- if (result.ok) {
217
- installSpinner.stop(ok("done"));
218
- } else {
219
- installSpinner.stop(warn(`skipped: ${result.error}`));
220
- }
221
- }
222
- }
223
- }
224
- const installedAgents = Object.keys(catalog.getInstalledEntries());
225
- let defaultAgent = "claude";
226
- if (installedAgents.length > 1) {
227
- defaultAgent = guardCancel(
228
- await clack2.select({
229
- message: "Which agent should be the default?",
230
- options: installedAgents.map((key) => {
231
- const agent = catalog.getInstalledAgent(key);
232
- return { label: `${agent.name} (${key})`, value: key };
233
- }),
234
- initialValue: "claude"
235
- })
236
- );
237
- }
238
- console.log(ok(`Default agent: ${c.bold}${defaultAgent}${c.reset}`));
239
- return { defaultAgent };
240
- }
241
-
242
- // src/core/setup/setup-workspace.ts
243
- import * as clack3 from "@clack/prompts";
244
- async function setupWorkspace(opts) {
245
- const { existing, stepNum, totalSteps } = opts ?? {};
246
- if (stepNum != null && totalSteps != null) {
247
- console.log(step(stepNum, totalSteps, "Workspace"));
248
- }
249
- const baseDir = guardCancel(
250
- await clack3.text({
251
- message: "Base directory for workspaces:",
252
- initialValue: existing ?? "~/openacp-workspace",
253
- validate: (val) => (val ?? "").toString().trim().length > 0 ? void 0 : "Path cannot be empty"
254
- })
255
- );
256
- return { baseDir: baseDir.trim().replace(/^['"]|['"]$/g, "") };
257
- }
258
-
259
- // src/core/setup/setup-run-mode.ts
260
- import * as clack4 from "@clack/prompts";
261
- async function setupRunMode(opts) {
262
- const { existing, stepNum, totalSteps } = opts ?? {};
263
- if (stepNum != null && totalSteps != null) {
264
- console.log(step(stepNum, totalSteps, "Run Mode"));
265
- }
266
- if (process.platform === "win32") {
267
- console.log(dim(" (Daemon mode not available on Windows)"));
268
- return { runMode: "foreground", autoStart: false };
269
- }
270
- const initialValue = existing?.runMode === "daemon" ? "daemon" : "foreground";
271
- const mode = guardCancel(
272
- await clack4.select({
273
- message: "How would you like to run OpenACP?",
274
- options: [
275
- {
276
- label: "Background (daemon)",
277
- value: "daemon",
278
- hint: "Runs silently, auto-starts on boot. Manage with: openacp status | stop | logs"
279
- },
280
- {
281
- label: "Foreground (terminal)",
282
- value: "foreground",
283
- hint: "Runs in current terminal session. Start with: openacp"
284
- }
285
- ],
286
- initialValue
287
- })
288
- );
289
- const wasDaemon = existing?.runMode === "daemon";
290
- if (mode === "daemon") {
291
- const { installAutoStart, isAutoStartSupported } = await import("./autostart-CUPZMKKC.js");
292
- const { muteLogger, unmuteLogger } = await import("./log-YZ243M5G.js");
293
- const autoStart = isAutoStartSupported();
294
- if (autoStart) {
295
- muteLogger();
296
- const result = installAutoStart(expandHome("~/.openacp/logs"));
297
- unmuteLogger();
298
- if (result.success) {
299
- console.log(ok("Auto-start on boot enabled"));
300
- } else {
301
- console.log(warn(`Auto-start failed: ${result.error}`));
302
- }
303
- }
304
- return { runMode: "daemon", autoStart };
305
- }
306
- if (wasDaemon) {
307
- const { muteLogger, unmuteLogger } = await import("./log-YZ243M5G.js");
308
- muteLogger();
309
- try {
310
- const { stopDaemon } = await import("./daemon-XFEMMJSZ.js");
311
- const result = await stopDaemon();
312
- unmuteLogger();
313
- if (result.stopped) {
314
- console.log(ok(`Daemon stopped (was PID ${result.pid})`));
315
- }
316
- } catch {
317
- unmuteLogger();
318
- }
319
- muteLogger();
320
- try {
321
- const { uninstallAutoStart } = await import("./autostart-CUPZMKKC.js");
322
- uninstallAutoStart();
323
- unmuteLogger();
324
- } catch {
325
- unmuteLogger();
326
- }
327
- }
328
- return { runMode: "foreground", autoStart: false };
329
- }
330
-
331
- // src/core/setup/setup-integrations.ts
332
- import * as clack5 from "@clack/prompts";
333
- async function setupIntegrations(config) {
334
- const claudeIntegration = config?.integrations?.claude;
335
- const isInstalled = claudeIntegration?.installed === true;
336
- const installClaude = guardCancel(
337
- await clack5.confirm({
338
- message: isInstalled ? "Claude CLI integration is installed. Reinstall?" : "Install session transfer for Claude? (enables /openacp:handoff in your terminal)",
339
- initialValue: !isInstalled
340
- })
341
- );
342
- if (installClaude) {
343
- try {
344
- const { getIntegration } = await import("./integrate-JIEZYDOR.js");
345
- const integration = getIntegration("claude");
346
- if (integration) {
347
- for (const item of integration.items) {
348
- const result = await item.install();
349
- for (const log of result.logs) console.log(` ${log}`);
350
- }
351
- }
352
- console.log("Claude CLI integration installed.\n");
353
- } catch (err) {
354
- console.log(`Could not install Claude CLI integration: ${err instanceof Error ? err.message : err}`);
355
- console.log(" You can install it later with: openacp integrate claude\n");
356
- }
357
- }
358
- }
359
-
360
- // src/core/setup/setup-channels.ts
361
- import * as os from "os";
362
- import * as path from "path";
363
- import * as clack6 from "@clack/prompts";
364
- function getChannelStatuses(config) {
365
- const statuses = [];
366
- for (const [id, meta] of Object.entries(CHANNEL_META)) {
367
- const ch = config.channels[id];
368
- const enabled = ch?.enabled === true;
369
- const configured = !!ch && Object.keys(ch).length > 1;
370
- let hint;
371
- if (id === "telegram" && ch?.botToken && typeof ch.botToken === "string" && ch.botToken !== "YOUR_BOT_TOKEN_HERE") {
372
- hint = `Chat ID: ${ch.chatId}`;
373
- }
374
- if (id === "discord" && ch?.guildId) {
375
- hint = `Guild: ${ch.guildId}`;
376
- }
377
- statuses.push({ id, label: meta.label, configured, enabled, hint });
378
- }
379
- return statuses;
380
- }
381
- function noteChannelStatus(config) {
382
- const statuses = getChannelStatuses(config);
383
- const lines = statuses.map((s) => {
384
- const status = s.enabled ? "enabled" : s.configured ? "disabled" : "not configured";
385
- const hintStr = s.hint ? ` \u2014 ${s.hint}` : "";
386
- return ` ${s.label}: ${status}${hintStr}`;
387
- });
388
- console.log("");
389
- console.log(`${c.bold} Channel status${c.reset}`);
390
- for (const line of lines) console.log(line);
391
- console.log("");
392
- }
393
- async function promptConfiguredAction(label) {
394
- return guardCancel(
395
- await clack6.select({
396
- message: `${label} already configured. What do you want to do?`,
397
- options: [
398
- { value: "modify", label: "Modify settings" },
399
- { value: "disable", label: "Disable bot" },
400
- { value: "delete", label: "Delete config" },
401
- { value: "skip", label: "Skip (leave as-is)" }
402
- ],
403
- initialValue: "modify"
404
- })
405
- );
406
- }
407
- async function configureViaPlugin(channelId) {
408
- const pluginMap = {
409
- telegram: { importPath: "../../plugins/telegram/index.js", name: "@openacp/telegram" }
410
- };
411
- const pluginInfo = pluginMap[channelId];
412
- let plugin;
413
- if (pluginInfo) {
414
- const pluginModule = await import(pluginInfo.importPath);
415
- plugin = pluginModule.default;
416
- } else {
417
- try {
418
- const pluginModule = await import(channelId);
419
- plugin = pluginModule.default;
420
- } catch (err) {
421
- console.log(`Could not load plugin "${channelId}": ${err.message}`);
422
- return;
423
- }
424
- }
425
- if (plugin?.configure) {
426
- const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
427
- const { createInstallContext } = await import("./install-context-EHYV5WRY.js");
428
- const basePath = path.join(os.homedir(), ".openacp", "plugins", "data");
429
- const settingsManager = new SettingsManager(basePath);
430
- const ctx = createInstallContext({
431
- pluginName: plugin.name,
432
- settingsManager,
433
- basePath
434
- });
435
- await plugin.configure(ctx);
436
- }
437
- }
438
- async function configureChannels(config) {
439
- const next = structuredClone(config);
440
- let changed = false;
441
- noteChannelStatus(next);
442
- while (true) {
443
- const statuses = getChannelStatuses(next);
444
- const options = statuses.map((s) => {
445
- const status = s.enabled ? "enabled" : s.configured ? "disabled" : "not configured";
446
- return {
447
- value: s.id,
448
- label: `${s.label} (${CHANNEL_META[s.id].method})`,
449
- hint: status + (s.hint ? ` \xB7 ${s.hint}` : "")
450
- };
451
- });
452
- const choice = guardCancel(
453
- await clack6.select({
454
- message: "Select a channel",
455
- options: [
456
- ...options,
457
- { value: "__done__", label: "Finished" }
458
- ]
459
- })
460
- );
461
- if (choice === "__done__") break;
462
- const channelId = choice;
463
- const meta = CHANNEL_META[channelId];
464
- const existing = next.channels[channelId];
465
- const isConfigured = !!existing && Object.keys(existing).length > 1;
466
- if (isConfigured) {
467
- const action = await promptConfiguredAction(meta.label);
468
- if (action === "skip") continue;
469
- if (action === "disable") {
470
- next.channels[channelId].enabled = false;
471
- changed = true;
472
- console.log(ok(`${meta.label} disabled`));
473
- continue;
474
- }
475
- if (action === "delete") {
476
- const confirmed = guardCancel(
477
- await clack6.confirm({
478
- message: `Delete ${meta.label} config? This cannot be undone.`,
479
- initialValue: false
480
- })
481
- );
482
- if (confirmed) {
483
- delete next.channels[channelId];
484
- changed = true;
485
- console.log(ok(`${meta.label} config deleted`));
486
- }
487
- continue;
488
- }
489
- }
490
- await configureViaPlugin(channelId);
491
- changed = true;
492
- }
493
- return { config: next, changed };
494
- }
495
-
496
- // src/core/setup/wizard.ts
497
- async function fetchCommunityAdapters() {
498
- try {
499
- const client = new RegistryClient();
500
- const registry = await client.getRegistry();
501
- return registry.plugins.filter((p) => p.category === "adapter" && p.verified).map((p) => ({
502
- name: p.npm,
503
- displayName: p.displayName ?? p.name,
504
- icon: p.icon,
505
- verified: p.verified
506
- }));
507
- } catch {
508
- return [];
509
- }
510
- }
511
- async function runSetup(configManager, opts) {
512
- await printStartBanner();
513
- clack7.intro("Let's set up OpenACP");
514
- const { settingsManager, pluginRegistry } = opts ?? {};
515
- try {
516
- if (!settingsManager || !pluginRegistry) {
517
- console.log(fail("Plugin system not initialized. Cannot set up channels."));
518
- return false;
519
- }
520
- const communityAdapters = await fetchCommunityAdapters();
521
- const builtInOptions = [
522
- { label: "Telegram", value: "telegram" }
523
- ];
524
- const communityOptions = communityAdapters.map((a) => ({
525
- label: `${a.icon} ${a.displayName}${a.verified ? " (verified)" : ""}`,
526
- value: `community:${a.name}`
527
- }));
528
- const channelChoices = guardCancel(
529
- await clack7.multiselect({
530
- message: "Which channels do you want to set up?",
531
- options: [
532
- ...builtInOptions.map((o) => ({ value: o.value, label: o.label, hint: "built-in" })),
533
- ...communityOptions.length > 0 ? communityOptions.map((o) => ({ value: o.value, label: o.label, hint: "from plugin registry" })) : []
534
- ],
535
- required: true,
536
- initialValues: ["telegram"]
537
- })
538
- );
539
- const channelSteps = channelChoices.length;
540
- const runModeSteps = opts?.skipRunMode ? 0 : 1;
541
- const totalSteps = channelSteps + 1 + runModeSteps;
542
- let currentStep = 0;
543
- const { createInstallContext } = await import("./install-context-EHYV5WRY.js");
544
- for (const channelId of channelChoices) {
545
- currentStep++;
546
- if (channelId === "telegram") {
547
- const telegramPlugin = (await import("./telegram-L3YM6SQJ.js")).default;
548
- const ctx = createInstallContext({
549
- pluginName: telegramPlugin.name,
550
- settingsManager,
551
- basePath: settingsManager.getBasePath()
552
- });
553
- await telegramPlugin.install(ctx);
554
- pluginRegistry.register(telegramPlugin.name, {
555
- version: telegramPlugin.version,
556
- source: "builtin",
557
- enabled: true,
558
- settingsPath: settingsManager.getSettingsPath(telegramPlugin.name),
559
- description: telegramPlugin.description
560
- });
561
- }
562
- if (channelId.startsWith("community:")) {
563
- const npmPackage = channelId.slice("community:".length);
564
- const { execFileSync: execFileSync2 } = await import("child_process");
565
- const pluginsDir = path2.join(os2.homedir(), ".openacp", "plugins");
566
- const nodeModulesDir = path2.join(pluginsDir, "node_modules");
567
- try {
568
- execFileSync2("npm", ["install", npmPackage, "--prefix", pluginsDir, "--save"], {
569
- stdio: "inherit",
570
- timeout: 6e4
571
- });
572
- } catch {
573
- console.log(fail(`Failed to install ${npmPackage}.`));
574
- return false;
575
- }
576
- try {
577
- const { readFileSync } = await import("fs");
578
- const installedPkgPath = path2.join(nodeModulesDir, npmPackage, "package.json");
579
- const installedPkg = JSON.parse(readFileSync(installedPkgPath, "utf-8"));
580
- const pluginModule = await import(path2.join(nodeModulesDir, npmPackage, installedPkg.main ?? "dist/index.js"));
581
- const plugin = pluginModule.default;
582
- if (plugin?.install) {
583
- const installCtx = createInstallContext({
584
- pluginName: plugin.name ?? npmPackage,
585
- settingsManager,
586
- basePath: settingsManager.getBasePath()
587
- });
588
- await plugin.install(installCtx);
589
- }
590
- pluginRegistry.register(plugin?.name ?? npmPackage, {
591
- version: installedPkg.version,
592
- source: "npm",
593
- enabled: true,
594
- settingsPath: settingsManager.getSettingsPath(plugin?.name ?? npmPackage),
595
- description: plugin?.description ?? installedPkg.description
596
- });
597
- } catch (err) {
598
- console.log(fail(`Failed to load ${npmPackage}: ${err.message}`));
599
- pluginRegistry.register(npmPackage, {
600
- version: "unknown",
601
- source: "npm",
602
- enabled: false,
603
- settingsPath: settingsManager.getSettingsPath(npmPackage)
604
- });
605
- }
606
- }
607
- }
608
- await pluginRegistry.save();
609
- const { defaultAgent } = await setupAgents();
610
- await setupIntegrations();
611
- currentStep++;
612
- const workspace = await setupWorkspace({ stepNum: currentStep, totalSteps });
613
- let runMode = "foreground";
614
- let autoStart = false;
615
- if (!opts?.skipRunMode) {
616
- currentStep++;
617
- const result = await setupRunMode({ stepNum: currentStep, totalSteps });
618
- runMode = result.runMode;
619
- autoStart = result.autoStart;
620
- }
621
- const security = {
622
- allowedUserIds: [],
623
- maxConcurrentSessions: 20,
624
- sessionTimeoutMinutes: 60
625
- };
626
- const config = {
627
- channels: {},
628
- agents: {},
629
- defaultAgent,
630
- workspace,
631
- security,
632
- logging: {
633
- level: "info",
634
- logDir: "~/.openacp/logs",
635
- maxFileSize: "10m",
636
- maxFiles: 7,
637
- sessionLogRetentionDays: 30
638
- },
639
- runMode,
640
- autoStart,
641
- api: {
642
- port: 21420,
643
- host: "127.0.0.1"
644
- },
645
- sessionStore: { ttlDays: 30 },
646
- tunnel: {
647
- enabled: true,
648
- port: 3100,
649
- provider: "cloudflare",
650
- options: {},
651
- maxUserTunnels: 5,
652
- storeTtlMinutes: 60,
653
- auth: { enabled: false }
654
- },
655
- usage: {
656
- enabled: true,
657
- warningThreshold: 0.8,
658
- currency: "USD",
659
- retentionDays: 90
660
- },
661
- integrations: {},
662
- speech: {
663
- stt: { provider: null, providers: {} },
664
- tts: { provider: null, providers: {} }
665
- }
666
- };
667
- try {
668
- await configManager.writeNew(config);
669
- } catch (writeErr) {
670
- console.log(
671
- fail(`Could not save config: ${writeErr.message}`)
672
- );
673
- return false;
674
- }
675
- if (settingsManager && pluginRegistry) {
676
- await registerBuiltinPlugins(settingsManager, pluginRegistry);
677
- await pluginRegistry.save();
678
- }
679
- clack7.outro(`Config saved to ${configManager.getConfigPath()}`);
680
- if (!opts?.skipRunMode) {
681
- console.log(ok("Starting OpenACP..."));
682
- console.log("");
683
- }
684
- return true;
685
- } catch (err) {
686
- if (err.name === "ExitPromptError") {
687
- clack7.cancel("Setup cancelled.");
688
- return false;
689
- }
690
- throw err;
691
- }
692
- }
693
- async function registerBuiltinPlugins(settingsManager, pluginRegistry) {
694
- const builtinPlugins = [
695
- { name: "@openacp/security", version: "1.0.0", description: "User access control and session limits" },
696
- { name: "@openacp/file-service", version: "1.0.0", description: "File storage and management" },
697
- { name: "@openacp/context", version: "1.0.0", description: "Conversation context management" },
698
- { name: "@openacp/speech", version: "1.0.0", description: "Text-to-speech and speech-to-text" },
699
- { name: "@openacp/notifications", version: "1.0.0", description: "Cross-session notification routing" },
700
- { name: "@openacp/tunnel", version: "1.0.0", description: "Expose local services via tunnel" },
701
- { name: "@openacp/api-server", version: "1.0.0", description: "REST API + SSE streaming server" }
702
- ];
703
- for (const p of builtinPlugins) {
704
- if (!pluginRegistry.get(p.name)) {
705
- pluginRegistry.register(p.name, {
706
- version: p.version,
707
- source: "builtin",
708
- enabled: true,
709
- settingsPath: settingsManager.getSettingsPath(p.name),
710
- description: p.description
711
- });
712
- }
713
- }
714
- }
715
- async function selectSection(hasSelection) {
716
- return guardCancel(
717
- await clack7.select({
718
- message: "Select sections to configure",
719
- options: [
720
- ...ONBOARD_SECTION_OPTIONS,
721
- {
722
- value: "__continue",
723
- label: "Continue",
724
- hint: hasSelection ? "Done" : "Skip for now"
725
- }
726
- ],
727
- initialValue: ONBOARD_SECTION_OPTIONS[0].value
728
- })
729
- );
730
- }
731
- async function runReconfigure(configManager) {
732
- await printStartBanner();
733
- clack7.intro("OpenACP \u2014 Reconfigure");
734
- try {
735
- await configManager.load();
736
- let config = configManager.get();
737
- clack7.note(summarizeConfig(config), "Current configuration");
738
- let ranSection = false;
739
- while (true) {
740
- const choice = await selectSection(ranSection);
741
- if (choice === "__continue") break;
742
- ranSection = true;
743
- if (choice === "channels") {
744
- const result = await configureChannels(config);
745
- if (result.changed) {
746
- config = { ...config, channels: result.config.channels };
747
- await configManager.writeNew(config);
748
- }
749
- }
750
- if (choice === "agents") {
751
- const { defaultAgent } = await setupAgents();
752
- await configManager.save({ defaultAgent });
753
- config = configManager.get();
754
- }
755
- if (choice === "workspace") {
756
- const { baseDir } = await setupWorkspace({
757
- existing: config.workspace.baseDir
758
- });
759
- await configManager.save({ workspace: { baseDir } });
760
- config = configManager.get();
761
- }
762
- if (choice === "runMode") {
763
- const result = await setupRunMode({
764
- existing: { runMode: config.runMode, autoStart: config.autoStart }
765
- });
766
- await configManager.save({
767
- runMode: result.runMode,
768
- autoStart: result.autoStart
769
- });
770
- config = configManager.get();
771
- }
772
- if (choice === "integrations") {
773
- await setupIntegrations(config);
774
- }
775
- }
776
- if (!ranSection) {
777
- clack7.outro("No changes made.");
778
- return;
779
- }
780
- clack7.outro(`Config saved to ${configManager.getConfigPath()}`);
781
- } catch (err) {
782
- if (err.name === "ExitPromptError") {
783
- clack7.cancel("Setup cancelled.");
784
- return;
785
- }
786
- throw err;
787
- }
788
- }
789
- export {
790
- detectAgents,
791
- printStartBanner,
792
- runReconfigure,
793
- runSetup,
794
- setupAgents,
795
- setupRunMode,
796
- setupWorkspace,
797
- validateAgentCommand,
798
- validateBotAdmin,
799
- validateBotToken,
800
- validateChatId
801
- };
802
- //# sourceMappingURL=setup-DISPNDEK.js.map