@band-ai/sdk 0.1.10 → 0.2.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/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 +250 -183
- package/dist/adapters.d.cts +21 -19
- package/dist/adapters.d.ts +21 -19
- package/dist/adapters.js +65 -44
- 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
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createBandMcpBackend
|
|
3
|
+
} from "./chunk-4IAXZBXX.js";
|
|
4
4
|
import {
|
|
5
5
|
buildRoomScopedRegistrations,
|
|
6
6
|
buildZodShape,
|
|
7
7
|
errorResult,
|
|
8
8
|
successResult
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NT7TBFX2.js";
|
|
10
10
|
import {
|
|
11
11
|
GoogleADKHistoryConverter,
|
|
12
12
|
LazyAsyncValue,
|
|
13
13
|
OpencodeHistoryConverter,
|
|
14
14
|
extractClaudeSessionId,
|
|
15
15
|
findLatestTaskMetadata
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TLBCKDQO.js";
|
|
17
17
|
import {
|
|
18
18
|
SimpleAdapter
|
|
19
19
|
} from "./chunk-AVVDPXP4.js";
|
|
20
20
|
import {
|
|
21
21
|
formatHistoryForLlm,
|
|
22
22
|
formatMessageForLlm
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LBWKISBS.js";
|
|
24
24
|
import {
|
|
25
25
|
renderSystemPrompt
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WLCM2OXG.js";
|
|
27
27
|
import {
|
|
28
|
+
MCP_SERVER_NAME,
|
|
29
|
+
SEND_EVENT_TOOL_NAME,
|
|
30
|
+
SEND_MESSAGE_TOOL_NAME,
|
|
28
31
|
mcpToolNames
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-RV76SKFT.js";
|
|
30
33
|
import {
|
|
31
34
|
asErrorMessage,
|
|
32
35
|
asNonEmptyString,
|
|
@@ -46,7 +49,7 @@ import {
|
|
|
46
49
|
RuntimeStateError,
|
|
47
50
|
UnsupportedFeatureError,
|
|
48
51
|
ValidationError
|
|
49
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-JY75VSQK.js";
|
|
50
53
|
|
|
51
54
|
// src/adapters/GenericAdapter.ts
|
|
52
55
|
var GenericAdapter = class extends SimpleAdapter {
|
|
@@ -477,8 +480,8 @@ var CODEX_WEB_SEARCH_MODES = ["disabled", "cached", "live"];
|
|
|
477
480
|
var CODEX_REASONING_SUMMARIES = ["auto", "concise", "detailed", "none"];
|
|
478
481
|
var CODEX_REASONING_EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
479
482
|
var SILENT_REPORTING_TOOLS = /* @__PURE__ */ new Set([
|
|
480
|
-
|
|
481
|
-
|
|
483
|
+
SEND_MESSAGE_TOOL_NAME,
|
|
484
|
+
SEND_EVENT_TOOL_NAME
|
|
482
485
|
]);
|
|
483
486
|
var CodexAdapter = class extends SimpleAdapter {
|
|
484
487
|
baseConfig;
|
|
@@ -508,8 +511,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
508
511
|
includeBaseInstructions: true,
|
|
509
512
|
experimentalApi: true,
|
|
510
513
|
fallbackSendAgentText: true,
|
|
511
|
-
clientName: "
|
|
512
|
-
clientTitle: "
|
|
514
|
+
clientName: "band_codex_adapter",
|
|
515
|
+
clientTitle: "Band Codex Adapter",
|
|
513
516
|
clientVersion: "0.1.0",
|
|
514
517
|
turnTimeoutMs: 18e4,
|
|
515
518
|
...options?.config
|
|
@@ -775,8 +778,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
775
778
|
await client.connect();
|
|
776
779
|
await client.initialize({
|
|
777
780
|
clientInfo: {
|
|
778
|
-
name: this.baseConfig.clientName ?? "
|
|
779
|
-
title: this.baseConfig.clientTitle ?? "
|
|
781
|
+
name: this.baseConfig.clientName ?? "band_codex_adapter",
|
|
782
|
+
title: this.baseConfig.clientTitle ?? "Band Codex Adapter",
|
|
780
783
|
version: this.baseConfig.clientVersion ?? "0.1.0"
|
|
781
784
|
},
|
|
782
785
|
capabilities: {
|
|
@@ -1049,7 +1052,7 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
1049
1052
|
tool_call_id: callId
|
|
1050
1053
|
}), "tool_result");
|
|
1051
1054
|
}
|
|
1052
|
-
return !isError && toolName ===
|
|
1055
|
+
return !isError && toolName === SEND_MESSAGE_TOOL_NAME;
|
|
1053
1056
|
} catch (error) {
|
|
1054
1057
|
const output = {
|
|
1055
1058
|
ok: false,
|
|
@@ -2531,7 +2534,7 @@ var GeminiAdapter = class extends ToolCallingAdapter {
|
|
|
2531
2534
|
|
|
2532
2535
|
// src/adapters/google-adk/GoogleADKAdapter.ts
|
|
2533
2536
|
import { randomUUID } from "crypto";
|
|
2534
|
-
var APP_NAME = "
|
|
2537
|
+
var APP_NAME = "band";
|
|
2535
2538
|
var DEFAULT_MAX_HISTORY_MESSAGES = 50;
|
|
2536
2539
|
var DEFAULT_MAX_TRANSCRIPT_CHARS = 1e5;
|
|
2537
2540
|
var MAX_TOOL_OUTPUT_PREVIEW = 200;
|
|
@@ -2705,7 +2708,7 @@ var GoogleADKAdapter = class extends SimpleAdapter {
|
|
|
2705
2708
|
}
|
|
2706
2709
|
buildAgent(sdk, tools) {
|
|
2707
2710
|
return sdk.createAgent({
|
|
2708
|
-
name: this.agentName || "
|
|
2711
|
+
name: this.agentName || "band_agent",
|
|
2709
2712
|
model: this.model,
|
|
2710
2713
|
instruction: this.systemPrompt,
|
|
2711
2714
|
tools: this.buildTools(sdk, tools)
|
|
@@ -3503,7 +3506,7 @@ var LettaAdapter = class extends SimpleAdapter {
|
|
|
3503
3506
|
const agent = await this.raceTimeout(
|
|
3504
3507
|
(s) => client.agents.create(
|
|
3505
3508
|
{
|
|
3506
|
-
name: `
|
|
3509
|
+
name: `band-room-${roomId.slice(0, 16)}`,
|
|
3507
3510
|
model: this.model,
|
|
3508
3511
|
...this.embedding ? { embedding: this.embedding } : {},
|
|
3509
3512
|
system: this.systemPrompt || void 0,
|
|
@@ -4003,7 +4006,7 @@ var SdkOpencodeClientBase = class {
|
|
|
4003
4006
|
const result = await runtime.client.mcp.add({
|
|
4004
4007
|
...this.scope(),
|
|
4005
4008
|
name: input.name,
|
|
4006
|
-
config: { type: "remote", url: input.url }
|
|
4009
|
+
config: { type: "remote", url: input.url, headers: input.headers }
|
|
4007
4010
|
});
|
|
4008
4011
|
return expectRecord(result);
|
|
4009
4012
|
}
|
|
@@ -4194,8 +4197,8 @@ async function readResponseBody(response) {
|
|
|
4194
4197
|
|
|
4195
4198
|
// src/adapters/opencode/OpencodeAdapter.ts
|
|
4196
4199
|
var OPENCODE_SYSTEM_NOTE = [
|
|
4197
|
-
"Responses are relayed back into the
|
|
4198
|
-
"Use the
|
|
4200
|
+
"Responses are relayed back into the Band room by the adapter.",
|
|
4201
|
+
"Use the band_ prefixed tools (for example band_send_message) for Band platform actions when available.",
|
|
4199
4202
|
"When you need approval or clarification, ask clearly and wait for the user's next room message."
|
|
4200
4203
|
].join("\n");
|
|
4201
4204
|
function createDeferred() {
|
|
@@ -4226,8 +4229,8 @@ function withDefaults(config) {
|
|
|
4226
4229
|
approvalTimeoutReply: "reject",
|
|
4227
4230
|
questionMode: "manual",
|
|
4228
4231
|
questionWaitTimeoutMs: 3e5,
|
|
4229
|
-
sessionTitlePrefix: "
|
|
4230
|
-
mcpServerName:
|
|
4232
|
+
sessionTitlePrefix: "Band",
|
|
4233
|
+
mcpServerName: MCP_SERVER_NAME,
|
|
4231
4234
|
...config
|
|
4232
4235
|
};
|
|
4233
4236
|
}
|
|
@@ -4283,7 +4286,7 @@ var OpencodeAdapter = class extends SimpleAdapter {
|
|
|
4283
4286
|
directory: config.directory || void 0,
|
|
4284
4287
|
workspace: config.workspace || void 0
|
|
4285
4288
|
}));
|
|
4286
|
-
this.mcpBackendFactory = options.mcpBackendFactory ??
|
|
4289
|
+
this.mcpBackendFactory = options.mcpBackendFactory ?? createBandMcpBackend;
|
|
4287
4290
|
this.logger = options.logger ?? new NoopLogger();
|
|
4288
4291
|
}
|
|
4289
4292
|
async onStarted(agentName, agentDescription) {
|
|
@@ -4437,7 +4440,8 @@ ${OPENCODE_SYSTEM_NOTE}`.trim();
|
|
|
4437
4440
|
}
|
|
4438
4441
|
await client.registerMcpServer({
|
|
4439
4442
|
name: this.config.mcpServerName,
|
|
4440
|
-
url: server.url
|
|
4443
|
+
url: server.url,
|
|
4444
|
+
headers: backend.authToken ? { Authorization: `Bearer ${backend.authToken}` } : void 0
|
|
4441
4445
|
});
|
|
4442
4446
|
} catch (error) {
|
|
4443
4447
|
this.logger.warn("Failed to register OpenCode MCP backend", { error });
|
|
@@ -5059,7 +5063,7 @@ function formatHistoryLine(entry) {
|
|
|
5059
5063
|
// src/adapters/claude-sdk/ClaudeSDKAdapter.ts
|
|
5060
5064
|
import { z as z2 } from "zod";
|
|
5061
5065
|
var DEFAULT_MODEL2 = "claude-sonnet-4-6";
|
|
5062
|
-
var
|
|
5066
|
+
var bandMcpBridgeFactory = new LazyAsyncValue({
|
|
5063
5067
|
load: async () => {
|
|
5064
5068
|
const module = await import("@anthropic-ai/claude-agent-sdk").catch((error) => {
|
|
5065
5069
|
throw new UnsupportedFeatureError(
|
|
@@ -5097,7 +5101,7 @@ var thenvoiMcpBridgeFactory = new LazyAsyncValue({
|
|
|
5097
5101
|
});
|
|
5098
5102
|
return {
|
|
5099
5103
|
serverConfig: createSdkMcpServer({
|
|
5100
|
-
name:
|
|
5104
|
+
name: MCP_SERVER_NAME,
|
|
5101
5105
|
tools: toolDefinitions
|
|
5102
5106
|
}),
|
|
5103
5107
|
allowedTools: mcpToolNames(new Set(registrations.map((registration) => registration.name)))
|
|
@@ -5148,8 +5152,8 @@ var ClaudeSDKAdapter = class extends SimpleAdapter {
|
|
|
5148
5152
|
capabilities: { memory: this.enableMemoryTools }
|
|
5149
5153
|
});
|
|
5150
5154
|
if (this.enableMcpTools) {
|
|
5151
|
-
const
|
|
5152
|
-
this.mcpBridge =
|
|
5155
|
+
const createBandMcpBridge = await bandMcpBridgeFactory.get();
|
|
5156
|
+
this.mcpBridge = createBandMcpBridge({
|
|
5153
5157
|
enableMemoryTools: this.enableMemoryTools,
|
|
5154
5158
|
getToolsForRoom: (roomId) => this.roomTools.get(roomId),
|
|
5155
5159
|
additionalTools: this.additionalMcpTools.length > 0 ? this.additionalMcpTools : void 0
|
|
@@ -5197,14 +5201,14 @@ var ClaudeSDKAdapter = class extends SimpleAdapter {
|
|
|
5197
5201
|
}
|
|
5198
5202
|
if (this.mcpBridge && this.enableMcpTools) {
|
|
5199
5203
|
options.mcpServers = {
|
|
5200
|
-
|
|
5204
|
+
[MCP_SERVER_NAME]: this.mcpBridge.serverConfig
|
|
5201
5205
|
};
|
|
5202
5206
|
options.allowedTools = this.mcpBridge.allowedTools;
|
|
5203
5207
|
this.roomTools.set(context.roomId, tools);
|
|
5204
5208
|
}
|
|
5205
5209
|
const roomToolHint = this.enableMcpTools ? `
|
|
5206
5210
|
|
|
5207
|
-
[Tooling note]: For any
|
|
5211
|
+
[Tooling note]: For any mcp__band__* tool call, pass room_id="${context.roomId}".` : "";
|
|
5208
5212
|
const query = queryFn({
|
|
5209
5213
|
prompt: buildConversationPrompt({
|
|
5210
5214
|
history,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ValidationError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JY75VSQK.js";
|
|
4
4
|
|
|
5
5
|
// src/contracts/chatEvents.ts
|
|
6
6
|
var CHAT_EVENT_TYPES = ["tool_call", "tool_result", "thought", "error", "task"];
|
|
@@ -77,9 +77,9 @@ var MEMORY_STATUSES = [
|
|
|
77
77
|
"active",
|
|
78
78
|
// Normal, visible memories
|
|
79
79
|
"superseded",
|
|
80
|
-
// Outdated; soft-deleted via
|
|
80
|
+
// Outdated; soft-deleted via band_supersede_memory
|
|
81
81
|
"archived",
|
|
82
|
-
// Hidden but preserved via
|
|
82
|
+
// Hidden but preserved via band_archive_memory
|
|
83
83
|
"all"
|
|
84
84
|
// Any status (no filter)
|
|
85
85
|
];
|
|
@@ -120,7 +120,7 @@ function memoryTypeForSystemError(system) {
|
|
|
120
120
|
|
|
121
121
|
// src/runtime/tools/schemas.ts
|
|
122
122
|
var TOOL_MODELS = {
|
|
123
|
-
|
|
123
|
+
band_send_message: {
|
|
124
124
|
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.",
|
|
125
125
|
properties: {
|
|
126
126
|
content: {
|
|
@@ -136,7 +136,7 @@ var TOOL_MODELS = {
|
|
|
136
136
|
},
|
|
137
137
|
required: ["content", "mentions"]
|
|
138
138
|
},
|
|
139
|
-
|
|
139
|
+
band_send_event: {
|
|
140
140
|
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.",
|
|
141
141
|
properties: {
|
|
142
142
|
content: {
|
|
@@ -155,12 +155,12 @@ var TOOL_MODELS = {
|
|
|
155
155
|
},
|
|
156
156
|
required: ["content", "message_type"]
|
|
157
157
|
},
|
|
158
|
-
|
|
159
|
-
description: "Add a participant (agent or user) to the chat room by name. IMPORTANT: Use
|
|
158
|
+
band_add_participant: {
|
|
159
|
+
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'.",
|
|
160
160
|
properties: {
|
|
161
161
|
name: {
|
|
162
162
|
type: "string",
|
|
163
|
-
description: "Name of participant to add (must match a name from
|
|
163
|
+
description: "Name of participant to add (must match a name from band_lookup_peers)."
|
|
164
164
|
},
|
|
165
165
|
role: {
|
|
166
166
|
type: "string",
|
|
@@ -170,7 +170,7 @@ var TOOL_MODELS = {
|
|
|
170
170
|
},
|
|
171
171
|
required: ["name"]
|
|
172
172
|
},
|
|
173
|
-
|
|
173
|
+
band_remove_participant: {
|
|
174
174
|
description: "Remove a participant from the chat room by name.",
|
|
175
175
|
properties: {
|
|
176
176
|
name: {
|
|
@@ -180,12 +180,12 @@ var TOOL_MODELS = {
|
|
|
180
180
|
},
|
|
181
181
|
required: ["name"]
|
|
182
182
|
},
|
|
183
|
-
|
|
183
|
+
band_get_participants: {
|
|
184
184
|
description: "Get a list of all participants in the current chat room.",
|
|
185
185
|
properties: {},
|
|
186
186
|
required: []
|
|
187
187
|
},
|
|
188
|
-
|
|
188
|
+
band_lookup_peers: {
|
|
189
189
|
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.",
|
|
190
190
|
properties: {
|
|
191
191
|
page: {
|
|
@@ -200,7 +200,7 @@ var TOOL_MODELS = {
|
|
|
200
200
|
},
|
|
201
201
|
required: []
|
|
202
202
|
},
|
|
203
|
-
|
|
203
|
+
band_create_chatroom: {
|
|
204
204
|
description: "Create a new chat room for a specific task or conversation.",
|
|
205
205
|
properties: {
|
|
206
206
|
task_id: {
|
|
@@ -210,7 +210,7 @@ var TOOL_MODELS = {
|
|
|
210
210
|
},
|
|
211
211
|
required: []
|
|
212
212
|
},
|
|
213
|
-
|
|
213
|
+
band_list_contacts: {
|
|
214
214
|
description: "List agent's contacts with pagination.",
|
|
215
215
|
properties: {
|
|
216
216
|
page: {
|
|
@@ -227,7 +227,7 @@ var TOOL_MODELS = {
|
|
|
227
227
|
},
|
|
228
228
|
required: []
|
|
229
229
|
},
|
|
230
|
-
|
|
230
|
+
band_add_contact: {
|
|
231
231
|
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.",
|
|
232
232
|
properties: {
|
|
233
233
|
handle: {
|
|
@@ -241,7 +241,7 @@ var TOOL_MODELS = {
|
|
|
241
241
|
},
|
|
242
242
|
required: ["handle"]
|
|
243
243
|
},
|
|
244
|
-
|
|
244
|
+
band_remove_contact: {
|
|
245
245
|
description: "Remove an existing contact by handle or ID.",
|
|
246
246
|
properties: {
|
|
247
247
|
handle: {
|
|
@@ -255,7 +255,7 @@ var TOOL_MODELS = {
|
|
|
255
255
|
},
|
|
256
256
|
required: []
|
|
257
257
|
},
|
|
258
|
-
|
|
258
|
+
band_list_contact_requests: {
|
|
259
259
|
description: "List both received and sent contact requests. Received requests are always filtered to pending status. Sent requests can be filtered by status.",
|
|
260
260
|
properties: {
|
|
261
261
|
page: {
|
|
@@ -277,7 +277,7 @@ var TOOL_MODELS = {
|
|
|
277
277
|
},
|
|
278
278
|
required: []
|
|
279
279
|
},
|
|
280
|
-
|
|
280
|
+
band_respond_contact_request: {
|
|
281
281
|
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).",
|
|
282
282
|
properties: {
|
|
283
283
|
action: {
|
|
@@ -296,7 +296,7 @@ var TOOL_MODELS = {
|
|
|
296
296
|
},
|
|
297
297
|
required: ["action"]
|
|
298
298
|
},
|
|
299
|
-
|
|
299
|
+
band_list_memories: {
|
|
300
300
|
description: "List memories accessible to the agent. Returns memories about the specified subject (cross-agent sharing) and organization-wide shared memories.",
|
|
301
301
|
properties: {
|
|
302
302
|
subject_id: {
|
|
@@ -341,7 +341,7 @@ var TOOL_MODELS = {
|
|
|
341
341
|
},
|
|
342
342
|
required: []
|
|
343
343
|
},
|
|
344
|
-
|
|
344
|
+
band_store_memory: {
|
|
345
345
|
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.",
|
|
346
346
|
properties: {
|
|
347
347
|
content: {
|
|
@@ -383,7 +383,7 @@ var TOOL_MODELS = {
|
|
|
383
383
|
},
|
|
384
384
|
required: ["content", "system", "type", "segment", "thought"]
|
|
385
385
|
},
|
|
386
|
-
|
|
386
|
+
band_get_memory: {
|
|
387
387
|
description: "Retrieve a specific memory by ID.",
|
|
388
388
|
properties: {
|
|
389
389
|
memory_id: {
|
|
@@ -393,7 +393,7 @@ var TOOL_MODELS = {
|
|
|
393
393
|
},
|
|
394
394
|
required: ["memory_id"]
|
|
395
395
|
},
|
|
396
|
-
|
|
396
|
+
band_supersede_memory: {
|
|
397
397
|
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.",
|
|
398
398
|
properties: {
|
|
399
399
|
memory_id: {
|
|
@@ -403,7 +403,7 @@ var TOOL_MODELS = {
|
|
|
403
403
|
},
|
|
404
404
|
required: ["memory_id"]
|
|
405
405
|
},
|
|
406
|
-
|
|
406
|
+
band_archive_memory: {
|
|
407
407
|
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.",
|
|
408
408
|
properties: {
|
|
409
409
|
memory_id: {
|
|
@@ -416,18 +416,18 @@ var TOOL_MODELS = {
|
|
|
416
416
|
};
|
|
417
417
|
var ALL_TOOL_NAMES = new Set(Object.keys(TOOL_MODELS));
|
|
418
418
|
var MEMORY_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
419
|
-
"
|
|
420
|
-
"
|
|
421
|
-
"
|
|
422
|
-
"
|
|
423
|
-
"
|
|
419
|
+
"band_list_memories",
|
|
420
|
+
"band_store_memory",
|
|
421
|
+
"band_get_memory",
|
|
422
|
+
"band_supersede_memory",
|
|
423
|
+
"band_archive_memory"
|
|
424
424
|
]);
|
|
425
425
|
var CONTACT_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
426
|
-
"
|
|
427
|
-
"
|
|
428
|
-
"
|
|
429
|
-
"
|
|
430
|
-
"
|
|
426
|
+
"band_list_contacts",
|
|
427
|
+
"band_add_contact",
|
|
428
|
+
"band_remove_contact",
|
|
429
|
+
"band_list_contact_requests",
|
|
430
|
+
"band_respond_contact_request"
|
|
431
431
|
]);
|
|
432
432
|
var BASE_TOOL_NAMES = new Set(
|
|
433
433
|
[...ALL_TOOL_NAMES].filter((name) => !MEMORY_TOOL_NAMES.has(name))
|
|
@@ -435,7 +435,10 @@ var BASE_TOOL_NAMES = new Set(
|
|
|
435
435
|
var CHAT_TOOL_NAMES = new Set(
|
|
436
436
|
[...BASE_TOOL_NAMES].filter((name) => !CONTACT_TOOL_NAMES.has(name))
|
|
437
437
|
);
|
|
438
|
-
var MCP_TOOL_PREFIX = "
|
|
438
|
+
var MCP_TOOL_PREFIX = "mcp__band__";
|
|
439
|
+
var MCP_SERVER_NAME = "band";
|
|
440
|
+
var SEND_MESSAGE_TOOL_NAME = "band_send_message";
|
|
441
|
+
var SEND_EVENT_TOOL_NAME = "band_send_event";
|
|
439
442
|
function mcpToolNames(names) {
|
|
440
443
|
return [...names].sort((a, b) => a.localeCompare(b)).map((name) => `${MCP_TOOL_PREFIX}${name}`);
|
|
441
444
|
}
|
|
@@ -477,6 +480,9 @@ export {
|
|
|
477
480
|
BASE_TOOL_NAMES,
|
|
478
481
|
CHAT_TOOL_NAMES,
|
|
479
482
|
MCP_TOOL_PREFIX,
|
|
483
|
+
MCP_SERVER_NAME,
|
|
484
|
+
SEND_MESSAGE_TOOL_NAME,
|
|
485
|
+
SEND_EVENT_TOOL_NAME,
|
|
480
486
|
mcpToolNames,
|
|
481
487
|
getToolDescription
|
|
482
488
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-AVVDPXP4.js";
|
|
4
4
|
import {
|
|
5
5
|
renderSystemPrompt
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WLCM2OXG.js";
|
|
7
7
|
import {
|
|
8
8
|
asErrorMessage,
|
|
9
9
|
asNonEmptyString,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
UnsupportedFeatureError,
|
|
17
17
|
ValidationError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JY75VSQK.js";
|
|
19
19
|
|
|
20
20
|
// src/adapters/shared/history.ts
|
|
21
21
|
function findLatestTaskMetadata(raw, predicate) {
|
|
@@ -1098,7 +1098,7 @@ function buildAgentCard(peer, gatewayUrl) {
|
|
|
1098
1098
|
id: "default",
|
|
1099
1099
|
name: peer.name,
|
|
1100
1100
|
description: peer.description,
|
|
1101
|
-
tags: ["
|
|
1101
|
+
tags: ["band", "gateway"]
|
|
1102
1102
|
}
|
|
1103
1103
|
],
|
|
1104
1104
|
defaultInputModes: ["text/plain"],
|
|
@@ -1281,7 +1281,7 @@ var DEFAULT_RESPONSE_TIMEOUT_MS = 12e4;
|
|
|
1281
1281
|
var DEFAULT_PEER_PAGE_SIZE = 100;
|
|
1282
1282
|
var DEFAULT_MAX_PEER_PAGES = 25;
|
|
1283
1283
|
var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
1284
|
-
|
|
1284
|
+
bandRest;
|
|
1285
1285
|
gatewayUrl;
|
|
1286
1286
|
host;
|
|
1287
1287
|
port;
|
|
@@ -1302,7 +1302,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1302
1302
|
super({
|
|
1303
1303
|
historyConverter: new GatewayHistoryConverter()
|
|
1304
1304
|
});
|
|
1305
|
-
this.
|
|
1305
|
+
this.bandRest = options.bandRest;
|
|
1306
1306
|
this.gatewayUrl = options.gatewayUrl ?? DEFAULT_GATEWAY_URL;
|
|
1307
1307
|
this.host = options.host ?? DEFAULT_HOST;
|
|
1308
1308
|
this.port = options.port ?? DEFAULT_PORT;
|
|
@@ -1382,13 +1382,13 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1382
1382
|
async refreshPeers() {
|
|
1383
1383
|
this.peersBySlug.clear();
|
|
1384
1384
|
this.peersById.clear();
|
|
1385
|
-
if (!this.
|
|
1385
|
+
if (!this.bandRest.listPeers) {
|
|
1386
1386
|
throw new UnsupportedFeatureError(
|
|
1387
1387
|
"Peer listing is not available in current REST adapter"
|
|
1388
1388
|
);
|
|
1389
1389
|
}
|
|
1390
1390
|
for (let page = 1; page <= this.maxPeerPages; page += 1) {
|
|
1391
|
-
const response = await this.
|
|
1391
|
+
const response = await this.bandRest.listPeers({
|
|
1392
1392
|
page,
|
|
1393
1393
|
pageSize: this.peerPageSize,
|
|
1394
1394
|
notInChat: ""
|
|
@@ -1458,7 +1458,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1458
1458
|
try {
|
|
1459
1459
|
await this.emitContextEvent(roomId, contextId);
|
|
1460
1460
|
const content = extractMessageText2(request.message) ?? "";
|
|
1461
|
-
await this.
|
|
1461
|
+
await this.bandRest.createChatMessage(roomId, {
|
|
1462
1462
|
content: buildMentionedContent(peer.name, content),
|
|
1463
1463
|
mentions: buildMentions(peer),
|
|
1464
1464
|
metadata: {
|
|
@@ -1489,7 +1489,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1489
1489
|
contextId: pending.contextId,
|
|
1490
1490
|
state: "failed",
|
|
1491
1491
|
final: true,
|
|
1492
|
-
text: "Timed out waiting for a
|
|
1492
|
+
text: "Timed out waiting for a Band peer response."
|
|
1493
1493
|
});
|
|
1494
1494
|
return;
|
|
1495
1495
|
}
|
|
@@ -1576,7 +1576,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1576
1576
|
if (existingRoom) {
|
|
1577
1577
|
const participants = this.roomParticipants.get(existingRoom) ?? /* @__PURE__ */ new Set();
|
|
1578
1578
|
if (!participants.has(targetPeerId)) {
|
|
1579
|
-
await this.
|
|
1579
|
+
await this.bandRest.addChatParticipant(existingRoom, {
|
|
1580
1580
|
participantId: targetPeerId,
|
|
1581
1581
|
role: "member"
|
|
1582
1582
|
});
|
|
@@ -1586,11 +1586,11 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1586
1586
|
return [existingRoom, contextId];
|
|
1587
1587
|
}
|
|
1588
1588
|
const normalizedContextId = contextId && contextId.length > 0 ? contextId : randomUUID4();
|
|
1589
|
-
const created = await this.
|
|
1589
|
+
const created = await this.bandRest.createChat(
|
|
1590
1590
|
`a2a:gateway:${normalizedContextId}`
|
|
1591
1591
|
);
|
|
1592
1592
|
const roomId = created.id;
|
|
1593
|
-
await this.
|
|
1593
|
+
await this.bandRest.addChatParticipant(roomId, {
|
|
1594
1594
|
participantId: targetPeerId,
|
|
1595
1595
|
role: "member"
|
|
1596
1596
|
});
|
|
@@ -1599,7 +1599,7 @@ var A2AGatewayAdapter = class extends SimpleAdapter {
|
|
|
1599
1599
|
return [roomId, normalizedContextId];
|
|
1600
1600
|
}
|
|
1601
1601
|
async emitContextEvent(roomId, contextId) {
|
|
1602
|
-
await this.
|
|
1602
|
+
await this.bandRest.createChatEvent(roomId, {
|
|
1603
1603
|
content: "A2A gateway context",
|
|
1604
1604
|
messageType: "task",
|
|
1605
1605
|
metadata: {
|
|
@@ -1777,10 +1777,10 @@ function toStatusUpdateEvent(message, taskId, contextId) {
|
|
|
1777
1777
|
final,
|
|
1778
1778
|
text: message.content,
|
|
1779
1779
|
metadata: {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1780
|
+
band_message_id: message.id,
|
|
1781
|
+
band_message_type: message.messageType,
|
|
1782
|
+
band_sender_id: message.senderId,
|
|
1783
|
+
band_room_id: message.roomId
|
|
1784
1784
|
}
|
|
1785
1785
|
});
|
|
1786
1786
|
}
|
|
@@ -1994,8 +1994,8 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
1994
1994
|
message: userMessage,
|
|
1995
1995
|
moderation: "none",
|
|
1996
1996
|
metadata: {
|
|
1997
|
-
|
|
1998
|
-
|
|
1997
|
+
band_source: "band-sdk-typescript",
|
|
1998
|
+
band_room_id: context.roomId
|
|
1999
1999
|
}
|
|
2000
2000
|
},
|
|
2001
2001
|
this.requestOptions()
|
|
@@ -2070,9 +2070,9 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
2070
2070
|
{
|
|
2071
2071
|
agentId: this.agentId,
|
|
2072
2072
|
customerId,
|
|
2073
|
-
title: `
|
|
2073
|
+
title: `Band Room ${roomId.slice(0, 8)}`,
|
|
2074
2074
|
metadata: {
|
|
2075
|
-
|
|
2075
|
+
band_room_id: roomId
|
|
2076
2076
|
}
|
|
2077
2077
|
},
|
|
2078
2078
|
this.requestOptions()
|
|
@@ -2085,7 +2085,7 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
2085
2085
|
source: "system",
|
|
2086
2086
|
message: this.systemPrompt,
|
|
2087
2087
|
metadata: {
|
|
2088
|
-
|
|
2088
|
+
band_system_prompt: true
|
|
2089
2089
|
}
|
|
2090
2090
|
},
|
|
2091
2091
|
this.requestOptions()
|
|
@@ -2139,7 +2139,7 @@ var ParlantAdapter = class extends SimpleAdapter {
|
|
|
2139
2139
|
{
|
|
2140
2140
|
name: customerName,
|
|
2141
2141
|
metadata: {
|
|
2142
|
-
|
|
2142
|
+
band_room_id: roomId
|
|
2143
2143
|
}
|
|
2144
2144
|
},
|
|
2145
2145
|
this.requestOptions()
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ValidationError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JY75VSQK.js";
|
|
4
4
|
|
|
5
5
|
// src/config/loader.ts
|
|
6
6
|
import { readFileSync } from "fs";
|
|
7
7
|
import yaml from "js-yaml";
|
|
8
8
|
var DEFAULT_CONFIG_PATH = "./agent_config.yaml";
|
|
9
|
-
var DEFAULT_ENV_PREFIX = "
|
|
9
|
+
var DEFAULT_ENV_PREFIX = "BAND_";
|
|
10
|
+
var LEGACY_ENV_PREFIX = "THENVOI_";
|
|
11
|
+
var _warnedLegacyEnvVars = /* @__PURE__ */ new Set();
|
|
12
|
+
function readBandFirstEnv(env, field) {
|
|
13
|
+
const bandVar = `${DEFAULT_ENV_PREFIX}${field}`;
|
|
14
|
+
const bandValue = env[bandVar];
|
|
15
|
+
if (bandValue !== void 0) return bandValue;
|
|
16
|
+
const legacyVar = `${LEGACY_ENV_PREFIX}${field}`;
|
|
17
|
+
const legacyValue = env[legacyVar];
|
|
18
|
+
if (legacyValue !== void 0 && !_warnedLegacyEnvVars.has(legacyVar)) {
|
|
19
|
+
_warnedLegacyEnvVars.add(legacyVar);
|
|
20
|
+
console.warn(`[band] ${legacyVar} is deprecated; use ${bandVar} instead`);
|
|
21
|
+
}
|
|
22
|
+
return legacyValue;
|
|
23
|
+
}
|
|
10
24
|
var REQUIRED_FIELDS = ["agent_id", "api_key"];
|
|
11
25
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype", "toString", "valueOf"]);
|
|
12
26
|
function toSnakeCase(key) {
|
|
@@ -90,19 +104,32 @@ function loadAgentConfig(agentKey, configPath) {
|
|
|
90
104
|
}
|
|
91
105
|
function loadAgentConfigFromEnv(options) {
|
|
92
106
|
const env = options?.env ?? process.env;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
let section;
|
|
108
|
+
let requiredHint;
|
|
109
|
+
if (options?.prefix === void 0) {
|
|
110
|
+
section = normalizeKeys({
|
|
111
|
+
agent_id: readBandFirstEnv(env, "AGENT_ID"),
|
|
112
|
+
api_key: readBandFirstEnv(env, "API_KEY"),
|
|
113
|
+
ws_url: readBandFirstEnv(env, "WS_URL"),
|
|
114
|
+
rest_url: readBandFirstEnv(env, "REST_URL")
|
|
115
|
+
});
|
|
116
|
+
requiredHint = `${DEFAULT_ENV_PREFIX}AGENT_ID and ${DEFAULT_ENV_PREFIX}API_KEY (legacy ${LEGACY_ENV_PREFIX}* still accepted)`;
|
|
117
|
+
} else {
|
|
118
|
+
const prefix = options.prefix === "" || options.prefix.endsWith("_") ? options.prefix : `${options.prefix}_`;
|
|
119
|
+
section = normalizeKeys({
|
|
120
|
+
agent_id: env[`${prefix}AGENT_ID`],
|
|
121
|
+
api_key: env[`${prefix}API_KEY`],
|
|
122
|
+
ws_url: env[`${prefix}WS_URL`],
|
|
123
|
+
rest_url: env[`${prefix}REST_URL`]
|
|
124
|
+
});
|
|
125
|
+
requiredHint = `${prefix}AGENT_ID and ${prefix}API_KEY`;
|
|
126
|
+
}
|
|
100
127
|
try {
|
|
101
|
-
return toAgentConfigResult(section, `environment variables (${
|
|
128
|
+
return toAgentConfigResult(section, `environment variables (${requiredHint})`);
|
|
102
129
|
} catch (error) {
|
|
103
130
|
if (error instanceof ValidationError) {
|
|
104
131
|
throw new ValidationError(
|
|
105
|
-
`${error.message}. Set ${
|
|
132
|
+
`${error.message}. Set ${requiredHint}, or use loadAgentConfig() for agent_config.yaml.`
|
|
106
133
|
);
|
|
107
134
|
}
|
|
108
135
|
throw error;
|