@band-ai/sdk 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.cjs +311 -96
- package/dist/adapters.d.cts +34 -6
- package/dist/adapters.d.ts +34 -6
- package/dist/adapters.js +307 -95
- package/dist/{chunk-FYVLUGW7.js → chunk-V5TSWS7P.js} +4 -1
- package/dist/converters.cjs +4 -1
- package/dist/converters.js +1 -1
- package/package.json +1 -1
package/dist/adapters.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { A as A2AAdapter, a as A2AAdapterOptions, K as A2AClientFactory, M as A2AClientLike, b as A2AGatewayAdapter, c as AnthropicAdapter, d as AnthropicAdapterOptions, N as AnthropicClientFactory, Q as AnthropicToolCallingModel, R as AnthropicToolCallingModelOptions, C as CODEX_REASONING_EFFORTS, e as CODEX_REASONING_SUMMARIES, f as CODEX_WEB_SEARCH_MODES, g as ClaudePermissionMode, h as ClaudeSDKAdapter, i as ClaudeSDKAdapterOptions, S as ClaudeSDKQuery, U as ClaudeSDKQueryParams, j as CodexAdapter, k as CodexAdapterConfig, W as CodexAppServerStdioClient, l as CodexApprovalPolicy, X as CodexClientLike, Y as CodexJsonRpcError, m as CodexReasoningEffort, n as CodexReasoningSummary, o as CodexSandboxMode, p as CodexWebSearchMode, Z as DynamicToolCallParams, _ as DynamicToolCallResponse, $ as DynamicToolSpec, G as GeminiAdapter, q as GeminiAdapterOptions, a0 as GeminiClientFactory, a1 as GeminiToolCallingModel, a2 as GeminiToolCallingModelOptions, r as GenericAdapter, s as GenericAdapterHandler, t as GoogleADKAdapter, u as GoogleADKAdapterOptions, a3 as HttpOpencodeClient, a4 as HttpOpencodeClientOptions, a5 as HttpStatusError, L as LangGraphAdapter, v as LangGraphAdapterOptions, w as LangGraphGraph, x as LettaAdapter, y as LettaAdapterOptions, a6 as LettaAgentCreateParams, a7 as LettaClientFactory, a8 as LettaClientLike, a9 as LettaHistoryConverter, aa as LettaMessage, ab as LettaMessageCreateParams, ac as LettaMessages, ad as LettaRequestOptions, ae as LettaResponse, af as LettaResponseMessage, O as OpenAIAdapter, z as OpenAIAdapterOptions, ag as OpenAIClientFactory, ah as OpenAIToolCallingModel, ai as OpenAIToolCallingModelOptions, B as OpencodeAdapter, D as OpencodeAdapterConfig, E as OpencodeApprovalMode, F as OpencodeApprovalReply, aj as OpencodeClientLike, H as OpencodeQuestionMode, P as ParlantAdapter, I as ParlantAdapterOptions, ak as ParlantClientFactory, al as ParlantClientLike, am as ToolCall, an as ToolCallingAdapter, ao as ToolCallingAdapterOptions, T as ToolCallingModel, ap as ToolCallingModelRequest, aq as ToolCallingResponse, ar as ToolResult, as as TurnStartParams, V as VercelAISDKAdapter, J as VercelAISDKAdapterOptions, at as VercelAISDKToolCallingModel, au as VercelAISDKToolCallingModelOptions, av as runSingleToolRound } from './ClaudeSDKAdapter-Cx6zhSaG.cjs';
|
|
2
2
|
import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
|
|
3
|
-
import { Client, ClientSideConnection, McpServer, ClientCapabilities,
|
|
3
|
+
import { Client, ClientSideConnection, RequestPermissionRequest, McpServer, ClientCapabilities, SessionMode, AgentSideConnection, SessionModeState, Agent, InitializeResponse, Implementation, Stream, InitializeRequest, LoadSessionRequest, LoadSessionResponse, ListSessionsRequest, ListSessionsResponse, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionModelRequest, SetSessionModelResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, AuthenticateRequest, AuthenticateResponse, PromptRequest, PromptResponse } from '@agentclientprotocol/sdk';
|
|
4
4
|
import { A as ACPClientSessionState, a as ACPServerSessionState } from './acp-server-Dlj7D563.cjs';
|
|
5
5
|
export { G as GatewayHistoryConverter } from './acp-server-Dlj7D563.cjs';
|
|
6
6
|
import { S as SimpleAdapter } from './simpleAdapter-BpT4XbZC.cjs';
|
|
@@ -40,7 +40,18 @@ type ACPClientConnectionFactory = (client: Client, options: {
|
|
|
40
40
|
cwd?: string;
|
|
41
41
|
env?: Record<string, string>;
|
|
42
42
|
}) => Promise<ACPClientConnectionHandle>;
|
|
43
|
+
type ACPPermissionRequest = RequestPermissionRequest & {
|
|
44
|
+
roomId: string;
|
|
45
|
+
};
|
|
46
|
+
type ACPPermissionAbandonReason = "timeout" | "room-closed" | "adapter-stopped" | "connection-lost";
|
|
47
|
+
type ACPPermissionEndReason = ACPPermissionAbandonReason | "settled" | "no-answer";
|
|
43
48
|
|
|
49
|
+
interface ACPModeRequest {
|
|
50
|
+
roomId: string;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
currentModeId: string;
|
|
53
|
+
modes: readonly SessionMode[];
|
|
54
|
+
}
|
|
44
55
|
interface ACPClientAdapterOptions {
|
|
45
56
|
command: string | string[];
|
|
46
57
|
cwd?: string;
|
|
@@ -52,9 +63,9 @@ interface ACPClientAdapterOptions {
|
|
|
52
63
|
additionalMcpTools?: McpToolRegistration[];
|
|
53
64
|
clientCapabilities?: ClientCapabilities;
|
|
54
65
|
connectionFactory?: ACPClientConnectionFactory;
|
|
55
|
-
resolvePermission?: (request:
|
|
66
|
+
resolvePermission?: (request: ACPPermissionRequest, signal: AbortSignal) => Promise<string | undefined>;
|
|
56
67
|
permissionTimeoutMs?: number;
|
|
57
|
-
|
|
68
|
+
resolveSessionMode?: (request: ACPModeRequest, signal: AbortSignal) => Promise<string | undefined>;
|
|
58
69
|
logger?: Logger;
|
|
59
70
|
}
|
|
60
71
|
declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
|
|
@@ -69,13 +80,17 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
69
80
|
private readonly clientCapabilities?;
|
|
70
81
|
private readonly connectionFactory;
|
|
71
82
|
private readonly roomToSession;
|
|
83
|
+
private readonly sessionToRoom;
|
|
72
84
|
private readonly roomTools;
|
|
73
85
|
private readonly activeSessions;
|
|
74
86
|
private readonly bootstrappedSessions;
|
|
75
87
|
private readonly pendingPermissions;
|
|
88
|
+
private readonly sessionsInFlight;
|
|
89
|
+
private readonly roomTurnLocks;
|
|
90
|
+
private readonly roomGeneration;
|
|
76
91
|
private readonly resolvePermission?;
|
|
92
|
+
private readonly resolveSessionMode?;
|
|
77
93
|
private readonly permissionTimeoutMs;
|
|
78
|
-
private readonly requestedPermissionMode?;
|
|
79
94
|
private readonly logger;
|
|
80
95
|
private backend;
|
|
81
96
|
private backendPromise;
|
|
@@ -92,23 +107,36 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
92
107
|
isSessionBootstrap: boolean;
|
|
93
108
|
roomId: string;
|
|
94
109
|
}): Promise<void>;
|
|
110
|
+
private runTurn;
|
|
111
|
+
private withRoomTurnLock;
|
|
95
112
|
onCleanup(roomId: string): Promise<void>;
|
|
96
113
|
onRuntimeStop(): Promise<void>;
|
|
97
114
|
stop(): Promise<void>;
|
|
98
115
|
private rehydrate;
|
|
116
|
+
private linkSession;
|
|
117
|
+
private nextRoomGeneration;
|
|
118
|
+
private isCurrentGeneration;
|
|
119
|
+
private raceAgainstConnectionClose;
|
|
120
|
+
private unlinkRoom;
|
|
99
121
|
private ensureConnection;
|
|
100
122
|
private spawnConnection;
|
|
101
123
|
private getOrCreateSession;
|
|
124
|
+
private establishSession;
|
|
125
|
+
private linkOrAbandon;
|
|
126
|
+
private configureSessionMode;
|
|
127
|
+
private resolveSessionModeManually;
|
|
102
128
|
private tryRestoreSession;
|
|
103
|
-
private applyRequestedPermissionMode;
|
|
104
129
|
private buildSessionMcpServers;
|
|
105
130
|
private getOrCreateBackend;
|
|
106
131
|
private createBackend;
|
|
107
132
|
private buildSystemContext;
|
|
133
|
+
private routePermissionRequest;
|
|
108
134
|
private handlePermissionRequest;
|
|
109
135
|
private toResponse;
|
|
110
136
|
private safeWarn;
|
|
111
137
|
private resolveManually;
|
|
138
|
+
private discardLateAnswer;
|
|
139
|
+
private abandon;
|
|
112
140
|
private trackPending;
|
|
113
141
|
private untrackPending;
|
|
114
142
|
private cancelPendingPermissions;
|
|
@@ -233,4 +261,4 @@ declare class ACPServer implements Agent {
|
|
|
233
261
|
extNotification(method: string, params: Record<string, unknown>): Promise<void>;
|
|
234
262
|
}
|
|
235
263
|
|
|
236
|
-
export { ACPClientAdapter, type ACPClientAdapterOptions, ACPServer, type ACPServerOptions, BandACPServerAdapter, type BandACPServerAdapterOptions, GatewayServer, GatewayServerLike, GatewayServerOptions, createGatewayServer };
|
|
264
|
+
export { ACPClientAdapter, type ACPClientAdapterOptions, type ACPPermissionAbandonReason, type ACPPermissionEndReason, type ACPPermissionRequest, ACPServer, type ACPServerOptions, BandACPServerAdapter, type BandACPServerAdapterOptions, GatewayServer, GatewayServerLike, GatewayServerOptions, createGatewayServer };
|
package/dist/adapters.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { A as A2AAdapter, a as A2AAdapterOptions, K as A2AClientFactory, M as A2AClientLike, b as A2AGatewayAdapter, c as AnthropicAdapter, d as AnthropicAdapterOptions, N as AnthropicClientFactory, Q as AnthropicToolCallingModel, R as AnthropicToolCallingModelOptions, C as CODEX_REASONING_EFFORTS, e as CODEX_REASONING_SUMMARIES, f as CODEX_WEB_SEARCH_MODES, g as ClaudePermissionMode, h as ClaudeSDKAdapter, i as ClaudeSDKAdapterOptions, S as ClaudeSDKQuery, U as ClaudeSDKQueryParams, j as CodexAdapter, k as CodexAdapterConfig, W as CodexAppServerStdioClient, l as CodexApprovalPolicy, X as CodexClientLike, Y as CodexJsonRpcError, m as CodexReasoningEffort, n as CodexReasoningSummary, o as CodexSandboxMode, p as CodexWebSearchMode, Z as DynamicToolCallParams, _ as DynamicToolCallResponse, $ as DynamicToolSpec, G as GeminiAdapter, q as GeminiAdapterOptions, a0 as GeminiClientFactory, a1 as GeminiToolCallingModel, a2 as GeminiToolCallingModelOptions, r as GenericAdapter, s as GenericAdapterHandler, t as GoogleADKAdapter, u as GoogleADKAdapterOptions, a3 as HttpOpencodeClient, a4 as HttpOpencodeClientOptions, a5 as HttpStatusError, L as LangGraphAdapter, v as LangGraphAdapterOptions, w as LangGraphGraph, x as LettaAdapter, y as LettaAdapterOptions, a6 as LettaAgentCreateParams, a7 as LettaClientFactory, a8 as LettaClientLike, a9 as LettaHistoryConverter, aa as LettaMessage, ab as LettaMessageCreateParams, ac as LettaMessages, ad as LettaRequestOptions, ae as LettaResponse, af as LettaResponseMessage, O as OpenAIAdapter, z as OpenAIAdapterOptions, ag as OpenAIClientFactory, ah as OpenAIToolCallingModel, ai as OpenAIToolCallingModelOptions, B as OpencodeAdapter, D as OpencodeAdapterConfig, E as OpencodeApprovalMode, F as OpencodeApprovalReply, aj as OpencodeClientLike, H as OpencodeQuestionMode, P as ParlantAdapter, I as ParlantAdapterOptions, ak as ParlantClientFactory, al as ParlantClientLike, am as ToolCall, an as ToolCallingAdapter, ao as ToolCallingAdapterOptions, T as ToolCallingModel, ap as ToolCallingModelRequest, aq as ToolCallingResponse, ar as ToolResult, as as TurnStartParams, V as VercelAISDKAdapter, J as VercelAISDKAdapterOptions, at as VercelAISDKToolCallingModel, au as VercelAISDKToolCallingModelOptions, av as runSingleToolRound } from './ClaudeSDKAdapter-CXud2DBE.js';
|
|
2
2
|
import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
|
|
3
|
-
import { Client, ClientSideConnection, McpServer, ClientCapabilities,
|
|
3
|
+
import { Client, ClientSideConnection, RequestPermissionRequest, McpServer, ClientCapabilities, SessionMode, AgentSideConnection, SessionModeState, Agent, InitializeResponse, Implementation, Stream, InitializeRequest, LoadSessionRequest, LoadSessionResponse, ListSessionsRequest, ListSessionsResponse, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionModelRequest, SetSessionModelResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, AuthenticateRequest, AuthenticateResponse, PromptRequest, PromptResponse } from '@agentclientprotocol/sdk';
|
|
4
4
|
import { A as ACPClientSessionState, a as ACPServerSessionState } from './acp-server-CiUqN3G3.js';
|
|
5
5
|
export { G as GatewayHistoryConverter } from './acp-server-CiUqN3G3.js';
|
|
6
6
|
import { S as SimpleAdapter } from './simpleAdapter--wznuoOw.js';
|
|
@@ -40,7 +40,18 @@ type ACPClientConnectionFactory = (client: Client, options: {
|
|
|
40
40
|
cwd?: string;
|
|
41
41
|
env?: Record<string, string>;
|
|
42
42
|
}) => Promise<ACPClientConnectionHandle>;
|
|
43
|
+
type ACPPermissionRequest = RequestPermissionRequest & {
|
|
44
|
+
roomId: string;
|
|
45
|
+
};
|
|
46
|
+
type ACPPermissionAbandonReason = "timeout" | "room-closed" | "adapter-stopped" | "connection-lost";
|
|
47
|
+
type ACPPermissionEndReason = ACPPermissionAbandonReason | "settled" | "no-answer";
|
|
43
48
|
|
|
49
|
+
interface ACPModeRequest {
|
|
50
|
+
roomId: string;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
currentModeId: string;
|
|
53
|
+
modes: readonly SessionMode[];
|
|
54
|
+
}
|
|
44
55
|
interface ACPClientAdapterOptions {
|
|
45
56
|
command: string | string[];
|
|
46
57
|
cwd?: string;
|
|
@@ -52,9 +63,9 @@ interface ACPClientAdapterOptions {
|
|
|
52
63
|
additionalMcpTools?: McpToolRegistration[];
|
|
53
64
|
clientCapabilities?: ClientCapabilities;
|
|
54
65
|
connectionFactory?: ACPClientConnectionFactory;
|
|
55
|
-
resolvePermission?: (request:
|
|
66
|
+
resolvePermission?: (request: ACPPermissionRequest, signal: AbortSignal) => Promise<string | undefined>;
|
|
56
67
|
permissionTimeoutMs?: number;
|
|
57
|
-
|
|
68
|
+
resolveSessionMode?: (request: ACPModeRequest, signal: AbortSignal) => Promise<string | undefined>;
|
|
58
69
|
logger?: Logger;
|
|
59
70
|
}
|
|
60
71
|
declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
|
|
@@ -69,13 +80,17 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
69
80
|
private readonly clientCapabilities?;
|
|
70
81
|
private readonly connectionFactory;
|
|
71
82
|
private readonly roomToSession;
|
|
83
|
+
private readonly sessionToRoom;
|
|
72
84
|
private readonly roomTools;
|
|
73
85
|
private readonly activeSessions;
|
|
74
86
|
private readonly bootstrappedSessions;
|
|
75
87
|
private readonly pendingPermissions;
|
|
88
|
+
private readonly sessionsInFlight;
|
|
89
|
+
private readonly roomTurnLocks;
|
|
90
|
+
private readonly roomGeneration;
|
|
76
91
|
private readonly resolvePermission?;
|
|
92
|
+
private readonly resolveSessionMode?;
|
|
77
93
|
private readonly permissionTimeoutMs;
|
|
78
|
-
private readonly requestedPermissionMode?;
|
|
79
94
|
private readonly logger;
|
|
80
95
|
private backend;
|
|
81
96
|
private backendPromise;
|
|
@@ -92,23 +107,36 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
92
107
|
isSessionBootstrap: boolean;
|
|
93
108
|
roomId: string;
|
|
94
109
|
}): Promise<void>;
|
|
110
|
+
private runTurn;
|
|
111
|
+
private withRoomTurnLock;
|
|
95
112
|
onCleanup(roomId: string): Promise<void>;
|
|
96
113
|
onRuntimeStop(): Promise<void>;
|
|
97
114
|
stop(): Promise<void>;
|
|
98
115
|
private rehydrate;
|
|
116
|
+
private linkSession;
|
|
117
|
+
private nextRoomGeneration;
|
|
118
|
+
private isCurrentGeneration;
|
|
119
|
+
private raceAgainstConnectionClose;
|
|
120
|
+
private unlinkRoom;
|
|
99
121
|
private ensureConnection;
|
|
100
122
|
private spawnConnection;
|
|
101
123
|
private getOrCreateSession;
|
|
124
|
+
private establishSession;
|
|
125
|
+
private linkOrAbandon;
|
|
126
|
+
private configureSessionMode;
|
|
127
|
+
private resolveSessionModeManually;
|
|
102
128
|
private tryRestoreSession;
|
|
103
|
-
private applyRequestedPermissionMode;
|
|
104
129
|
private buildSessionMcpServers;
|
|
105
130
|
private getOrCreateBackend;
|
|
106
131
|
private createBackend;
|
|
107
132
|
private buildSystemContext;
|
|
133
|
+
private routePermissionRequest;
|
|
108
134
|
private handlePermissionRequest;
|
|
109
135
|
private toResponse;
|
|
110
136
|
private safeWarn;
|
|
111
137
|
private resolveManually;
|
|
138
|
+
private discardLateAnswer;
|
|
139
|
+
private abandon;
|
|
112
140
|
private trackPending;
|
|
113
141
|
private untrackPending;
|
|
114
142
|
private cancelPendingPermissions;
|
|
@@ -233,4 +261,4 @@ declare class ACPServer implements Agent {
|
|
|
233
261
|
extNotification(method: string, params: Record<string, unknown>): Promise<void>;
|
|
234
262
|
}
|
|
235
263
|
|
|
236
|
-
export { ACPClientAdapter, type ACPClientAdapterOptions, ACPServer, type ACPServerOptions, BandACPServerAdapter, type BandACPServerAdapterOptions, GatewayServer, GatewayServerLike, GatewayServerOptions, createGatewayServer };
|
|
264
|
+
export { ACPClientAdapter, type ACPClientAdapterOptions, type ACPPermissionAbandonReason, type ACPPermissionEndReason, type ACPPermissionRequest, ACPServer, type ACPServerOptions, BandACPServerAdapter, type BandACPServerAdapterOptions, GatewayServer, GatewayServerLike, GatewayServerOptions, createGatewayServer };
|