@band-ai/sdk 0.1.10 → 0.2.1
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/README.md +54 -54
- package/dist/{ClaudeSDKAdapter-DfjaI5ke.d.cts → ClaudeSDKAdapter-BY4zEbCl.d.cts} +12 -10
- package/dist/{ClaudeSDKAdapter-DonPGJ43.d.ts → ClaudeSDKAdapter-Cna5P1dR.d.ts} +12 -10
- package/dist/{acp-server-NZAeg-WO.d.ts → acp-server-CiUqN3G3.d.ts} +2 -2
- package/dist/{acp-server-CUBXIiG6.d.cts → acp-server-Dlj7D563.d.cts} +2 -2
- package/dist/adapters.cjs +387 -238
- package/dist/adapters.d.cts +36 -21
- package/dist/adapters.d.ts +36 -21
- package/dist/adapters.js +168 -65
- package/dist/backends-D-dBdDm-.d.ts +27 -0
- package/dist/backends-ZLxmQrTZ.d.cts +27 -0
- package/dist/{chunk-2BHHR6YW.js → chunk-4IAXZBXX.js} +62 -23
- package/dist/{chunk-SG4WLD2H.js → chunk-EAI2M3WM.js} +38 -94
- package/dist/{chunk-YR3BOQNW.js → chunk-JY75VSQK.js} +7 -7
- package/dist/{chunk-RDM4TE4B.js → chunk-LBWKISBS.js} +19 -1
- package/dist/{chunk-FP237EAG.js → chunk-N2QTUMGO.js} +112 -195
- package/dist/{chunk-J3M3PFFY.js → chunk-NMZLX7TP.js} +35 -31
- package/dist/{chunk-6RXWL6TC.js → chunk-NT7TBFX2.js} +1 -1
- package/dist/{chunk-MLROFDKR.js → chunk-RV76SKFT.js} +39 -33
- package/dist/{chunk-XA4N2JPH.js → chunk-TLBCKDQO.js} +23 -23
- package/dist/{chunk-IZPV6QS6.js → chunk-WL2HNJZ6.js} +38 -11
- package/dist/{chunk-DNPVCR3S.js → chunk-WLCM2OXG.js} +31 -31
- package/dist/config.cjs +40 -13
- package/dist/config.d.cts +7 -1
- package/dist/config.d.ts +7 -1
- package/dist/config.js +2 -2
- package/dist/converters.cjs +61 -61
- package/dist/converters.d.cts +5 -5
- package/dist/converters.d.ts +5 -5
- package/dist/converters.js +4 -4
- package/dist/core.cjs +8 -8
- package/dist/core.d.cts +9 -9
- package/dist/core.d.ts +9 -9
- package/dist/core.js +3 -3
- package/dist/{dtos-Dd_fTfLn.d.cts → dtos-B8KU_q4d.d.cts} +2 -2
- package/dist/{dtos-Dd_fTfLn.d.ts → dtos-B8KU_q4d.d.ts} +2 -2
- package/dist/index.cjs +459 -504
- package/dist/index.d.cts +16 -15
- package/dist/index.d.ts +16 -15
- package/dist/index.js +15 -13
- package/dist/linear.cjs +74 -74
- package/dist/linear.d.cts +14 -14
- package/dist/linear.d.ts +14 -14
- package/dist/linear.js +72 -72
- package/dist/mcp-claude.cjs +37 -36
- package/dist/mcp-claude.d.cts +3 -3
- package/dist/mcp-claude.d.ts +3 -3
- package/dist/mcp-claude.js +7 -6
- package/dist/mcp.cjs +103 -62
- package/dist/mcp.d.cts +29 -16
- package/dist/mcp.d.ts +29 -16
- package/dist/mcp.js +14 -14
- package/dist/{opencode--iA5-KYk.d.cts → opencode-2YdscIc1.d.cts} +5 -5
- package/dist/{opencode-YNacv-eJ.d.ts → opencode-Bld62x5t.d.ts} +5 -5
- package/dist/{pagination-BBLsYLhT.d.ts → pagination-BgEx-HeL.d.ts} +2 -2
- package/dist/{pagination-CqidD-L_.d.cts → pagination-DqdkQArT.d.cts} +2 -2
- package/dist/{protocols-BF6jamIl.d.ts → protocols-Bwwcql0h.d.ts} +1 -1
- package/dist/{protocols-D2bTrQ_t.d.cts → protocols-Bz1rxcUg.d.cts} +1 -1
- package/dist/rest.cjs +41 -97
- package/dist/rest.d.cts +7 -7
- package/dist/rest.d.ts +7 -7
- package/dist/rest.js +2 -2
- package/dist/runtime.cjs +293 -464
- package/dist/runtime.d.cts +16 -28
- package/dist/runtime.d.ts +16 -28
- package/dist/runtime.js +12 -63
- package/dist/{schemas-CI0qgcp_.d.cts → schemas-BotL3ZLH.d.cts} +40 -54
- package/dist/{schemas-B1Fd3oUM.d.ts → schemas-DBsC4J1g.d.ts} +40 -54
- package/dist/{sdk-D2rTDU_o.d.cts → sdk-BTciSLRQ.d.cts} +5 -5
- package/dist/{sdk-CyqN1W5g.d.ts → sdk-qKJtMma_.d.ts} +5 -5
- package/dist/{simpleAdapter-qQt-tSz4.d.ts → simpleAdapter--wznuoOw.d.ts} +1 -1
- package/dist/{simpleAdapter-C_f-01Cu.d.cts → simpleAdapter-BpT4XbZC.d.cts} +1 -1
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/{types-DNySTI_8.d.ts → types-BTN_ZETM.d.ts} +2 -2
- package/dist/{types-D3AsUnd0.d.ts → types-BgYFd_Yw.d.cts} +5 -5
- package/dist/{types-DtMms5Fi.d.cts → types-BivGO7I9.d.ts} +5 -5
- package/dist/{types-CKqrhGB1.d.cts → types-D958TC71.d.cts} +2 -2
- package/package.json +6 -5
- package/dist/backends-DYtEhCZG.d.cts +0 -25
- package/dist/backends-oYAb7EU-.d.ts +0 -25
package/dist/adapters.cjs
CHANGED
|
@@ -30,6 +30,38 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
+
// src/core/errors.ts
|
|
34
|
+
var BandSdkError, UnsupportedFeatureError, ValidationError, RuntimeStateError;
|
|
35
|
+
var init_errors = __esm({
|
|
36
|
+
"src/core/errors.ts"() {
|
|
37
|
+
"use strict";
|
|
38
|
+
BandSdkError = class extends Error {
|
|
39
|
+
constructor(message, cause) {
|
|
40
|
+
super(message, cause !== void 0 ? { cause } : void 0);
|
|
41
|
+
this.name = "BandSdkError";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
UnsupportedFeatureError = class extends BandSdkError {
|
|
45
|
+
constructor(message) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.name = "UnsupportedFeatureError";
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
ValidationError = class extends BandSdkError {
|
|
51
|
+
constructor(message, cause) {
|
|
52
|
+
super(message, cause);
|
|
53
|
+
this.name = "ValidationError";
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
RuntimeStateError = class extends BandSdkError {
|
|
57
|
+
constructor(message) {
|
|
58
|
+
super(message);
|
|
59
|
+
this.name = "RuntimeStateError";
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
33
65
|
// src/contracts/memory.ts
|
|
34
66
|
function namedValues(values) {
|
|
35
67
|
return Object.fromEntries(values.map((value) => [value, value]));
|
|
@@ -95,9 +127,9 @@ var init_memory = __esm({
|
|
|
95
127
|
"active",
|
|
96
128
|
// Normal, visible memories
|
|
97
129
|
"superseded",
|
|
98
|
-
// Outdated; soft-deleted via
|
|
130
|
+
// Outdated; soft-deleted via band_supersede_memory
|
|
99
131
|
"archived",
|
|
100
|
-
// Hidden but preserved via
|
|
132
|
+
// Hidden but preserved via band_archive_memory
|
|
101
133
|
"all"
|
|
102
134
|
// Any status (no filter)
|
|
103
135
|
];
|
|
@@ -108,38 +140,6 @@ var init_memory = __esm({
|
|
|
108
140
|
}
|
|
109
141
|
});
|
|
110
142
|
|
|
111
|
-
// src/core/errors.ts
|
|
112
|
-
var ThenvoiSdkError, UnsupportedFeatureError, ValidationError, RuntimeStateError;
|
|
113
|
-
var init_errors = __esm({
|
|
114
|
-
"src/core/errors.ts"() {
|
|
115
|
-
"use strict";
|
|
116
|
-
ThenvoiSdkError = class extends Error {
|
|
117
|
-
constructor(message, cause) {
|
|
118
|
-
super(message, cause !== void 0 ? { cause } : void 0);
|
|
119
|
-
this.name = "ThenvoiSdkError";
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
UnsupportedFeatureError = class extends ThenvoiSdkError {
|
|
123
|
-
constructor(message) {
|
|
124
|
-
super(message);
|
|
125
|
-
this.name = "UnsupportedFeatureError";
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
ValidationError = class extends ThenvoiSdkError {
|
|
129
|
-
constructor(message, cause) {
|
|
130
|
-
super(message, cause);
|
|
131
|
-
this.name = "ValidationError";
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
RuntimeStateError = class extends ThenvoiSdkError {
|
|
135
|
-
constructor(message) {
|
|
136
|
-
super(message);
|
|
137
|
-
this.name = "RuntimeStateError";
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
|
|
143
143
|
// src/contracts/chatEvents.ts
|
|
144
144
|
var CHAT_EVENT_TYPES, CHAT_MESSAGE_TYPES;
|
|
145
145
|
var init_chatEvents = __esm({
|
|
@@ -159,14 +159,14 @@ function getToolDescription(name) {
|
|
|
159
159
|
const model = TOOL_MODELS[name];
|
|
160
160
|
return model?.description ?? `Execute ${name}`;
|
|
161
161
|
}
|
|
162
|
-
var TOOL_MODELS, ALL_TOOL_NAMES, MEMORY_TOOL_NAMES, CONTACT_TOOL_NAMES, BASE_TOOL_NAMES, CHAT_TOOL_NAMES, MCP_TOOL_PREFIX;
|
|
162
|
+
var TOOL_MODELS, ALL_TOOL_NAMES, MEMORY_TOOL_NAMES, CONTACT_TOOL_NAMES, BASE_TOOL_NAMES, CHAT_TOOL_NAMES, MCP_TOOL_PREFIX, MCP_SERVER_NAME, SEND_MESSAGE_TOOL_NAME, SEND_EVENT_TOOL_NAME;
|
|
163
163
|
var init_schemas = __esm({
|
|
164
164
|
"src/runtime/tools/schemas.ts"() {
|
|
165
165
|
"use strict";
|
|
166
166
|
init_chatEvents();
|
|
167
167
|
init_memory();
|
|
168
168
|
TOOL_MODELS = {
|
|
169
|
-
|
|
169
|
+
band_send_message: {
|
|
170
170
|
description: "Send a message to the chat room. Use this to respond to users or other agents. Messages require at least one @mention in the mentions array. You MUST use this tool to communicate \u2014 plain text responses won't reach users. When delegating, send the full task context in this message instead of assuming hidden state.",
|
|
171
171
|
properties: {
|
|
172
172
|
content: {
|
|
@@ -182,7 +182,7 @@ var init_schemas = __esm({
|
|
|
182
182
|
},
|
|
183
183
|
required: ["content", "mentions"]
|
|
184
184
|
},
|
|
185
|
-
|
|
185
|
+
band_send_event: {
|
|
186
186
|
description: "Send an event to the chat room. No mentions required. 'thought': Share your reasoning or plan BEFORE taking actions. Explain what you're about to do and why. 'error': Report an error or problem that occurred. 'task': Report task progress or completion status. Always send a thought before complex actions to keep users informed.",
|
|
187
187
|
properties: {
|
|
188
188
|
content: {
|
|
@@ -201,12 +201,12 @@ var init_schemas = __esm({
|
|
|
201
201
|
},
|
|
202
202
|
required: ["content", "message_type"]
|
|
203
203
|
},
|
|
204
|
-
|
|
205
|
-
description: "Add a participant (agent or user) to the chat room by name. IMPORTANT: Use
|
|
204
|
+
band_add_participant: {
|
|
205
|
+
description: "Add a participant (agent or user) to the chat room by name. IMPORTANT: Use band_lookup_peers() first to find available agents. Pass the exact peer name from band_lookup_peers, not the handle. For normal delegation, omit role or use 'member'.",
|
|
206
206
|
properties: {
|
|
207
207
|
name: {
|
|
208
208
|
type: "string",
|
|
209
|
-
description: "Name of participant to add (must match a name from
|
|
209
|
+
description: "Name of participant to add (must match a name from band_lookup_peers)."
|
|
210
210
|
},
|
|
211
211
|
role: {
|
|
212
212
|
type: "string",
|
|
@@ -216,7 +216,7 @@ var init_schemas = __esm({
|
|
|
216
216
|
},
|
|
217
217
|
required: ["name"]
|
|
218
218
|
},
|
|
219
|
-
|
|
219
|
+
band_remove_participant: {
|
|
220
220
|
description: "Remove a participant from the chat room by name.",
|
|
221
221
|
properties: {
|
|
222
222
|
name: {
|
|
@@ -226,12 +226,12 @@ var init_schemas = __esm({
|
|
|
226
226
|
},
|
|
227
227
|
required: ["name"]
|
|
228
228
|
},
|
|
229
|
-
|
|
229
|
+
band_get_participants: {
|
|
230
230
|
description: "Get a list of all participants in the current chat room.",
|
|
231
231
|
properties: {},
|
|
232
232
|
required: []
|
|
233
233
|
},
|
|
234
|
-
|
|
234
|
+
band_lookup_peers: {
|
|
235
235
|
description: "List available peers (agents and users) that can be added to this room. Automatically excludes peers already in the room. Returns dict with 'peers' list and 'metadata' (page, page_size, total_count, total_pages). Use this to find specialized agents (e.g., Weather Agent) when you cannot answer a question directly.",
|
|
236
236
|
properties: {
|
|
237
237
|
page: {
|
|
@@ -246,7 +246,7 @@ var init_schemas = __esm({
|
|
|
246
246
|
},
|
|
247
247
|
required: []
|
|
248
248
|
},
|
|
249
|
-
|
|
249
|
+
band_create_chatroom: {
|
|
250
250
|
description: "Create a new chat room for a specific task or conversation.",
|
|
251
251
|
properties: {
|
|
252
252
|
task_id: {
|
|
@@ -256,7 +256,7 @@ var init_schemas = __esm({
|
|
|
256
256
|
},
|
|
257
257
|
required: []
|
|
258
258
|
},
|
|
259
|
-
|
|
259
|
+
band_list_contacts: {
|
|
260
260
|
description: "List agent's contacts with pagination.",
|
|
261
261
|
properties: {
|
|
262
262
|
page: {
|
|
@@ -273,7 +273,7 @@ var init_schemas = __esm({
|
|
|
273
273
|
},
|
|
274
274
|
required: []
|
|
275
275
|
},
|
|
276
|
-
|
|
276
|
+
band_add_contact: {
|
|
277
277
|
description: "Send a contact request to add someone as a contact. Returns 'pending' when request is created. Returns 'approved' when inverse request existed and was auto-accepted.",
|
|
278
278
|
properties: {
|
|
279
279
|
handle: {
|
|
@@ -287,7 +287,7 @@ var init_schemas = __esm({
|
|
|
287
287
|
},
|
|
288
288
|
required: ["handle"]
|
|
289
289
|
},
|
|
290
|
-
|
|
290
|
+
band_remove_contact: {
|
|
291
291
|
description: "Remove an existing contact by handle or ID.",
|
|
292
292
|
properties: {
|
|
293
293
|
handle: {
|
|
@@ -301,7 +301,7 @@ var init_schemas = __esm({
|
|
|
301
301
|
},
|
|
302
302
|
required: []
|
|
303
303
|
},
|
|
304
|
-
|
|
304
|
+
band_list_contact_requests: {
|
|
305
305
|
description: "List both received and sent contact requests. Received requests are always filtered to pending status. Sent requests can be filtered by status.",
|
|
306
306
|
properties: {
|
|
307
307
|
page: {
|
|
@@ -323,7 +323,7 @@ var init_schemas = __esm({
|
|
|
323
323
|
},
|
|
324
324
|
required: []
|
|
325
325
|
},
|
|
326
|
-
|
|
326
|
+
band_respond_contact_request: {
|
|
327
327
|
description: "Respond to a contact request. 'approve'/'reject': For requests you RECEIVED (handle = requester's handle). 'cancel': For requests you SENT (handle = recipient's handle).",
|
|
328
328
|
properties: {
|
|
329
329
|
action: {
|
|
@@ -342,7 +342,7 @@ var init_schemas = __esm({
|
|
|
342
342
|
},
|
|
343
343
|
required: ["action"]
|
|
344
344
|
},
|
|
345
|
-
|
|
345
|
+
band_list_memories: {
|
|
346
346
|
description: "List memories accessible to the agent. Returns memories about the specified subject (cross-agent sharing) and organization-wide shared memories.",
|
|
347
347
|
properties: {
|
|
348
348
|
subject_id: {
|
|
@@ -387,7 +387,7 @@ var init_schemas = __esm({
|
|
|
387
387
|
},
|
|
388
388
|
required: []
|
|
389
389
|
},
|
|
390
|
-
|
|
390
|
+
band_store_memory: {
|
|
391
391
|
description: "Store a new memory entry. The memory will be associated with the authenticated agent as the source. For subject-scoped memories, provide a subject_id. For organization-scoped memories, omit subject_id.",
|
|
392
392
|
properties: {
|
|
393
393
|
content: {
|
|
@@ -429,7 +429,7 @@ var init_schemas = __esm({
|
|
|
429
429
|
},
|
|
430
430
|
required: ["content", "system", "type", "segment", "thought"]
|
|
431
431
|
},
|
|
432
|
-
|
|
432
|
+
band_get_memory: {
|
|
433
433
|
description: "Retrieve a specific memory by ID.",
|
|
434
434
|
properties: {
|
|
435
435
|
memory_id: {
|
|
@@ -439,7 +439,7 @@ var init_schemas = __esm({
|
|
|
439
439
|
},
|
|
440
440
|
required: ["memory_id"]
|
|
441
441
|
},
|
|
442
|
-
|
|
442
|
+
band_supersede_memory: {
|
|
443
443
|
description: "Mark a memory as superseded (soft delete). Use when information is outdated or incorrect. The memory remains for audit trail but won't appear in normal queries. Only the source agent can supersede.",
|
|
444
444
|
properties: {
|
|
445
445
|
memory_id: {
|
|
@@ -449,7 +449,7 @@ var init_schemas = __esm({
|
|
|
449
449
|
},
|
|
450
450
|
required: ["memory_id"]
|
|
451
451
|
},
|
|
452
|
-
|
|
452
|
+
band_archive_memory: {
|
|
453
453
|
description: "Archive a memory (hide but preserve). Use when memory is valid but not currently needed. Archived memories can be restored later by humans. Only the source agent can archive.",
|
|
454
454
|
properties: {
|
|
455
455
|
memory_id: {
|
|
@@ -462,18 +462,18 @@ var init_schemas = __esm({
|
|
|
462
462
|
};
|
|
463
463
|
ALL_TOOL_NAMES = new Set(Object.keys(TOOL_MODELS));
|
|
464
464
|
MEMORY_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
465
|
-
"
|
|
466
|
-
"
|
|
467
|
-
"
|
|
468
|
-
"
|
|
469
|
-
"
|
|
465
|
+
"band_list_memories",
|
|
466
|
+
"band_store_memory",
|
|
467
|
+
"band_get_memory",
|
|
468
|
+
"band_supersede_memory",
|
|
469
|
+
"band_archive_memory"
|
|
470
470
|
]);
|
|
471
471
|
CONTACT_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
472
|
-
"
|
|
473
|
-
"
|
|
474
|
-
"
|
|
475
|
-
"
|
|
476
|
-
"
|
|
472
|
+
"band_list_contacts",
|
|
473
|
+
"band_add_contact",
|
|
474
|
+
"band_remove_contact",
|
|
475
|
+
"band_list_contact_requests",
|
|
476
|
+
"band_respond_contact_request"
|
|
477
477
|
]);
|
|
478
478
|
BASE_TOOL_NAMES = new Set(
|
|
479
479
|
[...ALL_TOOL_NAMES].filter((name) => !MEMORY_TOOL_NAMES.has(name))
|
|
@@ -481,7 +481,10 @@ var init_schemas = __esm({
|
|
|
481
481
|
CHAT_TOOL_NAMES = new Set(
|
|
482
482
|
[...BASE_TOOL_NAMES].filter((name) => !CONTACT_TOOL_NAMES.has(name))
|
|
483
483
|
);
|
|
484
|
-
MCP_TOOL_PREFIX = "
|
|
484
|
+
MCP_TOOL_PREFIX = "mcp__band__";
|
|
485
|
+
MCP_SERVER_NAME = "band";
|
|
486
|
+
SEND_MESSAGE_TOOL_NAME = "band_send_message";
|
|
487
|
+
SEND_EVENT_TOOL_NAME = "band_send_event";
|
|
485
488
|
}
|
|
486
489
|
});
|
|
487
490
|
|
|
@@ -694,9 +697,9 @@ var init_zod = __esm({
|
|
|
694
697
|
// src/mcp/sdk.ts
|
|
695
698
|
var sdk_exports = {};
|
|
696
699
|
__export(sdk_exports, {
|
|
697
|
-
|
|
700
|
+
createBandSdkMcpServer: () => createBandSdkMcpServer
|
|
698
701
|
});
|
|
699
|
-
function
|
|
702
|
+
function createBandSdkMcpServer(options) {
|
|
700
703
|
const registrationOptions = {
|
|
701
704
|
enableMemoryTools: options.enableMemoryTools,
|
|
702
705
|
enableContactTools: true,
|
|
@@ -708,7 +711,7 @@ function createThenvoiSdkMcpServer(options) {
|
|
|
708
711
|
const contextCache = /* @__PURE__ */ new Map();
|
|
709
712
|
const MAX_CONTEXT_CACHE_ENTRIES = 100;
|
|
710
713
|
const serverConfig = (0, import_claude_agent_sdk.createSdkMcpServer)({
|
|
711
|
-
name:
|
|
714
|
+
name: MCP_SERVER_NAME,
|
|
712
715
|
tools: toolDefinitions
|
|
713
716
|
});
|
|
714
717
|
return {
|
|
@@ -948,6 +951,7 @@ __export(adapters_exports, {
|
|
|
948
951
|
ACPServer: () => ACPServer,
|
|
949
952
|
AnthropicAdapter: () => AnthropicAdapter,
|
|
950
953
|
AnthropicToolCallingModel: () => AnthropicToolCallingModel,
|
|
954
|
+
BandACPServerAdapter: () => BandACPServerAdapter,
|
|
951
955
|
CODEX_REASONING_EFFORTS: () => CODEX_REASONING_EFFORTS,
|
|
952
956
|
CODEX_REASONING_SUMMARIES: () => CODEX_REASONING_SUMMARIES,
|
|
953
957
|
CODEX_WEB_SEARCH_MODES: () => CODEX_WEB_SEARCH_MODES,
|
|
@@ -971,7 +975,6 @@ __export(adapters_exports, {
|
|
|
971
975
|
OpencodeAdapter: () => OpencodeAdapter,
|
|
972
976
|
ParlantAdapter: () => ParlantAdapter,
|
|
973
977
|
ParlantHistoryConverter: () => ParlantHistoryConverter,
|
|
974
|
-
ThenvoiACPServerAdapter: () => ThenvoiACPServerAdapter,
|
|
975
978
|
ToolCallingAdapter: () => ToolCallingAdapter,
|
|
976
979
|
VercelAISDKAdapter: () => VercelAISDKAdapter,
|
|
977
980
|
VercelAISDKToolCallingModel: () => VercelAISDKToolCallingModel,
|
|
@@ -1063,25 +1066,37 @@ var ACPClientHistoryConverter = class {
|
|
|
1063
1066
|
}
|
|
1064
1067
|
};
|
|
1065
1068
|
|
|
1069
|
+
// src/core/logger.ts
|
|
1070
|
+
var noop = () => void 0;
|
|
1071
|
+
var NoopLogger = class {
|
|
1072
|
+
debug = noop;
|
|
1073
|
+
info = noop;
|
|
1074
|
+
warn = noop;
|
|
1075
|
+
error = noop;
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
// src/adapters/acp/ACPClientAdapter.ts
|
|
1079
|
+
init_errors();
|
|
1080
|
+
|
|
1066
1081
|
// src/runtime/prompts/base.ts
|
|
1067
1082
|
var ENVIRONMENT_SECTION = `
|
|
1068
1083
|
## Environment
|
|
1069
1084
|
|
|
1070
1085
|
Multi-participant chat. Messages show sender: [Name]: content.
|
|
1071
1086
|
Messages prefixed with [System]: are platform updates (participant changes, contact updates, etc.) \u2014 not messages from users.
|
|
1072
|
-
Use \`
|
|
1087
|
+
Use \`band_send_message(content, mentions)\` to respond. Plain text output is not delivered.
|
|
1073
1088
|
Mentions use handles: @<username> for users, @<username>/<agent-name> for agents.`;
|
|
1074
1089
|
var MULTI_AGENT_RULES_SECTION = `## CRITICAL: Delegate When You Cannot Help Directly
|
|
1075
1090
|
|
|
1076
1091
|
You have NO internet access and NO real-time data. When asked about weather, news, stock prices,
|
|
1077
1092
|
or any current information you cannot answer directly:
|
|
1078
1093
|
|
|
1079
|
-
1. Call \`
|
|
1080
|
-
2. If a relevant agent exists, call \`
|
|
1081
|
-
3. Ask that agent using \`
|
|
1094
|
+
1. Call \`band_lookup_peers()\` to find available specialized agents
|
|
1095
|
+
2. If a relevant agent exists, call \`band_add_participant(name)\` to add them
|
|
1096
|
+
3. Ask that agent using \`band_send_message(question, mentions=[agent_handle])\`
|
|
1082
1097
|
4. Wait for their response and relay it back to the user
|
|
1083
1098
|
|
|
1084
|
-
NEVER say "I can't do that" without first checking if another agent can help via \`
|
|
1099
|
+
NEVER say "I can't do that" without first checking if another agent can help via \`band_lookup_peers()\`.
|
|
1085
1100
|
|
|
1086
1101
|
## CRITICAL: Do NOT Remove Agents Automatically
|
|
1087
1102
|
|
|
@@ -1100,42 +1115,42 @@ When someone asks you to get information from another agent:
|
|
|
1100
1115
|
3. Do NOT just thank the helper agent - the requester is waiting for their answer!`;
|
|
1101
1116
|
var THINKING_SECTION = `## IMPORTANT: Always Share Your Thinking
|
|
1102
1117
|
|
|
1103
|
-
You MUST call \`
|
|
1118
|
+
You MUST call \`band_send_event(content, message_type="thought")\` BEFORE every action.
|
|
1104
1119
|
This is required so users can see your reasoning process.`;
|
|
1105
1120
|
var EXAMPLES_SECTION = `## Examples
|
|
1106
1121
|
|
|
1107
1122
|
### Simple question - answer directly
|
|
1108
1123
|
[John Doe]: What's 2+2?
|
|
1109
|
-
->
|
|
1110
|
-
->
|
|
1124
|
+
-> band_send_event("Simple arithmetic, answering directly.", message_type="thought")
|
|
1125
|
+
-> band_send_message("4", mentions=["@john"])
|
|
1111
1126
|
|
|
1112
1127
|
### User asks about weather (you cannot answer directly)
|
|
1113
1128
|
[John Doe]: What's the weather in Tokyo?
|
|
1114
|
-
->
|
|
1115
|
-
->
|
|
1116
|
-
->
|
|
1117
|
-
->
|
|
1118
|
-
->
|
|
1129
|
+
-> band_send_event("I can't check weather directly. Looking for a Weather Agent.", message_type="thought")
|
|
1130
|
+
-> band_lookup_peers()
|
|
1131
|
+
-> band_send_event("Found Weather Agent. Adding to room.", message_type="thought")
|
|
1132
|
+
-> band_add_participant("Weather Agent")
|
|
1133
|
+
-> band_send_message("What's the weather in Tokyo?", mentions=["@john/weather-agent"])
|
|
1119
1134
|
|
|
1120
1135
|
[Weather Agent]: Tokyo is 15\xB0C and cloudy.
|
|
1121
|
-
->
|
|
1122
|
-
->
|
|
1136
|
+
-> band_send_event("Got weather response. Relaying back to John Doe.", message_type="thought")
|
|
1137
|
+
-> band_send_message("The weather in Tokyo is 15\xB0C and cloudy.", mentions=["@john"])
|
|
1123
1138
|
|
|
1124
1139
|
### No suitable agent available
|
|
1125
1140
|
[John Doe]: What's the stock price of AAPL?
|
|
1126
|
-
->
|
|
1127
|
-
->
|
|
1128
|
-
->
|
|
1129
|
-
->
|
|
1141
|
+
-> band_send_event("I can't check stock prices. Looking for a Stock Agent.", message_type="thought")
|
|
1142
|
+
-> band_lookup_peers()
|
|
1143
|
+
-> band_send_event("No stock agent available. Must inform user.", message_type="thought")
|
|
1144
|
+
-> band_send_message("I don't have access to stock prices, and there's no specialized agent available to help with that.", mentions=["@john"])
|
|
1130
1145
|
|
|
1131
1146
|
### Follow-up question in same conversation
|
|
1132
1147
|
[John Doe]: What about London?
|
|
1133
|
-
->
|
|
1134
|
-
->
|
|
1148
|
+
-> band_send_event("Follow-up weather question. Asking Weather Agent.", message_type="thought")
|
|
1149
|
+
-> band_send_message("What's the weather in London?", mentions=["@john/weather-agent"])
|
|
1135
1150
|
|
|
1136
1151
|
[Weather Agent]: London is 8\xB0C and rainy.
|
|
1137
|
-
->
|
|
1138
|
-
->
|
|
1152
|
+
-> band_send_event("Got London weather. Relaying to John Doe.", message_type="thought")
|
|
1153
|
+
-> band_send_message("London is 8\xB0C and rainy.", mentions=["@john"])`;
|
|
1139
1154
|
var BASE_INSTRUCTIONS = [
|
|
1140
1155
|
ENVIRONMENT_SECTION,
|
|
1141
1156
|
MULTI_AGENT_RULES_SECTION,
|
|
@@ -1149,10 +1164,10 @@ init_schemas();
|
|
|
1149
1164
|
var MEMORY_INTRO = `## Memory Tools
|
|
1150
1165
|
|
|
1151
1166
|
You have access to memory tools for storing and retrieving information
|
|
1152
|
-
across conversations. Use \`
|
|
1153
|
-
information and \`
|
|
1154
|
-
Use \`
|
|
1155
|
-
\`
|
|
1167
|
+
across conversations. Use \`band_store_memory\` to persist important
|
|
1168
|
+
information and \`band_list_memories\` / \`band_get_memory\` to recall it.
|
|
1169
|
+
Use \`band_supersede_memory\` to mark outdated memories and
|
|
1170
|
+
\`band_archive_memory\` to hide memories that should be preserved.`;
|
|
1156
1171
|
function longTermPattern(label, type, segment, scope) {
|
|
1157
1172
|
return {
|
|
1158
1173
|
label,
|
|
@@ -1177,7 +1192,7 @@ var MEMORY_COMMON_PATTERNS = [
|
|
|
1177
1192
|
].join("\n");
|
|
1178
1193
|
var MEMORY_SCOPE_GUIDANCE = `Prefer \`scope="${MEMORY_STORE_SCOPE.subject}"\` whenever the memory is about a specific person or agent, so it
|
|
1179
1194
|
stays attached to that subject rather than leaking org-wide. Storing with \`scope="${MEMORY_STORE_SCOPE.subject}"\` requires a
|
|
1180
|
-
real \`subject_id\` UUID, so resolve it first via \`
|
|
1195
|
+
real \`subject_id\` UUID, so resolve it first via \`band_lookup_peers\` or the participant list.
|
|
1181
1196
|
Reserve \`scope="${MEMORY_STORE_SCOPE.organization}"\` for knowledge that is genuinely shared across the whole organization and
|
|
1182
1197
|
is not about any one subject.`;
|
|
1183
1198
|
function quoteChoices(values) {
|
|
@@ -1187,11 +1202,11 @@ function memoryTypeLines() {
|
|
|
1187
1202
|
return Object.entries(MEMORY_SYSTEM_TYPES).map(([system, types]) => ` - ${system}: ${quoteChoices(types)}`).join("\n");
|
|
1188
1203
|
}
|
|
1189
1204
|
function buildMemorySection() {
|
|
1190
|
-
const storeMemoryProps = TOOL_MODELS.
|
|
1205
|
+
const storeMemoryProps = TOOL_MODELS.band_store_memory.properties;
|
|
1191
1206
|
const systems = storeMemoryProps.system.enum;
|
|
1192
1207
|
const segments = storeMemoryProps.segment.enum;
|
|
1193
1208
|
const scopes = storeMemoryProps.scope.enum;
|
|
1194
|
-
const fieldRules = `When calling \`
|
|
1209
|
+
const fieldRules = `When calling \`band_store_memory\`, the \`system\`, \`type\`, \`segment\`, and \`scope\` fields
|
|
1195
1210
|
must use these exact values (case-sensitive):
|
|
1196
1211
|
|
|
1197
1212
|
- **system**: ${quoteChoices(systems)}
|
|
@@ -1231,15 +1246,39 @@ ${customSection}`.trim();
|
|
|
1231
1246
|
return parts.join("\n\n");
|
|
1232
1247
|
}
|
|
1233
1248
|
|
|
1249
|
+
// src/adapters/acp/ACPClientAdapter.ts
|
|
1250
|
+
init_schemas();
|
|
1251
|
+
|
|
1252
|
+
// src/mcp/auth.ts
|
|
1253
|
+
var import_node_crypto = require("crypto");
|
|
1254
|
+
function generateAuthToken() {
|
|
1255
|
+
return (0, import_node_crypto.randomBytes)(32).toString("hex");
|
|
1256
|
+
}
|
|
1257
|
+
function isAuthorizedRequest(authorizationHeader, authToken) {
|
|
1258
|
+
if (!authToken) {
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
if (!authorizationHeader) {
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
const expected = Buffer.from(`Bearer ${authToken}`);
|
|
1265
|
+
const actual = Buffer.from(authorizationHeader);
|
|
1266
|
+
if (expected.length !== actual.length) {
|
|
1267
|
+
return false;
|
|
1268
|
+
}
|
|
1269
|
+
return (0, import_node_crypto.timingSafeEqual)(expected, actual);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1234
1272
|
// src/mcp/server.ts
|
|
1235
1273
|
init_registrations();
|
|
1236
1274
|
init_zod();
|
|
1275
|
+
init_schemas();
|
|
1237
1276
|
var PORT_RANGE_START = 5e4;
|
|
1238
1277
|
var PORT_RANGE_END = 6e4;
|
|
1239
1278
|
var MCP_SERVER_VERSION = "1.0.0";
|
|
1240
1279
|
var SESSION_IDLE_TTL_MS = 15 * 60 * 1e3;
|
|
1241
1280
|
var SESSION_SWEEP_INTERVAL_MS = 60 * 1e3;
|
|
1242
|
-
var
|
|
1281
|
+
var BandMcpServer = class {
|
|
1243
1282
|
options;
|
|
1244
1283
|
registrations;
|
|
1245
1284
|
httpServer = null;
|
|
@@ -1283,7 +1322,7 @@ var ThenvoiMcpServer = class {
|
|
|
1283
1322
|
const http = await import("http");
|
|
1284
1323
|
const { randomUUID: randomUUID7 } = await import("crypto");
|
|
1285
1324
|
const { z: z4 } = await import("zod");
|
|
1286
|
-
const serverName = this.options.name ??
|
|
1325
|
+
const serverName = this.options.name ?? MCP_SERVER_NAME;
|
|
1287
1326
|
const app = express();
|
|
1288
1327
|
app.use(express.json());
|
|
1289
1328
|
app.get("/healthz", (_req, res) => {
|
|
@@ -1291,6 +1330,10 @@ var ThenvoiMcpServer = class {
|
|
|
1291
1330
|
});
|
|
1292
1331
|
const handleMcpRequest = async (req, res) => {
|
|
1293
1332
|
try {
|
|
1333
|
+
if (!isAuthorizedRequest(req.headers.authorization, this.options.authToken)) {
|
|
1334
|
+
sendMcpError(res, 401, "Unauthorized");
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1294
1337
|
const sessionId = getSessionIdHeader(req.headers["mcp-session-id"]);
|
|
1295
1338
|
let session = sessionId ? this.sessions.get(sessionId) : void 0;
|
|
1296
1339
|
if (!session) {
|
|
@@ -1466,11 +1509,12 @@ function checkPort(http, port) {
|
|
|
1466
1509
|
// src/mcp/sse.ts
|
|
1467
1510
|
init_registrations();
|
|
1468
1511
|
init_zod();
|
|
1512
|
+
init_schemas();
|
|
1469
1513
|
var PORT_RANGE_START2 = 5e4;
|
|
1470
1514
|
var PORT_RANGE_END2 = 6e4;
|
|
1471
1515
|
var SESSION_IDLE_TTL_MS2 = 15 * 60 * 1e3;
|
|
1472
1516
|
var SESSION_SWEEP_INTERVAL_MS2 = 60 * 1e3;
|
|
1473
|
-
var
|
|
1517
|
+
var BandMcpSseServer = class {
|
|
1474
1518
|
options;
|
|
1475
1519
|
registrations;
|
|
1476
1520
|
httpServer = null;
|
|
@@ -1517,10 +1561,14 @@ var ThenvoiMcpSseServer = class {
|
|
|
1517
1561
|
app.get("/healthz", (_req, res) => {
|
|
1518
1562
|
res.json({ status: "ok" });
|
|
1519
1563
|
});
|
|
1520
|
-
app.get("/sse", async (
|
|
1564
|
+
app.get("/sse", async (req, res) => {
|
|
1565
|
+
if (!isAuthorizedRequest(req.headers.authorization, this.options.authToken)) {
|
|
1566
|
+
res.status(401).send("Unauthorized");
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1521
1569
|
const transport = new SSEServerTransport("/messages", res);
|
|
1522
1570
|
const mcpServer = new McpServer({
|
|
1523
|
-
name: this.options.name ??
|
|
1571
|
+
name: this.options.name ?? MCP_SERVER_NAME,
|
|
1524
1572
|
version: "1.0.0"
|
|
1525
1573
|
});
|
|
1526
1574
|
registerTools2(mcpServer, z4, this.registrations);
|
|
@@ -1542,6 +1590,10 @@ var ThenvoiMcpSseServer = class {
|
|
|
1542
1590
|
});
|
|
1543
1591
|
});
|
|
1544
1592
|
app.post("/messages", async (req, res) => {
|
|
1593
|
+
if (!isAuthorizedRequest(req.headers.authorization, this.options.authToken)) {
|
|
1594
|
+
res.status(401).send("Unauthorized");
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1545
1597
|
const sessionId = typeof req.query.sessionId === "string" ? req.query.sessionId : null;
|
|
1546
1598
|
if (!sessionId) {
|
|
1547
1599
|
res.status(400).send("Missing sessionId");
|
|
@@ -1714,7 +1766,7 @@ function normalizeMcpServers(mcpServers) {
|
|
|
1714
1766
|
}
|
|
1715
1767
|
|
|
1716
1768
|
// src/adapters/acp/client.ts
|
|
1717
|
-
var
|
|
1769
|
+
var BandACPClient = class {
|
|
1718
1770
|
sessionChunks = /* @__PURE__ */ new Map();
|
|
1719
1771
|
permissionHandlers = /* @__PURE__ */ new Map();
|
|
1720
1772
|
async sessionUpdate(params) {
|
|
@@ -1976,6 +2028,7 @@ var acpModule = new LazyAsyncValue({
|
|
|
1976
2028
|
});
|
|
1977
2029
|
|
|
1978
2030
|
// src/adapters/acp/ACPClientAdapter.ts
|
|
2031
|
+
var DEFAULT_PERMISSION_TIMEOUT_MS = 5 * 6e4;
|
|
1979
2032
|
var ACPClientAdapter = class extends SimpleAdapter {
|
|
1980
2033
|
command;
|
|
1981
2034
|
cwd;
|
|
@@ -1991,7 +2044,12 @@ var ACPClientAdapter = class extends SimpleAdapter {
|
|
|
1991
2044
|
roomTools = /* @__PURE__ */ new Map();
|
|
1992
2045
|
activeSessions = /* @__PURE__ */ new Set();
|
|
1993
2046
|
bootstrappedSessions = /* @__PURE__ */ new Set();
|
|
2047
|
+
pendingPermissions = /* @__PURE__ */ new Map();
|
|
2048
|
+
resolvePermission;
|
|
2049
|
+
permissionTimeoutMs;
|
|
2050
|
+
logger;
|
|
1994
2051
|
backend = null;
|
|
2052
|
+
backendPromise = null;
|
|
1995
2053
|
client = null;
|
|
1996
2054
|
connectionHandle = null;
|
|
1997
2055
|
connection = null;
|
|
@@ -2016,6 +2074,12 @@ var ACPClientAdapter = class extends SimpleAdapter {
|
|
|
2016
2074
|
this.additionalMcpTools = [...options.additionalMcpTools ?? []];
|
|
2017
2075
|
this.clientCapabilities = options.clientCapabilities;
|
|
2018
2076
|
this.connectionFactory = options.connectionFactory ?? createSubprocessConnection;
|
|
2077
|
+
this.resolvePermission = options.resolvePermission;
|
|
2078
|
+
this.logger = options.logger ?? new NoopLogger();
|
|
2079
|
+
this.permissionTimeoutMs = options.permissionTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
|
|
2080
|
+
if (this.resolvePermission && (!Number.isFinite(this.permissionTimeoutMs) || this.permissionTimeoutMs <= 0)) {
|
|
2081
|
+
throw new ValidationError(`permissionTimeoutMs must be a positive finite number, got ${options.permissionTimeoutMs}`);
|
|
2082
|
+
}
|
|
2019
2083
|
}
|
|
2020
2084
|
async onStarted(agentName, agentDescription) {
|
|
2021
2085
|
await super.onStarted(agentName, agentDescription);
|
|
@@ -2081,6 +2145,7 @@ ${message.content}`;
|
|
|
2081
2145
|
this.activeSessions.delete(sessionId);
|
|
2082
2146
|
this.bootstrappedSessions.delete(sessionId);
|
|
2083
2147
|
this.client?.setPermissionHandler(sessionId, void 0);
|
|
2148
|
+
this.cancelPendingPermissions(sessionId);
|
|
2084
2149
|
}
|
|
2085
2150
|
}
|
|
2086
2151
|
async onRuntimeStop() {
|
|
@@ -2093,6 +2158,7 @@ ${message.content}`;
|
|
|
2093
2158
|
this.bootstrappedSessions.clear();
|
|
2094
2159
|
this.roomToSession.clear();
|
|
2095
2160
|
this.roomTools.clear();
|
|
2161
|
+
this.cancelAllPendingPermissions();
|
|
2096
2162
|
this.client = null;
|
|
2097
2163
|
this.connection = null;
|
|
2098
2164
|
if (this.backend) {
|
|
@@ -2132,7 +2198,7 @@ ${message.content}`;
|
|
|
2132
2198
|
}
|
|
2133
2199
|
async spawnConnection() {
|
|
2134
2200
|
const acp = await acpModule.get();
|
|
2135
|
-
const client = new
|
|
2201
|
+
const client = new BandACPClient();
|
|
2136
2202
|
const handle = await this.connectionFactory(client, {
|
|
2137
2203
|
command: this.command,
|
|
2138
2204
|
cwd: this.cwd,
|
|
@@ -2164,11 +2230,11 @@ ${message.content}`;
|
|
|
2164
2230
|
}
|
|
2165
2231
|
async getOrCreateSession(roomId, connection) {
|
|
2166
2232
|
const existingSessionId = this.roomToSession.get(roomId);
|
|
2233
|
+
if (existingSessionId && this.activeSessions.has(existingSessionId)) {
|
|
2234
|
+
return existingSessionId;
|
|
2235
|
+
}
|
|
2167
2236
|
const mcpServers = await this.buildSessionMcpServers();
|
|
2168
2237
|
if (existingSessionId) {
|
|
2169
|
-
if (this.activeSessions.has(existingSessionId)) {
|
|
2170
|
-
return existingSessionId;
|
|
2171
|
-
}
|
|
2172
2238
|
const restored = await this.tryRestoreSession(connection, existingSessionId, mcpServers);
|
|
2173
2239
|
if (restored) {
|
|
2174
2240
|
this.activeSessions.add(existingSessionId);
|
|
@@ -2216,26 +2282,26 @@ ${message.content}`;
|
|
|
2216
2282
|
if (backend.kind === "http") {
|
|
2217
2283
|
const url = backend.server.url;
|
|
2218
2284
|
if (!url) {
|
|
2219
|
-
throw new Error("
|
|
2285
|
+
throw new Error("Band MCP HTTP backend did not expose a URL");
|
|
2220
2286
|
}
|
|
2221
2287
|
mcpServers.push({
|
|
2222
2288
|
type: "http",
|
|
2223
|
-
name:
|
|
2289
|
+
name: MCP_SERVER_NAME,
|
|
2224
2290
|
url,
|
|
2225
|
-
headers: []
|
|
2291
|
+
headers: [{ name: "Authorization", value: `Bearer ${backend.authToken}` }]
|
|
2226
2292
|
});
|
|
2227
2293
|
return mcpServers;
|
|
2228
2294
|
}
|
|
2229
2295
|
if (backend.kind === "sse") {
|
|
2230
2296
|
const url = backend.server.sseUrl;
|
|
2231
2297
|
if (!url) {
|
|
2232
|
-
throw new Error("
|
|
2298
|
+
throw new Error("Band MCP SSE backend did not expose a URL");
|
|
2233
2299
|
}
|
|
2234
2300
|
mcpServers.push({
|
|
2235
2301
|
type: "sse",
|
|
2236
|
-
name:
|
|
2302
|
+
name: MCP_SERVER_NAME,
|
|
2237
2303
|
url,
|
|
2238
|
-
headers: []
|
|
2304
|
+
headers: [{ name: "Authorization", value: `Bearer ${backend.authToken}` }]
|
|
2239
2305
|
});
|
|
2240
2306
|
return mcpServers;
|
|
2241
2307
|
}
|
|
@@ -2245,34 +2311,51 @@ ${message.content}`;
|
|
|
2245
2311
|
if (this.backend) {
|
|
2246
2312
|
return this.backend;
|
|
2247
2313
|
}
|
|
2248
|
-
|
|
2314
|
+
this.backendPromise ??= this.createBackend().finally(() => {
|
|
2315
|
+
this.backendPromise = null;
|
|
2316
|
+
});
|
|
2317
|
+
return this.backendPromise;
|
|
2318
|
+
}
|
|
2319
|
+
async createBackend() {
|
|
2320
|
+
const mcpCapabilities = this.connectionState?.agentCapabilities?.mcpCapabilities;
|
|
2321
|
+
const transport = mcpCapabilities?.http ? "http" : mcpCapabilities?.sse ? "sse" : null;
|
|
2322
|
+
if (transport === null) {
|
|
2323
|
+
throw new Error(
|
|
2324
|
+
"ACP agent does not advertise MCP transport support: its initialize response has mcpCapabilities.http and .sse both false or missing, so Band tools cannot be exposed to it over MCP."
|
|
2325
|
+
);
|
|
2326
|
+
}
|
|
2327
|
+
const authToken = generateAuthToken();
|
|
2249
2328
|
if (transport === "sse") {
|
|
2250
|
-
const server2 = new
|
|
2329
|
+
const server2 = new BandMcpSseServer({
|
|
2251
2330
|
tools: (roomId) => this.roomTools.get(roomId),
|
|
2252
2331
|
enableMemoryTools: this.enableMemoryTools,
|
|
2253
2332
|
enableContactTools: true,
|
|
2254
|
-
additionalTools: this.additionalMcpTools
|
|
2333
|
+
additionalTools: this.additionalMcpTools,
|
|
2334
|
+
authToken
|
|
2255
2335
|
});
|
|
2256
2336
|
await server2.start();
|
|
2257
2337
|
this.backend = {
|
|
2258
2338
|
kind: "sse",
|
|
2259
2339
|
server: server2,
|
|
2340
|
+
authToken,
|
|
2260
2341
|
stop: async () => {
|
|
2261
2342
|
await server2.stop();
|
|
2262
2343
|
}
|
|
2263
2344
|
};
|
|
2264
2345
|
return this.backend;
|
|
2265
2346
|
}
|
|
2266
|
-
const server = new
|
|
2347
|
+
const server = new BandMcpServer({
|
|
2267
2348
|
tools: (roomId) => this.roomTools.get(roomId),
|
|
2268
2349
|
enableMemoryTools: this.enableMemoryTools,
|
|
2269
2350
|
enableContactTools: true,
|
|
2270
|
-
additionalTools: this.additionalMcpTools
|
|
2351
|
+
additionalTools: this.additionalMcpTools,
|
|
2352
|
+
authToken
|
|
2271
2353
|
});
|
|
2272
2354
|
await server.start();
|
|
2273
2355
|
this.backend = {
|
|
2274
2356
|
kind: "http",
|
|
2275
2357
|
server,
|
|
2358
|
+
authToken,
|
|
2276
2359
|
stop: async () => {
|
|
2277
2360
|
await server.stop();
|
|
2278
2361
|
}
|
|
@@ -2287,39 +2370,105 @@ ${message.content}`;
|
|
|
2287
2370
|
this.systemPrompt,
|
|
2288
2371
|
"",
|
|
2289
2372
|
"## Room Context",
|
|
2290
|
-
"You are connected to
|
|
2291
|
-
"Use the
|
|
2373
|
+
"You are connected to Band using Band MCP tools.",
|
|
2374
|
+
"Use the Band tools for any visible room action. Plain text output is not posted back to the room.",
|
|
2292
2375
|
"",
|
|
2293
2376
|
`Current room_id: ${roomId}`,
|
|
2294
2377
|
`Current requester name: ${requesterName}`,
|
|
2295
2378
|
`Current requester id: ${requesterId}`,
|
|
2296
2379
|
"",
|
|
2297
|
-
"All
|
|
2380
|
+
"All Band MCP tool calls must include room_id."
|
|
2298
2381
|
].join("\n");
|
|
2299
2382
|
}
|
|
2300
2383
|
async handlePermissionRequest(tools, roomId, params) {
|
|
2301
|
-
const selected = choosePermissionOption(params.options);
|
|
2302
2384
|
const toolName = params.toolCall.title ?? "unknown";
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2385
|
+
const autoSelection = this.resolvePermission ? void 0 : choosePermissionOption(params.options);
|
|
2386
|
+
const controller = this.resolvePermission ? new AbortController() : void 0;
|
|
2387
|
+
if (controller) {
|
|
2388
|
+
this.trackPending(params.sessionId, controller);
|
|
2389
|
+
}
|
|
2390
|
+
const [, chosenId] = await Promise.all([
|
|
2391
|
+
// This is the room's only "a permission request is pending" signal,
|
|
2392
|
+
// and the only one other room participants ever see — started
|
|
2393
|
+
// immediately rather than serialized in front of a manual wait that
|
|
2394
|
+
// can take up to `permissionTimeoutMs`.
|
|
2395
|
+
tools.sendEvent(`Permission requested: ${toolName}`, "tool_call", {
|
|
2396
|
+
permission_request: true,
|
|
2397
|
+
tool_name: toolName,
|
|
2398
|
+
tool_call_id: params.toolCall.toolCallId,
|
|
2399
|
+
acp_session_id: params.sessionId,
|
|
2400
|
+
auto_allowed: autoSelection !== void 0 && autoSelection !== null
|
|
2401
|
+
}),
|
|
2402
|
+
controller ? this.resolveManually(params.sessionId, params, controller) : Promise.resolve(autoSelection?.optionId)
|
|
2403
|
+
]);
|
|
2404
|
+
return this.toResponse(chosenId, params.options);
|
|
2405
|
+
}
|
|
2406
|
+
// `undefined`, or an id absent from this request's own `options` (a buggy
|
|
2407
|
+
// or stale caller), both map to `cancelled` — never silently treated as a
|
|
2408
|
+
// deny. A real match, reject-kind options included, maps to `selected`.
|
|
2409
|
+
toResponse(chosenId, options) {
|
|
2410
|
+
const matched = chosenId !== void 0 && options.some((option) => option.optionId === chosenId);
|
|
2411
|
+
return matched ? { outcome: { outcome: "selected", optionId: chosenId } } : { outcome: { outcome: "cancelled" } };
|
|
2412
|
+
}
|
|
2413
|
+
// Races the caller-supplied resolver against a timeout and against
|
|
2414
|
+
// `controller`'s own abort signal — aborted externally by
|
|
2415
|
+
// `cancelPendingPermissions`/`cancelAllPendingPermissions` (fired from
|
|
2416
|
+
// `onCleanup`/`stop()` below) when a room or the whole adapter tears down
|
|
2417
|
+
// while this is still pending. `controller` is the same object tracked in
|
|
2418
|
+
// `pendingPermissions` by the caller, so there is exactly one cancellation
|
|
2419
|
+
// channel here, not a second hand-rolled one alongside it.
|
|
2420
|
+
async resolveManually(sessionId, params, controller) {
|
|
2421
|
+
let timer;
|
|
2422
|
+
const cancelled = new Promise((resolve) => {
|
|
2423
|
+
controller.signal.addEventListener("abort", () => resolve(void 0));
|
|
2424
|
+
});
|
|
2425
|
+
try {
|
|
2426
|
+
const timeout = new Promise((resolve) => {
|
|
2427
|
+
timer = setTimeout(() => resolve(void 0), this.permissionTimeoutMs);
|
|
2428
|
+
});
|
|
2429
|
+
return await Promise.race([
|
|
2430
|
+
// `resolvePermission` is caller-supplied; nothing guarantees it's
|
|
2431
|
+
// `async` or otherwise well-behaved. `Promise.resolve().then(...)`
|
|
2432
|
+
// normalizes a synchronous throw the same way it normalizes a
|
|
2433
|
+
// rejected promise, so both land in the `.catch` below rather than
|
|
2434
|
+
// escaping this race uncaught.
|
|
2435
|
+
Promise.resolve().then(() => this.resolvePermission(params, controller.signal)).catch((error) => {
|
|
2436
|
+
try {
|
|
2437
|
+
this.logger.warn("resolvePermission threw; treating as no answer", { error: String(error) });
|
|
2438
|
+
} catch {
|
|
2439
|
+
}
|
|
2440
|
+
return void 0;
|
|
2441
|
+
}),
|
|
2442
|
+
timeout,
|
|
2443
|
+
cancelled
|
|
2444
|
+
]);
|
|
2445
|
+
} finally {
|
|
2446
|
+
clearTimeout(timer);
|
|
2447
|
+
this.untrackPending(sessionId, controller);
|
|
2448
|
+
controller.abort();
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
trackPending(sessionId, controller) {
|
|
2452
|
+
const pending = this.pendingPermissions.get(sessionId) ?? /* @__PURE__ */ new Set();
|
|
2453
|
+
pending.add(controller);
|
|
2454
|
+
this.pendingPermissions.set(sessionId, pending);
|
|
2455
|
+
}
|
|
2456
|
+
untrackPending(sessionId, controller) {
|
|
2457
|
+
const pending = this.pendingPermissions.get(sessionId);
|
|
2458
|
+
pending?.delete(controller);
|
|
2459
|
+
if (pending?.size === 0) {
|
|
2460
|
+
this.pendingPermissions.delete(sessionId);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
cancelPendingPermissions(sessionId) {
|
|
2464
|
+
for (const controller of this.pendingPermissions.get(sessionId) ?? []) {
|
|
2465
|
+
controller.abort();
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
cancelAllPendingPermissions() {
|
|
2469
|
+
for (const sessionId of this.pendingPermissions.keys()) {
|
|
2470
|
+
this.cancelPendingPermissions(sessionId);
|
|
2316
2471
|
}
|
|
2317
|
-
return {
|
|
2318
|
-
outcome: {
|
|
2319
|
-
outcome: "selected",
|
|
2320
|
-
optionId: selected.optionId
|
|
2321
|
-
}
|
|
2322
|
-
};
|
|
2323
2472
|
}
|
|
2324
2473
|
async flushChunks(input) {
|
|
2325
2474
|
const client = this.client;
|
|
@@ -2403,8 +2552,8 @@ function toErrorMessage(error) {
|
|
|
2403
2552
|
// src/adapters/acp/ACPServer.ts
|
|
2404
2553
|
var import_node_stream2 = require("stream");
|
|
2405
2554
|
|
|
2406
|
-
// src/adapters/acp/
|
|
2407
|
-
var
|
|
2555
|
+
// src/adapters/acp/BandACPServerAdapter.ts
|
|
2556
|
+
var import_node_crypto2 = require("crypto");
|
|
2408
2557
|
|
|
2409
2558
|
// src/converters/acp-server.ts
|
|
2410
2559
|
var ACPServerHistoryConverter = class {
|
|
@@ -2655,12 +2804,12 @@ var AgentRouter = class {
|
|
|
2655
2804
|
}
|
|
2656
2805
|
};
|
|
2657
2806
|
|
|
2658
|
-
// src/adapters/acp/
|
|
2807
|
+
// src/adapters/acp/BandACPServerAdapter.ts
|
|
2659
2808
|
var DEFAULT_MAX_SESSIONS = 100;
|
|
2660
2809
|
var DEFAULT_PROMPT_TIMEOUT_MS = 3e5;
|
|
2661
2810
|
var DEFAULT_PROMPT_COMPLETION_GRACE_MS = 250;
|
|
2662
|
-
var
|
|
2663
|
-
|
|
2811
|
+
var BandACPServerAdapter = class extends SimpleAdapter {
|
|
2812
|
+
bandRest;
|
|
2664
2813
|
maxSessions;
|
|
2665
2814
|
responseTimeoutMs;
|
|
2666
2815
|
promptCompletionGraceMs;
|
|
@@ -2681,7 +2830,7 @@ var ThenvoiACPServerAdapter = class extends SimpleAdapter {
|
|
|
2681
2830
|
super({
|
|
2682
2831
|
historyConverter: new ACPServerHistoryConverter()
|
|
2683
2832
|
});
|
|
2684
|
-
this.
|
|
2833
|
+
this.bandRest = options.bandRest;
|
|
2685
2834
|
this.maxSessions = options.maxSessions ?? DEFAULT_MAX_SESSIONS;
|
|
2686
2835
|
this.responseTimeoutMs = options.responseTimeoutMs ?? DEFAULT_PROMPT_TIMEOUT_MS;
|
|
2687
2836
|
this.promptCompletionGraceMs = options.promptCompletionGraceMs ?? DEFAULT_PROMPT_COMPLETION_GRACE_MS;
|
|
@@ -2743,7 +2892,7 @@ var ThenvoiACPServerAdapter = class extends SimpleAdapter {
|
|
|
2743
2892
|
}
|
|
2744
2893
|
async verifyCredentials() {
|
|
2745
2894
|
try {
|
|
2746
|
-
await this.
|
|
2895
|
+
await this.bandRest.getAgentMe();
|
|
2747
2896
|
return true;
|
|
2748
2897
|
} catch {
|
|
2749
2898
|
return false;
|
|
@@ -2752,7 +2901,7 @@ var ThenvoiACPServerAdapter = class extends SimpleAdapter {
|
|
|
2752
2901
|
async onStarted(agentName, agentDescription) {
|
|
2753
2902
|
await super.onStarted(agentName, agentDescription);
|
|
2754
2903
|
try {
|
|
2755
|
-
const identity = await this.
|
|
2904
|
+
const identity = await this.bandRest.getAgentMe();
|
|
2756
2905
|
this.agentId = identity.id;
|
|
2757
2906
|
} catch {
|
|
2758
2907
|
this.agentId = null;
|
|
@@ -2766,8 +2915,8 @@ var ThenvoiACPServerAdapter = class extends SimpleAdapter {
|
|
|
2766
2915
|
throw new Error(`Maximum ACP sessions (${this.maxSessions}) reached`);
|
|
2767
2916
|
}
|
|
2768
2917
|
try {
|
|
2769
|
-
const room = await this.
|
|
2770
|
-
const sessionId = (0,
|
|
2918
|
+
const room = await this.bandRest.createChat();
|
|
2919
|
+
const sessionId = (0, import_node_crypto2.randomUUID)();
|
|
2771
2920
|
const normalizedMcpServers = normalizeMcpServers(input.mcpServers);
|
|
2772
2921
|
this.sessionToRoom.set(sessionId, room.id);
|
|
2773
2922
|
this.roomToSession.set(room.id, sessionId);
|
|
@@ -2776,7 +2925,7 @@ var ThenvoiACPServerAdapter = class extends SimpleAdapter {
|
|
|
2776
2925
|
this.sessionMcpServers.set(sessionId, normalizedMcpServers);
|
|
2777
2926
|
}
|
|
2778
2927
|
try {
|
|
2779
|
-
await this.
|
|
2928
|
+
await this.bandRest.createChatEvent(room.id, {
|
|
2780
2929
|
content: "ACP session context",
|
|
2781
2930
|
messageType: "task",
|
|
2782
2931
|
metadata: {
|
|
@@ -2809,10 +2958,10 @@ var ThenvoiACPServerAdapter = class extends SimpleAdapter {
|
|
|
2809
2958
|
this.pendingPrompts.set(roomId, pending);
|
|
2810
2959
|
const resolved = this.router.resolve(text, this.sessionModeIds.get(sessionId));
|
|
2811
2960
|
const promptText = this.prependSessionContext(sessionId, resolved.text);
|
|
2812
|
-
const participants = await this.
|
|
2961
|
+
const participants = await this.bandRest.listChatParticipants(roomId);
|
|
2813
2962
|
const mentions = this.resolveMentions(participants, resolved.targetPeer);
|
|
2814
2963
|
try {
|
|
2815
|
-
await this.
|
|
2964
|
+
await this.bandRest.createChatMessage(roomId, {
|
|
2816
2965
|
content: promptText,
|
|
2817
2966
|
mentions
|
|
2818
2967
|
});
|
|
@@ -3065,7 +3214,7 @@ var ACPServer = class {
|
|
|
3065
3214
|
this.authMethods = options?.authMethods ?? [{
|
|
3066
3215
|
id: "api_key",
|
|
3067
3216
|
name: "API Key",
|
|
3068
|
-
description: "Authenticate with THENVOI_API_KEY."
|
|
3217
|
+
description: "Authenticate with BAND_API_KEY (legacy THENVOI_API_KEY)."
|
|
3069
3218
|
}];
|
|
3070
3219
|
this.agentInfo = options?.agentInfo ?? {};
|
|
3071
3220
|
this.extensionHandler = options?.extensionHandler ?? new CursorExtensionHandler();
|
|
@@ -3118,8 +3267,8 @@ var ACPServer = class {
|
|
|
3118
3267
|
}
|
|
3119
3268
|
},
|
|
3120
3269
|
agentInfo: {
|
|
3121
|
-
name: this.agentInfo.name ?? "
|
|
3122
|
-
title: this.agentInfo.title ?? this.adapter.displayName ?? "
|
|
3270
|
+
name: this.agentInfo.name ?? "band-agent",
|
|
3271
|
+
title: this.agentInfo.title ?? this.adapter.displayName ?? "Band Agent",
|
|
3123
3272
|
version: this.agentInfo.version ?? "0.1.0"
|
|
3124
3273
|
},
|
|
3125
3274
|
authMethods: this.authMethods
|
|
@@ -3287,15 +3436,6 @@ function extractPromptText(prompt) {
|
|
|
3287
3436
|
// src/adapters/tool-calling/ToolCallingAdapter.ts
|
|
3288
3437
|
init_protocols();
|
|
3289
3438
|
|
|
3290
|
-
// src/core/logger.ts
|
|
3291
|
-
var noop = () => void 0;
|
|
3292
|
-
var NoopLogger = class {
|
|
3293
|
-
debug = noop;
|
|
3294
|
-
info = noop;
|
|
3295
|
-
warn = noop;
|
|
3296
|
-
error = noop;
|
|
3297
|
-
};
|
|
3298
|
-
|
|
3299
3439
|
// src/runtime/formatters.ts
|
|
3300
3440
|
function isMetadataMap(value) {
|
|
3301
3441
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -4471,7 +4611,7 @@ var GeminiAdapter = class extends ToolCallingAdapter {
|
|
|
4471
4611
|
};
|
|
4472
4612
|
|
|
4473
4613
|
// src/adapters/google-adk/GoogleADKAdapter.ts
|
|
4474
|
-
var
|
|
4614
|
+
var import_node_crypto3 = require("crypto");
|
|
4475
4615
|
|
|
4476
4616
|
// src/adapters/shared/history.ts
|
|
4477
4617
|
function findLatestTaskMetadata(raw, predicate) {
|
|
@@ -4628,7 +4768,7 @@ var GoogleADKHistoryConverter = class {
|
|
|
4628
4768
|
};
|
|
4629
4769
|
|
|
4630
4770
|
// src/adapters/google-adk/GoogleADKAdapter.ts
|
|
4631
|
-
var APP_NAME = "
|
|
4771
|
+
var APP_NAME = "band";
|
|
4632
4772
|
var DEFAULT_MAX_HISTORY_MESSAGES = 50;
|
|
4633
4773
|
var DEFAULT_MAX_TRANSCRIPT_CHARS = 1e5;
|
|
4634
4774
|
var MAX_TOOL_OUTPUT_PREVIEW = 200;
|
|
@@ -4743,7 +4883,7 @@ var GoogleADKAdapter = class extends SimpleAdapter {
|
|
|
4743
4883
|
agent: this.buildAgent(sdk, tools),
|
|
4744
4884
|
appName: APP_NAME
|
|
4745
4885
|
});
|
|
4746
|
-
const sessionId = (0,
|
|
4886
|
+
const sessionId = (0, import_node_crypto3.randomUUID)();
|
|
4747
4887
|
this.roomSessions.set(context.roomId, sessionId);
|
|
4748
4888
|
await runner.sessionService.createSession({
|
|
4749
4889
|
appName: APP_NAME,
|
|
@@ -4802,7 +4942,7 @@ var GoogleADKAdapter = class extends SimpleAdapter {
|
|
|
4802
4942
|
}
|
|
4803
4943
|
buildAgent(sdk, tools) {
|
|
4804
4944
|
return sdk.createAgent({
|
|
4805
|
-
name: this.agentName || "
|
|
4945
|
+
name: this.agentName || "band_agent",
|
|
4806
4946
|
model: this.model,
|
|
4807
4947
|
instruction: this.systemPrompt,
|
|
4808
4948
|
tools: this.buildTools(sdk, tools)
|
|
@@ -5295,7 +5435,7 @@ function stringifyJsonWithFallback(value, logger, context) {
|
|
|
5295
5435
|
}
|
|
5296
5436
|
|
|
5297
5437
|
// src/adapters/a2a/A2AAdapter.ts
|
|
5298
|
-
var
|
|
5438
|
+
var import_node_crypto4 = require("crypto");
|
|
5299
5439
|
init_errors();
|
|
5300
5440
|
|
|
5301
5441
|
// src/adapters/a2a/types.ts
|
|
@@ -5554,7 +5694,7 @@ var A2AAdapter = class extends SimpleAdapter {
|
|
|
5554
5694
|
return {
|
|
5555
5695
|
message: {
|
|
5556
5696
|
kind: "message",
|
|
5557
|
-
messageId: (0,
|
|
5697
|
+
messageId: (0, import_node_crypto4.randomUUID)(),
|
|
5558
5698
|
role: "user",
|
|
5559
5699
|
parts: [{ kind: "text", text: message.content }],
|
|
5560
5700
|
...contextId ? { contextId } : {},
|
|
@@ -5848,7 +5988,7 @@ function createAuthFetch(authHeaders) {
|
|
|
5848
5988
|
}
|
|
5849
5989
|
|
|
5850
5990
|
// src/adapters/a2a-gateway/A2AGatewayAdapter.ts
|
|
5851
|
-
var
|
|
5991
|
+
var import_node_crypto7 = require("crypto");
|
|
5852
5992
|
init_errors();
|
|
5853
5993
|
|
|
5854
5994
|
// src/adapters/a2a-gateway/history.ts
|
|
@@ -5887,10 +6027,10 @@ var GatewayHistoryConverter = class {
|
|
|
5887
6027
|
};
|
|
5888
6028
|
|
|
5889
6029
|
// src/adapters/a2a-gateway/server.ts
|
|
5890
|
-
var
|
|
6030
|
+
var import_node_crypto6 = require("crypto");
|
|
5891
6031
|
|
|
5892
6032
|
// src/adapters/a2a-gateway/statusEvent.ts
|
|
5893
|
-
var
|
|
6033
|
+
var import_node_crypto5 = require("crypto");
|
|
5894
6034
|
function buildStatusEvent(input) {
|
|
5895
6035
|
return {
|
|
5896
6036
|
kind: "status-update",
|
|
@@ -5902,7 +6042,7 @@ function buildStatusEvent(input) {
|
|
|
5902
6042
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5903
6043
|
message: {
|
|
5904
6044
|
kind: "message",
|
|
5905
|
-
messageId: (0,
|
|
6045
|
+
messageId: (0, import_node_crypto5.randomUUID)(),
|
|
5906
6046
|
role: "agent",
|
|
5907
6047
|
taskId: input.taskId,
|
|
5908
6048
|
contextId: input.contextId,
|
|
@@ -5929,8 +6069,8 @@ var GatewayPeerExecutor = class {
|
|
|
5929
6069
|
this.onCancel = options.onCancel;
|
|
5930
6070
|
}
|
|
5931
6071
|
async execute(requestContext, eventBus) {
|
|
5932
|
-
const taskId = asNonEmptyString2(requestContext.taskId) ?? (0,
|
|
5933
|
-
const contextId = asNonEmptyString2(requestContext.contextId) ?? (0,
|
|
6072
|
+
const taskId = asNonEmptyString2(requestContext.taskId) ?? (0, import_node_crypto6.randomUUID)();
|
|
6073
|
+
const contextId = asNonEmptyString2(requestContext.contextId) ?? (0, import_node_crypto6.randomUUID)();
|
|
5934
6074
|
const message = asA2AMessage(requestContext.userMessage, contextId, taskId);
|
|
5935
6075
|
try {
|
|
5936
6076
|
for await (const event of this.onRequest({
|
|
@@ -5970,7 +6110,7 @@ var GatewayPeerExecutor = class {
|
|
|
5970
6110
|
eventBus.publish(
|
|
5971
6111
|
buildStatusEvent({
|
|
5972
6112
|
taskId,
|
|
5973
|
-
contextId: (0,
|
|
6113
|
+
contextId: (0, import_node_crypto6.randomUUID)(),
|
|
5974
6114
|
state: "canceled",
|
|
5975
6115
|
final: true,
|
|
5976
6116
|
text: "Task canceled."
|
|
@@ -6165,7 +6305,7 @@ function buildAgentCard(peer, gatewayUrl) {
|
|
|
6165
6305
|
id: "default",
|
|
6166
6306
|
name: peer.name,
|
|
6167
6307
|
description: peer.description,
|
|
6168
|
-
tags: ["
|
|
6308
|
+
tags: ["band", "gateway"]
|
|
6169
6309
|
}
|
|
6170
6310
|
],
|
|
6171
6311
|
defaultInputModes: ["text/plain"],
|
|
@@ -6176,7 +6316,7 @@ function asA2AMessage(value, fallbackContextId, fallbackTaskId) {
|
|
|
6176
6316
|
if (!value || typeof value !== "object") {
|
|
6177
6317
|
return {
|
|
6178
6318
|
kind: "message",
|
|
6179
|
-
messageId: (0,
|
|
6319
|
+
messageId: (0, import_node_crypto6.randomUUID)(),
|
|
6180
6320
|
role: "user",
|
|
6181
6321
|
contextId: fallbackContextId,
|
|
6182
6322
|
taskId: fallbackTaskId,
|
|
@@ -6201,7 +6341,7 @@ function asA2AMessage(value, fallbackContextId, fallbackTaskId) {
|
|
|
6201
6341
|
}
|
|
6202
6342
|
return {
|
|
6203
6343
|
kind: "message",
|
|
6204
|
-
messageId: asNonEmptyString2(raw.messageId) ?? (0,
|
|
6344
|
+
messageId: asNonEmptyString2(raw.messageId) ?? (0, import_node_crypto6.randomUUID)(),
|
|
6205
6345
|
role: asNonEmptyString2(raw.role) === "agent" ? "agent" : "user",
|
|
6206
6346
|
contextId: asNonEmptyString2(raw.contextId) ?? fallbackContextId,
|
|
6207
6347
|
taskId: asNonEmptyString2(raw.taskId) ?? fallbackTaskId,
|
|
@@ -6336,7 +6476,7 @@ function safeHeaderEquals(left, right) {
|
|
|
6336
6476
|
if (leftBuffer.length !== rightBuffer.length) {
|
|
6337
6477
|
return false;
|
|
6338
6478
|
}
|
|
6339
|
-
return (0,
|
|
6479
|
+
return (0, import_node_crypto6.timingSafeEqual)(leftBuffer, rightBuffer);
|
|
6340
6480
|
}
|
|
6341
6481
|
|
|
6342
6482
|
// src/adapters/a2a-gateway/A2AGatewayAdapter.ts
|
|
@@ -6347,7 +6487,7 @@ var DEFAULT_RESPONSE_TIMEOUT_MS = 12e4;
|
|
|
6347
6487
|
var DEFAULT_PEER_PAGE_SIZE = 100;
|
|
6348
6488
|
var DEFAULT_MAX_PEER_PAGES = 25;
|
|
6349
6489
|
var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
6350
|
-
|
|
6490
|
+
bandRest;
|
|
6351
6491
|
gatewayUrl;
|
|
6352
6492
|
host;
|
|
6353
6493
|
port;
|
|
@@ -6368,7 +6508,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6368
6508
|
super({
|
|
6369
6509
|
historyConverter: new GatewayHistoryConverter()
|
|
6370
6510
|
});
|
|
6371
|
-
this.
|
|
6511
|
+
this.bandRest = options.bandRest;
|
|
6372
6512
|
this.gatewayUrl = options.gatewayUrl ?? DEFAULT_GATEWAY_URL;
|
|
6373
6513
|
this.host = options.host ?? DEFAULT_HOST;
|
|
6374
6514
|
this.port = options.port ?? DEFAULT_PORT;
|
|
@@ -6448,13 +6588,13 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6448
6588
|
async refreshPeers() {
|
|
6449
6589
|
this.peersBySlug.clear();
|
|
6450
6590
|
this.peersById.clear();
|
|
6451
|
-
if (!this.
|
|
6591
|
+
if (!this.bandRest.listPeers) {
|
|
6452
6592
|
throw new UnsupportedFeatureError(
|
|
6453
6593
|
"Peer listing is not available in current REST adapter"
|
|
6454
6594
|
);
|
|
6455
6595
|
}
|
|
6456
6596
|
for (let page = 1; page <= this.maxPeerPages; page += 1) {
|
|
6457
|
-
const response = await this.
|
|
6597
|
+
const response = await this.bandRest.listPeers({
|
|
6458
6598
|
page,
|
|
6459
6599
|
pageSize: this.peerPageSize,
|
|
6460
6600
|
notInChat: ""
|
|
@@ -6524,7 +6664,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6524
6664
|
try {
|
|
6525
6665
|
await this.emitContextEvent(roomId, contextId);
|
|
6526
6666
|
const content = extractMessageText2(request.message) ?? "";
|
|
6527
|
-
await this.
|
|
6667
|
+
await this.bandRest.createChatMessage(roomId, {
|
|
6528
6668
|
content: buildMentionedContent(peer.name, content),
|
|
6529
6669
|
mentions: buildMentions(peer),
|
|
6530
6670
|
metadata: {
|
|
@@ -6555,7 +6695,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6555
6695
|
contextId: pending.contextId,
|
|
6556
6696
|
state: "failed",
|
|
6557
6697
|
final: true,
|
|
6558
|
-
text: "Timed out waiting for a
|
|
6698
|
+
text: "Timed out waiting for a Band peer response."
|
|
6559
6699
|
});
|
|
6560
6700
|
return;
|
|
6561
6701
|
}
|
|
@@ -6642,7 +6782,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6642
6782
|
if (existingRoom) {
|
|
6643
6783
|
const participants = this.roomParticipants.get(existingRoom) ?? /* @__PURE__ */ new Set();
|
|
6644
6784
|
if (!participants.has(targetPeerId)) {
|
|
6645
|
-
await this.
|
|
6785
|
+
await this.bandRest.addChatParticipant(existingRoom, {
|
|
6646
6786
|
participantId: targetPeerId,
|
|
6647
6787
|
role: "member"
|
|
6648
6788
|
});
|
|
@@ -6651,12 +6791,12 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6651
6791
|
}
|
|
6652
6792
|
return [existingRoom, contextId];
|
|
6653
6793
|
}
|
|
6654
|
-
const normalizedContextId = contextId && contextId.length > 0 ? contextId : (0,
|
|
6655
|
-
const created = await this.
|
|
6794
|
+
const normalizedContextId = contextId && contextId.length > 0 ? contextId : (0, import_node_crypto7.randomUUID)();
|
|
6795
|
+
const created = await this.bandRest.createChat(
|
|
6656
6796
|
`a2a:gateway:${normalizedContextId}`
|
|
6657
6797
|
);
|
|
6658
6798
|
const roomId = created.id;
|
|
6659
|
-
await this.
|
|
6799
|
+
await this.bandRest.addChatParticipant(roomId, {
|
|
6660
6800
|
participantId: targetPeerId,
|
|
6661
6801
|
role: "member"
|
|
6662
6802
|
});
|
|
@@ -6665,7 +6805,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
6665
6805
|
return [roomId, normalizedContextId];
|
|
6666
6806
|
}
|
|
6667
6807
|
async emitContextEvent(roomId, contextId) {
|
|
6668
|
-
await this.
|
|
6808
|
+
await this.bandRest.createChatEvent(roomId, {
|
|
6669
6809
|
content: "A2A gateway context",
|
|
6670
6810
|
messageType: "task",
|
|
6671
6811
|
metadata: {
|
|
@@ -6843,10 +6983,10 @@ function toStatusUpdateEvent(message, taskId, contextId) {
|
|
|
6843
6983
|
final,
|
|
6844
6984
|
text: message.content,
|
|
6845
6985
|
metadata: {
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6986
|
+
band_message_id: message.id,
|
|
6987
|
+
band_message_type: message.messageType,
|
|
6988
|
+
band_sender_id: message.senderId,
|
|
6989
|
+
band_room_id: message.roomId
|
|
6850
6990
|
}
|
|
6851
6991
|
});
|
|
6852
6992
|
}
|
|
@@ -7016,8 +7156,8 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
7016
7156
|
message: userMessage,
|
|
7017
7157
|
moderation: "none",
|
|
7018
7158
|
metadata: {
|
|
7019
|
-
|
|
7020
|
-
|
|
7159
|
+
band_source: "band-sdk-typescript",
|
|
7160
|
+
band_room_id: context.roomId
|
|
7021
7161
|
}
|
|
7022
7162
|
},
|
|
7023
7163
|
this.requestOptions()
|
|
@@ -7092,9 +7232,9 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
7092
7232
|
{
|
|
7093
7233
|
agentId: this.agentId,
|
|
7094
7234
|
customerId,
|
|
7095
|
-
title: `
|
|
7235
|
+
title: `Band Room ${roomId.slice(0, 8)}`,
|
|
7096
7236
|
metadata: {
|
|
7097
|
-
|
|
7237
|
+
band_room_id: roomId
|
|
7098
7238
|
}
|
|
7099
7239
|
},
|
|
7100
7240
|
this.requestOptions()
|
|
@@ -7107,7 +7247,7 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
7107
7247
|
source: "system",
|
|
7108
7248
|
message: this.systemPrompt,
|
|
7109
7249
|
metadata: {
|
|
7110
|
-
|
|
7250
|
+
band_system_prompt: true
|
|
7111
7251
|
}
|
|
7112
7252
|
},
|
|
7113
7253
|
this.requestOptions()
|
|
@@ -7161,7 +7301,7 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
7161
7301
|
{
|
|
7162
7302
|
name: customerName,
|
|
7163
7303
|
metadata: {
|
|
7164
|
-
|
|
7304
|
+
band_room_id: roomId
|
|
7165
7305
|
}
|
|
7166
7306
|
},
|
|
7167
7307
|
this.requestOptions()
|
|
@@ -7711,7 +7851,7 @@ var LettaAdapter = class extends SimpleAdapter {
|
|
|
7711
7851
|
const agent = await this.raceTimeout(
|
|
7712
7852
|
(s) => client.agents.create(
|
|
7713
7853
|
{
|
|
7714
|
-
name: `
|
|
7854
|
+
name: `band-room-${roomId.slice(0, 16)}`,
|
|
7715
7855
|
model: this.model,
|
|
7716
7856
|
...this.embedding ? { embedding: this.embedding } : {},
|
|
7717
7857
|
system: this.systemPrompt || void 0,
|
|
@@ -8128,7 +8268,8 @@ init_registrations();
|
|
|
8128
8268
|
// src/mcp/stdio.ts
|
|
8129
8269
|
init_registrations();
|
|
8130
8270
|
init_zod();
|
|
8131
|
-
|
|
8271
|
+
init_schemas();
|
|
8272
|
+
var BandMcpStdioServer = class {
|
|
8132
8273
|
options;
|
|
8133
8274
|
registrations;
|
|
8134
8275
|
mcpServer = null;
|
|
@@ -8157,7 +8298,7 @@ var ThenvoiMcpStdioServer = class {
|
|
|
8157
8298
|
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
8158
8299
|
const { z: z4 } = await import("zod");
|
|
8159
8300
|
const mcpServer = new McpServer({
|
|
8160
|
-
name: this.options.name ??
|
|
8301
|
+
name: this.options.name ?? MCP_SERVER_NAME,
|
|
8161
8302
|
version: "1.0.0"
|
|
8162
8303
|
});
|
|
8163
8304
|
registerTools3(mcpServer, z4, this.registrations);
|
|
@@ -8188,15 +8329,15 @@ function registerTools3(mcpServer, z4, registrations) {
|
|
|
8188
8329
|
}
|
|
8189
8330
|
|
|
8190
8331
|
// src/mcp/backends.ts
|
|
8191
|
-
async function
|
|
8332
|
+
async function createBandMcpBackend(options) {
|
|
8192
8333
|
const registrationOptions = {
|
|
8193
8334
|
enableMemoryTools: options.enableMemoryTools,
|
|
8194
8335
|
enableContactTools: true,
|
|
8195
8336
|
additionalTools: options.additionalTools
|
|
8196
8337
|
};
|
|
8197
8338
|
if (options.kind === "sdk") {
|
|
8198
|
-
const {
|
|
8199
|
-
const server2 =
|
|
8339
|
+
const { createBandSdkMcpServer: createBandSdkMcpServer2 } = await Promise.resolve().then(() => (init_sdk(), sdk_exports));
|
|
8340
|
+
const server2 = createBandSdkMcpServer2({
|
|
8200
8341
|
getToolsForRoom: options.getToolsForRoom,
|
|
8201
8342
|
multiRoom: options.multiRoom,
|
|
8202
8343
|
enableMemoryTools: options.enableMemoryTools,
|
|
@@ -8213,7 +8354,7 @@ async function createThenvoiMcpBackend(options) {
|
|
|
8213
8354
|
const registrations = options.multiRoom === false ? buildSingleContextRegistrations(resolvedTools, registrationOptions) : buildRoomScopedRegistrations(resolvedTools, registrationOptions);
|
|
8214
8355
|
const allowedTools = mcpToolNames(new Set(registrations.map((registration) => registration.name)));
|
|
8215
8356
|
if (options.kind === "stdio") {
|
|
8216
|
-
const server2 = new
|
|
8357
|
+
const server2 = new BandMcpStdioServer({
|
|
8217
8358
|
tools: resolvedTools,
|
|
8218
8359
|
enableMemoryTools: options.enableMemoryTools,
|
|
8219
8360
|
enableContactTools: true,
|
|
@@ -8229,34 +8370,39 @@ async function createThenvoiMcpBackend(options) {
|
|
|
8229
8370
|
}
|
|
8230
8371
|
};
|
|
8231
8372
|
}
|
|
8373
|
+
const authToken = generateAuthToken();
|
|
8232
8374
|
if (options.kind === "sse") {
|
|
8233
|
-
const server2 = new
|
|
8375
|
+
const server2 = new BandMcpSseServer({
|
|
8234
8376
|
tools: resolvedTools,
|
|
8235
8377
|
enableMemoryTools: options.enableMemoryTools,
|
|
8236
8378
|
enableContactTools: true,
|
|
8237
|
-
additionalTools: options.additionalTools
|
|
8379
|
+
additionalTools: options.additionalTools,
|
|
8380
|
+
authToken
|
|
8238
8381
|
});
|
|
8239
8382
|
await server2.start();
|
|
8240
8383
|
return {
|
|
8241
8384
|
kind: "sse",
|
|
8242
8385
|
server: server2,
|
|
8243
8386
|
allowedTools,
|
|
8387
|
+
authToken,
|
|
8244
8388
|
stop: async () => {
|
|
8245
8389
|
await server2.stop();
|
|
8246
8390
|
}
|
|
8247
8391
|
};
|
|
8248
8392
|
}
|
|
8249
|
-
const server = new
|
|
8393
|
+
const server = new BandMcpServer({
|
|
8250
8394
|
tools: resolvedTools,
|
|
8251
8395
|
enableMemoryTools: options.enableMemoryTools,
|
|
8252
8396
|
enableContactTools: true,
|
|
8253
|
-
additionalTools: options.additionalTools
|
|
8397
|
+
additionalTools: options.additionalTools,
|
|
8398
|
+
authToken
|
|
8254
8399
|
});
|
|
8255
8400
|
await server.start();
|
|
8256
8401
|
return {
|
|
8257
8402
|
kind: "http",
|
|
8258
8403
|
server,
|
|
8259
8404
|
allowedTools,
|
|
8405
|
+
authToken,
|
|
8260
8406
|
stop: async () => {
|
|
8261
8407
|
await server.stop();
|
|
8262
8408
|
}
|
|
@@ -8265,6 +8411,7 @@ async function createThenvoiMcpBackend(options) {
|
|
|
8265
8411
|
|
|
8266
8412
|
// src/adapters/opencode/OpencodeAdapter.ts
|
|
8267
8413
|
init_registrations();
|
|
8414
|
+
init_schemas();
|
|
8268
8415
|
|
|
8269
8416
|
// src/converters/opencode.ts
|
|
8270
8417
|
var OpencodeHistoryConverter = class {
|
|
@@ -8398,7 +8545,7 @@ var SdkOpencodeClientBase = class {
|
|
|
8398
8545
|
const result = await runtime.client.mcp.add({
|
|
8399
8546
|
...this.scope(),
|
|
8400
8547
|
name: input.name,
|
|
8401
|
-
config: { type: "remote", url: input.url }
|
|
8548
|
+
config: { type: "remote", url: input.url, headers: input.headers }
|
|
8402
8549
|
});
|
|
8403
8550
|
return expectRecord(result);
|
|
8404
8551
|
}
|
|
@@ -8589,8 +8736,8 @@ async function readResponseBody(response) {
|
|
|
8589
8736
|
|
|
8590
8737
|
// src/adapters/opencode/OpencodeAdapter.ts
|
|
8591
8738
|
var OPENCODE_SYSTEM_NOTE = [
|
|
8592
|
-
"Responses are relayed back into the
|
|
8593
|
-
"Use the
|
|
8739
|
+
"Responses are relayed back into the Band room by the adapter.",
|
|
8740
|
+
"Use the band_ prefixed tools (for example band_send_message) for Band platform actions when available.",
|
|
8594
8741
|
"When you need approval or clarification, ask clearly and wait for the user's next room message."
|
|
8595
8742
|
].join("\n");
|
|
8596
8743
|
function createDeferred() {
|
|
@@ -8621,8 +8768,8 @@ function withDefaults(config) {
|
|
|
8621
8768
|
approvalTimeoutReply: "reject",
|
|
8622
8769
|
questionMode: "manual",
|
|
8623
8770
|
questionWaitTimeoutMs: 3e5,
|
|
8624
|
-
sessionTitlePrefix: "
|
|
8625
|
-
mcpServerName:
|
|
8771
|
+
sessionTitlePrefix: "Band",
|
|
8772
|
+
mcpServerName: MCP_SERVER_NAME,
|
|
8626
8773
|
...config
|
|
8627
8774
|
};
|
|
8628
8775
|
}
|
|
@@ -8678,7 +8825,7 @@ var OpencodeAdapter = class extends SimpleAdapter {
|
|
|
8678
8825
|
directory: config.directory || void 0,
|
|
8679
8826
|
workspace: config.workspace || void 0
|
|
8680
8827
|
}));
|
|
8681
|
-
this.mcpBackendFactory = options.mcpBackendFactory ??
|
|
8828
|
+
this.mcpBackendFactory = options.mcpBackendFactory ?? createBandMcpBackend;
|
|
8682
8829
|
this.logger = options.logger ?? new NoopLogger();
|
|
8683
8830
|
}
|
|
8684
8831
|
async onStarted(agentName, agentDescription) {
|
|
@@ -8832,7 +8979,8 @@ ${OPENCODE_SYSTEM_NOTE}`.trim();
|
|
|
8832
8979
|
}
|
|
8833
8980
|
await client.registerMcpServer({
|
|
8834
8981
|
name: this.config.mcpServerName,
|
|
8835
|
-
url: server.url
|
|
8982
|
+
url: server.url,
|
|
8983
|
+
headers: backend.authToken ? { Authorization: `Bearer ${backend.authToken}` } : void 0
|
|
8836
8984
|
});
|
|
8837
8985
|
} catch (error) {
|
|
8838
8986
|
this.logger.warn("Failed to register OpenCode MCP backend", { error });
|
|
@@ -9470,7 +9618,7 @@ init_registrations();
|
|
|
9470
9618
|
init_zod();
|
|
9471
9619
|
var import_zod8 = require("zod");
|
|
9472
9620
|
var DEFAULT_MODEL2 = "claude-sonnet-4-6";
|
|
9473
|
-
var
|
|
9621
|
+
var bandMcpBridgeFactory = new LazyAsyncValue({
|
|
9474
9622
|
load: async () => {
|
|
9475
9623
|
const module2 = await import("@anthropic-ai/claude-agent-sdk").catch((error) => {
|
|
9476
9624
|
throw new UnsupportedFeatureError(
|
|
@@ -9508,7 +9656,7 @@ var thenvoiMcpBridgeFactory = new LazyAsyncValue({
|
|
|
9508
9656
|
});
|
|
9509
9657
|
return {
|
|
9510
9658
|
serverConfig: createSdkMcpServer2({
|
|
9511
|
-
name:
|
|
9659
|
+
name: MCP_SERVER_NAME,
|
|
9512
9660
|
tools: toolDefinitions
|
|
9513
9661
|
}),
|
|
9514
9662
|
allowedTools: mcpToolNames(new Set(registrations.map((registration) => registration.name)))
|
|
@@ -9559,8 +9707,8 @@ var ClaudeSDKAdapter = class extends SimpleAdapter {
|
|
|
9559
9707
|
capabilities: { memory: this.enableMemoryTools }
|
|
9560
9708
|
});
|
|
9561
9709
|
if (this.enableMcpTools) {
|
|
9562
|
-
const
|
|
9563
|
-
this.mcpBridge =
|
|
9710
|
+
const createBandMcpBridge = await bandMcpBridgeFactory.get();
|
|
9711
|
+
this.mcpBridge = createBandMcpBridge({
|
|
9564
9712
|
enableMemoryTools: this.enableMemoryTools,
|
|
9565
9713
|
getToolsForRoom: (roomId) => this.roomTools.get(roomId),
|
|
9566
9714
|
additionalTools: this.additionalMcpTools.length > 0 ? this.additionalMcpTools : void 0
|
|
@@ -9608,14 +9756,14 @@ var ClaudeSDKAdapter = class extends SimpleAdapter {
|
|
|
9608
9756
|
}
|
|
9609
9757
|
if (this.mcpBridge && this.enableMcpTools) {
|
|
9610
9758
|
options.mcpServers = {
|
|
9611
|
-
|
|
9759
|
+
[MCP_SERVER_NAME]: this.mcpBridge.serverConfig
|
|
9612
9760
|
};
|
|
9613
9761
|
options.allowedTools = this.mcpBridge.allowedTools;
|
|
9614
9762
|
this.roomTools.set(context.roomId, tools);
|
|
9615
9763
|
}
|
|
9616
9764
|
const roomToolHint = this.enableMcpTools ? `
|
|
9617
9765
|
|
|
9618
|
-
[Tooling note]: For any
|
|
9766
|
+
[Tooling note]: For any mcp__band__* tool call, pass room_id="${context.roomId}".` : "";
|
|
9619
9767
|
const query = queryFn({
|
|
9620
9768
|
prompt: buildConversationPrompt({
|
|
9621
9769
|
history,
|
|
@@ -9704,6 +9852,7 @@ function extractAssistantText3(event) {
|
|
|
9704
9852
|
|
|
9705
9853
|
// src/adapters/codex/CodexAdapter.ts
|
|
9706
9854
|
init_protocols();
|
|
9855
|
+
init_schemas();
|
|
9707
9856
|
|
|
9708
9857
|
// src/adapters/codex/appServerClient.ts
|
|
9709
9858
|
var import_node_child_process2 = require("child_process");
|
|
@@ -10003,8 +10152,8 @@ var CODEX_WEB_SEARCH_MODES = ["disabled", "cached", "live"];
|
|
|
10003
10152
|
var CODEX_REASONING_SUMMARIES = ["auto", "concise", "detailed", "none"];
|
|
10004
10153
|
var CODEX_REASONING_EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
10005
10154
|
var SILENT_REPORTING_TOOLS = /* @__PURE__ */ new Set([
|
|
10006
|
-
|
|
10007
|
-
|
|
10155
|
+
SEND_MESSAGE_TOOL_NAME,
|
|
10156
|
+
SEND_EVENT_TOOL_NAME
|
|
10008
10157
|
]);
|
|
10009
10158
|
var CodexAdapter = class extends SimpleAdapter {
|
|
10010
10159
|
baseConfig;
|
|
@@ -10034,8 +10183,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
10034
10183
|
includeBaseInstructions: true,
|
|
10035
10184
|
experimentalApi: true,
|
|
10036
10185
|
fallbackSendAgentText: true,
|
|
10037
|
-
clientName: "
|
|
10038
|
-
clientTitle: "
|
|
10186
|
+
clientName: "band_codex_adapter",
|
|
10187
|
+
clientTitle: "Band Codex Adapter",
|
|
10039
10188
|
clientVersion: "0.1.0",
|
|
10040
10189
|
turnTimeoutMs: 18e4,
|
|
10041
10190
|
...options?.config
|
|
@@ -10301,8 +10450,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
10301
10450
|
await client.connect();
|
|
10302
10451
|
await client.initialize({
|
|
10303
10452
|
clientInfo: {
|
|
10304
|
-
name: this.baseConfig.clientName ?? "
|
|
10305
|
-
title: this.baseConfig.clientTitle ?? "
|
|
10453
|
+
name: this.baseConfig.clientName ?? "band_codex_adapter",
|
|
10454
|
+
title: this.baseConfig.clientTitle ?? "Band Codex Adapter",
|
|
10306
10455
|
version: this.baseConfig.clientVersion ?? "0.1.0"
|
|
10307
10456
|
},
|
|
10308
10457
|
capabilities: {
|
|
@@ -10575,7 +10724,7 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
10575
10724
|
tool_call_id: callId
|
|
10576
10725
|
}), "tool_result");
|
|
10577
10726
|
}
|
|
10578
|
-
return !isError && toolName ===
|
|
10727
|
+
return !isError && toolName === SEND_MESSAGE_TOOL_NAME;
|
|
10579
10728
|
} catch (error) {
|
|
10580
10729
|
const output = {
|
|
10581
10730
|
ok: false,
|
|
@@ -11098,6 +11247,7 @@ function parseModelListResponse(value) {
|
|
|
11098
11247
|
ACPServer,
|
|
11099
11248
|
AnthropicAdapter,
|
|
11100
11249
|
AnthropicToolCallingModel,
|
|
11250
|
+
BandACPServerAdapter,
|
|
11101
11251
|
CODEX_REASONING_EFFORTS,
|
|
11102
11252
|
CODEX_REASONING_SUMMARIES,
|
|
11103
11253
|
CODEX_WEB_SEARCH_MODES,
|
|
@@ -11121,7 +11271,6 @@ function parseModelListResponse(value) {
|
|
|
11121
11271
|
OpencodeAdapter,
|
|
11122
11272
|
ParlantAdapter,
|
|
11123
11273
|
ParlantHistoryConverter,
|
|
11124
|
-
ThenvoiACPServerAdapter,
|
|
11125
11274
|
ToolCallingAdapter,
|
|
11126
11275
|
VercelAISDKAdapter,
|
|
11127
11276
|
VercelAISDKToolCallingModel,
|