@band-ai/sdk 0.3.3 → 0.4.0

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 (97) hide show
  1. package/README.md +54 -1
  2. package/dist/{ClaudeSDKAdapter-CXud2DBE.d.ts → CopilotACPAdapter-BCpbHFB0.d.ts} +240 -19
  3. package/dist/{ClaudeSDKAdapter-Cx6zhSaG.d.cts → CopilotACPAdapter-D4VWg8lJ.d.cts} +240 -19
  4. package/dist/{opencode-2YdscIc1.d.cts → acp-client-D-I_5lK-.d.cts} +23 -4
  5. package/dist/{opencode-Bld62x5t.d.ts → acp-client-DUXyczlF.d.ts} +23 -4
  6. package/dist/acp-server-BlcYMxKt.d.ts +17 -0
  7. package/dist/acp-server-CJhclo6P.d.cts +17 -0
  8. package/dist/adapters.cjs +2217 -973
  9. package/dist/adapters.d.cts +21 -132
  10. package/dist/adapters.d.ts +21 -132
  11. package/dist/adapters.js +26 -1914
  12. package/dist/{backends-D-dBdDm-.d.ts → backends-CgsPQa9B.d.ts} +2 -2
  13. package/dist/{backends-ZLxmQrTZ.d.cts → backends-Dh2WXcHQ.d.cts} +2 -2
  14. package/dist/{chunk-JY75VSQK.js → chunk-4OVNFDD7.js} +14 -1
  15. package/dist/chunk-6BE2EG5P.js +128 -0
  16. package/dist/{chunk-U6AFCLYZ.js → chunk-6TGXV5TE.js} +1824 -514
  17. package/dist/{chunk-OH6VVVKT.js → chunk-CBCHTTUY.js} +10 -0
  18. package/dist/{chunk-K5KAEYPF.js → chunk-HNWZZXAE.js} +288 -120
  19. package/dist/chunk-I34SXMTJ.js +6 -0
  20. package/dist/{chunk-XWHWJP4I.js → chunk-JDW5WSGF.js} +2 -2
  21. package/dist/{chunk-KXJ74J73.js → chunk-JIZE4EC6.js} +4 -10
  22. package/dist/chunk-OGOXY43L.js +119 -0
  23. package/dist/{chunk-W5IAI6Z4.js → chunk-OVXVZUPO.js} +5 -5
  24. package/dist/{chunk-YJ42AZO4.js → chunk-RJNJUISR.js} +5 -2
  25. package/dist/{chunk-MQY74R7D.js → chunk-SHZBLLDQ.js} +21 -9
  26. package/dist/{chunk-JADCAMZY.js → chunk-TGDDFBYS.js} +45 -0
  27. package/dist/{chunk-US226AS4.js → chunk-UENIC5FJ.js} +14 -11
  28. package/dist/{chunk-WA7CHXUS.js → chunk-UL3Y5C4J.js} +2 -2
  29. package/dist/{chunk-WL2HNJZ6.js → chunk-VOMJRQOM.js} +3 -3
  30. package/dist/{chunk-MQBBWYRP.js → chunk-YF7K4UB3.js} +3352 -572
  31. package/dist/{chunk-OD2G5LFQ.js → chunk-ZYOXI4JL.js} +41 -2
  32. package/dist/config.cjs +2 -12
  33. package/dist/config.js +2 -2
  34. package/dist/converters.cjs +36 -11
  35. package/dist/converters.d.cts +7 -5
  36. package/dist/converters.d.ts +7 -5
  37. package/dist/converters.js +11 -13
  38. package/dist/core.cjs +239 -5
  39. package/dist/core.d.cts +71 -6
  40. package/dist/core.d.ts +71 -6
  41. package/dist/core.js +31 -6
  42. package/dist/{customTools-BzF0IISO.d.cts → customTools-Bfecd0mJ.d.cts} +1 -1
  43. package/dist/{customTools-BzF0IISO.d.ts → customTools-Bfecd0mJ.d.ts} +1 -1
  44. package/dist/{disconnectReason-IuADl6TH.d.ts → disconnectReason-Cctmg1SN.d.cts} +1 -1
  45. package/dist/{disconnectReason-IuADl6TH.d.cts → disconnectReason-Cctmg1SN.d.ts} +1 -1
  46. package/dist/{dtos-B8KU_q4d.d.ts → dtos-CjQsN1_h.d.cts} +5 -12
  47. package/dist/{dtos-B8KU_q4d.d.cts → dtos-CjQsN1_h.d.ts} +5 -12
  48. package/dist/index.cjs +5237 -1474
  49. package/dist/index.d.cts +61 -22
  50. package/dist/index.d.ts +61 -22
  51. package/dist/index.js +151 -43
  52. package/dist/linear.cjs +45 -7
  53. package/dist/linear.d.cts +4 -3
  54. package/dist/linear.d.ts +4 -3
  55. package/dist/linear.js +10 -10
  56. package/dist/mcp-claude.cjs +11 -6
  57. package/dist/mcp-claude.d.cts +4 -3
  58. package/dist/mcp-claude.d.ts +4 -3
  59. package/dist/mcp-claude.js +4 -5
  60. package/dist/mcp.cjs +13 -7
  61. package/dist/mcp.d.cts +6 -5
  62. package/dist/mcp.d.ts +6 -5
  63. package/dist/mcp.js +5 -6
  64. package/dist/{pagination-DqdkQArT.d.cts → pagination-BZDhB_nO.d.cts} +2 -2
  65. package/dist/{pagination-BgEx-HeL.d.ts → pagination-CPz0J_vQ.d.ts} +2 -2
  66. package/dist/{protocols-Bz1rxcUg.d.cts → protocols-CabgO52c.d.cts} +38 -3
  67. package/dist/{protocols-Bwwcql0h.d.ts → protocols-Dpci6uae.d.ts} +38 -3
  68. package/dist/rest.cjs +43 -1
  69. package/dist/rest.d.cts +6 -5
  70. package/dist/rest.d.ts +6 -5
  71. package/dist/rest.js +6 -5
  72. package/dist/runtime.cjs +2113 -597
  73. package/dist/runtime.d.cts +44 -25
  74. package/dist/runtime.d.ts +44 -25
  75. package/dist/runtime.js +11 -11
  76. package/dist/{schemas-BgJhlqqO.d.cts → schemas-BKnh4fKR.d.cts} +209 -24
  77. package/dist/{schemas-C4mK1WSs.d.ts → schemas-CDa3V_I5.d.ts} +209 -24
  78. package/dist/{sdk-BTciSLRQ.d.cts → sdk-CXNqzoY1.d.cts} +1 -1
  79. package/dist/{sdk-qKJtMma_.d.ts → sdk-Cin80BTC.d.ts} +1 -1
  80. package/dist/{simpleAdapter-BpT4XbZC.d.cts → simpleAdapter-D75rcz9n.d.cts} +3 -1
  81. package/dist/{simpleAdapter--wznuoOw.d.ts → simpleAdapter-eLvsAQNo.d.ts} +3 -1
  82. package/dist/testing.cjs +25 -7
  83. package/dist/testing.d.cts +5 -3
  84. package/dist/testing.d.ts +5 -3
  85. package/dist/testing.js +9 -6
  86. package/dist/{types-BivGO7I9.d.ts → types-42-HWeX8.d.cts} +10 -4
  87. package/dist/types-CKU1N0SK.d.ts +137 -0
  88. package/dist/{types-BgYFd_Yw.d.cts → types-CjxZekMH.d.ts} +10 -4
  89. package/dist/types-DtcOLALn.d.cts +137 -0
  90. package/package.json +25 -26
  91. package/dist/acp-server-CiUqN3G3.d.ts +0 -24
  92. package/dist/acp-server-Dlj7D563.d.cts +0 -24
  93. package/dist/chunk-AVVDPXP4.js +0 -39
  94. package/dist/chunk-F63TPOI3.js +0 -29
  95. package/dist/chunk-V5TSWS7P.js +0 -62
  96. package/dist/types-BNNtOXu3.d.cts +0 -446
  97. package/dist/types-DFUtpxah.d.ts +0 -446
