@openacp/cli 2026.410.1 → 2026.410.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{channel-CKXNnTy4.d.ts → channel-CFMUPzvH.d.ts} +239 -21
- package/dist/cli.d.ts +21 -0
- package/dist/cli.js +1209 -77
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1999 -35
- package/dist/index.js +1014 -31
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,34 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls how much detail is shown in agent output.
|
|
3
|
+
* - `"low"` — minimal: hides thoughts, usage, noisy tool calls
|
|
4
|
+
* - `"medium"` — balanced: shows tool summaries, hides noise
|
|
5
|
+
* - `"high"` — full: shows everything including tool output and thoughts
|
|
6
|
+
*/
|
|
1
7
|
type OutputMode = "low" | "medium" | "high";
|
|
2
8
|
/** @deprecated Use OutputMode instead */
|
|
3
9
|
type DisplayVerbosity = OutputMode;
|
|
10
|
+
/** Maps tool call status strings to emoji icons for display. */
|
|
4
11
|
declare const STATUS_ICONS: Record<string, string>;
|
|
12
|
+
/** Maps tool kind strings to emoji icons for display. */
|
|
5
13
|
declare const KIND_ICONS: Record<string, string>;
|
|
14
|
+
/** Links to the web viewer for file contents or diffs. */
|
|
6
15
|
interface ViewerLinks {
|
|
7
16
|
file?: string;
|
|
8
17
|
diff?: string;
|
|
9
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Metadata extracted from a tool_call agent event.
|
|
21
|
+
* Carried on OutgoingMessage.metadata for rendering by adapters.
|
|
22
|
+
*/
|
|
10
23
|
interface ToolCallMeta {
|
|
11
24
|
id: string;
|
|
12
25
|
name: string;
|
|
26
|
+
/** Semantic kind (read, edit, execute, search, etc.) used for icon/label selection. */
|
|
13
27
|
kind?: string;
|
|
14
28
|
status?: string;
|
|
15
29
|
content?: unknown;
|
|
16
30
|
rawInput?: unknown;
|
|
17
31
|
viewerLinks?: ViewerLinks;
|
|
18
32
|
viewerFilePath?: string;
|
|
33
|
+
/** Agent-provided summary override (takes precedence over auto-generated summary). */
|
|
19
34
|
displaySummary?: string;
|
|
35
|
+
/** Agent-provided title override (takes precedence over auto-generated title). */
|
|
20
36
|
displayTitle?: string;
|
|
37
|
+
/** Agent-provided kind override (takes precedence over inferred kind). */
|
|
21
38
|
displayKind?: string;
|
|
22
39
|
}
|
|
40
|
+
/** Metadata for a tool_update event — same as ToolCallMeta but status is required. */
|
|
23
41
|
interface ToolUpdateMeta extends ToolCallMeta {
|
|
24
42
|
status: string;
|
|
25
43
|
}
|
|
26
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Immutable context for a single user-prompt → agent-response cycle ("turn").
|
|
47
|
+
*
|
|
48
|
+
* Sealed when a prompt is dequeued from the PromptQueue and cleared after the turn
|
|
49
|
+
* completes. Bridges use this to route agent events to the correct adapter when
|
|
50
|
+
* multiple adapters are attached to the same session.
|
|
51
|
+
*/
|
|
27
52
|
interface TurnContext {
|
|
53
|
+
/** Unique identifier for this turn — shared between message:queued and message:processing events. */
|
|
28
54
|
turnId: string;
|
|
55
|
+
/** The adapter that originated this prompt. */
|
|
29
56
|
sourceAdapterId: string;
|
|
57
|
+
/** Where to send the response: null = silent (suppress), undefined = same as source, string = explicit target. */
|
|
30
58
|
responseAdapterId?: string | null;
|
|
31
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Routing hints attached to an incoming prompt — carried through the queue
|
|
62
|
+
* and used to construct TurnContext when the prompt is dequeued.
|
|
63
|
+
*/
|
|
32
64
|
interface TurnRouting {
|
|
33
65
|
sourceAdapterId: string;
|
|
34
66
|
responseAdapterId?: string | null;
|
|
@@ -47,6 +79,13 @@ declare function createTurnContext(sourceAdapterId: string, responseAdapterId?:
|
|
|
47
79
|
declare function getEffectiveTarget(ctx: TurnContext): string | null;
|
|
48
80
|
declare function isSystemEvent(event: AgentEvent): boolean;
|
|
49
81
|
|
|
82
|
+
/**
|
|
83
|
+
* A file attachment sent to or received from an agent.
|
|
84
|
+
*
|
|
85
|
+
* Agents receive attachments as content blocks in their prompt input.
|
|
86
|
+
* `originalFilePath` preserves the user's original path before any
|
|
87
|
+
* conversion (e.g., audio transcoding or image resizing).
|
|
88
|
+
*/
|
|
50
89
|
interface Attachment {
|
|
51
90
|
type: 'image' | 'audio' | 'file';
|
|
52
91
|
filePath: string;
|
|
@@ -55,6 +94,13 @@ interface Attachment {
|
|
|
55
94
|
size: number;
|
|
56
95
|
originalFilePath?: string;
|
|
57
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* A message arriving from a channel adapter (Telegram, Slack, SSE, etc.)
|
|
99
|
+
* destined for a session's agent.
|
|
100
|
+
*
|
|
101
|
+
* `routing` controls how the message is dispatched when multiple adapters
|
|
102
|
+
* are attached to the same session (e.g., which adapter should receive the response).
|
|
103
|
+
*/
|
|
58
104
|
interface IncomingMessage {
|
|
59
105
|
channelId: string;
|
|
60
106
|
threadId: string;
|
|
@@ -63,41 +109,82 @@ interface IncomingMessage {
|
|
|
63
109
|
attachments?: Attachment[];
|
|
64
110
|
routing?: TurnRouting;
|
|
65
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* A message flowing from the agent back to channel adapters for display.
|
|
114
|
+
*
|
|
115
|
+
* The `type` field determines how the adapter renders the message:
|
|
116
|
+
* - text/thought/plan/error — rendered as formatted text blocks
|
|
117
|
+
* - tool_call/tool_update — rendered as collapsible tool activity
|
|
118
|
+
* - usage — token/cost summary (typically shown in a status bar)
|
|
119
|
+
* - attachment — binary content (image, audio, file)
|
|
120
|
+
* - session_end — signals the agent turn is complete
|
|
121
|
+
* - ACP Phase 2 types (mode_change, config_update, etc.) — interactive controls
|
|
122
|
+
*/
|
|
66
123
|
interface OutgoingMessage {
|
|
67
124
|
type: "text" | "thought" | "tool_call" | "tool_update" | "plan" | "usage" | "session_end" | "error" | "attachment" | "system_message" | "mode_change" | "config_update" | "model_update" | "user_replay" | "resource" | "resource_link";
|
|
68
125
|
text: string;
|
|
69
126
|
metadata?: Record<string, unknown>;
|
|
70
127
|
attachment?: Attachment;
|
|
71
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* A permission request sent by the agent when it needs user approval.
|
|
131
|
+
*
|
|
132
|
+
* The agent blocks until the user picks one of the `options`.
|
|
133
|
+
* PermissionGate holds the request, emits it to adapters via SessionEv,
|
|
134
|
+
* and resumes the agent with the chosen option when resolved.
|
|
135
|
+
*/
|
|
72
136
|
interface PermissionRequest {
|
|
73
137
|
id: string;
|
|
74
138
|
description: string;
|
|
75
139
|
options: PermissionOption[];
|
|
76
140
|
}
|
|
141
|
+
/** A single choice within a permission request (e.g., "Allow once", "Deny"). */
|
|
77
142
|
interface PermissionOption {
|
|
78
143
|
id: string;
|
|
79
144
|
label: string;
|
|
145
|
+
/** Whether this option grants the requested permission. */
|
|
80
146
|
isAllow: boolean;
|
|
81
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* A notification pushed to the user outside of the normal message flow.
|
|
150
|
+
*
|
|
151
|
+
* Used for background alerts when the user isn't actively watching the session
|
|
152
|
+
* (e.g., agent completed, permission needed, budget warning).
|
|
153
|
+
*/
|
|
82
154
|
interface NotificationMessage {
|
|
83
155
|
sessionId: string;
|
|
84
156
|
sessionName?: string;
|
|
85
157
|
type: "completed" | "error" | "permission" | "input_required" | "budget_warning";
|
|
86
158
|
summary: string;
|
|
159
|
+
/** URL to jump directly to the session in the adapter UI. */
|
|
87
160
|
deepLink?: string;
|
|
88
161
|
}
|
|
162
|
+
/** A command exposed by the agent, surfaced as interactive buttons in the chat UI. */
|
|
89
163
|
interface AgentCommand {
|
|
90
164
|
name: string;
|
|
91
165
|
description: string;
|
|
92
166
|
input?: unknown;
|
|
93
167
|
}
|
|
94
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Union of all events that an AgentInstance can emit during a prompt turn.
|
|
170
|
+
*
|
|
171
|
+
* Each variant maps to an ACP protocol event. AgentInstance translates raw
|
|
172
|
+
* ACP SDK events into these normalized types, which then flow through
|
|
173
|
+
* middleware (Hook.AGENT_BEFORE_EVENT) and into SessionBridge for rendering.
|
|
174
|
+
*/
|
|
175
|
+
type AgentEvent =
|
|
176
|
+
/** Streamed text content from the agent's response. */
|
|
177
|
+
{
|
|
95
178
|
type: "text";
|
|
96
179
|
content: string;
|
|
97
|
-
}
|
|
180
|
+
}
|
|
181
|
+
/** Agent's internal reasoning (displayed in a collapsible block). */
|
|
182
|
+
| {
|
|
98
183
|
type: "thought";
|
|
99
184
|
content: string;
|
|
100
|
-
}
|
|
185
|
+
}
|
|
186
|
+
/** Agent started or completed a tool invocation. */
|
|
187
|
+
| {
|
|
101
188
|
type: "tool_call";
|
|
102
189
|
id: string;
|
|
103
190
|
name: string;
|
|
@@ -108,7 +195,9 @@ type AgentEvent = {
|
|
|
108
195
|
rawInput?: unknown;
|
|
109
196
|
rawOutput?: unknown;
|
|
110
197
|
meta?: unknown;
|
|
111
|
-
}
|
|
198
|
+
}
|
|
199
|
+
/** Progress update for an in-flight tool call (partial output, status change). */
|
|
200
|
+
| {
|
|
112
201
|
type: "tool_update";
|
|
113
202
|
id: string;
|
|
114
203
|
name?: string;
|
|
@@ -119,10 +208,14 @@ type AgentEvent = {
|
|
|
119
208
|
rawInput?: unknown;
|
|
120
209
|
rawOutput?: unknown;
|
|
121
210
|
meta?: unknown;
|
|
122
|
-
}
|
|
211
|
+
}
|
|
212
|
+
/** Agent's execution plan with prioritized steps. */
|
|
213
|
+
| {
|
|
123
214
|
type: "plan";
|
|
124
215
|
entries: PlanEntry[];
|
|
125
|
-
}
|
|
216
|
+
}
|
|
217
|
+
/** Token usage and cost report for the current turn. */
|
|
218
|
+
| {
|
|
126
219
|
type: "usage";
|
|
127
220
|
tokensUsed?: number;
|
|
128
221
|
contextSize?: number;
|
|
@@ -130,45 +223,67 @@ type AgentEvent = {
|
|
|
130
223
|
amount: number;
|
|
131
224
|
currency: string;
|
|
132
225
|
};
|
|
133
|
-
}
|
|
226
|
+
}
|
|
227
|
+
/** Agent updated its available slash commands. */
|
|
228
|
+
| {
|
|
134
229
|
type: "commands_update";
|
|
135
230
|
commands: AgentCommand[];
|
|
136
|
-
}
|
|
231
|
+
}
|
|
232
|
+
/** Agent produced an image as output (base64-encoded). */
|
|
233
|
+
| {
|
|
137
234
|
type: "image_content";
|
|
138
235
|
data: string;
|
|
139
236
|
mimeType: string;
|
|
140
|
-
}
|
|
237
|
+
}
|
|
238
|
+
/** Agent produced audio as output (base64-encoded). */
|
|
239
|
+
| {
|
|
141
240
|
type: "audio_content";
|
|
142
241
|
data: string;
|
|
143
242
|
mimeType: string;
|
|
144
|
-
}
|
|
243
|
+
}
|
|
244
|
+
/** Agent ended the session (no more prompts accepted). */
|
|
245
|
+
| {
|
|
145
246
|
type: "session_end";
|
|
146
247
|
reason: string;
|
|
147
|
-
}
|
|
248
|
+
}
|
|
249
|
+
/** Agent-level error (non-fatal — session may continue). */
|
|
250
|
+
| {
|
|
148
251
|
type: "error";
|
|
149
252
|
message: string;
|
|
150
|
-
}
|
|
253
|
+
}
|
|
254
|
+
/** System message injected by OpenACP (not from the agent itself). */
|
|
255
|
+
| {
|
|
151
256
|
type: "system_message";
|
|
152
257
|
message: string;
|
|
153
|
-
}
|
|
258
|
+
}
|
|
259
|
+
/** Agent updated session metadata (title, timestamps). */
|
|
260
|
+
| {
|
|
154
261
|
type: "session_info_update";
|
|
155
262
|
title?: string;
|
|
156
263
|
updatedAt?: string;
|
|
157
264
|
_meta?: Record<string, unknown>;
|
|
158
|
-
}
|
|
265
|
+
}
|
|
266
|
+
/** Agent updated its config options (modes, models, toggles). */
|
|
267
|
+
| {
|
|
159
268
|
type: "config_option_update";
|
|
160
269
|
options: ConfigOption[];
|
|
161
|
-
}
|
|
270
|
+
}
|
|
271
|
+
/** Echoed user message chunk — used for cross-adapter input visibility. */
|
|
272
|
+
| {
|
|
162
273
|
type: "user_message_chunk";
|
|
163
274
|
content: string;
|
|
164
|
-
}
|
|
275
|
+
}
|
|
276
|
+
/** Agent returned a resource's content (file, data). */
|
|
277
|
+
| {
|
|
165
278
|
type: "resource_content";
|
|
166
279
|
uri: string;
|
|
167
280
|
name: string;
|
|
168
281
|
text?: string;
|
|
169
282
|
blob?: string;
|
|
170
283
|
mimeType?: string;
|
|
171
|
-
}
|
|
284
|
+
}
|
|
285
|
+
/** Agent returned a link to a resource (without inline content). */
|
|
286
|
+
| {
|
|
172
287
|
type: "resource_link";
|
|
173
288
|
uri: string;
|
|
174
289
|
name: string;
|
|
@@ -176,14 +291,21 @@ type AgentEvent = {
|
|
|
176
291
|
title?: string;
|
|
177
292
|
description?: string;
|
|
178
293
|
size?: number;
|
|
179
|
-
}
|
|
294
|
+
}
|
|
295
|
+
/** Signals that TTS output should be stripped from the response. */
|
|
296
|
+
| {
|
|
180
297
|
type: "tts_strip";
|
|
181
298
|
};
|
|
299
|
+
/** A single step in an agent's execution plan. */
|
|
182
300
|
interface PlanEntry {
|
|
183
301
|
content: string;
|
|
184
302
|
status: "pending" | "in_progress" | "completed";
|
|
185
303
|
priority: "high" | "medium" | "low";
|
|
186
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Static definition of an agent — the command, args, and environment
|
|
307
|
+
* needed to spawn its subprocess.
|
|
308
|
+
*/
|
|
187
309
|
interface AgentDefinition {
|
|
188
310
|
name: string;
|
|
189
311
|
command: string;
|
|
@@ -191,7 +313,9 @@ interface AgentDefinition {
|
|
|
191
313
|
workingDirectory?: string;
|
|
192
314
|
env?: Record<string, string>;
|
|
193
315
|
}
|
|
316
|
+
/** How the agent is distributed and installed. */
|
|
194
317
|
type AgentDistribution = "npx" | "uvx" | "binary" | "custom";
|
|
318
|
+
/** An agent that has been installed locally and is ready to spawn. */
|
|
195
319
|
interface InstalledAgent {
|
|
196
320
|
registryId: string | null;
|
|
197
321
|
name: string;
|
|
@@ -202,14 +326,17 @@ interface InstalledAgent {
|
|
|
202
326
|
env: Record<string, string>;
|
|
203
327
|
workingDirectory?: string;
|
|
204
328
|
installedAt: string;
|
|
329
|
+
/** Absolute path to the binary on disk (only for "binary" distribution). */
|
|
205
330
|
binaryPath: string | null;
|
|
206
331
|
}
|
|
332
|
+
/** Platform-specific binary download target from the agent registry. */
|
|
207
333
|
interface RegistryBinaryTarget {
|
|
208
334
|
archive: string;
|
|
209
335
|
cmd: string;
|
|
210
336
|
args?: string[];
|
|
211
337
|
env?: Record<string, string>;
|
|
212
338
|
}
|
|
339
|
+
/** Distribution methods available for a registry agent. */
|
|
213
340
|
interface RegistryDistribution {
|
|
214
341
|
npx?: {
|
|
215
342
|
package: string;
|
|
@@ -221,8 +348,10 @@ interface RegistryDistribution {
|
|
|
221
348
|
args?: string[];
|
|
222
349
|
env?: Record<string, string>;
|
|
223
350
|
};
|
|
351
|
+
/** Platform → arch → binary target mapping. */
|
|
224
352
|
binary?: Record<string, RegistryBinaryTarget>;
|
|
225
353
|
}
|
|
354
|
+
/** An agent entry from the remote agent registry. */
|
|
226
355
|
interface RegistryAgent {
|
|
227
356
|
id: string;
|
|
228
357
|
name: string;
|
|
@@ -235,6 +364,7 @@ interface RegistryAgent {
|
|
|
235
364
|
icon?: string;
|
|
236
365
|
distribution: RegistryDistribution;
|
|
237
366
|
}
|
|
367
|
+
/** Merged view of a registry agent with local install status. */
|
|
238
368
|
interface AgentListItem {
|
|
239
369
|
key: string;
|
|
240
370
|
registryId: string;
|
|
@@ -244,8 +374,10 @@ interface AgentListItem {
|
|
|
244
374
|
distribution: AgentDistribution;
|
|
245
375
|
installed: boolean;
|
|
246
376
|
available: boolean;
|
|
377
|
+
/** Runtime dependencies that are missing on this machine. */
|
|
247
378
|
missingDeps?: string[];
|
|
248
379
|
}
|
|
380
|
+
/** Result of checking whether an agent can run on this machine. */
|
|
249
381
|
interface AvailabilityResult {
|
|
250
382
|
available: boolean;
|
|
251
383
|
reason?: string;
|
|
@@ -254,6 +386,7 @@ interface AvailabilityResult {
|
|
|
254
386
|
installHint: string;
|
|
255
387
|
}>;
|
|
256
388
|
}
|
|
389
|
+
/** Callbacks for reporting agent installation progress to the UI. */
|
|
257
390
|
interface InstallProgress {
|
|
258
391
|
onStart(agentId: string, agentName: string): void | Promise<void>;
|
|
259
392
|
onStep(step: string): void | Promise<void>;
|
|
@@ -261,6 +394,7 @@ interface InstallProgress {
|
|
|
261
394
|
onSuccess(agentName: string): void | Promise<void>;
|
|
262
395
|
onError(error: string, hint?: string): void | Promise<void>;
|
|
263
396
|
}
|
|
397
|
+
/** Result of an agent install operation. */
|
|
264
398
|
interface InstallResult {
|
|
265
399
|
ok: boolean;
|
|
266
400
|
agentKey: string;
|
|
@@ -268,13 +402,30 @@ interface InstallResult {
|
|
|
268
402
|
hint?: string;
|
|
269
403
|
setupSteps?: string[];
|
|
270
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* Session lifecycle status.
|
|
407
|
+
*
|
|
408
|
+
* Valid transitions:
|
|
409
|
+
* initializing → active | error
|
|
410
|
+
* active → error | finished | cancelled
|
|
411
|
+
* error → active | cancelled (recovery or user cancels)
|
|
412
|
+
* cancelled → active (user resumes)
|
|
413
|
+
* finished → (terminal — no transitions)
|
|
414
|
+
*/
|
|
271
415
|
type SessionStatus = "initializing" | "active" | "cancelled" | "finished" | "error";
|
|
416
|
+
/** Record of an agent switch within a session (for history tracking). */
|
|
272
417
|
interface AgentSwitchEntry {
|
|
273
418
|
agentName: string;
|
|
274
419
|
agentSessionId: string;
|
|
275
420
|
switchedAt: string;
|
|
276
421
|
promptCount: number;
|
|
277
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* Persisted session state — serialized to the session store (JSON file).
|
|
425
|
+
*
|
|
426
|
+
* Generic parameter `P` is the primary adapter's platform-specific data
|
|
427
|
+
* (e.g., TelegramPlatformData). Additional adapters store data in `platforms`.
|
|
428
|
+
*/
|
|
278
429
|
interface SessionRecord<P = Record<string, unknown>> {
|
|
279
430
|
sessionId: string;
|
|
280
431
|
agentSessionId: string;
|
|
@@ -309,11 +460,13 @@ interface SessionRecord<P = Record<string, unknown>> {
|
|
|
309
460
|
availableModels?: ModelInfo[];
|
|
310
461
|
};
|
|
311
462
|
}
|
|
463
|
+
/** Telegram-specific data stored per session in the session record. */
|
|
312
464
|
interface TelegramPlatformData {
|
|
313
465
|
topicId: number;
|
|
314
466
|
skillMsgId?: number;
|
|
315
467
|
controlMsgId?: number;
|
|
316
468
|
}
|
|
469
|
+
/** A single token usage data point for cost tracking. */
|
|
317
470
|
interface UsageRecord {
|
|
318
471
|
id: string;
|
|
319
472
|
sessionId: string;
|
|
@@ -326,6 +479,7 @@ interface UsageRecord {
|
|
|
326
479
|
};
|
|
327
480
|
timestamp: string;
|
|
328
481
|
}
|
|
482
|
+
/** Usage event emitted on the EventBus for the usage-tracking plugin. */
|
|
329
483
|
interface UsageRecordEvent {
|
|
330
484
|
sessionId: string;
|
|
331
485
|
agentName: string;
|
|
@@ -337,25 +491,36 @@ interface UsageRecordEvent {
|
|
|
337
491
|
currency: string;
|
|
338
492
|
};
|
|
339
493
|
}
|
|
494
|
+
/** An agent operating mode (e.g., "code", "architect", "ask"). */
|
|
340
495
|
interface SessionMode {
|
|
341
496
|
id: string;
|
|
342
497
|
name: string;
|
|
343
498
|
description?: string;
|
|
344
499
|
}
|
|
500
|
+
/** Current mode and all available modes for a session. */
|
|
345
501
|
interface SessionModeState {
|
|
346
502
|
currentModeId: string;
|
|
347
503
|
availableModes: SessionMode[];
|
|
348
504
|
}
|
|
505
|
+
/** A single choice within a select-type config option. */
|
|
349
506
|
interface ConfigSelectChoice {
|
|
350
507
|
value: string;
|
|
351
508
|
name: string;
|
|
352
509
|
description?: string;
|
|
353
510
|
}
|
|
511
|
+
/** A named group of select choices (for categorized dropdowns). */
|
|
354
512
|
interface ConfigSelectGroup {
|
|
355
513
|
group: string;
|
|
356
514
|
name: string;
|
|
357
515
|
options: ConfigSelectChoice[];
|
|
358
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* Agent-exposed configuration options surfaced as interactive controls in chat.
|
|
519
|
+
*
|
|
520
|
+
* These are settings the agent advertises via the ACP config_option_update event.
|
|
521
|
+
* Adapters render them as select menus, toggles, etc. in the chat UI.
|
|
522
|
+
* When the user changes a value, OpenACP sends a setConfigOption request to the agent.
|
|
523
|
+
*/
|
|
359
524
|
type ConfigOption = {
|
|
360
525
|
id: string;
|
|
361
526
|
name: string;
|
|
@@ -374,6 +539,7 @@ type ConfigOption = {
|
|
|
374
539
|
currentValue: boolean;
|
|
375
540
|
_meta?: Record<string, unknown>;
|
|
376
541
|
};
|
|
542
|
+
/** Value payload for updating a config option on the agent. */
|
|
377
543
|
type SetConfigOptionValue = {
|
|
378
544
|
type: "select";
|
|
379
545
|
value: string;
|
|
@@ -381,19 +547,28 @@ type SetConfigOptionValue = {
|
|
|
381
547
|
type: "boolean";
|
|
382
548
|
value: boolean;
|
|
383
549
|
};
|
|
550
|
+
/** An AI model available for the agent to use. */
|
|
384
551
|
interface ModelInfo {
|
|
385
552
|
id: string;
|
|
386
553
|
name: string;
|
|
387
554
|
description?: string;
|
|
388
555
|
}
|
|
556
|
+
/** Current model and all available models for a session. */
|
|
389
557
|
interface SessionModelState {
|
|
390
558
|
currentModelId: string;
|
|
391
559
|
availableModels: ModelInfo[];
|
|
392
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Capabilities advertised by the agent in its initialize response.
|
|
563
|
+
*
|
|
564
|
+
* These determine which ACP features the agent supports — OpenACP uses
|
|
565
|
+
* them to enable/disable UI features (e.g., session list, fork, MCP).
|
|
566
|
+
*/
|
|
393
567
|
interface AgentCapabilities {
|
|
394
568
|
name: string;
|
|
395
569
|
title?: string;
|
|
396
570
|
version?: string;
|
|
571
|
+
/** Whether the agent supports loading (resuming) existing sessions. */
|
|
397
572
|
loadSession?: boolean;
|
|
398
573
|
promptCapabilities?: {
|
|
399
574
|
image?: boolean;
|
|
@@ -411,12 +586,14 @@ interface AgentCapabilities {
|
|
|
411
586
|
};
|
|
412
587
|
authMethods?: AuthMethod[];
|
|
413
588
|
}
|
|
589
|
+
/** Response from the agent when creating a new session. */
|
|
414
590
|
interface NewSessionResponse {
|
|
415
591
|
sessionId: string;
|
|
416
592
|
modes?: SessionModeState;
|
|
417
593
|
configOptions?: ConfigOption[];
|
|
418
594
|
models?: SessionModelState;
|
|
419
595
|
}
|
|
596
|
+
/** Authentication method supported by the agent. */
|
|
420
597
|
type AuthMethod = {
|
|
421
598
|
type: "agent";
|
|
422
599
|
} | {
|
|
@@ -426,14 +603,26 @@ type AuthMethod = {
|
|
|
426
603
|
} | {
|
|
427
604
|
type: "terminal";
|
|
428
605
|
};
|
|
606
|
+
/** Request to authenticate with a specific method. */
|
|
429
607
|
interface AuthenticateRequest {
|
|
430
608
|
methodId: string;
|
|
431
609
|
}
|
|
610
|
+
/**
|
|
611
|
+
* Reason why the agent stopped generating.
|
|
612
|
+
*
|
|
613
|
+
* - end_turn: agent completed its response normally
|
|
614
|
+
* - max_tokens / max_turn_requests: hit a limit
|
|
615
|
+
* - refusal: agent declined the request
|
|
616
|
+
* - cancelled / interrupted: user or system stopped the prompt
|
|
617
|
+
* - error: agent encountered an error
|
|
618
|
+
*/
|
|
432
619
|
type StopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled" | "error" | "interrupted";
|
|
620
|
+
/** Final response from the agent after a prompt completes. */
|
|
433
621
|
interface PromptResponse {
|
|
434
622
|
stopReason: StopReason;
|
|
435
623
|
_meta?: Record<string, unknown>;
|
|
436
624
|
}
|
|
625
|
+
/** A content block within a prompt message sent to the agent. */
|
|
437
626
|
type ContentBlock = {
|
|
438
627
|
type: "text";
|
|
439
628
|
text: string;
|
|
@@ -463,6 +652,7 @@ type ContentBlock = {
|
|
|
463
652
|
description?: string;
|
|
464
653
|
size?: number;
|
|
465
654
|
};
|
|
655
|
+
/** A session entry returned by the agent's session list endpoint. */
|
|
466
656
|
interface SessionListItem {
|
|
467
657
|
sessionId: string;
|
|
468
658
|
title?: string;
|
|
@@ -470,10 +660,12 @@ interface SessionListItem {
|
|
|
470
660
|
updatedAt?: string;
|
|
471
661
|
_meta?: Record<string, unknown>;
|
|
472
662
|
}
|
|
663
|
+
/** Paginated response from the agent's session list endpoint. */
|
|
473
664
|
interface SessionListResponse {
|
|
474
665
|
sessions: SessionListItem[];
|
|
475
666
|
nextCursor?: string;
|
|
476
667
|
}
|
|
668
|
+
/** Configuration for connecting to an MCP (Model Context Protocol) server. */
|
|
477
669
|
type McpServerConfig = {
|
|
478
670
|
type?: "stdio";
|
|
479
671
|
name: string;
|
|
@@ -492,10 +684,18 @@ type McpServerConfig = {
|
|
|
492
684
|
headers?: Record<string, string>;
|
|
493
685
|
};
|
|
494
686
|
|
|
687
|
+
/**
|
|
688
|
+
* Configuration for an adapter channel (Telegram, Slack, etc.).
|
|
689
|
+
* Each adapter defines its own fields beyond `enabled`.
|
|
690
|
+
*/
|
|
495
691
|
interface ChannelConfig {
|
|
496
692
|
enabled: boolean;
|
|
497
693
|
[key: string]: unknown;
|
|
498
694
|
}
|
|
695
|
+
/**
|
|
696
|
+
* Declares what a messaging platform supports. Core uses these to decide
|
|
697
|
+
* whether to attempt features like streaming, file uploads, or voice.
|
|
698
|
+
*/
|
|
499
699
|
interface AdapterCapabilities {
|
|
500
700
|
streaming: boolean;
|
|
501
701
|
richFormatting: boolean;
|
|
@@ -504,6 +704,17 @@ interface AdapterCapabilities {
|
|
|
504
704
|
fileUpload: boolean;
|
|
505
705
|
voice: boolean;
|
|
506
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Contract for a messaging platform adapter.
|
|
709
|
+
*
|
|
710
|
+
* A "channel" in OpenACP is identified by an adapter name (e.g. "telegram", "slack").
|
|
711
|
+
* Each session binds to a channel + thread ID — together they form a unique conversation
|
|
712
|
+
* location. The adapter is responsible for platform-specific I/O: sending messages,
|
|
713
|
+
* creating threads/topics, handling permission buttons, etc.
|
|
714
|
+
*
|
|
715
|
+
* Core calls adapter methods via SessionBridge (for agent events) or directly
|
|
716
|
+
* (for session lifecycle operations like thread creation and archiving).
|
|
717
|
+
*/
|
|
507
718
|
interface IChannelAdapter {
|
|
508
719
|
readonly name: string;
|
|
509
720
|
readonly capabilities: AdapterCapabilities;
|
|
@@ -512,6 +723,7 @@ interface IChannelAdapter {
|
|
|
512
723
|
sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
513
724
|
sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
|
|
514
725
|
sendNotification(notification: NotificationMessage): Promise<void>;
|
|
726
|
+
/** Create a thread/topic for a session. Returns the platform-specific thread ID. */
|
|
515
727
|
createSessionThread(sessionId: string, name: string): Promise<string>;
|
|
516
728
|
renameSessionThread(sessionId: string, newName: string): Promise<void>;
|
|
517
729
|
deleteSessionThread?(sessionId: string): Promise<void>;
|
|
@@ -519,13 +731,19 @@ interface IChannelAdapter {
|
|
|
519
731
|
stripTTSBlock?(sessionId: string): Promise<void>;
|
|
520
732
|
sendSkillCommands?(sessionId: string, commands: AgentCommand[]): Promise<void>;
|
|
521
733
|
cleanupSkillCommands?(sessionId: string): Promise<void>;
|
|
522
|
-
/** Flush skill commands that were queued before threadId was available */
|
|
734
|
+
/** Flush skill commands that were queued before threadId was available. */
|
|
523
735
|
flushPendingSkillCommands?(sessionId: string): Promise<void>;
|
|
524
736
|
cleanupSessionState?(sessionId: string): Promise<void>;
|
|
525
737
|
}
|
|
526
738
|
/**
|
|
527
|
-
*
|
|
528
|
-
*
|
|
739
|
+
* Original base class for channel adapters. Provides default no-op implementations
|
|
740
|
+
* for optional IChannelAdapter methods so subclasses only need to implement the
|
|
741
|
+
* methods they care about.
|
|
742
|
+
*
|
|
743
|
+
* This class predates the adapter-primitives package. It has since been superseded
|
|
744
|
+
* by MessagingAdapter and StreamAdapter, which add structured send queuing, streaming
|
|
745
|
+
* support, and platform-specific rendering out of the box.
|
|
746
|
+
*
|
|
529
747
|
* @deprecated Use MessagingAdapter or StreamAdapter instead. Kept for backward compat during migration.
|
|
530
748
|
*/
|
|
531
749
|
declare abstract class ChannelAdapter<TCore = unknown> implements IChannelAdapter {
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Global instance-targeting flags accepted by every CLI command.
|
|
4
|
+
*
|
|
5
|
+
* These are extracted from argv before Commander parses the command,
|
|
6
|
+
* so they are available uniformly without each subcommand declaring them.
|
|
7
|
+
*/
|
|
2
8
|
interface InstanceFlags {
|
|
9
|
+
/** Use the instance in the current working directory (`.openacp/` in CWD). */
|
|
3
10
|
local: boolean;
|
|
11
|
+
/** Explicit path to the workspace directory (parent of `.openacp/`). */
|
|
4
12
|
dir?: string;
|
|
13
|
+
/** Clone a new instance from this source path. */
|
|
5
14
|
from?: string;
|
|
15
|
+
/** Human-readable label for the instance. */
|
|
6
16
|
name?: string;
|
|
7
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns the instance root resolved during CLI startup.
|
|
20
|
+
*
|
|
21
|
+
* Available to subcommands that need the resolved path without re-resolving it.
|
|
22
|
+
* May be null if the command does not require an instance (e.g., `update`, `adopt`).
|
|
23
|
+
*/
|
|
8
24
|
declare function getResolvedInstanceRoot(): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the global instance-targeting flags parsed from argv.
|
|
27
|
+
*
|
|
28
|
+
* Useful for subcommands that need to inspect raw flags (e.g., to read `--name`).
|
|
29
|
+
*/
|
|
9
30
|
declare function getInstanceFlags(): InstanceFlags;
|
|
10
31
|
|
|
11
32
|
export { type InstanceFlags, getInstanceFlags, getResolvedInstanceRoot };
|