@openacp/cli 0.4.5 → 0.4.8
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 +81 -15
- package/dist/agent-registry-7HC6D4CH.js +7 -0
- package/dist/{chunk-WHKLPZGK.js → chunk-6MJLVZXV.js} +8 -8
- package/dist/{chunk-V5P3K4A5.js → chunk-BBPWAWE3.js} +1137 -119
- package/dist/chunk-BBPWAWE3.js.map +1 -0
- package/dist/{chunk-3QACY5E3.js → chunk-C6YIUTGR.js} +2 -2
- package/dist/{chunk-2SY7Y2VB.js → chunk-HZD3CGPK.js} +2 -2
- package/dist/{chunk-BLVZFCKN.js → chunk-UAUTLC4E.js} +27 -3
- package/dist/{chunk-BLVZFCKN.js.map → chunk-UAUTLC4E.js.map} +1 -1
- package/dist/chunk-VA2M52CM.js +15 -0
- package/dist/chunk-VA2M52CM.js.map +1 -0
- package/dist/{chunk-WF5XDN4D.js → chunk-ZRFBLD3W.js} +6 -2
- package/dist/chunk-ZRFBLD3W.js.map +1 -0
- package/dist/cli.js +388 -38
- package/dist/cli.js.map +1 -1
- package/dist/{config-J5YQOMDU.js → config-H2DSEHNW.js} +2 -2
- package/dist/config-editor-SKS4LJLT.js +11 -0
- package/dist/{daemon-SLGQGRKO.js → daemon-VF6HJQXD.js} +3 -3
- package/dist/index.d.ts +111 -10
- package/dist/index.js +13 -10
- package/dist/integrate-WUPLRJD3.js +145 -0
- package/dist/integrate-WUPLRJD3.js.map +1 -0
- package/dist/{main-3CDOICYN.js → main-NV7YN3VY.js} +27 -14
- package/dist/main-NV7YN3VY.js.map +1 -0
- package/dist/{setup-JQZBPXWS.js → setup-FCVL75K6.js} +3 -3
- package/dist/setup-FCVL75K6.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-V5P3K4A5.js.map +0 -1
- package/dist/chunk-WF5XDN4D.js.map +0 -1
- package/dist/config-editor-IXL4BFG3.js +0 -11
- package/dist/main-3CDOICYN.js.map +0 -1
- /package/dist/{config-J5YQOMDU.js.map → agent-registry-7HC6D4CH.js.map} +0 -0
- /package/dist/{chunk-WHKLPZGK.js.map → chunk-6MJLVZXV.js.map} +0 -0
- /package/dist/{chunk-3QACY5E3.js.map → chunk-C6YIUTGR.js.map} +0 -0
- /package/dist/{chunk-2SY7Y2VB.js.map → chunk-HZD3CGPK.js.map} +0 -0
- /package/dist/{config-editor-IXL4BFG3.js.map → config-H2DSEHNW.js.map} +0 -0
- /package/dist/{daemon-SLGQGRKO.js.map → config-editor-SKS4LJLT.js.map} +0 -0
- /package/dist/{setup-JQZBPXWS.js.map → daemon-VF6HJQXD.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
installPlugin,
|
|
4
4
|
listPlugins,
|
|
5
5
|
uninstallPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HZD3CGPK.js";
|
|
7
7
|
import {
|
|
8
8
|
checkAndPromptUpdate,
|
|
9
9
|
compareVersions,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getLatestVersion,
|
|
12
12
|
runUpdate
|
|
13
13
|
} from "./chunk-KSIQZC3J.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-ZRFBLD3W.js";
|
|
15
15
|
import "./chunk-LYKCQTH5.js";
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
@@ -61,15 +61,33 @@ Usage:
|
|
|
61
61
|
openacp --foreground Force foreground mode
|
|
62
62
|
openacp --version Show version
|
|
63
63
|
openacp --help Show this help
|
|
64
|
+
adopt <agent> <id> Adopt an external agent session into OpenACP
|
|
65
|
+
integrate <agent> Install/uninstall agent integration for session transfer
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
openacp
|
|
67
|
-
openacp
|
|
68
|
-
openacp
|
|
69
|
-
openacp
|
|
67
|
+
API (requires running daemon):
|
|
68
|
+
openacp api status Show active sessions
|
|
69
|
+
openacp api session <id> Show session details
|
|
70
|
+
openacp api new [agent] [workspace] Create a new session
|
|
71
|
+
openacp api send <id> <prompt> Send prompt to session
|
|
72
|
+
openacp api cancel <id> Cancel a session
|
|
73
|
+
openacp api dangerous <id> [on|off] Toggle dangerous mode
|
|
74
|
+
openacp api agents List available agents
|
|
75
|
+
openacp api topics [--status s1,s2] List topics
|
|
76
|
+
openacp api delete-topic <id> [--force] Delete a topic
|
|
77
|
+
openacp api cleanup [--status s1,s2] Cleanup finished topics
|
|
78
|
+
openacp api health Show system health
|
|
79
|
+
openacp api adapters List registered adapters
|
|
80
|
+
openacp api tunnel Show tunnel status
|
|
81
|
+
openacp api config Show runtime config
|
|
82
|
+
openacp api config set <key> <value> Update config value
|
|
83
|
+
openacp api restart Restart daemon
|
|
84
|
+
openacp api notify <message> Send notification to all channels
|
|
85
|
+
openacp api version Show daemon version
|
|
70
86
|
|
|
71
87
|
Note: "openacp status" shows daemon process health.
|
|
72
|
-
"openacp
|
|
88
|
+
"openacp api status" shows active agent sessions.
|
|
89
|
+
"openacp --version" shows CLI version.
|
|
90
|
+
"openacp api version" shows running daemon version.
|
|
73
91
|
|
|
74
92
|
Install:
|
|
75
93
|
npm install -g @openacp/cli
|
|
@@ -81,14 +99,8 @@ Examples:
|
|
|
81
99
|
`);
|
|
82
100
|
}
|
|
83
101
|
async function cmdVersion() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const require2 = createRequire(import.meta.url);
|
|
87
|
-
const pkg = require2("../../package.json");
|
|
88
|
-
console.log(`openacp v${pkg.version}`);
|
|
89
|
-
} catch {
|
|
90
|
-
console.log("openacp v0.0.0-dev");
|
|
91
|
-
}
|
|
102
|
+
const { getCurrentVersion: getCurrentVersion2 } = await import("./version-VC5CPXBX.js");
|
|
103
|
+
console.log(`openacp v${getCurrentVersion2()}`);
|
|
92
104
|
}
|
|
93
105
|
async function cmdInstall(args2) {
|
|
94
106
|
const pkg = args2[1];
|
|
@@ -118,7 +130,7 @@ async function cmdPlugins() {
|
|
|
118
130
|
}
|
|
119
131
|
}
|
|
120
132
|
}
|
|
121
|
-
async function
|
|
133
|
+
async function cmdApi(args2) {
|
|
122
134
|
const subCmd = args2[1];
|
|
123
135
|
const port = readApiPort();
|
|
124
136
|
if (port === null) {
|
|
@@ -151,7 +163,7 @@ async function cmdRuntime(args2) {
|
|
|
151
163
|
} else if (subCmd === "cancel") {
|
|
152
164
|
const sessionId = args2[2];
|
|
153
165
|
if (!sessionId) {
|
|
154
|
-
console.error("Usage: openacp
|
|
166
|
+
console.error("Usage: openacp api cancel <session-id>");
|
|
155
167
|
process.exit(1);
|
|
156
168
|
}
|
|
157
169
|
const res = await apiCall(port, `/api/sessions/${encodeURIComponent(sessionId)}`, {
|
|
@@ -184,14 +196,272 @@ async function cmdRuntime(args2) {
|
|
|
184
196
|
const isDefault = a.name === data.default ? " (default)" : "";
|
|
185
197
|
console.log(` ${a.name}${isDefault}`);
|
|
186
198
|
}
|
|
199
|
+
} else if (subCmd === "topics") {
|
|
200
|
+
const statusIdx = args2.indexOf("--status");
|
|
201
|
+
const statusParam = statusIdx !== -1 ? args2[statusIdx + 1] : void 0;
|
|
202
|
+
const query = statusParam ? `?status=${encodeURIComponent(statusParam)}` : "";
|
|
203
|
+
const res = await apiCall(port, `/api/topics${query}`);
|
|
204
|
+
const data = await res.json();
|
|
205
|
+
if (data.topics.length === 0) {
|
|
206
|
+
console.log("No topics found.");
|
|
207
|
+
} else {
|
|
208
|
+
console.log(`Topics: ${data.topics.length}
|
|
209
|
+
`);
|
|
210
|
+
for (const t of data.topics) {
|
|
211
|
+
const name = t.name ? ` "${t.name}"` : "";
|
|
212
|
+
const topic = t.topicId ? `Topic #${t.topicId}` : "headless";
|
|
213
|
+
console.log(` ${t.sessionId} ${t.agentName} ${t.status}${name} ${topic}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
} else if (subCmd === "delete-topic") {
|
|
217
|
+
const sessionId = args2[2];
|
|
218
|
+
if (!sessionId) {
|
|
219
|
+
console.error("Usage: openacp api delete-topic <session-id> [--force]");
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
const force = args2.includes("--force");
|
|
223
|
+
const query = force ? "?force=true" : "";
|
|
224
|
+
const res = await apiCall(port, `/api/topics/${encodeURIComponent(sessionId)}${query}`, { method: "DELETE" });
|
|
225
|
+
const data = await res.json();
|
|
226
|
+
if (res.status === 409) {
|
|
227
|
+
console.error(`Session "${sessionId}" is active (${data.session?.status}). Use --force to delete.`);
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
230
|
+
if (!res.ok) {
|
|
231
|
+
console.error(`Error: ${data.error}`);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
const topicLabel = data.topicId ? `Topic #${data.topicId}` : "headless session";
|
|
235
|
+
console.log(`${topicLabel} deleted (session ${sessionId})`);
|
|
236
|
+
} else if (subCmd === "cleanup") {
|
|
237
|
+
const statusIdx = args2.indexOf("--status");
|
|
238
|
+
const statusParam = statusIdx !== -1 ? args2[statusIdx + 1] : void 0;
|
|
239
|
+
const body = {};
|
|
240
|
+
if (statusParam) body.statuses = statusParam.split(",");
|
|
241
|
+
const res = await apiCall(port, "/api/topics/cleanup", {
|
|
242
|
+
method: "POST",
|
|
243
|
+
headers: { "Content-Type": "application/json" },
|
|
244
|
+
body: JSON.stringify(body)
|
|
245
|
+
});
|
|
246
|
+
const data = await res.json();
|
|
247
|
+
if (data.deleted.length === 0 && data.failed.length === 0) {
|
|
248
|
+
console.log("Nothing to clean up.");
|
|
249
|
+
} else {
|
|
250
|
+
console.log(`Cleaned up ${data.deleted.length} topics${data.deleted.length ? ": " + data.deleted.join(", ") : ""} (${data.failed.length} failed)`);
|
|
251
|
+
for (const f of data.failed) {
|
|
252
|
+
console.error(` Failed: ${f.sessionId} \u2014 ${f.error}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else if (subCmd === "send") {
|
|
256
|
+
const sessionId = args2[2];
|
|
257
|
+
if (!sessionId) {
|
|
258
|
+
console.error("Usage: openacp api send <session-id> <prompt>");
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
const prompt = args2.slice(3).join(" ");
|
|
262
|
+
if (!prompt) {
|
|
263
|
+
console.error("Usage: openacp api send <session-id> <prompt>");
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
const res = await apiCall(port, `/api/sessions/${encodeURIComponent(sessionId)}/prompt`, {
|
|
267
|
+
method: "POST",
|
|
268
|
+
headers: { "Content-Type": "application/json" },
|
|
269
|
+
body: JSON.stringify({ prompt })
|
|
270
|
+
});
|
|
271
|
+
const data = await res.json();
|
|
272
|
+
if (!res.ok) {
|
|
273
|
+
console.error(`Error: ${data.error}`);
|
|
274
|
+
process.exit(1);
|
|
275
|
+
}
|
|
276
|
+
console.log(`Prompt sent to session ${sessionId} (queue depth: ${data.queueDepth})`);
|
|
277
|
+
} else if (subCmd === "session") {
|
|
278
|
+
const sessionId = args2[2];
|
|
279
|
+
if (!sessionId) {
|
|
280
|
+
console.error("Usage: openacp api session <session-id>");
|
|
281
|
+
process.exit(1);
|
|
282
|
+
}
|
|
283
|
+
const res = await apiCall(port, `/api/sessions/${encodeURIComponent(sessionId)}`);
|
|
284
|
+
const data = await res.json();
|
|
285
|
+
if (!res.ok) {
|
|
286
|
+
console.error(`Error: ${data.error}`);
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
console.log(`Session details:`);
|
|
290
|
+
console.log(` ID : ${data.id}`);
|
|
291
|
+
console.log(` Agent : ${data.agent}`);
|
|
292
|
+
console.log(` Status : ${data.status}`);
|
|
293
|
+
console.log(` Name : ${data.name ?? "(none)"}`);
|
|
294
|
+
console.log(` Workspace : ${data.workspace}`);
|
|
295
|
+
console.log(` Created : ${data.createdAt}`);
|
|
296
|
+
console.log(` Dangerous : ${data.dangerous}`);
|
|
297
|
+
console.log(` Queue depth : ${data.queueDepth}`);
|
|
298
|
+
console.log(` Prompt active : ${data.promptActive}`);
|
|
299
|
+
console.log(` Channel : ${data.channelId ?? "(none)"}`);
|
|
300
|
+
console.log(` Thread : ${data.threadId ?? "(none)"}`);
|
|
301
|
+
} else if (subCmd === "dangerous") {
|
|
302
|
+
const sessionId = args2[2];
|
|
303
|
+
if (!sessionId) {
|
|
304
|
+
console.error("Usage: openacp api dangerous <session-id> [on|off]");
|
|
305
|
+
process.exit(1);
|
|
306
|
+
}
|
|
307
|
+
const toggle = args2[3];
|
|
308
|
+
if (!toggle || toggle !== "on" && toggle !== "off") {
|
|
309
|
+
console.error("Usage: openacp api dangerous <session-id> [on|off]");
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
const res = await apiCall(port, `/api/sessions/${encodeURIComponent(sessionId)}/dangerous`, {
|
|
313
|
+
method: "PATCH",
|
|
314
|
+
headers: { "Content-Type": "application/json" },
|
|
315
|
+
body: JSON.stringify({ enabled: toggle === "on" })
|
|
316
|
+
});
|
|
317
|
+
const data = await res.json();
|
|
318
|
+
if (!res.ok) {
|
|
319
|
+
console.error(`Error: ${data.error}`);
|
|
320
|
+
process.exit(1);
|
|
321
|
+
}
|
|
322
|
+
const state = toggle === "on" ? "enabled" : "disabled";
|
|
323
|
+
console.log(`Dangerous mode ${state} for session ${sessionId}`);
|
|
324
|
+
} else if (subCmd === "health") {
|
|
325
|
+
const res = await apiCall(port, "/api/health");
|
|
326
|
+
const data = await res.json();
|
|
327
|
+
if (!res.ok) {
|
|
328
|
+
console.error(`Error: ${data.error}`);
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
const uptimeSeconds = typeof data.uptimeSeconds === "number" ? data.uptimeSeconds : 0;
|
|
332
|
+
const hours = Math.floor(uptimeSeconds / 3600);
|
|
333
|
+
const minutes = Math.floor(uptimeSeconds % 3600 / 60);
|
|
334
|
+
const memoryBytes = typeof data.memoryUsage === "number" ? data.memoryUsage : 0;
|
|
335
|
+
const memoryMB = (memoryBytes / 1024 / 1024).toFixed(1);
|
|
336
|
+
const sessions = data.sessions ?? {};
|
|
337
|
+
console.log(`Status : ${data.status}`);
|
|
338
|
+
console.log(`Uptime : ${hours}h ${minutes}m`);
|
|
339
|
+
console.log(`Version : ${data.version}`);
|
|
340
|
+
console.log(`Memory : ${memoryMB} MB`);
|
|
341
|
+
console.log(`Sessions : ${sessions.active ?? 0} active / ${sessions.total ?? 0} total`);
|
|
342
|
+
console.log(`Adapters : ${data.adapters}`);
|
|
343
|
+
console.log(`Tunnel : ${data.tunnel}`);
|
|
344
|
+
} else if (subCmd === "restart") {
|
|
345
|
+
const res = await apiCall(port, "/api/restart", { method: "POST" });
|
|
346
|
+
const data = await res.json();
|
|
347
|
+
if (!res.ok) {
|
|
348
|
+
console.error(`Error: ${data.error}`);
|
|
349
|
+
process.exit(1);
|
|
350
|
+
}
|
|
351
|
+
console.log("Restart signal sent. OpenACP is restarting...");
|
|
352
|
+
} else if (subCmd === "config") {
|
|
353
|
+
const subSubCmd = args2[2];
|
|
354
|
+
if (!subSubCmd) {
|
|
355
|
+
const res = await apiCall(port, "/api/config");
|
|
356
|
+
const data = await res.json();
|
|
357
|
+
if (!res.ok) {
|
|
358
|
+
console.error(`Error: ${data.error}`);
|
|
359
|
+
process.exit(1);
|
|
360
|
+
}
|
|
361
|
+
console.log(JSON.stringify(data.config, null, 2));
|
|
362
|
+
} else if (subSubCmd === "set") {
|
|
363
|
+
const configPath = args2[3];
|
|
364
|
+
const configValue = args2[4];
|
|
365
|
+
if (!configPath || configValue === void 0) {
|
|
366
|
+
console.error("Usage: openacp api config set <path> <value>");
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
let value = configValue;
|
|
370
|
+
try {
|
|
371
|
+
value = JSON.parse(configValue);
|
|
372
|
+
} catch {
|
|
373
|
+
}
|
|
374
|
+
const res = await apiCall(port, "/api/config", {
|
|
375
|
+
method: "PATCH",
|
|
376
|
+
headers: { "Content-Type": "application/json" },
|
|
377
|
+
body: JSON.stringify({ path: configPath, value })
|
|
378
|
+
});
|
|
379
|
+
const data = await res.json();
|
|
380
|
+
if (!res.ok) {
|
|
381
|
+
console.error(`Error: ${data.error}`);
|
|
382
|
+
process.exit(1);
|
|
383
|
+
}
|
|
384
|
+
console.log(`Config updated: ${configPath} = ${JSON.stringify(value)}`);
|
|
385
|
+
if (data.needsRestart) {
|
|
386
|
+
console.log("Note: restart required for this change to take effect.");
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
console.error(`Unknown config subcommand: ${subSubCmd}`);
|
|
390
|
+
console.log(" openacp api config Show runtime config");
|
|
391
|
+
console.log(" openacp api config set <key> <value> Update config value");
|
|
392
|
+
process.exit(1);
|
|
393
|
+
}
|
|
394
|
+
} else if (subCmd === "adapters") {
|
|
395
|
+
const res = await apiCall(port, "/api/adapters");
|
|
396
|
+
const data = await res.json();
|
|
397
|
+
if (!res.ok) {
|
|
398
|
+
console.error(`Error: ${data.error}`);
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
401
|
+
console.log("Registered adapters:");
|
|
402
|
+
for (const a of data.adapters) {
|
|
403
|
+
console.log(` ${a.name} (${a.type})`);
|
|
404
|
+
}
|
|
405
|
+
} else if (subCmd === "tunnel") {
|
|
406
|
+
const res = await apiCall(port, "/api/tunnel");
|
|
407
|
+
const data = await res.json();
|
|
408
|
+
if (!res.ok) {
|
|
409
|
+
console.error(`Error: ${data.error}`);
|
|
410
|
+
process.exit(1);
|
|
411
|
+
}
|
|
412
|
+
if (data.enabled) {
|
|
413
|
+
console.log(`Tunnel provider : ${data.provider}`);
|
|
414
|
+
console.log(`Tunnel URL : ${data.url}`);
|
|
415
|
+
} else {
|
|
416
|
+
console.log("Tunnel: not enabled");
|
|
417
|
+
}
|
|
418
|
+
} else if (subCmd === "notify") {
|
|
419
|
+
const message = args2.slice(2).join(" ");
|
|
420
|
+
if (!message) {
|
|
421
|
+
console.error("Usage: openacp api notify <message>");
|
|
422
|
+
process.exit(1);
|
|
423
|
+
}
|
|
424
|
+
const res = await apiCall(port, "/api/notify", {
|
|
425
|
+
method: "POST",
|
|
426
|
+
headers: { "Content-Type": "application/json" },
|
|
427
|
+
body: JSON.stringify({ message })
|
|
428
|
+
});
|
|
429
|
+
const data = await res.json();
|
|
430
|
+
if (!res.ok) {
|
|
431
|
+
console.error(`Error: ${data.error}`);
|
|
432
|
+
process.exit(1);
|
|
433
|
+
}
|
|
434
|
+
console.log("Notification sent to all channels.");
|
|
435
|
+
} else if (subCmd === "version") {
|
|
436
|
+
const res = await apiCall(port, "/api/version");
|
|
437
|
+
const data = await res.json();
|
|
438
|
+
if (!res.ok) {
|
|
439
|
+
console.error(`Error: ${data.error}`);
|
|
440
|
+
process.exit(1);
|
|
441
|
+
}
|
|
442
|
+
console.log(`Daemon version: ${data.version}`);
|
|
187
443
|
} else {
|
|
188
|
-
console.error(`Unknown
|
|
444
|
+
console.error(`Unknown api command: ${subCmd || "(none)"}
|
|
189
445
|
`);
|
|
190
446
|
console.log("Usage:");
|
|
191
|
-
console.log(" openacp
|
|
192
|
-
console.log(" openacp
|
|
193
|
-
console.log(" openacp
|
|
194
|
-
console.log(" openacp
|
|
447
|
+
console.log(" openacp api status Show active sessions");
|
|
448
|
+
console.log(" openacp api session <id> Show session details");
|
|
449
|
+
console.log(" openacp api new [agent] [workspace] Create a new session");
|
|
450
|
+
console.log(" openacp api send <id> <prompt> Send prompt to session");
|
|
451
|
+
console.log(" openacp api cancel <id> Cancel a session");
|
|
452
|
+
console.log(" openacp api dangerous <id> [on|off] Toggle dangerous mode");
|
|
453
|
+
console.log(" openacp api agents List available agents");
|
|
454
|
+
console.log(" openacp api topics [--status s1,s2] List topics");
|
|
455
|
+
console.log(" openacp api delete-topic <id> [--force] Delete a topic");
|
|
456
|
+
console.log(" openacp api cleanup [--status s1,s2] Cleanup finished topics");
|
|
457
|
+
console.log(" openacp api health Show system health");
|
|
458
|
+
console.log(" openacp api adapters List registered adapters");
|
|
459
|
+
console.log(" openacp api tunnel Show tunnel status");
|
|
460
|
+
console.log(" openacp api config Show runtime config");
|
|
461
|
+
console.log(" openacp api config set <key> <value> Update config value");
|
|
462
|
+
console.log(" openacp api restart Restart daemon");
|
|
463
|
+
console.log(" openacp api notify <message> Send notification to all channels");
|
|
464
|
+
console.log(" openacp api version Show daemon version");
|
|
195
465
|
process.exit(1);
|
|
196
466
|
}
|
|
197
467
|
} catch (err) {
|
|
@@ -205,8 +475,8 @@ async function cmdRuntime(args2) {
|
|
|
205
475
|
}
|
|
206
476
|
async function cmdStart() {
|
|
207
477
|
await checkAndPromptUpdate();
|
|
208
|
-
const { startDaemon, getPidPath } = await import("./daemon-
|
|
209
|
-
const { ConfigManager } = await import("./config-
|
|
478
|
+
const { startDaemon, getPidPath } = await import("./daemon-VF6HJQXD.js");
|
|
479
|
+
const { ConfigManager } = await import("./config-H2DSEHNW.js");
|
|
210
480
|
const cm = new ConfigManager();
|
|
211
481
|
if (await cm.exists()) {
|
|
212
482
|
await cm.load();
|
|
@@ -223,7 +493,7 @@ async function cmdStart() {
|
|
|
223
493
|
}
|
|
224
494
|
}
|
|
225
495
|
async function cmdStop() {
|
|
226
|
-
const { stopDaemon } = await import("./daemon-
|
|
496
|
+
const { stopDaemon } = await import("./daemon-VF6HJQXD.js");
|
|
227
497
|
const result = stopDaemon();
|
|
228
498
|
if (result.stopped) {
|
|
229
499
|
console.log(`OpenACP daemon stopped (was PID ${result.pid})`);
|
|
@@ -233,7 +503,7 @@ async function cmdStop() {
|
|
|
233
503
|
}
|
|
234
504
|
}
|
|
235
505
|
async function cmdStatus() {
|
|
236
|
-
const { getStatus } = await import("./daemon-
|
|
506
|
+
const { getStatus } = await import("./daemon-VF6HJQXD.js");
|
|
237
507
|
const status = getStatus();
|
|
238
508
|
if (status.running) {
|
|
239
509
|
console.log(`OpenACP is running (PID ${status.pid})`);
|
|
@@ -243,7 +513,7 @@ async function cmdStatus() {
|
|
|
243
513
|
}
|
|
244
514
|
async function cmdLogs() {
|
|
245
515
|
const { spawn } = await import("child_process");
|
|
246
|
-
const { ConfigManager, expandHome } = await import("./config-
|
|
516
|
+
const { ConfigManager, expandHome } = await import("./config-H2DSEHNW.js");
|
|
247
517
|
const pathMod = await import("path");
|
|
248
518
|
const cm = new ConfigManager();
|
|
249
519
|
let logDir = "~/.openacp/logs";
|
|
@@ -259,8 +529,8 @@ async function cmdLogs() {
|
|
|
259
529
|
});
|
|
260
530
|
}
|
|
261
531
|
async function cmdConfig() {
|
|
262
|
-
const { runConfigEditor } = await import("./config-editor-
|
|
263
|
-
const { ConfigManager } = await import("./config-
|
|
532
|
+
const { runConfigEditor } = await import("./config-editor-SKS4LJLT.js");
|
|
533
|
+
const { ConfigManager } = await import("./config-H2DSEHNW.js");
|
|
264
534
|
const cm = new ConfigManager();
|
|
265
535
|
if (!await cm.exists()) {
|
|
266
536
|
console.error('No config found. Run "openacp" first to set up.');
|
|
@@ -269,7 +539,7 @@ async function cmdConfig() {
|
|
|
269
539
|
await runConfigEditor(cm);
|
|
270
540
|
}
|
|
271
541
|
async function cmdReset() {
|
|
272
|
-
const { getStatus } = await import("./daemon-
|
|
542
|
+
const { getStatus } = await import("./daemon-VF6HJQXD.js");
|
|
273
543
|
const status = getStatus();
|
|
274
544
|
if (status.running) {
|
|
275
545
|
console.error("OpenACP is running. Stop it first: openacp stop");
|
|
@@ -313,6 +583,84 @@ async function cmdUpdate() {
|
|
|
313
583
|
process.exit(1);
|
|
314
584
|
}
|
|
315
585
|
}
|
|
586
|
+
async function cmdAdopt(args2) {
|
|
587
|
+
const agent = args2[1];
|
|
588
|
+
const sessionId = args2[2];
|
|
589
|
+
if (!agent || !sessionId) {
|
|
590
|
+
console.log("Usage: openacp adopt <agent> <session_id> [--cwd <path>]");
|
|
591
|
+
console.log("Example: openacp adopt claude abc123-def456 --cwd /path/to/project");
|
|
592
|
+
process.exit(1);
|
|
593
|
+
}
|
|
594
|
+
const cwdIdx = args2.indexOf("--cwd");
|
|
595
|
+
const cwd = cwdIdx !== -1 && args2[cwdIdx + 1] ? args2[cwdIdx + 1] : process.cwd();
|
|
596
|
+
const port = readApiPort();
|
|
597
|
+
if (!port) {
|
|
598
|
+
console.log("OpenACP is not running. Start it with: openacp start");
|
|
599
|
+
process.exit(1);
|
|
600
|
+
}
|
|
601
|
+
try {
|
|
602
|
+
const res = await fetch(`http://127.0.0.1:${port}/api/sessions/adopt`, {
|
|
603
|
+
method: "POST",
|
|
604
|
+
headers: { "Content-Type": "application/json" },
|
|
605
|
+
body: JSON.stringify({ agent, agentSessionId: sessionId, cwd })
|
|
606
|
+
});
|
|
607
|
+
const data = await res.json();
|
|
608
|
+
if (data.ok) {
|
|
609
|
+
if (data.status === "existing") {
|
|
610
|
+
console.log(`Session already on Telegram. Topic pinged.`);
|
|
611
|
+
} else {
|
|
612
|
+
console.log(`Session transferred to Telegram.`);
|
|
613
|
+
}
|
|
614
|
+
console.log(` Session ID: ${data.sessionId}`);
|
|
615
|
+
console.log(` Thread ID: ${data.threadId}`);
|
|
616
|
+
} else {
|
|
617
|
+
console.log(`Error: ${data.message || data.error}`);
|
|
618
|
+
process.exit(1);
|
|
619
|
+
}
|
|
620
|
+
} catch (err) {
|
|
621
|
+
console.log(`Failed to connect to OpenACP: ${err instanceof Error ? err.message : err}`);
|
|
622
|
+
process.exit(1);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
async function cmdIntegrate(args2) {
|
|
626
|
+
const { getIntegration, listIntegrations } = await import("./integrate-WUPLRJD3.js");
|
|
627
|
+
const agent = args2[1];
|
|
628
|
+
const uninstall = args2.includes("--uninstall");
|
|
629
|
+
if (!agent) {
|
|
630
|
+
console.log("Usage: openacp integrate <agent> [--uninstall]");
|
|
631
|
+
console.log(`Available integrations: ${listIntegrations().join(", ")}`);
|
|
632
|
+
process.exit(1);
|
|
633
|
+
}
|
|
634
|
+
const integration = getIntegration(agent);
|
|
635
|
+
if (!integration) {
|
|
636
|
+
console.log(`No integration available for '${agent}'.`);
|
|
637
|
+
console.log(`Available: ${listIntegrations().join(", ")}`);
|
|
638
|
+
process.exit(1);
|
|
639
|
+
}
|
|
640
|
+
for (const item of integration.items) {
|
|
641
|
+
if (uninstall) {
|
|
642
|
+
console.log(`Removing ${agent}/${item.id}...`);
|
|
643
|
+
const result = await item.uninstall();
|
|
644
|
+
for (const log of result.logs) console.log(` ${log}`);
|
|
645
|
+
if (result.success) {
|
|
646
|
+
console.log(` ${item.name} removed.`);
|
|
647
|
+
} else {
|
|
648
|
+
console.log(` Failed to remove ${item.name}.`);
|
|
649
|
+
process.exit(1);
|
|
650
|
+
}
|
|
651
|
+
} else {
|
|
652
|
+
console.log(`Installing ${agent}/${item.id}...`);
|
|
653
|
+
const result = await item.install();
|
|
654
|
+
for (const log of result.logs) console.log(` ${log}`);
|
|
655
|
+
if (result.success) {
|
|
656
|
+
console.log(` ${item.name} installed.`);
|
|
657
|
+
} else {
|
|
658
|
+
console.log(` Failed to install ${item.name}.`);
|
|
659
|
+
process.exit(1);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
316
664
|
async function cmdDefault(command2) {
|
|
317
665
|
const forceForeground = command2 === "--foreground";
|
|
318
666
|
if (command2 && !command2.startsWith("-")) {
|
|
@@ -321,17 +669,17 @@ async function cmdDefault(command2) {
|
|
|
321
669
|
process.exit(1);
|
|
322
670
|
}
|
|
323
671
|
await checkAndPromptUpdate();
|
|
324
|
-
const { ConfigManager } = await import("./config-
|
|
672
|
+
const { ConfigManager } = await import("./config-H2DSEHNW.js");
|
|
325
673
|
const cm = new ConfigManager();
|
|
326
674
|
if (!await cm.exists()) {
|
|
327
|
-
const { runSetup } = await import("./setup-
|
|
675
|
+
const { runSetup } = await import("./setup-FCVL75K6.js");
|
|
328
676
|
const shouldStart = await runSetup(cm);
|
|
329
677
|
if (!shouldStart) process.exit(0);
|
|
330
678
|
}
|
|
331
679
|
await cm.load();
|
|
332
680
|
const config = cm.get();
|
|
333
681
|
if (!forceForeground && config.runMode === "daemon") {
|
|
334
|
-
const { startDaemon, getPidPath } = await import("./daemon-
|
|
682
|
+
const { startDaemon, getPidPath } = await import("./daemon-VF6HJQXD.js");
|
|
335
683
|
const result = startDaemon(getPidPath(), config.logging.logDir);
|
|
336
684
|
if ("error" in result) {
|
|
337
685
|
console.error(result.error);
|
|
@@ -340,9 +688,9 @@ async function cmdDefault(command2) {
|
|
|
340
688
|
console.log(`OpenACP daemon started (PID ${result.pid})`);
|
|
341
689
|
return;
|
|
342
690
|
}
|
|
343
|
-
const { markRunning } = await import("./daemon-
|
|
691
|
+
const { markRunning } = await import("./daemon-VF6HJQXD.js");
|
|
344
692
|
markRunning();
|
|
345
|
-
const { startServer } = await import("./main-
|
|
693
|
+
const { startServer } = await import("./main-NV7YN3VY.js");
|
|
346
694
|
await startServer();
|
|
347
695
|
}
|
|
348
696
|
|
|
@@ -358,7 +706,7 @@ var commands = {
|
|
|
358
706
|
"install": () => cmdInstall(args),
|
|
359
707
|
"uninstall": () => cmdUninstall(args),
|
|
360
708
|
"plugins": () => cmdPlugins(),
|
|
361
|
-
"
|
|
709
|
+
"api": () => cmdApi(args),
|
|
362
710
|
"start": () => cmdStart(),
|
|
363
711
|
"stop": () => cmdStop(),
|
|
364
712
|
"status": () => cmdStatus(),
|
|
@@ -366,8 +714,10 @@ var commands = {
|
|
|
366
714
|
"config": () => cmdConfig(),
|
|
367
715
|
"reset": () => cmdReset(),
|
|
368
716
|
"update": () => cmdUpdate(),
|
|
717
|
+
"adopt": () => cmdAdopt(args),
|
|
718
|
+
"integrate": () => cmdIntegrate(args),
|
|
369
719
|
"--daemon-child": async () => {
|
|
370
|
-
const { startServer } = await import("./main-
|
|
720
|
+
const { startServer } = await import("./main-NV7YN3VY.js");
|
|
371
721
|
await startServer();
|
|
372
722
|
}
|
|
373
723
|
};
|