@band-ai/sdk 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters.cjs +36 -9
- package/dist/adapters.js +36 -9
- package/dist/{chunk-JJF44XWA.js → chunk-U6AFCLYZ.js} +13 -6
- package/dist/index.cjs +15 -13
- package/dist/index.js +1 -1
- package/dist/runtime.cjs +12 -10
- package/dist/runtime.js +1 -1
- package/package.json +2 -2
package/dist/adapters.cjs
CHANGED
|
@@ -1920,9 +1920,9 @@ var BandACPClient = class {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
getCollectedChunks(sessionId) {
|
|
1922
1922
|
if (sessionId) {
|
|
1923
|
-
return
|
|
1923
|
+
return coalesceChunks(this.sessionChunks.get(sessionId) ?? []);
|
|
1924
1924
|
}
|
|
1925
|
-
return [...this.sessionChunks.values()].flatMap((chunks) => chunks);
|
|
1925
|
+
return [...this.sessionChunks.values()].flatMap((chunks) => coalesceChunks(chunks));
|
|
1926
1926
|
}
|
|
1927
1927
|
async extMethod(method, params) {
|
|
1928
1928
|
if (method === "cursor/ask_question") {
|
|
@@ -1965,7 +1965,8 @@ var BandACPClient = class {
|
|
|
1965
1965
|
this.appendChunk(sessionId, {
|
|
1966
1966
|
chunkType: "plan",
|
|
1967
1967
|
content: lines.join("\n"),
|
|
1968
|
-
metadata: {}
|
|
1968
|
+
metadata: {},
|
|
1969
|
+
streamed: false
|
|
1969
1970
|
});
|
|
1970
1971
|
}
|
|
1971
1972
|
return;
|
|
@@ -1976,7 +1977,8 @@ var BandACPClient = class {
|
|
|
1976
1977
|
this.appendChunk(sessionId, {
|
|
1977
1978
|
chunkType: "text",
|
|
1978
1979
|
content: `[Task completed] ${result}`,
|
|
1979
|
-
metadata: {}
|
|
1980
|
+
metadata: {},
|
|
1981
|
+
streamed: false
|
|
1980
1982
|
});
|
|
1981
1983
|
}
|
|
1982
1984
|
}
|
|
@@ -1987,19 +1989,41 @@ var BandACPClient = class {
|
|
|
1987
1989
|
this.sessionChunks.set(sessionId, existing);
|
|
1988
1990
|
}
|
|
1989
1991
|
};
|
|
1992
|
+
function coalesceChunks(chunks) {
|
|
1993
|
+
const result = [];
|
|
1994
|
+
const openRuns = /* @__PURE__ */ new Map();
|
|
1995
|
+
for (const chunk of chunks) {
|
|
1996
|
+
if (!chunk.streamed) {
|
|
1997
|
+
openRuns.clear();
|
|
1998
|
+
result.push({ ...chunk });
|
|
1999
|
+
continue;
|
|
2000
|
+
}
|
|
2001
|
+
const openRun = openRuns.get(chunk.chunkType);
|
|
2002
|
+
if (openRun) {
|
|
2003
|
+
openRun.content += chunk.content;
|
|
2004
|
+
continue;
|
|
2005
|
+
}
|
|
2006
|
+
const clone = { ...chunk };
|
|
2007
|
+
openRuns.set(chunk.chunkType, clone);
|
|
2008
|
+
result.push(clone);
|
|
2009
|
+
}
|
|
2010
|
+
return result;
|
|
2011
|
+
}
|
|
1990
2012
|
function toCollectedChunk(update) {
|
|
1991
2013
|
switch (update.sessionUpdate) {
|
|
1992
2014
|
case "agent_message_chunk":
|
|
1993
2015
|
return {
|
|
1994
2016
|
chunkType: "text",
|
|
1995
2017
|
content: extractTextFromContent(update.content),
|
|
1996
|
-
metadata: {}
|
|
2018
|
+
metadata: {},
|
|
2019
|
+
streamed: true
|
|
1997
2020
|
};
|
|
1998
2021
|
case "agent_thought_chunk":
|
|
1999
2022
|
return {
|
|
2000
2023
|
chunkType: "thought",
|
|
2001
2024
|
content: extractTextFromContent(update.content),
|
|
2002
|
-
metadata: {}
|
|
2025
|
+
metadata: {},
|
|
2026
|
+
streamed: true
|
|
2003
2027
|
};
|
|
2004
2028
|
case "tool_call":
|
|
2005
2029
|
return {
|
|
@@ -2009,7 +2033,8 @@ function toCollectedChunk(update) {
|
|
|
2009
2033
|
tool_call_id: update.toolCallId,
|
|
2010
2034
|
raw_input: update.rawInput,
|
|
2011
2035
|
status: update.status ?? "pending"
|
|
2012
|
-
}
|
|
2036
|
+
},
|
|
2037
|
+
streamed: false
|
|
2013
2038
|
};
|
|
2014
2039
|
case "tool_call_update":
|
|
2015
2040
|
return {
|
|
@@ -2018,13 +2043,15 @@ function toCollectedChunk(update) {
|
|
|
2018
2043
|
metadata: {
|
|
2019
2044
|
tool_call_id: update.toolCallId,
|
|
2020
2045
|
status: update.status ?? "completed"
|
|
2021
|
-
}
|
|
2046
|
+
},
|
|
2047
|
+
streamed: false
|
|
2022
2048
|
};
|
|
2023
2049
|
case "plan":
|
|
2024
2050
|
return {
|
|
2025
2051
|
chunkType: "plan",
|
|
2026
2052
|
content: update.entries.map((entry) => entry.content).join("\n"),
|
|
2027
|
-
metadata: {}
|
|
2053
|
+
metadata: {},
|
|
2054
|
+
streamed: false
|
|
2028
2055
|
};
|
|
2029
2056
|
default:
|
|
2030
2057
|
return null;
|
package/dist/adapters.js
CHANGED
|
@@ -187,9 +187,9 @@ var BandACPClient = class {
|
|
|
187
187
|
}
|
|
188
188
|
getCollectedChunks(sessionId) {
|
|
189
189
|
if (sessionId) {
|
|
190
|
-
return
|
|
190
|
+
return coalesceChunks(this.sessionChunks.get(sessionId) ?? []);
|
|
191
191
|
}
|
|
192
|
-
return [...this.sessionChunks.values()].flatMap((chunks) => chunks);
|
|
192
|
+
return [...this.sessionChunks.values()].flatMap((chunks) => coalesceChunks(chunks));
|
|
193
193
|
}
|
|
194
194
|
async extMethod(method, params) {
|
|
195
195
|
if (method === "cursor/ask_question") {
|
|
@@ -232,7 +232,8 @@ var BandACPClient = class {
|
|
|
232
232
|
this.appendChunk(sessionId, {
|
|
233
233
|
chunkType: "plan",
|
|
234
234
|
content: lines.join("\n"),
|
|
235
|
-
metadata: {}
|
|
235
|
+
metadata: {},
|
|
236
|
+
streamed: false
|
|
236
237
|
});
|
|
237
238
|
}
|
|
238
239
|
return;
|
|
@@ -243,7 +244,8 @@ var BandACPClient = class {
|
|
|
243
244
|
this.appendChunk(sessionId, {
|
|
244
245
|
chunkType: "text",
|
|
245
246
|
content: `[Task completed] ${result}`,
|
|
246
|
-
metadata: {}
|
|
247
|
+
metadata: {},
|
|
248
|
+
streamed: false
|
|
247
249
|
});
|
|
248
250
|
}
|
|
249
251
|
}
|
|
@@ -254,19 +256,41 @@ var BandACPClient = class {
|
|
|
254
256
|
this.sessionChunks.set(sessionId, existing);
|
|
255
257
|
}
|
|
256
258
|
};
|
|
259
|
+
function coalesceChunks(chunks) {
|
|
260
|
+
const result = [];
|
|
261
|
+
const openRuns = /* @__PURE__ */ new Map();
|
|
262
|
+
for (const chunk of chunks) {
|
|
263
|
+
if (!chunk.streamed) {
|
|
264
|
+
openRuns.clear();
|
|
265
|
+
result.push({ ...chunk });
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const openRun = openRuns.get(chunk.chunkType);
|
|
269
|
+
if (openRun) {
|
|
270
|
+
openRun.content += chunk.content;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const clone = { ...chunk };
|
|
274
|
+
openRuns.set(chunk.chunkType, clone);
|
|
275
|
+
result.push(clone);
|
|
276
|
+
}
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
257
279
|
function toCollectedChunk(update) {
|
|
258
280
|
switch (update.sessionUpdate) {
|
|
259
281
|
case "agent_message_chunk":
|
|
260
282
|
return {
|
|
261
283
|
chunkType: "text",
|
|
262
284
|
content: extractTextFromContent(update.content),
|
|
263
|
-
metadata: {}
|
|
285
|
+
metadata: {},
|
|
286
|
+
streamed: true
|
|
264
287
|
};
|
|
265
288
|
case "agent_thought_chunk":
|
|
266
289
|
return {
|
|
267
290
|
chunkType: "thought",
|
|
268
291
|
content: extractTextFromContent(update.content),
|
|
269
|
-
metadata: {}
|
|
292
|
+
metadata: {},
|
|
293
|
+
streamed: true
|
|
270
294
|
};
|
|
271
295
|
case "tool_call":
|
|
272
296
|
return {
|
|
@@ -276,7 +300,8 @@ function toCollectedChunk(update) {
|
|
|
276
300
|
tool_call_id: update.toolCallId,
|
|
277
301
|
raw_input: update.rawInput,
|
|
278
302
|
status: update.status ?? "pending"
|
|
279
|
-
}
|
|
303
|
+
},
|
|
304
|
+
streamed: false
|
|
280
305
|
};
|
|
281
306
|
case "tool_call_update":
|
|
282
307
|
return {
|
|
@@ -285,13 +310,15 @@ function toCollectedChunk(update) {
|
|
|
285
310
|
metadata: {
|
|
286
311
|
tool_call_id: update.toolCallId,
|
|
287
312
|
status: update.status ?? "completed"
|
|
288
|
-
}
|
|
313
|
+
},
|
|
314
|
+
streamed: false
|
|
289
315
|
};
|
|
290
316
|
case "plan":
|
|
291
317
|
return {
|
|
292
318
|
chunkType: "plan",
|
|
293
319
|
content: update.entries.map((entry) => entry.content).join("\n"),
|
|
294
|
-
metadata: {}
|
|
320
|
+
metadata: {},
|
|
321
|
+
streamed: false
|
|
295
322
|
};
|
|
296
323
|
default:
|
|
297
324
|
return null;
|
|
@@ -207,6 +207,7 @@ async function readResponseBody(response) {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// src/platform/streaming/PhoenixChannelsTransport.ts
|
|
210
|
+
import { agentControlTopic } from "@band-ai/band-sdk-core";
|
|
210
211
|
var PhoenixChannelsTransport = class {
|
|
211
212
|
socket;
|
|
212
213
|
agentId;
|
|
@@ -473,7 +474,7 @@ var PhoenixChannelsTransport = class {
|
|
|
473
474
|
if (!this.agentId) {
|
|
474
475
|
return;
|
|
475
476
|
}
|
|
476
|
-
await this.join(
|
|
477
|
+
await this.join(agentControlTopic(this.agentId), {
|
|
477
478
|
supersede: (payload) => {
|
|
478
479
|
const reason = parseSupersedeDisconnectReason(payload);
|
|
479
480
|
if (!reason) {
|
|
@@ -574,6 +575,12 @@ function getSocketChannelCount(socket) {
|
|
|
574
575
|
|
|
575
576
|
// src/platform/BandLink.ts
|
|
576
577
|
import { BandClient } from "@band-ai/rest-client";
|
|
578
|
+
import {
|
|
579
|
+
agentContactsTopic,
|
|
580
|
+
agentRoomsTopic,
|
|
581
|
+
chatRoomTopic,
|
|
582
|
+
roomParticipantsTopic
|
|
583
|
+
} from "@band-ai/band-sdk-core";
|
|
577
584
|
var DEFAULT_WS_URL = "wss://app.band.ai/api/v1/socket";
|
|
578
585
|
function deriveDefaultRestUrl(wsUrl) {
|
|
579
586
|
const parsed = new URL(wsUrl);
|
|
@@ -582,8 +589,8 @@ function deriveDefaultRestUrl(wsUrl) {
|
|
|
582
589
|
}
|
|
583
590
|
function roomTopics(roomId) {
|
|
584
591
|
return {
|
|
585
|
-
chat:
|
|
586
|
-
participants:
|
|
592
|
+
chat: chatRoomTopic(roomId),
|
|
593
|
+
participants: roomParticipantsTopic(roomId)
|
|
587
594
|
};
|
|
588
595
|
}
|
|
589
596
|
function toPlatformMessage(roomId, message) {
|
|
@@ -703,7 +710,7 @@ var BandLink = class {
|
|
|
703
710
|
this.eventQueue.push(event);
|
|
704
711
|
}
|
|
705
712
|
async subscribeAgentRooms() {
|
|
706
|
-
await this.transport.join(
|
|
713
|
+
await this.transport.join(agentRoomsTopic(this.agentId), {
|
|
707
714
|
room_added: (payload) => {
|
|
708
715
|
const roomId = typeof payload.id === "string" ? payload.id : "";
|
|
709
716
|
this.emit("room_added", payload, roomId);
|
|
@@ -756,7 +763,7 @@ var BandLink = class {
|
|
|
756
763
|
}
|
|
757
764
|
async subscribeAgentContacts() {
|
|
758
765
|
assertCapability(this.capabilities, "contacts", "Contacts streaming");
|
|
759
|
-
await this.transport.join(
|
|
766
|
+
await this.transport.join(agentContactsTopic(this.agentId), {
|
|
760
767
|
contact_request_received: (payload) => {
|
|
761
768
|
this.emit("contact_request_received", payload, null);
|
|
762
769
|
},
|
|
@@ -772,7 +779,7 @@ var BandLink = class {
|
|
|
772
779
|
});
|
|
773
780
|
}
|
|
774
781
|
async unsubscribeAgentContacts() {
|
|
775
|
-
await this.transport.leave(
|
|
782
|
+
await this.transport.leave(agentContactsTopic(this.agentId));
|
|
776
783
|
}
|
|
777
784
|
async nextEvent(signal) {
|
|
778
785
|
if (this.terminalDisconnectError) {
|
package/dist/index.cjs
CHANGED
|
@@ -2175,6 +2175,7 @@ async function readResponseBody(response) {
|
|
|
2175
2175
|
}
|
|
2176
2176
|
|
|
2177
2177
|
// src/platform/streaming/PhoenixChannelsTransport.ts
|
|
2178
|
+
var import_band_sdk_core = require("@band-ai/band-sdk-core");
|
|
2178
2179
|
var PhoenixChannelsTransport = class {
|
|
2179
2180
|
socket;
|
|
2180
2181
|
agentId;
|
|
@@ -2441,7 +2442,7 @@ var PhoenixChannelsTransport = class {
|
|
|
2441
2442
|
if (!this.agentId) {
|
|
2442
2443
|
return;
|
|
2443
2444
|
}
|
|
2444
|
-
await this.join(
|
|
2445
|
+
await this.join((0, import_band_sdk_core.agentControlTopic)(this.agentId), {
|
|
2445
2446
|
supersede: (payload) => {
|
|
2446
2447
|
const reason = parseSupersedeDisconnectReason(payload);
|
|
2447
2448
|
if (!reason) {
|
|
@@ -2543,6 +2544,7 @@ function getSocketChannelCount(socket) {
|
|
|
2543
2544
|
// src/platform/BandLink.ts
|
|
2544
2545
|
init_protocols();
|
|
2545
2546
|
var import_rest_client = require("@band-ai/rest-client");
|
|
2547
|
+
var import_band_sdk_core2 = require("@band-ai/band-sdk-core");
|
|
2546
2548
|
var DEFAULT_WS_URL = "wss://app.band.ai/api/v1/socket";
|
|
2547
2549
|
function deriveDefaultRestUrl(wsUrl) {
|
|
2548
2550
|
const parsed = new URL(wsUrl);
|
|
@@ -2551,8 +2553,8 @@ function deriveDefaultRestUrl(wsUrl) {
|
|
|
2551
2553
|
}
|
|
2552
2554
|
function roomTopics(roomId) {
|
|
2553
2555
|
return {
|
|
2554
|
-
chat:
|
|
2555
|
-
participants:
|
|
2556
|
+
chat: (0, import_band_sdk_core2.chatRoomTopic)(roomId),
|
|
2557
|
+
participants: (0, import_band_sdk_core2.roomParticipantsTopic)(roomId)
|
|
2556
2558
|
};
|
|
2557
2559
|
}
|
|
2558
2560
|
function toPlatformMessage(roomId, message) {
|
|
@@ -2672,7 +2674,7 @@ var BandLink = class {
|
|
|
2672
2674
|
this.eventQueue.push(event);
|
|
2673
2675
|
}
|
|
2674
2676
|
async subscribeAgentRooms() {
|
|
2675
|
-
await this.transport.join(
|
|
2677
|
+
await this.transport.join((0, import_band_sdk_core2.agentRoomsTopic)(this.agentId), {
|
|
2676
2678
|
room_added: (payload) => {
|
|
2677
2679
|
const roomId = typeof payload.id === "string" ? payload.id : "";
|
|
2678
2680
|
this.emit("room_added", payload, roomId);
|
|
@@ -2725,7 +2727,7 @@ var BandLink = class {
|
|
|
2725
2727
|
}
|
|
2726
2728
|
async subscribeAgentContacts() {
|
|
2727
2729
|
assertCapability(this.capabilities, "contacts", "Contacts streaming");
|
|
2728
|
-
await this.transport.join(
|
|
2730
|
+
await this.transport.join((0, import_band_sdk_core2.agentContactsTopic)(this.agentId), {
|
|
2729
2731
|
contact_request_received: (payload) => {
|
|
2730
2732
|
this.emit("contact_request_received", payload, null);
|
|
2731
2733
|
},
|
|
@@ -2741,7 +2743,7 @@ var BandLink = class {
|
|
|
2741
2743
|
});
|
|
2742
2744
|
}
|
|
2743
2745
|
async unsubscribeAgentContacts() {
|
|
2744
|
-
await this.transport.leave(
|
|
2746
|
+
await this.transport.leave((0, import_band_sdk_core2.agentContactsTopic)(this.agentId));
|
|
2745
2747
|
}
|
|
2746
2748
|
async nextEvent(signal) {
|
|
2747
2749
|
if (this.terminalDisconnectError) {
|
|
@@ -3213,7 +3215,7 @@ init_errors();
|
|
|
3213
3215
|
|
|
3214
3216
|
// src/runtime/tools/AgentTools.ts
|
|
3215
3217
|
init_errors();
|
|
3216
|
-
var
|
|
3218
|
+
var import_band_sdk_core3 = require("@band-ai/band-sdk-core");
|
|
3217
3219
|
|
|
3218
3220
|
// src/runtime/types.ts
|
|
3219
3221
|
var HistoryProvider = class {
|
|
@@ -3360,7 +3362,7 @@ var AgentTools = class {
|
|
|
3360
3362
|
constructor(options) {
|
|
3361
3363
|
this.roomId = options.roomId;
|
|
3362
3364
|
this.rest = options.rest;
|
|
3363
|
-
this.roster = options.roster ?? new
|
|
3365
|
+
this.roster = options.roster ?? new import_band_sdk_core3.ParticipantRoster();
|
|
3364
3366
|
this.logger = options.logger ?? new NoopLogger();
|
|
3365
3367
|
this.capabilities = {
|
|
3366
3368
|
...DEFAULT_AGENT_TOOLS_CAPABILITIES,
|
|
@@ -4185,7 +4187,7 @@ function validateToolArgs(toolName, args) {
|
|
|
4185
4187
|
}
|
|
4186
4188
|
|
|
4187
4189
|
// src/runtime/ExecutionContext.ts
|
|
4188
|
-
var
|
|
4190
|
+
var import_band_sdk_core4 = require("@band-ai/band-sdk-core");
|
|
4189
4191
|
var DEDUP_CACHE_MAX = 500;
|
|
4190
4192
|
var ExecutionContext = class {
|
|
4191
4193
|
roomId;
|
|
@@ -4197,7 +4199,7 @@ var ExecutionContext = class {
|
|
|
4197
4199
|
history = [];
|
|
4198
4200
|
messageIds = /* @__PURE__ */ new Set();
|
|
4199
4201
|
dedupCache = /* @__PURE__ */ new Map();
|
|
4200
|
-
roster = new
|
|
4202
|
+
roster = new import_band_sdk_core4.ParticipantRoster();
|
|
4201
4203
|
tools;
|
|
4202
4204
|
adapterTools;
|
|
4203
4205
|
participantsMessage = null;
|
|
@@ -4215,7 +4217,7 @@ var ExecutionContext = class {
|
|
|
4215
4217
|
this.enableContextCache = options.enableContextCache ?? true;
|
|
4216
4218
|
this.contextCacheTtlMs = Math.max(0, (options.contextCacheTtlSeconds ?? 300) * 1e3);
|
|
4217
4219
|
this.enableContextHydration = options.enableContextHydration ?? true;
|
|
4218
|
-
this.retryTrackerInstance = new
|
|
4220
|
+
this.retryTrackerInstance = new import_band_sdk_core4.RetryTracker(options.maxMessageRetries ?? 1);
|
|
4219
4221
|
this.tools = new AgentTools({
|
|
4220
4222
|
roomId: this.roomId,
|
|
4221
4223
|
rest: this.link.rest,
|
|
@@ -4471,7 +4473,7 @@ var ExecutionContext = class {
|
|
|
4471
4473
|
|
|
4472
4474
|
// src/runtime/rooms/RoomPresence.ts
|
|
4473
4475
|
init_errors();
|
|
4474
|
-
var
|
|
4476
|
+
var import_band_sdk_core5 = require("@band-ai/band-sdk-core");
|
|
4475
4477
|
|
|
4476
4478
|
// src/runtime/rooms/subscriptions.ts
|
|
4477
4479
|
init_errors();
|
|
@@ -4502,7 +4504,7 @@ async function hydrateExistingRooms(options) {
|
|
|
4502
4504
|
|
|
4503
4505
|
// src/runtime/rooms/RoomPresence.ts
|
|
4504
4506
|
var RoomPresence = class {
|
|
4505
|
-
roster = new
|
|
4507
|
+
roster = new import_band_sdk_core5.RoomRoster();
|
|
4506
4508
|
onRoomJoined = null;
|
|
4507
4509
|
onRoomLeft = null;
|
|
4508
4510
|
onRoomEvent = null;
|
package/dist/index.js
CHANGED
package/dist/runtime.cjs
CHANGED
|
@@ -41,11 +41,11 @@ __export(runtime_exports, {
|
|
|
41
41
|
MCP_TOOL_PREFIX: () => MCP_TOOL_PREFIX,
|
|
42
42
|
MEMORY_SECTION: () => MEMORY_SECTION,
|
|
43
43
|
MEMORY_TOOL_NAMES: () => MEMORY_TOOL_NAMES,
|
|
44
|
-
ParticipantRoster: () =>
|
|
44
|
+
ParticipantRoster: () => import_band_sdk_core6.ParticipantRoster,
|
|
45
45
|
PlatformRuntime: () => PlatformRuntime,
|
|
46
|
-
RetryTracker: () =>
|
|
46
|
+
RetryTracker: () => import_band_sdk_core6.RetryTracker,
|
|
47
47
|
RoomPresence: () => RoomPresence,
|
|
48
|
-
RoomRoster: () =>
|
|
48
|
+
RoomRoster: () => import_band_sdk_core6.RoomRoster,
|
|
49
49
|
SYNTHETIC_CONTACT_EVENTS_SENDER_ID: () => SYNTHETIC_CONTACT_EVENTS_SENDER_ID,
|
|
50
50
|
SYNTHETIC_CONTACT_EVENTS_SENDER_NAME: () => SYNTHETIC_CONTACT_EVENTS_SENDER_NAME,
|
|
51
51
|
SYNTHETIC_SENDER_TYPE: () => SYNTHETIC_SENDER_TYPE,
|
|
@@ -4435,6 +4435,7 @@ async function readResponseBody(response) {
|
|
|
4435
4435
|
}
|
|
4436
4436
|
|
|
4437
4437
|
// src/platform/streaming/PhoenixChannelsTransport.ts
|
|
4438
|
+
var import_band_sdk_core4 = require("@band-ai/band-sdk-core");
|
|
4438
4439
|
var PhoenixChannelsTransport = class {
|
|
4439
4440
|
socket;
|
|
4440
4441
|
agentId;
|
|
@@ -4701,7 +4702,7 @@ var PhoenixChannelsTransport = class {
|
|
|
4701
4702
|
if (!this.agentId) {
|
|
4702
4703
|
return;
|
|
4703
4704
|
}
|
|
4704
|
-
await this.join(
|
|
4705
|
+
await this.join((0, import_band_sdk_core4.agentControlTopic)(this.agentId), {
|
|
4705
4706
|
supersede: (payload) => {
|
|
4706
4707
|
const reason = parseSupersedeDisconnectReason(payload);
|
|
4707
4708
|
if (!reason) {
|
|
@@ -4802,6 +4803,7 @@ function getSocketChannelCount(socket) {
|
|
|
4802
4803
|
|
|
4803
4804
|
// src/platform/BandLink.ts
|
|
4804
4805
|
var import_rest_client = require("@band-ai/rest-client");
|
|
4806
|
+
var import_band_sdk_core5 = require("@band-ai/band-sdk-core");
|
|
4805
4807
|
var DEFAULT_WS_URL = "wss://app.band.ai/api/v1/socket";
|
|
4806
4808
|
function deriveDefaultRestUrl(wsUrl) {
|
|
4807
4809
|
const parsed = new URL(wsUrl);
|
|
@@ -4810,8 +4812,8 @@ function deriveDefaultRestUrl(wsUrl) {
|
|
|
4810
4812
|
}
|
|
4811
4813
|
function roomTopics(roomId) {
|
|
4812
4814
|
return {
|
|
4813
|
-
chat:
|
|
4814
|
-
participants:
|
|
4815
|
+
chat: (0, import_band_sdk_core5.chatRoomTopic)(roomId),
|
|
4816
|
+
participants: (0, import_band_sdk_core5.roomParticipantsTopic)(roomId)
|
|
4815
4817
|
};
|
|
4816
4818
|
}
|
|
4817
4819
|
function toPlatformMessage(roomId, message) {
|
|
@@ -4931,7 +4933,7 @@ var BandLink = class {
|
|
|
4931
4933
|
this.eventQueue.push(event);
|
|
4932
4934
|
}
|
|
4933
4935
|
async subscribeAgentRooms() {
|
|
4934
|
-
await this.transport.join(
|
|
4936
|
+
await this.transport.join((0, import_band_sdk_core5.agentRoomsTopic)(this.agentId), {
|
|
4935
4937
|
room_added: (payload) => {
|
|
4936
4938
|
const roomId = typeof payload.id === "string" ? payload.id : "";
|
|
4937
4939
|
this.emit("room_added", payload, roomId);
|
|
@@ -4984,7 +4986,7 @@ var BandLink = class {
|
|
|
4984
4986
|
}
|
|
4985
4987
|
async subscribeAgentContacts() {
|
|
4986
4988
|
assertCapability(this.capabilities, "contacts", "Contacts streaming");
|
|
4987
|
-
await this.transport.join(
|
|
4989
|
+
await this.transport.join((0, import_band_sdk_core5.agentContactsTopic)(this.agentId), {
|
|
4988
4990
|
contact_request_received: (payload) => {
|
|
4989
4991
|
this.emit("contact_request_received", payload, null);
|
|
4990
4992
|
},
|
|
@@ -5000,7 +5002,7 @@ var BandLink = class {
|
|
|
5000
5002
|
});
|
|
5001
5003
|
}
|
|
5002
5004
|
async unsubscribeAgentContacts() {
|
|
5003
|
-
await this.transport.leave(
|
|
5005
|
+
await this.transport.leave((0, import_band_sdk_core5.agentContactsTopic)(this.agentId));
|
|
5004
5006
|
}
|
|
5005
5007
|
async nextEvent(signal) {
|
|
5006
5008
|
if (this.terminalDisconnectError) {
|
|
@@ -5488,7 +5490,7 @@ var PlatformRuntime = class {
|
|
|
5488
5490
|
};
|
|
5489
5491
|
|
|
5490
5492
|
// src/runtime/index.ts
|
|
5491
|
-
var
|
|
5493
|
+
var import_band_sdk_core6 = require("@band-ai/band-sdk-core");
|
|
5492
5494
|
|
|
5493
5495
|
// src/runtime/prompts/base.ts
|
|
5494
5496
|
var ENVIRONMENT_SECTION = `
|
package/dist/runtime.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@band-ai/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Band TypeScript SDK core runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"node": ">=22.12"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@band-ai/band-sdk-core": "2.
|
|
91
|
+
"@band-ai/band-sdk-core": "2.4.0",
|
|
92
92
|
"@band-ai/rest-client": "0.0.118",
|
|
93
93
|
"js-yaml": "^4.1.1",
|
|
94
94
|
"phoenix": "^1.8.4",
|