@band-ai/sdk 0.1.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/CodexAdapter-A1k_LMdZ.d.ts +1278 -0
- package/dist/CodexAdapter-BbZD-nBd.d.cts +1278 -0
- package/dist/adapters.cjs +10643 -0
- package/dist/adapters.d.cts +217 -0
- package/dist/adapters.d.ts +217 -0
- package/dist/adapters.js +92 -0
- package/dist/backends-BnOLsG7w.d.cts +20 -0
- package/dist/backends-C4n6cKOf.d.ts +20 -0
- package/dist/chunk-3BKAC4OZ.js +44 -0
- package/dist/chunk-5CXIMAH2.js +52 -0
- package/dist/chunk-6AJA2OPC.js +3682 -0
- package/dist/chunk-A3TDK6GP.js +6674 -0
- package/dist/chunk-AVVDPXP4.js +39 -0
- package/dist/chunk-EDPKUUJL.js +177 -0
- package/dist/chunk-FUODYQRE.js +2562 -0
- package/dist/chunk-GVEQ3RAH.js +373 -0
- package/dist/chunk-INA6YZTZ.js +88 -0
- package/dist/chunk-IZPV6QS6.js +115 -0
- package/dist/chunk-LY55KYVI.js +0 -0
- package/dist/chunk-NIAQBANR.js +577 -0
- package/dist/chunk-OD2G5LFQ.js +78 -0
- package/dist/chunk-SFVKOEQH.js +103 -0
- package/dist/chunk-SG4WLD2H.js +1093 -0
- package/dist/chunk-YR3BOQNW.js +39 -0
- package/dist/chunk-ZZJRRBPQ.js +82 -0
- package/dist/claude-CcnQ5OUC.d.ts +53 -0
- package/dist/claude-CwTAxhwI.d.cts +53 -0
- package/dist/config.cjs +164 -0
- package/dist/config.d.cts +19 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +9 -0
- package/dist/converters.cjs +1086 -0
- package/dist/converters.d.cts +143 -0
- package/dist/converters.d.ts +143 -0
- package/dist/converters.js +468 -0
- package/dist/core.cjs +185 -0
- package/dist/core.d.cts +22 -0
- package/dist/core.d.ts +22 -0
- package/dist/core.js +24 -0
- package/dist/customTools-BzF0IISO.d.cts +10 -0
- package/dist/customTools-BzF0IISO.d.ts +10 -0
- package/dist/dtos-DUpbIu8k.d.cts +163 -0
- package/dist/dtos-DUpbIu8k.d.ts +163 -0
- package/dist/history-ByessXNq.d.ts +24 -0
- package/dist/history-i6yN7neC.d.cts +24 -0
- package/dist/index.cjs +13914 -0
- package/dist/index.d.cts +63 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +198 -0
- package/dist/linear.cjs +2207 -0
- package/dist/linear.d.cts +167 -0
- package/dist/linear.d.ts +167 -0
- package/dist/linear.js +2139 -0
- package/dist/logger-CABQOnlR.d.cts +21 -0
- package/dist/logger-CABQOnlR.d.ts +21 -0
- package/dist/mcp-claude.cjs +584 -0
- package/dist/mcp-claude.d.cts +4 -0
- package/dist/mcp-claude.d.ts +4 -0
- package/dist/mcp-claude.js +11 -0
- package/dist/mcp.cjs +1247 -0
- package/dist/mcp.d.cts +97 -0
- package/dist/mcp.d.ts +97 -0
- package/dist/mcp.js +27 -0
- package/dist/opencode-BBcDchcN.d.cts +159 -0
- package/dist/opencode-DthQQUsZ.d.ts +159 -0
- package/dist/pagination-BPiys10t.d.cts +25 -0
- package/dist/pagination-CcDkVFxK.d.ts +25 -0
- package/dist/protocols-CInhtFpA.d.cts +116 -0
- package/dist/protocols-DrhzOH6K.d.ts +116 -0
- package/dist/rest.cjs +1159 -0
- package/dist/rest.d.cts +144 -0
- package/dist/rest.d.ts +144 -0
- package/dist/rest.js +18 -0
- package/dist/runtime.cjs +5353 -0
- package/dist/runtime.d.cts +276 -0
- package/dist/runtime.d.ts +276 -0
- package/dist/runtime.js +274 -0
- package/dist/schemas-BpEBkq5V.d.cts +592 -0
- package/dist/schemas-vos1AaBc.d.ts +592 -0
- package/dist/sdk-HJUVSSWA.js +10 -0
- package/dist/simpleAdapter-9OE_p6QW.d.ts +29 -0
- package/dist/simpleAdapter-DqhvjsGr.d.cts +29 -0
- package/dist/testing.cjs +217 -0
- package/dist/testing.d.cts +126 -0
- package/dist/testing.d.ts +126 -0
- package/dist/testing.js +186 -0
- package/dist/types-7jVzOeOP.d.ts +446 -0
- package/dist/types-CSHFipIc.d.cts +331 -0
- package/dist/types-CovcHpYf.d.cts +446 -0
- package/dist/types-CxII3XkA.d.ts +331 -0
- package/package.json +189 -0
|
@@ -0,0 +1,217 @@
|
|
|
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 './CodexAdapter-BbZD-nBd.cjs';
|
|
2
|
+
import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
|
|
3
|
+
import { Client, ClientSideConnection, 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
|
+
import { A as ACPClientSessionState, a as ACPServerSessionState } from './history-i6yN7neC.cjs';
|
|
5
|
+
export { G as GatewayHistoryConverter } from './history-i6yN7neC.cjs';
|
|
6
|
+
import { S as SimpleAdapter } from './simpleAdapter-DqhvjsGr.cjs';
|
|
7
|
+
import { A as AdapterToolsProtocol, c as MessagingTools } from './protocols-CInhtFpA.cjs';
|
|
8
|
+
import { P as PlatformMessage } from './types-CovcHpYf.cjs';
|
|
9
|
+
import { M as McpToolRegistration } from './claude-CwTAxhwI.cjs';
|
|
10
|
+
import { R as RestApi } from './types-CSHFipIc.cjs';
|
|
11
|
+
import { b as GatewayServerLike, c as GatewayServerOptions } from './opencode-BBcDchcN.cjs';
|
|
12
|
+
export { A as A2AAuth, a as A2AGatewayAdapterOptions, d as A2AHistoryConverter, e as A2ASessionState, f as GatewayA2AMessage, g as GatewayA2AStatusUpdateEvent, h as GatewayCancelRequest, i as GatewayPeer, j as GatewayRequest, k as GatewayServerFactory, G as GatewaySessionState, l as GatewayTaskState, P as ParlantHistoryConverter, m as ParlantMessage, n as ParlantMessages, o as PendingA2ATask, p as buildA2AAuthHeaders } from './opencode-BBcDchcN.cjs';
|
|
13
|
+
import './logger-CABQOnlR.cjs';
|
|
14
|
+
import './customTools-BzF0IISO.cjs';
|
|
15
|
+
import 'zod';
|
|
16
|
+
import './dtos-DUpbIu8k.cjs';
|
|
17
|
+
import './backends-BnOLsG7w.cjs';
|
|
18
|
+
import '@anthropic-ai/claude-agent-sdk';
|
|
19
|
+
|
|
20
|
+
interface ACPClientConnectionHandle {
|
|
21
|
+
connection: ClientSideConnection;
|
|
22
|
+
stop(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
type ACPClientConnectionFactory = (client: Client, options: {
|
|
25
|
+
command: string[];
|
|
26
|
+
cwd?: string;
|
|
27
|
+
env?: Record<string, string>;
|
|
28
|
+
}) => Promise<ACPClientConnectionHandle>;
|
|
29
|
+
|
|
30
|
+
interface ACPClientAdapterOptions {
|
|
31
|
+
command: string | string[];
|
|
32
|
+
cwd?: string;
|
|
33
|
+
env?: Record<string, string>;
|
|
34
|
+
mcpServers?: McpServer[];
|
|
35
|
+
authMethod?: string | null;
|
|
36
|
+
enableMemoryTools?: boolean;
|
|
37
|
+
enableMcpTools?: boolean;
|
|
38
|
+
additionalMcpTools?: McpToolRegistration[];
|
|
39
|
+
clientCapabilities?: ClientCapabilities;
|
|
40
|
+
connectionFactory?: ACPClientConnectionFactory;
|
|
41
|
+
}
|
|
42
|
+
declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
|
|
43
|
+
private readonly command;
|
|
44
|
+
private readonly cwd;
|
|
45
|
+
private readonly env?;
|
|
46
|
+
private readonly mcpServers;
|
|
47
|
+
private readonly authMethod?;
|
|
48
|
+
private readonly enableMemoryTools;
|
|
49
|
+
private readonly enableMcpTools;
|
|
50
|
+
private readonly additionalMcpTools;
|
|
51
|
+
private readonly clientCapabilities?;
|
|
52
|
+
private readonly connectionFactory;
|
|
53
|
+
private readonly roomToSession;
|
|
54
|
+
private readonly roomTools;
|
|
55
|
+
private readonly activeSessions;
|
|
56
|
+
private readonly bootstrappedSessions;
|
|
57
|
+
private backend;
|
|
58
|
+
private client;
|
|
59
|
+
private connectionHandle;
|
|
60
|
+
private connection;
|
|
61
|
+
private connectionState;
|
|
62
|
+
private started;
|
|
63
|
+
private systemPrompt;
|
|
64
|
+
private spawnPromise;
|
|
65
|
+
constructor(options: ACPClientAdapterOptions);
|
|
66
|
+
onStarted(agentName: string, agentDescription: string): Promise<void>;
|
|
67
|
+
onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState, _participantsMessage: string | null, _contactsMessage: string | null, context: {
|
|
68
|
+
isSessionBootstrap: boolean;
|
|
69
|
+
roomId: string;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
onCleanup(roomId: string): Promise<void>;
|
|
72
|
+
onRuntimeStop(): Promise<void>;
|
|
73
|
+
stop(): Promise<void>;
|
|
74
|
+
private rehydrate;
|
|
75
|
+
private ensureConnection;
|
|
76
|
+
private spawnConnection;
|
|
77
|
+
private getOrCreateSession;
|
|
78
|
+
private tryRestoreSession;
|
|
79
|
+
private buildSessionMcpServers;
|
|
80
|
+
private getOrCreateBackend;
|
|
81
|
+
private buildSystemContext;
|
|
82
|
+
private handlePermissionRequest;
|
|
83
|
+
private flushChunks;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface ThenvoiACPServerAdapterOptions {
|
|
87
|
+
thenvoiRest: RestApi;
|
|
88
|
+
maxSessions?: number;
|
|
89
|
+
responseTimeoutMs?: number;
|
|
90
|
+
promptCompletionGraceMs?: number;
|
|
91
|
+
sessionModes?: SessionMode[];
|
|
92
|
+
modeToPeer?: Record<string, string>;
|
|
93
|
+
slashCommands?: Record<string, string>;
|
|
94
|
+
}
|
|
95
|
+
declare class ThenvoiACPServerAdapter extends SimpleAdapter<ACPServerSessionState, MessagingTools> {
|
|
96
|
+
private readonly thenvoiRest;
|
|
97
|
+
private readonly maxSessions;
|
|
98
|
+
private readonly responseTimeoutMs;
|
|
99
|
+
private readonly promptCompletionGraceMs;
|
|
100
|
+
private readonly sessionModes;
|
|
101
|
+
private readonly sessionToRoom;
|
|
102
|
+
private readonly roomToSession;
|
|
103
|
+
private readonly pendingPrompts;
|
|
104
|
+
private readonly sessionModeIds;
|
|
105
|
+
private readonly sessionModelIds;
|
|
106
|
+
private readonly sessionCwds;
|
|
107
|
+
private readonly sessionMcpServers;
|
|
108
|
+
private connection;
|
|
109
|
+
private agentId;
|
|
110
|
+
private sessionsInFlight;
|
|
111
|
+
private readonly router;
|
|
112
|
+
private readonly pushHandler;
|
|
113
|
+
constructor(options: ThenvoiACPServerAdapterOptions);
|
|
114
|
+
bindConnection(connection: AgentSideConnection | null): void;
|
|
115
|
+
getConnection(): AgentSideConnection | null;
|
|
116
|
+
hasSession(sessionId: string): boolean;
|
|
117
|
+
getSessionIds(): string[];
|
|
118
|
+
getSessionForRoom(roomId: string): string | null;
|
|
119
|
+
get displayName(): string;
|
|
120
|
+
getSessionCwd(sessionId: string): string;
|
|
121
|
+
getModeState(sessionId: string): SessionModeState;
|
|
122
|
+
setSessionModes(modes: SessionMode[]): void;
|
|
123
|
+
setSessionMode(sessionId: string, modeId: string): void;
|
|
124
|
+
setSessionModel(sessionId: string, modelId: string): void;
|
|
125
|
+
updateSessionContext(sessionId: string, input: {
|
|
126
|
+
cwd?: string;
|
|
127
|
+
mcpServers?: readonly McpServer[];
|
|
128
|
+
}): void;
|
|
129
|
+
verifyCredentials(): Promise<boolean>;
|
|
130
|
+
onStarted(agentName: string, agentDescription: string): Promise<void>;
|
|
131
|
+
createSession(input?: {
|
|
132
|
+
cwd?: string;
|
|
133
|
+
mcpServers?: readonly McpServer[];
|
|
134
|
+
}): Promise<string>;
|
|
135
|
+
handlePrompt(sessionId: string, text: string): Promise<void>;
|
|
136
|
+
onMessage(message: PlatformMessage, _tools: MessagingTools, history: ACPServerSessionState, _participantsMessage: string | null, _contactsMessage: string | null, context: {
|
|
137
|
+
isSessionBootstrap: boolean;
|
|
138
|
+
roomId: string;
|
|
139
|
+
}): Promise<void>;
|
|
140
|
+
onCleanup(roomId: string): Promise<void>;
|
|
141
|
+
onRuntimeStop(): Promise<void>;
|
|
142
|
+
cancelPrompt(sessionId: string): Promise<void>;
|
|
143
|
+
closeSession(sessionId: string): Promise<void>;
|
|
144
|
+
private rehydrate;
|
|
145
|
+
private prependSessionContext;
|
|
146
|
+
private resolveMentions;
|
|
147
|
+
private schedulePromptCompletion;
|
|
148
|
+
private finishPendingPrompt;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Handler for vendor-specific ACP extension methods and notifications.
|
|
153
|
+
*
|
|
154
|
+
* Extension methods/notifications are not part of the core ACP specification.
|
|
155
|
+
* Each client (Cursor, VS Code, etc.) may define its own set of extensions.
|
|
156
|
+
* Implementations of this interface encapsulate client-specific behavior so
|
|
157
|
+
* that ACPServer stays focused on the standard protocol.
|
|
158
|
+
*/
|
|
159
|
+
interface ACPExtensionHandler {
|
|
160
|
+
extMethod?(method: string, params: Record<string, unknown>): Promise<Record<string, unknown> | null>;
|
|
161
|
+
extNotification?(method: string, params: Record<string, unknown>, context: {
|
|
162
|
+
sessionId: string;
|
|
163
|
+
connection: AgentSideConnection;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface ACPServerOptions {
|
|
168
|
+
modes?: SessionMode[];
|
|
169
|
+
authMethods?: InitializeResponse["authMethods"];
|
|
170
|
+
agentInfo?: Partial<Implementation>;
|
|
171
|
+
extensionHandler?: ACPExtensionHandler;
|
|
172
|
+
}
|
|
173
|
+
declare class ACPServer implements Agent {
|
|
174
|
+
private readonly adapter;
|
|
175
|
+
private readonly authMethods;
|
|
176
|
+
private readonly agentInfo;
|
|
177
|
+
private readonly extensionHandler;
|
|
178
|
+
private connection;
|
|
179
|
+
constructor(adapter: ThenvoiACPServerAdapter, options?: ACPServerOptions);
|
|
180
|
+
connectStream(stream: Stream): AgentSideConnection;
|
|
181
|
+
connectStdio(options?: {
|
|
182
|
+
stdin?: NodeJS.ReadableStream;
|
|
183
|
+
stdout?: NodeJS.WritableStream;
|
|
184
|
+
}): AgentSideConnection;
|
|
185
|
+
get closed(): Promise<void>;
|
|
186
|
+
initialize(params: InitializeRequest): Promise<InitializeResponse>;
|
|
187
|
+
newSession(params: _agentclientprotocol_sdk.NewSessionRequest): Promise<_agentclientprotocol_sdk.NewSessionResponse>;
|
|
188
|
+
loadSession(params: LoadSessionRequest): Promise<LoadSessionResponse>;
|
|
189
|
+
listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse>;
|
|
190
|
+
unstable_forkSession(params: ForkSessionRequest): Promise<ForkSessionResponse>;
|
|
191
|
+
unstable_resumeSession(params: ResumeSessionRequest): Promise<ResumeSessionResponse>;
|
|
192
|
+
unstable_closeSession(params: _agentclientprotocol_sdk.CloseSessionRequest): Promise<_agentclientprotocol_sdk.CloseSessionResponse>;
|
|
193
|
+
setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
|
|
194
|
+
unstable_setSessionModel(params: SetSessionModelRequest): Promise<SetSessionModelResponse>;
|
|
195
|
+
setSessionConfigOption(_params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
|
|
196
|
+
authenticate(params: AuthenticateRequest): Promise<AuthenticateResponse>;
|
|
197
|
+
prompt(params: PromptRequest): Promise<PromptResponse>;
|
|
198
|
+
cancel(params: _agentclientprotocol_sdk.CancelNotification): Promise<void>;
|
|
199
|
+
extMethod(method: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
200
|
+
extNotification(method: string, params: Record<string, unknown>): Promise<void>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare class GatewayServer implements GatewayServerLike {
|
|
204
|
+
private readonly options;
|
|
205
|
+
private server;
|
|
206
|
+
private started;
|
|
207
|
+
constructor(options: GatewayServerOptions);
|
|
208
|
+
start(): Promise<void>;
|
|
209
|
+
stop(): Promise<void>;
|
|
210
|
+
private loadModules;
|
|
211
|
+
private createApp;
|
|
212
|
+
private registerPeerRoutes;
|
|
213
|
+
private registerPeerRoute;
|
|
214
|
+
}
|
|
215
|
+
declare function createGatewayServer(options: GatewayServerOptions): GatewayServer;
|
|
216
|
+
|
|
217
|
+
export { ACPClientAdapter, type ACPClientAdapterOptions, ACPServer, type ACPServerOptions, GatewayServer, GatewayServerLike, GatewayServerOptions, ThenvoiACPServerAdapter, type ThenvoiACPServerAdapterOptions, createGatewayServer };
|
|
@@ -0,0 +1,217 @@
|
|
|
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 './CodexAdapter-A1k_LMdZ.js';
|
|
2
|
+
import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
|
|
3
|
+
import { Client, ClientSideConnection, 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
|
+
import { A as ACPClientSessionState, a as ACPServerSessionState } from './history-ByessXNq.js';
|
|
5
|
+
export { G as GatewayHistoryConverter } from './history-ByessXNq.js';
|
|
6
|
+
import { S as SimpleAdapter } from './simpleAdapter-9OE_p6QW.js';
|
|
7
|
+
import { A as AdapterToolsProtocol, c as MessagingTools } from './protocols-DrhzOH6K.js';
|
|
8
|
+
import { P as PlatformMessage } from './types-7jVzOeOP.js';
|
|
9
|
+
import { M as McpToolRegistration } from './claude-CcnQ5OUC.js';
|
|
10
|
+
import { R as RestApi } from './types-CxII3XkA.js';
|
|
11
|
+
import { b as GatewayServerLike, c as GatewayServerOptions } from './opencode-DthQQUsZ.js';
|
|
12
|
+
export { A as A2AAuth, a as A2AGatewayAdapterOptions, d as A2AHistoryConverter, e as A2ASessionState, f as GatewayA2AMessage, g as GatewayA2AStatusUpdateEvent, h as GatewayCancelRequest, i as GatewayPeer, j as GatewayRequest, k as GatewayServerFactory, G as GatewaySessionState, l as GatewayTaskState, P as ParlantHistoryConverter, m as ParlantMessage, n as ParlantMessages, o as PendingA2ATask, p as buildA2AAuthHeaders } from './opencode-DthQQUsZ.js';
|
|
13
|
+
import './logger-CABQOnlR.js';
|
|
14
|
+
import './customTools-BzF0IISO.js';
|
|
15
|
+
import 'zod';
|
|
16
|
+
import './dtos-DUpbIu8k.js';
|
|
17
|
+
import './backends-C4n6cKOf.js';
|
|
18
|
+
import '@anthropic-ai/claude-agent-sdk';
|
|
19
|
+
|
|
20
|
+
interface ACPClientConnectionHandle {
|
|
21
|
+
connection: ClientSideConnection;
|
|
22
|
+
stop(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
type ACPClientConnectionFactory = (client: Client, options: {
|
|
25
|
+
command: string[];
|
|
26
|
+
cwd?: string;
|
|
27
|
+
env?: Record<string, string>;
|
|
28
|
+
}) => Promise<ACPClientConnectionHandle>;
|
|
29
|
+
|
|
30
|
+
interface ACPClientAdapterOptions {
|
|
31
|
+
command: string | string[];
|
|
32
|
+
cwd?: string;
|
|
33
|
+
env?: Record<string, string>;
|
|
34
|
+
mcpServers?: McpServer[];
|
|
35
|
+
authMethod?: string | null;
|
|
36
|
+
enableMemoryTools?: boolean;
|
|
37
|
+
enableMcpTools?: boolean;
|
|
38
|
+
additionalMcpTools?: McpToolRegistration[];
|
|
39
|
+
clientCapabilities?: ClientCapabilities;
|
|
40
|
+
connectionFactory?: ACPClientConnectionFactory;
|
|
41
|
+
}
|
|
42
|
+
declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
|
|
43
|
+
private readonly command;
|
|
44
|
+
private readonly cwd;
|
|
45
|
+
private readonly env?;
|
|
46
|
+
private readonly mcpServers;
|
|
47
|
+
private readonly authMethod?;
|
|
48
|
+
private readonly enableMemoryTools;
|
|
49
|
+
private readonly enableMcpTools;
|
|
50
|
+
private readonly additionalMcpTools;
|
|
51
|
+
private readonly clientCapabilities?;
|
|
52
|
+
private readonly connectionFactory;
|
|
53
|
+
private readonly roomToSession;
|
|
54
|
+
private readonly roomTools;
|
|
55
|
+
private readonly activeSessions;
|
|
56
|
+
private readonly bootstrappedSessions;
|
|
57
|
+
private backend;
|
|
58
|
+
private client;
|
|
59
|
+
private connectionHandle;
|
|
60
|
+
private connection;
|
|
61
|
+
private connectionState;
|
|
62
|
+
private started;
|
|
63
|
+
private systemPrompt;
|
|
64
|
+
private spawnPromise;
|
|
65
|
+
constructor(options: ACPClientAdapterOptions);
|
|
66
|
+
onStarted(agentName: string, agentDescription: string): Promise<void>;
|
|
67
|
+
onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState, _participantsMessage: string | null, _contactsMessage: string | null, context: {
|
|
68
|
+
isSessionBootstrap: boolean;
|
|
69
|
+
roomId: string;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
onCleanup(roomId: string): Promise<void>;
|
|
72
|
+
onRuntimeStop(): Promise<void>;
|
|
73
|
+
stop(): Promise<void>;
|
|
74
|
+
private rehydrate;
|
|
75
|
+
private ensureConnection;
|
|
76
|
+
private spawnConnection;
|
|
77
|
+
private getOrCreateSession;
|
|
78
|
+
private tryRestoreSession;
|
|
79
|
+
private buildSessionMcpServers;
|
|
80
|
+
private getOrCreateBackend;
|
|
81
|
+
private buildSystemContext;
|
|
82
|
+
private handlePermissionRequest;
|
|
83
|
+
private flushChunks;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface ThenvoiACPServerAdapterOptions {
|
|
87
|
+
thenvoiRest: RestApi;
|
|
88
|
+
maxSessions?: number;
|
|
89
|
+
responseTimeoutMs?: number;
|
|
90
|
+
promptCompletionGraceMs?: number;
|
|
91
|
+
sessionModes?: SessionMode[];
|
|
92
|
+
modeToPeer?: Record<string, string>;
|
|
93
|
+
slashCommands?: Record<string, string>;
|
|
94
|
+
}
|
|
95
|
+
declare class ThenvoiACPServerAdapter extends SimpleAdapter<ACPServerSessionState, MessagingTools> {
|
|
96
|
+
private readonly thenvoiRest;
|
|
97
|
+
private readonly maxSessions;
|
|
98
|
+
private readonly responseTimeoutMs;
|
|
99
|
+
private readonly promptCompletionGraceMs;
|
|
100
|
+
private readonly sessionModes;
|
|
101
|
+
private readonly sessionToRoom;
|
|
102
|
+
private readonly roomToSession;
|
|
103
|
+
private readonly pendingPrompts;
|
|
104
|
+
private readonly sessionModeIds;
|
|
105
|
+
private readonly sessionModelIds;
|
|
106
|
+
private readonly sessionCwds;
|
|
107
|
+
private readonly sessionMcpServers;
|
|
108
|
+
private connection;
|
|
109
|
+
private agentId;
|
|
110
|
+
private sessionsInFlight;
|
|
111
|
+
private readonly router;
|
|
112
|
+
private readonly pushHandler;
|
|
113
|
+
constructor(options: ThenvoiACPServerAdapterOptions);
|
|
114
|
+
bindConnection(connection: AgentSideConnection | null): void;
|
|
115
|
+
getConnection(): AgentSideConnection | null;
|
|
116
|
+
hasSession(sessionId: string): boolean;
|
|
117
|
+
getSessionIds(): string[];
|
|
118
|
+
getSessionForRoom(roomId: string): string | null;
|
|
119
|
+
get displayName(): string;
|
|
120
|
+
getSessionCwd(sessionId: string): string;
|
|
121
|
+
getModeState(sessionId: string): SessionModeState;
|
|
122
|
+
setSessionModes(modes: SessionMode[]): void;
|
|
123
|
+
setSessionMode(sessionId: string, modeId: string): void;
|
|
124
|
+
setSessionModel(sessionId: string, modelId: string): void;
|
|
125
|
+
updateSessionContext(sessionId: string, input: {
|
|
126
|
+
cwd?: string;
|
|
127
|
+
mcpServers?: readonly McpServer[];
|
|
128
|
+
}): void;
|
|
129
|
+
verifyCredentials(): Promise<boolean>;
|
|
130
|
+
onStarted(agentName: string, agentDescription: string): Promise<void>;
|
|
131
|
+
createSession(input?: {
|
|
132
|
+
cwd?: string;
|
|
133
|
+
mcpServers?: readonly McpServer[];
|
|
134
|
+
}): Promise<string>;
|
|
135
|
+
handlePrompt(sessionId: string, text: string): Promise<void>;
|
|
136
|
+
onMessage(message: PlatformMessage, _tools: MessagingTools, history: ACPServerSessionState, _participantsMessage: string | null, _contactsMessage: string | null, context: {
|
|
137
|
+
isSessionBootstrap: boolean;
|
|
138
|
+
roomId: string;
|
|
139
|
+
}): Promise<void>;
|
|
140
|
+
onCleanup(roomId: string): Promise<void>;
|
|
141
|
+
onRuntimeStop(): Promise<void>;
|
|
142
|
+
cancelPrompt(sessionId: string): Promise<void>;
|
|
143
|
+
closeSession(sessionId: string): Promise<void>;
|
|
144
|
+
private rehydrate;
|
|
145
|
+
private prependSessionContext;
|
|
146
|
+
private resolveMentions;
|
|
147
|
+
private schedulePromptCompletion;
|
|
148
|
+
private finishPendingPrompt;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Handler for vendor-specific ACP extension methods and notifications.
|
|
153
|
+
*
|
|
154
|
+
* Extension methods/notifications are not part of the core ACP specification.
|
|
155
|
+
* Each client (Cursor, VS Code, etc.) may define its own set of extensions.
|
|
156
|
+
* Implementations of this interface encapsulate client-specific behavior so
|
|
157
|
+
* that ACPServer stays focused on the standard protocol.
|
|
158
|
+
*/
|
|
159
|
+
interface ACPExtensionHandler {
|
|
160
|
+
extMethod?(method: string, params: Record<string, unknown>): Promise<Record<string, unknown> | null>;
|
|
161
|
+
extNotification?(method: string, params: Record<string, unknown>, context: {
|
|
162
|
+
sessionId: string;
|
|
163
|
+
connection: AgentSideConnection;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface ACPServerOptions {
|
|
168
|
+
modes?: SessionMode[];
|
|
169
|
+
authMethods?: InitializeResponse["authMethods"];
|
|
170
|
+
agentInfo?: Partial<Implementation>;
|
|
171
|
+
extensionHandler?: ACPExtensionHandler;
|
|
172
|
+
}
|
|
173
|
+
declare class ACPServer implements Agent {
|
|
174
|
+
private readonly adapter;
|
|
175
|
+
private readonly authMethods;
|
|
176
|
+
private readonly agentInfo;
|
|
177
|
+
private readonly extensionHandler;
|
|
178
|
+
private connection;
|
|
179
|
+
constructor(adapter: ThenvoiACPServerAdapter, options?: ACPServerOptions);
|
|
180
|
+
connectStream(stream: Stream): AgentSideConnection;
|
|
181
|
+
connectStdio(options?: {
|
|
182
|
+
stdin?: NodeJS.ReadableStream;
|
|
183
|
+
stdout?: NodeJS.WritableStream;
|
|
184
|
+
}): AgentSideConnection;
|
|
185
|
+
get closed(): Promise<void>;
|
|
186
|
+
initialize(params: InitializeRequest): Promise<InitializeResponse>;
|
|
187
|
+
newSession(params: _agentclientprotocol_sdk.NewSessionRequest): Promise<_agentclientprotocol_sdk.NewSessionResponse>;
|
|
188
|
+
loadSession(params: LoadSessionRequest): Promise<LoadSessionResponse>;
|
|
189
|
+
listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse>;
|
|
190
|
+
unstable_forkSession(params: ForkSessionRequest): Promise<ForkSessionResponse>;
|
|
191
|
+
unstable_resumeSession(params: ResumeSessionRequest): Promise<ResumeSessionResponse>;
|
|
192
|
+
unstable_closeSession(params: _agentclientprotocol_sdk.CloseSessionRequest): Promise<_agentclientprotocol_sdk.CloseSessionResponse>;
|
|
193
|
+
setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
|
|
194
|
+
unstable_setSessionModel(params: SetSessionModelRequest): Promise<SetSessionModelResponse>;
|
|
195
|
+
setSessionConfigOption(_params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
|
|
196
|
+
authenticate(params: AuthenticateRequest): Promise<AuthenticateResponse>;
|
|
197
|
+
prompt(params: PromptRequest): Promise<PromptResponse>;
|
|
198
|
+
cancel(params: _agentclientprotocol_sdk.CancelNotification): Promise<void>;
|
|
199
|
+
extMethod(method: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
200
|
+
extNotification(method: string, params: Record<string, unknown>): Promise<void>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare class GatewayServer implements GatewayServerLike {
|
|
204
|
+
private readonly options;
|
|
205
|
+
private server;
|
|
206
|
+
private started;
|
|
207
|
+
constructor(options: GatewayServerOptions);
|
|
208
|
+
start(): Promise<void>;
|
|
209
|
+
stop(): Promise<void>;
|
|
210
|
+
private loadModules;
|
|
211
|
+
private createApp;
|
|
212
|
+
private registerPeerRoutes;
|
|
213
|
+
private registerPeerRoute;
|
|
214
|
+
}
|
|
215
|
+
declare function createGatewayServer(options: GatewayServerOptions): GatewayServer;
|
|
216
|
+
|
|
217
|
+
export { ACPClientAdapter, type ACPClientAdapterOptions, ACPServer, type ACPServerOptions, GatewayServer, GatewayServerLike, GatewayServerOptions, ThenvoiACPServerAdapter, type ThenvoiACPServerAdapterOptions, createGatewayServer };
|
package/dist/adapters.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ACPClientAdapter,
|
|
3
|
+
ACPServer,
|
|
4
|
+
AnthropicAdapter,
|
|
5
|
+
AnthropicToolCallingModel,
|
|
6
|
+
CODEX_REASONING_EFFORTS,
|
|
7
|
+
CODEX_REASONING_SUMMARIES,
|
|
8
|
+
CODEX_WEB_SEARCH_MODES,
|
|
9
|
+
ClaudeSDKAdapter,
|
|
10
|
+
CodexAdapter,
|
|
11
|
+
CodexAppServerStdioClient,
|
|
12
|
+
CodexJsonRpcError,
|
|
13
|
+
GeminiAdapter,
|
|
14
|
+
GeminiToolCallingModel,
|
|
15
|
+
GenericAdapter,
|
|
16
|
+
GoogleADKAdapter,
|
|
17
|
+
HttpOpencodeClient,
|
|
18
|
+
HttpStatusError,
|
|
19
|
+
LangGraphAdapter,
|
|
20
|
+
LettaAdapter,
|
|
21
|
+
LettaHistoryConverter,
|
|
22
|
+
OpenAIAdapter,
|
|
23
|
+
OpenAIToolCallingModel,
|
|
24
|
+
OpencodeAdapter,
|
|
25
|
+
ThenvoiACPServerAdapter,
|
|
26
|
+
ToolCallingAdapter,
|
|
27
|
+
VercelAISDKAdapter,
|
|
28
|
+
VercelAISDKToolCallingModel,
|
|
29
|
+
runSingleToolRound
|
|
30
|
+
} from "./chunk-A3TDK6GP.js";
|
|
31
|
+
import "./chunk-NIAQBANR.js";
|
|
32
|
+
import "./chunk-LY55KYVI.js";
|
|
33
|
+
import "./chunk-5CXIMAH2.js";
|
|
34
|
+
import "./chunk-EDPKUUJL.js";
|
|
35
|
+
import {
|
|
36
|
+
A2AAdapter,
|
|
37
|
+
A2AGatewayAdapter,
|
|
38
|
+
A2AHistoryConverter,
|
|
39
|
+
GatewayHistoryConverter,
|
|
40
|
+
GatewayServer,
|
|
41
|
+
ParlantAdapter,
|
|
42
|
+
ParlantHistoryConverter,
|
|
43
|
+
buildA2AAuthHeaders,
|
|
44
|
+
createGatewayServer
|
|
45
|
+
} from "./chunk-FUODYQRE.js";
|
|
46
|
+
import "./chunk-AVVDPXP4.js";
|
|
47
|
+
import "./chunk-INA6YZTZ.js";
|
|
48
|
+
import "./chunk-GVEQ3RAH.js";
|
|
49
|
+
import "./chunk-SFVKOEQH.js";
|
|
50
|
+
import "./chunk-ZZJRRBPQ.js";
|
|
51
|
+
import "./chunk-3BKAC4OZ.js";
|
|
52
|
+
import "./chunk-OD2G5LFQ.js";
|
|
53
|
+
import "./chunk-YR3BOQNW.js";
|
|
54
|
+
export {
|
|
55
|
+
A2AAdapter,
|
|
56
|
+
A2AGatewayAdapter,
|
|
57
|
+
A2AHistoryConverter,
|
|
58
|
+
ACPClientAdapter,
|
|
59
|
+
ACPServer,
|
|
60
|
+
AnthropicAdapter,
|
|
61
|
+
AnthropicToolCallingModel,
|
|
62
|
+
CODEX_REASONING_EFFORTS,
|
|
63
|
+
CODEX_REASONING_SUMMARIES,
|
|
64
|
+
CODEX_WEB_SEARCH_MODES,
|
|
65
|
+
ClaudeSDKAdapter,
|
|
66
|
+
CodexAdapter,
|
|
67
|
+
CodexAppServerStdioClient,
|
|
68
|
+
CodexJsonRpcError,
|
|
69
|
+
GatewayHistoryConverter,
|
|
70
|
+
GatewayServer,
|
|
71
|
+
GeminiAdapter,
|
|
72
|
+
GeminiToolCallingModel,
|
|
73
|
+
GenericAdapter,
|
|
74
|
+
GoogleADKAdapter,
|
|
75
|
+
HttpOpencodeClient,
|
|
76
|
+
HttpStatusError,
|
|
77
|
+
LangGraphAdapter,
|
|
78
|
+
LettaAdapter,
|
|
79
|
+
LettaHistoryConverter,
|
|
80
|
+
OpenAIAdapter,
|
|
81
|
+
OpenAIToolCallingModel,
|
|
82
|
+
OpencodeAdapter,
|
|
83
|
+
ParlantAdapter,
|
|
84
|
+
ParlantHistoryConverter,
|
|
85
|
+
ThenvoiACPServerAdapter,
|
|
86
|
+
ToolCallingAdapter,
|
|
87
|
+
VercelAISDKAdapter,
|
|
88
|
+
VercelAISDKToolCallingModel,
|
|
89
|
+
buildA2AAuthHeaders,
|
|
90
|
+
createGatewayServer,
|
|
91
|
+
runSingleToolRound
|
|
92
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { A as AdapterToolsProtocol } from './protocols-CInhtFpA.cjs';
|
|
2
|
+
import { M as McpToolRegistration, T as ThenvoiSdkMcpServer } from './claude-CwTAxhwI.cjs';
|
|
3
|
+
|
|
4
|
+
type ThenvoiMcpBackendKind = "sdk" | "http" | "sse" | "stdio";
|
|
5
|
+
interface ThenvoiMcpBackend {
|
|
6
|
+
kind: ThenvoiMcpBackendKind;
|
|
7
|
+
server: unknown;
|
|
8
|
+
allowedTools: string[];
|
|
9
|
+
stop(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
interface CreateThenvoiMcpBackendOptions {
|
|
12
|
+
kind: ThenvoiMcpBackendKind;
|
|
13
|
+
enableMemoryTools: boolean;
|
|
14
|
+
getToolsForRoom: (roomId: string) => AdapterToolsProtocol | undefined;
|
|
15
|
+
additionalTools?: McpToolRegistration[];
|
|
16
|
+
}
|
|
17
|
+
declare function createThenvoiMcpBackend(options: CreateThenvoiMcpBackendOptions): Promise<ThenvoiMcpBackend>;
|
|
18
|
+
declare function getThenvoiSdkMcpServerConfig(backend: ThenvoiMcpBackend): ThenvoiSdkMcpServer["serverConfig"];
|
|
19
|
+
|
|
20
|
+
export { type CreateThenvoiMcpBackendOptions as C, type ThenvoiMcpBackend as T, type ThenvoiMcpBackendKind as a, createThenvoiMcpBackend as c, getThenvoiSdkMcpServerConfig as g };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { A as AdapterToolsProtocol } from './protocols-DrhzOH6K.js';
|
|
2
|
+
import { M as McpToolRegistration, T as ThenvoiSdkMcpServer } from './claude-CcnQ5OUC.js';
|
|
3
|
+
|
|
4
|
+
type ThenvoiMcpBackendKind = "sdk" | "http" | "sse" | "stdio";
|
|
5
|
+
interface ThenvoiMcpBackend {
|
|
6
|
+
kind: ThenvoiMcpBackendKind;
|
|
7
|
+
server: unknown;
|
|
8
|
+
allowedTools: string[];
|
|
9
|
+
stop(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
interface CreateThenvoiMcpBackendOptions {
|
|
12
|
+
kind: ThenvoiMcpBackendKind;
|
|
13
|
+
enableMemoryTools: boolean;
|
|
14
|
+
getToolsForRoom: (roomId: string) => AdapterToolsProtocol | undefined;
|
|
15
|
+
additionalTools?: McpToolRegistration[];
|
|
16
|
+
}
|
|
17
|
+
declare function createThenvoiMcpBackend(options: CreateThenvoiMcpBackendOptions): Promise<ThenvoiMcpBackend>;
|
|
18
|
+
declare function getThenvoiSdkMcpServerConfig(backend: ThenvoiMcpBackend): ThenvoiSdkMcpServer["serverConfig"];
|
|
19
|
+
|
|
20
|
+
export { type CreateThenvoiMcpBackendOptions as C, type ThenvoiMcpBackend as T, type ThenvoiMcpBackendKind as a, createThenvoiMcpBackend as c, getThenvoiSdkMcpServerConfig as g };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/contracts/protocols.ts
|
|
2
|
+
var TOOL_EXECUTOR_ERROR_TYPES = [
|
|
3
|
+
"ToolArgumentsValidationError",
|
|
4
|
+
"ToolNotFoundError",
|
|
5
|
+
"ToolExecutionError"
|
|
6
|
+
];
|
|
7
|
+
function createToolExecutorError(input) {
|
|
8
|
+
return {
|
|
9
|
+
ok: false,
|
|
10
|
+
errorType: input.errorType,
|
|
11
|
+
toolName: input.toolName,
|
|
12
|
+
message: input.message,
|
|
13
|
+
legacyMessage: input.legacyMessage ?? input.message,
|
|
14
|
+
...input.details ? { details: input.details } : {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function isToolExecutorError(value) {
|
|
18
|
+
if (!value || typeof value !== "object") {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const candidate = value;
|
|
22
|
+
return candidate.ok === false && typeof candidate.errorType === "string" && TOOL_EXECUTOR_ERROR_TYPES.includes(candidate.errorType) && typeof candidate.toolName === "string" && typeof candidate.message === "string" && typeof candidate.legacyMessage === "string";
|
|
23
|
+
}
|
|
24
|
+
function toLegacyToolExecutorErrorMessage(value) {
|
|
25
|
+
if (typeof value === "string") {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
if (!isToolExecutorError(value)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return value.legacyMessage;
|
|
32
|
+
}
|
|
33
|
+
var DEFAULT_AGENT_TOOLS_CAPABILITIES = {
|
|
34
|
+
peers: true,
|
|
35
|
+
contacts: true,
|
|
36
|
+
memory: true
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
createToolExecutorError,
|
|
41
|
+
isToolExecutorError,
|
|
42
|
+
toLegacyToolExecutorErrorMessage,
|
|
43
|
+
DEFAULT_AGENT_TOOLS_CAPABILITIES
|
|
44
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildRoomScopedRegistrations,
|
|
3
|
+
buildZodShape
|
|
4
|
+
} from "./chunk-EDPKUUJL.js";
|
|
5
|
+
import {
|
|
6
|
+
mcpToolNames
|
|
7
|
+
} from "./chunk-GVEQ3RAH.js";
|
|
8
|
+
|
|
9
|
+
// src/mcp/sdk.ts
|
|
10
|
+
import {
|
|
11
|
+
createSdkMcpServer,
|
|
12
|
+
tool
|
|
13
|
+
} from "@anthropic-ai/claude-agent-sdk";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
function createThenvoiSdkMcpServer(options) {
|
|
16
|
+
const registrations = buildRoomScopedRegistrations(
|
|
17
|
+
options.getToolsForRoom,
|
|
18
|
+
{
|
|
19
|
+
enableMemoryTools: options.enableMemoryTools,
|
|
20
|
+
enableContactTools: true,
|
|
21
|
+
additionalTools: options.additionalTools
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
const toolDefinitions = registrations.map(toSdkToolDefinition);
|
|
25
|
+
const toolNames = new Set(registrations.map((r) => r.name));
|
|
26
|
+
const serverConfig = createSdkMcpServer({
|
|
27
|
+
name: "thenvoi",
|
|
28
|
+
tools: toolDefinitions
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
serverConfig,
|
|
32
|
+
allowedTools: mcpToolNames(toolNames),
|
|
33
|
+
toolDefinitions
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function toSdkToolDefinition(registration) {
|
|
37
|
+
const shape = buildZodShape(
|
|
38
|
+
z,
|
|
39
|
+
registration.inputSchema.properties,
|
|
40
|
+
new Set(registration.inputSchema.required)
|
|
41
|
+
);
|
|
42
|
+
return tool(
|
|
43
|
+
registration.name,
|
|
44
|
+
registration.description,
|
|
45
|
+
shape,
|
|
46
|
+
async (args) => registration.execute(args)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
createThenvoiSdkMcpServer
|
|
52
|
+
};
|