@openacp/cli 0.2.5 → 0.2.13
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 +25 -25
- package/dist/chunk-3F7TYQ4H.js +1820 -0
- package/dist/chunk-3F7TYQ4H.js.map +1 -0
- package/dist/chunk-5KBEVENA.js +412 -0
- package/dist/chunk-5KBEVENA.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +153 -45
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/dist/{main-66K7T7MJ.js → main-VWRGYSPB.js} +31 -29
- package/dist/main-VWRGYSPB.js.map +1 -0
- package/dist/{setup-NLOC2GFD.js → setup-4EBTX2NJ.js} +4 -33
- package/dist/setup-4EBTX2NJ.js.map +1 -0
- package/package.json +6 -3
- package/dist/chunk-6YLIH7L5.js +0 -669
- package/dist/chunk-6YLIH7L5.js.map +0 -1
- package/dist/chunk-M5ZYTPZY.js +0 -220
- package/dist/chunk-M5ZYTPZY.js.map +0 -1
- package/dist/main-66K7T7MJ.js.map +0 -1
- package/dist/setup-NLOC2GFD.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import pino from 'pino';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { Readable, Writable } from 'node:stream';
|
|
3
4
|
import { PromptResponse } from '@agentclientprotocol/sdk';
|
|
4
5
|
|
|
5
6
|
interface IncomingMessage {
|
|
@@ -30,6 +31,11 @@ interface NotificationMessage {
|
|
|
30
31
|
summary: string;
|
|
31
32
|
deepLink?: string;
|
|
32
33
|
}
|
|
34
|
+
interface AgentCommand {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
input?: unknown;
|
|
38
|
+
}
|
|
33
39
|
type AgentEvent = {
|
|
34
40
|
type: 'text';
|
|
35
41
|
content: string;
|
|
@@ -63,7 +69,7 @@ type AgentEvent = {
|
|
|
63
69
|
};
|
|
64
70
|
} | {
|
|
65
71
|
type: 'commands_update';
|
|
66
|
-
commands:
|
|
72
|
+
commands: AgentCommand[];
|
|
67
73
|
} | {
|
|
68
74
|
type: 'session_end';
|
|
69
75
|
reason: string;
|
|
@@ -85,49 +91,27 @@ interface AgentDefinition {
|
|
|
85
91
|
}
|
|
86
92
|
type SessionStatus = 'initializing' | 'active' | 'cancelled' | 'finished' | 'error';
|
|
87
93
|
|
|
88
|
-
declare const log: {
|
|
89
|
-
info: (...args: unknown[]) => void;
|
|
90
|
-
warn: (...args: unknown[]) => void;
|
|
91
|
-
error: (...args: unknown[]) => void;
|
|
92
|
-
debug: (...args: unknown[]) => void;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
interface ChannelConfig {
|
|
96
|
-
enabled: boolean;
|
|
97
|
-
[key: string]: unknown;
|
|
98
|
-
}
|
|
99
|
-
declare abstract class ChannelAdapter {
|
|
100
|
-
protected core: any;
|
|
101
|
-
protected config: ChannelConfig;
|
|
102
|
-
constructor(core: any, config: ChannelConfig);
|
|
103
|
-
abstract start(): Promise<void>;
|
|
104
|
-
abstract stop(): Promise<void>;
|
|
105
|
-
abstract sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
106
|
-
abstract sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
|
|
107
|
-
abstract sendNotification(notification: NotificationMessage): Promise<void>;
|
|
108
|
-
abstract createSessionThread(sessionId: string, name: string): Promise<string>;
|
|
109
|
-
abstract renameSessionThread(sessionId: string, newName: string): Promise<void>;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
declare class NotificationManager {
|
|
113
|
-
private adapters;
|
|
114
|
-
constructor(adapters: Map<string, ChannelAdapter>);
|
|
115
|
-
notify(channelId: string, notification: NotificationMessage): Promise<void>;
|
|
116
|
-
notifyAll(notification: NotificationMessage): Promise<void>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
declare function nodeToWebWritable(nodeStream: Writable): WritableStream<Uint8Array>;
|
|
120
|
-
declare function nodeToWebReadable(nodeStream: Readable): ReadableStream<Uint8Array>;
|
|
121
|
-
|
|
122
|
-
declare class StderrCapture {
|
|
123
|
-
private maxLines;
|
|
124
|
-
private lines;
|
|
125
|
-
constructor(maxLines?: number);
|
|
126
|
-
append(chunk: string): void;
|
|
127
|
-
getLastLines(): string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
94
|
declare const PLUGINS_DIR: string;
|
|
95
|
+
declare const LoggingSchema: z.ZodDefault<z.ZodObject<{
|
|
96
|
+
level: z.ZodDefault<z.ZodEnum<["silent", "debug", "info", "warn", "error", "fatal"]>>;
|
|
97
|
+
logDir: z.ZodDefault<z.ZodString>;
|
|
98
|
+
maxFileSize: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
99
|
+
maxFiles: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
sessionLogRetentionDays: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
level: "fatal" | "error" | "warn" | "info" | "debug" | "silent";
|
|
103
|
+
logDir: string;
|
|
104
|
+
maxFileSize: string | number;
|
|
105
|
+
maxFiles: number;
|
|
106
|
+
sessionLogRetentionDays: number;
|
|
107
|
+
}, {
|
|
108
|
+
level?: "fatal" | "error" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
109
|
+
logDir?: string | undefined;
|
|
110
|
+
maxFileSize?: string | number | undefined;
|
|
111
|
+
maxFiles?: number | undefined;
|
|
112
|
+
sessionLogRetentionDays?: number | undefined;
|
|
113
|
+
}>>;
|
|
114
|
+
type LoggingConfig = z.infer<typeof LoggingSchema>;
|
|
131
115
|
declare const ConfigSchema: z.ZodObject<{
|
|
132
116
|
channels: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
133
117
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -176,6 +160,25 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
176
160
|
maxConcurrentSessions?: number | undefined;
|
|
177
161
|
sessionTimeoutMinutes?: number | undefined;
|
|
178
162
|
}>>;
|
|
163
|
+
logging: z.ZodDefault<z.ZodObject<{
|
|
164
|
+
level: z.ZodDefault<z.ZodEnum<["silent", "debug", "info", "warn", "error", "fatal"]>>;
|
|
165
|
+
logDir: z.ZodDefault<z.ZodString>;
|
|
166
|
+
maxFileSize: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
167
|
+
maxFiles: z.ZodDefault<z.ZodNumber>;
|
|
168
|
+
sessionLogRetentionDays: z.ZodDefault<z.ZodNumber>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
level: "fatal" | "error" | "warn" | "info" | "debug" | "silent";
|
|
171
|
+
logDir: string;
|
|
172
|
+
maxFileSize: string | number;
|
|
173
|
+
maxFiles: number;
|
|
174
|
+
sessionLogRetentionDays: number;
|
|
175
|
+
}, {
|
|
176
|
+
level?: "fatal" | "error" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
177
|
+
logDir?: string | undefined;
|
|
178
|
+
maxFileSize?: string | number | undefined;
|
|
179
|
+
maxFiles?: number | undefined;
|
|
180
|
+
sessionLogRetentionDays?: number | undefined;
|
|
181
|
+
}>>;
|
|
179
182
|
}, "strip", z.ZodTypeAny, {
|
|
180
183
|
channels: Record<string, z.objectOutputType<{
|
|
181
184
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -196,6 +199,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
196
199
|
maxConcurrentSessions: number;
|
|
197
200
|
sessionTimeoutMinutes: number;
|
|
198
201
|
};
|
|
202
|
+
logging: {
|
|
203
|
+
level: "fatal" | "error" | "warn" | "info" | "debug" | "silent";
|
|
204
|
+
logDir: string;
|
|
205
|
+
maxFileSize: string | number;
|
|
206
|
+
maxFiles: number;
|
|
207
|
+
sessionLogRetentionDays: number;
|
|
208
|
+
};
|
|
199
209
|
}, {
|
|
200
210
|
channels: Record<string, z.objectInputType<{
|
|
201
211
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -216,6 +226,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
216
226
|
maxConcurrentSessions?: number | undefined;
|
|
217
227
|
sessionTimeoutMinutes?: number | undefined;
|
|
218
228
|
} | undefined;
|
|
229
|
+
logging?: {
|
|
230
|
+
level?: "fatal" | "error" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
231
|
+
logDir?: string | undefined;
|
|
232
|
+
maxFileSize?: string | number | undefined;
|
|
233
|
+
maxFiles?: number | undefined;
|
|
234
|
+
sessionLogRetentionDays?: number | undefined;
|
|
235
|
+
} | undefined;
|
|
219
236
|
}>;
|
|
220
237
|
type Config = z.infer<typeof ConfigSchema>;
|
|
221
238
|
declare function expandHome(p: string): string;
|
|
@@ -234,6 +251,61 @@ declare class ConfigManager {
|
|
|
234
251
|
private deepMerge;
|
|
235
252
|
}
|
|
236
253
|
|
|
254
|
+
type Logger = pino.Logger;
|
|
255
|
+
declare const log: {
|
|
256
|
+
info: (...args: unknown[]) => void;
|
|
257
|
+
warn: (...args: unknown[]) => void;
|
|
258
|
+
error: (...args: unknown[]) => void;
|
|
259
|
+
debug: (...args: unknown[]) => void;
|
|
260
|
+
fatal: (...args: unknown[]) => void;
|
|
261
|
+
child: (bindings: pino.Bindings) => pino.Logger<never, boolean>;
|
|
262
|
+
};
|
|
263
|
+
declare function initLogger(config: LoggingConfig): Logger;
|
|
264
|
+
declare function createChildLogger(context: {
|
|
265
|
+
module: string;
|
|
266
|
+
[key: string]: unknown;
|
|
267
|
+
}): Logger;
|
|
268
|
+
declare function createSessionLogger(sessionId: string, parentLogger: Logger): Logger;
|
|
269
|
+
declare function shutdownLogger(): Promise<void>;
|
|
270
|
+
declare function cleanupOldSessionLogs(retentionDays: number): Promise<void>;
|
|
271
|
+
|
|
272
|
+
interface ChannelConfig {
|
|
273
|
+
enabled: boolean;
|
|
274
|
+
[key: string]: unknown;
|
|
275
|
+
}
|
|
276
|
+
declare abstract class ChannelAdapter {
|
|
277
|
+
protected core: any;
|
|
278
|
+
protected config: ChannelConfig;
|
|
279
|
+
constructor(core: any, config: ChannelConfig);
|
|
280
|
+
abstract start(): Promise<void>;
|
|
281
|
+
abstract stop(): Promise<void>;
|
|
282
|
+
abstract sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
283
|
+
abstract sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
|
|
284
|
+
abstract sendNotification(notification: NotificationMessage): Promise<void>;
|
|
285
|
+
abstract createSessionThread(sessionId: string, name: string): Promise<string>;
|
|
286
|
+
abstract renameSessionThread(sessionId: string, newName: string): Promise<void>;
|
|
287
|
+
sendSkillCommands(_sessionId: string, _commands: AgentCommand[]): Promise<void>;
|
|
288
|
+
cleanupSkillCommands(_sessionId: string): Promise<void>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
declare class NotificationManager {
|
|
292
|
+
private adapters;
|
|
293
|
+
constructor(adapters: Map<string, ChannelAdapter>);
|
|
294
|
+
notify(channelId: string, notification: NotificationMessage): Promise<void>;
|
|
295
|
+
notifyAll(notification: NotificationMessage): Promise<void>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
declare function nodeToWebWritable(nodeStream: Writable): WritableStream<Uint8Array>;
|
|
299
|
+
declare function nodeToWebReadable(nodeStream: Readable): ReadableStream<Uint8Array>;
|
|
300
|
+
|
|
301
|
+
declare class StderrCapture {
|
|
302
|
+
private maxLines;
|
|
303
|
+
private lines;
|
|
304
|
+
constructor(maxLines?: number);
|
|
305
|
+
append(chunk: string): void;
|
|
306
|
+
getLastLines(): string;
|
|
307
|
+
}
|
|
308
|
+
|
|
237
309
|
declare class AgentInstance {
|
|
238
310
|
private connection;
|
|
239
311
|
private child;
|
|
@@ -276,6 +348,7 @@ declare class Session {
|
|
|
276
348
|
requestId: string;
|
|
277
349
|
resolve: (optionId: string) => void;
|
|
278
350
|
};
|
|
351
|
+
log: Logger;
|
|
279
352
|
constructor(opts: {
|
|
280
353
|
id?: string;
|
|
281
354
|
channelId: string;
|
|
@@ -286,6 +359,8 @@ declare class Session {
|
|
|
286
359
|
enqueuePrompt(text: string): Promise<void>;
|
|
287
360
|
private runPrompt;
|
|
288
361
|
private autoName;
|
|
362
|
+
/** Fire-and-forget warm-up: primes model cache while user types their first message */
|
|
363
|
+
warmup(): Promise<void>;
|
|
289
364
|
cancel(): Promise<void>;
|
|
290
365
|
destroy(): Promise<void>;
|
|
291
366
|
}
|
|
@@ -326,4 +401,37 @@ declare function uninstallPlugin(packageName: string): void;
|
|
|
326
401
|
declare function listPlugins(): Record<string, string>;
|
|
327
402
|
declare function loadAdapterFactory(packageName: string): Promise<AdapterFactory | null>;
|
|
328
403
|
|
|
329
|
-
|
|
404
|
+
interface TelegramChannelConfig {
|
|
405
|
+
enabled: boolean;
|
|
406
|
+
botToken: string;
|
|
407
|
+
chatId: number;
|
|
408
|
+
notificationTopicId: number | null;
|
|
409
|
+
assistantTopicId: number | null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
declare class TelegramAdapter extends ChannelAdapter {
|
|
413
|
+
private bot;
|
|
414
|
+
private telegramConfig;
|
|
415
|
+
private sessionDrafts;
|
|
416
|
+
private toolCallMessages;
|
|
417
|
+
private permissionHandler;
|
|
418
|
+
private assistantSession;
|
|
419
|
+
private notificationTopicId;
|
|
420
|
+
private assistantTopicId;
|
|
421
|
+
private skillMessages;
|
|
422
|
+
constructor(core: OpenACPCore, config: TelegramChannelConfig);
|
|
423
|
+
start(): Promise<void>;
|
|
424
|
+
stop(): Promise<void>;
|
|
425
|
+
private setupRoutes;
|
|
426
|
+
sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
427
|
+
sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
|
|
428
|
+
sendNotification(notification: NotificationMessage): Promise<void>;
|
|
429
|
+
createSessionThread(sessionId: string, name: string): Promise<string>;
|
|
430
|
+
renameSessionThread(sessionId: string, newName: string): Promise<void>;
|
|
431
|
+
sendSkillCommands(sessionId: string, commands: AgentCommand[]): Promise<void>;
|
|
432
|
+
cleanupSkillCommands(sessionId: string): Promise<void>;
|
|
433
|
+
private updateCommandAutocomplete;
|
|
434
|
+
private finalizeDraft;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export { type AdapterFactory, type AgentCommand, type AgentDefinition, type AgentEvent, AgentInstance, AgentManager, ChannelAdapter, type ChannelConfig, type Config, ConfigManager, type IncomingMessage, type Logger, type LoggingConfig, NotificationManager, type NotificationMessage, OpenACPCore, type OutgoingMessage, PLUGINS_DIR, type PermissionOption, type PermissionRequest, type PlanEntry, Session, SessionManager, type SessionStatus, StderrCapture, TelegramAdapter, cleanupOldSessionLogs, createChildLogger, createSessionLogger, expandHome, initLogger, installPlugin, listPlugins, loadAdapterFactory, log, nodeToWebReadable, nodeToWebWritable, shutdownLogger, uninstallPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentInstance,
|
|
3
3
|
AgentManager,
|
|
4
|
+
ChannelAdapter,
|
|
4
5
|
NotificationManager,
|
|
5
6
|
OpenACPCore,
|
|
6
7
|
Session,
|
|
7
8
|
SessionManager,
|
|
8
9
|
StderrCapture,
|
|
10
|
+
TelegramAdapter,
|
|
9
11
|
nodeToWebReadable,
|
|
10
12
|
nodeToWebWritable
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3F7TYQ4H.js";
|
|
12
14
|
import {
|
|
13
15
|
ConfigManager,
|
|
14
16
|
PLUGINS_DIR,
|
|
17
|
+
cleanupOldSessionLogs,
|
|
18
|
+
createChildLogger,
|
|
19
|
+
createSessionLogger,
|
|
15
20
|
expandHome,
|
|
21
|
+
initLogger,
|
|
16
22
|
installPlugin,
|
|
17
23
|
listPlugins,
|
|
18
24
|
loadAdapterFactory,
|
|
19
25
|
log,
|
|
26
|
+
shutdownLogger,
|
|
20
27
|
uninstallPlugin
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
|
|
23
|
-
// packages/core/src/channel.ts
|
|
24
|
-
var ChannelAdapter = class {
|
|
25
|
-
constructor(core, config) {
|
|
26
|
-
this.core = core;
|
|
27
|
-
this.config = config;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
28
|
+
} from "./chunk-5KBEVENA.js";
|
|
30
29
|
export {
|
|
31
30
|
AgentInstance,
|
|
32
31
|
AgentManager,
|
|
@@ -38,13 +37,19 @@ export {
|
|
|
38
37
|
Session,
|
|
39
38
|
SessionManager,
|
|
40
39
|
StderrCapture,
|
|
40
|
+
TelegramAdapter,
|
|
41
|
+
cleanupOldSessionLogs,
|
|
42
|
+
createChildLogger,
|
|
43
|
+
createSessionLogger,
|
|
41
44
|
expandHome,
|
|
45
|
+
initLogger,
|
|
42
46
|
installPlugin,
|
|
43
47
|
listPlugins,
|
|
44
48
|
loadAdapterFactory,
|
|
45
49
|
log,
|
|
46
50
|
nodeToWebReadable,
|
|
47
51
|
nodeToWebWritable,
|
|
52
|
+
shutdownLogger,
|
|
48
53
|
uninstallPlugin
|
|
49
54
|
};
|
|
50
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
OpenACPCore
|
|
4
|
-
|
|
3
|
+
OpenACPCore,
|
|
4
|
+
TelegramAdapter
|
|
5
|
+
} from "./chunk-3F7TYQ4H.js";
|
|
5
6
|
import {
|
|
6
7
|
ConfigManager,
|
|
8
|
+
cleanupOldSessionLogs,
|
|
9
|
+
initLogger,
|
|
7
10
|
loadAdapterFactory,
|
|
8
|
-
log
|
|
9
|
-
|
|
11
|
+
log,
|
|
12
|
+
shutdownLogger
|
|
13
|
+
} from "./chunk-5KBEVENA.js";
|
|
10
14
|
|
|
11
|
-
//
|
|
15
|
+
// src/main.ts
|
|
12
16
|
var shuttingDown = false;
|
|
13
17
|
async function startServer() {
|
|
14
18
|
const configManager = new ConfigManager();
|
|
15
19
|
const configExists = await configManager.exists();
|
|
16
20
|
if (!configExists) {
|
|
17
|
-
const { runSetup } = await import("./setup-
|
|
21
|
+
const { runSetup } = await import("./setup-4EBTX2NJ.js");
|
|
18
22
|
const shouldStart = await runSetup(configManager);
|
|
19
23
|
if (!shouldStart) process.exit(0);
|
|
20
24
|
}
|
|
21
25
|
await configManager.load();
|
|
22
26
|
const config = configManager.get();
|
|
23
|
-
|
|
27
|
+
initLogger(config.logging);
|
|
28
|
+
log.info({ configPath: configManager.getConfigPath() }, "Config loaded");
|
|
29
|
+
cleanupOldSessionLogs(config.logging.sessionLogRetentionDays).catch(
|
|
30
|
+
(err) => log.warn({ err }, "Session log cleanup failed")
|
|
31
|
+
);
|
|
24
32
|
const core = new OpenACPCore(configManager);
|
|
25
33
|
for (const [channelName, channelConfig] of Object.entries(config.channels)) {
|
|
26
34
|
if (!channelConfig.enabled) continue;
|
|
27
35
|
if (channelName === "telegram") {
|
|
28
|
-
let TelegramAdapter;
|
|
29
|
-
try {
|
|
30
|
-
const mod = await import("@openacp/adapter-telegram");
|
|
31
|
-
TelegramAdapter = mod.TelegramAdapter;
|
|
32
|
-
} catch {
|
|
33
|
-
const adapterPath = new URL("../../adapters/telegram/dist/index.js", import.meta.url).pathname;
|
|
34
|
-
const mod = await import(adapterPath);
|
|
35
|
-
TelegramAdapter = mod.TelegramAdapter;
|
|
36
|
-
}
|
|
37
36
|
core.registerAdapter("telegram", new TelegramAdapter(core, channelConfig));
|
|
38
|
-
log.info(
|
|
37
|
+
log.info({ adapter: "telegram" }, "Adapter registered");
|
|
39
38
|
} else if (channelConfig.adapter) {
|
|
40
39
|
const factory = await loadAdapterFactory(channelConfig.adapter);
|
|
41
40
|
if (factory) {
|
|
42
41
|
const adapter = factory.createAdapter(core, channelConfig);
|
|
43
42
|
core.registerAdapter(channelName, adapter);
|
|
44
|
-
log.info(
|
|
43
|
+
log.info({ adapter: channelName, plugin: channelConfig.adapter }, "Adapter registered");
|
|
45
44
|
} else {
|
|
46
|
-
|
|
45
|
+
const name = channelName;
|
|
46
|
+
const err = channelConfig.adapter;
|
|
47
|
+
log.error({ adapter: name, err }, "Failed to load adapter");
|
|
47
48
|
}
|
|
48
49
|
} else {
|
|
49
|
-
log.error(
|
|
50
|
+
log.error({ adapter: channelName }, 'Channel has no built-in adapter; set "adapter" field to a plugin package');
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
if (core.adapters.size === 0) {
|
|
@@ -54,37 +55,38 @@ async function startServer() {
|
|
|
54
55
|
process.exit(1);
|
|
55
56
|
}
|
|
56
57
|
await core.start();
|
|
57
|
-
const agents = Object.keys(config.agents)
|
|
58
|
-
log.info(
|
|
59
|
-
log.info("Press Ctrl+C to stop
|
|
58
|
+
const agents = Object.keys(config.agents);
|
|
59
|
+
log.info({ agents }, "OpenACP started");
|
|
60
|
+
log.info("Press Ctrl+C to stop");
|
|
60
61
|
const shutdown = async (signal) => {
|
|
61
62
|
if (shuttingDown) return;
|
|
62
63
|
shuttingDown = true;
|
|
63
|
-
log.info(
|
|
64
|
+
log.info({ signal }, "Signal received, shutting down");
|
|
64
65
|
try {
|
|
65
66
|
await core.stop();
|
|
66
67
|
} catch (err) {
|
|
67
|
-
log.error("Error during shutdown
|
|
68
|
+
log.error({ err }, "Error during shutdown");
|
|
68
69
|
}
|
|
70
|
+
await shutdownLogger();
|
|
69
71
|
process.exit(0);
|
|
70
72
|
};
|
|
71
73
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
72
74
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
73
75
|
process.on("uncaughtException", (err) => {
|
|
74
|
-
log.error("Uncaught exception
|
|
76
|
+
log.error({ err }, "Uncaught exception");
|
|
75
77
|
});
|
|
76
78
|
process.on("unhandledRejection", (err) => {
|
|
77
|
-
log.error("Unhandled rejection
|
|
79
|
+
log.error({ err }, "Unhandled rejection");
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
var isDirectExecution = process.argv[1]?.endsWith("main.js");
|
|
81
83
|
if (isDirectExecution) {
|
|
82
84
|
startServer().catch((err) => {
|
|
83
|
-
log.error("Fatal
|
|
85
|
+
log.error({ err }, "Fatal error");
|
|
84
86
|
process.exit(1);
|
|
85
87
|
});
|
|
86
88
|
}
|
|
87
89
|
export {
|
|
88
90
|
startServer
|
|
89
91
|
};
|
|
90
|
-
//# sourceMappingURL=main-
|
|
92
|
+
//# sourceMappingURL=main-VWRGYSPB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { ConfigManager } from './core/config.js'\nimport { OpenACPCore } from './core/core.js'\nimport { loadAdapterFactory } from './core/plugin-manager.js'\nimport { initLogger, shutdownLogger, cleanupOldSessionLogs, log } from './core/log.js'\nimport { TelegramAdapter } from './adapters/telegram/index.js'\n\nlet shuttingDown = false\n\nexport async function startServer() {\n // 1. Check config exists, run setup if not\n const configManager = new ConfigManager()\n const configExists = await configManager.exists()\n\n if (!configExists) {\n const { runSetup } = await import('./core/setup.js')\n const shouldStart = await runSetup(configManager)\n if (!shouldStart) process.exit(0)\n }\n\n // 2. Load config (validates with Zod)\n await configManager.load()\n const config = configManager.get()\n initLogger(config.logging)\n log.info({ configPath: configManager.getConfigPath() }, 'Config loaded')\n\n // Async cleanup of old session logs (non-blocking)\n cleanupOldSessionLogs(config.logging.sessionLogRetentionDays).catch(err =>\n log.warn({ err }, 'Session log cleanup failed')\n )\n\n // 3. Create core\n const core = new OpenACPCore(configManager)\n\n // 4. Register adapters from config\n for (const [channelName, channelConfig] of Object.entries(config.channels)) {\n if (!channelConfig.enabled) continue\n\n if (channelName === 'telegram') {\n core.registerAdapter('telegram', new TelegramAdapter(core, channelConfig as any))\n log.info({ adapter: 'telegram' }, 'Adapter registered')\n } else if (channelConfig.adapter) {\n // Plugin adapter\n const factory = await loadAdapterFactory(channelConfig.adapter)\n if (factory) {\n const adapter = factory.createAdapter(core, channelConfig)\n core.registerAdapter(channelName, adapter)\n log.info({ adapter: channelName, plugin: channelConfig.adapter }, 'Adapter registered')\n } else {\n const name = channelName\n const err = channelConfig.adapter\n log.error({ adapter: name, err }, 'Failed to load adapter')\n }\n } else {\n log.error({ adapter: channelName }, 'Channel has no built-in adapter; set \"adapter\" field to a plugin package')\n }\n }\n\n if (core.adapters.size === 0) {\n log.error('No channels enabled. Enable at least one channel in config.')\n process.exit(1)\n }\n\n // 5. Start\n await core.start()\n\n // 6. Log ready\n const agents = Object.keys(config.agents)\n log.info({ agents }, 'OpenACP started')\n log.info('Press Ctrl+C to stop')\n\n // 7. Graceful shutdown\n const shutdown = async (signal: string) => {\n if (shuttingDown) return\n shuttingDown = true\n log.info({ signal }, 'Signal received, shutting down')\n\n try {\n await core.stop()\n } catch (err) {\n log.error({ err }, 'Error during shutdown')\n }\n\n await shutdownLogger()\n process.exit(0)\n }\n\n process.on('SIGINT', () => shutdown('SIGINT'))\n process.on('SIGTERM', () => shutdown('SIGTERM'))\n\n process.on('uncaughtException', (err) => {\n log.error({ err }, 'Uncaught exception')\n })\n\n process.on('unhandledRejection', (err) => {\n log.error({ err }, 'Unhandled rejection')\n })\n}\n\n// Direct execution for dev (node dist/main.js)\nconst isDirectExecution = process.argv[1]?.endsWith('main.js')\nif (isDirectExecution) {\n startServer().catch((err) => {\n log.error({ err }, 'Fatal error')\n process.exit(1)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;AAQA,IAAI,eAAe;AAEnB,eAAsB,cAAc;AAElC,QAAM,gBAAgB,IAAI,cAAc;AACxC,QAAM,eAAe,MAAM,cAAc,OAAO;AAEhD,MAAI,CAAC,cAAc;AACjB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AM,KAAK,MAAM;AAGjB,QAAM,SAAS,OAAO,KAAK,OAAO,MAAM;AACxC,MAAI,KAAK,EAAE,OAAO,GAAG,iBAAiB;AACtC,MAAI,KAAK,sBAAsB;AAG/B,QAAM,WAAW,OAAO,WAAmB;AACzC,QAAI,aAAc;AAClB,mBAAe;AACf,QAAI,KAAK,EAAE,OAAO,GAAG,gCAAgC;AAErD,QAAI;AACF,YAAM,KAAK,KAAK;AAAA,IAClB,SAAS,KAAK;AACZ,UAAI,MAAM,EAAE,IAAI,GAAG,uBAAuB;AAAA,IAC5C;AAEA,UAAM,eAAe;AACrB,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,UAAQ,GAAG,UAAU,MAAM,SAAS,QAAQ,CAAC;AAC7C,UAAQ,GAAG,WAAW,MAAM,SAAS,SAAS,CAAC;AAE/C,UAAQ,GAAG,qBAAqB,CAAC,QAAQ;AACvC,QAAI,MAAM,EAAE,IAAI,GAAG,oBAAoB;AAAA,EACzC,CAAC;AAED,UAAQ,GAAG,sBAAsB,CAAC,QAAQ;AACxC,QAAI,MAAM,EAAE,IAAI,GAAG,qBAAqB;AAAA,EAC1C,CAAC;AACH;AAGA,IAAM,oBAAoB,QAAQ,KAAK,CAAC,GAAG,SAAS,SAAS;AAC7D,IAAI,mBAAmB;AACrB,cAAY,EAAE,MAAM,CAAC,QAAQ;AAC3B,QAAI,MAAM,EAAE,IAAI,GAAG,aAAa;AAChC,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/core/setup.ts
|
|
2
2
|
import { execFileSync } from "child_process";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
@@ -177,35 +177,6 @@ async function setupWorkspace() {
|
|
|
177
177
|
});
|
|
178
178
|
return { baseDir: baseDir.trim() };
|
|
179
179
|
}
|
|
180
|
-
async function setupSecurity() {
|
|
181
|
-
console.log("\n--- Step 4: Security Setup ---\n");
|
|
182
|
-
const userIdsStr = await input({
|
|
183
|
-
message: "Allowed Telegram user IDs (comma-separated, or leave empty to allow all):",
|
|
184
|
-
default: ""
|
|
185
|
-
});
|
|
186
|
-
const allowedUserIds = userIdsStr.trim() ? userIdsStr.split(",").map((id) => id.trim()).filter((id) => id.length > 0) : [];
|
|
187
|
-
const maxConcurrentStr = await input({
|
|
188
|
-
message: "Max concurrent sessions:",
|
|
189
|
-
default: "5",
|
|
190
|
-
validate: (val) => {
|
|
191
|
-
const n = Number(val);
|
|
192
|
-
return !isNaN(n) && Number.isInteger(n) && n > 0 || "Must be a positive integer";
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
const timeoutStr = await input({
|
|
196
|
-
message: "Session timeout (minutes):",
|
|
197
|
-
default: "60",
|
|
198
|
-
validate: (val) => {
|
|
199
|
-
const n = Number(val);
|
|
200
|
-
return !isNaN(n) && Number.isInteger(n) && n > 0 || "Must be a positive integer";
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
return {
|
|
204
|
-
allowedUserIds,
|
|
205
|
-
maxConcurrentSessions: Number(maxConcurrentStr),
|
|
206
|
-
sessionTimeoutMinutes: Number(timeoutStr)
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
180
|
function printWelcomeBanner() {
|
|
210
181
|
console.log(`
|
|
211
182
|
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
@@ -246,7 +217,8 @@ async function runSetup(configManager) {
|
|
|
246
217
|
agents,
|
|
247
218
|
defaultAgent,
|
|
248
219
|
workspace,
|
|
249
|
-
security
|
|
220
|
+
security,
|
|
221
|
+
logging: { level: "info", logDir: "~/.openacp/logs", maxFileSize: "10m", maxFiles: 7, sessionLogRetentionDays: 30 }
|
|
250
222
|
};
|
|
251
223
|
printConfigSummary(config);
|
|
252
224
|
try {
|
|
@@ -274,11 +246,10 @@ export {
|
|
|
274
246
|
detectAgents,
|
|
275
247
|
runSetup,
|
|
276
248
|
setupAgents,
|
|
277
|
-
setupSecurity,
|
|
278
249
|
setupTelegram,
|
|
279
250
|
setupWorkspace,
|
|
280
251
|
validateAgentCommand,
|
|
281
252
|
validateBotToken,
|
|
282
253
|
validateChatId
|
|
283
254
|
};
|
|
284
|
-
//# sourceMappingURL=setup-
|
|
255
|
+
//# sourceMappingURL=setup-4EBTX2NJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/setup.ts"],"sourcesContent":["import { execFileSync } from 'node:child_process'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { input, select } from '@inquirer/prompts'\nimport type { Config, ConfigManager } from './config.js'\n\n// --- Telegram validation ---\n\nexport async function validateBotToken(token: string): Promise<\n { ok: true; botName: string; botUsername: string } | { ok: false; error: string }\n> {\n try {\n const res = await fetch(`https://api.telegram.org/bot${token}/getMe`)\n const data = await res.json() as { ok: boolean; result?: { first_name: string; username: string }; description?: string }\n if (data.ok && data.result) {\n return { ok: true, botName: data.result.first_name, botUsername: data.result.username }\n }\n return { ok: false, error: data.description || 'Invalid token' }\n } catch (err) {\n return { ok: false, error: (err as Error).message }\n }\n}\n\nexport async function validateChatId(token: string, chatId: number): Promise<\n { ok: true; title: string; isForum: boolean } | { ok: false; error: string }\n> {\n try {\n const res = await fetch(`https://api.telegram.org/bot${token}/getChat`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ chat_id: chatId }),\n })\n const data = await res.json() as {\n ok: boolean\n result?: { title: string; type: string; is_forum?: boolean }\n description?: string\n }\n if (!data.ok || !data.result) {\n return { ok: false, error: data.description || 'Invalid chat ID' }\n }\n if (data.result.type !== 'supergroup') {\n return { ok: false, error: `Chat is \"${data.result.type}\", must be a supergroup` }\n }\n return { ok: true, title: data.result.title, isForum: data.result.is_forum === true }\n } catch (err) {\n return { ok: false, error: (err as Error).message }\n }\n}\n\n// --- Agent detection ---\n\n// Commands listed in priority order — first match wins per agent\nconst KNOWN_AGENTS: Array<{ name: string; commands: string[] }> = [\n { name: 'claude', commands: ['claude-agent-acp', 'claude-code', 'claude'] },\n { name: 'codex', commands: ['codex'] },\n]\n\nfunction commandExists(cmd: string): boolean {\n // Check system PATH\n try {\n execFileSync('which', [cmd], { stdio: 'pipe' })\n return true\n } catch {\n // not in PATH\n }\n // Check node_modules/.bin (walks up from cwd)\n let dir = process.cwd()\n while (true) {\n const binPath = path.join(dir, 'node_modules', '.bin', cmd)\n if (fs.existsSync(binPath)) return true\n const parent = path.dirname(dir)\n if (parent === dir) break\n dir = parent\n }\n return false\n}\n\nexport async function detectAgents(): Promise<Array<{ name: string; command: string }>> {\n const found: Array<{ name: string; command: string }> = []\n for (const agent of KNOWN_AGENTS) {\n // Find all available commands for this agent (PATH + node_modules/.bin)\n const available: string[] = []\n for (const cmd of agent.commands) {\n if (commandExists(cmd)) {\n available.push(cmd)\n }\n }\n if (available.length > 0) {\n // Prefer claude-agent-acp over claude/claude-code (priority order)\n const preferred = available[0]\n found.push({ name: agent.name, command: preferred })\n }\n }\n return found\n}\n\nexport async function validateAgentCommand(command: string): Promise<boolean> {\n try {\n execFileSync('which', [command], { stdio: 'pipe' })\n return true\n } catch {\n return false\n }\n}\n\n// --- Setup steps ---\n\nexport async function setupTelegram(): Promise<Config['channels'][string]> {\n console.log('\\n--- Step 1: Telegram Setup ---\\n')\n\n let botToken = ''\n let botUsername = ''\n let botName = ''\n\n while (true) {\n botToken = await input({\n message: 'Telegram bot token (from @BotFather):',\n validate: (val) => val.trim().length > 0 || 'Token cannot be empty',\n })\n botToken = botToken.trim()\n\n console.log('Validating bot token...')\n const result = await validateBotToken(botToken)\n if (result.ok) {\n botUsername = result.botUsername\n botName = result.botName\n console.log(`✓ Bot \"${botName}\" (@${botUsername}) connected`)\n break\n }\n console.log(`✗ Validation failed: ${result.error}`)\n const action = await select({\n message: 'What would you like to do?',\n choices: [\n { name: 'Re-enter token', value: 'retry' },\n { name: 'Skip validation (use token as-is)', value: 'skip' },\n ],\n })\n if (action === 'skip') break\n }\n\n let chatId = 0\n\n while (true) {\n const chatIdStr = await input({\n message: 'Telegram supergroup chat ID (e.g. -1001234567890):',\n validate: (val) => {\n const n = Number(val.trim())\n if (isNaN(n) || !Number.isInteger(n)) return 'Chat ID must be an integer'\n return true\n },\n })\n chatId = Number(chatIdStr.trim())\n\n console.log('Validating chat ID...')\n const result = await validateChatId(botToken, chatId)\n if (result.ok) {\n if (!result.isForum) {\n console.log(`⚠ Warning: \"${result.title}\" does not have Topics enabled.`)\n console.log(' Please enable Topics in group settings → Topics → Enable.')\n } else {\n console.log(`✓ Connected to \"${result.title}\" (Topics enabled)`)\n }\n break\n }\n console.log(`✗ Validation failed: ${result.error}`)\n if (result.error.includes('must be a supergroup')) {\n console.log(' Tip: Create a Supergroup in Telegram, then enable Topics in group settings.')\n }\n const action = await select({\n message: 'What would you like to do?',\n choices: [\n { name: 'Re-enter chat ID', value: 'retry' },\n { name: 'Skip validation (use chat ID as-is)', value: 'skip' },\n ],\n })\n if (action === 'skip') break\n }\n\n return {\n enabled: true,\n botToken,\n chatId,\n notificationTopicId: null,\n assistantTopicId: null,\n }\n}\n\nexport async function setupAgents(): Promise<{ agents: Config['agents']; defaultAgent: string }> {\n console.log('\\n--- Step 2: Agent Setup ---\\n')\n\n console.log('Detecting agents in PATH...')\n const detected = await detectAgents()\n\n const agents: Config['agents'] = {}\n\n if (detected.length > 0) {\n for (const agent of detected) {\n agents[agent.name] = { command: agent.command, args: [], env: {} }\n }\n console.log(`Found: ${detected.map(a => `${a.name} (${a.command})`).join(', ')}`)\n } else {\n // Fallback to claude-agent-acp as default\n agents['claude'] = { command: 'claude-agent-acp', args: [], env: {} }\n console.log('No agents detected. Using default: claude (claude-agent-acp)')\n }\n\n const defaultAgent = Object.keys(agents)[0]\n console.log(`Default agent: ${defaultAgent}`)\n\n return { agents, defaultAgent }\n}\n\nexport async function setupWorkspace(): Promise<{ baseDir: string }> {\n console.log('\\n--- Step 3: Workspace Setup ---\\n')\n\n const baseDir = await input({\n message: 'Workspace base directory:',\n default: '~/openacp-workspace',\n validate: (val) => val.trim().length > 0 || 'Path cannot be empty',\n })\n\n return { baseDir: baseDir.trim() }\n}\n\n// --- Orchestrator ---\n\nfunction printWelcomeBanner(): void {\n console.log(`\n┌──────────────────────────────────────┐\n│ │\n│ Welcome to OpenACP! │\n│ │\n│ Let's set up your configuration. │\n│ │\n└──────────────────────────────────────┘\n`)\n}\n\nfunction printConfigSummary(config: Config): void {\n console.log('\\n--- Configuration Summary ---\\n')\n\n console.log('Telegram:')\n const tg = config.channels.telegram as Record<string, any> | undefined\n if (tg) {\n const token = String(tg.botToken || '')\n console.log(` Bot token: ${token.slice(0, 8)}...${token.slice(-4)}`)\n console.log(` Chat ID: ${tg.chatId}`)\n }\n\n console.log('\\nAgents:')\n for (const [name, agent] of Object.entries(config.agents)) {\n const marker = name === config.defaultAgent ? ' (default)' : ''\n console.log(` ${name}: ${agent.command}${marker}`)\n }\n\n console.log(`\\nWorkspace: ${config.workspace.baseDir}`)\n}\n\nexport async function runSetup(configManager: ConfigManager): Promise<boolean> {\n printWelcomeBanner()\n\n try {\n const telegram = await setupTelegram()\n const { agents, defaultAgent } = await setupAgents()\n const workspace = await setupWorkspace()\n const security = { allowedUserIds: [] as string[], maxConcurrentSessions: 5, sessionTimeoutMinutes: 60 }\n\n const config: Config = {\n channels: { telegram },\n agents,\n defaultAgent,\n workspace,\n security,\n logging: { level: 'info', logDir: '~/.openacp/logs', maxFileSize: '10m', maxFiles: 7, sessionLogRetentionDays: 30 },\n }\n\n printConfigSummary(config)\n\n try {\n await configManager.writeNew(config)\n } catch (writeErr) {\n console.error(`\\n✗ Failed to write config to ${configManager.getConfigPath()}`)\n console.error(` Error: ${(writeErr as Error).message}`)\n console.error(' Check that you have write permissions to this path.')\n return false\n }\n console.log(`\\n✓ Config saved to ${configManager.getConfigPath()}`)\n console.log('Starting OpenACP...\\n')\n\n return true\n } catch (err) {\n // Ctrl+C from inquirer throws ExitPromptError\n if ((err as Error).name === 'ExitPromptError') {\n console.log('\\nSetup cancelled.')\n return false\n }\n throw err\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,OAAO,cAAc;AAK9B,eAAsB,iBAAiB,OAErC;AACA,MAAI;AACF,UAAM,MAAM,MAAM,MAAM,+BAA+B,KAAK,QAAQ;AACpE,UAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,QAAI,KAAK,MAAM,KAAK,QAAQ;AAC1B,aAAO,EAAE,IAAI,MAAM,SAAS,KAAK,OAAO,YAAY,aAAa,KAAK,OAAO,SAAS;AAAA,IACxF;AACA,WAAO,EAAE,IAAI,OAAO,OAAO,KAAK,eAAe,gBAAgB;AAAA,EACjE,SAAS,KAAK;AACZ,WAAO,EAAE,IAAI,OAAO,OAAQ,IAAc,QAAQ;AAAA,EACpD;AACF;AAEA,eAAsB,eAAe,OAAe,QAElD;AACA,MAAI;AACF,UAAM,MAAM,MAAM,MAAM,+BAA+B,KAAK,YAAY;AAAA,MACtE,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU,EAAE,SAAS,OAAO,CAAC;AAAA,IAC1C,CAAC;AACD,UAAM,OAAO,MAAM,IAAI,KAAK;AAK5B,QAAI,CAAC,KAAK,MAAM,CAAC,KAAK,QAAQ;AAC5B,aAAO,EAAE,IAAI,OAAO,OAAO,KAAK,eAAe,kBAAkB;AAAA,IACnE;AACA,QAAI,KAAK,OAAO,SAAS,cAAc;AACrC,aAAO,EAAE,IAAI,OAAO,OAAO,YAAY,KAAK,OAAO,IAAI,0BAA0B;AAAA,IACnF;AACA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;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,EAAE,OAAO,QAAQ,QAAQ,mBAAmB,aAAa,OAAO,UAAU,GAAG,yBAAyB,GAAG;AAAA,IACpH;AAEA,uBAAmB,MAAM;AAEzB,QAAI;AACF,YAAM,cAAc,SAAS,MAAM;AAAA,IACrC,SAAS,UAAU;AACjB,cAAQ,MAAM;AAAA,mCAAiC,cAAc,cAAc,CAAC,EAAE;AAC9E,cAAQ,MAAM,YAAa,SAAmB,OAAO,EAAE;AACvD,cAAQ,MAAM,uDAAuD;AACrE,aAAO;AAAA,IACT;AACA,YAAQ,IAAI;AAAA,yBAAuB,cAAc,cAAc,CAAC,EAAE;AAClE,YAAQ,IAAI,uBAAuB;AAEnC,WAAO;AAAA,EACT,SAAS,KAAK;AAEZ,QAAK,IAAc,SAAS,mBAAmB;AAC7C,cAAQ,IAAI,oBAAoB;AAChC,aAAO;AAAA,IACT;AACA,UAAM;AAAA,EACR;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openacp/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "Self-hosted bridge for AI coding agents via ACP protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,9 +24,12 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@agentclientprotocol/sdk": "^0.16.0",
|
|
26
26
|
"@inquirer/prompts": "^8.3.2",
|
|
27
|
+
"grammy": "^1.30.0",
|
|
27
28
|
"nanoid": "^5.0.0",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
29
|
+
"pino": "^10.3.1",
|
|
30
|
+
"pino-pretty": "^13.1.3",
|
|
31
|
+
"pino-roll": "^4.0.0",
|
|
32
|
+
"zod": "^3.25.0"
|
|
30
33
|
},
|
|
31
34
|
"repository": {
|
|
32
35
|
"type": "git",
|