@openacp/cli 2026.330.2 → 2026.331.1
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.
- package/README.md +17 -0
- package/dist/adapter-ELG3VRZ3.js +14 -0
- package/dist/{agent-catalog-SZQQERV7.js → agent-catalog-UYD26QDK.js} +3 -3
- package/dist/{api-client-XTLRRFPX.js → api-client-PEMHYL5U.js} +2 -2
- package/dist/{api-server-JLBDKCU4.js → api-server-DATG2KBR.js} +3 -3
- package/dist/api-server-L5Z7XACW.js +7 -0
- package/dist/chunk-23SRIVG4.js +50 -0
- package/dist/chunk-23SRIVG4.js.map +1 -0
- package/dist/{chunk-YIGBJFJL.js → chunk-7GXEMMEV.js} +15 -15
- package/dist/{chunk-QWVHCTCA.js → chunk-7U6IZIJP.js} +37 -23
- package/dist/chunk-7U6IZIJP.js.map +1 -0
- package/dist/{chunk-FCTC7KDT.js → chunk-7YIKTRSM.js} +14 -10
- package/dist/chunk-7YIKTRSM.js.map +1 -0
- package/dist/{chunk-MITTQMGZ.js → chunk-BYCJQPMN.js} +5 -5
- package/dist/chunk-BYCJQPMN.js.map +1 -0
- package/dist/{chunk-5ZNBNIK3.js → chunk-EWVXSTQK.js} +193 -53
- package/dist/chunk-EWVXSTQK.js.map +1 -0
- package/dist/{chunk-UWH7KIAA.js → chunk-FPKQYCQS.js} +88 -13
- package/dist/chunk-FPKQYCQS.js.map +1 -0
- package/dist/{chunk-GEOXPGCO.js → chunk-K6UY5M75.js} +12 -9
- package/dist/chunk-K6UY5M75.js.map +1 -0
- package/dist/{chunk-KDU3ZEWT.js → chunk-KGAQW6F4.js} +12 -3
- package/dist/chunk-KGAQW6F4.js.map +1 -0
- package/dist/{chunk-7RKPIM3E.js → chunk-LRV56K2M.js} +205 -16
- package/dist/chunk-LRV56K2M.js.map +1 -0
- package/dist/{chunk-V2YZWYXT.js → chunk-MDJHCCFS.js} +18 -17
- package/dist/chunk-MDJHCCFS.js.map +1 -0
- package/dist/chunk-NHD5XDD2.js +686 -0
- package/dist/chunk-NHD5XDD2.js.map +1 -0
- package/dist/{chunk-APS6UEFU.js → chunk-NJX75BLK.js} +1 -1
- package/dist/chunk-NJX75BLK.js.map +1 -0
- package/dist/{chunk-5HKQCYOI.js → chunk-NOEAJNTK.js} +14 -3
- package/dist/chunk-NOEAJNTK.js.map +1 -0
- package/dist/chunk-ON7HB5O7.js +58 -0
- package/dist/chunk-ON7HB5O7.js.map +1 -0
- package/dist/{chunk-5OCGO27U.js → chunk-OSBZXY2W.js} +2 -1
- package/dist/chunk-OSBZXY2W.js.map +1 -0
- package/dist/{chunk-PA6MNBG4.js → chunk-P3HHJANC.js} +32 -13
- package/dist/chunk-P3HHJANC.js.map +1 -0
- package/dist/{chunk-BTJHGSLM.js → chunk-R2YLDQLI.js} +9 -10
- package/dist/chunk-R2YLDQLI.js.map +1 -0
- package/dist/{chunk-CFUJGWOP.js → chunk-SSLVNCEA.js} +27 -3
- package/dist/chunk-SSLVNCEA.js.map +1 -0
- package/dist/{chunk-MPGEHTGE.js → chunk-TGP34LQN.js} +9 -7
- package/dist/chunk-TGP34LQN.js.map +1 -0
- package/dist/{chunk-TMVTSWVH.js → chunk-VUSCVRJL.js} +2 -1
- package/dist/chunk-VUSCVRJL.js.map +1 -0
- package/dist/chunk-XRJUS6FE.js +53 -0
- package/dist/chunk-XRJUS6FE.js.map +1 -0
- package/dist/{chunk-W4LK6WJP.js → chunk-YZCKSNRN.js} +24 -17
- package/dist/chunk-YZCKSNRN.js.map +1 -0
- package/dist/{chunk-3NAFXVQM.js → chunk-ZIRH6QWW.js} +7 -5
- package/dist/chunk-ZIRH6QWW.js.map +1 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +334 -140
- package/dist/cli.js.map +1 -1
- package/dist/config-X4UP7H6R.js +13 -0
- package/dist/config-editor-7BENRVG5.js +11 -0
- package/dist/{config-registry-ZXAIJNYB.js → config-registry-M3FFWEVM.js} +3 -2
- package/dist/context-FVGCU5TI.js +9 -0
- package/dist/core-plugins-JSY2I44L.js +25 -0
- package/dist/{daemon-XFEMMJSZ.js → daemon-UOSRDEXW.js} +8 -3
- package/dist/doctor-6DLACBR4.js +10 -0
- package/dist/{file-service-HHB3JQIO.js → file-service-FQQYME7M.js} +2 -2
- package/dist/index.d.ts +265 -32
- package/dist/index.js +44 -33
- package/dist/index.js.map +1 -1
- package/dist/{install-cloudflared-JRJ4BSOM.js → install-cloudflared-LNS5L5FR.js} +5 -4
- package/dist/install-cloudflared-LNS5L5FR.js.map +1 -0
- package/dist/{install-context-EHYV5WRY.js → install-context-KZO5FR4D.js} +4 -3
- package/dist/install-context-KZO5FR4D.js.map +1 -0
- package/dist/{install-jq-ISTGT263.js → install-jq-SN4IA5K4.js} +3 -3
- package/dist/instance-context-FLCE7VZ4.js +13 -0
- package/dist/instance-registry-SW5FWKHO.js +7 -0
- package/dist/{main-L2M4NTJY.js → main-D7M2AKRM.js} +91 -48
- package/dist/main-D7M2AKRM.js.map +1 -0
- package/dist/{plugin-create-EHL76ZZG.js → plugin-create-HFKS23JY.js} +4 -2
- package/dist/{plugin-create-EHL76ZZG.js.map → plugin-create-HFKS23JY.js.map} +1 -1
- package/dist/{post-upgrade-Y26S2ZQ7.js → post-upgrade-F4YPMTUT.js} +6 -6
- package/dist/{security-2BA265LN.js → security-O4XGN2CM.js} +2 -2
- package/dist/{setup-E6BNEYCS.js → setup-44WLBIOT.js} +209 -22
- package/dist/setup-44WLBIOT.js.map +1 -0
- package/dist/{speech-SG62JYIF.js → speech-GHTSWDAN.js} +2 -2
- package/dist/telegram-D7ASLVEB.js +7 -0
- package/dist/telegram-D7ASLVEB.js.map +1 -0
- package/dist/tunnel-ALJDPFDQ.js +10 -0
- package/dist/tunnel-ALJDPFDQ.js.map +1 -0
- package/dist/{tunnel-service-ZMO4THKE.js → tunnel-service-TBAHDXMF.js} +41 -547
- package/dist/tunnel-service-TBAHDXMF.js.map +1 -0
- package/package.json +1 -1
- package/dist/adapter-4U6MC5ZS.js +0 -13
- package/dist/api-server-5VNYFWJE.js +0 -7
- package/dist/chunk-3NAFXVQM.js.map +0 -1
- package/dist/chunk-4WXALZA3.js +0 -45
- package/dist/chunk-4WXALZA3.js.map +0 -1
- package/dist/chunk-5HKQCYOI.js.map +0 -1
- package/dist/chunk-5OCGO27U.js.map +0 -1
- package/dist/chunk-5ZNBNIK3.js.map +0 -1
- package/dist/chunk-7RKPIM3E.js.map +0 -1
- package/dist/chunk-APS6UEFU.js.map +0 -1
- package/dist/chunk-BTJHGSLM.js.map +0 -1
- package/dist/chunk-CFUJGWOP.js.map +0 -1
- package/dist/chunk-FCTC7KDT.js.map +0 -1
- package/dist/chunk-GEOXPGCO.js.map +0 -1
- package/dist/chunk-KDU3ZEWT.js.map +0 -1
- package/dist/chunk-MITTQMGZ.js.map +0 -1
- package/dist/chunk-MPGEHTGE.js.map +0 -1
- package/dist/chunk-PA6MNBG4.js.map +0 -1
- package/dist/chunk-QWVHCTCA.js.map +0 -1
- package/dist/chunk-TMVTSWVH.js.map +0 -1
- package/dist/chunk-UWH7KIAA.js.map +0 -1
- package/dist/chunk-V2YZWYXT.js.map +0 -1
- package/dist/chunk-W4LK6WJP.js.map +0 -1
- package/dist/config-KN6NKKPF.js +0 -20
- package/dist/config-editor-76RVZS4B.js +0 -10
- package/dist/context-NXXW62NJ.js +0 -9
- package/dist/core-plugins-OCHKGCIZ.js +0 -22
- package/dist/doctor-AV6AUO22.js +0 -9
- package/dist/install-cloudflared-JRJ4BSOM.js.map +0 -1
- package/dist/install-context-EHYV5WRY.js.map +0 -1
- package/dist/main-L2M4NTJY.js.map +0 -1
- package/dist/setup-E6BNEYCS.js.map +0 -1
- package/dist/telegram-EAVRDNFU.js +0 -7
- package/dist/tunnel-HWJ27WDH.js +0 -7
- package/dist/tunnel-service-ZMO4THKE.js.map +0 -1
- /package/dist/{adapter-4U6MC5ZS.js.map → adapter-ELG3VRZ3.js.map} +0 -0
- /package/dist/{agent-catalog-SZQQERV7.js.map → agent-catalog-UYD26QDK.js.map} +0 -0
- /package/dist/{api-client-XTLRRFPX.js.map → api-client-PEMHYL5U.js.map} +0 -0
- /package/dist/{api-server-5VNYFWJE.js.map → api-server-DATG2KBR.js.map} +0 -0
- /package/dist/{api-server-JLBDKCU4.js.map → api-server-L5Z7XACW.js.map} +0 -0
- /package/dist/{chunk-YIGBJFJL.js.map → chunk-7GXEMMEV.js.map} +0 -0
- /package/dist/{config-KN6NKKPF.js.map → config-X4UP7H6R.js.map} +0 -0
- /package/dist/{config-editor-76RVZS4B.js.map → config-editor-7BENRVG5.js.map} +0 -0
- /package/dist/{config-registry-ZXAIJNYB.js.map → config-registry-M3FFWEVM.js.map} +0 -0
- /package/dist/{context-NXXW62NJ.js.map → context-FVGCU5TI.js.map} +0 -0
- /package/dist/{core-plugins-OCHKGCIZ.js.map → core-plugins-JSY2I44L.js.map} +0 -0
- /package/dist/{daemon-XFEMMJSZ.js.map → daemon-UOSRDEXW.js.map} +0 -0
- /package/dist/{doctor-AV6AUO22.js.map → doctor-6DLACBR4.js.map} +0 -0
- /package/dist/{file-service-HHB3JQIO.js.map → file-service-FQQYME7M.js.map} +0 -0
- /package/dist/{install-jq-ISTGT263.js.map → install-jq-SN4IA5K4.js.map} +0 -0
- /package/dist/{security-2BA265LN.js.map → instance-context-FLCE7VZ4.js.map} +0 -0
- /package/dist/{speech-SG62JYIF.js.map → instance-registry-SW5FWKHO.js.map} +0 -0
- /package/dist/{post-upgrade-Y26S2ZQ7.js.map → post-upgrade-F4YPMTUT.js.map} +0 -0
- /package/dist/{telegram-EAVRDNFU.js.map → security-O4XGN2CM.js.map} +0 -0
- /package/dist/{tunnel-HWJ27WDH.js.map → speech-GHTSWDAN.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,15 @@ import {
|
|
|
3
3
|
apiCall,
|
|
4
4
|
readApiPort,
|
|
5
5
|
removeStalePortFile
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XRJUS6FE.js";
|
|
7
|
+
import {
|
|
8
|
+
InstanceRegistry
|
|
9
|
+
} from "./chunk-23SRIVG4.js";
|
|
10
|
+
import {
|
|
11
|
+
createInstanceContext,
|
|
12
|
+
getGlobalRoot,
|
|
13
|
+
resolveInstanceRoot
|
|
14
|
+
} from "./chunk-ON7HB5O7.js";
|
|
7
15
|
import {
|
|
8
16
|
checkAndPromptUpdate,
|
|
9
17
|
compareVersions,
|
|
@@ -11,13 +19,10 @@ import {
|
|
|
11
19
|
getLatestVersion,
|
|
12
20
|
runUpdate
|
|
13
21
|
} from "./chunk-S64CB6J3.js";
|
|
14
|
-
import {
|
|
15
|
-
PLUGINS_DIR
|
|
16
|
-
} from "./chunk-W4LK6WJP.js";
|
|
17
|
-
import "./chunk-R6KZYF7D.js";
|
|
18
22
|
|
|
19
23
|
// src/cli.ts
|
|
20
24
|
import { setDefaultAutoSelectFamily } from "net";
|
|
25
|
+
import path9 from "path";
|
|
21
26
|
|
|
22
27
|
// src/cli/commands/help.ts
|
|
23
28
|
function printHelp() {
|
|
@@ -93,6 +98,13 @@ Connect messaging platforms (Telegram, Discord) to 28+ AI coding agents via ACP
|
|
|
93
98
|
openacp api health System health check
|
|
94
99
|
openacp api restart Restart daemon
|
|
95
100
|
|
|
101
|
+
\x1B[1mInstance Flags:\x1B[0m
|
|
102
|
+
--local Use setup in current directory
|
|
103
|
+
--global Use main setup (~/.openacp)
|
|
104
|
+
--dir <path> Use setup in specified directory
|
|
105
|
+
--from <path> Copy settings from existing setup (on create)
|
|
106
|
+
--name <name> Set instance name (on create)
|
|
107
|
+
|
|
96
108
|
\x1B[2mMore info: https://github.com/Open-ACP/OpenACP\x1B[0m
|
|
97
109
|
`);
|
|
98
110
|
}
|
|
@@ -107,6 +119,7 @@ async function cmdVersion() {
|
|
|
107
119
|
import { execSync } from "child_process";
|
|
108
120
|
import * as fs from "fs";
|
|
109
121
|
import * as path from "path";
|
|
122
|
+
import * as os from "os";
|
|
110
123
|
|
|
111
124
|
// src/cli/commands/helpers.ts
|
|
112
125
|
function wantsHelp(args2) {
|
|
@@ -125,7 +138,9 @@ function buildNestedUpdateFromPath(dotPath, value) {
|
|
|
125
138
|
}
|
|
126
139
|
|
|
127
140
|
// src/cli/commands/install.ts
|
|
128
|
-
async function cmdInstall(args2) {
|
|
141
|
+
async function cmdInstall(args2, instanceRoot) {
|
|
142
|
+
const root2 = instanceRoot ?? path.join(os.homedir(), ".openacp");
|
|
143
|
+
const pluginsDir = path.join(root2, "plugins");
|
|
129
144
|
if (wantsHelp(args2)) {
|
|
130
145
|
console.log(`
|
|
131
146
|
\x1B[1mopenacp install\x1B[0m \u2014 Install a plugin adapter
|
|
@@ -148,13 +163,13 @@ Installs the plugin to ~/.openacp/plugins/.
|
|
|
148
163
|
console.error("Usage: openacp install <package>");
|
|
149
164
|
process.exit(1);
|
|
150
165
|
}
|
|
151
|
-
fs.mkdirSync(
|
|
152
|
-
const pkgPath = path.join(
|
|
166
|
+
fs.mkdirSync(pluginsDir, { recursive: true });
|
|
167
|
+
const pkgPath = path.join(pluginsDir, "package.json");
|
|
153
168
|
if (!fs.existsSync(pkgPath)) {
|
|
154
169
|
fs.writeFileSync(pkgPath, JSON.stringify({ name: "openacp-plugins", private: true, dependencies: {} }, null, 2));
|
|
155
170
|
}
|
|
156
171
|
console.log(`Installing ${pkg}...`);
|
|
157
|
-
execSync(`npm install ${pkg} --prefix "${
|
|
172
|
+
execSync(`npm install ${pkg} --prefix "${pluginsDir}"`, { stdio: "inherit" });
|
|
158
173
|
console.log(`Plugin ${pkg} installed successfully.`);
|
|
159
174
|
}
|
|
160
175
|
|
|
@@ -162,7 +177,10 @@ Installs the plugin to ~/.openacp/plugins/.
|
|
|
162
177
|
import { execSync as execSync2 } from "child_process";
|
|
163
178
|
import * as fs2 from "fs";
|
|
164
179
|
import * as path2 from "path";
|
|
165
|
-
|
|
180
|
+
import * as os2 from "os";
|
|
181
|
+
async function cmdUninstall(args2, instanceRoot) {
|
|
182
|
+
const root2 = instanceRoot ?? path2.join(os2.homedir(), ".openacp");
|
|
183
|
+
const pluginsDir = path2.join(root2, "plugins");
|
|
166
184
|
if (wantsHelp(args2)) {
|
|
167
185
|
console.log(`
|
|
168
186
|
\x1B[1mopenacp uninstall\x1B[0m \u2014 Remove a plugin adapter
|
|
@@ -183,18 +201,18 @@ async function cmdUninstall(args2) {
|
|
|
183
201
|
console.error("Usage: openacp uninstall <package>");
|
|
184
202
|
process.exit(1);
|
|
185
203
|
}
|
|
186
|
-
fs2.mkdirSync(
|
|
187
|
-
const pkgPath = path2.join(
|
|
204
|
+
fs2.mkdirSync(pluginsDir, { recursive: true });
|
|
205
|
+
const pkgPath = path2.join(pluginsDir, "package.json");
|
|
188
206
|
if (!fs2.existsSync(pkgPath)) {
|
|
189
207
|
fs2.writeFileSync(pkgPath, JSON.stringify({ name: "openacp-plugins", private: true, dependencies: {} }, null, 2));
|
|
190
208
|
}
|
|
191
209
|
console.log(`Uninstalling ${pkg}...`);
|
|
192
|
-
execSync2(`npm uninstall ${pkg} --prefix "${
|
|
210
|
+
execSync2(`npm uninstall ${pkg} --prefix "${pluginsDir}"`, { stdio: "inherit" });
|
|
193
211
|
console.log(`Plugin ${pkg} uninstalled.`);
|
|
194
212
|
}
|
|
195
213
|
|
|
196
214
|
// src/cli/commands/plugins.ts
|
|
197
|
-
async function cmdPlugins(args2 = []) {
|
|
215
|
+
async function cmdPlugins(args2 = [], instanceRoot) {
|
|
198
216
|
if (wantsHelp(args2)) {
|
|
199
217
|
console.log(`
|
|
200
218
|
\x1B[1mopenacp plugins\x1B[0m \u2014 List installed plugins
|
|
@@ -206,10 +224,11 @@ Shows all plugins registered in the plugin registry.
|
|
|
206
224
|
`);
|
|
207
225
|
return;
|
|
208
226
|
}
|
|
209
|
-
const
|
|
210
|
-
const
|
|
227
|
+
const os7 = await import("os");
|
|
228
|
+
const path10 = await import("path");
|
|
211
229
|
const { PluginRegistry } = await import("./plugin-registry-6J3YSFHF.js");
|
|
212
|
-
const
|
|
230
|
+
const root2 = instanceRoot ?? path10.join(os7.homedir(), ".openacp");
|
|
231
|
+
const registryPath = path10.join(root2, "plugins.json");
|
|
213
232
|
const registry = new PluginRegistry(registryPath);
|
|
214
233
|
await registry.load();
|
|
215
234
|
const plugins = registry.list();
|
|
@@ -223,7 +242,7 @@ Shows all plugins registered in the plugin registry.
|
|
|
223
242
|
}
|
|
224
243
|
}
|
|
225
244
|
}
|
|
226
|
-
async function cmdPlugin(args2 = []) {
|
|
245
|
+
async function cmdPlugin(args2 = [], instanceRoot) {
|
|
227
246
|
const subcommand = args2[1];
|
|
228
247
|
if (wantsHelp(args2) || !subcommand) {
|
|
229
248
|
console.log(`
|
|
@@ -254,7 +273,7 @@ async function cmdPlugin(args2 = []) {
|
|
|
254
273
|
}
|
|
255
274
|
switch (subcommand) {
|
|
256
275
|
case "list":
|
|
257
|
-
return cmdPlugins(args2.slice(1));
|
|
276
|
+
return cmdPlugins(args2.slice(1), instanceRoot);
|
|
258
277
|
case "search": {
|
|
259
278
|
const { cmdPluginSearch } = await import("./plugin-search-MGKAL5JM.js");
|
|
260
279
|
await cmdPluginSearch(args2.slice(2));
|
|
@@ -267,7 +286,7 @@ async function cmdPlugin(args2 = []) {
|
|
|
267
286
|
console.error("Error: missing package name. Usage: openacp plugin add <package>");
|
|
268
287
|
process.exit(1);
|
|
269
288
|
}
|
|
270
|
-
await installPlugin(pkg);
|
|
289
|
+
await installPlugin(pkg, instanceRoot);
|
|
271
290
|
return;
|
|
272
291
|
}
|
|
273
292
|
case "remove":
|
|
@@ -278,7 +297,7 @@ async function cmdPlugin(args2 = []) {
|
|
|
278
297
|
process.exit(1);
|
|
279
298
|
}
|
|
280
299
|
const purge = args2.includes("--purge");
|
|
281
|
-
await uninstallPlugin(pkg, purge);
|
|
300
|
+
await uninstallPlugin(pkg, purge, instanceRoot);
|
|
282
301
|
return;
|
|
283
302
|
}
|
|
284
303
|
case "enable": {
|
|
@@ -287,7 +306,7 @@ async function cmdPlugin(args2 = []) {
|
|
|
287
306
|
console.error("Error: missing plugin name. Usage: openacp plugin enable <name>");
|
|
288
307
|
process.exit(1);
|
|
289
308
|
}
|
|
290
|
-
await setPluginEnabled(name, true);
|
|
309
|
+
await setPluginEnabled(name, true, instanceRoot);
|
|
291
310
|
return;
|
|
292
311
|
}
|
|
293
312
|
case "disable": {
|
|
@@ -296,7 +315,7 @@ async function cmdPlugin(args2 = []) {
|
|
|
296
315
|
console.error("Error: missing plugin name. Usage: openacp plugin disable <name>");
|
|
297
316
|
process.exit(1);
|
|
298
317
|
}
|
|
299
|
-
await setPluginEnabled(name, false);
|
|
318
|
+
await setPluginEnabled(name, false, instanceRoot);
|
|
300
319
|
return;
|
|
301
320
|
}
|
|
302
321
|
case "configure": {
|
|
@@ -305,11 +324,11 @@ async function cmdPlugin(args2 = []) {
|
|
|
305
324
|
console.error("Error: missing plugin name. Usage: openacp plugin configure <name>");
|
|
306
325
|
process.exit(1);
|
|
307
326
|
}
|
|
308
|
-
await configurePlugin(name);
|
|
327
|
+
await configurePlugin(name, instanceRoot);
|
|
309
328
|
return;
|
|
310
329
|
}
|
|
311
330
|
case "create": {
|
|
312
|
-
const { cmdPluginCreate } = await import("./plugin-create-
|
|
331
|
+
const { cmdPluginCreate } = await import("./plugin-create-HFKS23JY.js");
|
|
313
332
|
await cmdPluginCreate();
|
|
314
333
|
return;
|
|
315
334
|
}
|
|
@@ -319,11 +338,12 @@ async function cmdPlugin(args2 = []) {
|
|
|
319
338
|
process.exit(1);
|
|
320
339
|
}
|
|
321
340
|
}
|
|
322
|
-
async function setPluginEnabled(name, enabled) {
|
|
323
|
-
const
|
|
324
|
-
const
|
|
341
|
+
async function setPluginEnabled(name, enabled, instanceRoot) {
|
|
342
|
+
const os7 = await import("os");
|
|
343
|
+
const path10 = await import("path");
|
|
325
344
|
const { PluginRegistry } = await import("./plugin-registry-6J3YSFHF.js");
|
|
326
|
-
const
|
|
345
|
+
const root2 = instanceRoot ?? path10.join(os7.homedir(), ".openacp");
|
|
346
|
+
const registryPath = path10.join(root2, "plugins.json");
|
|
327
347
|
const registry = new PluginRegistry(registryPath);
|
|
328
348
|
await registry.load();
|
|
329
349
|
const entry = registry.get(name);
|
|
@@ -335,18 +355,19 @@ async function setPluginEnabled(name, enabled) {
|
|
|
335
355
|
await registry.save();
|
|
336
356
|
console.log(`Plugin ${name} ${enabled ? "enabled" : "disabled"}. Restart to apply.`);
|
|
337
357
|
}
|
|
338
|
-
async function configurePlugin(name) {
|
|
339
|
-
const
|
|
340
|
-
const
|
|
341
|
-
const { corePlugins } = await import("./core-plugins-
|
|
358
|
+
async function configurePlugin(name, instanceRoot) {
|
|
359
|
+
const os7 = await import("os");
|
|
360
|
+
const path10 = await import("path");
|
|
361
|
+
const { corePlugins } = await import("./core-plugins-JSY2I44L.js");
|
|
342
362
|
const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
|
|
343
|
-
const { createInstallContext } = await import("./install-context-
|
|
363
|
+
const { createInstallContext } = await import("./install-context-KZO5FR4D.js");
|
|
344
364
|
const plugin = corePlugins.find((p) => p.name === name);
|
|
345
365
|
if (!plugin) {
|
|
346
366
|
console.error(`Plugin "${name}" not found.`);
|
|
347
367
|
process.exit(1);
|
|
348
368
|
}
|
|
349
|
-
const
|
|
369
|
+
const root2 = instanceRoot ?? path10.join(os7.homedir(), ".openacp");
|
|
370
|
+
const basePath = path10.join(root2, "plugins", "data");
|
|
350
371
|
const settingsManager = new SettingsManager(basePath);
|
|
351
372
|
const ctx = createInstallContext({ pluginName: name, settingsManager, basePath });
|
|
352
373
|
if (plugin.configure) {
|
|
@@ -357,14 +378,15 @@ async function configurePlugin(name) {
|
|
|
357
378
|
console.log(`Plugin ${name} has no configure or install hook.`);
|
|
358
379
|
}
|
|
359
380
|
}
|
|
360
|
-
async function installPlugin(input) {
|
|
361
|
-
const
|
|
362
|
-
const
|
|
381
|
+
async function installPlugin(input, instanceRoot) {
|
|
382
|
+
const os7 = await import("os");
|
|
383
|
+
const path10 = await import("path");
|
|
363
384
|
const { execFileSync } = await import("child_process");
|
|
364
385
|
const { getCurrentVersion: getCurrentVersion2 } = await import("./version-AXXV6IV2.js");
|
|
365
386
|
const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
|
|
366
|
-
const { createInstallContext } = await import("./install-context-
|
|
387
|
+
const { createInstallContext } = await import("./install-context-KZO5FR4D.js");
|
|
367
388
|
const { PluginRegistry } = await import("./plugin-registry-6J3YSFHF.js");
|
|
389
|
+
const root2 = instanceRoot ?? path10.join(os7.homedir(), ".openacp");
|
|
368
390
|
let pkgName;
|
|
369
391
|
let pkgVersion;
|
|
370
392
|
if (input.startsWith("@")) {
|
|
@@ -407,11 +429,11 @@ async function installPlugin(input) {
|
|
|
407
429
|
}
|
|
408
430
|
const installSpec = pkgVersion ? `${pkgName}@${pkgVersion}` : pkgName;
|
|
409
431
|
console.log(`Installing ${installSpec}...`);
|
|
410
|
-
const { corePlugins } = await import("./core-plugins-
|
|
432
|
+
const { corePlugins } = await import("./core-plugins-JSY2I44L.js");
|
|
411
433
|
const builtinPlugin = corePlugins.find((p) => p.name === pkgName);
|
|
412
|
-
const basePath =
|
|
434
|
+
const basePath = path10.join(root2, "plugins", "data");
|
|
413
435
|
const settingsManager = new SettingsManager(basePath);
|
|
414
|
-
const registryPath =
|
|
436
|
+
const registryPath = path10.join(root2, "plugins.json");
|
|
415
437
|
const pluginRegistry = new PluginRegistry(registryPath);
|
|
416
438
|
await pluginRegistry.load();
|
|
417
439
|
if (builtinPlugin) {
|
|
@@ -430,8 +452,8 @@ async function installPlugin(input) {
|
|
|
430
452
|
console.log(`\u2713 ${builtinPlugin.name} installed! Restart to activate.`);
|
|
431
453
|
return;
|
|
432
454
|
}
|
|
433
|
-
const pluginsDir =
|
|
434
|
-
const nodeModulesDir =
|
|
455
|
+
const pluginsDir = path10.join(root2, "plugins");
|
|
456
|
+
const nodeModulesDir = path10.join(pluginsDir, "node_modules");
|
|
435
457
|
try {
|
|
436
458
|
execFileSync("npm", ["install", installSpec, "--prefix", pluginsDir, "--save"], {
|
|
437
459
|
stdio: "inherit",
|
|
@@ -444,8 +466,8 @@ async function installPlugin(input) {
|
|
|
444
466
|
const cliVersion = getCurrentVersion2();
|
|
445
467
|
const isLocalPath = pkgName.startsWith("/") || pkgName.startsWith(".");
|
|
446
468
|
try {
|
|
447
|
-
const pluginRoot = isLocalPath ?
|
|
448
|
-
const installedPkgPath =
|
|
469
|
+
const pluginRoot = isLocalPath ? path10.resolve(pkgName) : path10.join(nodeModulesDir, pkgName);
|
|
470
|
+
const installedPkgPath = path10.join(pluginRoot, "package.json");
|
|
449
471
|
const { readFileSync } = await import("fs");
|
|
450
472
|
const installedPkg = JSON.parse(readFileSync(installedPkgPath, "utf-8"));
|
|
451
473
|
const minVersion = installedPkg.engines?.openacp?.replace(/[>=^~\s]/g, "");
|
|
@@ -458,7 +480,7 @@ async function installPlugin(input) {
|
|
|
458
480
|
`);
|
|
459
481
|
}
|
|
460
482
|
}
|
|
461
|
-
const pluginModule = await import(
|
|
483
|
+
const pluginModule = await import(path10.join(pluginRoot, installedPkg.main ?? "dist/index.js"));
|
|
462
484
|
const plugin = pluginModule.default;
|
|
463
485
|
if (plugin?.install) {
|
|
464
486
|
const ctx = createInstallContext({ pluginName: plugin.name ?? pkgName, settingsManager, basePath });
|
|
@@ -484,12 +506,13 @@ async function installPlugin(input) {
|
|
|
484
506
|
console.log(`\u2713 ${pkgName} installed (npm only). Restart to activate.`);
|
|
485
507
|
}
|
|
486
508
|
}
|
|
487
|
-
async function uninstallPlugin(name, purge) {
|
|
488
|
-
const
|
|
489
|
-
const
|
|
490
|
-
const
|
|
509
|
+
async function uninstallPlugin(name, purge, instanceRoot) {
|
|
510
|
+
const os7 = await import("os");
|
|
511
|
+
const path10 = await import("path");
|
|
512
|
+
const fs5 = await import("fs");
|
|
491
513
|
const { PluginRegistry } = await import("./plugin-registry-6J3YSFHF.js");
|
|
492
|
-
const
|
|
514
|
+
const root2 = instanceRoot ?? path10.join(os7.homedir(), ".openacp");
|
|
515
|
+
const registryPath = path10.join(root2, "plugins.json");
|
|
493
516
|
const registry = new PluginRegistry(registryPath);
|
|
494
517
|
await registry.load();
|
|
495
518
|
const entry = registry.get(name);
|
|
@@ -502,12 +525,12 @@ async function uninstallPlugin(name, purge) {
|
|
|
502
525
|
process.exit(1);
|
|
503
526
|
}
|
|
504
527
|
try {
|
|
505
|
-
const { corePlugins } = await import("./core-plugins-
|
|
528
|
+
const { corePlugins } = await import("./core-plugins-JSY2I44L.js");
|
|
506
529
|
const plugin = corePlugins.find((p) => p.name === name);
|
|
507
530
|
if (plugin?.uninstall) {
|
|
508
531
|
const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
|
|
509
|
-
const { createInstallContext } = await import("./install-context-
|
|
510
|
-
const basePath =
|
|
532
|
+
const { createInstallContext } = await import("./install-context-KZO5FR4D.js");
|
|
533
|
+
const basePath = path10.join(root2, "plugins", "data");
|
|
511
534
|
const settingsManager = new SettingsManager(basePath);
|
|
512
535
|
const ctx = createInstallContext({ pluginName: name, settingsManager, basePath });
|
|
513
536
|
await plugin.uninstall(ctx, { purge });
|
|
@@ -515,8 +538,8 @@ async function uninstallPlugin(name, purge) {
|
|
|
515
538
|
} catch {
|
|
516
539
|
}
|
|
517
540
|
if (purge) {
|
|
518
|
-
const pluginDir =
|
|
519
|
-
|
|
541
|
+
const pluginDir = path10.join(root2, "plugins", name);
|
|
542
|
+
fs5.rmSync(pluginDir, { recursive: true, force: true });
|
|
520
543
|
}
|
|
521
544
|
registry.remove(name);
|
|
522
545
|
await registry.save();
|
|
@@ -1121,7 +1144,10 @@ Shows the version of the currently running daemon process.
|
|
|
1121
1144
|
}
|
|
1122
1145
|
|
|
1123
1146
|
// src/cli/commands/start.ts
|
|
1124
|
-
|
|
1147
|
+
import path3 from "path";
|
|
1148
|
+
import os3 from "os";
|
|
1149
|
+
async function cmdStart(args2 = [], instanceRoot) {
|
|
1150
|
+
const root2 = instanceRoot ?? path3.join(os3.homedir(), ".openacp");
|
|
1125
1151
|
if (wantsHelp(args2)) {
|
|
1126
1152
|
console.log(`
|
|
1127
1153
|
\x1B[1mopenacp start\x1B[0m \u2014 Start OpenACP as a background daemon
|
|
@@ -1140,13 +1166,13 @@ Requires an existing config \u2014 run 'openacp' first to set up.
|
|
|
1140
1166
|
return;
|
|
1141
1167
|
}
|
|
1142
1168
|
await checkAndPromptUpdate();
|
|
1143
|
-
const { startDaemon, getPidPath } = await import("./daemon-
|
|
1144
|
-
const { ConfigManager } = await import("./config-
|
|
1169
|
+
const { startDaemon, getPidPath } = await import("./daemon-UOSRDEXW.js");
|
|
1170
|
+
const { ConfigManager } = await import("./config-X4UP7H6R.js");
|
|
1145
1171
|
const cm = new ConfigManager();
|
|
1146
1172
|
if (await cm.exists()) {
|
|
1147
1173
|
await cm.load();
|
|
1148
1174
|
const config = cm.get();
|
|
1149
|
-
const result = startDaemon(getPidPath(), config.logging.logDir);
|
|
1175
|
+
const result = startDaemon(getPidPath(root2), config.logging.logDir, root2);
|
|
1150
1176
|
if ("error" in result) {
|
|
1151
1177
|
console.error(result.error);
|
|
1152
1178
|
process.exit(1);
|
|
@@ -1159,7 +1185,10 @@ Requires an existing config \u2014 run 'openacp' first to set up.
|
|
|
1159
1185
|
}
|
|
1160
1186
|
|
|
1161
1187
|
// src/cli/commands/stop.ts
|
|
1162
|
-
|
|
1188
|
+
import path4 from "path";
|
|
1189
|
+
import os4 from "os";
|
|
1190
|
+
async function cmdStop(args2 = [], instanceRoot) {
|
|
1191
|
+
const root2 = instanceRoot ?? path4.join(os4.homedir(), ".openacp");
|
|
1163
1192
|
if (wantsHelp(args2)) {
|
|
1164
1193
|
console.log(`
|
|
1165
1194
|
\x1B[1mopenacp stop\x1B[0m \u2014 Stop the background daemon
|
|
@@ -1171,8 +1200,8 @@ Sends a stop signal to the running OpenACP daemon process.
|
|
|
1171
1200
|
`);
|
|
1172
1201
|
return;
|
|
1173
1202
|
}
|
|
1174
|
-
const { stopDaemon } = await import("./daemon-
|
|
1175
|
-
const result = await stopDaemon();
|
|
1203
|
+
const { stopDaemon, getPidPath } = await import("./daemon-UOSRDEXW.js");
|
|
1204
|
+
const result = await stopDaemon(getPidPath(root2), root2);
|
|
1176
1205
|
if (result.stopped) {
|
|
1177
1206
|
console.log(`OpenACP daemon stopped (was PID ${result.pid})`);
|
|
1178
1207
|
} else {
|
|
@@ -1182,25 +1211,116 @@ Sends a stop signal to the running OpenACP daemon process.
|
|
|
1182
1211
|
}
|
|
1183
1212
|
|
|
1184
1213
|
// src/cli/commands/status.ts
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
openacp status
|
|
1192
|
-
|
|
1193
|
-
Shows whether the OpenACP daemon is running and its PID.
|
|
1194
|
-
`);
|
|
1214
|
+
import fs3 from "fs";
|
|
1215
|
+
import path5 from "path";
|
|
1216
|
+
import os5 from "os";
|
|
1217
|
+
async function cmdStatus(args2 = [], instanceRoot) {
|
|
1218
|
+
if (args2.includes("--all")) {
|
|
1219
|
+
await showAllInstances();
|
|
1195
1220
|
return;
|
|
1196
1221
|
}
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1222
|
+
const idIdx = args2.indexOf("--id");
|
|
1223
|
+
if (idIdx !== -1 && args2[idIdx + 1]) {
|
|
1224
|
+
await showInstanceById(args2[idIdx + 1]);
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
const root2 = instanceRoot ?? getGlobalRoot();
|
|
1228
|
+
await showSingleInstance(root2);
|
|
1229
|
+
}
|
|
1230
|
+
async function showAllInstances() {
|
|
1231
|
+
const registryPath = path5.join(getGlobalRoot(), "instances.json");
|
|
1232
|
+
const registry = new InstanceRegistry(registryPath);
|
|
1233
|
+
await registry.load();
|
|
1234
|
+
const instances = registry.list();
|
|
1235
|
+
if (instances.length === 0) {
|
|
1236
|
+
console.log("No instances registered.");
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
console.log("");
|
|
1240
|
+
console.log(" Status ID Name Directory Mode Channels API Tunnel");
|
|
1241
|
+
console.log(" " + "\u2500".repeat(100));
|
|
1242
|
+
for (const entry of instances) {
|
|
1243
|
+
const info = readInstanceInfo(entry.root);
|
|
1244
|
+
const status = info.pid ? "\u25CF online" : "\u25CB offline";
|
|
1245
|
+
const mode = info.pid ? info.runMode === "daemon" ? "daemon" : "fg" : "\u2014";
|
|
1246
|
+
const api = info.apiPort ? String(info.apiPort) : "\u2014";
|
|
1247
|
+
const tunnel = info.tunnelPort ? String(info.tunnelPort) : "\u2014";
|
|
1248
|
+
const dir = entry.root.replace(/\/.openacp$/, "").replace(os5.homedir(), "~");
|
|
1249
|
+
const channels = info.channels.join(", ") || "\u2014";
|
|
1250
|
+
const name = info.name ?? entry.id;
|
|
1251
|
+
console.log(` ${status.padEnd(10)} ${entry.id.padEnd(16)} ${name.padEnd(16)} ${dir.padEnd(20)} ${mode.padEnd(8)} ${channels.padEnd(10)} ${api.padEnd(6)} ${tunnel}`);
|
|
1252
|
+
}
|
|
1253
|
+
console.log("");
|
|
1254
|
+
}
|
|
1255
|
+
async function showInstanceById(id) {
|
|
1256
|
+
const registryPath = path5.join(getGlobalRoot(), "instances.json");
|
|
1257
|
+
const registry = new InstanceRegistry(registryPath);
|
|
1258
|
+
await registry.load();
|
|
1259
|
+
const entry = registry.get(id);
|
|
1260
|
+
if (!entry) {
|
|
1261
|
+
console.error(`Instance "${id}" not found.`);
|
|
1262
|
+
process.exit(1);
|
|
1263
|
+
}
|
|
1264
|
+
await showSingleInstance(entry.root);
|
|
1265
|
+
}
|
|
1266
|
+
async function showSingleInstance(root2) {
|
|
1267
|
+
const info = readInstanceInfo(root2);
|
|
1268
|
+
if (info.pid) {
|
|
1269
|
+
console.log(`OpenACP is running (PID ${info.pid})`);
|
|
1270
|
+
if (info.name) console.log(` Name: ${info.name}`);
|
|
1271
|
+
if (info.apiPort) console.log(` API: port ${info.apiPort}`);
|
|
1272
|
+
if (info.tunnelPort) console.log(` Tunnel: port ${info.tunnelPort}`);
|
|
1273
|
+
if (info.channels.length > 0) console.log(` Channels: ${info.channels.join(", ")}`);
|
|
1201
1274
|
} else {
|
|
1202
|
-
console.log("OpenACP is not running");
|
|
1275
|
+
console.log("OpenACP is not running.");
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
function readInstanceInfo(root2) {
|
|
1279
|
+
const result = {
|
|
1280
|
+
name: null,
|
|
1281
|
+
pid: null,
|
|
1282
|
+
apiPort: null,
|
|
1283
|
+
tunnelPort: null,
|
|
1284
|
+
runMode: null,
|
|
1285
|
+
channels: []
|
|
1286
|
+
};
|
|
1287
|
+
try {
|
|
1288
|
+
const config = JSON.parse(fs3.readFileSync(path5.join(root2, "config.json"), "utf-8"));
|
|
1289
|
+
result.name = config.instanceName ?? null;
|
|
1290
|
+
result.runMode = config.runMode ?? null;
|
|
1291
|
+
} catch {
|
|
1203
1292
|
}
|
|
1293
|
+
try {
|
|
1294
|
+
const pid = parseInt(fs3.readFileSync(path5.join(root2, "openacp.pid"), "utf-8").trim());
|
|
1295
|
+
if (!isNaN(pid)) {
|
|
1296
|
+
process.kill(pid, 0);
|
|
1297
|
+
result.pid = pid;
|
|
1298
|
+
}
|
|
1299
|
+
} catch {
|
|
1300
|
+
}
|
|
1301
|
+
try {
|
|
1302
|
+
const port = parseInt(fs3.readFileSync(path5.join(root2, "api.port"), "utf-8").trim());
|
|
1303
|
+
if (!isNaN(port)) result.apiPort = port;
|
|
1304
|
+
} catch {
|
|
1305
|
+
}
|
|
1306
|
+
try {
|
|
1307
|
+
const tunnels = JSON.parse(fs3.readFileSync(path5.join(root2, "tunnels.json"), "utf-8"));
|
|
1308
|
+
const entries = Object.values(tunnels);
|
|
1309
|
+
const systemEntry = entries.find((t) => t.type === "system");
|
|
1310
|
+
if (systemEntry?.port) result.tunnelPort = systemEntry.port;
|
|
1311
|
+
} catch {
|
|
1312
|
+
}
|
|
1313
|
+
try {
|
|
1314
|
+
const plugins = JSON.parse(fs3.readFileSync(path5.join(root2, "plugins.json"), "utf-8"));
|
|
1315
|
+
const adapters = ["@openacp/telegram", "@openacp/discord", "@openacp/slack"];
|
|
1316
|
+
for (const name of adapters) {
|
|
1317
|
+
if (plugins.installed?.[name] && plugins.installed[name].enabled !== false) {
|
|
1318
|
+
result.channels.push(name.replace("@openacp/", ""));
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
} catch {
|
|
1322
|
+
}
|
|
1323
|
+
return result;
|
|
1204
1324
|
}
|
|
1205
1325
|
|
|
1206
1326
|
// src/cli/commands/logs.ts
|
|
@@ -1220,7 +1340,7 @@ Log file location is configured in config (default: ~/.openacp/logs/).
|
|
|
1220
1340
|
return;
|
|
1221
1341
|
}
|
|
1222
1342
|
const { spawn } = await import("child_process");
|
|
1223
|
-
const { ConfigManager, expandHome } = await import("./config-
|
|
1343
|
+
const { ConfigManager, expandHome } = await import("./config-X4UP7H6R.js");
|
|
1224
1344
|
const pathMod = await import("path");
|
|
1225
1345
|
const cm = new ConfigManager();
|
|
1226
1346
|
let logDir = "~/.openacp/logs";
|
|
@@ -1292,7 +1412,7 @@ the API for live updates. When stopped, edits config file directly.
|
|
|
1292
1412
|
console.error("Usage: openacp config set <path> <value>");
|
|
1293
1413
|
process.exit(1);
|
|
1294
1414
|
}
|
|
1295
|
-
const { ConfigSchema } = await import("./config-
|
|
1415
|
+
const { ConfigSchema } = await import("./config-X4UP7H6R.js");
|
|
1296
1416
|
const topLevelKey = configPath.split(".")[0];
|
|
1297
1417
|
const validConfigKeys = Object.keys(ConfigSchema.shape);
|
|
1298
1418
|
if (!validConfigKeys.includes(topLevelKey)) {
|
|
@@ -1324,7 +1444,7 @@ the API for live updates. When stopped, edits config file directly.
|
|
|
1324
1444
|
console.log("Note: restart required for this change to take effect.");
|
|
1325
1445
|
}
|
|
1326
1446
|
} else {
|
|
1327
|
-
const { ConfigManager: ConfigManager2 } = await import("./config-
|
|
1447
|
+
const { ConfigManager: ConfigManager2 } = await import("./config-X4UP7H6R.js");
|
|
1328
1448
|
const cm2 = new ConfigManager2();
|
|
1329
1449
|
if (!await cm2.exists()) {
|
|
1330
1450
|
console.error('No config found. Run "openacp" first to set up.');
|
|
@@ -1337,8 +1457,8 @@ the API for live updates. When stopped, edits config file directly.
|
|
|
1337
1457
|
}
|
|
1338
1458
|
return;
|
|
1339
1459
|
}
|
|
1340
|
-
const { runConfigEditor } = await import("./config-editor-
|
|
1341
|
-
const { ConfigManager } = await import("./config-
|
|
1460
|
+
const { runConfigEditor } = await import("./config-editor-7BENRVG5.js");
|
|
1461
|
+
const { ConfigManager } = await import("./config-X4UP7H6R.js");
|
|
1342
1462
|
const cm = new ConfigManager();
|
|
1343
1463
|
if (!await cm.exists()) {
|
|
1344
1464
|
console.error('No config found. Run "openacp" first to set up.');
|
|
@@ -1353,7 +1473,7 @@ the API for live updates. When stopped, edits config file directly.
|
|
|
1353
1473
|
}
|
|
1354
1474
|
|
|
1355
1475
|
// src/cli/commands/reset.ts
|
|
1356
|
-
async function cmdReset(args2 = []) {
|
|
1476
|
+
async function cmdReset(args2 = [], instanceRoot) {
|
|
1357
1477
|
if (wantsHelp(args2)) {
|
|
1358
1478
|
console.log(`
|
|
1359
1479
|
\x1B[1mopenacp reset\x1B[0m \u2014 Re-run setup wizard
|
|
@@ -1368,8 +1488,11 @@ start fresh with the setup wizard. The daemon must be stopped first.
|
|
|
1368
1488
|
`);
|
|
1369
1489
|
return;
|
|
1370
1490
|
}
|
|
1371
|
-
const
|
|
1372
|
-
const
|
|
1491
|
+
const os7 = await import("os");
|
|
1492
|
+
const path10 = await import("path");
|
|
1493
|
+
const root2 = instanceRoot ?? path10.join(os7.homedir(), ".openacp");
|
|
1494
|
+
const { getStatus, getPidPath } = await import("./daemon-UOSRDEXW.js");
|
|
1495
|
+
const status = getStatus(getPidPath(root2));
|
|
1373
1496
|
if (status.running) {
|
|
1374
1497
|
console.error("OpenACP is running. Stop it first: openacp stop");
|
|
1375
1498
|
process.exit(1);
|
|
@@ -1385,11 +1508,8 @@ start fresh with the setup wizard. The daemon must be stopped first.
|
|
|
1385
1508
|
}
|
|
1386
1509
|
const { uninstallAutoStart } = await import("./autostart-CUPZMKKC.js");
|
|
1387
1510
|
uninstallAutoStart();
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
const path5 = await import("path");
|
|
1391
|
-
const openacpDir = path5.join(os2.homedir(), ".openacp");
|
|
1392
|
-
fs4.rmSync(openacpDir, { recursive: true, force: true });
|
|
1511
|
+
const fs5 = await import("fs");
|
|
1512
|
+
fs5.rmSync(root2, { recursive: true, force: true });
|
|
1393
1513
|
console.log("Reset complete. Run `openacp` to set up again.");
|
|
1394
1514
|
}
|
|
1395
1515
|
|
|
@@ -1472,7 +1592,7 @@ as a messaging thread. Requires a running daemon.
|
|
|
1472
1592
|
process.exit(1);
|
|
1473
1593
|
}
|
|
1474
1594
|
try {
|
|
1475
|
-
const { apiCall: apiCall2 } = await import("./api-client-
|
|
1595
|
+
const { apiCall: apiCall2 } = await import("./api-client-PEMHYL5U.js");
|
|
1476
1596
|
const res = await apiCall2(port, "/api/sessions/adopt", {
|
|
1477
1597
|
method: "POST",
|
|
1478
1598
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1600,7 +1720,7 @@ Fixable issues can be auto-repaired when not using --dry-run.
|
|
|
1600
1720
|
process.exit(1);
|
|
1601
1721
|
}
|
|
1602
1722
|
const dryRun = args2.includes("--dry-run");
|
|
1603
|
-
const { DoctorEngine } = await import("./doctor-
|
|
1723
|
+
const { DoctorEngine } = await import("./doctor-6DLACBR4.js");
|
|
1604
1724
|
const engine = new DoctorEngine({ dryRun });
|
|
1605
1725
|
console.log("\n\u{1FA7A} OpenACP Doctor\n");
|
|
1606
1726
|
const report = await engine.runAll();
|
|
@@ -1710,7 +1830,7 @@ Run 'openacp agents' to see available agents.`);
|
|
|
1710
1830
|
}
|
|
1711
1831
|
}
|
|
1712
1832
|
async function agentsList() {
|
|
1713
|
-
const { AgentCatalog } = await import("./agent-catalog-
|
|
1833
|
+
const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
|
|
1714
1834
|
const catalog = new AgentCatalog();
|
|
1715
1835
|
catalog.load();
|
|
1716
1836
|
await catalog.refreshRegistryIfStale();
|
|
@@ -1773,7 +1893,7 @@ Run 'openacp agents' to see available agents.
|
|
|
1773
1893
|
`);
|
|
1774
1894
|
return;
|
|
1775
1895
|
}
|
|
1776
|
-
const { AgentCatalog } = await import("./agent-catalog-
|
|
1896
|
+
const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
|
|
1777
1897
|
const catalog = new AgentCatalog();
|
|
1778
1898
|
catalog.load();
|
|
1779
1899
|
await catalog.refreshRegistryIfStale();
|
|
@@ -1852,7 +1972,7 @@ async function agentsUninstall(name, help = false) {
|
|
|
1852
1972
|
`);
|
|
1853
1973
|
return;
|
|
1854
1974
|
}
|
|
1855
|
-
const { AgentCatalog } = await import("./agent-catalog-
|
|
1975
|
+
const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
|
|
1856
1976
|
const catalog = new AgentCatalog();
|
|
1857
1977
|
catalog.load();
|
|
1858
1978
|
const result = await catalog.uninstall(name);
|
|
@@ -1880,7 +2000,7 @@ async function agentsUninstall(name, help = false) {
|
|
|
1880
2000
|
}
|
|
1881
2001
|
}
|
|
1882
2002
|
async function agentsRefresh() {
|
|
1883
|
-
const { AgentCatalog } = await import("./agent-catalog-
|
|
2003
|
+
const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
|
|
1884
2004
|
const catalog = new AgentCatalog();
|
|
1885
2005
|
catalog.load();
|
|
1886
2006
|
console.log("\n Updating agent list...");
|
|
@@ -1907,7 +2027,7 @@ whether the agent is installed or available from the registry.
|
|
|
1907
2027
|
`);
|
|
1908
2028
|
return;
|
|
1909
2029
|
}
|
|
1910
|
-
const { AgentCatalog } = await import("./agent-catalog-
|
|
2030
|
+
const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
|
|
1911
2031
|
const catalog = new AgentCatalog();
|
|
1912
2032
|
catalog.load();
|
|
1913
2033
|
const { getAgentSetup } = await import("./agent-dependencies-ED2ZTUHG.js");
|
|
@@ -1988,7 +2108,7 @@ ACP-specific flags are automatically stripped.
|
|
|
1988
2108
|
`);
|
|
1989
2109
|
return;
|
|
1990
2110
|
}
|
|
1991
|
-
const { AgentCatalog } = await import("./agent-catalog-
|
|
2111
|
+
const { AgentCatalog } = await import("./agent-catalog-UYD26QDK.js");
|
|
1992
2112
|
const catalog = new AgentCatalog();
|
|
1993
2113
|
catalog.load();
|
|
1994
2114
|
const installed = catalog.getInstalledAgent(nameOrId);
|
|
@@ -2121,30 +2241,35 @@ Tunnel Management:
|
|
|
2121
2241
|
}
|
|
2122
2242
|
|
|
2123
2243
|
// src/cli/commands/onboard.ts
|
|
2244
|
+
import * as path6 from "path";
|
|
2124
2245
|
async function cmdOnboard() {
|
|
2125
|
-
const { ConfigManager
|
|
2246
|
+
const { ConfigManager } = await import("./config-X4UP7H6R.js");
|
|
2126
2247
|
const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
|
|
2127
2248
|
const { PluginRegistry } = await import("./plugin-registry-6J3YSFHF.js");
|
|
2249
|
+
const { getGlobalRoot: getGlobalRoot2 } = await import("./instance-context-FLCE7VZ4.js");
|
|
2250
|
+
const OPENACP_DIR = getGlobalRoot2();
|
|
2251
|
+
const PLUGINS_DATA_DIR = path6.join(OPENACP_DIR, "plugins", "data");
|
|
2252
|
+
const REGISTRY_PATH = path6.join(OPENACP_DIR, "plugins.json");
|
|
2128
2253
|
const cm = new ConfigManager();
|
|
2129
|
-
const settingsManager = new SettingsManager(
|
|
2130
|
-
const pluginRegistry = new PluginRegistry(
|
|
2254
|
+
const settingsManager = new SettingsManager(PLUGINS_DATA_DIR);
|
|
2255
|
+
const pluginRegistry = new PluginRegistry(REGISTRY_PATH);
|
|
2131
2256
|
await pluginRegistry.load();
|
|
2132
2257
|
if (await cm.exists()) {
|
|
2133
|
-
const { runReconfigure } = await import("./setup-
|
|
2258
|
+
const { runReconfigure } = await import("./setup-44WLBIOT.js");
|
|
2134
2259
|
await runReconfigure(cm);
|
|
2135
2260
|
} else {
|
|
2136
|
-
const { runSetup } = await import("./setup-
|
|
2261
|
+
const { runSetup } = await import("./setup-44WLBIOT.js");
|
|
2137
2262
|
await runSetup(cm, { skipRunMode: true, settingsManager, pluginRegistry });
|
|
2138
2263
|
}
|
|
2139
2264
|
}
|
|
2140
2265
|
|
|
2141
2266
|
// src/cli/commands/default.ts
|
|
2142
|
-
import
|
|
2143
|
-
import
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2267
|
+
import path7 from "path";
|
|
2268
|
+
import os6 from "os";
|
|
2269
|
+
async function cmdDefault(command2, instanceRoot) {
|
|
2270
|
+
const root2 = instanceRoot ?? path7.join(os6.homedir(), ".openacp");
|
|
2271
|
+
const pluginsDataDir = path7.join(root2, "plugins", "data");
|
|
2272
|
+
const registryPath = path7.join(root2, "plugins.json");
|
|
2148
2273
|
const forceForeground = command2 === "--foreground";
|
|
2149
2274
|
if (command2 && !command2.startsWith("-")) {
|
|
2150
2275
|
const { suggestMatch } = await import("./suggest-RST5VOHB.js");
|
|
@@ -2174,23 +2299,23 @@ async function cmdDefault(command2) {
|
|
|
2174
2299
|
process.exit(1);
|
|
2175
2300
|
}
|
|
2176
2301
|
await checkAndPromptUpdate();
|
|
2177
|
-
const { ConfigManager } = await import("./config-
|
|
2302
|
+
const { ConfigManager } = await import("./config-X4UP7H6R.js");
|
|
2178
2303
|
const cm = new ConfigManager();
|
|
2179
2304
|
if (!await cm.exists()) {
|
|
2180
2305
|
const { SettingsManager } = await import("./settings-manager-B4UN2LAC.js");
|
|
2181
2306
|
const { PluginRegistry } = await import("./plugin-registry-6J3YSFHF.js");
|
|
2182
|
-
const settingsManager = new SettingsManager(
|
|
2183
|
-
const pluginRegistry = new PluginRegistry(
|
|
2307
|
+
const settingsManager = new SettingsManager(pluginsDataDir);
|
|
2308
|
+
const pluginRegistry = new PluginRegistry(registryPath);
|
|
2184
2309
|
await pluginRegistry.load();
|
|
2185
|
-
const { runSetup } = await import("./setup-
|
|
2310
|
+
const { runSetup } = await import("./setup-44WLBIOT.js");
|
|
2186
2311
|
const shouldStart = await runSetup(cm, { settingsManager, pluginRegistry });
|
|
2187
2312
|
if (!shouldStart) process.exit(0);
|
|
2188
2313
|
}
|
|
2189
2314
|
await cm.load();
|
|
2190
2315
|
const config = cm.get();
|
|
2191
2316
|
if (!forceForeground && config.runMode === "daemon") {
|
|
2192
|
-
const { startDaemon, getPidPath } = await import("./daemon-
|
|
2193
|
-
const result = startDaemon(getPidPath(), config.logging.logDir);
|
|
2317
|
+
const { startDaemon, getPidPath } = await import("./daemon-UOSRDEXW.js");
|
|
2318
|
+
const result = startDaemon(getPidPath(root2), config.logging.logDir, root2);
|
|
2194
2319
|
if ("error" in result) {
|
|
2195
2320
|
console.error(result.error);
|
|
2196
2321
|
process.exit(1);
|
|
@@ -2198,15 +2323,20 @@ async function cmdDefault(command2) {
|
|
|
2198
2323
|
console.log(`OpenACP daemon started (PID ${result.pid})`);
|
|
2199
2324
|
return;
|
|
2200
2325
|
}
|
|
2201
|
-
const { markRunning } = await import("./daemon-
|
|
2202
|
-
markRunning();
|
|
2203
|
-
const { startServer } = await import("./main-
|
|
2204
|
-
|
|
2326
|
+
const { markRunning } = await import("./daemon-UOSRDEXW.js");
|
|
2327
|
+
markRunning(root2);
|
|
2328
|
+
const { startServer } = await import("./main-D7M2AKRM.js");
|
|
2329
|
+
const ctx = createInstanceContext({
|
|
2330
|
+
id: "default",
|
|
2331
|
+
root: root2,
|
|
2332
|
+
isGlobal: root2 === getGlobalRoot()
|
|
2333
|
+
});
|
|
2334
|
+
await startServer({ instanceContext: ctx });
|
|
2205
2335
|
}
|
|
2206
2336
|
|
|
2207
2337
|
// src/cli/commands/dev.ts
|
|
2208
|
-
import
|
|
2209
|
-
import
|
|
2338
|
+
import fs4 from "fs";
|
|
2339
|
+
import path8 from "path";
|
|
2210
2340
|
async function cmdDev(args2 = []) {
|
|
2211
2341
|
if (wantsHelp(args2)) {
|
|
2212
2342
|
console.log(`
|
|
@@ -2233,13 +2363,13 @@ async function cmdDev(args2 = []) {
|
|
|
2233
2363
|
console.error("Error: missing plugin path. Usage: openacp dev <plugin-path>");
|
|
2234
2364
|
process.exit(1);
|
|
2235
2365
|
}
|
|
2236
|
-
const pluginPath =
|
|
2237
|
-
if (!
|
|
2366
|
+
const pluginPath = path8.resolve(pluginPathArg);
|
|
2367
|
+
if (!fs4.existsSync(pluginPath)) {
|
|
2238
2368
|
console.error(`Error: plugin path does not exist: ${pluginPath}`);
|
|
2239
2369
|
process.exit(1);
|
|
2240
2370
|
}
|
|
2241
|
-
const tsconfigPath =
|
|
2242
|
-
const hasTsconfig =
|
|
2371
|
+
const tsconfigPath = path8.join(pluginPath, "tsconfig.json");
|
|
2372
|
+
const hasTsconfig = fs4.existsSync(tsconfigPath);
|
|
2243
2373
|
if (hasTsconfig) {
|
|
2244
2374
|
console.log("Compiling plugin TypeScript...");
|
|
2245
2375
|
const { execSync: execSync3 } = await import("child_process");
|
|
@@ -2274,30 +2404,74 @@ async function cmdDev(args2 = []) {
|
|
|
2274
2404
|
process.env.OPENACP_DEBUG = "1";
|
|
2275
2405
|
}
|
|
2276
2406
|
process.env.OPENACP_DEV_LOOP = "1";
|
|
2277
|
-
const { startServer } = await import("./main-
|
|
2407
|
+
const { startServer } = await import("./main-D7M2AKRM.js");
|
|
2278
2408
|
await startServer({ devPluginPath: pluginPath, noWatch });
|
|
2279
2409
|
}
|
|
2280
2410
|
|
|
2281
2411
|
// src/cli.ts
|
|
2282
2412
|
setDefaultAutoSelectFamily(false);
|
|
2283
|
-
|
|
2284
|
-
|
|
2413
|
+
function extractInstanceFlags(args2) {
|
|
2414
|
+
const flags2 = { local: false, global: false };
|
|
2415
|
+
const remaining2 = [];
|
|
2416
|
+
let i = 0;
|
|
2417
|
+
while (i < args2.length) {
|
|
2418
|
+
if (args2[i] === "--local") {
|
|
2419
|
+
flags2.local = true;
|
|
2420
|
+
i++;
|
|
2421
|
+
} else if (args2[i] === "--global") {
|
|
2422
|
+
flags2.global = true;
|
|
2423
|
+
i++;
|
|
2424
|
+
} else if (args2[i] === "--dir" && args2[i + 1]) {
|
|
2425
|
+
flags2.dir = args2[i + 1];
|
|
2426
|
+
i += 2;
|
|
2427
|
+
} else if (args2[i] === "--from" && args2[i + 1]) {
|
|
2428
|
+
flags2.from = args2[i + 1];
|
|
2429
|
+
i += 2;
|
|
2430
|
+
} else if (args2[i] === "--name" && args2[i + 1]) {
|
|
2431
|
+
flags2.name = args2[i + 1];
|
|
2432
|
+
i += 2;
|
|
2433
|
+
} else {
|
|
2434
|
+
remaining2.push(args2[i]);
|
|
2435
|
+
i++;
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
return { flags: flags2, remaining: remaining2 };
|
|
2439
|
+
}
|
|
2440
|
+
var resolvedInstanceRoot = null;
|
|
2441
|
+
var instanceFlags = { local: false, global: false };
|
|
2442
|
+
function getResolvedInstanceRoot() {
|
|
2443
|
+
return resolvedInstanceRoot;
|
|
2444
|
+
}
|
|
2445
|
+
function getInstanceFlags() {
|
|
2446
|
+
return instanceFlags;
|
|
2447
|
+
}
|
|
2448
|
+
var allArgs = process.argv.slice(2);
|
|
2449
|
+
var { flags, remaining } = extractInstanceFlags(allArgs);
|
|
2450
|
+
instanceFlags = flags;
|
|
2451
|
+
var [command, ...args] = remaining;
|
|
2452
|
+
resolvedInstanceRoot = resolveInstanceRoot({
|
|
2453
|
+
dir: flags.dir,
|
|
2454
|
+
local: flags.local,
|
|
2455
|
+
global: flags.global,
|
|
2456
|
+
cwd: process.cwd()
|
|
2457
|
+
});
|
|
2458
|
+
var root = resolvedInstanceRoot ?? getGlobalRoot();
|
|
2285
2459
|
var commands = {
|
|
2286
2460
|
"--help": async () => printHelp(),
|
|
2287
2461
|
"-h": async () => printHelp(),
|
|
2288
2462
|
"--version": () => cmdVersion(),
|
|
2289
2463
|
"-v": () => cmdVersion(),
|
|
2290
|
-
"install": () => cmdInstall(args),
|
|
2291
|
-
"uninstall": () => cmdUninstall(args),
|
|
2292
|
-
"plugins": () => cmdPlugins(args),
|
|
2293
|
-
"plugin": () => cmdPlugin(args),
|
|
2464
|
+
"install": () => cmdInstall(args, root),
|
|
2465
|
+
"uninstall": () => cmdUninstall(args, root),
|
|
2466
|
+
"plugins": () => cmdPlugins(args, root),
|
|
2467
|
+
"plugin": () => cmdPlugin(args, root),
|
|
2294
2468
|
"api": () => cmdApi(args),
|
|
2295
|
-
"start": () => cmdStart(args),
|
|
2296
|
-
"stop": () => cmdStop(args),
|
|
2469
|
+
"start": () => cmdStart(args, root),
|
|
2470
|
+
"stop": () => cmdStop(args, root),
|
|
2297
2471
|
"status": () => cmdStatus(args),
|
|
2298
2472
|
"logs": () => cmdLogs(args),
|
|
2299
2473
|
"config": () => cmdConfig(args),
|
|
2300
|
-
"reset": () => cmdReset(args),
|
|
2474
|
+
"reset": () => cmdReset(args, root),
|
|
2301
2475
|
"update": () => cmdUpdate(args),
|
|
2302
2476
|
"adopt": () => cmdAdopt(args),
|
|
2303
2477
|
"integrate": () => cmdIntegrate(args),
|
|
@@ -2307,8 +2481,24 @@ var commands = {
|
|
|
2307
2481
|
"onboard": () => cmdOnboard(),
|
|
2308
2482
|
"dev": () => cmdDev(args),
|
|
2309
2483
|
"--daemon-child": async () => {
|
|
2310
|
-
const { startServer } = await import("./main-
|
|
2311
|
-
|
|
2484
|
+
const { startServer } = await import("./main-D7M2AKRM.js");
|
|
2485
|
+
const envRoot = process.env.OPENACP_INSTANCE_ROOT;
|
|
2486
|
+
if (envRoot) {
|
|
2487
|
+
const { createInstanceContext: createInstanceContext2, getGlobalRoot: getGlobal } = await import("./instance-context-FLCE7VZ4.js");
|
|
2488
|
+
const { InstanceRegistry: InstanceRegistry2 } = await import("./instance-registry-SW5FWKHO.js");
|
|
2489
|
+
const registry = new InstanceRegistry2(path9.join(getGlobal(), "instances.json"));
|
|
2490
|
+
await registry.load();
|
|
2491
|
+
const entry = registry.getByRoot(envRoot);
|
|
2492
|
+
const id = entry?.id ?? "unknown";
|
|
2493
|
+
const ctx = createInstanceContext2({
|
|
2494
|
+
id,
|
|
2495
|
+
root: envRoot,
|
|
2496
|
+
isGlobal: envRoot === getGlobal()
|
|
2497
|
+
});
|
|
2498
|
+
await startServer({ instanceContext: ctx });
|
|
2499
|
+
} else {
|
|
2500
|
+
await startServer();
|
|
2501
|
+
}
|
|
2312
2502
|
}
|
|
2313
2503
|
};
|
|
2314
2504
|
async function main() {
|
|
@@ -2316,11 +2506,15 @@ async function main() {
|
|
|
2316
2506
|
if (handler) {
|
|
2317
2507
|
await handler();
|
|
2318
2508
|
} else {
|
|
2319
|
-
await cmdDefault(command);
|
|
2509
|
+
await cmdDefault(command, root);
|
|
2320
2510
|
}
|
|
2321
2511
|
}
|
|
2322
2512
|
main().catch((err) => {
|
|
2323
2513
|
console.error("Fatal:", err);
|
|
2324
2514
|
process.exit(1);
|
|
2325
2515
|
});
|
|
2516
|
+
export {
|
|
2517
|
+
getInstanceFlags,
|
|
2518
|
+
getResolvedInstanceRoot
|
|
2519
|
+
};
|
|
2326
2520
|
//# sourceMappingURL=cli.js.map
|