@band-ai/sdk 0.2.1 → 0.3.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.
- package/dist/{ClaudeSDKAdapter-Cna5P1dR.d.ts → ClaudeSDKAdapter-CXud2DBE.d.ts} +2 -1
- package/dist/{ClaudeSDKAdapter-BY4zEbCl.d.cts → ClaudeSDKAdapter-Cx6zhSaG.d.cts} +2 -1
- package/dist/adapters.cjs +208 -115
- package/dist/adapters.d.cts +8 -4
- package/dist/adapters.d.ts +8 -4
- package/dist/adapters.js +105 -43
- package/dist/chunk-F63TPOI3.js +29 -0
- package/dist/{chunk-3BKAC4OZ.js → chunk-JADCAMZY.js} +8 -0
- package/dist/{chunk-N2QTUMGO.js → chunk-JJF44XWA.js} +365 -249
- package/dist/{chunk-TLBCKDQO.js → chunk-K5KAEYPF.js} +2 -2
- package/dist/{chunk-ZZJRRBPQ.js → chunk-KXJ74J73.js} +1 -1
- package/dist/{chunk-NMZLX7TP.js → chunk-MQBBWYRP.js} +52 -45
- package/dist/{chunk-RV76SKFT.js → chunk-MQY74R7D.js} +2 -20
- package/dist/{chunk-LBWKISBS.js → chunk-OH6VVVKT.js} +21 -0
- package/dist/{chunk-EAI2M3WM.js → chunk-W5IAI6Z4.js} +1 -1
- package/dist/{chunk-4IAXZBXX.js → chunk-WA7CHXUS.js} +2 -2
- package/dist/{chunk-NT7TBFX2.js → chunk-XWHWJP4I.js} +2 -2
- package/dist/{chunk-WLCM2OXG.js → chunk-YJ42AZO4.js} +1 -1
- package/dist/converters.js +6 -5
- package/dist/index.cjs +405 -277
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -11
- package/dist/mcp-claude.js +4 -3
- package/dist/mcp.js +5 -4
- package/dist/rest.js +3 -3
- package/dist/runtime.cjs +387 -362
- package/dist/runtime.d.cts +10 -39
- package/dist/runtime.d.ts +10 -39
- package/dist/runtime.js +20 -142
- package/dist/{schemas-BotL3ZLH.d.cts → schemas-BgJhlqqO.d.cts} +57 -13
- package/dist/{schemas-DBsC4J1g.d.ts → schemas-C4mK1WSs.d.ts} +57 -13
- package/dist/testing.cjs +11 -0
- package/dist/testing.js +8 -1
- package/dist/{types-D958TC71.d.cts → types-BNNtOXu3.d.cts} +1 -1
- package/dist/{types-BTN_ZETM.d.ts → types-DFUtpxah.d.ts} +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SimpleAdapter } from './simpleAdapter--wznuoOw.js';
|
|
2
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-
|
|
3
|
+
import { H as HistoryProvider, P as PlatformMessage } from './types-DFUtpxah.js';
|
|
4
4
|
import { L as Logger } from './logger-CABQOnlR.js';
|
|
5
5
|
import { C as CustomToolDef } from './customTools-BzF0IISO.js';
|
|
6
6
|
import { m as ToolModelMessage, n as ToolModelSchema, M as MetadataMap } from './dtos-B8KU_q4d.js';
|
|
@@ -562,6 +562,7 @@ declare class GoogleADKAdapter extends SimpleAdapter<GoogleADKMessages, AdapterT
|
|
|
562
562
|
private buildPrompt;
|
|
563
563
|
private formatIncomingMessage;
|
|
564
564
|
private reportExecutionEvent;
|
|
565
|
+
private warnOnFailedSend;
|
|
565
566
|
}
|
|
566
567
|
|
|
567
568
|
interface LangGraphGraph {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SimpleAdapter } from './simpleAdapter-BpT4XbZC.cjs';
|
|
2
2
|
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, c as MessagingTools, T as ToolExecutor, f as ToolSchemaProvider, H as HistoryConverter } from './protocols-Bz1rxcUg.cjs';
|
|
3
|
-
import { H as HistoryProvider, P as PlatformMessage } from './types-
|
|
3
|
+
import { H as HistoryProvider, P as PlatformMessage } from './types-BNNtOXu3.cjs';
|
|
4
4
|
import { L as Logger } from './logger-CABQOnlR.cjs';
|
|
5
5
|
import { C as CustomToolDef } from './customTools-BzF0IISO.cjs';
|
|
6
6
|
import { m as ToolModelMessage, n as ToolModelSchema, M as MetadataMap } from './dtos-B8KU_q4d.cjs';
|
|
@@ -562,6 +562,7 @@ declare class GoogleADKAdapter extends SimpleAdapter<GoogleADKMessages, AdapterT
|
|
|
562
562
|
private buildPrompt;
|
|
563
563
|
private formatIncomingMessage;
|
|
564
564
|
private reportExecutionEvent;
|
|
565
|
+
private warnOnFailedSend;
|
|
565
566
|
}
|
|
566
567
|
|
|
567
568
|
interface LangGraphGraph {
|
package/dist/adapters.cjs
CHANGED
|
@@ -141,13 +141,17 @@ var init_memory = __esm({
|
|
|
141
141
|
});
|
|
142
142
|
|
|
143
143
|
// src/contracts/chatEvents.ts
|
|
144
|
-
|
|
144
|
+
function isBlankEventContent(content) {
|
|
145
|
+
return !VISIBLE_CONTENT_PATTERN.test(content);
|
|
146
|
+
}
|
|
147
|
+
var CHAT_EVENT_TYPES, CHAT_MESSAGE_TYPES, VISIBLE_CONTENT_PATTERN;
|
|
145
148
|
var init_chatEvents = __esm({
|
|
146
149
|
"src/contracts/chatEvents.ts"() {
|
|
147
150
|
"use strict";
|
|
148
151
|
init_errors();
|
|
149
152
|
CHAT_EVENT_TYPES = ["tool_call", "tool_result", "thought", "error", "task"];
|
|
150
153
|
CHAT_MESSAGE_TYPES = ["text", ...CHAT_EVENT_TYPES];
|
|
154
|
+
VISIBLE_CONTENT_PATTERN = /[\p{L}\p{N}\p{P}\p{S}]/u;
|
|
151
155
|
}
|
|
152
156
|
});
|
|
153
157
|
|
|
@@ -496,6 +500,13 @@ function isToolExecutorError(value) {
|
|
|
496
500
|
const candidate = value;
|
|
497
501
|
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";
|
|
498
502
|
}
|
|
503
|
+
function isStructuredToolFailure(value) {
|
|
504
|
+
if (!value || typeof value !== "object") {
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
const payload = value;
|
|
508
|
+
return payload.ok === false && typeof payload.message === "string";
|
|
509
|
+
}
|
|
499
510
|
function toLegacyToolExecutorErrorMessage(value) {
|
|
500
511
|
if (typeof value === "string") {
|
|
501
512
|
return value;
|
|
@@ -1246,7 +1257,116 @@ ${customSection}`.trim();
|
|
|
1246
1257
|
return parts.join("\n\n");
|
|
1247
1258
|
}
|
|
1248
1259
|
|
|
1260
|
+
// src/runtime/types.ts
|
|
1261
|
+
function ensureHandlePrefix(handle) {
|
|
1262
|
+
if (!handle) {
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
return handle.startsWith("@") ? handle : `@${handle}`;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/runtime/formatters.ts
|
|
1269
|
+
function isMetadataMap(value) {
|
|
1270
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1271
|
+
}
|
|
1272
|
+
function mentionSubjectsFromMetadata(metadata) {
|
|
1273
|
+
const mentions = metadata?.mentions;
|
|
1274
|
+
if (!Array.isArray(mentions)) {
|
|
1275
|
+
return [];
|
|
1276
|
+
}
|
|
1277
|
+
const subjects = [];
|
|
1278
|
+
for (const mention of mentions) {
|
|
1279
|
+
if (!isMetadataMap(mention) || typeof mention.id !== "string") {
|
|
1280
|
+
continue;
|
|
1281
|
+
}
|
|
1282
|
+
const label = [mention.handle, mention.username, mention.name].find(
|
|
1283
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
1284
|
+
);
|
|
1285
|
+
if (label === void 0) {
|
|
1286
|
+
continue;
|
|
1287
|
+
}
|
|
1288
|
+
subjects.push({ id: mention.id, handle: label });
|
|
1289
|
+
}
|
|
1290
|
+
return subjects;
|
|
1291
|
+
}
|
|
1292
|
+
function replaceUuidMentions(content, participants) {
|
|
1293
|
+
if (!content || participants.length === 0) {
|
|
1294
|
+
return content;
|
|
1295
|
+
}
|
|
1296
|
+
let next = content;
|
|
1297
|
+
for (const participant of participants) {
|
|
1298
|
+
const participantId = participant.id;
|
|
1299
|
+
const handle = participant.handle;
|
|
1300
|
+
if (typeof participantId === "string" && typeof handle === "string") {
|
|
1301
|
+
next = next.replaceAll(`@[[${participantId}]]`, ensureHandlePrefix(handle) ?? "");
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
return next;
|
|
1305
|
+
}
|
|
1306
|
+
function formatMessageForLlm(message, participants) {
|
|
1307
|
+
const senderType = String(message.sender_type ?? "");
|
|
1308
|
+
const senderName = String(message.sender_name ?? message.name ?? senderType);
|
|
1309
|
+
const content = participants ? replaceUuidMentions(String(message.content ?? ""), participants) : String(message.content ?? "");
|
|
1310
|
+
return {
|
|
1311
|
+
role: senderType === "Agent" ? "assistant" : "user",
|
|
1312
|
+
content,
|
|
1313
|
+
sender_name: senderName,
|
|
1314
|
+
sender_type: senderType,
|
|
1315
|
+
message_type: String(message.message_type ?? "text"),
|
|
1316
|
+
metadata: isMetadataMap(message.metadata) ? message.metadata : {}
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
function formatHistoryForLlm(messages, options) {
|
|
1320
|
+
const excludeId = options?.excludeId;
|
|
1321
|
+
const participants = options?.participants;
|
|
1322
|
+
return messages.filter((message) => String(message.id ?? "") !== excludeId).map((message) => formatMessageForLlm(message, participants));
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// src/adapters/shared/conversationPrompt.ts
|
|
1326
|
+
function systemUpdateParts(participantsMessage, contactsMessage) {
|
|
1327
|
+
const parts = [];
|
|
1328
|
+
if (participantsMessage) {
|
|
1329
|
+
parts.push(`[System]: ${participantsMessage}`);
|
|
1330
|
+
}
|
|
1331
|
+
if (contactsMessage) {
|
|
1332
|
+
parts.push(`[System]: ${contactsMessage}`);
|
|
1333
|
+
}
|
|
1334
|
+
return parts;
|
|
1335
|
+
}
|
|
1336
|
+
function buildConversationPrompt(options) {
|
|
1337
|
+
const parts = [];
|
|
1338
|
+
if (options.isSessionBootstrap && options.history.length > 0) {
|
|
1339
|
+
const historyText = options.history.raw.slice(-(options.maxHistoryMessages ?? 50)).map(formatHistoryLine).join("\n");
|
|
1340
|
+
parts.push(`${options.historyHeader}
|
|
1341
|
+
${historyText}`);
|
|
1342
|
+
}
|
|
1343
|
+
parts.push(...systemUpdateParts(options.participantsMessage, options.contactsMessage));
|
|
1344
|
+
parts.push(options.currentMessage);
|
|
1345
|
+
return parts.join("\n\n");
|
|
1346
|
+
}
|
|
1347
|
+
function formatHistoryLine(entry) {
|
|
1348
|
+
const sender = String(entry.sender_name ?? entry.sender_type ?? "Unknown");
|
|
1349
|
+
const content = String(entry.content ?? "");
|
|
1350
|
+
return `[${sender}]: ${content}`;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// src/adapters/shared/withTimeout.ts
|
|
1354
|
+
async function withTimeout(promise, timeoutMs, message) {
|
|
1355
|
+
let timer;
|
|
1356
|
+
try {
|
|
1357
|
+
return await Promise.race([
|
|
1358
|
+
promise,
|
|
1359
|
+
new Promise((_, reject) => {
|
|
1360
|
+
timer = setTimeout(() => reject(new Error(message)), timeoutMs);
|
|
1361
|
+
})
|
|
1362
|
+
]);
|
|
1363
|
+
} finally {
|
|
1364
|
+
clearTimeout(timer);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1249
1368
|
// src/adapters/acp/ACPClientAdapter.ts
|
|
1369
|
+
init_chatEvents();
|
|
1250
1370
|
init_schemas();
|
|
1251
1371
|
|
|
1252
1372
|
// src/mcp/auth.ts
|
|
@@ -2029,6 +2149,7 @@ var acpModule = new LazyAsyncValue({
|
|
|
2029
2149
|
|
|
2030
2150
|
// src/adapters/acp/ACPClientAdapter.ts
|
|
2031
2151
|
var DEFAULT_PERMISSION_TIMEOUT_MS = 5 * 6e4;
|
|
2152
|
+
var SET_SESSION_MODE_TIMEOUT_MS = 1e4;
|
|
2032
2153
|
var ACPClientAdapter = class extends SimpleAdapter {
|
|
2033
2154
|
command;
|
|
2034
2155
|
cwd;
|
|
@@ -2047,6 +2168,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
|
|
|
2047
2168
|
pendingPermissions = /* @__PURE__ */ new Map();
|
|
2048
2169
|
resolvePermission;
|
|
2049
2170
|
permissionTimeoutMs;
|
|
2171
|
+
requestedPermissionMode;
|
|
2050
2172
|
logger;
|
|
2051
2173
|
backend = null;
|
|
2052
2174
|
backendPromise = null;
|
|
@@ -2077,6 +2199,10 @@ var ACPClientAdapter = class extends SimpleAdapter {
|
|
|
2077
2199
|
this.resolvePermission = options.resolvePermission;
|
|
2078
2200
|
this.logger = options.logger ?? new NoopLogger();
|
|
2079
2201
|
this.permissionTimeoutMs = options.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
|
|
2202
|
+
this.requestedPermissionMode = options.requestedPermissionMode;
|
|
2203
|
+
if (this.requestedPermissionMode !== void 0 && this.requestedPermissionMode.length === 0) {
|
|
2204
|
+
throw new ValidationError("requestedPermissionMode must be a non-empty mode id, got an empty string");
|
|
2205
|
+
}
|
|
2080
2206
|
if (this.resolvePermission && (!Number.isFinite(this.permissionTimeoutMs) || this.permissionTimeoutMs <= 0)) {
|
|
2081
2207
|
throw new ValidationError(`permissionTimeoutMs must be a positive finite number, got ${options.permissionTimeoutMs}`);
|
|
2082
2208
|
}
|
|
@@ -2091,7 +2217,7 @@ var ACPClientAdapter = class extends SimpleAdapter {
|
|
|
2091
2217
|
});
|
|
2092
2218
|
await this.ensureConnection();
|
|
2093
2219
|
}
|
|
2094
|
-
async onMessage(message, tools, history,
|
|
2220
|
+
async onMessage(message, tools, history, participantsMessage, contactsMessage, context) {
|
|
2095
2221
|
if (context.isSessionBootstrap) {
|
|
2096
2222
|
this.rehydrate(history);
|
|
2097
2223
|
}
|
|
@@ -2107,9 +2233,11 @@ var ACPClientAdapter = class extends SimpleAdapter {
|
|
|
2107
2233
|
sessionId,
|
|
2108
2234
|
(params) => this.handlePermissionRequest(tools, context.roomId, params)
|
|
2109
2235
|
);
|
|
2110
|
-
const
|
|
2236
|
+
const content = replaceUuidMentions(message.content, mentionSubjectsFromMetadata(message.metadata));
|
|
2237
|
+
const messageWithContext = [...systemUpdateParts(participantsMessage, contactsMessage), content].join("\n\n");
|
|
2238
|
+
const promptText = this.bootstrappedSessions.has(sessionId) ? messageWithContext : `${this.buildSystemContext(context.roomId, message)}
|
|
2111
2239
|
|
|
2112
|
-
${
|
|
2240
|
+
${messageWithContext}`;
|
|
2113
2241
|
this.bootstrappedSessions.add(sessionId);
|
|
2114
2242
|
try {
|
|
2115
2243
|
await connection.prompt({
|
|
@@ -2236,9 +2364,10 @@ ${message.content}`;
|
|
|
2236
2364
|
const mcpServers = await this.buildSessionMcpServers();
|
|
2237
2365
|
if (existingSessionId) {
|
|
2238
2366
|
const restored = await this.tryRestoreSession(connection, existingSessionId, mcpServers);
|
|
2239
|
-
if (restored) {
|
|
2367
|
+
if (restored.ok) {
|
|
2240
2368
|
this.activeSessions.add(existingSessionId);
|
|
2241
2369
|
this.bootstrappedSessions.add(existingSessionId);
|
|
2370
|
+
await this.applyRequestedPermissionMode(connection, existingSessionId, restored.modes);
|
|
2242
2371
|
return existingSessionId;
|
|
2243
2372
|
}
|
|
2244
2373
|
}
|
|
@@ -2248,30 +2377,52 @@ ${message.content}`;
|
|
|
2248
2377
|
});
|
|
2249
2378
|
this.roomToSession.set(roomId, created.sessionId);
|
|
2250
2379
|
this.activeSessions.add(created.sessionId);
|
|
2380
|
+
await this.applyRequestedPermissionMode(connection, created.sessionId, created.modes);
|
|
2251
2381
|
return created.sessionId;
|
|
2252
2382
|
}
|
|
2253
2383
|
async tryRestoreSession(connection, sessionId, mcpServers) {
|
|
2384
|
+
const capabilities = this.connectionState?.agentCapabilities;
|
|
2385
|
+
const params = { cwd: this.cwd, mcpServers, sessionId };
|
|
2386
|
+
const restore = capabilities?.loadSession ? () => connection.loadSession(params) : capabilities?.sessionCapabilities?.resume ? () => connection.unstable_resumeSession(params) : null;
|
|
2387
|
+
if (!restore) {
|
|
2388
|
+
return { ok: false };
|
|
2389
|
+
}
|
|
2254
2390
|
try {
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
cwd: this.cwd,
|
|
2258
|
-
mcpServers,
|
|
2259
|
-
sessionId
|
|
2260
|
-
});
|
|
2261
|
-
return true;
|
|
2262
|
-
}
|
|
2263
|
-
if (this.connectionState?.agentCapabilities?.sessionCapabilities?.resume) {
|
|
2264
|
-
await connection.unstable_resumeSession({
|
|
2265
|
-
cwd: this.cwd,
|
|
2266
|
-
mcpServers,
|
|
2267
|
-
sessionId
|
|
2268
|
-
});
|
|
2269
|
-
return true;
|
|
2270
|
-
}
|
|
2391
|
+
const restored = await restore();
|
|
2392
|
+
return { ok: true, modes: restored?.modes };
|
|
2271
2393
|
} catch {
|
|
2272
|
-
return false;
|
|
2394
|
+
return { ok: false };
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
// Best-effort: never throws, so a mode switch going wrong can't take a
|
|
2398
|
+
// session establishment down with it.
|
|
2399
|
+
async applyRequestedPermissionMode(connection, sessionId, modes) {
|
|
2400
|
+
const requestedModeId = this.requestedPermissionMode;
|
|
2401
|
+
if (!requestedModeId || !modes || modes.currentModeId === requestedModeId) {
|
|
2402
|
+
return;
|
|
2403
|
+
}
|
|
2404
|
+
const availableModes = Array.isArray(modes.availableModes) ? modes.availableModes : [];
|
|
2405
|
+
if (!availableModes.some((mode) => mode?.id === requestedModeId)) {
|
|
2406
|
+
this.safeWarn("requested permission mode is not advertised by this session", {
|
|
2407
|
+
sessionId,
|
|
2408
|
+
requestedModeId,
|
|
2409
|
+
availableModeIds: availableModes.map((mode) => mode?.id)
|
|
2410
|
+
});
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
try {
|
|
2414
|
+
await withTimeout(
|
|
2415
|
+
connection.setSessionMode({ sessionId, modeId: requestedModeId }),
|
|
2416
|
+
SET_SESSION_MODE_TIMEOUT_MS,
|
|
2417
|
+
`setSessionMode did not respond within ${SET_SESSION_MODE_TIMEOUT_MS}ms`
|
|
2418
|
+
);
|
|
2419
|
+
} catch (error) {
|
|
2420
|
+
this.safeWarn("failed to switch session into the requested permission mode", {
|
|
2421
|
+
sessionId,
|
|
2422
|
+
requestedModeId,
|
|
2423
|
+
error: String(error)
|
|
2424
|
+
});
|
|
2273
2425
|
}
|
|
2274
|
-
return false;
|
|
2275
2426
|
}
|
|
2276
2427
|
async buildSessionMcpServers() {
|
|
2277
2428
|
const mcpServers = [...this.mcpServers];
|
|
@@ -2410,6 +2561,18 @@ ${message.content}`;
|
|
|
2410
2561
|
const matched = chosenId !== void 0 && options.some((option) => option.optionId === chosenId);
|
|
2411
2562
|
return matched ? { outcome: { outcome: "selected", optionId: chosenId } } : { outcome: { outcome: "cancelled" } };
|
|
2412
2563
|
}
|
|
2564
|
+
// A caller-supplied `Logger` isn't guaranteed to be synchronous or
|
|
2565
|
+
// non-throwing. Every best-effort warning in this file routes through here
|
|
2566
|
+
// so one failing sink — a synchronous throw, or an `async` implementation
|
|
2567
|
+
// rejecting (the `Logger` interface's `void` return type permits either;
|
|
2568
|
+
// a bare try/catch only ever catches the former) — can't turn a warning
|
|
2569
|
+
// into an unhandled rejection in its place.
|
|
2570
|
+
safeWarn(message, context) {
|
|
2571
|
+
try {
|
|
2572
|
+
Promise.resolve(this.logger.warn(message, context)).catch(() => void 0);
|
|
2573
|
+
} catch {
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2413
2576
|
// Races the caller-supplied resolver against a timeout and against
|
|
2414
2577
|
// `controller`'s own abort signal — aborted externally by
|
|
2415
2578
|
// `cancelPendingPermissions`/`cancelAllPendingPermissions` (fired from
|
|
@@ -2433,10 +2596,7 @@ ${message.content}`;
|
|
|
2433
2596
|
// rejected promise, so both land in the `.catch` below rather than
|
|
2434
2597
|
// escaping this race uncaught.
|
|
2435
2598
|
Promise.resolve().then(() => this.resolvePermission(params, controller.signal)).catch((error) => {
|
|
2436
|
-
|
|
2437
|
-
this.logger.warn("resolvePermission threw; treating as no answer", { error: String(error) });
|
|
2438
|
-
} catch {
|
|
2439
|
-
}
|
|
2599
|
+
this.safeWarn("resolvePermission threw; treating as no answer", { error: String(error) });
|
|
2440
2600
|
return void 0;
|
|
2441
2601
|
}),
|
|
2442
2602
|
timeout,
|
|
@@ -2476,13 +2636,14 @@ ${message.content}`;
|
|
|
2476
2636
|
return;
|
|
2477
2637
|
}
|
|
2478
2638
|
for (const chunk of client.getCollectedChunks(input.sessionId)) {
|
|
2639
|
+
if (isBlankEventContent(chunk.content)) {
|
|
2640
|
+
continue;
|
|
2641
|
+
}
|
|
2479
2642
|
if (chunk.chunkType === "text") {
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
}]);
|
|
2485
|
-
}
|
|
2643
|
+
await input.tools.sendMessage(chunk.content, [{
|
|
2644
|
+
id: input.senderId,
|
|
2645
|
+
handle: input.senderHandle
|
|
2646
|
+
}]);
|
|
2486
2647
|
continue;
|
|
2487
2648
|
}
|
|
2488
2649
|
const messageType = chunk.chunkType === "plan" ? "task" : chunk.chunkType;
|
|
@@ -2590,14 +2751,6 @@ var ACPServerHistoryConverter = class {
|
|
|
2590
2751
|
}
|
|
2591
2752
|
};
|
|
2592
2753
|
|
|
2593
|
-
// src/runtime/types.ts
|
|
2594
|
-
function ensureHandlePrefix(handle) {
|
|
2595
|
-
if (!handle) {
|
|
2596
|
-
return null;
|
|
2597
|
-
}
|
|
2598
|
-
return handle.startsWith("@") ? handle : `@${handle}`;
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
2754
|
// src/converters/shared.ts
|
|
2602
2755
|
function asOptionalString(value) {
|
|
2603
2756
|
if (typeof value !== "string") {
|
|
@@ -3436,43 +3589,6 @@ function extractPromptText(prompt) {
|
|
|
3436
3589
|
// src/adapters/tool-calling/ToolCallingAdapter.ts
|
|
3437
3590
|
init_protocols();
|
|
3438
3591
|
|
|
3439
|
-
// src/runtime/formatters.ts
|
|
3440
|
-
function isMetadataMap(value) {
|
|
3441
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3442
|
-
}
|
|
3443
|
-
function replaceUuidMentions(content, participants) {
|
|
3444
|
-
if (!content || participants.length === 0) {
|
|
3445
|
-
return content;
|
|
3446
|
-
}
|
|
3447
|
-
let next = content;
|
|
3448
|
-
for (const participant of participants) {
|
|
3449
|
-
const participantId = participant.id;
|
|
3450
|
-
const handle = participant.handle;
|
|
3451
|
-
if (typeof participantId === "string" && typeof handle === "string") {
|
|
3452
|
-
next = next.replaceAll(`@[[${participantId}]]`, ensureHandlePrefix(handle) ?? "");
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
return next;
|
|
3456
|
-
}
|
|
3457
|
-
function formatMessageForLlm(message, participants) {
|
|
3458
|
-
const senderType = String(message.sender_type ?? "");
|
|
3459
|
-
const senderName = String(message.sender_name ?? message.name ?? senderType);
|
|
3460
|
-
const content = participants ? replaceUuidMentions(String(message.content ?? ""), participants) : String(message.content ?? "");
|
|
3461
|
-
return {
|
|
3462
|
-
role: senderType === "Agent" ? "assistant" : "user",
|
|
3463
|
-
content,
|
|
3464
|
-
sender_name: senderName,
|
|
3465
|
-
sender_type: senderType,
|
|
3466
|
-
message_type: String(message.message_type ?? "text"),
|
|
3467
|
-
metadata: isMetadataMap(message.metadata) ? message.metadata : {}
|
|
3468
|
-
};
|
|
3469
|
-
}
|
|
3470
|
-
function formatHistoryForLlm(messages, options) {
|
|
3471
|
-
const excludeId = options?.excludeId;
|
|
3472
|
-
const participants = options?.participants;
|
|
3473
|
-
return messages.filter((message) => String(message.id ?? "") !== excludeId).map((message) => formatMessageForLlm(message, participants));
|
|
3474
|
-
}
|
|
3475
|
-
|
|
3476
3592
|
// src/runtime/tools/customTools.ts
|
|
3477
3593
|
var import_zod3 = require("zod");
|
|
3478
3594
|
var import_zod_to_json_schema = require("zod-to-json-schema");
|
|
@@ -5011,18 +5127,28 @@ var GoogleADKAdapter = class extends SimpleAdapter {
|
|
|
5011
5127
|
}
|
|
5012
5128
|
async reportExecutionEvent(sdk, event, tools) {
|
|
5013
5129
|
for (const functionCall of sdk.getFunctionCalls(event)) {
|
|
5014
|
-
await tools.sendEvent(JSON.stringify({
|
|
5130
|
+
const result = await tools.sendEvent(JSON.stringify({
|
|
5015
5131
|
name: functionCall.name ?? "unknown",
|
|
5016
5132
|
args: asToolArgs(functionCall.args),
|
|
5017
5133
|
tool_call_id: functionCall.id ?? ""
|
|
5018
5134
|
}), "tool_call");
|
|
5135
|
+
this.warnOnFailedSend(result, "Google ADK tool_call event send failed", { toolCallId: functionCall.id ?? "" });
|
|
5019
5136
|
}
|
|
5020
5137
|
for (const functionResponse of sdk.getFunctionResponses(event)) {
|
|
5021
|
-
await tools.sendEvent(JSON.stringify({
|
|
5138
|
+
const result = await tools.sendEvent(JSON.stringify({
|
|
5022
5139
|
name: functionResponse.name ?? "unknown",
|
|
5023
5140
|
output: String(functionResponse.response ?? ""),
|
|
5024
5141
|
tool_call_id: functionResponse.id ?? ""
|
|
5025
5142
|
}), "tool_result");
|
|
5143
|
+
this.warnOnFailedSend(result, "Google ADK tool_result event send failed", { toolCallId: functionResponse.id ?? "" });
|
|
5144
|
+
}
|
|
5145
|
+
}
|
|
5146
|
+
warnOnFailedSend(result, message, meta) {
|
|
5147
|
+
if (result.ok === false) {
|
|
5148
|
+
try {
|
|
5149
|
+
this.logger.warn(message, meta);
|
|
5150
|
+
} catch {
|
|
5151
|
+
}
|
|
5026
5152
|
}
|
|
5027
5153
|
}
|
|
5028
5154
|
};
|
|
@@ -9580,29 +9706,6 @@ function delay(ms) {
|
|
|
9580
9706
|
init_errors();
|
|
9581
9707
|
init_schemas();
|
|
9582
9708
|
|
|
9583
|
-
// src/adapters/shared/conversationPrompt.ts
|
|
9584
|
-
function buildConversationPrompt(options) {
|
|
9585
|
-
const parts = [];
|
|
9586
|
-
if (options.isSessionBootstrap && options.history.length > 0) {
|
|
9587
|
-
const historyText = options.history.raw.slice(-(options.maxHistoryMessages ?? 50)).map(formatHistoryLine).join("\n");
|
|
9588
|
-
parts.push(`${options.historyHeader}
|
|
9589
|
-
${historyText}`);
|
|
9590
|
-
}
|
|
9591
|
-
if (options.participantsMessage) {
|
|
9592
|
-
parts.push(`[System]: ${options.participantsMessage}`);
|
|
9593
|
-
}
|
|
9594
|
-
if (options.contactsMessage) {
|
|
9595
|
-
parts.push(`[System]: ${options.contactsMessage}`);
|
|
9596
|
-
}
|
|
9597
|
-
parts.push(options.currentMessage);
|
|
9598
|
-
return parts.join("\n\n");
|
|
9599
|
-
}
|
|
9600
|
-
function formatHistoryLine(entry) {
|
|
9601
|
-
const sender = String(entry.sender_name ?? entry.sender_type ?? "Unknown");
|
|
9602
|
-
const content = String(entry.content ?? "");
|
|
9603
|
-
return `[${sender}]: ${content}`;
|
|
9604
|
-
}
|
|
9605
|
-
|
|
9606
9709
|
// src/converters/claude-sdk.ts
|
|
9607
9710
|
function extractClaudeSessionId(raw) {
|
|
9608
9711
|
const metadata = findLatestTaskMetadata(
|
|
@@ -10626,11 +10729,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
10626
10729
|
items.push({ type: "text", text: context });
|
|
10627
10730
|
}
|
|
10628
10731
|
}
|
|
10629
|
-
|
|
10630
|
-
items.push({ type: "text", text:
|
|
10631
|
-
}
|
|
10632
|
-
if (input.contactsMessage) {
|
|
10633
|
-
items.push({ type: "text", text: `[System]: ${input.contactsMessage}` });
|
|
10732
|
+
for (const part of systemUpdateParts(input.participantsMessage, input.contactsMessage)) {
|
|
10733
|
+
items.push({ type: "text", text: part });
|
|
10634
10734
|
}
|
|
10635
10735
|
items.push({
|
|
10636
10736
|
type: "text",
|
|
@@ -11058,13 +11158,6 @@ var TURN_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
|
11058
11158
|
"failed",
|
|
11059
11159
|
"inProgress"
|
|
11060
11160
|
]);
|
|
11061
|
-
function isStructuredToolFailure(value) {
|
|
11062
|
-
if (!value || typeof value !== "object") {
|
|
11063
|
-
return false;
|
|
11064
|
-
}
|
|
11065
|
-
const payload = value;
|
|
11066
|
-
return payload.ok === false && typeof payload.message === "string";
|
|
11067
|
-
}
|
|
11068
11161
|
function isCodexToolOutputError(value) {
|
|
11069
11162
|
return isToolExecutorError(value) || isStructuredToolFailure(value);
|
|
11070
11163
|
}
|
package/dist/adapters.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
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, RequestPermissionRequest, 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';
|
|
3
|
+
import { Client, ClientSideConnection, McpServer, ClientCapabilities, RequestPermissionRequest, SessionModeId, 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';
|
|
7
7
|
import { L as Logger } from './logger-CABQOnlR.cjs';
|
|
8
8
|
import { A as AdapterToolsProtocol, c as MessagingTools } from './protocols-Bz1rxcUg.cjs';
|
|
9
|
-
import { P as PlatformMessage } from './types-
|
|
9
|
+
import { P as PlatformMessage } from './types-BNNtOXu3.cjs';
|
|
10
10
|
import { M as McpToolRegistration } from './sdk-BTciSLRQ.cjs';
|
|
11
11
|
import { R as RestApi } from './types-BgYFd_Yw.cjs';
|
|
12
12
|
import { b as GatewayServerLike, c as GatewayServerOptions } from './opencode-2YdscIc1.cjs';
|
|
@@ -54,6 +54,7 @@ interface ACPClientAdapterOptions {
|
|
|
54
54
|
connectionFactory?: ACPClientConnectionFactory;
|
|
55
55
|
resolvePermission?: (request: RequestPermissionRequest, signal: AbortSignal) => Promise<string | undefined>;
|
|
56
56
|
permissionTimeoutMs?: number;
|
|
57
|
+
requestedPermissionMode?: SessionModeId;
|
|
57
58
|
logger?: Logger;
|
|
58
59
|
}
|
|
59
60
|
declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
|
|
@@ -74,6 +75,7 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
74
75
|
private readonly pendingPermissions;
|
|
75
76
|
private readonly resolvePermission?;
|
|
76
77
|
private readonly permissionTimeoutMs;
|
|
78
|
+
private readonly requestedPermissionMode?;
|
|
77
79
|
private readonly logger;
|
|
78
80
|
private backend;
|
|
79
81
|
private backendPromise;
|
|
@@ -86,7 +88,7 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
86
88
|
private spawnPromise;
|
|
87
89
|
constructor(options: ACPClientAdapterOptions);
|
|
88
90
|
onStarted(agentName: string, agentDescription: string): Promise<void>;
|
|
89
|
-
onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState,
|
|
91
|
+
onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState, participantsMessage: string | null, contactsMessage: string | null, context: {
|
|
90
92
|
isSessionBootstrap: boolean;
|
|
91
93
|
roomId: string;
|
|
92
94
|
}): Promise<void>;
|
|
@@ -98,12 +100,14 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
98
100
|
private spawnConnection;
|
|
99
101
|
private getOrCreateSession;
|
|
100
102
|
private tryRestoreSession;
|
|
103
|
+
private applyRequestedPermissionMode;
|
|
101
104
|
private buildSessionMcpServers;
|
|
102
105
|
private getOrCreateBackend;
|
|
103
106
|
private createBackend;
|
|
104
107
|
private buildSystemContext;
|
|
105
108
|
private handlePermissionRequest;
|
|
106
109
|
private toResponse;
|
|
110
|
+
private safeWarn;
|
|
107
111
|
private resolveManually;
|
|
108
112
|
private trackPending;
|
|
109
113
|
private untrackPending;
|
package/dist/adapters.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
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, RequestPermissionRequest, 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';
|
|
3
|
+
import { Client, ClientSideConnection, McpServer, ClientCapabilities, RequestPermissionRequest, SessionModeId, 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';
|
|
7
7
|
import { L as Logger } from './logger-CABQOnlR.js';
|
|
8
8
|
import { A as AdapterToolsProtocol, c as MessagingTools } from './protocols-Bwwcql0h.js';
|
|
9
|
-
import { P as PlatformMessage } from './types-
|
|
9
|
+
import { P as PlatformMessage } from './types-DFUtpxah.js';
|
|
10
10
|
import { M as McpToolRegistration } from './sdk-qKJtMma_.js';
|
|
11
11
|
import { R as RestApi } from './types-BivGO7I9.js';
|
|
12
12
|
import { b as GatewayServerLike, c as GatewayServerOptions } from './opencode-Bld62x5t.js';
|
|
@@ -54,6 +54,7 @@ interface ACPClientAdapterOptions {
|
|
|
54
54
|
connectionFactory?: ACPClientConnectionFactory;
|
|
55
55
|
resolvePermission?: (request: RequestPermissionRequest, signal: AbortSignal) => Promise<string | undefined>;
|
|
56
56
|
permissionTimeoutMs?: number;
|
|
57
|
+
requestedPermissionMode?: SessionModeId;
|
|
57
58
|
logger?: Logger;
|
|
58
59
|
}
|
|
59
60
|
declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, AdapterToolsProtocol> {
|
|
@@ -74,6 +75,7 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
74
75
|
private readonly pendingPermissions;
|
|
75
76
|
private readonly resolvePermission?;
|
|
76
77
|
private readonly permissionTimeoutMs;
|
|
78
|
+
private readonly requestedPermissionMode?;
|
|
77
79
|
private readonly logger;
|
|
78
80
|
private backend;
|
|
79
81
|
private backendPromise;
|
|
@@ -86,7 +88,7 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
86
88
|
private spawnPromise;
|
|
87
89
|
constructor(options: ACPClientAdapterOptions);
|
|
88
90
|
onStarted(agentName: string, agentDescription: string): Promise<void>;
|
|
89
|
-
onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState,
|
|
91
|
+
onMessage(message: PlatformMessage, tools: AdapterToolsProtocol, history: ACPClientSessionState, participantsMessage: string | null, contactsMessage: string | null, context: {
|
|
90
92
|
isSessionBootstrap: boolean;
|
|
91
93
|
roomId: string;
|
|
92
94
|
}): Promise<void>;
|
|
@@ -98,12 +100,14 @@ declare class ACPClientAdapter extends SimpleAdapter<ACPClientSessionState, Adap
|
|
|
98
100
|
private spawnConnection;
|
|
99
101
|
private getOrCreateSession;
|
|
100
102
|
private tryRestoreSession;
|
|
103
|
+
private applyRequestedPermissionMode;
|
|
101
104
|
private buildSessionMcpServers;
|
|
102
105
|
private getOrCreateBackend;
|
|
103
106
|
private createBackend;
|
|
104
107
|
private buildSystemContext;
|
|
105
108
|
private handlePermissionRequest;
|
|
106
109
|
private toResponse;
|
|
110
|
+
private safeWarn;
|
|
107
111
|
private resolveManually;
|
|
108
112
|
private trackPending;
|
|
109
113
|
private untrackPending;
|