package/README.md CHANGED
@@ -44,6 +44,25 @@ Requires Node.js 22+.
44
44
 
45
45
  Each adapter wraps a different LLM framework. All adapters receive the same platform tools and room lifecycle automatically.
46
46
 
47
+ ### GitHub Copilot CLI ACP (public preview)
48
+
49
+ `CopilotACPAdapter` connects Band rooms to [GitHub Copilot CLI's ACP server](https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server). Install the optional ACP peer alongside the CLI, then use the default stdio transport:
50
+
51
+ ```bash
52
+ pnpm add @agentclientprotocol/sdk
53
+ npm install -g @github/copilot
54
+ ```
55
+
56
+ ```ts
57
+ import { CopilotACPAdapter } from "@band-ai/sdk";
58
+
59
+ const adapter = new CopilotACPAdapter({ cwd: process.cwd() });
60
+ ```
61
+
62
+ It launches `copilot --acp --stdio`. For an already-running listener, use `{ host, port }`; the SDK only owns its client socket, never that listener. The default injected Band MCP server is loopback-only, so a remote/containerized Copilot server needs `enableMcpTools: false` and caller-provided reachable `mcpServers`.
63
+
64
+ Copilot CLI authentication and BYOK remain CLI configuration. Supply auth/BYOK environment variables through `env` only for stdio; a TCP listener already owns its environment. ACP is public preview, and Copilot tool filtering and reasoning effort are server launch-time settings rather than per-session adapter options.
65
+
47
66
  ### Generic
48
67
 
49
68
  Bring your own logic with a single async callback:
@@ -160,6 +179,28 @@ const agent = Agent.create({
160
179
  await agent.run();
161
180
  ```
162
181
 
182
+ ### OMP ACP
183
+
184
+ `OmpACPAdapter` connects Band rooms to [OMP's](https://omp.sh/) ACP server. Install the optional ACP peer alongside OMP itself:
185
+
186
+ ```bash
187
+ pnpm add @agentclientprotocol/sdk
188
+ curl -fsSL https://omp.sh/install | sh
189
+ ```
190
+
191
+ ```ts
192
+ import { Agent, OmpACPAdapter, loadAgentConfig } from "@band-ai/sdk";
193
+
194
+ const agent = Agent.create({
195
+ adapter: new OmpACPAdapter({ cwd: process.cwd() }),
196
+ config: loadAgentConfig("my_agent"),
197
+ });
198
+
199
+ await agent.run();
200
+ ```
201
+
202
+ It launches `omp acp`. OMP performs `read`/`write`/`bash` itself — this SDK's ACP client doesn't implement `fs`/`terminal` handlers, so `clientCapabilities` is left unset — but OMP still gates `bash`/`edit`/`delete`/`move` through `session/request_permission` under its default (non-yolo) ACP approval mode; don't configure OMP with `tools.approvalMode: yolo` if you want that gate to stay active. OMP resolves its own provider credentials (a stored login or one of 60+ provider-specific environment variables — see [OMP's provider docs](https://github.com/can1357/oh-my-pi/blob/main/docs/providers.md)); pass any needed values through `env`. The SDK never reads or logs them.
203
+
163
204
  ### LangGraph
164
205
 
165
206
  ```ts
@@ -204,6 +245,8 @@ import { Agent, SimpleAdapter, loadAgentConfig } from "@band-ai/sdk";
204
245
  import type { AdapterToolsProtocol, HistoryProvider, PlatformMessage } from "@band-ai/sdk";
205
246
 
206
247
  class MyAdapter extends SimpleAdapter<HistoryProvider> {
248
+ protected readonly provider = "my-adapter";
249
+
207
250
  async onMessage(message: PlatformMessage, tools: AdapterToolsProtocol): Promise<void> {
208
251
  await tools.sendMessage("Hello from my custom adapter!");
209
252
  }
@@ -328,6 +371,8 @@ Working examples live in `examples/`. Each folder is self-contained.
328
371
  | `examples/gemini/` | Gemini | Gemini 3 Flash |
329
372
  | `examples/claude-sdk/` | Claude Agent SDK | MCP tools, room-scoped resume |
330
373
  | `examples/codex/` | Codex | Thread mapping, local commands |
374
+ | `examples/omp-acp/` | OMP | ACP stdio, permission-gated writes |
375
+ | `examples/copilot-acp/` | GitHub Copilot CLI | ACP stdio or existing TCP listener |
331
376
  | `examples/langgraph/` | LangGraph | Graph-based agent |
332
377
  | `examples/custom-adapter/` | SimpleAdapter | Custom adapter protocol |
333
378
  | `examples/parlant/` | Parlant | Guideline-based behavior |
@@ -362,11 +407,19 @@ Agent.create({ adapter, config })
362
407
 
363
408
  `agent.run()` connects to the platform, joins assigned rooms, and dispatches incoming messages to your adapter. It handles `SIGINT`/`SIGTERM` for graceful shutdown. Pass `{ signals: false }` to disable signal handling in tests.
364
409
 
410
+ ## Migration
411
+
412
+ Adapter failure reporting is structured (`MessagingTools.sendFailure`, required
413
+ `SimpleAdapter.provider`, nested A2A `metadata.failure`). See
414
+ [docs/migrations/structured-adapter-failure-reporting.md](docs/migrations/structured-adapter-failure-reporting.md).
415
+
365
416
  ## Development
366
417
 
367
418
  ```bash
368
419
  pnpm install
420
+ pnpm build # build dist/ — some tests compile a consumer against it
369
421
  pnpm test # unit tests
370
422
  pnpm typecheck # tsc --noEmit
371
- pnpm build # build dist/
372
423
  ```
424
+
425
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for which tests need that build and why.
@@ -1,12 +1,13 @@
1
- import { S as SimpleAdapter } from './simpleAdapter--wznuoOw.js';
2
- import { A as AdapterToolsProtocol, a as AgentToolsProtocol, c as MessagingTools, T as ToolExecutor, f as ToolSchemaProvider, H as HistoryConverter } from './protocols-Bwwcql0h.js';
3
- import { H as HistoryProvider, P as PlatformMessage } from './types-DFUtpxah.js';
1
+ import { S as SimpleAdapter } from './simpleAdapter-eLvsAQNo.js';
2
+ import { A as AdapterToolsProtocol, b as AgentToolsProtocol, e as MessagingTools, T as ToolExecutor, i as ToolSchemaProvider, H as HistoryConverter } from './protocols-Dpci6uae.js';
3
+ import { H as HistoryProvider, P as PlatformMessage } from './types-CKU1N0SK.js';
4
4
  import { L as Logger } from './logger-CABQOnlR.js';
5
- import { C as CustomToolDef } from './customTools-BzF0IISO.js';
6
- import { m as ToolModelMessage, n as ToolModelSchema, M as MetadataMap } from './dtos-B8KU_q4d.js';
7
- import { s as GoogleADKMessages, q as GoogleADKHistoryConverter, e as A2ASessionState, A as A2AAuth, G as GatewaySessionState, a as A2AGatewayAdapterOptions, n as ParlantMessages, P as ParlantHistoryConverter, t as OpencodeSessionState, O as OpencodeHistoryConverter } from './opencode-Bld62x5t.js';
8
- import { c as createBandMcpBackend } from './backends-D-dBdDm-.js';
9
- import { M as McpToolRegistration } from './sdk-qKJtMma_.js';
5
+ import { C as CustomToolDef } from './customTools-Bfecd0mJ.js';
6
+ import { m as ToolModelMessage, n as ToolModelSchema, M as MetadataMap } from './dtos-CjQsN1_h.js';
7
+ import { u as GoogleADKMessages, s as GoogleADKHistoryConverter, e as A2ASessionState, A as A2AAuth, G as GatewaySessionState, a as A2AGatewayAdapterOptions, n as ParlantMessages, P as ParlantHistoryConverter, C as ChatTurn, v as OpencodeSessionState, O as OpencodeHistoryConverter, r as ACPClientSessionState } from './acp-client-DUXyczlF.js';
8
+ import { c as createBandMcpBackend } from './backends-CgsPQa9B.js';
9
+ import { M as McpToolRegistration } from './sdk-Cin80BTC.js';
10
+ import { Client, ClientSideConnection, RequestPermissionRequest, McpServer, ClientCapabilities, SessionMode, SessionConfigSelectOption } from '@agentclientprotocol/sdk';
10
11
 
11
12
  type GenericAdapterHandler = (args: {
12
13
  message: PlatformMessage;
@@ -20,6 +21,7 @@ type GenericAdapterHandler = (args: {
20
21
  agentDescription: string;
21
22
  }) => Promise<void>;
22
23
  declare class GenericAdapter extends SimpleAdapter<HistoryProvider> {
24
+ protected readonly provider = "generic";
23
25
  private readonly handler;
24
26
  constructor(handler: GenericAdapterHandler);
25
27
  onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: HistoryProvider, participantsMessage: string | null, contactsMessage: string | null, context: {
@@ -108,7 +110,7 @@ type CodexRpcEvent = CodexRpcRequestEvent | CodexRpcNotificationEvent;
108
110
  interface CodexClientLike {
109
111
  connect(): Promise<void>;
110
112
  initialize(params: InitializeParams): Promise<void>;
111
- request<TResult>(method: string, params?: Record<string, unknown>): Promise<TResult>;
113
+ request<TResult>(method: string, params?: Record<string, unknown>, timeoutMs?: number): Promise<TResult>;
112
114
  notify(method: string, params?: Record<string, unknown>): Promise<void>;
113
115
  respond(requestId: RequestId, result: Record<string, unknown> | DynamicToolCallResponse): Promise<void>;
114
116
  respondError(requestId: RequestId, code: number, message: string, data?: unknown): Promise<void>;
@@ -140,7 +142,7 @@ declare class CodexAppServerStdioClient implements CodexClientLike {
140
142
  });
141
143
  connect(): Promise<void>;
142
144
  initialize(params: InitializeParams): Promise<void>;
143
- request<TResult>(method: string, params?: Record<string, unknown>): Promise<TResult>;
145
+ request<TResult>(method: string, params?: Record<string, unknown>, timeoutMs?: number): Promise<TResult>;
144
146
  notify(method: string, params?: Record<string, unknown>): Promise<void>;
145
147
  respond(requestId: RequestId, result: Record<string, unknown> | DynamicToolCallResponse): Promise<void>;
146
148
  respondError(requestId: RequestId, code: number, message: string, data?: unknown): Promise<void>;
@@ -200,6 +202,7 @@ interface CodexAdapterOptions {
200
202
  logger?: Logger;
201
203
  }
202
204
  declare class CodexAdapter extends SimpleAdapter<HistoryProvider, AgentToolsProtocol> {
205
+ protected readonly provider = "codex";
203
206
  private readonly baseConfig;
204
207
  private readonly roomConfigOverrides;
205
208
  private readonly customTools;
@@ -221,14 +224,21 @@ declare class CodexAdapter extends SimpleAdapter<HistoryProvider, AgentToolsProt
221
224
  isSessionBootstrap: boolean;
222
225
  roomId: string;
223
226
  }): Promise<void>;
227
+ private ensureClientAndThread;
228
+ private startTurn;
229
+ private runEventLoop;
224
230
  onCleanup(roomId: string): Promise<void>;
225
231
  onRuntimeStop(): Promise<void>;
226
232
  private getConfig;
227
233
  private ensureSystemPrompt;
228
234
  private ensureClient;
235
+ private takeClientForReset;
229
236
  private resetClient;
237
+ private abandonClient;
238
+ private evictOnTransportFailure;
230
239
  private debug;
231
240
  private getOrCreateThread;
241
+ private assertCurrentClient;
232
242
  private buildThreadStartParams;
233
243
  private buildThreadResumeParams;
234
244
  private buildThreadConfigOverrides;
@@ -241,9 +251,15 @@ declare class CodexAdapter extends SimpleAdapter<HistoryProvider, AgentToolsProt
241
251
  private extractToolItem;
242
252
  private extractThoughtText;
243
253
  private emitTurnOutcome;
254
+ private reportAndDeliverTurnFailure;
244
255
  private extractTurnError;
245
256
  private currentMention;
246
257
  private handleLocalCommand;
258
+ private handleHelpCommand;
259
+ private handleStatusCommand;
260
+ private handleModelCommand;
261
+ private handleModelListCommand;
262
+ private handleReasoningCommand;
247
263
  private safeSendEvent;
248
264
  }
249
265
 
@@ -280,6 +296,8 @@ interface ToolCallingModel {
280
296
  interface ToolCallingAdapterOptions {
281
297
  model: ToolCallingModel;
282
298
  toolFormat: "openai" | "anthropic";
299
+ /** Passed through as `AgentFailure.provider` on a provider failure. Defaults to `DEFAULT_PROVIDER` when omitted. */
300
+ provider?: string;
283
301
  systemPrompt?: string;
284
302
  includeMemoryTools?: boolean;
285
303
  maxToolRounds?: number;
@@ -291,6 +309,7 @@ type ToolCallingTools = MessagingTools & ToolExecutor & ToolSchemaProvider;
291
309
  declare class ToolCallingAdapter extends SimpleAdapter<HistoryProvider, ToolCallingTools> {
292
310
  private readonly model;
293
311
  private readonly toolFormat;
312
+ protected readonly provider: string;
294
313
  private readonly systemPrompt?;
295
314
  private readonly includeMemoryTools;
296
315
  private readonly maxToolRounds;
@@ -328,7 +347,7 @@ declare class VercelAISDKToolCallingModel implements ToolCallingModel {
328
347
  complete(request: ToolCallingModelRequest): Promise<ToolCallingResponse>;
329
348
  }
330
349
 
331
- interface VercelAISDKAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model">, VercelAISDKToolCallingModelOptions {
350
+ interface VercelAISDKAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model" | "provider">, VercelAISDKToolCallingModelOptions {
332
351
  }
333
352
  declare class VercelAISDKAdapter extends ToolCallingAdapter {
334
353
  constructor(options: VercelAISDKAdapterOptions);
@@ -367,7 +386,7 @@ declare class OpenAIToolCallingModel implements ToolCallingModel {
367
386
  private getClient;
368
387
  }
369
388
 
370
- interface OpenAIAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model"> {
389
+ interface OpenAIAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model" | "provider"> {
371
390
  model?: ToolCallingModel;
372
391
  openAIModel?: string;
373
392
  apiKey?: string;
@@ -405,7 +424,7 @@ declare class AnthropicToolCallingModel implements ToolCallingModel {
405
424
  private getClient;
406
425
  }
407
426
 
408
- interface AnthropicAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model"> {
427
+ interface AnthropicAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model" | "provider"> {
409
428
  model?: ToolCallingModel;
410
429
  anthropicModel?: string;
411
430
  apiKey?: string;
@@ -459,7 +478,7 @@ declare class GeminiToolCallingModel implements ToolCallingModel {
459
478
  private ensurePartFactories;
460
479
  }
461
480
 
462
- interface GeminiAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model"> {
481
+ interface GeminiAdapterOptions extends Omit<ToolCallingAdapterOptions, "toolFormat" | "model" | "provider"> {
463
482
  model?: ToolCallingModel;
464
483
  geminiModel?: string;
465
484
  apiKey?: string;
@@ -534,6 +553,7 @@ interface GoogleADKAdapterOptions {
534
553
  sdkFactory?: () => Promise<GoogleAdkSdkLike>;
535
554
  }
536
555
  declare class GoogleADKAdapter extends SimpleAdapter<GoogleADKMessages, AdapterToolsProtocol> {
556
+ protected readonly provider = "google-adk";
537
557
  private readonly model;
538
558
  private readonly systemPromptOverride?;
539
559
  private readonly customSection;
@@ -584,6 +604,7 @@ interface LangGraphAdapterOptions {
584
604
  logger?: Logger;
585
605
  }
586
606
  declare class LangGraphAdapter extends SimpleAdapter<HistoryProvider, AdapterToolsProtocol> {
607
+ protected readonly provider = "langgraph";
587
608
  private readonly llm?;
588
609
  private readonly checkpointer?;
589
610
  private readonly graph?;
@@ -646,6 +667,7 @@ type A2AClientFactory = (input: {
646
667
  authHeaders: Record<string, string>;
647
668
  }) => Promise<A2AClientLike>;
648
669
  declare class A2AAdapter extends SimpleAdapter<A2ASessionState, MessagingTools> {
670
+ protected readonly provider = "a2a";
649
671
  private readonly remoteUrl;
650
672
  private readonly authHeaders;
651
673
  private readonly streaming;
@@ -676,6 +698,7 @@ declare class A2AAdapter extends SimpleAdapter<A2ASessionState, MessagingTools>
676
698
  }
677
699
 
678
700
  declare class A2AGatewayAdapter extends SimpleAdapter<GatewaySessionState, MessagingTools> {
701
+ protected readonly provider = "a2a-gateway";
679
702
  private readonly bandRest;
680
703
  private readonly gatewayUrl;
681
704
  private readonly host;
@@ -686,6 +709,7 @@ declare class A2AGatewayAdapter extends SimpleAdapter<GatewaySessionState, Messa
686
709
  private readonly peerPageSize;
687
710
  private readonly maxPeerPages;
688
711
  private readonly serverFactory;
712
+ private readonly logger;
689
713
  private readonly peersBySlug;
690
714
  private readonly peersById;
691
715
  private readonly contextToRoom;
@@ -774,6 +798,14 @@ interface ParlantAdapterOptions {
774
798
  customSection?: string;
775
799
  includeBaseInstructions?: boolean;
776
800
  responseTimeoutSeconds?: number;
801
+ /**
802
+ * Most turns of prior conversation to replay into a new session.
803
+ * Defaults to 100. The value is a cap, not a toggle: `0` replays none.
804
+ *
805
+ * A reply is never replayed without the question it answers, so the result
806
+ * can be one turn shorter than the cap - and `1` replays nothing whenever
807
+ * the newest turn is an answer.
808
+ */
777
809
  maxHistoryMessages?: number;
778
810
  historyConverter?: ParlantHistoryConverter;
779
811
  clientFactory?: ParlantClientFactory;
@@ -781,6 +813,7 @@ interface ParlantAdapterOptions {
781
813
  }
782
814
  type ParlantClientFactory = () => Promise<ParlantClientLike>;
783
815
  declare class ParlantAdapter extends SimpleAdapter<ParlantMessages, MessagingTools> {
816
+ protected readonly provider = "parlant";
784
817
  private readonly environment;
785
818
  private readonly baseUrl?;
786
819
  private readonly agentId;
@@ -818,9 +851,7 @@ declare class ParlantAdapter extends SimpleAdapter<ParlantMessages, MessagingToo
818
851
  private createClient;
819
852
  }
820
853
 
821
- interface LettaMessage {
822
- role: "user" | "assistant";
823
- content: string;
854
+ interface LettaMessage extends ChatTurn {
824
855
  sender: string;
825
856
  senderType: string;
826
857
  }
@@ -922,6 +953,14 @@ interface LettaAdapterOptions {
922
953
  systemPrompt?: string;
923
954
  customSection?: string;
924
955
  includeBaseInstructions?: boolean;
956
+ /**
957
+ * Most turns of prior conversation to replay into a new session.
958
+ * Defaults to 100. The value is a cap, not a toggle: `0` replays none.
959
+ *
960
+ * A reply is never replayed without the question it answers, so the result
961
+ * can be one turn shorter than the cap - and `1` replays nothing whenever
962
+ * the newest turn is an answer.
963
+ */
925
964
  maxHistoryMessages?: number;
926
965
  emitReasoningEvents?: boolean;
927
966
  historyConverter?: LettaHistoryConverter;
@@ -929,6 +968,7 @@ interface LettaAdapterOptions {
929
968
  logger?: Logger;
930
969
  }
931
970
  declare class LettaAdapter extends SimpleAdapter<LettaMessages, AdapterToolsProtocol> {
971
+ protected readonly provider = "letta";
932
972
  private readonly model;
933
973
  private readonly lettaApiKey?;
934
974
  private readonly lettaBaseUrl?;
@@ -1145,6 +1185,7 @@ interface OpencodeAdapterOptions {
1145
1185
  logger?: Logger;
1146
1186
  }
1147
1187
  declare class OpencodeAdapter extends SimpleAdapter<OpencodeSessionState, AdapterToolsProtocol> {
1188
+ protected readonly provider = "opencode";
1148
1189
  private readonly config;
1149
1190
  private readonly customTools;
1150
1191
  private readonly clientFactory;
@@ -1163,6 +1204,7 @@ declare class OpencodeAdapter extends SimpleAdapter<OpencodeSessionState, Adapte
1163
1204
  isSessionBootstrap: boolean;
1164
1205
  roomId: string;
1165
1206
  }): Promise<void>;
1207
+ private startTurn;
1166
1208
  onCleanup(roomId: string): Promise<void>;
1167
1209
  private getOrCreateRoomState;
1168
1210
  private ensureClientStarted;
@@ -1187,10 +1229,22 @@ declare class OpencodeAdapter extends SimpleAdapter<OpencodeSessionState, Adapte
1187
1229
  private ensureSession;
1188
1230
  private beginTurn;
1189
1231
  private watchTurnCompletion;
1232
+ private handleTurnTimeout;
1233
+ private abortAndAbandonSession;
1234
+ private abandonSession;
1235
+ private handleSessionError;
1236
+ private reportTerminalFailure;
1190
1237
  private releaseTurnWait;
1191
1238
  private finishTurn;
1239
+ private failInteractivePromptDelivery;
1192
1240
  private clearTurnState;
1193
1241
  private emitSessionTaskEvent;
1242
+ /**
1243
+ * "blocked" and "empty" are both a no-op today, but `deliverFallbackText`
1244
+ * needs to tell them apart: only "empty" means the shared guard already
1245
+ * passed, so it's safe to go on and send its own fallback message.
1246
+ */
1247
+ private flushTurnText;
1194
1248
  private deliverFallbackText;
1195
1249
  private reportToolCall;
1196
1250
  private reportToolResult;
@@ -1200,7 +1254,7 @@ declare class OpencodeAdapter extends SimpleAdapter<OpencodeSessionState, Adapte
1200
1254
  private parsePermissionReply;
1201
1255
  private parseQuestionAnswers;
1202
1256
  private formatQuestionPrompt;
1203
- private formatError;
1257
+ private toAgentFailure;
1204
1258
  private formatOpenCodeError;
1205
1259
  }
1206
1260
 
@@ -1216,6 +1270,7 @@ interface ClaudeSDKMessageLike {
1216
1270
  type: string;
1217
1271
  session_id?: string;
1218
1272
  subtype?: string;
1273
+ is_error?: boolean;
1219
1274
  result?: unknown;
1220
1275
  summary?: string;
1221
1276
  message?: ClaudeAssistantMessage;
@@ -1252,6 +1307,7 @@ interface ClaudeSDKAdapterOptions {
1252
1307
  logger?: Logger;
1253
1308
  }
1254
1309
  declare class ClaudeSDKAdapter extends SimpleAdapter<HistoryProvider, AdapterToolsProtocol> {
1310
+ protected readonly provider = "claude-sdk";
1255
1311
  private readonly model;
1256
1312
  private readonly customSection?;
1257
1313
  private readonly includeBaseInstructions;
@@ -1276,8 +1332,173 @@ declare class ClaudeSDKAdapter extends SimpleAdapter<HistoryProvider, AdapterToo
1276
1332
  roomId: string;
1277
1333
  }): Promise<void>;
1278
1334
  private doMessage;
1335
+ private startQuery;
1336
+ private consumeQueryEvents;
1279
1337
  onCleanup(roomId: string): Promise<void>;
1280
1338
  private reportSessionId;
1281
1339
  }
1282
1340
 
1283
- export { type DynamicToolSpec as $, A2AAdapter as A, OpencodeAdapter as B, CODEX_REASONING_EFFORTS as C, type OpencodeAdapterConfig as D, type OpencodeApprovalMode as E, type OpencodeApprovalReply as F, GeminiAdapter as G, type OpencodeQuestionMode as H, type ParlantAdapterOptions as I, type VercelAISDKAdapterOptions as J, type A2AClientFactory as K, LangGraphAdapter as L, type A2AClientLike as M, type AnthropicClientFactory as N, OpenAIAdapter as O, ParlantAdapter as P, AnthropicToolCallingModel as Q, type AnthropicToolCallingModelOptions as R, type ClaudeSDKQuery as S, type ToolCallingModel as T, type ClaudeSDKQueryParams as U, VercelAISDKAdapter as V, CodexAppServerStdioClient as W, type CodexClientLike as X, CodexJsonRpcError as Y, type DynamicToolCallParams as Z, type DynamicToolCallResponse as _, type A2AAdapterOptions as a, type GeminiClientFactory as a0, GeminiToolCallingModel as a1, type GeminiToolCallingModelOptions as a2, HttpOpencodeClient as a3, type HttpOpencodeClientOptions as a4, HttpStatusError as a5, type LettaAgentCreateParams as a6, type LettaClientFactory as a7, type LettaClientLike as a8, LettaHistoryConverter as a9, type LettaMessage as aa, type LettaMessageCreateParams as ab, type LettaMessages as ac, type LettaRequestOptions as ad, type LettaResponse as ae, type LettaResponseMessage as af, type OpenAIClientFactory as ag, OpenAIToolCallingModel as ah, type OpenAIToolCallingModelOptions as ai, type OpencodeClientLike as aj, type ParlantClientFactory as ak, type ParlantClientLike as al, type ToolCall as am, ToolCallingAdapter as an, type ToolCallingAdapterOptions as ao, type ToolCallingModelRequest as ap, type ToolCallingResponse as aq, type ToolResult as ar, type TurnStartParams as as, VercelAISDKToolCallingModel as at, type VercelAISDKToolCallingModelOptions as au, runSingleToolRound as av, A2AGatewayAdapter as b, AnthropicAdapter as c, type AnthropicAdapterOptions as d, CODEX_REASONING_SUMMARIES as e, CODEX_WEB_SEARCH_MODES as f, type ClaudePermissionMode as g, ClaudeSDKAdapter as h, type ClaudeSDKAdapterOptions as i, CodexAdapter as j, type CodexAdapterConfig as k, type CodexApprovalPolicy as l, type CodexReasoningEffort as m, type CodexReasoningSummary as n, type CodexSandboxMode as o, type CodexWebSearchMode as p, type GeminiAdapterOptions as q, GenericAdapter as r, type GenericAdapterHandler as s, GoogleADKAdapter as t, type GoogleADKAdapterOptions as u, type LangGraphAdapterOptions as v, type LangGraphGraph as w, LettaAdapter as x, type LettaAdapterOptions as y, type OpenAIAdapterOptions as z };
1341
+ interface ACPClientConnectionHandle {
1342
+ connection: ClientSideConnection;
1343
+ stop(): Promise<void>;
1344
+ }
1345
+ type ACPClientConnectionFactory = (client: Client, options: {
1346
+ command: string[];
1347
+ cwd?: string;
1348
+ env?: Record<string, string>;
1349
+ }) => Promise<ACPClientConnectionHandle>;
1350
+ type ACPPermissionRequest = RequestPermissionRequest & {
1351
+ roomId: string;
1352
+ };
1353
+ type ACPPermissionAbandonReason = "timeout" | "room-closed" | "adapter-stopped" | "connection-lost";
1354
+ type ACPPermissionEndReason = ACPPermissionAbandonReason | "settled" | "no-answer";
1355
+
1356
+ interface ACPModeRequest {
1357
+ roomId: string;
1358
+ sessionId: string;
1359
+ currentModeId: string;
1360
+ modes: readonly SessionMode[];
1361
+ }
1362
+ interface ACPModelRequest {
1363
+ roomId: string;
1364
+ sessionId: string;
1365
+ currentModelId: string;
1366
+ models: readonly SessionConfigSelectOption[];
1367
+ }
1368
+ interface ACPClientAdapterBaseOptions {
1369
+ cwd?: string;
1370
+ env?: Record<string, string>;
1371
+ mcpServers?: McpServer[];
1372
+ authMethod?: string | null;
1373
+ enableMemoryTools?: boolean;
1374
+ enableMcpTools?: boolean;
1375
+ additionalMcpTools?: McpToolRegistration[];
1376
+ clientCapabilities?: ClientCapabilities;
1377
+ connectionFactory?: ACPClientConnectionFactory;
1378
+ resolvePermission?: (request: ACPPermissionRequest, signal: AbortSignal) => Promise<string | undefined>;
1379
+ permissionTimeoutMs?: number;
1380
+ turnTimeoutMs?: number;
1381
+ resolveSessionMode?: (request: ACPModeRequest, signal: AbortSignal) => Promise<string | undefined>;
1382
+ resolveSessionModel?: (request: ACPModelRequest, signal: AbortSignal) => Promise<string | undefined>;
1383
+ logger?: Logger;
1384
+ }
1385
+ interface ACPClientStdioOptions extends ACPClientAdapterBaseOptions {
1386
+ command: string | string[];
1387
+ host?: never;
1388
+ port?: never;
1389
+ }
1390
+ interface ACPClientTcpOptions extends ACPClientAdapterBaseOptions {
1391
+ command?: never;
1392
+ host: string;
1393
+ port: number;
1394
+ }
1395
+ type ACPClientAdapterOptions = ACPClientStdioOptions | ACPClientTcpOptions;
1396
+ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
1397
+ protected readonly provider: string;
1398
+ private readonly command;
1399
+ private readonly cwd;
1400
+ private readonly env?;
1401
+ private readonly mcpServers;
1402
+ private readonly authMethod?;
1403
+ private readonly enableMemoryTools;
1404
+ private readonly enableMcpTools;
1405
+ private readonly additionalMcpTools;
1406
+ private readonly clientCapabilities?;
1407
+ private readonly connectionFactory?;
1408
+ private readonly tcpEndpoint;
1409
+ private readonly roomToSession;
1410
+ private readonly sessionToRoom;
1411
+ private readonly roomTools;
1412
+ private readonly activeSessions;
1413
+ private readonly bootstrappedSessions;
1414
+ private readonly abandonedSessions;
1415
+ private readonly pendingPermissions;
1416
+ private readonly sessionsInFlight;
1417
+ private readonly roomTurnLocks;
1418
+ private readonly roomGeneration;
1419
+ private readonly resolvePermission?;
1420
+ private readonly resolveSessionMode?;
1421
+ private readonly resolveSessionModel?;
1422
+ private readonly permissionTimeoutMs;
1423
+ private readonly turnTimeoutMs;
1424
+ private readonly logger;
1425
+ private backend;
1426
+ private backendPromise;
1427
+ private client;
1428
+ private connectionHandle;
1429
+ private pendingConnectionStop;
1430
+ private connection;
1431
+ private connectionState;
1432
+ private started;
1433
+ private systemPrompt;
1434
+ private spawnPromise;
1435
+ private connectionGeneration;
1436
+ constructor(options: ACPClientAdapterOptions);
1437
+ onStarted(agentName: string, agentDescription: string): Promise<void>;
1438
+ onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState, participantsMessage: string | null, contactsMessage: string | null, context: {
1439
+ isSessionBootstrap: boolean;
1440
+ roomId: string;
1441
+ }): Promise<void>;
1442
+ private runTurn;
1443
+ private abandonTimedOutTurn;
1444
+ private withRoomTurnLock;
1445
+ onCleanup(roomId: string): Promise<void>;
1446
+ onRuntimeStop(): Promise<void>;
1447
+ stop(): Promise<void>;
1448
+ private rehydrate;
1449
+ private linkSession;
1450
+ private nextRoomGeneration;
1451
+ private isCurrentGeneration;
1452
+ private raceAgainstConnectionClose;
1453
+ private unlinkRoom;
1454
+ private unlinkOwner;
1455
+ private sessionKey;
1456
+ private ensureConnection;
1457
+ private spawnConnection;
1458
+ private getOrCreateSession;
1459
+ private establishSession;
1460
+ private linkOrAbandon;
1461
+ private configureSessionMode;
1462
+ private configureSessionModel;
1463
+ private resolveManualSelection;
1464
+ private tryRestoreSession;
1465
+ private buildSessionMcpServers;
1466
+ private getOrCreateBackend;
1467
+ private createBackend;
1468
+ private buildSystemContext;
1469
+ private routePermissionRequest;
1470
+ private handlePermissionRequest;
1471
+ private toResponse;
1472
+ private safeWarn;
1473
+ private resolveManually;
1474
+ private discardLateAnswer;
1475
+ private abandon;
1476
+ private trackPending;
1477
+ private untrackPending;
1478
+ private cancelPendingPermissions;
1479
+ private cancelAllPendingPermissions;
1480
+ private pruneConnectionGeneration;
1481
+ private flushChunks;
1482
+ }
1483
+
1484
+ declare const DEFAULT_OMP_ACP_COMMAND: readonly ["omp", "acp"];
1485
+ interface OmpACPAdapterOptions extends Omit<ACPClientStdioOptions, "command"> {
1486
+ command?: string | string[];
1487
+ }
1488
+ declare class OmpACPAdapter extends ACPClientAdapter {
1489
+ protected readonly provider = "omp-acp";
1490
+ constructor(options?: OmpACPAdapterOptions);
1491
+ }
1492
+
1493
+ declare const DEFAULT_COPILOT_ACP_COMMAND: readonly ["copilot", "--acp", "--stdio"];
1494
+ interface CopilotACPStdioOptions extends Omit<ACPClientStdioOptions, "command"> {
1495
+ command?: string | string[];
1496
+ }
1497
+ type CopilotACPTcpOptions = ACPClientTcpOptions;
1498
+ type CopilotACPAdapterOptions = CopilotACPStdioOptions | CopilotACPTcpOptions;
1499
+ declare class CopilotACPAdapter extends ACPClientAdapter {
1500
+ protected readonly provider = "copilot-acp";
1501
+ constructor(options?: CopilotACPAdapterOptions);
1502
+ }
1503
+
1504
+ export { type VercelAISDKAdapterOptions as $, A2AAdapter as A, type GeminiAdapterOptions as B, CODEX_REASONING_EFFORTS as C, DEFAULT_COPILOT_ACP_COMMAND as D, GenericAdapter as E, type GenericAdapterHandler as F, GeminiAdapter as G, GoogleADKAdapter as H, type GoogleADKAdapterOptions as I, type LangGraphAdapterOptions as J, type LangGraphGraph as K, LangGraphAdapter as L, LettaAdapter as M, type LettaAdapterOptions as N, OmpACPAdapter as O, type OmpACPAdapterOptions as P, OpenAIAdapter as Q, type OpenAIAdapterOptions as R, OpencodeAdapter as S, type OpencodeAdapterConfig as T, type OpencodeApprovalMode as U, type OpencodeApprovalReply as V, type OpencodeQuestionMode as W, ParlantAdapter as X, type ParlantAdapterOptions as Y, type ToolCallingModel as Z, VercelAISDKAdapter as _, type A2AAdapterOptions as a, type A2AClientFactory as a0, type A2AClientLike as a1, type ACPPermissionAbandonReason as a2, type ACPPermissionEndReason as a3, type ACPPermissionRequest as a4, type AnthropicClientFactory as a5, AnthropicToolCallingModel as a6, type AnthropicToolCallingModelOptions as a7, type ClaudeSDKQuery as a8, type ClaudeSDKQueryParams as a9, type ParlantClientFactory as aA, type ParlantClientLike as aB, type ToolCall as aC, ToolCallingAdapter as aD, type ToolCallingAdapterOptions as aE, type ToolCallingModelRequest as aF, type ToolCallingResponse as aG, type ToolResult as aH, type TurnStartParams as aI, VercelAISDKToolCallingModel as aJ, type VercelAISDKToolCallingModelOptions as aK, runSingleToolRound as aL, CodexAppServerStdioClient as aa, type CodexClientLike as ab, CodexJsonRpcError as ac, type DynamicToolCallParams as ad, type DynamicToolCallResponse as ae, type DynamicToolSpec as af, type GeminiClientFactory as ag, GeminiToolCallingModel as ah, type GeminiToolCallingModelOptions as ai, HttpOpencodeClient as aj, type HttpOpencodeClientOptions as ak, HttpStatusError as al, type LettaAgentCreateParams as am, type LettaClientFactory as an, type LettaClientLike as ao, LettaHistoryConverter as ap, type LettaMessage as aq, type LettaMessageCreateParams as ar, type LettaMessages as as, type LettaRequestOptions as at, type LettaResponse as au, type LettaResponseMessage as av, type OpenAIClientFactory as aw, OpenAIToolCallingModel as ax, type OpenAIToolCallingModelOptions as ay, type OpencodeClientLike as az, A2AGatewayAdapter as b, ACPClientAdapter as c, type ACPClientAdapterBaseOptions as d, type ACPClientAdapterOptions as e, type ACPClientStdioOptions as f, type ACPClientTcpOptions as g, AnthropicAdapter as h, type AnthropicAdapterOptions as i, CODEX_REASONING_SUMMARIES as j, CODEX_WEB_SEARCH_MODES as k, type ClaudePermissionMode as l, ClaudeSDKAdapter as m, type ClaudeSDKAdapterOptions as n, CodexAdapter as o, type CodexAdapterConfig as p, type CodexApprovalPolicy as q, type CodexReasoningEffort as r, type CodexReasoningSummary as s, type CodexSandboxMode as t, type CodexWebSearchMode as u, CopilotACPAdapter as v, type CopilotACPAdapterOptions as w, type CopilotACPStdioOptions as x, type CopilotACPTcpOptions as y, DEFAULT_OMP_ACP_COMMAND as z };