@easbot/acp 0.0.0-stage → 0.3.32

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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +522 -0
  3. package/README.md +667 -2
  4. package/dist/chunks/bootstrap-GGS3N5CF.cjs +1 -0
  5. package/dist/chunks/bootstrap-MZQICOGZ.mjs +1 -0
  6. package/dist/chunks/cache-3R3ORBTY.cjs +1 -0
  7. package/dist/chunks/cache-76CBF3LU.mjs +1 -0
  8. package/dist/chunks/chunk-2KOCPHVP.mjs +1 -0
  9. package/dist/chunks/chunk-33M2R2US.mjs +1 -0
  10. package/dist/chunks/chunk-3DHMW4DB.mjs +11 -0
  11. package/dist/chunks/chunk-5HWD3B3N.cjs +11 -0
  12. package/dist/chunks/chunk-7RWES66A.cjs +2 -0
  13. package/dist/chunks/chunk-B3ANZALB.mjs +2 -0
  14. package/dist/chunks/chunk-BNSJ6COS.cjs +1 -0
  15. package/dist/chunks/chunk-D4TSQ2TT.mjs +0 -0
  16. package/dist/chunks/chunk-D7S7ARXV.mjs +8 -0
  17. package/dist/chunks/chunk-DX35VSAT.cjs +1 -0
  18. package/dist/chunks/chunk-HQBRVVXS.mjs +1 -0
  19. package/dist/chunks/chunk-ITV7SWGU.cjs +8 -0
  20. package/dist/chunks/chunk-JLO7UYKQ.cjs +1 -0
  21. package/dist/chunks/chunk-M2YU5LAI.cjs +1 -0
  22. package/dist/chunks/chunk-NHXAYBZH.mjs +1 -0
  23. package/dist/chunks/chunk-PATHHDWE.mjs +1 -0
  24. package/dist/chunks/chunk-RHW6YR3D.mjs +2 -0
  25. package/dist/chunks/chunk-SNWAB3QJ.cjs +2 -0
  26. package/dist/chunks/chunk-VVGGER23.cjs +1 -0
  27. package/dist/chunks/chunk-Z3YEK7DD.cjs +1 -0
  28. package/dist/chunks/cli-handler-6XB6B5DV.mjs +1 -0
  29. package/dist/chunks/cli-handler-IU3YUTOU.cjs +1 -0
  30. package/dist/chunks/config-FTGKCGYZ.mjs +1 -0
  31. package/dist/chunks/config-ZVDYJ7TW.cjs +1 -0
  32. package/dist/chunks/interfaces-6ZCF5T55.cjs +1 -0
  33. package/dist/chunks/interfaces-TXNKX4HT.mjs +1 -0
  34. package/dist/chunks/loader-3KX33KJQ.cjs +1 -0
  35. package/dist/chunks/loader-6HBCWO6Y.mjs +1 -0
  36. package/dist/chunks/types-BZWPIPG6.mjs +1 -0
  37. package/dist/chunks/types-R3VOD4XE.cjs +1 -0
  38. package/dist/cli.cjs +2 -0
  39. package/dist/cli.d.cts +1 -0
  40. package/dist/cli.d.ts +1 -0
  41. package/dist/cli.mjs +2 -0
  42. package/dist/index.cjs +1 -0
  43. package/dist/index.d.cts +2030 -0
  44. package/dist/index.d.ts +2030 -0
  45. package/dist/index.mjs +1 -0
  46. package/package.json +87 -3
