@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
package/dist/runtime.d.cts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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, h as SYNTHETIC_CONTACT_EVENTS_SENDER_ID, i as SYNTHETIC_CONTACT_EVENTS_SENDER_NAME, j as SYNTHETIC_SENDER_TYPE, S as SessionConfig, k as ensureHandlePrefix } from './types-
|
|
1
|
+
import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-D958TC71.cjs';
|
|
2
|
+
export { A as AgentConfig, b as ContactEventCallback, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, h as SYNTHETIC_CONTACT_EVENTS_SENDER_ID, i as SYNTHETIC_CONTACT_EVENTS_SENDER_NAME, j as SYNTHETIC_SENDER_TYPE, S as SessionConfig, k as ensureHandlePrefix } from './types-D958TC71.cjs';
|
|
3
3
|
import { L as Logger } from './logger-CABQOnlR.cjs';
|
|
4
|
-
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-
|
|
5
|
-
import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
import { M as MetadataMap,
|
|
4
|
+
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-Bz1rxcUg.cjs';
|
|
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-BotL3ZLH.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, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-BotL3ZLH.cjs';
|
|
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';
|
|
9
|
+
import { ParticipantRoster } from '@band-ai/band-sdk-core';
|
|
10
|
+
export { ParticipantRoster, RetryTracker } from '@band-ai/band-sdk-core';
|
|
9
11
|
import 'zod';
|
|
10
|
-
import './pagination-
|
|
12
|
+
import './pagination-DqdkQArT.cjs';
|
|
13
|
+
import './disconnectReason-IuADl6TH.cjs';
|
|
11
14
|
|
|
12
|
-
declare const HUB_ROOM_SYSTEM_PROMPT = "## OVERRIDE: Contact Management Mode\n\nThis is your CONTACTS HUB - a dedicated room for managing contact requests.\n\n**IMPORTANT: Do NOT delegate or add participants here.** You handle contact events DIRECTLY using the contact tools below. Do NOT call
|
|
15
|
+
declare const HUB_ROOM_SYSTEM_PROMPT = "## OVERRIDE: Contact Management Mode\n\nThis is your CONTACTS HUB - a dedicated room for managing contact requests.\n\n**IMPORTANT: Do NOT delegate or add participants here.** You handle contact events DIRECTLY using the contact tools below. Do NOT call band_lookup_peers() or band_add_participant() in this room.\n\n## Your Role\n\n1. **Review incoming contact requests** - When you see a [Contact Request] message, evaluate it\n2. **Take action** - Use the contact tools to respond:\n - `band_respond_contact_request(action=\"approve\", request_id=\"...\")` to accept\n - `band_respond_contact_request(action=\"reject\", request_id=\"...\")` to decline\n3. **Report your decision** - Send a thought event explaining what you did\n\n## Example\n\n[Contact Events]: [Contact Request] Alice (@alice) wants to connect.\nRequest ID: abc-123\n\nYour response:\n1. band_send_event(\"Received contact request from Alice. Approving.\", message_type=\"thought\")\n2. band_respond_contact_request(action=\"approve\", request_id=\"abc-123\")\n3. band_send_event(\"Approved contact request from Alice (@alice)\", message_type=\"thought\")\n\n## Contact Tools (use these, NOT participant tools)\n- `band_respond_contact_request(action, request_id)` - Approve/reject requests\n- `band_list_contact_requests()` - List pending requests\n- `band_list_contacts()` - List current contacts";
|
|
13
16
|
type ContactHandlerRestApi = Partial<AgentToolsRestApi> & Pick<ChatMessagingRestApi, "createChatEvent"> & Pick<ChatRoomRestApi, "createChat"> & Partial<Pick<ContactRestApi, "listContactRequests">>;
|
|
14
17
|
interface ContactEventHandlerOptions {
|
|
15
18
|
config: ContactEventConfig;
|
|
@@ -54,7 +57,7 @@ declare class ContactEventHandler {
|
|
|
54
57
|
type ExecutionHandler = (context: ExecutionContext, event: PlatformEvent) => Promise<void>;
|
|
55
58
|
interface ExecutionOptions {
|
|
56
59
|
roomId: string;
|
|
57
|
-
link:
|
|
60
|
+
link: BandLink;
|
|
58
61
|
context: ExecutionContext;
|
|
59
62
|
onExecute: ExecutionHandler;
|
|
60
63
|
onFailure?: (error: unknown, event: PlatformEvent) => void | Promise<void>;
|
|
@@ -97,7 +100,7 @@ declare class Execution {
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
interface RoomPresenceOptions {
|
|
100
|
-
link:
|
|
103
|
+
link: BandLink;
|
|
101
104
|
roomFilter?: (room: MetadataMap) => boolean;
|
|
102
105
|
autoSubscribeExistingRooms?: boolean;
|
|
103
106
|
logger?: Logger;
|
|
@@ -131,14 +134,14 @@ declare class RoomPresence {
|
|
|
131
134
|
interface AgentToolsOptions {
|
|
132
135
|
roomId: string;
|
|
133
136
|
rest: AgentToolsRestApi;
|
|
134
|
-
|
|
137
|
+
roster?: ParticipantRoster;
|
|
135
138
|
capabilities?: Partial<AgentToolsCapabilities>;
|
|
136
139
|
}
|
|
137
140
|
declare class AgentTools implements AgentToolsProtocol {
|
|
138
141
|
readonly roomId: string;
|
|
139
142
|
readonly capabilities: Readonly<AgentToolsCapabilities>;
|
|
140
143
|
private readonly rest;
|
|
141
|
-
private
|
|
144
|
+
private readonly roster;
|
|
142
145
|
private readonly adapterTools;
|
|
143
146
|
private readonly toolHandlers;
|
|
144
147
|
constructor(options: AgentToolsOptions);
|
|
@@ -175,7 +178,6 @@ declare class AgentTools implements AgentToolsProtocol {
|
|
|
175
178
|
private resolveMentions;
|
|
176
179
|
private lookupPeerByName;
|
|
177
180
|
private normalizeMentionHandle;
|
|
178
|
-
private replaceParticipants;
|
|
179
181
|
private buildAdapterTools;
|
|
180
182
|
private bindAdapterToolMethod;
|
|
181
183
|
private buildToolHandlers;
|
|
@@ -224,7 +226,10 @@ declare function formatHistoryForLlm(messages: Array<Record<string, unknown>>, o
|
|
|
224
226
|
}): ToolModelMessage[];
|
|
225
227
|
declare function buildParticipantsMessage(participants: Array<Record<string, unknown>>): string;
|
|
226
228
|
|
|
227
|
-
declare const BASE_INSTRUCTIONS
|
|
229
|
+
declare const BASE_INSTRUCTIONS: string;
|
|
230
|
+
|
|
231
|
+
declare const MEMORY_SECTION: string;
|
|
232
|
+
|
|
228
233
|
declare const TEMPLATES: Record<string, string>;
|
|
229
234
|
interface RenderSystemPromptOptions {
|
|
230
235
|
agentName?: string;
|
|
@@ -232,22 +237,10 @@ interface RenderSystemPromptOptions {
|
|
|
232
237
|
customSection?: string;
|
|
233
238
|
template?: string;
|
|
234
239
|
includeBaseInstructions?: boolean;
|
|
240
|
+
capabilities?: Partial<AgentToolsCapabilities>;
|
|
235
241
|
}
|
|
236
242
|
declare function renderSystemPrompt(options?: RenderSystemPromptOptions): string;
|
|
237
243
|
|
|
238
|
-
declare class ParticipantTracker {
|
|
239
|
-
private participantsList;
|
|
240
|
-
private lastSent;
|
|
241
|
-
private loaded;
|
|
242
|
-
get participants(): Array<Record<string, unknown>>;
|
|
243
|
-
get isLoaded(): boolean;
|
|
244
|
-
setLoaded(participants: Array<Record<string, unknown>>): void;
|
|
245
|
-
add(participant: Record<string, unknown>): boolean;
|
|
246
|
-
remove(participantId: string): boolean;
|
|
247
|
-
changed(): boolean;
|
|
248
|
-
markSent(): void;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
244
|
interface StoppableAgent {
|
|
252
245
|
stop(timeoutMs?: number | null): Promise<boolean>;
|
|
253
246
|
run(options?: {
|
|
@@ -273,4 +266,4 @@ declare class GracefulShutdown {
|
|
|
273
266
|
}
|
|
274
267
|
declare function runWithGracefulShutdown(agent: StoppableAgent, options?: GracefulShutdownOptions): Promise<void>;
|
|
275
268
|
|
|
276
|
-
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,
|
|
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, RoomPresence, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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, h as SYNTHETIC_CONTACT_EVENTS_SENDER_ID, i as SYNTHETIC_CONTACT_EVENTS_SENDER_NAME, j as SYNTHETIC_SENDER_TYPE, S as SessionConfig, k as ensureHandlePrefix } from './types-
|
|
1
|
+
import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-BTN_ZETM.js';
|
|
2
|
+
export { A as AgentConfig, b as ContactEventCallback, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, h as SYNTHETIC_CONTACT_EVENTS_SENDER_ID, i as SYNTHETIC_CONTACT_EVENTS_SENDER_NAME, j as SYNTHETIC_SENDER_TYPE, S as SessionConfig, k as ensureHandlePrefix } from './types-BTN_ZETM.js';
|
|
3
3
|
import { L as Logger } from './logger-CABQOnlR.js';
|
|
4
|
-
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-
|
|
5
|
-
import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
import { M as MetadataMap,
|
|
4
|
+
import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-Bwwcql0h.js';
|
|
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-DBsC4J1g.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, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-DBsC4J1g.js';
|
|
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';
|
|
9
|
+
import { ParticipantRoster } from '@band-ai/band-sdk-core';
|
|
10
|
+
export { ParticipantRoster, RetryTracker } from '@band-ai/band-sdk-core';
|
|
9
11
|
import 'zod';
|
|
10
|
-
import './pagination-
|
|
12
|
+
import './pagination-BgEx-HeL.js';
|
|
13
|
+
import './disconnectReason-IuADl6TH.js';
|
|
11
14
|
|
|
12
|
-
declare const HUB_ROOM_SYSTEM_PROMPT = "## OVERRIDE: Contact Management Mode\n\nThis is your CONTACTS HUB - a dedicated room for managing contact requests.\n\n**IMPORTANT: Do NOT delegate or add participants here.** You handle contact events DIRECTLY using the contact tools below. Do NOT call
|
|
15
|
+
declare const HUB_ROOM_SYSTEM_PROMPT = "## OVERRIDE: Contact Management Mode\n\nThis is your CONTACTS HUB - a dedicated room for managing contact requests.\n\n**IMPORTANT: Do NOT delegate or add participants here.** You handle contact events DIRECTLY using the contact tools below. Do NOT call band_lookup_peers() or band_add_participant() in this room.\n\n## Your Role\n\n1. **Review incoming contact requests** - When you see a [Contact Request] message, evaluate it\n2. **Take action** - Use the contact tools to respond:\n - `band_respond_contact_request(action=\"approve\", request_id=\"...\")` to accept\n - `band_respond_contact_request(action=\"reject\", request_id=\"...\")` to decline\n3. **Report your decision** - Send a thought event explaining what you did\n\n## Example\n\n[Contact Events]: [Contact Request] Alice (@alice) wants to connect.\nRequest ID: abc-123\n\nYour response:\n1. band_send_event(\"Received contact request from Alice. Approving.\", message_type=\"thought\")\n2. band_respond_contact_request(action=\"approve\", request_id=\"abc-123\")\n3. band_send_event(\"Approved contact request from Alice (@alice)\", message_type=\"thought\")\n\n## Contact Tools (use these, NOT participant tools)\n- `band_respond_contact_request(action, request_id)` - Approve/reject requests\n- `band_list_contact_requests()` - List pending requests\n- `band_list_contacts()` - List current contacts";
|
|
13
16
|
type ContactHandlerRestApi = Partial<AgentToolsRestApi> & Pick<ChatMessagingRestApi, "createChatEvent"> & Pick<ChatRoomRestApi, "createChat"> & Partial<Pick<ContactRestApi, "listContactRequests">>;
|
|
14
17
|
interface ContactEventHandlerOptions {
|
|
15
18
|
config: ContactEventConfig;
|
|
@@ -54,7 +57,7 @@ declare class ContactEventHandler {
|
|
|
54
57
|
type ExecutionHandler = (context: ExecutionContext, event: PlatformEvent) => Promise<void>;
|
|
55
58
|
interface ExecutionOptions {
|
|
56
59
|
roomId: string;
|
|
57
|
-
link:
|
|
60
|
+
link: BandLink;
|
|
58
61
|
context: ExecutionContext;
|
|
59
62
|
onExecute: ExecutionHandler;
|
|
60
63
|
onFailure?: (error: unknown, event: PlatformEvent) => void | Promise<void>;
|
|
@@ -97,7 +100,7 @@ declare class Execution {
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
interface RoomPresenceOptions {
|
|
100
|
-
link:
|
|
103
|
+
link: BandLink;
|
|
101
104
|
roomFilter?: (room: MetadataMap) => boolean;
|
|
102
105
|
autoSubscribeExistingRooms?: boolean;
|
|
103
106
|
logger?: Logger;
|
|
@@ -131,14 +134,14 @@ declare class RoomPresence {
|
|
|
131
134
|
interface AgentToolsOptions {
|
|
132
135
|
roomId: string;
|
|
133
136
|
rest: AgentToolsRestApi;
|
|
134
|
-
|
|
137
|
+
roster?: ParticipantRoster;
|
|
135
138
|
capabilities?: Partial<AgentToolsCapabilities>;
|
|
136
139
|
}
|
|
137
140
|
declare class AgentTools implements AgentToolsProtocol {
|
|
138
141
|
readonly roomId: string;
|
|
139
142
|
readonly capabilities: Readonly<AgentToolsCapabilities>;
|
|
140
143
|
private readonly rest;
|
|
141
|
-
private
|
|
144
|
+
private readonly roster;
|
|
142
145
|
private readonly adapterTools;
|
|
143
146
|
private readonly toolHandlers;
|
|
144
147
|
constructor(options: AgentToolsOptions);
|
|
@@ -175,7 +178,6 @@ declare class AgentTools implements AgentToolsProtocol {
|
|
|
175
178
|
private resolveMentions;
|
|
176
179
|
private lookupPeerByName;
|
|
177
180
|
private normalizeMentionHandle;
|
|
178
|
-
private replaceParticipants;
|
|
179
181
|
private buildAdapterTools;
|
|
180
182
|
private bindAdapterToolMethod;
|
|
181
183
|
private buildToolHandlers;
|
|
@@ -224,7 +226,10 @@ declare function formatHistoryForLlm(messages: Array<Record<string, unknown>>, o
|
|
|
224
226
|
}): ToolModelMessage[];
|
|
225
227
|
declare function buildParticipantsMessage(participants: Array<Record<string, unknown>>): string;
|
|
226
228
|
|
|
227
|
-
declare const BASE_INSTRUCTIONS
|
|
229
|
+
declare const BASE_INSTRUCTIONS: string;
|
|
230
|
+
|
|
231
|
+
declare const MEMORY_SECTION: string;
|
|
232
|
+
|
|
228
233
|
declare const TEMPLATES: Record<string, string>;
|
|
229
234
|
interface RenderSystemPromptOptions {
|
|
230
235
|
agentName?: string;
|
|
@@ -232,22 +237,10 @@ interface RenderSystemPromptOptions {
|
|
|
232
237
|
customSection?: string;
|
|
233
238
|
template?: string;
|
|
234
239
|
includeBaseInstructions?: boolean;
|
|
240
|
+
capabilities?: Partial<AgentToolsCapabilities>;
|
|
235
241
|
}
|
|
236
242
|
declare function renderSystemPrompt(options?: RenderSystemPromptOptions): string;
|
|
237
243
|
|
|
238
|
-
declare class ParticipantTracker {
|
|
239
|
-
private participantsList;
|
|
240
|
-
private lastSent;
|
|
241
|
-
private loaded;
|
|
242
|
-
get participants(): Array<Record<string, unknown>>;
|
|
243
|
-
get isLoaded(): boolean;
|
|
244
|
-
setLoaded(participants: Array<Record<string, unknown>>): void;
|
|
245
|
-
add(participant: Record<string, unknown>): boolean;
|
|
246
|
-
remove(participantId: string): boolean;
|
|
247
|
-
changed(): boolean;
|
|
248
|
-
markSent(): void;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
244
|
interface StoppableAgent {
|
|
252
245
|
stop(timeoutMs?: number | null): Promise<boolean>;
|
|
253
246
|
run(options?: {
|
|
@@ -273,4 +266,4 @@ declare class GracefulShutdown {
|
|
|
273
266
|
}
|
|
274
267
|
declare function runWithGracefulShutdown(agent: StoppableAgent, options?: GracefulShutdownOptions): Promise<void>;
|
|
275
268
|
|
|
276
|
-
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,
|
|
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, RoomPresence, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
|
package/dist/runtime.js
CHANGED
|
@@ -8,13 +8,12 @@ import {
|
|
|
8
8
|
ExecutionContext,
|
|
9
9
|
GracefulShutdown,
|
|
10
10
|
HUB_ROOM_SYSTEM_PROMPT,
|
|
11
|
-
MessageRetryTracker,
|
|
12
11
|
PlatformRuntime,
|
|
13
12
|
hydrateTrackedRooms,
|
|
14
13
|
runWithGracefulShutdown,
|
|
15
14
|
trackRoomJoin,
|
|
16
15
|
trackRoomLeave
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-N2QTUMGO.js";
|
|
18
17
|
import {
|
|
19
18
|
HistoryProvider,
|
|
20
19
|
SYNTHETIC_CONTACT_EVENTS_SENDER_ID,
|
|
@@ -25,7 +24,13 @@ import {
|
|
|
25
24
|
formatHistoryForLlm,
|
|
26
25
|
formatMessageForLlm,
|
|
27
26
|
replaceUuidMentions
|
|
28
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LBWKISBS.js";
|
|
28
|
+
import {
|
|
29
|
+
BASE_INSTRUCTIONS,
|
|
30
|
+
MEMORY_SECTION,
|
|
31
|
+
TEMPLATES,
|
|
32
|
+
renderSystemPrompt
|
|
33
|
+
} from "./chunk-WLCM2OXG.js";
|
|
29
34
|
import {
|
|
30
35
|
ALL_TOOL_NAMES,
|
|
31
36
|
BASE_TOOL_NAMES,
|
|
@@ -33,6 +38,7 @@ import {
|
|
|
33
38
|
CHAT_MESSAGE_TYPES,
|
|
34
39
|
CHAT_TOOL_NAMES,
|
|
35
40
|
CONTACT_TOOL_NAMES,
|
|
41
|
+
MCP_SERVER_NAME,
|
|
36
42
|
MCP_TOOL_PREFIX,
|
|
37
43
|
MEMORY_TOOL_NAMES,
|
|
38
44
|
TOOL_MODELS,
|
|
@@ -40,21 +46,17 @@ import {
|
|
|
40
46
|
getToolDescription,
|
|
41
47
|
isChatEventType,
|
|
42
48
|
mcpToolNames
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import
|
|
45
|
-
BASE_INSTRUCTIONS,
|
|
46
|
-
TEMPLATES,
|
|
47
|
-
renderSystemPrompt
|
|
48
|
-
} from "./chunk-SFVKOEQH.js";
|
|
49
|
+
} from "./chunk-RV76SKFT.js";
|
|
50
|
+
import "./chunk-US226AS4.js";
|
|
49
51
|
import {
|
|
50
52
|
DEFAULT_REQUEST_OPTIONS
|
|
51
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-EAI2M3WM.js";
|
|
52
54
|
import "./chunk-ZZJRRBPQ.js";
|
|
53
55
|
import "./chunk-3BKAC4OZ.js";
|
|
54
56
|
import {
|
|
55
57
|
NoopLogger
|
|
56
58
|
} from "./chunk-OD2G5LFQ.js";
|
|
57
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-JY75VSQK.js";
|
|
58
60
|
|
|
59
61
|
// src/runtime/rooms/RoomPresence.ts
|
|
60
62
|
var RoomPresence = class {
|
|
@@ -177,60 +179,8 @@ var RoomPresence = class {
|
|
|
177
179
|
}
|
|
178
180
|
};
|
|
179
181
|
|
|
180
|
-
// src/runtime/
|
|
181
|
-
|
|
182
|
-
participantsList = [];
|
|
183
|
-
lastSent = null;
|
|
184
|
-
loaded = false;
|
|
185
|
-
get participants() {
|
|
186
|
-
return [...this.participantsList];
|
|
187
|
-
}
|
|
188
|
-
get isLoaded() {
|
|
189
|
-
return this.loaded;
|
|
190
|
-
}
|
|
191
|
-
setLoaded(participants) {
|
|
192
|
-
this.participantsList = participants.map((participant) => ({ ...participant }));
|
|
193
|
-
this.loaded = true;
|
|
194
|
-
}
|
|
195
|
-
add(participant) {
|
|
196
|
-
if (this.participantsList.some((entry) => entry.id === participant.id)) {
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
this.participantsList.push({
|
|
200
|
-
id: participant.id,
|
|
201
|
-
name: participant.name,
|
|
202
|
-
type: participant.type,
|
|
203
|
-
handle: participant.handle
|
|
204
|
-
});
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
remove(participantId) {
|
|
208
|
-
const before = this.participantsList.length;
|
|
209
|
-
this.participantsList = this.participantsList.filter(
|
|
210
|
-
(participant) => participant.id !== participantId
|
|
211
|
-
);
|
|
212
|
-
return this.participantsList.length < before;
|
|
213
|
-
}
|
|
214
|
-
changed() {
|
|
215
|
-
if (!this.lastSent) {
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
const oldIds = new Set(this.lastSent.map((participant) => participant.id));
|
|
219
|
-
const newIds = new Set(this.participantsList.map((participant) => participant.id));
|
|
220
|
-
if (oldIds.size !== newIds.size) {
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
for (const id of oldIds) {
|
|
224
|
-
if (!newIds.has(id)) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
markSent() {
|
|
231
|
-
this.lastSent = this.participantsList.map((participant) => ({ ...participant }));
|
|
232
|
-
}
|
|
233
|
-
};
|
|
182
|
+
// src/runtime/index.ts
|
|
183
|
+
import { ParticipantRoster, RetryTracker } from "@band-ai/band-sdk-core";
|
|
234
184
|
export {
|
|
235
185
|
ALL_TOOL_NAMES,
|
|
236
186
|
AgentRuntime,
|
|
@@ -249,11 +199,13 @@ export {
|
|
|
249
199
|
GracefulShutdown,
|
|
250
200
|
HUB_ROOM_SYSTEM_PROMPT,
|
|
251
201
|
HistoryProvider,
|
|
202
|
+
MCP_SERVER_NAME,
|
|
252
203
|
MCP_TOOL_PREFIX,
|
|
204
|
+
MEMORY_SECTION,
|
|
253
205
|
MEMORY_TOOL_NAMES,
|
|
254
|
-
|
|
255
|
-
ParticipantTracker,
|
|
206
|
+
ParticipantRoster,
|
|
256
207
|
PlatformRuntime,
|
|
208
|
+
RetryTracker,
|
|
257
209
|
RoomPresence,
|
|
258
210
|
SYNTHETIC_CONTACT_EVENTS_SENDER_ID,
|
|
259
211
|
SYNTHETIC_CONTACT_EVENTS_SENDER_NAME,
|