@openacp/cli 2026.401.5 → 2026.401.7
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-BOcUuhjt.d.ts +522 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -525
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +5 -0
- package/dist/testing.js +17364 -0
- package/dist/testing.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,476 +1,13 @@
|
|
|
1
|
+
import { A as AgentEvent, a as AgentCapabilities, P as PermissionRequest, b as AgentDefinition, M as McpServerConfig, S as SetConfigOptionValue, c as Attachment, I as InstalledAgent, R as RegistryAgent, d as AgentListItem, e as AvailabilityResult, f as InstallProgress, g as InstallResult, h as SessionStatus, C as ConfigOption, i as AgentSwitchEntry, j as SessionRecord, O as OutgoingMessage, k as IChannelAdapter, N as NotificationMessage, l as StopReason, U as UsageRecord, m as UsageRecordEvent, n as IncomingMessage, D as DisplayVerbosity, o as ChannelConfig, p as AdapterCapabilities, T as ToolCallMeta, V as ViewerLinks, q as OutputMode, r as PlanEntry, s as AgentCommand } from './channel-BOcUuhjt.js';
|
|
2
|
+
export { t as AgentDistribution, u as AuthMethod, v as AuthenticateRequest, w as ChannelAdapter, x as ConfigSelectChoice, y as ConfigSelectGroup, z as ContentBlock, K as KIND_ICONS, B as ModelInfo, E as NewSessionResponse, F as PermissionOption, G as PromptResponse, H as RegistryBinaryTarget, J as RegistryDistribution, L as STATUS_ICONS, Q as SessionListItem, W as SessionListResponse, X as SessionMode, Y as SessionModeState, Z as SessionModelState, _ as TelegramPlatformData, $ as ToolUpdateMeta } from './channel-BOcUuhjt.js';
|
|
1
3
|
import pino from 'pino';
|
|
2
4
|
import * as zod from 'zod';
|
|
3
5
|
import { z, ZodSchema } from 'zod';
|
|
4
6
|
import { EventEmitter } from 'node:events';
|
|
5
|
-
import { SetSessionConfigOptionResponse, ListSessionsResponse, LoadSessionResponse, ForkSessionResponse, PromptResponse
|
|
7
|
+
import { SetSessionConfigOptionResponse, ListSessionsResponse, LoadSessionResponse, ForkSessionResponse, PromptResponse } from '@agentclientprotocol/sdk';
|
|
6
8
|
import { FastifyInstance, FastifyPluginAsync, preHandlerHookHandler, FastifyRequest, FastifyReply } from 'fastify';
|
|
7
9
|
import * as http from 'node:http';
|
|
8
10
|
|
|
9
|
-
type OutputMode = "low" | "medium" | "high";
|
|
10
|
-
/** @deprecated Use OutputMode instead */
|
|
11
|
-
type DisplayVerbosity = OutputMode;
|
|
12
|
-
declare const STATUS_ICONS: Record<string, string>;
|
|
13
|
-
declare const KIND_ICONS: Record<string, string>;
|
|
14
|
-
interface ViewerLinks {
|
|
15
|
-
file?: string;
|
|
16
|
-
diff?: string;
|
|
17
|
-
}
|
|
18
|
-
interface ToolCallMeta {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
kind?: string;
|
|
22
|
-
status?: string;
|
|
23
|
-
content?: unknown;
|
|
24
|
-
rawInput?: unknown;
|
|
25
|
-
viewerLinks?: ViewerLinks;
|
|
26
|
-
viewerFilePath?: string;
|
|
27
|
-
displaySummary?: string;
|
|
28
|
-
displayTitle?: string;
|
|
29
|
-
displayKind?: string;
|
|
30
|
-
}
|
|
31
|
-
interface ToolUpdateMeta extends ToolCallMeta {
|
|
32
|
-
status: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface Attachment {
|
|
36
|
-
type: 'image' | 'audio' | 'file';
|
|
37
|
-
filePath: string;
|
|
38
|
-
fileName: string;
|
|
39
|
-
mimeType: string;
|
|
40
|
-
size: number;
|
|
41
|
-
originalFilePath?: string;
|
|
42
|
-
}
|
|
43
|
-
interface IncomingMessage {
|
|
44
|
-
channelId: string;
|
|
45
|
-
threadId: string;
|
|
46
|
-
userId: string;
|
|
47
|
-
text: string;
|
|
48
|
-
attachments?: Attachment[];
|
|
49
|
-
}
|
|
50
|
-
interface OutgoingMessage {
|
|
51
|
-
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";
|
|
52
|
-
text: string;
|
|
53
|
-
metadata?: Record<string, unknown>;
|
|
54
|
-
attachment?: Attachment;
|
|
55
|
-
}
|
|
56
|
-
interface PermissionRequest {
|
|
57
|
-
id: string;
|
|
58
|
-
description: string;
|
|
59
|
-
options: PermissionOption[];
|
|
60
|
-
}
|
|
61
|
-
interface PermissionOption {
|
|
62
|
-
id: string;
|
|
63
|
-
label: string;
|
|
64
|
-
isAllow: boolean;
|
|
65
|
-
}
|
|
66
|
-
interface NotificationMessage {
|
|
67
|
-
sessionId: string;
|
|
68
|
-
sessionName?: string;
|
|
69
|
-
type: "completed" | "error" | "permission" | "input_required" | "budget_warning";
|
|
70
|
-
summary: string;
|
|
71
|
-
deepLink?: string;
|
|
72
|
-
}
|
|
73
|
-
interface AgentCommand {
|
|
74
|
-
name: string;
|
|
75
|
-
description: string;
|
|
76
|
-
input?: unknown;
|
|
77
|
-
}
|
|
78
|
-
type AgentEvent = {
|
|
79
|
-
type: "text";
|
|
80
|
-
content: string;
|
|
81
|
-
} | {
|
|
82
|
-
type: "thought";
|
|
83
|
-
content: string;
|
|
84
|
-
} | {
|
|
85
|
-
type: "tool_call";
|
|
86
|
-
id: string;
|
|
87
|
-
name: string;
|
|
88
|
-
kind?: string;
|
|
89
|
-
status: string;
|
|
90
|
-
content?: unknown;
|
|
91
|
-
locations?: unknown;
|
|
92
|
-
rawInput?: unknown;
|
|
93
|
-
rawOutput?: unknown;
|
|
94
|
-
meta?: unknown;
|
|
95
|
-
} | {
|
|
96
|
-
type: "tool_update";
|
|
97
|
-
id: string;
|
|
98
|
-
name?: string;
|
|
99
|
-
kind?: string;
|
|
100
|
-
status: string;
|
|
101
|
-
content?: unknown;
|
|
102
|
-
locations?: unknown;
|
|
103
|
-
rawInput?: unknown;
|
|
104
|
-
rawOutput?: unknown;
|
|
105
|
-
meta?: unknown;
|
|
106
|
-
} | {
|
|
107
|
-
type: "plan";
|
|
108
|
-
entries: PlanEntry[];
|
|
109
|
-
} | {
|
|
110
|
-
type: "usage";
|
|
111
|
-
tokensUsed?: number;
|
|
112
|
-
contextSize?: number;
|
|
113
|
-
cost?: {
|
|
114
|
-
amount: number;
|
|
115
|
-
currency: string;
|
|
116
|
-
};
|
|
117
|
-
} | {
|
|
118
|
-
type: "commands_update";
|
|
119
|
-
commands: AgentCommand[];
|
|
120
|
-
} | {
|
|
121
|
-
type: "image_content";
|
|
122
|
-
data: string;
|
|
123
|
-
mimeType: string;
|
|
124
|
-
} | {
|
|
125
|
-
type: "audio_content";
|
|
126
|
-
data: string;
|
|
127
|
-
mimeType: string;
|
|
128
|
-
} | {
|
|
129
|
-
type: "session_end";
|
|
130
|
-
reason: string;
|
|
131
|
-
} | {
|
|
132
|
-
type: "error";
|
|
133
|
-
message: string;
|
|
134
|
-
} | {
|
|
135
|
-
type: "system_message";
|
|
136
|
-
message: string;
|
|
137
|
-
} | {
|
|
138
|
-
type: "session_info_update";
|
|
139
|
-
title?: string;
|
|
140
|
-
updatedAt?: string;
|
|
141
|
-
_meta?: Record<string, unknown>;
|
|
142
|
-
} | {
|
|
143
|
-
type: "config_option_update";
|
|
144
|
-
options: ConfigOption[];
|
|
145
|
-
} | {
|
|
146
|
-
type: "user_message_chunk";
|
|
147
|
-
content: string;
|
|
148
|
-
} | {
|
|
149
|
-
type: "resource_content";
|
|
150
|
-
uri: string;
|
|
151
|
-
name: string;
|
|
152
|
-
text?: string;
|
|
153
|
-
blob?: string;
|
|
154
|
-
mimeType?: string;
|
|
155
|
-
} | {
|
|
156
|
-
type: "resource_link";
|
|
157
|
-
uri: string;
|
|
158
|
-
name: string;
|
|
159
|
-
mimeType?: string;
|
|
160
|
-
title?: string;
|
|
161
|
-
description?: string;
|
|
162
|
-
size?: number;
|
|
163
|
-
} | {
|
|
164
|
-
type: "tts_strip";
|
|
165
|
-
};
|
|
166
|
-
interface PlanEntry {
|
|
167
|
-
content: string;
|
|
168
|
-
status: "pending" | "in_progress" | "completed";
|
|
169
|
-
priority: "high" | "medium" | "low";
|
|
170
|
-
}
|
|
171
|
-
interface AgentDefinition {
|
|
172
|
-
name: string;
|
|
173
|
-
command: string;
|
|
174
|
-
args: string[];
|
|
175
|
-
workingDirectory?: string;
|
|
176
|
-
env?: Record<string, string>;
|
|
177
|
-
}
|
|
178
|
-
type AgentDistribution = "npx" | "uvx" | "binary" | "custom";
|
|
179
|
-
interface InstalledAgent {
|
|
180
|
-
registryId: string | null;
|
|
181
|
-
name: string;
|
|
182
|
-
version: string;
|
|
183
|
-
distribution: AgentDistribution;
|
|
184
|
-
command: string;
|
|
185
|
-
args: string[];
|
|
186
|
-
env: Record<string, string>;
|
|
187
|
-
workingDirectory?: string;
|
|
188
|
-
installedAt: string;
|
|
189
|
-
binaryPath: string | null;
|
|
190
|
-
}
|
|
191
|
-
interface RegistryBinaryTarget {
|
|
192
|
-
archive: string;
|
|
193
|
-
cmd: string;
|
|
194
|
-
args?: string[];
|
|
195
|
-
env?: Record<string, string>;
|
|
196
|
-
}
|
|
197
|
-
interface RegistryDistribution {
|
|
198
|
-
npx?: {
|
|
199
|
-
package: string;
|
|
200
|
-
args?: string[];
|
|
201
|
-
env?: Record<string, string>;
|
|
202
|
-
};
|
|
203
|
-
uvx?: {
|
|
204
|
-
package: string;
|
|
205
|
-
args?: string[];
|
|
206
|
-
env?: Record<string, string>;
|
|
207
|
-
};
|
|
208
|
-
binary?: Record<string, RegistryBinaryTarget>;
|
|
209
|
-
}
|
|
210
|
-
interface RegistryAgent {
|
|
211
|
-
id: string;
|
|
212
|
-
name: string;
|
|
213
|
-
version: string;
|
|
214
|
-
description: string;
|
|
215
|
-
repository?: string;
|
|
216
|
-
website?: string;
|
|
217
|
-
authors?: string[];
|
|
218
|
-
license?: string;
|
|
219
|
-
icon?: string;
|
|
220
|
-
distribution: RegistryDistribution;
|
|
221
|
-
}
|
|
222
|
-
interface AgentListItem {
|
|
223
|
-
key: string;
|
|
224
|
-
registryId: string;
|
|
225
|
-
name: string;
|
|
226
|
-
version: string;
|
|
227
|
-
description?: string;
|
|
228
|
-
distribution: AgentDistribution;
|
|
229
|
-
installed: boolean;
|
|
230
|
-
available: boolean;
|
|
231
|
-
missingDeps?: string[];
|
|
232
|
-
}
|
|
233
|
-
interface AvailabilityResult {
|
|
234
|
-
available: boolean;
|
|
235
|
-
reason?: string;
|
|
236
|
-
missing?: Array<{
|
|
237
|
-
label: string;
|
|
238
|
-
installHint: string;
|
|
239
|
-
}>;
|
|
240
|
-
}
|
|
241
|
-
interface InstallProgress {
|
|
242
|
-
onStart(agentId: string, agentName: string): void | Promise<void>;
|
|
243
|
-
onStep(step: string): void | Promise<void>;
|
|
244
|
-
onDownloadProgress(percent: number): void | Promise<void>;
|
|
245
|
-
onSuccess(agentName: string): void | Promise<void>;
|
|
246
|
-
onError(error: string, hint?: string): void | Promise<void>;
|
|
247
|
-
}
|
|
248
|
-
interface InstallResult {
|
|
249
|
-
ok: boolean;
|
|
250
|
-
agentKey: string;
|
|
251
|
-
error?: string;
|
|
252
|
-
hint?: string;
|
|
253
|
-
setupSteps?: string[];
|
|
254
|
-
}
|
|
255
|
-
type SessionStatus = "initializing" | "active" | "cancelled" | "finished" | "error";
|
|
256
|
-
interface AgentSwitchEntry {
|
|
257
|
-
agentName: string;
|
|
258
|
-
agentSessionId: string;
|
|
259
|
-
switchedAt: string;
|
|
260
|
-
promptCount: number;
|
|
261
|
-
}
|
|
262
|
-
interface SessionRecord<P = Record<string, unknown>> {
|
|
263
|
-
sessionId: string;
|
|
264
|
-
agentSessionId: string;
|
|
265
|
-
originalAgentSessionId?: string;
|
|
266
|
-
agentName: string;
|
|
267
|
-
workingDir: string;
|
|
268
|
-
channelId: string;
|
|
269
|
-
status: SessionStatus;
|
|
270
|
-
createdAt: string;
|
|
271
|
-
lastActiveAt: string;
|
|
272
|
-
name?: string;
|
|
273
|
-
dangerousMode?: boolean;
|
|
274
|
-
clientOverrides?: {
|
|
275
|
-
bypassPermissions?: boolean;
|
|
276
|
-
};
|
|
277
|
-
outputMode?: OutputMode;
|
|
278
|
-
platform: P;
|
|
279
|
-
firstAgent?: string;
|
|
280
|
-
currentPromptCount?: number;
|
|
281
|
-
agentSwitchHistory?: AgentSwitchEntry[];
|
|
282
|
-
acpState?: {
|
|
283
|
-
configOptions?: ConfigOption[];
|
|
284
|
-
agentCapabilities?: AgentCapabilities;
|
|
285
|
-
currentMode?: string;
|
|
286
|
-
availableModes?: SessionMode[];
|
|
287
|
-
currentModel?: string;
|
|
288
|
-
availableModels?: ModelInfo[];
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
interface TelegramPlatformData {
|
|
292
|
-
topicId: number;
|
|
293
|
-
skillMsgId?: number;
|
|
294
|
-
controlMsgId?: number;
|
|
295
|
-
}
|
|
296
|
-
interface UsageRecord {
|
|
297
|
-
id: string;
|
|
298
|
-
sessionId: string;
|
|
299
|
-
agentName: string;
|
|
300
|
-
tokensUsed: number;
|
|
301
|
-
contextSize: number;
|
|
302
|
-
cost?: {
|
|
303
|
-
amount: number;
|
|
304
|
-
currency: string;
|
|
305
|
-
};
|
|
306
|
-
timestamp: string;
|
|
307
|
-
}
|
|
308
|
-
interface UsageRecordEvent {
|
|
309
|
-
sessionId: string;
|
|
310
|
-
agentName: string;
|
|
311
|
-
timestamp: string;
|
|
312
|
-
tokensUsed: number;
|
|
313
|
-
contextSize: number;
|
|
314
|
-
cost?: {
|
|
315
|
-
amount: number;
|
|
316
|
-
currency: string;
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
interface SessionMode {
|
|
320
|
-
id: string;
|
|
321
|
-
name: string;
|
|
322
|
-
description?: string;
|
|
323
|
-
}
|
|
324
|
-
interface SessionModeState {
|
|
325
|
-
currentModeId: string;
|
|
326
|
-
availableModes: SessionMode[];
|
|
327
|
-
}
|
|
328
|
-
interface ConfigSelectChoice {
|
|
329
|
-
value: string;
|
|
330
|
-
name: string;
|
|
331
|
-
description?: string;
|
|
332
|
-
}
|
|
333
|
-
interface ConfigSelectGroup {
|
|
334
|
-
group: string;
|
|
335
|
-
name: string;
|
|
336
|
-
options: ConfigSelectChoice[];
|
|
337
|
-
}
|
|
338
|
-
type ConfigOption = {
|
|
339
|
-
id: string;
|
|
340
|
-
name: string;
|
|
341
|
-
description?: string;
|
|
342
|
-
category?: string;
|
|
343
|
-
type: "select";
|
|
344
|
-
currentValue: string;
|
|
345
|
-
options: (ConfigSelectChoice | ConfigSelectGroup)[];
|
|
346
|
-
_meta?: Record<string, unknown>;
|
|
347
|
-
} | {
|
|
348
|
-
id: string;
|
|
349
|
-
name: string;
|
|
350
|
-
description?: string;
|
|
351
|
-
category?: string;
|
|
352
|
-
type: "boolean";
|
|
353
|
-
currentValue: boolean;
|
|
354
|
-
_meta?: Record<string, unknown>;
|
|
355
|
-
};
|
|
356
|
-
type SetConfigOptionValue = {
|
|
357
|
-
type: "select";
|
|
358
|
-
value: string;
|
|
359
|
-
} | {
|
|
360
|
-
type: "boolean";
|
|
361
|
-
value: boolean;
|
|
362
|
-
};
|
|
363
|
-
interface ModelInfo {
|
|
364
|
-
id: string;
|
|
365
|
-
name: string;
|
|
366
|
-
description?: string;
|
|
367
|
-
}
|
|
368
|
-
interface SessionModelState {
|
|
369
|
-
currentModelId: string;
|
|
370
|
-
availableModels: ModelInfo[];
|
|
371
|
-
}
|
|
372
|
-
interface AgentCapabilities {
|
|
373
|
-
name: string;
|
|
374
|
-
title?: string;
|
|
375
|
-
version?: string;
|
|
376
|
-
loadSession?: boolean;
|
|
377
|
-
promptCapabilities?: {
|
|
378
|
-
image?: boolean;
|
|
379
|
-
audio?: boolean;
|
|
380
|
-
embeddedContext?: boolean;
|
|
381
|
-
};
|
|
382
|
-
sessionCapabilities?: {
|
|
383
|
-
list?: boolean;
|
|
384
|
-
fork?: boolean;
|
|
385
|
-
close?: boolean;
|
|
386
|
-
};
|
|
387
|
-
mcp?: {
|
|
388
|
-
http?: boolean;
|
|
389
|
-
sse?: boolean;
|
|
390
|
-
};
|
|
391
|
-
authMethods?: AuthMethod[];
|
|
392
|
-
}
|
|
393
|
-
interface NewSessionResponse {
|
|
394
|
-
sessionId: string;
|
|
395
|
-
modes?: SessionModeState;
|
|
396
|
-
configOptions?: ConfigOption[];
|
|
397
|
-
models?: SessionModelState;
|
|
398
|
-
}
|
|
399
|
-
type AuthMethod = {
|
|
400
|
-
type: "agent";
|
|
401
|
-
} | {
|
|
402
|
-
type: "env_var";
|
|
403
|
-
name: string;
|
|
404
|
-
description?: string;
|
|
405
|
-
} | {
|
|
406
|
-
type: "terminal";
|
|
407
|
-
};
|
|
408
|
-
interface AuthenticateRequest {
|
|
409
|
-
methodId: string;
|
|
410
|
-
}
|
|
411
|
-
type StopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
|
|
412
|
-
interface PromptResponse {
|
|
413
|
-
stopReason: StopReason;
|
|
414
|
-
_meta?: Record<string, unknown>;
|
|
415
|
-
}
|
|
416
|
-
type ContentBlock = {
|
|
417
|
-
type: "text";
|
|
418
|
-
text: string;
|
|
419
|
-
} | {
|
|
420
|
-
type: "image";
|
|
421
|
-
data: string;
|
|
422
|
-
mimeType: string;
|
|
423
|
-
uri?: string;
|
|
424
|
-
} | {
|
|
425
|
-
type: "audio";
|
|
426
|
-
data: string;
|
|
427
|
-
mimeType: string;
|
|
428
|
-
} | {
|
|
429
|
-
type: "resource";
|
|
430
|
-
resource: {
|
|
431
|
-
uri: string;
|
|
432
|
-
text?: string;
|
|
433
|
-
blob?: string;
|
|
434
|
-
mimeType?: string;
|
|
435
|
-
};
|
|
436
|
-
} | {
|
|
437
|
-
type: "resource_link";
|
|
438
|
-
uri: string;
|
|
439
|
-
name: string;
|
|
440
|
-
mimeType?: string;
|
|
441
|
-
title?: string;
|
|
442
|
-
description?: string;
|
|
443
|
-
size?: number;
|
|
444
|
-
};
|
|
445
|
-
interface SessionListItem {
|
|
446
|
-
sessionId: string;
|
|
447
|
-
title?: string;
|
|
448
|
-
createdAt: string;
|
|
449
|
-
updatedAt?: string;
|
|
450
|
-
_meta?: Record<string, unknown>;
|
|
451
|
-
}
|
|
452
|
-
interface SessionListResponse {
|
|
453
|
-
sessions: SessionListItem[];
|
|
454
|
-
nextCursor?: string;
|
|
455
|
-
}
|
|
456
|
-
type McpServerConfig = {
|
|
457
|
-
type?: "stdio";
|
|
458
|
-
name: string;
|
|
459
|
-
command: string;
|
|
460
|
-
args?: string[];
|
|
461
|
-
env?: Record<string, string>;
|
|
462
|
-
} | {
|
|
463
|
-
type: "http";
|
|
464
|
-
name: string;
|
|
465
|
-
url: string;
|
|
466
|
-
headers?: Record<string, string>;
|
|
467
|
-
} | {
|
|
468
|
-
type: "sse";
|
|
469
|
-
name: string;
|
|
470
|
-
url: string;
|
|
471
|
-
headers?: Record<string, string>;
|
|
472
|
-
};
|
|
473
|
-
|
|
474
11
|
declare const LoggingSchema: z.ZodDefault<z.ZodObject<{
|
|
475
12
|
level: z.ZodDefault<z.ZodEnum<["silent", "debug", "info", "warn", "error", "fatal"]>>;
|
|
476
13
|
logDir: z.ZodDefault<z.ZodString>;
|
|
@@ -1040,62 +577,6 @@ declare function createSessionLogger(sessionId: string, parentLogger: Logger$1):
|
|
|
1040
577
|
declare function shutdownLogger(): Promise<void>;
|
|
1041
578
|
declare function cleanupOldSessionLogs(retentionDays: number): Promise<void>;
|
|
1042
579
|
|
|
1043
|
-
interface ChannelConfig {
|
|
1044
|
-
enabled: boolean;
|
|
1045
|
-
[key: string]: unknown;
|
|
1046
|
-
}
|
|
1047
|
-
interface AdapterCapabilities {
|
|
1048
|
-
streaming: boolean;
|
|
1049
|
-
richFormatting: boolean;
|
|
1050
|
-
threads: boolean;
|
|
1051
|
-
reactions: boolean;
|
|
1052
|
-
fileUpload: boolean;
|
|
1053
|
-
voice: boolean;
|
|
1054
|
-
}
|
|
1055
|
-
interface IChannelAdapter {
|
|
1056
|
-
readonly name: string;
|
|
1057
|
-
readonly capabilities: AdapterCapabilities;
|
|
1058
|
-
start(): Promise<void>;
|
|
1059
|
-
stop(): Promise<void>;
|
|
1060
|
-
sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
1061
|
-
sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
|
|
1062
|
-
sendNotification(notification: NotificationMessage): Promise<void>;
|
|
1063
|
-
createSessionThread(sessionId: string, name: string): Promise<string>;
|
|
1064
|
-
renameSessionThread(sessionId: string, newName: string): Promise<void>;
|
|
1065
|
-
deleteSessionThread?(sessionId: string): Promise<void>;
|
|
1066
|
-
archiveSessionTopic?(sessionId: string): Promise<void>;
|
|
1067
|
-
stripTTSBlock?(sessionId: string): Promise<void>;
|
|
1068
|
-
sendSkillCommands?(sessionId: string, commands: AgentCommand[]): Promise<void>;
|
|
1069
|
-
cleanupSkillCommands?(sessionId: string): Promise<void>;
|
|
1070
|
-
/** Flush skill commands that were queued before threadId was available */
|
|
1071
|
-
flushPendingSkillCommands?(sessionId: string): Promise<void>;
|
|
1072
|
-
cleanupSessionState?(sessionId: string): Promise<void>;
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Base class providing default no-op implementations for optional methods.
|
|
1076
|
-
* Adapters can extend this or implement IChannelAdapter directly.
|
|
1077
|
-
* @deprecated Use MessagingAdapter or StreamAdapter instead. Kept for backward compat during migration.
|
|
1078
|
-
*/
|
|
1079
|
-
declare abstract class ChannelAdapter<TCore = unknown> implements IChannelAdapter {
|
|
1080
|
-
readonly core: TCore;
|
|
1081
|
-
protected config: ChannelConfig;
|
|
1082
|
-
abstract readonly name: string;
|
|
1083
|
-
readonly capabilities: AdapterCapabilities;
|
|
1084
|
-
constructor(core: TCore, config: ChannelConfig);
|
|
1085
|
-
abstract start(): Promise<void>;
|
|
1086
|
-
abstract stop(): Promise<void>;
|
|
1087
|
-
abstract sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
1088
|
-
abstract sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
|
|
1089
|
-
abstract sendNotification(notification: NotificationMessage): Promise<void>;
|
|
1090
|
-
abstract createSessionThread(sessionId: string, name: string): Promise<string>;
|
|
1091
|
-
abstract renameSessionThread(sessionId: string, newName: string): Promise<void>;
|
|
1092
|
-
deleteSessionThread(_sessionId: string): Promise<void>;
|
|
1093
|
-
sendSkillCommands(_sessionId: string, _commands: AgentCommand[]): Promise<void>;
|
|
1094
|
-
cleanupSkillCommands(_sessionId: string): Promise<void>;
|
|
1095
|
-
cleanupSessionState(_sessionId: string): Promise<void>;
|
|
1096
|
-
archiveSessionTopic(_sessionId: string): Promise<void>;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
580
|
declare function nodeToWebWritable(nodeStream: NodeJS.WritableStream): WritableStream<Uint8Array>;
|
|
1100
581
|
declare function nodeToWebReadable(nodeStream: NodeJS.ReadableStream): ReadableStream<Uint8Array>;
|
|
1101
582
|
|
|
@@ -1231,7 +712,7 @@ declare class AgentInstance extends TypedEmitter<AgentInstanceEvents> {
|
|
|
1231
712
|
authenticate(methodId: string): Promise<void>;
|
|
1232
713
|
forkSession(sessionId: string, cwd: string, mcpServers?: McpServerConfig[]): Promise<ForkSessionResponse>;
|
|
1233
714
|
closeSession(sessionId: string): Promise<void>;
|
|
1234
|
-
prompt(text: string, attachments?: Attachment[]): Promise<PromptResponse
|
|
715
|
+
prompt(text: string, attachments?: Attachment[]): Promise<PromptResponse>;
|
|
1235
716
|
cancel(): Promise<void>;
|
|
1236
717
|
destroy(): Promise<void>;
|
|
1237
718
|
}
|
|
@@ -1435,7 +916,7 @@ declare class Session extends TypedEmitter<SessionEvents> {
|
|
|
1435
916
|
get status(): SessionStatus;
|
|
1436
917
|
/** Transition to active — from initializing, error, or cancelled */
|
|
1437
918
|
activate(): void;
|
|
1438
|
-
/** Transition to error — from initializing or active */
|
|
919
|
+
/** Transition to error — from initializing or active. Idempotent if already in error. */
|
|
1439
920
|
fail(reason: string): void;
|
|
1440
921
|
/** Transition to finished — from active only. Emits session_end for backward compat. */
|
|
1441
922
|
finish(reason?: string): void;
|
|
@@ -3319,4 +2800,4 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
3319
2800
|
archiveSessionTopic(sessionId: string): Promise<void>;
|
|
3320
2801
|
}
|
|
3321
2802
|
|
|
3322
|
-
export { ActivityTracker,
|
|
2803
|
+
export { ActivityTracker, AdapterCapabilities, AgentCapabilities, AgentCatalog, AgentCommand, AgentDefinition, AgentEvent, AgentInstance, AgentListItem, AgentManager, AgentStore, AgentSwitchEntry, type ApiConfig, type ApiServerInstance, type ApiServerOptions, type ApiServerService, Attachment, AvailabilityResult, BaseRenderer, type BridgeDeps, CONFIG_REGISTRY, ChannelConfig, type CleanupResult, type CommandArgs, type CommandDef, CommandRegistry, type CommandResponse, type Config, type ConfigFieldDef, ConfigManager$1 as ConfigManager, ConfigOption, ContextManager, type ContextOptions, type ContextProvider, type ContextQuery, type ContextResult, type ContextService, type SessionInfo as ContextSessionInfo, type DeleteTopicResult, DisplaySpecBuilder, DisplayVerbosity, DoctorEngine, type DoctorReport, DraftManager, EntireProvider, EventBus, type EventBusEvents, FileService, type FileServiceInterface, GroqSTT, IChannelAdapter, type IRenderer, IncomingMessage, type InstallContext, InstallProgress, InstallResult, InstalledAgent, type ListItem, type Logger$1 as Logger, type LoggingConfig, McpServerConfig, type MenuOption, MessageTransformer, MessagingAdapter, type MessagingAdapterConfig, type MigrateContext, NotificationManager, NotificationMessage, type NotificationService, OpenACPCore, type OpenACPPlugin, OutgoingMessage, OutputMode, OutputModeResolver, PRODUCT_GUIDE, type PendingFix, PermissionGate, PermissionRequest, PlanEntry, type PluginContext, type PluginPermission, type PluginStorage, PromptQueue, RegistryAgent, type RenderedMessage, SSEManager, type STTOptions, type STTProvider$1 as STTProvider, type STTResult, SecurityGuard, type SecurityService, SendQueue, Session, SessionBridge, type SessionCreateParams, type SessionEvents, SessionFactory, type SessionListResult, SessionManager, SessionRecord, SessionStatus, SetConfigOptionValue, type SettingsAPI, type SideEffectDeps, type SpeechProviderConfig, SpeechService, type SpeechServiceConfig, type SpeechServiceInterface, StaticServer, StderrCapture, StopReason, StreamAdapter, type TTSOptions, type TTSProvider$1 as TTSProvider, type TTSResult, TelegramAdapter, type TerminalIO, ThoughtBuffer, type ThoughtDisplaySpec, ToolCallMeta, ToolCallTracker, type ToolCardSnapshot, ToolCardState, type ToolCardStateConfig, type ToolDisplaySpec, type ToolEntry, ToolStateMap, type TopicInfo, TopicManager, type TunnelServiceInterface, TypedEmitter, type UsageConfig, UsageRecord, UsageRecordEvent, type UsageService, ViewerLinks, cleanupOldSessionLogs, createApiServer, createApiServerService, createChildLogger, createSessionLogger, expandHome, extractContentText, formatTokens, formatToolSummary, formatToolTitle, getConfigValue, getFieldDef, getPidPath, getSafeFields, getStatus, initLogger, installAutoStart, isAutoStartInstalled, isAutoStartSupported, isHotReloadable, log, nodeToWebReadable, nodeToWebWritable, progressBar, resolveOptions, resolveToolIcon, runConfigEditor, setLogLevel, shutdownLogger, splitMessage, startDaemon, stopDaemon, stripCodeFences, truncateContent, uninstallAutoStart };
|
package/dist/index.js
CHANGED
|
@@ -3977,8 +3977,9 @@ var Session = class extends TypedEmitter {
|
|
|
3977
3977
|
activate() {
|
|
3978
3978
|
this.transition("active");
|
|
3979
3979
|
}
|
|
3980
|
-
/** Transition to error — from initializing or active */
|
|
3980
|
+
/** Transition to error — from initializing or active. Idempotent if already in error. */
|
|
3981
3981
|
fail(reason) {
|
|
3982
|
+
if (this._status === "error") return;
|
|
3982
3983
|
this.transition("error");
|
|
3983
3984
|
this.emit("error", new Error(reason));
|
|
3984
3985
|
}
|