@@ -0,0 +1,2030 @@
1
+ import { ACPInfoACPConfig, ACPClientConfig, ACPClientsConfig, ACPServerConfig as ACPServerConfig$1, IGlobal, IInstance, ModelIdentifier, ChannelType } from '@easbot/types';
2
+ export { ACPAgentRuntimeConfig, ACPAgentRuntimeConfigSchema, ACPClientConfig, ACPClientsConfig, ACPConnectionConfig, ACPConnectionConfigSchema, ACPHttpConnectionConfig, ACPHttpConnectionConfigSchema, ACPInfoACPClientsConfig, ACPInfoACPClientsConfigSchema, ACPInfoACPConfig, ACPInfoACPServerConfig, ACPInfoACPServerConfigSchema, ACPModelConfig, ACPModelConfigSchema, ACPServerConfig, ACPStdioConnectionConfig, ACPStdioConnectionConfigSchema, ACPWebSocketConnectionConfig, ACPWebSocketConnectionConfigSchema, ACP_DEFAULT_CLIENT_CONFIG, ACP_DEFAULT_SERVER_CONFIG, ChannelType } from '@easbot/types';
3
+ import z$1, { z } from 'zod';
4
+ import { NameErrors as NameErrors$1, ACPConnectionRegistryConfig, ACPConnectionResult, ACPConnectionState, ACPRoutingContext, ACPRoutingResult, EasServer } from '@easbot/utils';
5
+ export { ACPComposedContext, ACPConnectionRegistryConfig, ACPConnectionResult, ACPConnectionState, ACPDegradationInfo, ACPHistoryContext, ACPInteractionConfig, ACPInteractionContext, ACPInteractionMessage, ACPRoutingContext, ACPRoutingResult, ServiceError, ServiceError as ServiceErrorInstance } from '@easbot/utils';
6
+ import { EasbotClient, ContextMode } from '@easbot/sdk';
7
+ import { AvailableCommand, SessionConfigOption, SessionNotification, McpServer, Agent, AgentSideConnection, InitializeRequest, InitializeResponse, AuthenticateRequest, AuthenticateResponse, NewSessionRequest, NewSessionResponse, LoadSessionRequest, LoadSessionResponse, PromptRequest, PromptResponse, CancelNotification, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, ListSessionsRequest, ListSessionsResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, CloseSessionRequest, CloseSessionResponse } from '@agentclientprotocol/sdk';
8
+
9
+ type TranslationResources = {
10
+ translation: Record<string, string>;
11
+ cli?: Record<string, string>;
12
+ marketplace?: Record<string, string>;
13
+ workflow?: Record<string, string>;
14
+ mcp?: Record<string, string>;
15
+ };
16
+ declare const languages: {
17
+ value: string;
18
+ name: string;
19
+ example: string;
20
+ supported: boolean;
21
+ }[];
22
+ declare const LanguagesSupported: string[];
23
+ declare const I18n: {
24
+ readonly defaultLocale: "zh-CN";
25
+ readonly timeZone: "Asia/Shanghai";
26
+ readonly locales: string[];
27
+ };
28
+ type Locale = (typeof I18n)['locales'][number];
29
+ type TypeWithI18N<T = string> = {
30
+ [K in Locale]?: T;
31
+ } & {
32
+ zh_CN?: T;
33
+ en_US?: T;
34
+ [key: string]: T | undefined;
35
+ };
36
+ declare const registerI18nResources: (locale: Locale, resources: TranslationResources) => TranslationResources;
37
+ declare const initI18n: (locale?: Locale) => {
38
+ locale: string;
39
+ resources: TranslationResources;
40
+ };
41
+ declare const changeI18nLanguage: (locale: Locale) => {
42
+ locale: string;
43
+ resources: TranslationResources;
44
+ };
45
+ declare const getRegisteredResources: (locale: Locale) => TranslationResources | undefined;
46
+
47
+ interface TranslateOptions {
48
+ locale?: Locale;
49
+ vars?: Record<string, any>;
50
+ fallback?: string;
51
+ }
52
+ declare const translate: (key: string, options?: TranslateOptions) => string;
53
+ declare const t: (key: string, options?: TranslateOptions) => string;
54
+ interface FormatLogOptions extends TranslateOptions {
55
+ context?: Record<string, any>;
56
+ }
57
+ declare const formatLog: (key: string, options?: FormatLogOptions) => {
58
+ message: string;
59
+ locale: string;
60
+ context: Record<string, any>;
61
+ };
62
+
63
+ declare const ACPServerConfigSchema: z.ZodPipe<z.ZodObject<{
64
+ directory: z.ZodDefault<z.ZodString>;
65
+ enabled: z.ZodDefault<z.ZodBoolean>;
66
+ channel: z.ZodDefault<z.ZodPreprocess<z.ZodEnum<{
67
+ stdio: "stdio";
68
+ http: "http";
69
+ websocket: "websocket";
70
+ }>>>;
71
+ port: z.ZodDefault<z.ZodNumber>;
72
+ hostname: z.ZodDefault<z.ZodCustomStringFormat<"hostname">>;
73
+ timeout: z.ZodDefault<z.ZodNumber>;
74
+ name: z.ZodOptional<z.ZodString>;
75
+ agentId: z.ZodOptional<z.ZodString>;
76
+ stdio: z.ZodOptional<z.ZodObject<{
77
+ command: z.ZodString;
78
+ args: z.ZodArray<z.ZodString>;
79
+ }, z.core.$strip>>;
80
+ http: z.ZodOptional<z.ZodObject<{
81
+ baseUrl: z.ZodString;
82
+ timeout: z.ZodDefault<z.ZodNumber>;
83
+ }, z.core.$strip>>;
84
+ ws: z.ZodOptional<z.ZodObject<{
85
+ url: z.ZodString;
86
+ timeout: z.ZodDefault<z.ZodNumber>;
87
+ batchSize: z.ZodDefault<z.ZodNumber>;
88
+ batchInterval: z.ZodDefault<z.ZodNumber>;
89
+ heartbeatInterval: z.ZodDefault<z.ZodNumber>;
90
+ }, z.core.$strip>>;
91
+ agent: z.ZodOptional<z.ZodObject<{
92
+ agent: z.ZodOptional<z.ZodString>;
93
+ model: z.ZodOptional<z.ZodObject<{
94
+ id: z.ZodString;
95
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
96
+ }, z.core.$strip>>;
97
+ }, z.core.$strip>>;
98
+ }, z.core.$strip>, z.ZodTransform<{
99
+ channel: "stdio" | "http" | "websocket";
100
+ directory: string;
101
+ enabled: boolean;
102
+ port: number;
103
+ hostname: string;
104
+ timeout: number;
105
+ name?: string | undefined;
106
+ agentId?: string | undefined;
107
+ stdio?: {
108
+ command: string;
109
+ args: string[];
110
+ } | undefined;
111
+ http?: {
112
+ baseUrl: string;
113
+ timeout: number;
114
+ } | undefined;
115
+ ws?: {
116
+ url: string;
117
+ timeout: number;
118
+ batchSize: number;
119
+ batchInterval: number;
120
+ heartbeatInterval: number;
121
+ } | undefined;
122
+ agent?: {
123
+ agent?: string | undefined;
124
+ model?: {
125
+ id: string;
126
+ options?: Record<string, unknown> | undefined;
127
+ } | undefined;
128
+ } | undefined;
129
+ }, {
130
+ directory: string;
131
+ enabled: boolean;
132
+ channel: "stdio" | "http" | "websocket";
133
+ port: number;
134
+ hostname: string;
135
+ timeout: number;
136
+ name?: string | undefined;
137
+ agentId?: string | undefined;
138
+ stdio?: {
139
+ command: string;
140
+ args: string[];
141
+ } | undefined;
142
+ http?: {
143
+ baseUrl: string;
144
+ timeout: number;
145
+ } | undefined;
146
+ ws?: {
147
+ url: string;
148
+ timeout: number;
149
+ batchSize: number;
150
+ batchInterval: number;
151
+ heartbeatInterval: number;
152
+ } | undefined;
153
+ agent?: {
154
+ agent?: string | undefined;
155
+ model?: {
156
+ id: string;
157
+ options?: Record<string, unknown> | undefined;
158
+ } | undefined;
159
+ } | undefined;
160
+ }>>;
161
+ declare const ACPClientConfigSchema: z.ZodPipe<z.ZodObject<{
162
+ id: z.ZodString;
163
+ type: z.ZodEnum<{
164
+ custom: "custom";
165
+ easbot: "easbot";
166
+ }>;
167
+ name: z.ZodOptional<z.ZodString>;
168
+ agentId: z.ZodOptional<z.ZodString>;
169
+ channel: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
170
+ stdio: "stdio";
171
+ http: "http";
172
+ websocket: "websocket";
173
+ }>>>;
174
+ connection: z.ZodObject<{
175
+ stdio: z.ZodOptional<z.ZodObject<{
176
+ command: z.ZodString;
177
+ args: z.ZodArray<z.ZodString>;
178
+ }, z.core.$strip>>;
179
+ http: z.ZodOptional<z.ZodObject<{
180
+ baseUrl: z.ZodString;
181
+ timeout: z.ZodDefault<z.ZodNumber>;
182
+ }, z.core.$strip>>;
183
+ ws: z.ZodOptional<z.ZodObject<{
184
+ url: z.ZodString;
185
+ timeout: z.ZodDefault<z.ZodNumber>;
186
+ batchSize: z.ZodDefault<z.ZodNumber>;
187
+ batchInterval: z.ZodDefault<z.ZodNumber>;
188
+ heartbeatInterval: z.ZodDefault<z.ZodNumber>;
189
+ }, z.core.$strip>>;
190
+ }, z.core.$strip>;
191
+ autoConnect: z.ZodDefault<z.ZodBoolean>;
192
+ priority: z.ZodDefault<z.ZodNumber>;
193
+ }, z.core.$strip>, z.ZodTransform<{
194
+ channel: "stdio" | "http" | "websocket";
195
+ id: string;
196
+ type: "custom" | "easbot";
197
+ connection: {
198
+ stdio?: {
199
+ command: string;
200
+ args: string[];
201
+ } | undefined;
202
+ http?: {
203
+ baseUrl: string;
204
+ timeout: number;
205
+ } | undefined;
206
+ ws?: {
207
+ url: string;
208
+ timeout: number;
209
+ batchSize: number;
210
+ batchInterval: number;
211
+ heartbeatInterval: number;
212
+ } | undefined;
213
+ };
214
+ autoConnect: boolean;
215
+ priority: number;
216
+ name?: string | undefined;
217
+ agentId?: string | undefined;
218
+ }, {
219
+ id: string;
220
+ type: "custom" | "easbot";
221
+ connection: {
222
+ stdio?: {
223
+ command: string;
224
+ args: string[];
225
+ } | undefined;
226
+ http?: {
227
+ baseUrl: string;
228
+ timeout: number;
229
+ } | undefined;
230
+ ws?: {
231
+ url: string;
232
+ timeout: number;
233
+ batchSize: number;
234
+ batchInterval: number;
235
+ heartbeatInterval: number;
236
+ } | undefined;
237
+ };
238
+ autoConnect: boolean;
239
+ priority: number;
240
+ name?: string | undefined;
241
+ agentId?: string | undefined;
242
+ channel?: "stdio" | "http" | "websocket" | undefined;
243
+ }>>;
244
+ declare const ACPClientsConfigSchema: z.ZodObject<{
245
+ clients: z.ZodArray<z.ZodPipe<z.ZodObject<{
246
+ id: z.ZodString;
247
+ type: z.ZodEnum<{
248
+ custom: "custom";
249
+ easbot: "easbot";
250
+ }>;
251
+ name: z.ZodOptional<z.ZodString>;
252
+ agentId: z.ZodOptional<z.ZodString>;
253
+ channel: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
254
+ stdio: "stdio";
255
+ http: "http";
256
+ websocket: "websocket";
257
+ }>>>;
258
+ connection: z.ZodObject<{
259
+ stdio: z.ZodOptional<z.ZodObject<{
260
+ command: z.ZodString;
261
+ args: z.ZodArray<z.ZodString>;
262
+ }, z.core.$strip>>;
263
+ http: z.ZodOptional<z.ZodObject<{
264
+ baseUrl: z.ZodString;
265
+ timeout: z.ZodDefault<z.ZodNumber>;
266
+ }, z.core.$strip>>;
267
+ ws: z.ZodOptional<z.ZodObject<{
268
+ url: z.ZodString;
269
+ timeout: z.ZodDefault<z.ZodNumber>;
270
+ batchSize: z.ZodDefault<z.ZodNumber>;
271
+ batchInterval: z.ZodDefault<z.ZodNumber>;
272
+ heartbeatInterval: z.ZodDefault<z.ZodNumber>;
273
+ }, z.core.$strip>>;
274
+ }, z.core.$strip>;
275
+ autoConnect: z.ZodDefault<z.ZodBoolean>;
276
+ priority: z.ZodDefault<z.ZodNumber>;
277
+ }, z.core.$strip>, z.ZodTransform<{
278
+ channel: "stdio" | "http" | "websocket";
279
+ id: string;
280
+ type: "custom" | "easbot";
281
+ connection: {
282
+ stdio?: {
283
+ command: string;
284
+ args: string[];
285
+ } | undefined;
286
+ http?: {
287
+ baseUrl: string;
288
+ timeout: number;
289
+ } | undefined;
290
+ ws?: {
291
+ url: string;
292
+ timeout: number;
293
+ batchSize: number;
294
+ batchInterval: number;
295
+ heartbeatInterval: number;
296
+ } | undefined;
297
+ };
298
+ autoConnect: boolean;
299
+ priority: number;
300
+ name?: string | undefined;
301
+ agentId?: string | undefined;
302
+ }, {
303
+ id: string;
304
+ type: "custom" | "easbot";
305
+ connection: {
306
+ stdio?: {
307
+ command: string;
308
+ args: string[];
309
+ } | undefined;
310
+ http?: {
311
+ baseUrl: string;
312
+ timeout: number;
313
+ } | undefined;
314
+ ws?: {
315
+ url: string;
316
+ timeout: number;
317
+ batchSize: number;
318
+ batchInterval: number;
319
+ heartbeatInterval: number;
320
+ } | undefined;
321
+ };
322
+ autoConnect: boolean;
323
+ priority: number;
324
+ name?: string | undefined;
325
+ agentId?: string | undefined;
326
+ channel?: "stdio" | "http" | "websocket" | undefined;
327
+ }>>>;
328
+ defaultClientId: z.ZodOptional<z.ZodString>;
329
+ }, z.core.$strip>;
330
+ declare const ACPInfoACPConfigSchema: z.ZodObject<{
331
+ server: z.ZodOptional<z.ZodPipe<z.ZodObject<{
332
+ directory: z.ZodDefault<z.ZodString>;
333
+ enabled: z.ZodDefault<z.ZodBoolean>;
334
+ channel: z.ZodDefault<z.ZodPreprocess<z.ZodEnum<{
335
+ stdio: "stdio";
336
+ http: "http";
337
+ websocket: "websocket";
338
+ }>>>;
339
+ port: z.ZodDefault<z.ZodNumber>;
340
+ hostname: z.ZodDefault<z.ZodCustomStringFormat<"hostname">>;
341
+ timeout: z.ZodDefault<z.ZodNumber>;
342
+ name: z.ZodOptional<z.ZodString>;
343
+ agentId: z.ZodOptional<z.ZodString>;
344
+ stdio: z.ZodOptional<z.ZodObject<{
345
+ command: z.ZodString;
346
+ args: z.ZodArray<z.ZodString>;
347
+ }, z.core.$strip>>;
348
+ http: z.ZodOptional<z.ZodObject<{
349
+ baseUrl: z.ZodString;
350
+ timeout: z.ZodDefault<z.ZodNumber>;
351
+ }, z.core.$strip>>;
352
+ ws: z.ZodOptional<z.ZodObject<{
353
+ url: z.ZodString;
354
+ timeout: z.ZodDefault<z.ZodNumber>;
355
+ batchSize: z.ZodDefault<z.ZodNumber>;
356
+ batchInterval: z.ZodDefault<z.ZodNumber>;
357
+ heartbeatInterval: z.ZodDefault<z.ZodNumber>;
358
+ }, z.core.$strip>>;
359
+ agent: z.ZodOptional<z.ZodObject<{
360
+ agent: z.ZodOptional<z.ZodString>;
361
+ model: z.ZodOptional<z.ZodObject<{
362
+ id: z.ZodString;
363
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
364
+ }, z.core.$strip>>;
365
+ }, z.core.$strip>>;
366
+ }, z.core.$strip>, z.ZodTransform<{
367
+ channel: "stdio" | "http" | "websocket";
368
+ directory: string;
369
+ enabled: boolean;
370
+ port: number;
371
+ hostname: string;
372
+ timeout: number;
373
+ name?: string | undefined;
374
+ agentId?: string | undefined;
375
+ stdio?: {
376
+ command: string;
377
+ args: string[];
378
+ } | undefined;
379
+ http?: {
380
+ baseUrl: string;
381
+ timeout: number;
382
+ } | undefined;
383
+ ws?: {
384
+ url: string;
385
+ timeout: number;
386
+ batchSize: number;
387
+ batchInterval: number;
388
+ heartbeatInterval: number;
389
+ } | undefined;
390
+ agent?: {
391
+ agent?: string | undefined;
392
+ model?: {
393
+ id: string;
394
+ options?: Record<string, unknown> | undefined;
395
+ } | undefined;
396
+ } | undefined;
397
+ }, {
398
+ directory: string;
399
+ enabled: boolean;
400
+ channel: "stdio" | "http" | "websocket";
401
+ port: number;
402
+ hostname: string;
403
+ timeout: number;
404
+ name?: string | undefined;
405
+ agentId?: string | undefined;
406
+ stdio?: {
407
+ command: string;
408
+ args: string[];
409
+ } | undefined;
410
+ http?: {
411
+ baseUrl: string;
412
+ timeout: number;
413
+ } | undefined;
414
+ ws?: {
415
+ url: string;
416
+ timeout: number;
417
+ batchSize: number;
418
+ batchInterval: number;
419
+ heartbeatInterval: number;
420
+ } | undefined;
421
+ agent?: {
422
+ agent?: string | undefined;
423
+ model?: {
424
+ id: string;
425
+ options?: Record<string, unknown> | undefined;
426
+ } | undefined;
427
+ } | undefined;
428
+ }>>>;
429
+ clients: z.ZodOptional<z.ZodObject<{
430
+ clients: z.ZodArray<z.ZodPipe<z.ZodObject<{
431
+ id: z.ZodString;
432
+ type: z.ZodEnum<{
433
+ custom: "custom";
434
+ easbot: "easbot";
435
+ }>;
436
+ name: z.ZodOptional<z.ZodString>;
437
+ agentId: z.ZodOptional<z.ZodString>;
438
+ channel: z.ZodOptional<z.ZodPreprocess<z.ZodEnum<{
439
+ stdio: "stdio";
440
+ http: "http";
441
+ websocket: "websocket";
442
+ }>>>;
443
+ connection: z.ZodObject<{
444
+ stdio: z.ZodOptional<z.ZodObject<{
445
+ command: z.ZodString;
446
+ args: z.ZodArray<z.ZodString>;
447
+ }, z.core.$strip>>;
448
+ http: z.ZodOptional<z.ZodObject<{
449
+ baseUrl: z.ZodString;
450
+ timeout: z.ZodDefault<z.ZodNumber>;
451
+ }, z.core.$strip>>;
452
+ ws: z.ZodOptional<z.ZodObject<{
453
+ url: z.ZodString;
454
+ timeout: z.ZodDefault<z.ZodNumber>;
455
+ batchSize: z.ZodDefault<z.ZodNumber>;
456
+ batchInterval: z.ZodDefault<z.ZodNumber>;
457
+ heartbeatInterval: z.ZodDefault<z.ZodNumber>;
458
+ }, z.core.$strip>>;
459
+ }, z.core.$strip>;
460
+ autoConnect: z.ZodDefault<z.ZodBoolean>;
461
+ priority: z.ZodDefault<z.ZodNumber>;
462
+ }, z.core.$strip>, z.ZodTransform<{
463
+ channel: "stdio" | "http" | "websocket";
464
+ id: string;
465
+ type: "custom" | "easbot";
466
+ connection: {
467
+ stdio?: {
468
+ command: string;
469
+ args: string[];
470
+ } | undefined;
471
+ http?: {
472
+ baseUrl: string;
473
+ timeout: number;
474
+ } | undefined;
475
+ ws?: {
476
+ url: string;
477
+ timeout: number;
478
+ batchSize: number;
479
+ batchInterval: number;
480
+ heartbeatInterval: number;
481
+ } | undefined;
482
+ };
483
+ autoConnect: boolean;
484
+ priority: number;
485
+ name?: string | undefined;
486
+ agentId?: string | undefined;
487
+ }, {
488
+ id: string;
489
+ type: "custom" | "easbot";
490
+ connection: {
491
+ stdio?: {
492
+ command: string;
493
+ args: string[];
494
+ } | undefined;
495
+ http?: {
496
+ baseUrl: string;
497
+ timeout: number;
498
+ } | undefined;
499
+ ws?: {
500
+ url: string;
501
+ timeout: number;
502
+ batchSize: number;
503
+ batchInterval: number;
504
+ heartbeatInterval: number;
505
+ } | undefined;
506
+ };
507
+ autoConnect: boolean;
508
+ priority: number;
509
+ name?: string | undefined;
510
+ agentId?: string | undefined;
511
+ channel?: "stdio" | "http" | "websocket" | undefined;
512
+ }>>>;
513
+ defaultClientId: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$strip>>;
515
+ client: z.ZodOptional<z.ZodObject<{
516
+ autoRegister: z.ZodDefault<z.ZodBoolean>;
517
+ gatewayUrl: z.ZodOptional<z.ZodURL>;
518
+ }, z.core.$strip>>;
519
+ }, z.core.$strip>;
520
+
521
+ declare function ACPValidateConfig(config: unknown): ACPInfoACPConfig;
522
+ declare function ACPParsePartialConfig(partial: unknown): ACPInfoACPConfig;
523
+
524
+ interface AcpConfigStateResult {
525
+ config: ACPInfoACPConfig;
526
+ cachedConfig: ACPInfoACPConfig | null;
527
+ directories: string[];
528
+ }
529
+ declare function loadConfig(): Promise<ACPInfoACPConfig>;
530
+ declare function getConfig(): ACPInfoACPConfig | null;
531
+ declare function isConfigLoaded(): boolean;
532
+ declare function clearConfigCache(): void;
533
+ declare function reloadConfig(): Promise<ACPInfoACPConfig>;
534
+ declare function getConfigDirectory(): string;
535
+ declare function getServerConfig(): Promise<ACPServerConfig$1>;
536
+ declare function getClientsConfig(): Promise<ACPClientsConfig>;
537
+ declare function getClientById(clientId: string): Promise<ACPClientConfig | undefined>;
538
+ declare function getDefaultClient(): Promise<ACPClientConfig | undefined>;
539
+ declare function getGatewayClientUrl(): Promise<string | undefined>;
540
+
541
+ declare const ACP_JSON_REL_PATH: readonly [".easbot", "acp.json"];
542
+ type StateResult = {
543
+ acpJson: ACPInfoACPConfig | undefined;
544
+ exists: boolean;
545
+ rootDir: string;
546
+ };
547
+ declare namespace AcpCache {
548
+ function state(): Promise<StateResult>;
549
+ function resetState(writtenPath?: string): void;
550
+ function init(): Promise<void>;
551
+ function getAcpJson(): Promise<Record<string, unknown> | undefined>;
552
+ function exists(): Promise<boolean>;
553
+ function getRootDir(): Promise<string>;
554
+ function writeAcpJson(partial: Record<string, unknown>): Promise<Record<string, unknown>>;
555
+ function getConfigPath(): Promise<string>;
556
+ }
557
+
558
+ declare const NameErrors: typeof NameErrors$1;
559
+ declare namespace AcpError {
560
+ const ConfigNotFoundError: {
561
+ new (data: {
562
+ message: string;
563
+ path: string;
564
+ }, options?: ErrorOptions): {
565
+ readonly name: "AcpConfigNotFoundError";
566
+ readonly message: string;
567
+ readonly data: {
568
+ message: string;
569
+ path: string;
570
+ };
571
+ schema(): z$1.ZodObject<{
572
+ name: z$1.ZodLiteral<"AcpConfigNotFoundError">;
573
+ data: z$1.ZodObject<{
574
+ message: z$1.ZodString;
575
+ path: z$1.ZodString;
576
+ }, z$1.core.$strip>;
577
+ }, z$1.core.$strip>;
578
+ toObject(): {
579
+ name: "AcpConfigNotFoundError";
580
+ data: {
581
+ message: string;
582
+ path: string;
583
+ };
584
+ };
585
+ stack?: string;
586
+ cause?: unknown;
587
+ };
588
+ readonly Schema: z$1.ZodObject<{
589
+ name: z$1.ZodLiteral<"AcpConfigNotFoundError">;
590
+ data: z$1.ZodObject<{
591
+ message: z$1.ZodString;
592
+ path: z$1.ZodString;
593
+ }, z$1.core.$strip>;
594
+ }, z$1.core.$strip>;
595
+ isInstance(input: any): input is InstanceType<any>;
596
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
597
+ readonly Unknown: {
598
+ new (data: {
599
+ message: string;
600
+ }, options?: ErrorOptions): {
601
+ readonly name: "UnknownError";
602
+ readonly message: string;
603
+ readonly data: {
604
+ message: string;
605
+ };
606
+ schema(): z$1.ZodObject<{
607
+ name: z$1.ZodLiteral<"UnknownError">;
608
+ data: z$1.ZodObject<{
609
+ message: z$1.ZodString;
610
+ }, z$1.core.$strip>;
611
+ }, z$1.core.$strip>;
612
+ toObject(): {
613
+ name: "UnknownError";
614
+ data: {
615
+ message: string;
616
+ };
617
+ };
618
+ stack?: string;
619
+ cause?: unknown;
620
+ };
621
+ readonly Schema: z$1.ZodObject<{
622
+ name: z$1.ZodLiteral<"UnknownError">;
623
+ data: z$1.ZodObject<{
624
+ message: z$1.ZodString;
625
+ }, z$1.core.$strip>;
626
+ }, z$1.core.$strip>;
627
+ isInstance(input: any): input is {
628
+ readonly name: "UnknownError";
629
+ readonly message: string;
630
+ readonly data: {
631
+ message: string;
632
+ };
633
+ schema(): z$1.ZodObject<{
634
+ name: z$1.ZodLiteral<"UnknownError">;
635
+ data: z$1.ZodObject<{
636
+ message: z$1.ZodString;
637
+ }, z$1.core.$strip>;
638
+ }, z$1.core.$strip>;
639
+ toObject(): {
640
+ name: "UnknownError";
641
+ data: {
642
+ message: string;
643
+ };
644
+ };
645
+ stack?: string;
646
+ cause?: unknown;
647
+ };
648
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
649
+ readonly Unknown: any;
650
+ isError(error: unknown): error is Error;
651
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
652
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
653
+ stackTraceLimit: number;
654
+ };
655
+ isError(error: unknown): error is Error;
656
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
657
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
658
+ stackTraceLimit: number;
659
+ };
660
+ const ConfigValidationError: {
661
+ new (data: {
662
+ message: string;
663
+ path?: string | undefined;
664
+ }, options?: ErrorOptions): {
665
+ readonly name: "AcpConfigValidationError";
666
+ readonly message: string;
667
+ readonly data: {
668
+ message: string;
669
+ path?: string | undefined;
670
+ };
671
+ schema(): z$1.ZodObject<{
672
+ name: z$1.ZodLiteral<"AcpConfigValidationError">;
673
+ data: z$1.ZodObject<{
674
+ message: z$1.ZodString;
675
+ path: z$1.ZodOptional<z$1.ZodString>;
676
+ }, z$1.core.$strip>;
677
+ }, z$1.core.$strip>;
678
+ toObject(): {
679
+ name: "AcpConfigValidationError";
680
+ data: {
681
+ message: string;
682
+ path?: string | undefined;
683
+ };
684
+ };
685
+ stack?: string;
686
+ cause?: unknown;
687
+ };
688
+ readonly Schema: z$1.ZodObject<{
689
+ name: z$1.ZodLiteral<"AcpConfigValidationError">;
690
+ data: z$1.ZodObject<{
691
+ message: z$1.ZodString;
692
+ path: z$1.ZodOptional<z$1.ZodString>;
693
+ }, z$1.core.$strip>;
694
+ }, z$1.core.$strip>;
695
+ isInstance(input: any): input is InstanceType<any>;
696
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
697
+ readonly Unknown: {
698
+ new (data: {
699
+ message: string;
700
+ }, options?: ErrorOptions): {
701
+ readonly name: "UnknownError";
702
+ readonly message: string;
703
+ readonly data: {
704
+ message: string;
705
+ };
706
+ schema(): z$1.ZodObject<{
707
+ name: z$1.ZodLiteral<"UnknownError">;
708
+ data: z$1.ZodObject<{
709
+ message: z$1.ZodString;
710
+ }, z$1.core.$strip>;
711
+ }, z$1.core.$strip>;
712
+ toObject(): {
713
+ name: "UnknownError";
714
+ data: {
715
+ message: string;
716
+ };
717
+ };
718
+ stack?: string;
719
+ cause?: unknown;
720
+ };
721
+ readonly Schema: z$1.ZodObject<{
722
+ name: z$1.ZodLiteral<"UnknownError">;
723
+ data: z$1.ZodObject<{
724
+ message: z$1.ZodString;
725
+ }, z$1.core.$strip>;
726
+ }, z$1.core.$strip>;
727
+ isInstance(input: any): input is {
728
+ readonly name: "UnknownError";
729
+ readonly message: string;
730
+ readonly data: {
731
+ message: string;
732
+ };
733
+ schema(): z$1.ZodObject<{
734
+ name: z$1.ZodLiteral<"UnknownError">;
735
+ data: z$1.ZodObject<{
736
+ message: z$1.ZodString;
737
+ }, z$1.core.$strip>;
738
+ }, z$1.core.$strip>;
739
+ toObject(): {
740
+ name: "UnknownError";
741
+ data: {
742
+ message: string;
743
+ };
744
+ };
745
+ stack?: string;
746
+ cause?: unknown;
747
+ };
748
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
749
+ readonly Unknown: any;
750
+ isError(error: unknown): error is Error;
751
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
752
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
753
+ stackTraceLimit: number;
754
+ };
755
+ isError(error: unknown): error is Error;
756
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
757
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
758
+ stackTraceLimit: number;
759
+ };
760
+ const ServerStartFailedError: {
761
+ new (data: {
762
+ message: string;
763
+ channel?: string | undefined;
764
+ port?: number | undefined;
765
+ code?: string | undefined;
766
+ }, options?: ErrorOptions): {
767
+ readonly name: "AcpServerStartFailedError";
768
+ readonly message: string;
769
+ readonly data: {
770
+ message: string;
771
+ channel?: string | undefined;
772
+ port?: number | undefined;
773
+ code?: string | undefined;
774
+ };
775
+ schema(): z$1.ZodObject<{
776
+ name: z$1.ZodLiteral<"AcpServerStartFailedError">;
777
+ data: z$1.ZodObject<{
778
+ message: z$1.ZodString;
779
+ channel: z$1.ZodOptional<z$1.ZodString>;
780
+ port: z$1.ZodOptional<z$1.ZodNumber>;
781
+ code: z$1.ZodOptional<z$1.ZodString>;
782
+ }, z$1.core.$strip>;
783
+ }, z$1.core.$strip>;
784
+ toObject(): {
785
+ name: "AcpServerStartFailedError";
786
+ data: {
787
+ message: string;
788
+ channel?: string | undefined;
789
+ port?: number | undefined;
790
+ code?: string | undefined;
791
+ };
792
+ };
793
+ stack?: string;
794
+ cause?: unknown;
795
+ };
796
+ readonly Schema: z$1.ZodObject<{
797
+ name: z$1.ZodLiteral<"AcpServerStartFailedError">;
798
+ data: z$1.ZodObject<{
799
+ message: z$1.ZodString;
800
+ channel: z$1.ZodOptional<z$1.ZodString>;
801
+ port: z$1.ZodOptional<z$1.ZodNumber>;
802
+ code: z$1.ZodOptional<z$1.ZodString>;
803
+ }, z$1.core.$strip>;
804
+ }, z$1.core.$strip>;
805
+ isInstance(input: any): input is InstanceType<any>;
806
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
807
+ readonly Unknown: {
808
+ new (data: {
809
+ message: string;
810
+ }, options?: ErrorOptions): {
811
+ readonly name: "UnknownError";
812
+ readonly message: string;
813
+ readonly data: {
814
+ message: string;
815
+ };
816
+ schema(): z$1.ZodObject<{
817
+ name: z$1.ZodLiteral<"UnknownError">;
818
+ data: z$1.ZodObject<{
819
+ message: z$1.ZodString;
820
+ }, z$1.core.$strip>;
821
+ }, z$1.core.$strip>;
822
+ toObject(): {
823
+ name: "UnknownError";
824
+ data: {
825
+ message: string;
826
+ };
827
+ };
828
+ stack?: string;
829
+ cause?: unknown;
830
+ };
831
+ readonly Schema: z$1.ZodObject<{
832
+ name: z$1.ZodLiteral<"UnknownError">;
833
+ data: z$1.ZodObject<{
834
+ message: z$1.ZodString;
835
+ }, z$1.core.$strip>;
836
+ }, z$1.core.$strip>;
837
+ isInstance(input: any): input is {
838
+ readonly name: "UnknownError";
839
+ readonly message: string;
840
+ readonly data: {
841
+ message: string;
842
+ };
843
+ schema(): z$1.ZodObject<{
844
+ name: z$1.ZodLiteral<"UnknownError">;
845
+ data: z$1.ZodObject<{
846
+ message: z$1.ZodString;
847
+ }, z$1.core.$strip>;
848
+ }, z$1.core.$strip>;
849
+ toObject(): {
850
+ name: "UnknownError";
851
+ data: {
852
+ message: string;
853
+ };
854
+ };
855
+ stack?: string;
856
+ cause?: unknown;
857
+ };
858
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
859
+ readonly Unknown: any;
860
+ isError(error: unknown): error is Error;
861
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
862
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
863
+ stackTraceLimit: number;
864
+ };
865
+ isError(error: unknown): error is Error;
866
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
867
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
868
+ stackTraceLimit: number;
869
+ };
870
+ const ClientConnectionFailedError: {
871
+ new (data: {
872
+ message: string;
873
+ clientId?: string | undefined;
874
+ channel?: string | undefined;
875
+ code?: string | undefined;
876
+ }, options?: ErrorOptions): {
877
+ readonly name: "AcpClientConnectionFailedError";
878
+ readonly message: string;
879
+ readonly data: {
880
+ message: string;
881
+ clientId?: string | undefined;
882
+ channel?: string | undefined;
883
+ code?: string | undefined;
884
+ };
885
+ schema(): z$1.ZodObject<{
886
+ name: z$1.ZodLiteral<"AcpClientConnectionFailedError">;
887
+ data: z$1.ZodObject<{
888
+ message: z$1.ZodString;
889
+ clientId: z$1.ZodOptional<z$1.ZodString>;
890
+ channel: z$1.ZodOptional<z$1.ZodString>;
891
+ code: z$1.ZodOptional<z$1.ZodString>;
892
+ }, z$1.core.$strip>;
893
+ }, z$1.core.$strip>;
894
+ toObject(): {
895
+ name: "AcpClientConnectionFailedError";
896
+ data: {
897
+ message: string;
898
+ clientId?: string | undefined;
899
+ channel?: string | undefined;
900
+ code?: string | undefined;
901
+ };
902
+ };
903
+ stack?: string;
904
+ cause?: unknown;
905
+ };
906
+ readonly Schema: z$1.ZodObject<{
907
+ name: z$1.ZodLiteral<"AcpClientConnectionFailedError">;
908
+ data: z$1.ZodObject<{
909
+ message: z$1.ZodString;
910
+ clientId: z$1.ZodOptional<z$1.ZodString>;
911
+ channel: z$1.ZodOptional<z$1.ZodString>;
912
+ code: z$1.ZodOptional<z$1.ZodString>;
913
+ }, z$1.core.$strip>;
914
+ }, z$1.core.$strip>;
915
+ isInstance(input: any): input is InstanceType<any>;
916
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
917
+ readonly Unknown: {
918
+ new (data: {
919
+ message: string;
920
+ }, options?: ErrorOptions): {
921
+ readonly name: "UnknownError";
922
+ readonly message: string;
923
+ readonly data: {
924
+ message: string;
925
+ };
926
+ schema(): z$1.ZodObject<{
927
+ name: z$1.ZodLiteral<"UnknownError">;
928
+ data: z$1.ZodObject<{
929
+ message: z$1.ZodString;
930
+ }, z$1.core.$strip>;
931
+ }, z$1.core.$strip>;
932
+ toObject(): {
933
+ name: "UnknownError";
934
+ data: {
935
+ message: string;
936
+ };
937
+ };
938
+ stack?: string;
939
+ cause?: unknown;
940
+ };
941
+ readonly Schema: z$1.ZodObject<{
942
+ name: z$1.ZodLiteral<"UnknownError">;
943
+ data: z$1.ZodObject<{
944
+ message: z$1.ZodString;
945
+ }, z$1.core.$strip>;
946
+ }, z$1.core.$strip>;
947
+ isInstance(input: any): input is {
948
+ readonly name: "UnknownError";
949
+ readonly message: string;
950
+ readonly data: {
951
+ message: string;
952
+ };
953
+ schema(): z$1.ZodObject<{
954
+ name: z$1.ZodLiteral<"UnknownError">;
955
+ data: z$1.ZodObject<{
956
+ message: z$1.ZodString;
957
+ }, z$1.core.$strip>;
958
+ }, z$1.core.$strip>;
959
+ toObject(): {
960
+ name: "UnknownError";
961
+ data: {
962
+ message: string;
963
+ };
964
+ };
965
+ stack?: string;
966
+ cause?: unknown;
967
+ };
968
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
969
+ readonly Unknown: any;
970
+ isError(error: unknown): error is Error;
971
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
972
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
973
+ stackTraceLimit: number;
974
+ };
975
+ isError(error: unknown): error is Error;
976
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
977
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
978
+ stackTraceLimit: number;
979
+ };
980
+ const RpcParseFailedError: {
981
+ new (data: {
982
+ message: string;
983
+ frame?: string | undefined;
984
+ method?: string | undefined;
985
+ }, options?: ErrorOptions): {
986
+ readonly name: "AcpRpcParseFailedError";
987
+ readonly message: string;
988
+ readonly data: {
989
+ message: string;
990
+ frame?: string | undefined;
991
+ method?: string | undefined;
992
+ };
993
+ schema(): z$1.ZodObject<{
994
+ name: z$1.ZodLiteral<"AcpRpcParseFailedError">;
995
+ data: z$1.ZodObject<{
996
+ message: z$1.ZodString;
997
+ frame: z$1.ZodOptional<z$1.ZodString>;
998
+ method: z$1.ZodOptional<z$1.ZodString>;
999
+ }, z$1.core.$strip>;
1000
+ }, z$1.core.$strip>;
1001
+ toObject(): {
1002
+ name: "AcpRpcParseFailedError";
1003
+ data: {
1004
+ message: string;
1005
+ frame?: string | undefined;
1006
+ method?: string | undefined;
1007
+ };
1008
+ };
1009
+ stack?: string;
1010
+ cause?: unknown;
1011
+ };
1012
+ readonly Schema: z$1.ZodObject<{
1013
+ name: z$1.ZodLiteral<"AcpRpcParseFailedError">;
1014
+ data: z$1.ZodObject<{
1015
+ message: z$1.ZodString;
1016
+ frame: z$1.ZodOptional<z$1.ZodString>;
1017
+ method: z$1.ZodOptional<z$1.ZodString>;
1018
+ }, z$1.core.$strip>;
1019
+ }, z$1.core.$strip>;
1020
+ isInstance(input: any): input is InstanceType<any>;
1021
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1022
+ readonly Unknown: {
1023
+ new (data: {
1024
+ message: string;
1025
+ }, options?: ErrorOptions): {
1026
+ readonly name: "UnknownError";
1027
+ readonly message: string;
1028
+ readonly data: {
1029
+ message: string;
1030
+ };
1031
+ schema(): z$1.ZodObject<{
1032
+ name: z$1.ZodLiteral<"UnknownError">;
1033
+ data: z$1.ZodObject<{
1034
+ message: z$1.ZodString;
1035
+ }, z$1.core.$strip>;
1036
+ }, z$1.core.$strip>;
1037
+ toObject(): {
1038
+ name: "UnknownError";
1039
+ data: {
1040
+ message: string;
1041
+ };
1042
+ };
1043
+ stack?: string;
1044
+ cause?: unknown;
1045
+ };
1046
+ readonly Schema: z$1.ZodObject<{
1047
+ name: z$1.ZodLiteral<"UnknownError">;
1048
+ data: z$1.ZodObject<{
1049
+ message: z$1.ZodString;
1050
+ }, z$1.core.$strip>;
1051
+ }, z$1.core.$strip>;
1052
+ isInstance(input: any): input is {
1053
+ readonly name: "UnknownError";
1054
+ readonly message: string;
1055
+ readonly data: {
1056
+ message: string;
1057
+ };
1058
+ schema(): z$1.ZodObject<{
1059
+ name: z$1.ZodLiteral<"UnknownError">;
1060
+ data: z$1.ZodObject<{
1061
+ message: z$1.ZodString;
1062
+ }, z$1.core.$strip>;
1063
+ }, z$1.core.$strip>;
1064
+ toObject(): {
1065
+ name: "UnknownError";
1066
+ data: {
1067
+ message: string;
1068
+ };
1069
+ };
1070
+ stack?: string;
1071
+ cause?: unknown;
1072
+ };
1073
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1074
+ readonly Unknown: any;
1075
+ isError(error: unknown): error is Error;
1076
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1077
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1078
+ stackTraceLimit: number;
1079
+ };
1080
+ isError(error: unknown): error is Error;
1081
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1082
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1083
+ stackTraceLimit: number;
1084
+ };
1085
+ const ServiceModeConflictError: {
1086
+ new (data: {
1087
+ message: string;
1088
+ conflictingModes: string[];
1089
+ }, options?: ErrorOptions): {
1090
+ readonly name: "AcpServiceModeConflictError";
1091
+ readonly message: string;
1092
+ readonly data: {
1093
+ message: string;
1094
+ conflictingModes: string[];
1095
+ };
1096
+ schema(): z$1.ZodObject<{
1097
+ name: z$1.ZodLiteral<"AcpServiceModeConflictError">;
1098
+ data: z$1.ZodObject<{
1099
+ message: z$1.ZodString;
1100
+ conflictingModes: z$1.ZodArray<z$1.ZodString>;
1101
+ }, z$1.core.$strip>;
1102
+ }, z$1.core.$strip>;
1103
+ toObject(): {
1104
+ name: "AcpServiceModeConflictError";
1105
+ data: {
1106
+ message: string;
1107
+ conflictingModes: string[];
1108
+ };
1109
+ };
1110
+ stack?: string;
1111
+ cause?: unknown;
1112
+ };
1113
+ readonly Schema: z$1.ZodObject<{
1114
+ name: z$1.ZodLiteral<"AcpServiceModeConflictError">;
1115
+ data: z$1.ZodObject<{
1116
+ message: z$1.ZodString;
1117
+ conflictingModes: z$1.ZodArray<z$1.ZodString>;
1118
+ }, z$1.core.$strip>;
1119
+ }, z$1.core.$strip>;
1120
+ isInstance(input: any): input is InstanceType<any>;
1121
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1122
+ readonly Unknown: {
1123
+ new (data: {
1124
+ message: string;
1125
+ }, options?: ErrorOptions): {
1126
+ readonly name: "UnknownError";
1127
+ readonly message: string;
1128
+ readonly data: {
1129
+ message: string;
1130
+ };
1131
+ schema(): z$1.ZodObject<{
1132
+ name: z$1.ZodLiteral<"UnknownError">;
1133
+ data: z$1.ZodObject<{
1134
+ message: z$1.ZodString;
1135
+ }, z$1.core.$strip>;
1136
+ }, z$1.core.$strip>;
1137
+ toObject(): {
1138
+ name: "UnknownError";
1139
+ data: {
1140
+ message: string;
1141
+ };
1142
+ };
1143
+ stack?: string;
1144
+ cause?: unknown;
1145
+ };
1146
+ readonly Schema: z$1.ZodObject<{
1147
+ name: z$1.ZodLiteral<"UnknownError">;
1148
+ data: z$1.ZodObject<{
1149
+ message: z$1.ZodString;
1150
+ }, z$1.core.$strip>;
1151
+ }, z$1.core.$strip>;
1152
+ isInstance(input: any): input is {
1153
+ readonly name: "UnknownError";
1154
+ readonly message: string;
1155
+ readonly data: {
1156
+ message: string;
1157
+ };
1158
+ schema(): z$1.ZodObject<{
1159
+ name: z$1.ZodLiteral<"UnknownError">;
1160
+ data: z$1.ZodObject<{
1161
+ message: z$1.ZodString;
1162
+ }, z$1.core.$strip>;
1163
+ }, z$1.core.$strip>;
1164
+ toObject(): {
1165
+ name: "UnknownError";
1166
+ data: {
1167
+ message: string;
1168
+ };
1169
+ };
1170
+ stack?: string;
1171
+ cause?: unknown;
1172
+ };
1173
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1174
+ readonly Unknown: any;
1175
+ isError(error: unknown): error is Error;
1176
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1177
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1178
+ stackTraceLimit: number;
1179
+ };
1180
+ isError(error: unknown): error is Error;
1181
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1182
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1183
+ stackTraceLimit: number;
1184
+ };
1185
+ const RoutingError: {
1186
+ new (data: {
1187
+ message: string;
1188
+ code: string;
1189
+ context?: Record<string, unknown> | undefined;
1190
+ }, options?: ErrorOptions): {
1191
+ readonly name: "AcpRoutingError";
1192
+ readonly message: string;
1193
+ readonly data: {
1194
+ message: string;
1195
+ code: string;
1196
+ context?: Record<string, unknown> | undefined;
1197
+ };
1198
+ schema(): z$1.ZodObject<{
1199
+ name: z$1.ZodLiteral<"AcpRoutingError">;
1200
+ data: z$1.ZodObject<{
1201
+ message: z$1.ZodString;
1202
+ code: z$1.ZodString;
1203
+ context: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1204
+ }, z$1.core.$strip>;
1205
+ }, z$1.core.$strip>;
1206
+ toObject(): {
1207
+ name: "AcpRoutingError";
1208
+ data: {
1209
+ message: string;
1210
+ code: string;
1211
+ context?: Record<string, unknown> | undefined;
1212
+ };
1213
+ };
1214
+ stack?: string;
1215
+ cause?: unknown;
1216
+ };
1217
+ readonly Schema: z$1.ZodObject<{
1218
+ name: z$1.ZodLiteral<"AcpRoutingError">;
1219
+ data: z$1.ZodObject<{
1220
+ message: z$1.ZodString;
1221
+ code: z$1.ZodString;
1222
+ context: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1223
+ }, z$1.core.$strip>;
1224
+ }, z$1.core.$strip>;
1225
+ isInstance(input: any): input is InstanceType<any>;
1226
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1227
+ readonly Unknown: {
1228
+ new (data: {
1229
+ message: string;
1230
+ }, options?: ErrorOptions): {
1231
+ readonly name: "UnknownError";
1232
+ readonly message: string;
1233
+ readonly data: {
1234
+ message: string;
1235
+ };
1236
+ schema(): z$1.ZodObject<{
1237
+ name: z$1.ZodLiteral<"UnknownError">;
1238
+ data: z$1.ZodObject<{
1239
+ message: z$1.ZodString;
1240
+ }, z$1.core.$strip>;
1241
+ }, z$1.core.$strip>;
1242
+ toObject(): {
1243
+ name: "UnknownError";
1244
+ data: {
1245
+ message: string;
1246
+ };
1247
+ };
1248
+ stack?: string;
1249
+ cause?: unknown;
1250
+ };
1251
+ readonly Schema: z$1.ZodObject<{
1252
+ name: z$1.ZodLiteral<"UnknownError">;
1253
+ data: z$1.ZodObject<{
1254
+ message: z$1.ZodString;
1255
+ }, z$1.core.$strip>;
1256
+ }, z$1.core.$strip>;
1257
+ isInstance(input: any): input is {
1258
+ readonly name: "UnknownError";
1259
+ readonly message: string;
1260
+ readonly data: {
1261
+ message: string;
1262
+ };
1263
+ schema(): z$1.ZodObject<{
1264
+ name: z$1.ZodLiteral<"UnknownError">;
1265
+ data: z$1.ZodObject<{
1266
+ message: z$1.ZodString;
1267
+ }, z$1.core.$strip>;
1268
+ }, z$1.core.$strip>;
1269
+ toObject(): {
1270
+ name: "UnknownError";
1271
+ data: {
1272
+ message: string;
1273
+ };
1274
+ };
1275
+ stack?: string;
1276
+ cause?: unknown;
1277
+ };
1278
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1279
+ readonly Unknown: any;
1280
+ isError(error: unknown): error is Error;
1281
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1282
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1283
+ stackTraceLimit: number;
1284
+ };
1285
+ isError(error: unknown): error is Error;
1286
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1287
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1288
+ stackTraceLimit: number;
1289
+ };
1290
+ const AdapterEnvironmentInitializationError: {
1291
+ new (data: {
1292
+ message: string;
1293
+ stage: "log" | "global" | "models" | "handlers" | "instance";
1294
+ }, options?: ErrorOptions): {
1295
+ readonly name: "AcpAdapterEnvironmentInitializationError";
1296
+ readonly message: string;
1297
+ readonly data: {
1298
+ message: string;
1299
+ stage: "log" | "global" | "models" | "handlers" | "instance";
1300
+ };
1301
+ schema(): z$1.ZodObject<{
1302
+ name: z$1.ZodLiteral<"AcpAdapterEnvironmentInitializationError">;
1303
+ data: z$1.ZodObject<{
1304
+ message: z$1.ZodString;
1305
+ stage: z$1.ZodEnum<{
1306
+ log: "log";
1307
+ global: "global";
1308
+ models: "models";
1309
+ handlers: "handlers";
1310
+ instance: "instance";
1311
+ }>;
1312
+ }, z$1.core.$strip>;
1313
+ }, z$1.core.$strip>;
1314
+ toObject(): {
1315
+ name: "AcpAdapterEnvironmentInitializationError";
1316
+ data: {
1317
+ message: string;
1318
+ stage: "log" | "global" | "models" | "handlers" | "instance";
1319
+ };
1320
+ };
1321
+ stack?: string;
1322
+ cause?: unknown;
1323
+ };
1324
+ readonly Schema: z$1.ZodObject<{
1325
+ name: z$1.ZodLiteral<"AcpAdapterEnvironmentInitializationError">;
1326
+ data: z$1.ZodObject<{
1327
+ message: z$1.ZodString;
1328
+ stage: z$1.ZodEnum<{
1329
+ log: "log";
1330
+ global: "global";
1331
+ models: "models";
1332
+ handlers: "handlers";
1333
+ instance: "instance";
1334
+ }>;
1335
+ }, z$1.core.$strip>;
1336
+ }, z$1.core.$strip>;
1337
+ isInstance(input: any): input is InstanceType<any>;
1338
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1339
+ readonly Unknown: {
1340
+ new (data: {
1341
+ message: string;
1342
+ }, options?: ErrorOptions): {
1343
+ readonly name: "UnknownError";
1344
+ readonly message: string;
1345
+ readonly data: {
1346
+ message: string;
1347
+ };
1348
+ schema(): z$1.ZodObject<{
1349
+ name: z$1.ZodLiteral<"UnknownError">;
1350
+ data: z$1.ZodObject<{
1351
+ message: z$1.ZodString;
1352
+ }, z$1.core.$strip>;
1353
+ }, z$1.core.$strip>;
1354
+ toObject(): {
1355
+ name: "UnknownError";
1356
+ data: {
1357
+ message: string;
1358
+ };
1359
+ };
1360
+ stack?: string;
1361
+ cause?: unknown;
1362
+ };
1363
+ readonly Schema: z$1.ZodObject<{
1364
+ name: z$1.ZodLiteral<"UnknownError">;
1365
+ data: z$1.ZodObject<{
1366
+ message: z$1.ZodString;
1367
+ }, z$1.core.$strip>;
1368
+ }, z$1.core.$strip>;
1369
+ isInstance(input: any): input is {
1370
+ readonly name: "UnknownError";
1371
+ readonly message: string;
1372
+ readonly data: {
1373
+ message: string;
1374
+ };
1375
+ schema(): z$1.ZodObject<{
1376
+ name: z$1.ZodLiteral<"UnknownError">;
1377
+ data: z$1.ZodObject<{
1378
+ message: z$1.ZodString;
1379
+ }, z$1.core.$strip>;
1380
+ }, z$1.core.$strip>;
1381
+ toObject(): {
1382
+ name: "UnknownError";
1383
+ data: {
1384
+ message: string;
1385
+ };
1386
+ };
1387
+ stack?: string;
1388
+ cause?: unknown;
1389
+ };
1390
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1391
+ readonly Unknown: any;
1392
+ isError(error: unknown): error is Error;
1393
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1394
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1395
+ stackTraceLimit: number;
1396
+ };
1397
+ isError(error: unknown): error is Error;
1398
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1399
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1400
+ stackTraceLimit: number;
1401
+ };
1402
+ const AdapterError: {
1403
+ new (data: {
1404
+ message: string;
1405
+ type: string;
1406
+ context?: Record<string, unknown> | undefined;
1407
+ }, options?: ErrorOptions): {
1408
+ readonly name: "AcpAdapterError";
1409
+ readonly message: string;
1410
+ readonly data: {
1411
+ message: string;
1412
+ type: string;
1413
+ context?: Record<string, unknown> | undefined;
1414
+ };
1415
+ schema(): z$1.ZodObject<{
1416
+ name: z$1.ZodLiteral<"AcpAdapterError">;
1417
+ data: z$1.ZodObject<{
1418
+ message: z$1.ZodString;
1419
+ type: z$1.ZodString;
1420
+ context: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1421
+ }, z$1.core.$strip>;
1422
+ }, z$1.core.$strip>;
1423
+ toObject(): {
1424
+ name: "AcpAdapterError";
1425
+ data: {
1426
+ message: string;
1427
+ type: string;
1428
+ context?: Record<string, unknown> | undefined;
1429
+ };
1430
+ };
1431
+ stack?: string;
1432
+ cause?: unknown;
1433
+ };
1434
+ readonly Schema: z$1.ZodObject<{
1435
+ name: z$1.ZodLiteral<"AcpAdapterError">;
1436
+ data: z$1.ZodObject<{
1437
+ message: z$1.ZodString;
1438
+ type: z$1.ZodString;
1439
+ context: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1440
+ }, z$1.core.$strip>;
1441
+ }, z$1.core.$strip>;
1442
+ isInstance(input: any): input is InstanceType<any>;
1443
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1444
+ readonly Unknown: {
1445
+ new (data: {
1446
+ message: string;
1447
+ }, options?: ErrorOptions): {
1448
+ readonly name: "UnknownError";
1449
+ readonly message: string;
1450
+ readonly data: {
1451
+ message: string;
1452
+ };
1453
+ schema(): z$1.ZodObject<{
1454
+ name: z$1.ZodLiteral<"UnknownError">;
1455
+ data: z$1.ZodObject<{
1456
+ message: z$1.ZodString;
1457
+ }, z$1.core.$strip>;
1458
+ }, z$1.core.$strip>;
1459
+ toObject(): {
1460
+ name: "UnknownError";
1461
+ data: {
1462
+ message: string;
1463
+ };
1464
+ };
1465
+ stack?: string;
1466
+ cause?: unknown;
1467
+ };
1468
+ readonly Schema: z$1.ZodObject<{
1469
+ name: z$1.ZodLiteral<"UnknownError">;
1470
+ data: z$1.ZodObject<{
1471
+ message: z$1.ZodString;
1472
+ }, z$1.core.$strip>;
1473
+ }, z$1.core.$strip>;
1474
+ isInstance(input: any): input is {
1475
+ readonly name: "UnknownError";
1476
+ readonly message: string;
1477
+ readonly data: {
1478
+ message: string;
1479
+ };
1480
+ schema(): z$1.ZodObject<{
1481
+ name: z$1.ZodLiteral<"UnknownError">;
1482
+ data: z$1.ZodObject<{
1483
+ message: z$1.ZodString;
1484
+ }, z$1.core.$strip>;
1485
+ }, z$1.core.$strip>;
1486
+ toObject(): {
1487
+ name: "UnknownError";
1488
+ data: {
1489
+ message: string;
1490
+ };
1491
+ };
1492
+ stack?: string;
1493
+ cause?: unknown;
1494
+ };
1495
+ create<Name extends string, Data extends z$1.core.$ZodType>(name: Name, data: Data): any;
1496
+ readonly Unknown: any;
1497
+ isError(error: unknown): error is Error;
1498
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1499
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1500
+ stackTraceLimit: number;
1501
+ };
1502
+ isError(error: unknown): error is Error;
1503
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
1504
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
1505
+ stackTraceLimit: number;
1506
+ };
1507
+ }
1508
+ declare enum ErrorType {
1509
+ CHANNEL_ERROR = "channel_error",
1510
+ CHANNEL_TIMEOUT = "channel_timeout",
1511
+ CHANNEL_UNAVAILABLE = "channel_unavailable",
1512
+ NETWORK_ERROR = "network_error",
1513
+ CONNECTION_FAILED = "connection_failed",
1514
+ CONNECTION_TIMEOUT = "connection_timeout",
1515
+ ACP_ERROR = "acp_error",
1516
+ ACP_AUTH_FAILED = "acp_auth_failed",
1517
+ ACP_SESSION_NOT_FOUND = "acp_session_not_found",
1518
+ CONFIG_ERROR = "config_error",
1519
+ CONFIG_INVALID = "config_invalid",
1520
+ SYSTEM_ERROR = "system_error",
1521
+ INITIALIZATION_FAILED = "initialization_failed"
1522
+ }
1523
+ type AdapterError = InstanceType<typeof AcpError.AdapterError>;
1524
+ declare function isAdapterError(err: unknown): err is AdapterError;
1525
+ type ServiceModeConflictError = InstanceType<typeof AcpError.ServiceModeConflictError>;
1526
+ declare function isServiceModeConflictError(err: unknown): err is ServiceModeConflictError;
1527
+ type RoutingError = InstanceType<typeof AcpError.RoutingError>;
1528
+ declare function isRoutingError(err: unknown): err is RoutingError;
1529
+ type AdapterEnvironmentInitializationError = InstanceType<typeof AcpError.AdapterEnvironmentInitializationError>;
1530
+ declare function isAdapterEnvironmentInitializationError(err: unknown): err is AdapterEnvironmentInitializationError;
1531
+ declare function isAdapterErrorRetryable(type: ErrorType): boolean;
1532
+ declare function isAdapterErrorFatal(type: ErrorType): boolean;
1533
+ declare function createAdapterError(type: ErrorType, message: string, context?: Record<string, unknown>, cause?: Error): AdapterError;
1534
+ declare function createChannelError(message: string, context?: Record<string, unknown>, cause?: Error): AdapterError;
1535
+ declare function createNetworkError(message: string, context?: Record<string, unknown>, cause?: Error): AdapterError;
1536
+ declare function createConfigError(message: string, context?: Record<string, unknown>): AdapterError;
1537
+ declare function createTimeoutError(message: string, timeout: number, context?: Record<string, unknown>): AdapterError;
1538
+ declare const ACP_BUSINESS_CODES: ReadonlySet<string>;
1539
+ declare const ACP_BUSINESS_HINTS: Readonly<Record<string, string>>;
1540
+ declare function registerBusinessErrors(): Promise<void>;
1541
+
1542
+ interface CommandHelp {
1543
+ i18nKey: string;
1544
+ name: string;
1545
+ description: string;
1546
+ group: 'lifecycle' | 'server' | 'external';
1547
+ }
1548
+ declare const COMMANDS_HELP: readonly CommandHelp[];
1549
+ interface AcpCliDeps {
1550
+ version: string;
1551
+ cwd?: string;
1552
+ locale?: string;
1553
+ }
1554
+ interface AcpCliResult {
1555
+ code: number;
1556
+ handled: boolean;
1557
+ command: string | null;
1558
+ }
1559
+ declare function renderBanner(): void;
1560
+ declare function renderHelp(): void;
1561
+ declare function handleAcpCli(args: string[], deps?: AcpCliDeps): Promise<AcpCliResult>;
1562
+
1563
+ declare function setGlobalAdapter(global: IGlobal | null): void;
1564
+ declare function resetGlobalAdapter(): void;
1565
+ declare function getGlobal(): IGlobal;
1566
+ declare function setInstanceAdapter(instance: IInstance | null): void;
1567
+ declare function resetInstanceAdapter(): void;
1568
+ declare function getInstance(): IInstance;
1569
+ declare function setEasbotClientAdapter(client: EasbotClient | null): Promise<void>;
1570
+ declare function resetEasbotClientAdapter(): Promise<void>;
1571
+ declare function getSdk(): Promise<EasbotClient>;
1572
+ declare function getHomeDir(): string;
1573
+ declare function getXdgData(): string;
1574
+ declare function getWorktree(): string;
1575
+ declare function getProjectDirectory(): string;
1576
+
1577
+ declare namespace ServerConnectionRegistry {
1578
+ type Registry = ConnectionRegistry;
1579
+ function init(config?: ACPConnectionRegistryConfig): Promise<ConnectionRegistry>;
1580
+ function connect(args: {
1581
+ baseUrl: string;
1582
+ localAgentId: string;
1583
+ remoteAgentId: string;
1584
+ remoteSessionId?: string;
1585
+ localSessionId?: string;
1586
+ }): Promise<ACPConnectionResult>;
1587
+ function resolve(id: string): Promise<ACPConnectionState | undefined>;
1588
+ function resolveSync(id: string): ACPConnectionState | undefined;
1589
+ function close(connectionId: string): Promise<void>;
1590
+ function markDegraded(connectionId: string, reason: string): Promise<void>;
1591
+ function getConnectionsByLocalAgent(agentId: string): Promise<ACPConnectionState[]>;
1592
+ function getConnectionsByService(baseUrl: string): Promise<ACPConnectionState[]>;
1593
+ function getAllActiveConnections(): Promise<ACPConnectionState[]>;
1594
+ function updateLastSeenMessageId(connectionId: string, messageId: string): Promise<void>;
1595
+ function updateSessionUpdates(connectionId: string, updates: {
1596
+ availableCommands?: AvailableCommand[];
1597
+ configOptions?: SessionConfigOption[];
1598
+ currentModeId?: string;
1599
+ remoteSessionStatus?: 'idle' | 'busy' | 'retry';
1600
+ }): Promise<void>;
1601
+ function updateSessionUpdatesBySessionId(sessionId: string, updates: {
1602
+ availableCommands?: AvailableCommand[];
1603
+ configOptions?: SessionConfigOption[];
1604
+ currentModeId?: string;
1605
+ remoteSessionStatus?: 'idle' | 'busy' | 'retry';
1606
+ }): Promise<void>;
1607
+ function findConnectionIdBySubscriber(subscriber: unknown): string | undefined;
1608
+ class ConnectionRegistry {
1609
+ private readonly defaultHistoryScope;
1610
+ private readonly defaultHistoryWindowSize;
1611
+ private readonly defaultDegradePolicy;
1612
+ private agentIndex;
1613
+ private serviceIndex;
1614
+ private connections;
1615
+ static create(config?: ACPConnectionRegistryConfig): ConnectionRegistry;
1616
+ private constructor();
1617
+ connect(baseUrl: string, localAgentId: string, remoteAgentId: string, remoteSessionId?: string, localSessionId?: string): ACPConnectionResult;
1618
+ resolve(id: string, createIfMissing?: boolean): ACPConnectionState | undefined;
1619
+ closeConnection(connectionId: string): void;
1620
+ markDegraded(connectionId: string, reason: string): void;
1621
+ getConnectionsByAgent(agentId: string): ACPConnectionState[];
1622
+ getConnectionsByService(baseUrl: string): ACPConnectionState[];
1623
+ getAllActiveConnections(): ACPConnectionState[];
1624
+ updateLastSeenMessageId(connectionId: string, messageId: string): void;
1625
+ updateSessionUpdates(connectionId: string, updates: {
1626
+ availableCommands?: AvailableCommand[];
1627
+ configOptions?: SessionConfigOption[];
1628
+ currentModeId?: string;
1629
+ remoteSessionStatus?: 'idle' | 'busy' | 'retry';
1630
+ }): void;
1631
+ findConnectionIdBySubscriber(subscriber: unknown): string | undefined;
1632
+ private generateConnectionId;
1633
+ private generateShortId;
1634
+ close(): Promise<void>;
1635
+ }
1636
+ }
1637
+
1638
+ declare enum RoutingErrorCode {
1639
+ EMPTY_CONTEXT = "EMPTY_CONTEXT",
1640
+ AMBIGUOUS_ROUTE = "AMBIGUOUS_ROUTE",
1641
+ NOT_FOUND = "NOT_FOUND",
1642
+ CONNECTION_CLOSED = "CONNECTION_CLOSED",
1643
+ MISSING_REQUIRED_PARAMS = "MISSING_REQUIRED_PARAMS"
1644
+ }
1645
+ declare function createRoutingError(code: RoutingErrorCode, message: string, context?: ACPRoutingContext): RoutingError;
1646
+ declare class SessionRouter {
1647
+ static create(): SessionRouter;
1648
+ protected constructor();
1649
+ route(context: ACPRoutingContext): ACPRoutingResult;
1650
+ routeOrThrow(context: ACPRoutingContext): ACPConnectionState;
1651
+ registerConnection(state: ACPConnectionState): ACPRoutingResult;
1652
+ unregisterConnection(connectionId: string): boolean;
1653
+ private isValidContext;
1654
+ private routeByConnectionId;
1655
+ private routeByPeerAndBaseUrl;
1656
+ private routeByBaseUrlAndSessionId;
1657
+ protected getConnectionState(connectionId: string): ACPConnectionState | undefined;
1658
+ protected getConnectionsByPeer(agentId: string): ACPConnectionState[];
1659
+ protected getConnectionsByService(baseUrl: string): ACPConnectionState[];
1660
+ private getErrorCode;
1661
+ }
1662
+ declare class RegistrySessionRouter extends SessionRouter {
1663
+ private readonly registry;
1664
+ static fromRegistry(registry: RegistrySessionRouter['registry']): RegistrySessionRouter;
1665
+ protected constructor(registry: RegistrySessionRouter['registry']);
1666
+ protected getConnectionState(connectionId: string): ACPConnectionState | undefined;
1667
+ protected getConnectionsByPeer(agentId: string): ACPConnectionState[];
1668
+ protected getConnectionsByService(baseUrl: string): ACPConnectionState[];
1669
+ }
1670
+
1671
+ interface ACPConnection {
1672
+ sessionUpdate(params: SessionNotification): Promise<void>;
1673
+ requestPermission(params: ACPRequestPermissionParams): Promise<ACPRequestPermissionResponse>;
1674
+ extMethod(method: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
1675
+ extNotification(method: string, params: Record<string, unknown>): Promise<void>;
1676
+ }
1677
+ interface ACPRequestPermissionParams {
1678
+ sessionId: string;
1679
+ toolCall: {
1680
+ callId: string;
1681
+ status?: string;
1682
+ title?: string;
1683
+ rawInput?: unknown;
1684
+ kind?: string;
1685
+ locations?: string[];
1686
+ };
1687
+ options: Array<{
1688
+ optionId: string;
1689
+ name: string;
1690
+ kind?: string;
1691
+ }>;
1692
+ }
1693
+ interface ACPRequestPermissionResponse {
1694
+ outcome: {
1695
+ outcome: 'selected';
1696
+ optionId: string;
1697
+ } | {
1698
+ outcome: 'cancelled';
1699
+ };
1700
+ }
1701
+ declare class AcpEventBridge {
1702
+ private sdk;
1703
+ private connection;
1704
+ private abortController;
1705
+ private started;
1706
+ private permissionQueues;
1707
+ private readonly _messageMetaCache;
1708
+ private permissionOptions;
1709
+ private acpService?;
1710
+ private _cachedPrimaryAgents;
1711
+ constructor(sdk: EasbotClient, connection: ACPConnection);
1712
+ setService(service: {
1713
+ abortConnection?: () => void;
1714
+ closeConnection?: () => void;
1715
+ }): void;
1716
+ start(): Promise<void>;
1717
+ stop(): Promise<void>;
1718
+ private runEventSubscription;
1719
+ private handleEvent;
1720
+ private handleSessionStatus;
1721
+ private handleSessionDeleted;
1722
+ private handlePermissionAsked;
1723
+ private handleQuestionAsked;
1724
+ private handleMessagePartUpdated;
1725
+ private handleToolPart;
1726
+ private handleTextPart;
1727
+ private handleReasoningPart;
1728
+ private handleStepFinishPart;
1729
+ private getContextLimit;
1730
+ private getMessageMeta;
1731
+ private clearMessageMetaCache;
1732
+ private shouldFilterAgent;
1733
+ }
1734
+
1735
+ type ServiceMode$1 = 'stdio' | 'http' | 'websocket';
1736
+
1737
+ declare enum AgentStatus {
1738
+ INITIALIZING = "initializing",
1739
+ READY = "ready",
1740
+ RUNNING = "running",
1741
+ STOPPED = "stopped",
1742
+ ERROR = "error"
1743
+ }
1744
+
1745
+ interface ACPConfig {
1746
+ sdk: EasbotClient;
1747
+ }
1748
+
1749
+ interface AdapterSessionState {
1750
+ id: string;
1751
+ cwd: string;
1752
+ mcpServers: McpServer[];
1753
+ createdAt: Date;
1754
+ model?: ModelIdentifier;
1755
+ variant?: string;
1756
+ modeId?: string;
1757
+ contextMode?: ContextMode;
1758
+ agent?: string;
1759
+ }
1760
+ declare class AdapterSessionManager {
1761
+ private sessions;
1762
+ private sdk;
1763
+ constructor(sdk: EasbotClient);
1764
+ tryGet(sessionId: string): AdapterSessionState | undefined;
1765
+ create(sessionId: string, cwd: string, mcpServers: McpServer[], model?: AdapterSessionState['model']): Promise<AdapterSessionState>;
1766
+ load(sessionId: string, cwd: string, mcpServers: McpServer[], model?: AdapterSessionState['model']): Promise<AdapterSessionState>;
1767
+ get(sessionId: string): AdapterSessionState;
1768
+ getModel(sessionId: string): {
1769
+ modelId: string;
1770
+ providerId: string;
1771
+ } | undefined;
1772
+ setModel(sessionId: string, model: AdapterSessionState['model']): AdapterSessionState;
1773
+ getVariant(sessionId: string): string | undefined;
1774
+ setVariant(sessionId: string, variant?: string): AdapterSessionState;
1775
+ setMode(sessionId: string, modeId: string): AdapterSessionState;
1776
+ setContextMode(sessionId: string, contextMode?: ContextMode): AdapterSessionState;
1777
+ setAgent(sessionId: string, agent?: string): AdapterSessionState;
1778
+ close(sessionId: string): boolean;
1779
+ dispose(): void;
1780
+ resolveConnectionState(sessionId: string): ACPConnectionState | undefined;
1781
+ }
1782
+
1783
+ interface ACPServiceConfig {
1784
+ acp: ACPConfig;
1785
+ serviceMode: ServiceMode$1;
1786
+ channel: {
1787
+ type: ServiceMode$1;
1788
+ timeout?: number;
1789
+ retryCount?: number;
1790
+ };
1791
+ directory?: string;
1792
+ connectionRegistry?: ServerConnectionRegistry.Registry;
1793
+ sessionRouter?: SessionRouter;
1794
+ }
1795
+ declare abstract class ACPService implements Agent {
1796
+ protected config: ACPServiceConfig;
1797
+ protected readonly serviceMode: ServiceMode$1;
1798
+ protected connection: AgentSideConnection | undefined;
1799
+ protected sdk: EasbotClient;
1800
+ protected connectionRegistry: ServerConnectionRegistry.Registry | null;
1801
+ protected sessionRouter: SessionRouter | null;
1802
+ protected sessionManager: AdapterSessionManager;
1803
+ private executorInitialized;
1804
+ protected status: AgentStatus;
1805
+ constructor(connection: AgentSideConnection | undefined, config: ACPServiceConfig);
1806
+ protected initializeExecutor(): Promise<void>;
1807
+ protected setStatus(newStatus: AgentStatus, agentId?: string): void;
1808
+ protected getStatus(): AgentStatus;
1809
+ abstract initialize(params: InitializeRequest): Promise<InitializeResponse>;
1810
+ authenticate(params: AuthenticateRequest): Promise<undefined | AuthenticateResponse>;
1811
+ newSession(params: NewSessionRequest): Promise<NewSessionResponse>;
1812
+ loadSession(params: LoadSessionRequest): Promise<LoadSessionResponse>;
1813
+ prompt(params: PromptRequest): Promise<PromptResponse>;
1814
+ cancel(params: CancelNotification): Promise<void>;
1815
+ private parseUri;
1816
+ private sendUsageUpdate;
1817
+ sendAvailableCommandsUpdate(sessionId: string, directory?: string): Promise<void>;
1818
+ private sendConfigOptionUpdate;
1819
+ private sendCurrentModeUpdate;
1820
+ private getContextLimit;
1821
+ unstable_forkSession(params: ForkSessionRequest): Promise<ForkSessionResponse>;
1822
+ resumeSession(params: ResumeSessionRequest): Promise<ResumeSessionResponse>;
1823
+ listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse>;
1824
+ setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
1825
+ setSessionConfigOption(params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
1826
+ closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse>;
1827
+ private buildSessionStateResponse;
1828
+ private parseModelSelection;
1829
+ setConnection(connection: AgentSideConnection): void;
1830
+ getConnection(): AgentSideConnection | undefined;
1831
+ setServerConnection(connection: any): void;
1832
+ abortConnection(): void;
1833
+ closeConnection(): void;
1834
+ getServerConnectionRegistry(): ServerConnectionRegistry.Registry | null;
1835
+ getSessionRouter(): SessionRouter | null;
1836
+ createConnection(baseUrl: string, localAgentId?: string, remoteAgentId?: string, sessionId?: string): {
1837
+ connectionId: string;
1838
+ sessionId: string;
1839
+ localAgentId: string;
1840
+ remoteAgentId: string;
1841
+ baseUrl: string;
1842
+ };
1843
+ routeToConnection(context: {
1844
+ connectionId?: string;
1845
+ remoteAgentId?: string;
1846
+ baseUrl?: string;
1847
+ sessionId?: string;
1848
+ }): Promise<{
1849
+ success: boolean;
1850
+ connectionId?: string;
1851
+ sessionId?: string;
1852
+ remoteAgentId?: string;
1853
+ baseUrl?: string;
1854
+ error?: string;
1855
+ }>;
1856
+ dispose(): Promise<void>;
1857
+ }
1858
+
1859
+ type ServiceMode = ChannelType;
1860
+ declare const ServiceMode: {
1861
+ readonly HTTP: "http";
1862
+ readonly STDIO: "stdio";
1863
+ readonly WEBSOCKET: "websocket";
1864
+ };
1865
+ type ServiceModeValue = (typeof ServiceMode)[keyof typeof ServiceMode];
1866
+ interface StdioChannelConfig {
1867
+ command: string;
1868
+ args: string[];
1869
+ }
1870
+ interface HttpChannelConfig {
1871
+ baseUrl: string;
1872
+ timeout?: number;
1873
+ }
1874
+ interface WebSocketChannelConfig {
1875
+ url: string;
1876
+ timeout?: number;
1877
+ batchSize?: number;
1878
+ batchInterval?: number;
1879
+ heartbeatInterval?: number;
1880
+ }
1881
+ interface ACPServerConfig {
1882
+ channel: ServiceMode;
1883
+ port?: number;
1884
+ hostname?: string;
1885
+ timeout?: number;
1886
+ stdio?: StdioChannelConfig;
1887
+ http?: HttpChannelConfig;
1888
+ ws?: WebSocketChannelConfig;
1889
+ historyScope?: 'session' | 'peer' | 'global';
1890
+ historyWindowSize?: number;
1891
+ degradePolicy?: 'polling_only' | 'streaming_first';
1892
+ sessionExpireMs?: number;
1893
+ }
1894
+ declare function createServiceModeConflictError(message: string, conflictingModes?: ServiceMode[]): ServiceModeConflictError;
1895
+
1896
+ declare function loadACPServerConfig(config: Partial<ACPServerConfig>): ACPServerConfig;
1897
+ declare function loadConfigFromEnv(): Partial<ACPServerConfig>;
1898
+ declare function applyEnvironmentOverrides(config: ACPServerConfig): ACPServerConfig;
1899
+
1900
+ interface ACPServerInstance {
1901
+ type: ServiceMode;
1902
+ server: unknown;
1903
+ agent: EasBotAgent;
1904
+ stop: () => Promise<void>;
1905
+ healthCheck: () => Promise<boolean>;
1906
+ }
1907
+ declare function startACPServer(agent: EasBotAgent, config?: Partial<ACPServerConfig>): Promise<ACPServerInstance>;
1908
+ declare function createACPServerInstance(config: ACPServerConfig): ACPServerInstance;
1909
+
1910
+ type AcpEndpointChannel = 'stdio' | 'http' | 'websocket';
1911
+ declare const ACP_STDIO_COMMAND = "easbot";
1912
+ interface AcpEndpointInput {
1913
+ channel: AcpEndpointChannel;
1914
+ hostname?: string;
1915
+ port?: number;
1916
+ command?: string;
1917
+ }
1918
+ declare function getAcpEndpointUrl(input: AcpEndpointInput): string | null;
1919
+
1920
+ declare function startHttpServer(agent: EasBotAgent, config: ACPServerConfig): Promise<{
1921
+ server: EasServer;
1922
+ stop: () => Promise<void>;
1923
+ }>;
1924
+
1925
+ declare function startWebSocketServer(agent: EasBotAgent, config: ACPServerConfig): Promise<{
1926
+ server: EasServer;
1927
+ stop: () => Promise<void>;
1928
+ }>;
1929
+
1930
+ interface EventBroadcaster {
1931
+ broadcast: (sessionId: string, event: SessionNotification) => void;
1932
+ }
1933
+ declare class ServerAgentSideConnection implements ACPConnection {
1934
+ private broadcaster;
1935
+ private sessionIds;
1936
+ private sessionRefCounts;
1937
+ setBroadcaster(broadcaster: EventBroadcaster): void;
1938
+ addSession(sessionId: string): void;
1939
+ removeSession(sessionId: string): void;
1940
+ clearSessions(): void;
1941
+ getSessions(): string[];
1942
+ sessionUpdate(params: SessionNotification): Promise<void>;
1943
+ requestPermission(params: {
1944
+ sessionId: string;
1945
+ toolCall: {
1946
+ callId: string;
1947
+ };
1948
+ options: Array<{
1949
+ optionId: string;
1950
+ name: string;
1951
+ kind?: string;
1952
+ }>;
1953
+ }): Promise<{
1954
+ outcome: {
1955
+ outcome: 'selected';
1956
+ optionId: string;
1957
+ } | {
1958
+ outcome: 'cancelled';
1959
+ };
1960
+ }>;
1961
+ extMethod(method: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
1962
+ extNotification(method: string, params: Record<string, unknown>): Promise<void>;
1963
+ }
1964
+
1965
+ interface EasBotAgentConfig extends ACPServiceConfig {
1966
+ acpServerConfig?: ACPServerConfig$1;
1967
+ printLog?: boolean;
1968
+ stdioStream?: {
1969
+ stream: any;
1970
+ };
1971
+ }
1972
+ declare class EasBotAgent extends ACPService {
1973
+ private acpEventBridge;
1974
+ private server;
1975
+ private isAgentInitialized;
1976
+ static create(config: EasBotAgentConfig): Promise<EasBotAgent>;
1977
+ constructor(connection: AgentSideConnection | undefined, config: EasBotAgentConfig);
1978
+ initialize(params: InitializeRequest): Promise<InitializeResponse>;
1979
+ private initializeAgent;
1980
+ start(): Promise<void>;
1981
+ stop(): Promise<void>;
1982
+ private initializeAcpEventBridge;
1983
+ getServiceMode(): ServiceMode$1;
1984
+ getServerInstance(): ACPServerInstance | null;
1985
+ getSDK(): EasbotClient | null;
1986
+ }
1987
+
1988
+ interface AdapterBootstrapConfig {
1989
+ directory?: string;
1990
+ initModels?: boolean;
1991
+ printLogs?: boolean;
1992
+ logLevel?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1993
+ channel?: ChannelType;
1994
+ }
1995
+ type AdapterEnvInitStage = 'global' | 'log' | 'models' | 'handlers' | 'instance';
1996
+ declare function createAdapterEnvironmentInitializationError(message: string, stage: AdapterEnvInitStage, cause?: Error): AdapterEnvironmentInitializationError;
1997
+ declare namespace EasbotAdapter {
1998
+ function resetState(): void;
1999
+ function init(config?: AdapterBootstrapConfig): Promise<void>;
2000
+ function destroy(): Promise<void>;
2001
+ function isInitialized(): Promise<boolean>;
2002
+ function setAgent(agent: unknown): Promise<void>;
2003
+ function getAgent<T = unknown>(): Promise<T | null>;
2004
+ function getServer<T = ACPServerInstance>(): Promise<T | null>;
2005
+ function getSDK(): Promise<EasbotClient | null>;
2006
+ function getACPConnection(): Promise<AgentSideConnection | null>;
2007
+ function getState(): Promise<{
2008
+ initialized: boolean;
2009
+ directory: string;
2010
+ activeChannel: ChannelType | null;
2011
+ hasSDK: boolean;
2012
+ hasAgent: boolean;
2013
+ hasACPConnection: boolean;
2014
+ hasServer: boolean;
2015
+ }>;
2016
+ function ensureACPService(config: ACPServerConfig$1): Promise<{
2017
+ sdk: EasbotClient;
2018
+ agent: EasBotAgent;
2019
+ server?: ACPServerInstance;
2020
+ }>;
2021
+ function ensureACPServiceStdio(config: {
2022
+ directory: string;
2023
+ }): Promise<{
2024
+ sdk: EasbotClient;
2025
+ agent: EasBotAgent;
2026
+ }>;
2027
+ }
2028
+ declare const AdapterBootstrap: typeof EasbotAdapter;
2029
+
2030
+ export { ACPClientConfigSchema, ACPClientsConfigSchema, ACPInfoACPConfigSchema, ACPParsePartialConfig, ACPServerConfigSchema, type ACPServerInstance, ACPValidateConfig, ACP_BUSINESS_CODES, ACP_BUSINESS_HINTS, ACP_JSON_REL_PATH, ACP_STDIO_COMMAND, AcpCache, type AcpCliDeps, type AcpCliResult, type AcpConfigStateResult, type AcpEndpointChannel, type AcpEndpointInput, AcpError, AcpEventBridge, AdapterBootstrap, type AdapterBootstrapConfig, type AdapterEnvInitStage, AdapterEnvironmentInitializationError, AdapterError, AgentStatus, COMMANDS_HELP, type CommandHelp, EasBotAgent, type EasBotAgentConfig, EasbotAdapter, ErrorType, type FormatLogOptions, I18n, LanguagesSupported, type Locale, NameErrors, RegistrySessionRouter, RoutingError, RoutingErrorCode, ServerAgentSideConnection, ServerConnectionRegistry, ServiceMode, ServiceModeConflictError, type ServiceModeValue, SessionRouter, type TranslateOptions, type TranslationResources, type TypeWithI18N, applyEnvironmentOverrides, changeI18nLanguage, clearConfigCache, createACPServerInstance, createAdapterEnvironmentInitializationError, createAdapterError, createChannelError, createConfigError, createNetworkError, createRoutingError, createServiceModeConflictError, createTimeoutError, formatLog, getAcpEndpointUrl, getClientById, getClientsConfig, getConfig, getConfigDirectory, getDefaultClient, getGatewayClientUrl, getGlobal, getHomeDir, getInstance, getProjectDirectory, getRegisteredResources, getSdk, getServerConfig, getWorktree, getXdgData, handleAcpCli, initI18n, isAdapterEnvironmentInitializationError, isAdapterError, isAdapterErrorFatal, isAdapterErrorRetryable, isConfigLoaded, isRoutingError, isServiceModeConflictError, languages, loadACPServerConfig, loadConfig, loadConfigFromEnv, registerBusinessErrors, registerI18nResources, reloadConfig, renderBanner, renderHelp, resetEasbotClientAdapter, resetGlobalAdapter, resetInstanceAdapter, setEasbotClientAdapter, setGlobalAdapter, setInstanceAdapter, startACPServer, startHttpServer, startWebSocketServer, t, translate };