@band-ai/sdk 0.1.6 → 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 +372 -0
- package/dist/{ClaudeSDKAdapter-CRq4R-WB.d.cts → ClaudeSDKAdapter-BY4zEbCl.d.cts} +14 -10
- package/dist/{ClaudeSDKAdapter-BHOkjN3X.d.ts → ClaudeSDKAdapter-Cna5P1dR.d.ts} +14 -10
- package/dist/{acp-server-B1Da7L6u.d.ts → acp-server-CiUqN3G3.d.ts} +2 -2
- package/dist/{acp-server-BdRz9_UN.d.cts → acp-server-Dlj7D563.d.cts} +2 -2
- package/dist/adapters.cjs +734 -279
- 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-MSL6CWHY.js → chunk-4IAXZBXX.js} +77 -37
- package/dist/{chunk-SG4WLD2H.js → chunk-EAI2M3WM.js} +38 -94
- package/dist/{chunk-YR3BOQNW.js → chunk-JY75VSQK.js} +7 -7
- package/dist/{chunk-INA6YZTZ.js → chunk-LBWKISBS.js} +51 -31
- package/dist/{chunk-I5EZG52P.js → chunk-N2QTUMGO.js} +532 -327
- package/dist/{chunk-RHVH2GZR.js → chunk-NMZLX7TP.js} +110 -56
- package/dist/{chunk-EDPKUUJL.js → chunk-NT7TBFX2.js} +9 -1
- package/dist/{chunk-GVEQ3RAH.js → chunk-RV76SKFT.js} +169 -54
- package/dist/{chunk-W5NDZSYE.js → chunk-TLBCKDQO.js} +23 -23
- package/dist/chunk-US226AS4.js +130 -0
- package/dist/{chunk-IZPV6QS6.js → chunk-WL2HNJZ6.js} +38 -11
- package/dist/chunk-WLCM2OXG.js +181 -0
- 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 +491 -35
- package/dist/converters.d.cts +5 -5
- package/dist/converters.d.ts +5 -5
- package/dist/converters.js +4 -3
- package/dist/core.cjs +53 -10
- package/dist/core.d.cts +10 -9
- package/dist/core.d.ts +10 -9
- package/dist/core.js +8 -4
- package/dist/disconnectReason-IuADl6TH.d.cts +34 -0
- package/dist/disconnectReason-IuADl6TH.d.ts +34 -0
- package/dist/{dtos-DUpbIu8k.d.ts → dtos-B8KU_q4d.d.cts} +26 -6
- package/dist/{dtos-DUpbIu8k.d.cts → dtos-B8KU_q4d.d.ts} +26 -6
- package/dist/index.cjs +1510 -735
- package/dist/index.d.cts +18 -16
- package/dist/index.d.ts +18 -16
- package/dist/index.js +21 -13
- package/dist/linear.cjs +1044 -112
- package/dist/linear.d.cts +146 -16
- package/dist/linear.d.ts +146 -16
- package/dist/linear.js +1031 -110
- package/dist/mcp-claude.cjs +338 -66
- package/dist/mcp-claude.d.cts +3 -3
- package/dist/mcp-claude.d.ts +3 -3
- package/dist/mcp-claude.js +215 -16
- package/dist/mcp.cjs +414 -105
- package/dist/mcp.d.cts +29 -16
- package/dist/mcp.d.ts +29 -16
- package/dist/mcp.js +14 -14
- package/dist/{opencode-BBcDchcN.d.cts → opencode-2YdscIc1.d.cts} +5 -5
- package/dist/{opencode-DthQQUsZ.d.ts → opencode-Bld62x5t.d.ts} +5 -5
- package/dist/{pagination-CcDkVFxK.d.ts → pagination-BgEx-HeL.d.ts} +2 -2
- package/dist/{pagination-BPiys10t.d.cts → pagination-DqdkQArT.d.cts} +2 -2
- package/dist/{protocols-DrhzOH6K.d.ts → protocols-Bwwcql0h.d.ts} +1 -1
- package/dist/{protocols-CInhtFpA.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 +998 -620
- package/dist/runtime.d.cts +22 -29
- package/dist/runtime.d.ts +22 -29
- package/dist/runtime.js +19 -67
- package/dist/{schemas-BpEBkq5V.d.cts → schemas-BotL3ZLH.d.cts} +51 -56
- package/dist/{schemas-vos1AaBc.d.ts → schemas-DBsC4J1g.d.ts} +51 -56
- package/dist/{sdk-CwTAxhwI.d.cts → sdk-BTciSLRQ.d.cts} +35 -5
- package/dist/{sdk-CcnQ5OUC.d.ts → sdk-qKJtMma_.d.ts} +35 -5
- package/dist/{simpleAdapter-9OE_p6QW.d.ts → simpleAdapter--wznuoOw.d.ts} +1 -1
- package/dist/{simpleAdapter-DqhvjsGr.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-7jVzOeOP.d.ts → types-BTN_ZETM.d.ts} +2 -2
- package/dist/{types-CxII3XkA.d.ts → types-BgYFd_Yw.d.cts} +5 -5
- package/dist/{types-CSHFipIc.d.cts → types-BivGO7I9.d.ts} +5 -5
- package/dist/{types-CovcHpYf.d.cts → types-D958TC71.d.cts} +2 -2
- package/package.json +25 -23
- package/dist/backends-CzDbiQar.d.ts +0 -20
- package/dist/backends-SVMT-7l4.d.cts +0 -20
- package/dist/chunk-SFVKOEQH.js +0 -103
|
@@ -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-
|
|
24
|
-
import {
|
|
25
|
-
mcpToolNames
|
|
26
|
-
} from "./chunk-GVEQ3RAH.js";
|
|
23
|
+
} from "./chunk-LBWKISBS.js";
|
|
27
24
|
import {
|
|
28
25
|
renderSystemPrompt
|
|
29
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WLCM2OXG.js";
|
|
27
|
+
import {
|
|
28
|
+
MCP_SERVER_NAME,
|
|
29
|
+
SEND_EVENT_TOOL_NAME,
|
|
30
|
+
SEND_MESSAGE_TOOL_NAME,
|
|
31
|
+
mcpToolNames
|
|
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
|
|
@@ -750,7 +753,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
750
753
|
agentName: this.agentName,
|
|
751
754
|
agentDescription: this.agentDescription,
|
|
752
755
|
customSection,
|
|
753
|
-
includeBaseInstructions: this.baseConfig.includeBaseInstructions ?? true
|
|
756
|
+
includeBaseInstructions: this.baseConfig.includeBaseInstructions ?? true,
|
|
757
|
+
capabilities: { memory: this.includeMemoryTools }
|
|
754
758
|
}).trim();
|
|
755
759
|
this.systemPrompt = prompt.length > 0 ? prompt : null;
|
|
756
760
|
}
|
|
@@ -774,8 +778,8 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
774
778
|
await client.connect();
|
|
775
779
|
await client.initialize({
|
|
776
780
|
clientInfo: {
|
|
777
|
-
name: this.baseConfig.clientName ?? "
|
|
778
|
-
title: this.baseConfig.clientTitle ?? "
|
|
781
|
+
name: this.baseConfig.clientName ?? "band_codex_adapter",
|
|
782
|
+
title: this.baseConfig.clientTitle ?? "Band Codex Adapter",
|
|
779
783
|
version: this.baseConfig.clientVersion ?? "0.1.0"
|
|
780
784
|
},
|
|
781
785
|
capabilities: {
|
|
@@ -1048,7 +1052,7 @@ var CodexAdapter = class extends SimpleAdapter {
|
|
|
1048
1052
|
tool_call_id: callId
|
|
1049
1053
|
}), "tool_result");
|
|
1050
1054
|
}
|
|
1051
|
-
return !isError && toolName ===
|
|
1055
|
+
return !isError && toolName === SEND_MESSAGE_TOOL_NAME;
|
|
1052
1056
|
} catch (error) {
|
|
1053
1057
|
const output = {
|
|
1054
1058
|
ok: false,
|
|
@@ -2530,7 +2534,7 @@ var GeminiAdapter = class extends ToolCallingAdapter {
|
|
|
2530
2534
|
|
|
2531
2535
|
// src/adapters/google-adk/GoogleADKAdapter.ts
|
|
2532
2536
|
import { randomUUID } from "crypto";
|
|
2533
|
-
var APP_NAME = "
|
|
2537
|
+
var APP_NAME = "band";
|
|
2534
2538
|
var DEFAULT_MAX_HISTORY_MESSAGES = 50;
|
|
2535
2539
|
var DEFAULT_MAX_TRANSCRIPT_CHARS = 1e5;
|
|
2536
2540
|
var MAX_TOOL_OUTPUT_PREVIEW = 200;
|
|
@@ -2630,7 +2634,8 @@ var GoogleADKAdapter = class extends SimpleAdapter {
|
|
|
2630
2634
|
this.systemPrompt = this.systemPromptOverride ?? renderSystemPrompt({
|
|
2631
2635
|
agentName,
|
|
2632
2636
|
agentDescription,
|
|
2633
|
-
customSection: this.customSection
|
|
2637
|
+
customSection: this.customSection,
|
|
2638
|
+
capabilities: { memory: this.enableMemoryTools }
|
|
2634
2639
|
});
|
|
2635
2640
|
}
|
|
2636
2641
|
async onMessage(message, tools, history, participantsMessage, contactsMessage, context) {
|
|
@@ -2703,7 +2708,7 @@ var GoogleADKAdapter = class extends SimpleAdapter {
|
|
|
2703
2708
|
}
|
|
2704
2709
|
buildAgent(sdk, tools) {
|
|
2705
2710
|
return sdk.createAgent({
|
|
2706
|
-
name: this.agentName || "
|
|
2711
|
+
name: this.agentName || "band_agent",
|
|
2707
2712
|
model: this.model,
|
|
2708
2713
|
instruction: this.systemPrompt,
|
|
2709
2714
|
tools: this.buildTools(sdk, tools)
|
|
@@ -2869,7 +2874,8 @@ var LangGraphAdapter = class extends SimpleAdapter {
|
|
|
2869
2874
|
this.renderedSystemPrompt = this.systemPromptOverride ?? renderSystemPrompt({
|
|
2870
2875
|
agentName,
|
|
2871
2876
|
agentDescription,
|
|
2872
|
-
customSection: this.customSection
|
|
2877
|
+
customSection: this.customSection,
|
|
2878
|
+
capabilities: { memory: this.includeMemoryTools }
|
|
2873
2879
|
});
|
|
2874
2880
|
}
|
|
2875
2881
|
async onMessage(message, tools, history, participantsMessage, contactsMessage, context) {
|
|
@@ -2888,14 +2894,17 @@ var LangGraphAdapter = class extends SimpleAdapter {
|
|
|
2888
2894
|
];
|
|
2889
2895
|
}
|
|
2890
2896
|
const graph = await this.resolveGraph(sdk, langGraphTools);
|
|
2891
|
-
const
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
context.
|
|
2897
|
-
|
|
2898
|
-
|
|
2897
|
+
const usesCheckpointer = Boolean(this.checkpointer);
|
|
2898
|
+
const isFirstBootstrap = context.isSessionBootstrap && !this.bootstrappedRooms.has(context.roomId);
|
|
2899
|
+
const replayHistory = !usesCheckpointer || isFirstBootstrap;
|
|
2900
|
+
const includeSystemPrompt = this.usesCustomGraph && (!usesCheckpointer || isFirstBootstrap);
|
|
2901
|
+
if (context.isSessionBootstrap) {
|
|
2902
|
+
this.bootstrappedRooms.add(context.roomId);
|
|
2903
|
+
}
|
|
2904
|
+
const messages = this.buildMessages(history, message, participantsMessage, contactsMessage, {
|
|
2905
|
+
replayHistory,
|
|
2906
|
+
includeSystemPrompt
|
|
2907
|
+
});
|
|
2899
2908
|
const input = { messages };
|
|
2900
2909
|
const graphConfig = {
|
|
2901
2910
|
configurable: {
|
|
@@ -2922,6 +2931,10 @@ var LangGraphAdapter = class extends SimpleAdapter {
|
|
|
2922
2931
|
async onCleanup(roomId) {
|
|
2923
2932
|
this.bootstrappedRooms.delete(roomId);
|
|
2924
2933
|
}
|
|
2934
|
+
/** A caller-supplied graph rather than the built-in createReactAgent. */
|
|
2935
|
+
get usesCustomGraph() {
|
|
2936
|
+
return Boolean(this.graph || this.graphFactory);
|
|
2937
|
+
}
|
|
2925
2938
|
resolveGraph(sdk, langGraphTools) {
|
|
2926
2939
|
if (this.graphFactory) {
|
|
2927
2940
|
return Promise.resolve(this.graphFactory(langGraphTools));
|
|
@@ -2942,14 +2955,13 @@ var LangGraphAdapter = class extends SimpleAdapter {
|
|
|
2942
2955
|
prompt: this.renderedSystemPrompt
|
|
2943
2956
|
}));
|
|
2944
2957
|
}
|
|
2945
|
-
buildMessages(history, message, participantsMessage, contactsMessage,
|
|
2958
|
+
buildMessages(history, message, participantsMessage, contactsMessage, options) {
|
|
2946
2959
|
const messages = [];
|
|
2947
|
-
if (
|
|
2960
|
+
if (options.includeSystemPrompt) {
|
|
2948
2961
|
messages.push(["system", this.renderedSystemPrompt]);
|
|
2949
|
-
this.bootstrappedRooms.add(roomId);
|
|
2950
2962
|
}
|
|
2951
|
-
if (
|
|
2952
|
-
const historical = history.raw.slice(-this.maxHistoryMessages);
|
|
2963
|
+
if (options.replayHistory && history.length > 0) {
|
|
2964
|
+
const historical = history.raw.filter((item) => item.id !== message.id).slice(-this.maxHistoryMessages);
|
|
2953
2965
|
for (const item of historical) {
|
|
2954
2966
|
const role = String(item.sender_type ?? "") === "Agent" ? "assistant" : "user";
|
|
2955
2967
|
const content = String(item.content ?? "");
|
|
@@ -2968,7 +2980,7 @@ var LangGraphAdapter = class extends SimpleAdapter {
|
|
|
2968
2980
|
return messages;
|
|
2969
2981
|
}
|
|
2970
2982
|
async forwardStreamEvents(graph, input, config, tools) {
|
|
2971
|
-
const stream = graph.streamEvents?.(input, config,
|
|
2983
|
+
const stream = graph.streamEvents?.(input, { ...config, version: "v2" });
|
|
2972
2984
|
if (!stream) {
|
|
2973
2985
|
return null;
|
|
2974
2986
|
}
|
|
@@ -2995,6 +3007,10 @@ var LangGraphAdapter = class extends SimpleAdapter {
|
|
|
2995
3007
|
);
|
|
2996
3008
|
}
|
|
2997
3009
|
if (eventType === "on_chain_end") {
|
|
3010
|
+
const chainName = String(data.name ?? "");
|
|
3011
|
+
if (!this.usesCustomGraph && chainName !== "LangGraph" && chainName !== "agent") {
|
|
3012
|
+
continue;
|
|
3013
|
+
}
|
|
2998
3014
|
const output = asOptionalRecord(data.data) ?? {};
|
|
2999
3015
|
const text = extractAssistantText(output.output);
|
|
3000
3016
|
if (text) {
|
|
@@ -3056,18 +3072,25 @@ function stringifyToolResult2(value, logger, toolName) {
|
|
|
3056
3072
|
});
|
|
3057
3073
|
}
|
|
3058
3074
|
function extractAssistantText(result) {
|
|
3059
|
-
if (typeof result === "string"
|
|
3060
|
-
|
|
3075
|
+
if (typeof result === "string") {
|
|
3076
|
+
const trimmed = result.trim();
|
|
3077
|
+
return trimmed.length > 0 && !isInternalLangGraphMarker(trimmed) ? trimmed : null;
|
|
3061
3078
|
}
|
|
3062
3079
|
const record = asOptionalRecord(result) ?? {};
|
|
3080
|
+
if (isLangChainAssistantMessage(record)) {
|
|
3081
|
+
const text = asLangChainMessageContent(record);
|
|
3082
|
+
if (text && !isInternalLangGraphMarker(text)) {
|
|
3083
|
+
return text;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3063
3086
|
const directContent = asMessageContent(record.content);
|
|
3064
|
-
if (directContent) {
|
|
3087
|
+
if (directContent && !isInternalLangGraphMarker(directContent)) {
|
|
3065
3088
|
return directContent;
|
|
3066
3089
|
}
|
|
3067
3090
|
const messages = Array.isArray(record.messages) ? record.messages : [];
|
|
3068
3091
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
3069
3092
|
const text = asMessageText(messages[index]);
|
|
3070
|
-
if (text) {
|
|
3093
|
+
if (text && !isInternalLangGraphMarker(text)) {
|
|
3071
3094
|
return text;
|
|
3072
3095
|
}
|
|
3073
3096
|
}
|
|
@@ -3084,12 +3107,40 @@ function asMessageText(value) {
|
|
|
3084
3107
|
if (!record) {
|
|
3085
3108
|
return null;
|
|
3086
3109
|
}
|
|
3110
|
+
if (isLangChainAssistantMessage(record)) {
|
|
3111
|
+
return asLangChainMessageContent(record);
|
|
3112
|
+
}
|
|
3087
3113
|
const role = String(record.role ?? "");
|
|
3088
3114
|
if (role !== "assistant") {
|
|
3089
3115
|
return null;
|
|
3090
3116
|
}
|
|
3091
3117
|
return asMessageContent(record.content);
|
|
3092
3118
|
}
|
|
3119
|
+
function isLangChainAssistantMessage(record) {
|
|
3120
|
+
const id = record.id;
|
|
3121
|
+
if (Array.isArray(id)) {
|
|
3122
|
+
const typeName = String(id[id.length - 1] ?? "");
|
|
3123
|
+
if (typeName === "AIMessage" || typeName === "AIMessageChunk") {
|
|
3124
|
+
return true;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
const getType = record.getType;
|
|
3128
|
+
if (typeof getType === "function") {
|
|
3129
|
+
try {
|
|
3130
|
+
return getType.call(record) === "ai";
|
|
3131
|
+
} catch {
|
|
3132
|
+
return false;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
return false;
|
|
3136
|
+
}
|
|
3137
|
+
function asLangChainMessageContent(record) {
|
|
3138
|
+
const kwargs = asOptionalRecord(record.kwargs);
|
|
3139
|
+
return asMessageContent(kwargs?.content ?? record.content);
|
|
3140
|
+
}
|
|
3141
|
+
function isInternalLangGraphMarker(text) {
|
|
3142
|
+
return text === "__end__" || text === "__start__";
|
|
3143
|
+
}
|
|
3093
3144
|
function asMessageContent(value) {
|
|
3094
3145
|
if (typeof value === "string" && value.trim().length > 0) {
|
|
3095
3146
|
return value.trim();
|
|
@@ -3455,7 +3506,7 @@ var LettaAdapter = class extends SimpleAdapter {
|
|
|
3455
3506
|
const agent = await this.raceTimeout(
|
|
3456
3507
|
(s) => client.agents.create(
|
|
3457
3508
|
{
|
|
3458
|
-
name: `
|
|
3509
|
+
name: `band-room-${roomId.slice(0, 16)}`,
|
|
3459
3510
|
model: this.model,
|
|
3460
3511
|
...this.embedding ? { embedding: this.embedding } : {},
|
|
3461
3512
|
system: this.systemPrompt || void 0,
|
|
@@ -3955,7 +4006,7 @@ var SdkOpencodeClientBase = class {
|
|
|
3955
4006
|
const result = await runtime.client.mcp.add({
|
|
3956
4007
|
...this.scope(),
|
|
3957
4008
|
name: input.name,
|
|
3958
|
-
config: { type: "remote", url: input.url }
|
|
4009
|
+
config: { type: "remote", url: input.url, headers: input.headers }
|
|
3959
4010
|
});
|
|
3960
4011
|
return expectRecord(result);
|
|
3961
4012
|
}
|
|
@@ -4146,8 +4197,8 @@ async function readResponseBody(response) {
|
|
|
4146
4197
|
|
|
4147
4198
|
// src/adapters/opencode/OpencodeAdapter.ts
|
|
4148
4199
|
var OPENCODE_SYSTEM_NOTE = [
|
|
4149
|
-
"Responses are relayed back into the
|
|
4150
|
-
"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.",
|
|
4151
4202
|
"When you need approval or clarification, ask clearly and wait for the user's next room message."
|
|
4152
4203
|
].join("\n");
|
|
4153
4204
|
function createDeferred() {
|
|
@@ -4178,8 +4229,8 @@ function withDefaults(config) {
|
|
|
4178
4229
|
approvalTimeoutReply: "reject",
|
|
4179
4230
|
questionMode: "manual",
|
|
4180
4231
|
questionWaitTimeoutMs: 3e5,
|
|
4181
|
-
sessionTitlePrefix: "
|
|
4182
|
-
mcpServerName:
|
|
4232
|
+
sessionTitlePrefix: "Band",
|
|
4233
|
+
mcpServerName: MCP_SERVER_NAME,
|
|
4183
4234
|
...config
|
|
4184
4235
|
};
|
|
4185
4236
|
}
|
|
@@ -4235,7 +4286,7 @@ var OpencodeAdapter = class extends SimpleAdapter {
|
|
|
4235
4286
|
directory: config.directory || void 0,
|
|
4236
4287
|
workspace: config.workspace || void 0
|
|
4237
4288
|
}));
|
|
4238
|
-
this.mcpBackendFactory = options.mcpBackendFactory ??
|
|
4289
|
+
this.mcpBackendFactory = options.mcpBackendFactory ?? createBandMcpBackend;
|
|
4239
4290
|
this.logger = options.logger ?? new NoopLogger();
|
|
4240
4291
|
}
|
|
4241
4292
|
async onStarted(agentName, agentDescription) {
|
|
@@ -4244,7 +4295,8 @@ var OpencodeAdapter = class extends SimpleAdapter {
|
|
|
4244
4295
|
agentName,
|
|
4245
4296
|
agentDescription,
|
|
4246
4297
|
customSection: this.config.customSection,
|
|
4247
|
-
includeBaseInstructions: this.config.includeBaseInstructions
|
|
4298
|
+
includeBaseInstructions: this.config.includeBaseInstructions,
|
|
4299
|
+
capabilities: { memory: this.config.enableMemoryTools }
|
|
4248
4300
|
}).trim();
|
|
4249
4301
|
this.systemPrompt = `${systemPrompt}
|
|
4250
4302
|
|
|
@@ -4388,7 +4440,8 @@ ${OPENCODE_SYSTEM_NOTE}`.trim();
|
|
|
4388
4440
|
}
|
|
4389
4441
|
await client.registerMcpServer({
|
|
4390
4442
|
name: this.config.mcpServerName,
|
|
4391
|
-
url: server.url
|
|
4443
|
+
url: server.url,
|
|
4444
|
+
headers: backend.authToken ? { Authorization: `Bearer ${backend.authToken}` } : void 0
|
|
4392
4445
|
});
|
|
4393
4446
|
} catch (error) {
|
|
4394
4447
|
this.logger.warn("Failed to register OpenCode MCP backend", { error });
|
|
@@ -5010,7 +5063,7 @@ function formatHistoryLine(entry) {
|
|
|
5010
5063
|
// src/adapters/claude-sdk/ClaudeSDKAdapter.ts
|
|
5011
5064
|
import { z as z2 } from "zod";
|
|
5012
5065
|
var DEFAULT_MODEL2 = "claude-sonnet-4-6";
|
|
5013
|
-
var
|
|
5066
|
+
var bandMcpBridgeFactory = new LazyAsyncValue({
|
|
5014
5067
|
load: async () => {
|
|
5015
5068
|
const module = await import("@anthropic-ai/claude-agent-sdk").catch((error) => {
|
|
5016
5069
|
throw new UnsupportedFeatureError(
|
|
@@ -5048,7 +5101,7 @@ var thenvoiMcpBridgeFactory = new LazyAsyncValue({
|
|
|
5048
5101
|
});
|
|
5049
5102
|
return {
|
|
5050
5103
|
serverConfig: createSdkMcpServer({
|
|
5051
|
-
name:
|
|
5104
|
+
name: MCP_SERVER_NAME,
|
|
5052
5105
|
tools: toolDefinitions
|
|
5053
5106
|
}),
|
|
5054
5107
|
allowedTools: mcpToolNames(new Set(registrations.map((registration) => registration.name)))
|
|
@@ -5095,11 +5148,12 @@ var ClaudeSDKAdapter = class extends SimpleAdapter {
|
|
|
5095
5148
|
agentName,
|
|
5096
5149
|
agentDescription,
|
|
5097
5150
|
customSection: this.customSection,
|
|
5098
|
-
includeBaseInstructions: this.includeBaseInstructions
|
|
5151
|
+
includeBaseInstructions: this.includeBaseInstructions,
|
|
5152
|
+
capabilities: { memory: this.enableMemoryTools }
|
|
5099
5153
|
});
|
|
5100
5154
|
if (this.enableMcpTools) {
|
|
5101
|
-
const
|
|
5102
|
-
this.mcpBridge =
|
|
5155
|
+
const createBandMcpBridge = await bandMcpBridgeFactory.get();
|
|
5156
|
+
this.mcpBridge = createBandMcpBridge({
|
|
5103
5157
|
enableMemoryTools: this.enableMemoryTools,
|
|
5104
5158
|
getToolsForRoom: (roomId) => this.roomTools.get(roomId),
|
|
5105
5159
|
additionalTools: this.additionalMcpTools.length > 0 ? this.additionalMcpTools : void 0
|
|
@@ -5147,14 +5201,14 @@ var ClaudeSDKAdapter = class extends SimpleAdapter {
|
|
|
5147
5201
|
}
|
|
5148
5202
|
if (this.mcpBridge && this.enableMcpTools) {
|
|
5149
5203
|
options.mcpServers = {
|
|
5150
|
-
|
|
5204
|
+
[MCP_SERVER_NAME]: this.mcpBridge.serverConfig
|
|
5151
5205
|
};
|
|
5152
5206
|
options.allowedTools = this.mcpBridge.allowedTools;
|
|
5153
5207
|
this.roomTools.set(context.roomId, tools);
|
|
5154
5208
|
}
|
|
5155
5209
|
const roomToolHint = this.enableMcpTools ? `
|
|
5156
5210
|
|
|
5157
|
-
[Tooling note]: For any
|
|
5211
|
+
[Tooling note]: For any mcp__band__* tool call, pass room_id="${context.roomId}".` : "";
|
|
5158
5212
|
const query = queryFn({
|
|
5159
5213
|
prompt: buildConversationPrompt({
|
|
5160
5214
|
history,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
MEMORY_TOOL_NAMES,
|
|
5
5
|
TOOL_MODELS,
|
|
6
6
|
getToolDescription
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RV76SKFT.js";
|
|
8
8
|
import {
|
|
9
9
|
isToolExecutorError,
|
|
10
10
|
toLegacyToolExecutorErrorMessage
|
|
@@ -128,6 +128,13 @@ function serializeValue(value) {
|
|
|
128
128
|
return String(value);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
function resolveSingleRoomTools(getToolsForRoom) {
|
|
132
|
+
const tools = getToolsForRoom("");
|
|
133
|
+
if (!tools) {
|
|
134
|
+
throw new Error('Single-room mode requires getToolsForRoom("") to return a tools instance');
|
|
135
|
+
}
|
|
136
|
+
return tools;
|
|
137
|
+
}
|
|
131
138
|
|
|
132
139
|
// src/mcp/zod.ts
|
|
133
140
|
function buildZodShape(z, properties, required) {
|
|
@@ -173,5 +180,6 @@ export {
|
|
|
173
180
|
buildSingleContextRegistrations,
|
|
174
181
|
successResult,
|
|
175
182
|
errorResult,
|
|
183
|
+
resolveSingleRoomTools,
|
|
176
184
|
buildZodShape
|
|
177
185
|
};
|