@band-ai/sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ClaudeSDKAdapter-Cna5P1dR.d.ts → ClaudeSDKAdapter-CXud2DBE.d.ts} +2 -1
- package/dist/{ClaudeSDKAdapter-BY4zEbCl.d.cts → ClaudeSDKAdapter-Cx6zhSaG.d.cts} +2 -1
- package/dist/adapters.cjs +347 -172
- package/dist/adapters.d.cts +22 -5
- package/dist/adapters.d.ts +22 -5
- package/dist/adapters.js +204 -60
- package/dist/chunk-F63TPOI3.js +29 -0
- package/dist/{chunk-3BKAC4OZ.js → chunk-JADCAMZY.js} +8 -0
- package/dist/{chunk-N2QTUMGO.js → chunk-JJF44XWA.js} +365 -249
- package/dist/{chunk-TLBCKDQO.js → chunk-K5KAEYPF.js} +2 -2
- package/dist/{chunk-ZZJRRBPQ.js → chunk-KXJ74J73.js} +1 -1
- package/dist/{chunk-NMZLX7TP.js → chunk-MQBBWYRP.js} +52 -45
- package/dist/{chunk-RV76SKFT.js → chunk-MQY74R7D.js} +2 -20
- package/dist/{chunk-LBWKISBS.js → chunk-OH6VVVKT.js} +21 -0
- package/dist/{chunk-EAI2M3WM.js → chunk-W5IAI6Z4.js} +1 -1
- package/dist/{chunk-4IAXZBXX.js → chunk-WA7CHXUS.js} +2 -2
- package/dist/{chunk-NT7TBFX2.js → chunk-XWHWJP4I.js} +2 -2
- package/dist/{chunk-WLCM2OXG.js → chunk-YJ42AZO4.js} +1 -1
- package/dist/converters.js +6 -5
- package/dist/index.cjs +405 -277
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -11
- package/dist/mcp-claude.js +4 -3
- package/dist/mcp.js +5 -4
- package/dist/rest.js +3 -3
- package/dist/runtime.cjs +387 -362
- package/dist/runtime.d.cts +10 -39
- package/dist/runtime.d.ts +10 -39
- package/dist/runtime.js +20 -142
- package/dist/{schemas-BotL3ZLH.d.cts → schemas-BgJhlqqO.d.cts} +57 -13
- package/dist/{schemas-DBsC4J1g.d.ts → schemas-C4mK1WSs.d.ts} +57 -13
- package/dist/testing.cjs +11 -0
- package/dist/testing.js +8 -1
- package/dist/{types-D958TC71.d.cts → types-BNNtOXu3.d.cts} +1 -1
- package/dist/{types-BTN_ZETM.d.ts → types-DFUtpxah.d.ts} +1 -1
- package/package.json +2 -2
package/dist/runtime.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-
|
|
2
|
-
export { A as AgentConfig, b as ContactEventCallback, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler,
|
|
1
|
+
import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-BNNtOXu3.cjs';
|
|
2
|
+
export { A as AgentConfig, b as ContactEventCallback, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, j as SYNTHETIC_CONTACT_EVENTS_SENDER_ID, k as SYNTHETIC_CONTACT_EVENTS_SENDER_NAME, l as SYNTHETIC_SENDER_TYPE, S as SessionConfig, m as ensureHandlePrefix } from './types-BNNtOXu3.cjs';
|
|
3
3
|
import { L as Logger } from './logger-CABQOnlR.cjs';
|
|
4
4
|
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-Bz1rxcUg.cjs';
|
|
5
5
|
import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-BgYFd_Yw.cjs';
|
|
6
|
-
import { B as BandLink, c as ExecutionContext } from './schemas-
|
|
7
|
-
export { e as ALL_TOOL_NAMES, A as AgentRuntime, f as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, g as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, h as ExecutionState, M as MCP_SERVER_NAME, b as MCP_TOOL_PREFIX, i as MEMORY_TOOL_NAMES, P as PlatformRuntime, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-
|
|
8
|
-
import { M as MetadataMap, a as MentionInput, T as ToolOperationResult, c as PaginatedList, d as PeerRecord, P as ParticipantRecord, b as ToolSchemaRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, e as ListContactRequestsArgs, f as ContactRequestsResult, g as RespondContactRequestArgs, h as ListMemoriesArgs, i as MemoryRecord, S as StoreMemoryArgs, m as ToolModelMessage } from './dtos-B8KU_q4d.cjs';
|
|
6
|
+
import { B as BandLink, c as ExecutionContext } from './schemas-BgJhlqqO.cjs';
|
|
7
|
+
export { e as ALL_TOOL_NAMES, A as AgentRuntime, f as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, g as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, h as ExecutionState, M as MCP_SERVER_NAME, b as MCP_TOOL_PREFIX, i as MEMORY_TOOL_NAMES, P as PlatformRuntime, R as RoomPresence, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-BgJhlqqO.cjs';
|
|
9
8
|
import { ParticipantRoster } from '@band-ai/band-sdk-core';
|
|
10
|
-
export { ParticipantRoster, RetryTracker } from '@band-ai/band-sdk-core';
|
|
9
|
+
export { ParticipantRoster, RetryTracker, RoomMembership, RoomRoster } from '@band-ai/band-sdk-core';
|
|
10
|
+
import { a as MentionInput, T as ToolOperationResult, M as MetadataMap, c as PaginatedList, d as PeerRecord, P as ParticipantRecord, b as ToolSchemaRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, e as ListContactRequestsArgs, f as ContactRequestsResult, g as RespondContactRequestArgs, h as ListMemoriesArgs, i as MemoryRecord, S as StoreMemoryArgs, m as ToolModelMessage } from './dtos-B8KU_q4d.cjs';
|
|
11
11
|
import 'zod';
|
|
12
12
|
import './pagination-DqdkQArT.cjs';
|
|
13
13
|
import './disconnectReason-IuADl6TH.cjs';
|
|
@@ -99,43 +99,12 @@ declare class Execution {
|
|
|
99
99
|
private markMessageFailed;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
interface RoomPresenceOptions {
|
|
103
|
-
link: BandLink;
|
|
104
|
-
roomFilter?: (room: MetadataMap) => boolean;
|
|
105
|
-
autoSubscribeExistingRooms?: boolean;
|
|
106
|
-
logger?: Logger;
|
|
107
|
-
}
|
|
108
|
-
type RoomPresenceJoinHandler = (roomId: string, payload: MetadataMap) => Promise<void>;
|
|
109
|
-
type RoomPresenceLeaveHandler = (roomId: string) => Promise<void>;
|
|
110
|
-
type RoomPresenceEventHandler = (roomId: string, event: PlatformEvent) => Promise<void>;
|
|
111
|
-
type RoomPresenceContactHandler = (event: ContactEvent) => Promise<void>;
|
|
112
|
-
declare class RoomPresence {
|
|
113
|
-
readonly rooms: Set<string>;
|
|
114
|
-
onRoomJoined: RoomPresenceJoinHandler | null;
|
|
115
|
-
onRoomLeft: RoomPresenceLeaveHandler | null;
|
|
116
|
-
onRoomEvent: RoomPresenceEventHandler | null;
|
|
117
|
-
onContactEvent: RoomPresenceContactHandler | null;
|
|
118
|
-
private readonly link;
|
|
119
|
-
private readonly roomFilter?;
|
|
120
|
-
private readonly autoSubscribeExistingRooms;
|
|
121
|
-
private readonly logger;
|
|
122
|
-
private eventController;
|
|
123
|
-
private eventTask;
|
|
124
|
-
private contactsSubscribed;
|
|
125
|
-
constructor(options: RoomPresenceOptions);
|
|
126
|
-
start(): Promise<void>;
|
|
127
|
-
stop(): Promise<void>;
|
|
128
|
-
private consumeEvents;
|
|
129
|
-
private handleRoomAdded;
|
|
130
|
-
private handleRoomRemoved;
|
|
131
|
-
private subscribeExistingRooms;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
102
|
interface AgentToolsOptions {
|
|
135
103
|
roomId: string;
|
|
136
104
|
rest: AgentToolsRestApi;
|
|
137
105
|
roster?: ParticipantRoster;
|
|
138
106
|
capabilities?: Partial<AgentToolsCapabilities>;
|
|
107
|
+
logger?: Logger;
|
|
139
108
|
}
|
|
140
109
|
declare class AgentTools implements AgentToolsProtocol {
|
|
141
110
|
readonly roomId: string;
|
|
@@ -144,6 +113,7 @@ declare class AgentTools implements AgentToolsProtocol {
|
|
|
144
113
|
private readonly roster;
|
|
145
114
|
private readonly adapterTools;
|
|
146
115
|
private readonly toolHandlers;
|
|
116
|
+
private readonly logger;
|
|
147
117
|
constructor(options: AgentToolsOptions);
|
|
148
118
|
getAdapterTools(): AdapterToolsProtocol;
|
|
149
119
|
sendMessage(content: string, mentions?: MentionInput): Promise<ToolOperationResult>;
|
|
@@ -218,6 +188,7 @@ type ChatMessageType = (typeof CHAT_MESSAGE_TYPES)[number];
|
|
|
218
188
|
declare function isChatEventType(value: string): value is ChatEventType;
|
|
219
189
|
declare function assertChatEventType(value: string): asserts value is ChatEventType;
|
|
220
190
|
|
|
191
|
+
declare function mentionSubjectsFromMetadata(metadata: MetadataMap | undefined): Array<Record<string, unknown>>;
|
|
221
192
|
declare function replaceUuidMentions(content: string, participants: Array<Record<string, unknown>>): string;
|
|
222
193
|
declare function formatMessageForLlm(message: Record<string, unknown>, participants?: Array<Record<string, unknown>>): ToolModelMessage;
|
|
223
194
|
declare function formatHistoryForLlm(messages: Array<Record<string, unknown>>, options?: {
|
|
@@ -266,4 +237,4 @@ declare class GracefulShutdown {
|
|
|
266
237
|
}
|
|
267
238
|
declare function runWithGracefulShutdown(agent: StoppableAgent, options?: GracefulShutdownOptions): Promise<void>;
|
|
268
239
|
|
|
269
|
-
export { AgentTools, BASE_INSTRUCTIONS, CHAT_EVENT_TYPES, CHAT_MESSAGE_TYPES, type ChatEventType, type ChatMessageType, ContactEventConfig, ContactEventHandler, ContactToolsImpl, Execution, ExecutionContext, type ExecutionHandler, GracefulShutdown, HUB_ROOM_SYSTEM_PROMPT, MEMORY_SECTION, PlatformMessage, type RenderSystemPromptOptions,
|
|
240
|
+
export { AgentTools, BASE_INSTRUCTIONS, CHAT_EVENT_TYPES, CHAT_MESSAGE_TYPES, type ChatEventType, type ChatMessageType, ContactEventConfig, ContactEventHandler, ContactToolsImpl, Execution, ExecutionContext, type ExecutionHandler, GracefulShutdown, HUB_ROOM_SYSTEM_PROMPT, MEMORY_SECTION, PlatformMessage, type RenderSystemPromptOptions, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, mentionSubjectsFromMetadata, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-
|
|
2
|
-
export { A as AgentConfig, b as ContactEventCallback, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler,
|
|
1
|
+
import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-DFUtpxah.js';
|
|
2
|
+
export { A as AgentConfig, b as ContactEventCallback, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, j as SYNTHETIC_CONTACT_EVENTS_SENDER_ID, k as SYNTHETIC_CONTACT_EVENTS_SENDER_NAME, l as SYNTHETIC_SENDER_TYPE, S as SessionConfig, m as ensureHandlePrefix } from './types-DFUtpxah.js';
|
|
3
3
|
import { L as Logger } from './logger-CABQOnlR.js';
|
|
4
4
|
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-Bwwcql0h.js';
|
|
5
5
|
import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-BivGO7I9.js';
|
|
6
|
-
import { B as BandLink, c as ExecutionContext } from './schemas-
|
|
7
|
-
export { e as ALL_TOOL_NAMES, A as AgentRuntime, f as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, g as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, h as ExecutionState, M as MCP_SERVER_NAME, b as MCP_TOOL_PREFIX, i as MEMORY_TOOL_NAMES, P as PlatformRuntime, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-
|
|
8
|
-
import { M as MetadataMap, a as MentionInput, T as ToolOperationResult, c as PaginatedList, d as PeerRecord, P as ParticipantRecord, b as ToolSchemaRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, e as ListContactRequestsArgs, f as ContactRequestsResult, g as RespondContactRequestArgs, h as ListMemoriesArgs, i as MemoryRecord, S as StoreMemoryArgs, m as ToolModelMessage } from './dtos-B8KU_q4d.js';
|
|
6
|
+
import { B as BandLink, c as ExecutionContext } from './schemas-C4mK1WSs.js';
|
|
7
|
+
export { e as ALL_TOOL_NAMES, A as AgentRuntime, f as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, g as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, h as ExecutionState, M as MCP_SERVER_NAME, b as MCP_TOOL_PREFIX, i as MEMORY_TOOL_NAMES, P as PlatformRuntime, R as RoomPresence, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-C4mK1WSs.js';
|
|
9
8
|
import { ParticipantRoster } from '@band-ai/band-sdk-core';
|
|
10
|
-
export { ParticipantRoster, RetryTracker } from '@band-ai/band-sdk-core';
|
|
9
|
+
export { ParticipantRoster, RetryTracker, RoomMembership, RoomRoster } from '@band-ai/band-sdk-core';
|
|
10
|
+
import { a as MentionInput, T as ToolOperationResult, M as MetadataMap, c as PaginatedList, d as PeerRecord, P as ParticipantRecord, b as ToolSchemaRecord, L as ListContactsArgs, C as ContactRecord, A as AddContactArgs, R as RemoveContactArgs, e as ListContactRequestsArgs, f as ContactRequestsResult, g as RespondContactRequestArgs, h as ListMemoriesArgs, i as MemoryRecord, S as StoreMemoryArgs, m as ToolModelMessage } from './dtos-B8KU_q4d.js';
|
|
11
11
|
import 'zod';
|
|
12
12
|
import './pagination-BgEx-HeL.js';
|
|
13
13
|
import './disconnectReason-IuADl6TH.js';
|
|
@@ -99,43 +99,12 @@ declare class Execution {
|
|
|
99
99
|
private markMessageFailed;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
interface RoomPresenceOptions {
|
|
103
|
-
link: BandLink;
|
|
104
|
-
roomFilter?: (room: MetadataMap) => boolean;
|
|
105
|
-
autoSubscribeExistingRooms?: boolean;
|
|
106
|
-
logger?: Logger;
|
|
107
|
-
}
|
|
108
|
-
type RoomPresenceJoinHandler = (roomId: string, payload: MetadataMap) => Promise<void>;
|
|
109
|
-
type RoomPresenceLeaveHandler = (roomId: string) => Promise<void>;
|
|
110
|
-
type RoomPresenceEventHandler = (roomId: string, event: PlatformEvent) => Promise<void>;
|
|
111
|
-
type RoomPresenceContactHandler = (event: ContactEvent) => Promise<void>;
|
|
112
|
-
declare class RoomPresence {
|
|
113
|
-
readonly rooms: Set<string>;
|
|
114
|
-
onRoomJoined: RoomPresenceJoinHandler | null;
|
|
115
|
-
onRoomLeft: RoomPresenceLeaveHandler | null;
|
|
116
|
-
onRoomEvent: RoomPresenceEventHandler | null;
|
|
117
|
-
onContactEvent: RoomPresenceContactHandler | null;
|
|
118
|
-
private readonly link;
|
|
119
|
-
private readonly roomFilter?;
|
|
120
|
-
private readonly autoSubscribeExistingRooms;
|
|
121
|
-
private readonly logger;
|
|
122
|
-
private eventController;
|
|
123
|
-
private eventTask;
|
|
124
|
-
private contactsSubscribed;
|
|
125
|
-
constructor(options: RoomPresenceOptions);
|
|
126
|
-
start(): Promise<void>;
|
|
127
|
-
stop(): Promise<void>;
|
|
128
|
-
private consumeEvents;
|
|
129
|
-
private handleRoomAdded;
|
|
130
|
-
private handleRoomRemoved;
|
|
131
|
-
private subscribeExistingRooms;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
102
|
interface AgentToolsOptions {
|
|
135
103
|
roomId: string;
|
|
136
104
|
rest: AgentToolsRestApi;
|
|
137
105
|
roster?: ParticipantRoster;
|
|
138
106
|
capabilities?: Partial<AgentToolsCapabilities>;
|
|
107
|
+
logger?: Logger;
|
|
139
108
|
}
|
|
140
109
|
declare class AgentTools implements AgentToolsProtocol {
|
|
141
110
|
readonly roomId: string;
|
|
@@ -144,6 +113,7 @@ declare class AgentTools implements AgentToolsProtocol {
|
|
|
144
113
|
private readonly roster;
|
|
145
114
|
private readonly adapterTools;
|
|
146
115
|
private readonly toolHandlers;
|
|
116
|
+
private readonly logger;
|
|
147
117
|
constructor(options: AgentToolsOptions);
|
|
148
118
|
getAdapterTools(): AdapterToolsProtocol;
|
|
149
119
|
sendMessage(content: string, mentions?: MentionInput): Promise<ToolOperationResult>;
|
|
@@ -218,6 +188,7 @@ type ChatMessageType = (typeof CHAT_MESSAGE_TYPES)[number];
|
|
|
218
188
|
declare function isChatEventType(value: string): value is ChatEventType;
|
|
219
189
|
declare function assertChatEventType(value: string): asserts value is ChatEventType;
|
|
220
190
|
|
|
191
|
+
declare function mentionSubjectsFromMetadata(metadata: MetadataMap | undefined): Array<Record<string, unknown>>;
|
|
221
192
|
declare function replaceUuidMentions(content: string, participants: Array<Record<string, unknown>>): string;
|
|
222
193
|
declare function formatMessageForLlm(message: Record<string, unknown>, participants?: Array<Record<string, unknown>>): ToolModelMessage;
|
|
223
194
|
declare function formatHistoryForLlm(messages: Array<Record<string, unknown>>, options?: {
|
|
@@ -266,4 +237,4 @@ declare class GracefulShutdown {
|
|
|
266
237
|
}
|
|
267
238
|
declare function runWithGracefulShutdown(agent: StoppableAgent, options?: GracefulShutdownOptions): Promise<void>;
|
|
268
239
|
|
|
269
|
-
export { AgentTools, BASE_INSTRUCTIONS, CHAT_EVENT_TYPES, CHAT_MESSAGE_TYPES, type ChatEventType, type ChatMessageType, ContactEventConfig, ContactEventHandler, ContactToolsImpl, Execution, ExecutionContext, type ExecutionHandler, GracefulShutdown, HUB_ROOM_SYSTEM_PROMPT, MEMORY_SECTION, PlatformMessage, type RenderSystemPromptOptions,
|
|
240
|
+
export { AgentTools, BASE_INSTRUCTIONS, CHAT_EVENT_TYPES, CHAT_MESSAGE_TYPES, type ChatEventType, type ChatMessageType, ContactEventConfig, ContactEventHandler, ContactToolsImpl, Execution, ExecutionContext, type ExecutionHandler, GracefulShutdown, HUB_ROOM_SYSTEM_PROMPT, MEMORY_SECTION, PlatformMessage, type RenderSystemPromptOptions, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, mentionSubjectsFromMetadata, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
|
package/dist/runtime.js
CHANGED
|
@@ -9,11 +9,9 @@ import {
|
|
|
9
9
|
GracefulShutdown,
|
|
10
10
|
HUB_ROOM_SYSTEM_PROMPT,
|
|
11
11
|
PlatformRuntime,
|
|
12
|
-
|
|
13
|
-
runWithGracefulShutdown
|
|
14
|
-
|
|
15
|
-
trackRoomLeave
|
|
16
|
-
} from "./chunk-N2QTUMGO.js";
|
|
12
|
+
RoomPresence,
|
|
13
|
+
runWithGracefulShutdown
|
|
14
|
+
} from "./chunk-JJF44XWA.js";
|
|
17
15
|
import {
|
|
18
16
|
HistoryProvider,
|
|
19
17
|
SYNTHETIC_CONTACT_EVENTS_SENDER_ID,
|
|
@@ -23,164 +21,42 @@ import {
|
|
|
23
21
|
ensureHandlePrefix,
|
|
24
22
|
formatHistoryForLlm,
|
|
25
23
|
formatMessageForLlm,
|
|
24
|
+
mentionSubjectsFromMetadata,
|
|
26
25
|
replaceUuidMentions
|
|
27
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OH6VVVKT.js";
|
|
28
27
|
import {
|
|
29
28
|
BASE_INSTRUCTIONS,
|
|
30
29
|
MEMORY_SECTION,
|
|
31
30
|
TEMPLATES,
|
|
32
31
|
renderSystemPrompt
|
|
33
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-YJ42AZO4.js";
|
|
34
33
|
import {
|
|
35
34
|
ALL_TOOL_NAMES,
|
|
36
35
|
BASE_TOOL_NAMES,
|
|
37
|
-
CHAT_EVENT_TYPES,
|
|
38
|
-
CHAT_MESSAGE_TYPES,
|
|
39
36
|
CHAT_TOOL_NAMES,
|
|
40
37
|
CONTACT_TOOL_NAMES,
|
|
41
38
|
MCP_SERVER_NAME,
|
|
42
39
|
MCP_TOOL_PREFIX,
|
|
43
40
|
MEMORY_TOOL_NAMES,
|
|
44
41
|
TOOL_MODELS,
|
|
45
|
-
assertChatEventType,
|
|
46
42
|
getToolDescription,
|
|
47
|
-
isChatEventType,
|
|
48
43
|
mcpToolNames
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-US226AS4.js";
|
|
44
|
+
} from "./chunk-MQY74R7D.js";
|
|
51
45
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
CHAT_EVENT_TYPES,
|
|
47
|
+
CHAT_MESSAGE_TYPES,
|
|
48
|
+
assertChatEventType,
|
|
49
|
+
isChatEventType
|
|
50
|
+
} from "./chunk-F63TPOI3.js";
|
|
51
|
+
import "./chunk-US226AS4.js";
|
|
52
|
+
import "./chunk-W5IAI6Z4.js";
|
|
53
|
+
import "./chunk-KXJ74J73.js";
|
|
54
|
+
import "./chunk-JADCAMZY.js";
|
|
55
|
+
import "./chunk-OD2G5LFQ.js";
|
|
59
56
|
import "./chunk-JY75VSQK.js";
|
|
60
57
|
|
|
61
|
-
// src/runtime/rooms/RoomPresence.ts
|
|
62
|
-
var RoomPresence = class {
|
|
63
|
-
rooms = /* @__PURE__ */ new Set();
|
|
64
|
-
onRoomJoined = null;
|
|
65
|
-
onRoomLeft = null;
|
|
66
|
-
onRoomEvent = null;
|
|
67
|
-
onContactEvent = null;
|
|
68
|
-
link;
|
|
69
|
-
roomFilter;
|
|
70
|
-
autoSubscribeExistingRooms;
|
|
71
|
-
logger;
|
|
72
|
-
eventController = null;
|
|
73
|
-
eventTask = null;
|
|
74
|
-
contactsSubscribed = false;
|
|
75
|
-
constructor(options) {
|
|
76
|
-
this.link = options.link;
|
|
77
|
-
this.roomFilter = options.roomFilter;
|
|
78
|
-
this.autoSubscribeExistingRooms = options.autoSubscribeExistingRooms ?? true;
|
|
79
|
-
this.logger = options.logger ?? new NoopLogger();
|
|
80
|
-
}
|
|
81
|
-
async start() {
|
|
82
|
-
if (this.eventTask) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (!this.link.isConnected()) {
|
|
86
|
-
await this.link.connect();
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
await this.link.subscribeAgentRooms();
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
if (this.autoSubscribeExistingRooms) {
|
|
93
|
-
await this.subscribeExistingRooms();
|
|
94
|
-
}
|
|
95
|
-
if (this.link.capabilities.contacts) {
|
|
96
|
-
await this.link.subscribeAgentContacts();
|
|
97
|
-
this.contactsSubscribed = true;
|
|
98
|
-
}
|
|
99
|
-
this.eventController = new AbortController();
|
|
100
|
-
this.eventTask = this.consumeEvents(this.eventController.signal);
|
|
101
|
-
}
|
|
102
|
-
async stop() {
|
|
103
|
-
this.eventController?.abort();
|
|
104
|
-
await this.eventTask;
|
|
105
|
-
this.eventTask = null;
|
|
106
|
-
this.eventController = null;
|
|
107
|
-
if (this.contactsSubscribed) {
|
|
108
|
-
await this.link.unsubscribeAgentContacts();
|
|
109
|
-
this.contactsSubscribed = false;
|
|
110
|
-
}
|
|
111
|
-
for (const roomId of [...this.rooms]) {
|
|
112
|
-
await trackRoomLeave({
|
|
113
|
-
link: this.link,
|
|
114
|
-
roomId,
|
|
115
|
-
trackedRooms: this.rooms,
|
|
116
|
-
onLeft: this.onRoomLeft ?? void 0
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async consumeEvents(signal) {
|
|
121
|
-
while (!signal.aborted) {
|
|
122
|
-
const event = await this.link.nextEvent(signal);
|
|
123
|
-
if (!event) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
switch (event.type) {
|
|
127
|
-
case "room_added":
|
|
128
|
-
await this.handleRoomAdded(event.roomId, event.payload);
|
|
129
|
-
break;
|
|
130
|
-
case "room_removed":
|
|
131
|
-
case "room_deleted":
|
|
132
|
-
await this.handleRoomRemoved(event.roomId);
|
|
133
|
-
break;
|
|
134
|
-
case "contact_request_received":
|
|
135
|
-
case "contact_request_updated":
|
|
136
|
-
case "contact_added":
|
|
137
|
-
case "contact_removed":
|
|
138
|
-
await this.onContactEvent?.(event);
|
|
139
|
-
break;
|
|
140
|
-
default:
|
|
141
|
-
if (event.roomId && this.rooms.has(event.roomId)) {
|
|
142
|
-
await this.onRoomEvent?.(event.roomId, event);
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
async handleRoomAdded(roomId, payload) {
|
|
149
|
-
await trackRoomJoin({
|
|
150
|
-
link: this.link,
|
|
151
|
-
roomId,
|
|
152
|
-
payload,
|
|
153
|
-
trackedRooms: this.rooms,
|
|
154
|
-
roomFilter: this.roomFilter,
|
|
155
|
-
onJoined: this.onRoomJoined ?? void 0
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
async handleRoomRemoved(roomId) {
|
|
159
|
-
await trackRoomLeave({
|
|
160
|
-
link: this.link,
|
|
161
|
-
roomId,
|
|
162
|
-
trackedRooms: this.rooms,
|
|
163
|
-
onLeft: this.onRoomLeft ?? void 0
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
async subscribeExistingRooms() {
|
|
167
|
-
await hydrateTrackedRooms({
|
|
168
|
-
link: this.link,
|
|
169
|
-
trackedRooms: this.rooms,
|
|
170
|
-
requestOptions: DEFAULT_REQUEST_OPTIONS,
|
|
171
|
-
roomFilter: this.roomFilter,
|
|
172
|
-
onJoined: this.onRoomJoined ?? void 0,
|
|
173
|
-
onError: async (error) => {
|
|
174
|
-
this.logger.warn("RoomPresence failed to subscribe existing rooms", {
|
|
175
|
-
error
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
|
|
182
58
|
// src/runtime/index.ts
|
|
183
|
-
import { ParticipantRoster, RetryTracker } from "@band-ai/band-sdk-core";
|
|
59
|
+
import { ParticipantRoster, RetryTracker, RoomRoster } from "@band-ai/band-sdk-core";
|
|
184
60
|
export {
|
|
185
61
|
ALL_TOOL_NAMES,
|
|
186
62
|
AgentRuntime,
|
|
@@ -207,6 +83,7 @@ export {
|
|
|
207
83
|
PlatformRuntime,
|
|
208
84
|
RetryTracker,
|
|
209
85
|
RoomPresence,
|
|
86
|
+
RoomRoster,
|
|
210
87
|
SYNTHETIC_CONTACT_EVENTS_SENDER_ID,
|
|
211
88
|
SYNTHETIC_CONTACT_EVENTS_SENDER_NAME,
|
|
212
89
|
SYNTHETIC_SENDER_TYPE,
|
|
@@ -220,6 +97,7 @@ export {
|
|
|
220
97
|
getToolDescription,
|
|
221
98
|
isChatEventType,
|
|
222
99
|
mcpToolNames,
|
|
100
|
+
mentionSubjectsFromMetadata,
|
|
223
101
|
renderSystemPrompt,
|
|
224
102
|
replaceUuidMentions,
|
|
225
103
|
runWithGracefulShutdown
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { h as AgentToolsCapabilities, g as PlatformMessageLike, A as AdapterToolsProtocol, e as Preprocessor, F as FrameworkAdapter, i as PreprocessorContext } from './protocols-Bz1rxcUg.cjs';
|
|
2
|
-
import { f as PlatformEvent, P as PlatformMessage, e as ConversationContext, S as SessionConfig, c as ContactEventConfig, A as AgentConfig, C as ContactEvent, a as AgentInput } from './types-
|
|
2
|
+
import { f as PlatformEvent, P as PlatformMessage, e as ConversationContext, S as SessionConfig, c as ContactEventConfig, A as AgentConfig, g as MessageEvent, h as ParticipantAddedEvent, i as ParticipantRemovedEvent, C as ContactEvent, a as AgentInput } from './types-BNNtOXu3.cjs';
|
|
3
3
|
import { M as MetadataMap, P as ParticipantRecord } from './dtos-B8KU_q4d.cjs';
|
|
4
4
|
import { L as Logger } from './logger-CABQOnlR.cjs';
|
|
5
5
|
import { B as BandLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-BgYFd_Yw.cjs';
|
|
6
6
|
import { P as PaginationOptions } from './pagination-DqdkQArT.cjs';
|
|
7
7
|
import { W as WebSocketConflictPolicy, b as WebSocketDisconnectReason } from './disconnectReason-IuADl6TH.cjs';
|
|
8
|
-
import { RetryTracker } from '@band-ai/band-sdk-core';
|
|
8
|
+
import { RetryTracker, RoomRoster } from '@band-ai/band-sdk-core';
|
|
9
9
|
|
|
10
10
|
interface TopicHandlers {
|
|
11
11
|
[event: string]: (payload: Record<string, unknown>) => Promise<void> | void;
|
|
@@ -93,6 +93,7 @@ interface ExecutionContextOptions {
|
|
|
93
93
|
enableContextCache?: boolean;
|
|
94
94
|
contextCacheTtlSeconds?: number;
|
|
95
95
|
enableContextHydration?: boolean;
|
|
96
|
+
logger?: Logger;
|
|
96
97
|
}
|
|
97
98
|
declare class ExecutionContext {
|
|
98
99
|
readonly roomId: string;
|
|
@@ -167,7 +168,7 @@ interface PlatformRuntimeOptions {
|
|
|
167
168
|
description?: string | null;
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
|
-
declare class PlatformRuntime {
|
|
171
|
+
declare class PlatformRuntime implements AsyncDisposable {
|
|
171
172
|
private readonly _agentId;
|
|
172
173
|
private readonly _apiKey;
|
|
173
174
|
private readonly _wsUrl?;
|
|
@@ -203,6 +204,7 @@ declare class PlatformRuntime {
|
|
|
203
204
|
private doInitialize;
|
|
204
205
|
start(adapter: FrameworkAdapter): Promise<void>;
|
|
205
206
|
stop(timeoutMs?: number): Promise<boolean>;
|
|
207
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
206
208
|
runForever(): Promise<void>;
|
|
207
209
|
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
208
210
|
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
@@ -210,6 +212,55 @@ declare class PlatformRuntime {
|
|
|
210
212
|
private handleContactEvent;
|
|
211
213
|
}
|
|
212
214
|
|
|
215
|
+
interface RoomPresenceOptions {
|
|
216
|
+
link: BandLink;
|
|
217
|
+
roomFilter?: (room: MetadataMap) => boolean;
|
|
218
|
+
autoSubscribeExistingRooms?: boolean;
|
|
219
|
+
logger?: Logger;
|
|
220
|
+
}
|
|
221
|
+
type RoomPresenceJoinHandler = (roomId: string, payload: MetadataMap) => Promise<void>;
|
|
222
|
+
type RoomPresenceLeaveHandler = (roomId: string) => Promise<void>;
|
|
223
|
+
type RoomPresenceEventHandler = (roomId: string, event: MessageEvent | ParticipantAddedEvent | ParticipantRemovedEvent) => Promise<void>;
|
|
224
|
+
type RoomPresenceContactHandler = (event: ContactEvent) => Promise<void>;
|
|
225
|
+
declare class RoomPresence implements AsyncDisposable {
|
|
226
|
+
readonly roster: RoomRoster;
|
|
227
|
+
onRoomJoined: RoomPresenceJoinHandler | null;
|
|
228
|
+
onRoomLeft: RoomPresenceLeaveHandler | null;
|
|
229
|
+
onRoomEvent: RoomPresenceEventHandler | null;
|
|
230
|
+
onContactEvent: RoomPresenceContactHandler | null;
|
|
231
|
+
private readonly link;
|
|
232
|
+
private readonly roomFilter?;
|
|
233
|
+
private readonly autoSubscribeExistingRooms;
|
|
234
|
+
private readonly logger;
|
|
235
|
+
private eventController;
|
|
236
|
+
private eventTask;
|
|
237
|
+
private contactsSubscribed;
|
|
238
|
+
private lifecycle;
|
|
239
|
+
private readonly admissionInFlight;
|
|
240
|
+
private readonly lastSubscribeError;
|
|
241
|
+
constructor(options: RoomPresenceOptions);
|
|
242
|
+
start(): Promise<void>;
|
|
243
|
+
stop(): Promise<void>;
|
|
244
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
245
|
+
abortEventLoop(): void;
|
|
246
|
+
waitUntilStopped(): Promise<void>;
|
|
247
|
+
admitRoom(roomId: string, payload: MetadataMap, notify?: boolean): Promise<boolean>;
|
|
248
|
+
/** Admit a room for a caller that needs to know *why* a failed subscribe happened, not just that it did. */
|
|
249
|
+
admitRoomOrThrow(roomId: string): Promise<void>;
|
|
250
|
+
private awaitInFlightAdmission;
|
|
251
|
+
private performAdmission;
|
|
252
|
+
private completeAdmission;
|
|
253
|
+
private serialize;
|
|
254
|
+
private startBody;
|
|
255
|
+
private subscribeContacts;
|
|
256
|
+
private stopBody;
|
|
257
|
+
private consumeEvents;
|
|
258
|
+
private handleRoomAdded;
|
|
259
|
+
private handleRoomRemoved;
|
|
260
|
+
private unsubscribeRoom;
|
|
261
|
+
private subscribeExistingRooms;
|
|
262
|
+
}
|
|
263
|
+
|
|
213
264
|
interface AgentRuntimeOptions {
|
|
214
265
|
link: BandLink;
|
|
215
266
|
agentId: string;
|
|
@@ -228,6 +279,7 @@ interface AgentRuntimeOptions {
|
|
|
228
279
|
logger?: Logger;
|
|
229
280
|
}
|
|
230
281
|
declare class AgentRuntime {
|
|
282
|
+
readonly presence: RoomPresence;
|
|
231
283
|
private readonly link;
|
|
232
284
|
private readonly agentId;
|
|
233
285
|
private readonly onExecute;
|
|
@@ -238,19 +290,14 @@ declare class AgentRuntime {
|
|
|
238
290
|
private readonly onParticipantAdded?;
|
|
239
291
|
private readonly onParticipantRemoved?;
|
|
240
292
|
private readonly onError?;
|
|
241
|
-
private readonly roomFilter?;
|
|
242
293
|
private readonly contextFactory?;
|
|
243
294
|
private readonly sessionConfig;
|
|
244
|
-
private readonly autoSubscribeExistingRooms;
|
|
245
|
-
private readonly subscribedRooms;
|
|
246
295
|
private readonly contexts;
|
|
247
296
|
private readonly executions;
|
|
248
297
|
private readonly executionWatchers;
|
|
249
298
|
private readonly logger;
|
|
250
299
|
private running;
|
|
251
300
|
private stopping;
|
|
252
|
-
private stopController;
|
|
253
|
-
private consumeTask;
|
|
254
301
|
private fatalError;
|
|
255
302
|
constructor(options: AgentRuntimeOptions);
|
|
256
303
|
start(): Promise<void>;
|
|
@@ -259,15 +306,12 @@ declare class AgentRuntime {
|
|
|
259
306
|
getContext(roomId: string): ExecutionContext | undefined;
|
|
260
307
|
waitUntilStopped(): Promise<void>;
|
|
261
308
|
getContexts(): ExecutionContext[];
|
|
262
|
-
private consumeLoop;
|
|
263
|
-
private handleEvent;
|
|
264
309
|
enqueueEvent(roomId: string, event: PlatformEvent): Promise<void>;
|
|
265
310
|
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
266
311
|
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
312
|
+
private teardownExecution;
|
|
267
313
|
private getOrCreateExecution;
|
|
268
314
|
getOrCreateContext(roomId: string): ExecutionContext;
|
|
269
|
-
private subscribeExistingRooms;
|
|
270
|
-
private leaveTrackedRoom;
|
|
271
315
|
private failRuntime;
|
|
272
316
|
private notifyOnError;
|
|
273
317
|
}
|
|
@@ -584,4 +628,4 @@ declare const MCP_SERVER_NAME = "band";
|
|
|
584
628
|
declare function mcpToolNames(names: Set<string>): string[];
|
|
585
629
|
declare function getToolDescription(name: string): string;
|
|
586
630
|
|
|
587
|
-
export { AgentRuntime as A, BandLink as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_SERVER_NAME as M, PlatformRuntime as P, TOOL_MODELS as T, type PlatformRuntimeOptions as a, MCP_TOOL_PREFIX as b, ExecutionContext as c, deriveDefaultRestUrl as d, ALL_TOOL_NAMES as e, BASE_TOOL_NAMES as f, CONTACT_TOOL_NAMES as g, type ExecutionState as h, MEMORY_TOOL_NAMES as i, getToolDescription as j, mcpToolNames as m };
|
|
631
|
+
export { AgentRuntime as A, BandLink as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_SERVER_NAME as M, PlatformRuntime as P, RoomPresence as R, TOOL_MODELS as T, type PlatformRuntimeOptions as a, MCP_TOOL_PREFIX as b, ExecutionContext as c, deriveDefaultRestUrl as d, ALL_TOOL_NAMES as e, BASE_TOOL_NAMES as f, CONTACT_TOOL_NAMES as g, type ExecutionState as h, MEMORY_TOOL_NAMES as i, getToolDescription as j, mcpToolNames as m };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { h as AgentToolsCapabilities, g as PlatformMessageLike, A as AdapterToolsProtocol, e as Preprocessor, F as FrameworkAdapter, i as PreprocessorContext } from './protocols-Bwwcql0h.js';
|
|
2
|
-
import { f as PlatformEvent, P as PlatformMessage, e as ConversationContext, S as SessionConfig, c as ContactEventConfig, A as AgentConfig, C as ContactEvent, a as AgentInput } from './types-
|
|
2
|
+
import { f as PlatformEvent, P as PlatformMessage, e as ConversationContext, S as SessionConfig, c as ContactEventConfig, A as AgentConfig, g as MessageEvent, h as ParticipantAddedEvent, i as ParticipantRemovedEvent, C as ContactEvent, a as AgentInput } from './types-DFUtpxah.js';
|
|
3
3
|
import { M as MetadataMap, P as ParticipantRecord } from './dtos-B8KU_q4d.js';
|
|
4
4
|
import { L as Logger } from './logger-CABQOnlR.js';
|
|
5
5
|
import { B as BandLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-BivGO7I9.js';
|
|
6
6
|
import { P as PaginationOptions } from './pagination-BgEx-HeL.js';
|
|
7
7
|
import { W as WebSocketConflictPolicy, b as WebSocketDisconnectReason } from './disconnectReason-IuADl6TH.js';
|
|
8
|
-
import { RetryTracker } from '@band-ai/band-sdk-core';
|
|
8
|
+
import { RetryTracker, RoomRoster } from '@band-ai/band-sdk-core';
|
|
9
9
|
|
|
10
10
|
interface TopicHandlers {
|
|
11
11
|
[event: string]: (payload: Record<string, unknown>) => Promise<void> | void;
|
|
@@ -93,6 +93,7 @@ interface ExecutionContextOptions {
|
|
|
93
93
|
enableContextCache?: boolean;
|
|
94
94
|
contextCacheTtlSeconds?: number;
|
|
95
95
|
enableContextHydration?: boolean;
|
|
96
|
+
logger?: Logger;
|
|
96
97
|
}
|
|
97
98
|
declare class ExecutionContext {
|
|
98
99
|
readonly roomId: string;
|
|
@@ -167,7 +168,7 @@ interface PlatformRuntimeOptions {
|
|
|
167
168
|
description?: string | null;
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
|
-
declare class PlatformRuntime {
|
|
171
|
+
declare class PlatformRuntime implements AsyncDisposable {
|
|
171
172
|
private readonly _agentId;
|
|
172
173
|
private readonly _apiKey;
|
|
173
174
|
private readonly _wsUrl?;
|
|
@@ -203,6 +204,7 @@ declare class PlatformRuntime {
|
|
|
203
204
|
private doInitialize;
|
|
204
205
|
start(adapter: FrameworkAdapter): Promise<void>;
|
|
205
206
|
stop(timeoutMs?: number): Promise<boolean>;
|
|
207
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
206
208
|
runForever(): Promise<void>;
|
|
207
209
|
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
208
210
|
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
@@ -210,6 +212,55 @@ declare class PlatformRuntime {
|
|
|
210
212
|
private handleContactEvent;
|
|
211
213
|
}
|
|
212
214
|
|
|
215
|
+
interface RoomPresenceOptions {
|
|
216
|
+
link: BandLink;
|
|
217
|
+
roomFilter?: (room: MetadataMap) => boolean;
|
|
218
|
+
autoSubscribeExistingRooms?: boolean;
|
|
219
|
+
logger?: Logger;
|
|
220
|
+
}
|
|
221
|
+
type RoomPresenceJoinHandler = (roomId: string, payload: MetadataMap) => Promise<void>;
|
|
222
|
+
type RoomPresenceLeaveHandler = (roomId: string) => Promise<void>;
|
|
223
|
+
type RoomPresenceEventHandler = (roomId: string, event: MessageEvent | ParticipantAddedEvent | ParticipantRemovedEvent) => Promise<void>;
|
|
224
|
+
type RoomPresenceContactHandler = (event: ContactEvent) => Promise<void>;
|
|
225
|
+
declare class RoomPresence implements AsyncDisposable {
|
|
226
|
+
readonly roster: RoomRoster;
|
|
227
|
+
onRoomJoined: RoomPresenceJoinHandler | null;
|
|
228
|
+
onRoomLeft: RoomPresenceLeaveHandler | null;
|
|
229
|
+
onRoomEvent: RoomPresenceEventHandler | null;
|
|
230
|
+
onContactEvent: RoomPresenceContactHandler | null;
|
|
231
|
+
private readonly link;
|
|
232
|
+
private readonly roomFilter?;
|
|
233
|
+
private readonly autoSubscribeExistingRooms;
|
|
234
|
+
private readonly logger;
|
|
235
|
+
private eventController;
|
|
236
|
+
private eventTask;
|
|
237
|
+
private contactsSubscribed;
|
|
238
|
+
private lifecycle;
|
|
239
|
+
private readonly admissionInFlight;
|
|
240
|
+
private readonly lastSubscribeError;
|
|
241
|
+
constructor(options: RoomPresenceOptions);
|
|
242
|
+
start(): Promise<void>;
|
|
243
|
+
stop(): Promise<void>;
|
|
244
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
245
|
+
abortEventLoop(): void;
|
|
246
|
+
waitUntilStopped(): Promise<void>;
|
|
247
|
+
admitRoom(roomId: string, payload: MetadataMap, notify?: boolean): Promise<boolean>;
|
|
248
|
+
/** Admit a room for a caller that needs to know *why* a failed subscribe happened, not just that it did. */
|
|
249
|
+
admitRoomOrThrow(roomId: string): Promise<void>;
|
|
250
|
+
private awaitInFlightAdmission;
|
|
251
|
+
private performAdmission;
|
|
252
|
+
private completeAdmission;
|
|
253
|
+
private serialize;
|
|
254
|
+
private startBody;
|
|
255
|
+
private subscribeContacts;
|
|
256
|
+
private stopBody;
|
|
257
|
+
private consumeEvents;
|
|
258
|
+
private handleRoomAdded;
|
|
259
|
+
private handleRoomRemoved;
|
|
260
|
+
private unsubscribeRoom;
|
|
261
|
+
private subscribeExistingRooms;
|
|
262
|
+
}
|
|
263
|
+
|
|
213
264
|
interface AgentRuntimeOptions {
|
|
214
265
|
link: BandLink;
|
|
215
266
|
agentId: string;
|
|
@@ -228,6 +279,7 @@ interface AgentRuntimeOptions {
|
|
|
228
279
|
logger?: Logger;
|
|
229
280
|
}
|
|
230
281
|
declare class AgentRuntime {
|
|
282
|
+
readonly presence: RoomPresence;
|
|
231
283
|
private readonly link;
|
|
232
284
|
private readonly agentId;
|
|
233
285
|
private readonly onExecute;
|
|
@@ -238,19 +290,14 @@ declare class AgentRuntime {
|
|
|
238
290
|
private readonly onParticipantAdded?;
|
|
239
291
|
private readonly onParticipantRemoved?;
|
|
240
292
|
private readonly onError?;
|
|
241
|
-
private readonly roomFilter?;
|
|
242
293
|
private readonly contextFactory?;
|
|
243
294
|
private readonly sessionConfig;
|
|
244
|
-
private readonly autoSubscribeExistingRooms;
|
|
245
|
-
private readonly subscribedRooms;
|
|
246
295
|
private readonly contexts;
|
|
247
296
|
private readonly executions;
|
|
248
297
|
private readonly executionWatchers;
|
|
249
298
|
private readonly logger;
|
|
250
299
|
private running;
|
|
251
300
|
private stopping;
|
|
252
|
-
private stopController;
|
|
253
|
-
private consumeTask;
|
|
254
301
|
private fatalError;
|
|
255
302
|
constructor(options: AgentRuntimeOptions);
|
|
256
303
|
start(): Promise<void>;
|
|
@@ -259,15 +306,12 @@ declare class AgentRuntime {
|
|
|
259
306
|
getContext(roomId: string): ExecutionContext | undefined;
|
|
260
307
|
waitUntilStopped(): Promise<void>;
|
|
261
308
|
getContexts(): ExecutionContext[];
|
|
262
|
-
private consumeLoop;
|
|
263
|
-
private handleEvent;
|
|
264
309
|
enqueueEvent(roomId: string, event: PlatformEvent): Promise<void>;
|
|
265
310
|
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
266
311
|
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
312
|
+
private teardownExecution;
|
|
267
313
|
private getOrCreateExecution;
|
|
268
314
|
getOrCreateContext(roomId: string): ExecutionContext;
|
|
269
|
-
private subscribeExistingRooms;
|
|
270
|
-
private leaveTrackedRoom;
|
|
271
315
|
private failRuntime;
|
|
272
316
|
private notifyOnError;
|
|
273
317
|
}
|
|
@@ -584,4 +628,4 @@ declare const MCP_SERVER_NAME = "band";
|
|
|
584
628
|
declare function mcpToolNames(names: Set<string>): string[];
|
|
585
629
|
declare function getToolDescription(name: string): string;
|
|
586
630
|
|
|
587
|
-
export { AgentRuntime as A, BandLink as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_SERVER_NAME as M, PlatformRuntime as P, TOOL_MODELS as T, type PlatformRuntimeOptions as a, MCP_TOOL_PREFIX as b, ExecutionContext as c, deriveDefaultRestUrl as d, ALL_TOOL_NAMES as e, BASE_TOOL_NAMES as f, CONTACT_TOOL_NAMES as g, type ExecutionState as h, MEMORY_TOOL_NAMES as i, getToolDescription as j, mcpToolNames as m };
|
|
631
|
+
export { AgentRuntime as A, BandLink as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_SERVER_NAME as M, PlatformRuntime as P, RoomPresence as R, TOOL_MODELS as T, type PlatformRuntimeOptions as a, MCP_TOOL_PREFIX as b, ExecutionContext as c, deriveDefaultRestUrl as d, ALL_TOOL_NAMES as e, BASE_TOOL_NAMES as f, CONTACT_TOOL_NAMES as g, type ExecutionState as h, MEMORY_TOOL_NAMES as i, getToolDescription as j, mcpToolNames as m };
|