@band-ai/sdk 0.1.4 → 0.1.10

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.
Files changed (73) hide show
  1. package/README.md +372 -0
  2. package/dist/{ClaudeSDKAdapter-CRq4R-WB.d.cts → ClaudeSDKAdapter-DfjaI5ke.d.cts} +9 -7
  3. package/dist/{ClaudeSDKAdapter-BHOkjN3X.d.ts → ClaudeSDKAdapter-DonPGJ43.d.ts} +9 -7
  4. package/dist/{acp-server-BdRz9_UN.d.cts → acp-server-CUBXIiG6.d.cts} +2 -2
  5. package/dist/{acp-server-B1Da7L6u.d.ts → acp-server-NZAeg-WO.d.ts} +2 -2
  6. package/dist/adapters.cjs +494 -106
  7. package/dist/adapters.d.cts +12 -12
  8. package/dist/adapters.d.ts +12 -12
  9. package/dist/adapters.js +7 -7
  10. package/dist/{backends-SVMT-7l4.d.cts → backends-DYtEhCZG.d.cts} +7 -2
  11. package/dist/{backends-CzDbiQar.d.ts → backends-oYAb7EU-.d.ts} +7 -2
  12. package/dist/{chunk-MSL6CWHY.js → chunk-2BHHR6YW.js} +17 -16
  13. package/dist/{chunk-EDPKUUJL.js → chunk-6RXWL6TC.js} +9 -1
  14. package/dist/{chunk-SFVKOEQH.js → chunk-DNPVCR3S.js} +92 -14
  15. package/dist/{chunk-I5EZG52P.js → chunk-FP237EAG.js} +424 -136
  16. package/dist/{chunk-RHVH2GZR.js → chunk-J3M3PFFY.js} +81 -31
  17. package/dist/{chunk-GVEQ3RAH.js → chunk-MLROFDKR.js} +132 -23
  18. package/dist/{chunk-INA6YZTZ.js → chunk-RDM4TE4B.js} +32 -30
  19. package/dist/chunk-US226AS4.js +130 -0
  20. package/dist/{chunk-W5NDZSYE.js → chunk-XA4N2JPH.js} +1 -1
  21. package/dist/converters.cjs +469 -13
  22. package/dist/converters.d.cts +5 -5
  23. package/dist/converters.d.ts +5 -5
  24. package/dist/converters.js +3 -2
  25. package/dist/core.cjs +45 -2
  26. package/dist/core.d.cts +4 -3
  27. package/dist/core.d.ts +4 -3
  28. package/dist/core.js +5 -1
  29. package/dist/disconnectReason-IuADl6TH.d.cts +34 -0
  30. package/dist/disconnectReason-IuADl6TH.d.ts +34 -0
  31. package/dist/{dtos-DUpbIu8k.d.cts → dtos-Dd_fTfLn.d.cts} +26 -6
  32. package/dist/{dtos-DUpbIu8k.d.ts → dtos-Dd_fTfLn.d.ts} +26 -6
  33. package/dist/index.cjs +1089 -269
  34. package/dist/index.d.cts +16 -15
  35. package/dist/index.d.ts +16 -15
  36. package/dist/index.js +14 -8
  37. package/dist/linear.cjs +985 -53
  38. package/dist/linear.d.cts +137 -7
  39. package/dist/linear.d.ts +137 -7
  40. package/dist/linear.js +974 -53
  41. package/dist/mcp-claude.cjs +303 -32
  42. package/dist/mcp-claude.d.cts +3 -3
  43. package/dist/mcp-claude.d.ts +3 -3
  44. package/dist/mcp-claude.js +210 -12
  45. package/dist/mcp.cjs +313 -45
  46. package/dist/mcp.d.cts +5 -5
  47. package/dist/mcp.d.ts +5 -5
  48. package/dist/mcp.js +3 -3
  49. package/dist/{opencode-BBcDchcN.d.cts → opencode--iA5-KYk.d.cts} +2 -2
  50. package/dist/{opencode-DthQQUsZ.d.ts → opencode-YNacv-eJ.d.ts} +2 -2
  51. package/dist/{pagination-CcDkVFxK.d.ts → pagination-BBLsYLhT.d.ts} +2 -2
  52. package/dist/{pagination-BPiys10t.d.cts → pagination-CqidD-L_.d.cts} +2 -2
  53. package/dist/{protocols-DrhzOH6K.d.ts → protocols-BF6jamIl.d.ts} +1 -1
  54. package/dist/{protocols-CInhtFpA.d.cts → protocols-D2bTrQ_t.d.cts} +1 -1
  55. package/dist/rest.d.cts +5 -5
  56. package/dist/rest.d.ts +5 -5
  57. package/dist/runtime.cjs +721 -172
  58. package/dist/runtime.d.cts +15 -10
  59. package/dist/runtime.d.ts +15 -10
  60. package/dist/runtime.js +11 -8
  61. package/dist/{schemas-vos1AaBc.d.ts → schemas-B1Fd3oUM.d.ts} +17 -8
  62. package/dist/{schemas-BpEBkq5V.d.cts → schemas-CI0qgcp_.d.cts} +17 -8
  63. package/dist/{sdk-CcnQ5OUC.d.ts → sdk-CyqN1W5g.d.ts} +32 -2
  64. package/dist/{sdk-CwTAxhwI.d.cts → sdk-D2rTDU_o.d.cts} +32 -2
  65. package/dist/{simpleAdapter-DqhvjsGr.d.cts → simpleAdapter-C_f-01Cu.d.cts} +1 -1
  66. package/dist/{simpleAdapter-9OE_p6QW.d.ts → simpleAdapter-qQt-tSz4.d.ts} +1 -1
  67. package/dist/testing.d.cts +3 -3
  68. package/dist/testing.d.ts +3 -3
  69. package/dist/{types-CovcHpYf.d.cts → types-CKqrhGB1.d.cts} +2 -2
  70. package/dist/{types-CxII3XkA.d.ts → types-D3AsUnd0.d.ts} +1 -1
  71. package/dist/{types-7jVzOeOP.d.ts → types-DNySTI_8.d.ts} +2 -2
  72. package/dist/{types-CSHFipIc.d.cts → types-DtMms5Fi.d.cts} +1 -1
  73. package/package.json +22 -21
@@ -1,13 +1,14 @@
1
- import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-CovcHpYf.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-CovcHpYf.cjs';
1
+ import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-CKqrhGB1.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-CKqrhGB1.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-CInhtFpA.cjs';
5
- import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-CSHFipIc.cjs';
6
- import { b as ThenvoiLink, c as ExecutionContext } from './schemas-BpEBkq5V.cjs';
7
- export { d as ALL_TOOL_NAMES, A as AgentRuntime, B as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, e as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, f as ExecutionState, M as MCP_TOOL_PREFIX, g as MEMORY_TOOL_NAMES, h as MessageRetryTracker, P as PlatformRuntime, T as TOOL_MODELS, i as getToolDescription, m as mcpToolNames } from './schemas-BpEBkq5V.cjs';
8
- import { M as MetadataMap, P as ParticipantRecord, a as MentionInput, T as ToolOperationResult, c as PaginatedList, d as PeerRecord, 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-DUpbIu8k.cjs';
4
+ import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-D2bTrQ_t.cjs';
5
+ import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-DtMms5Fi.cjs';
6
+ import { b as ThenvoiLink, c as ExecutionContext } from './schemas-CI0qgcp_.cjs';
7
+ export { e as ALL_TOOL_NAMES, A as AgentRuntime, B as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, f as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, g as ExecutionState, M as MCP_TOOL_PREFIX, h as MEMORY_TOOL_NAMES, i as MessageRetryTracker, P as PlatformRuntime, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-CI0qgcp_.cjs';
8
+ import { M as MetadataMap, P as ParticipantRecord, a as MentionInput, T as ToolOperationResult, c as PaginatedList, d as PeerRecord, 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-Dd_fTfLn.cjs';
9
9
  import 'zod';
10
- import './pagination-BPiys10t.cjs';
10
+ import './pagination-CqidD-L_.cjs';
11
+ import './disconnectReason-IuADl6TH.cjs';
11
12
 
12
13
  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 thenvoi_lookup_peers() or thenvoi_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 - `thenvoi_respond_contact_request(action=\"approve\", request_id=\"...\")` to accept\n - `thenvoi_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. thenvoi_send_event(\"Received contact request from Alice. Approving.\", message_type=\"thought\")\n2. thenvoi_respond_contact_request(action=\"approve\", request_id=\"abc-123\")\n3. thenvoi_send_event(\"Approved contact request from Alice (@alice)\", message_type=\"thought\")\n\n## Contact Tools (use these, NOT participant tools)\n- `thenvoi_respond_contact_request(action, request_id)` - Approve/reject requests\n- `thenvoi_list_contact_requests()` - List pending requests\n- `thenvoi_list_contacts()` - List current contacts";
13
14
  type ContactHandlerRestApi = Partial<AgentToolsRestApi> & Pick<ChatMessagingRestApi, "createChatEvent"> & Pick<ChatRoomRestApi, "createChat"> & Partial<Pick<ContactRestApi, "listContactRequests">>;
@@ -224,7 +225,10 @@ declare function formatHistoryForLlm(messages: Array<Record<string, unknown>>, o
224
225
  }): ToolModelMessage[];
225
226
  declare function buildParticipantsMessage(participants: Array<Record<string, unknown>>): string;
226
227
 
227
- declare const BASE_INSTRUCTIONS = "\n## Environment\n\nMulti-participant chat. Messages show sender: [Name]: content.\nMessages prefixed with [System]: are platform updates (participant changes, contact updates, etc.) \u2014 not messages from users.\nUse `thenvoi_send_message(content, mentions)` to respond. Plain text output is not delivered.\nMentions use handles: @<username> for users, @<username>/<agent-name> for agents.\n\n## CRITICAL: Delegate When You Cannot Help Directly\n\nYou have NO internet access and NO real-time data. When asked about weather, news, stock prices,\nor any current information you cannot answer directly:\n\n1. Call `thenvoi_lookup_peers()` to find available specialized agents\n2. If a relevant agent exists, call `thenvoi_add_participant(name)` to add them\n3. Ask that agent using `thenvoi_send_message(question, mentions=[agent_handle])`\n4. Wait for their response and relay it back to the user\n\nNEVER say \"I can't do that\" without first checking if another agent can help via `thenvoi_lookup_peers()`.\n\n## CRITICAL: Do NOT Remove Agents Automatically\n\nAfter adding an agent to help with a task:\n1. Ask your question and wait for their response\n2. Relay their response back to the original requester\n3. **Do NOT remove the agent** - they stay silent unless mentioned and may be useful for follow-ups\n\nOnly remove agents if the user explicitly requests it.\n\n## CRITICAL: Always Relay Information Back to the Requester\n\nWhen someone asks you to get information from another agent:\n1. Ask the other agent for the information\n2. When you receive the response, IMMEDIATELY relay it back to the ORIGINAL REQUESTER\n3. Do NOT just thank the helper agent - the requester is waiting for their answer!\n\n## IMPORTANT: Always Share Your Thinking\n\nYou MUST call `thenvoi_send_event(content, message_type=\"thought\")` BEFORE every action.\nThis is required so users can see your reasoning process.\n\n## Examples\n\n### Simple question - answer directly\n[John Doe]: What's 2+2?\n-> thenvoi_send_event(\"Simple arithmetic, answering directly.\", message_type=\"thought\")\n-> thenvoi_send_message(\"4\", mentions=[\"@john\"])\n\n### User asks about weather (you cannot answer directly)\n[John Doe]: What's the weather in Tokyo?\n-> thenvoi_send_event(\"I can't check weather directly. Looking for a Weather Agent.\", message_type=\"thought\")\n-> thenvoi_lookup_peers()\n-> thenvoi_send_event(\"Found Weather Agent. Adding to room.\", message_type=\"thought\")\n-> thenvoi_add_participant(\"Weather Agent\")\n-> thenvoi_send_message(\"What's the weather in Tokyo?\", mentions=[\"@john/weather-agent\"])\n\n[Weather Agent]: Tokyo is 15\u00B0C and cloudy.\n-> thenvoi_send_event(\"Got weather response. Relaying back to John Doe.\", message_type=\"thought\")\n-> thenvoi_send_message(\"The weather in Tokyo is 15\u00B0C and cloudy.\", mentions=[\"@john\"])\n\n### No suitable agent available\n[John Doe]: What's the stock price of AAPL?\n-> thenvoi_send_event(\"I can't check stock prices. Looking for a Stock Agent.\", message_type=\"thought\")\n-> thenvoi_lookup_peers()\n-> thenvoi_send_event(\"No stock agent available. Must inform user.\", message_type=\"thought\")\n-> thenvoi_send_message(\"I don't have access to stock prices, and there's no specialized agent available to help with that.\", mentions=[\"@john\"])\n\n### Follow-up question in same conversation\n[John Doe]: What about London?\n-> thenvoi_send_event(\"Follow-up weather question. Asking Weather Agent.\", message_type=\"thought\")\n-> thenvoi_send_message(\"What's the weather in London?\", mentions=[\"@john/weather-agent\"])\n\n[Weather Agent]: London is 8\u00B0C and rainy.\n-> thenvoi_send_event(\"Got London weather. Relaying to John Doe.\", message_type=\"thought\")\n-> thenvoi_send_message(\"London is 8\u00B0C and rainy.\", mentions=[\"@john\"])\n";
228
+ declare const BASE_INSTRUCTIONS: string;
229
+
230
+ declare const MEMORY_SECTION: string;
231
+
228
232
  declare const TEMPLATES: Record<string, string>;
229
233
  interface RenderSystemPromptOptions {
230
234
  agentName?: string;
@@ -232,6 +236,7 @@ interface RenderSystemPromptOptions {
232
236
  customSection?: string;
233
237
  template?: string;
234
238
  includeBaseInstructions?: boolean;
239
+ capabilities?: Partial<AgentToolsCapabilities>;
235
240
  }
236
241
  declare function renderSystemPrompt(options?: RenderSystemPromptOptions): string;
237
242
 
@@ -273,4 +278,4 @@ declare class GracefulShutdown {
273
278
  }
274
279
  declare function runWithGracefulShutdown(agent: StoppableAgent, options?: GracefulShutdownOptions): Promise<void>;
275
280
 
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, ParticipantTracker, PlatformMessage, type RenderSystemPromptOptions, RoomPresence, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
281
+ 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, ParticipantTracker, PlatformMessage, type RenderSystemPromptOptions, RoomPresence, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
package/dist/runtime.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-7jVzOeOP.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-7jVzOeOP.js';
1
+ import { c as ContactEventConfig, g as MessageEvent, C as ContactEvent, f as PlatformEvent, P as PlatformMessage } from './types-DNySTI_8.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-DNySTI_8.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-DrhzOH6K.js';
5
- import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-CxII3XkA.js';
6
- import { b as ThenvoiLink, c as ExecutionContext } from './schemas-vos1AaBc.js';
7
- export { d as ALL_TOOL_NAMES, A as AgentRuntime, B as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, e as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, f as ExecutionState, M as MCP_TOOL_PREFIX, g as MEMORY_TOOL_NAMES, h as MessageRetryTracker, P as PlatformRuntime, T as TOOL_MODELS, i as getToolDescription, m as mcpToolNames } from './schemas-vos1AaBc.js';
8
- import { M as MetadataMap, P as ParticipantRecord, a as MentionInput, T as ToolOperationResult, c as PaginatedList, d as PeerRecord, 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-DUpbIu8k.js';
4
+ import { A as AdapterToolsProtocol, a as AgentToolsProtocol, h as AgentToolsCapabilities, C as ContactTools } from './protocols-BF6jamIl.js';
5
+ import { e as AgentToolsRestApi, f as ChatMessagingRestApi, g as ChatRoomRestApi, h as ContactRestApi } from './types-D3AsUnd0.js';
6
+ import { b as ThenvoiLink, c as ExecutionContext } from './schemas-B1Fd3oUM.js';
7
+ export { e as ALL_TOOL_NAMES, A as AgentRuntime, B as BASE_TOOL_NAMES, C as CHAT_TOOL_NAMES, f as CONTACT_TOOL_NAMES, D as DefaultPreprocessor, E as ExecutionContextOptions, g as ExecutionState, M as MCP_TOOL_PREFIX, h as MEMORY_TOOL_NAMES, i as MessageRetryTracker, P as PlatformRuntime, T as TOOL_MODELS, j as getToolDescription, m as mcpToolNames } from './schemas-B1Fd3oUM.js';
8
+ import { M as MetadataMap, P as ParticipantRecord, a as MentionInput, T as ToolOperationResult, c as PaginatedList, d as PeerRecord, 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-Dd_fTfLn.js';
9
9
  import 'zod';
10
- import './pagination-CcDkVFxK.js';
10
+ import './pagination-BBLsYLhT.js';
11
+ import './disconnectReason-IuADl6TH.js';
11
12
 
12
13
  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 thenvoi_lookup_peers() or thenvoi_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 - `thenvoi_respond_contact_request(action=\"approve\", request_id=\"...\")` to accept\n - `thenvoi_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. thenvoi_send_event(\"Received contact request from Alice. Approving.\", message_type=\"thought\")\n2. thenvoi_respond_contact_request(action=\"approve\", request_id=\"abc-123\")\n3. thenvoi_send_event(\"Approved contact request from Alice (@alice)\", message_type=\"thought\")\n\n## Contact Tools (use these, NOT participant tools)\n- `thenvoi_respond_contact_request(action, request_id)` - Approve/reject requests\n- `thenvoi_list_contact_requests()` - List pending requests\n- `thenvoi_list_contacts()` - List current contacts";
13
14
  type ContactHandlerRestApi = Partial<AgentToolsRestApi> & Pick<ChatMessagingRestApi, "createChatEvent"> & Pick<ChatRoomRestApi, "createChat"> & Partial<Pick<ContactRestApi, "listContactRequests">>;
@@ -224,7 +225,10 @@ declare function formatHistoryForLlm(messages: Array<Record<string, unknown>>, o
224
225
  }): ToolModelMessage[];
225
226
  declare function buildParticipantsMessage(participants: Array<Record<string, unknown>>): string;
226
227
 
227
- declare const BASE_INSTRUCTIONS = "\n## Environment\n\nMulti-participant chat. Messages show sender: [Name]: content.\nMessages prefixed with [System]: are platform updates (participant changes, contact updates, etc.) \u2014 not messages from users.\nUse `thenvoi_send_message(content, mentions)` to respond. Plain text output is not delivered.\nMentions use handles: @<username> for users, @<username>/<agent-name> for agents.\n\n## CRITICAL: Delegate When You Cannot Help Directly\n\nYou have NO internet access and NO real-time data. When asked about weather, news, stock prices,\nor any current information you cannot answer directly:\n\n1. Call `thenvoi_lookup_peers()` to find available specialized agents\n2. If a relevant agent exists, call `thenvoi_add_participant(name)` to add them\n3. Ask that agent using `thenvoi_send_message(question, mentions=[agent_handle])`\n4. Wait for their response and relay it back to the user\n\nNEVER say \"I can't do that\" without first checking if another agent can help via `thenvoi_lookup_peers()`.\n\n## CRITICAL: Do NOT Remove Agents Automatically\n\nAfter adding an agent to help with a task:\n1. Ask your question and wait for their response\n2. Relay their response back to the original requester\n3. **Do NOT remove the agent** - they stay silent unless mentioned and may be useful for follow-ups\n\nOnly remove agents if the user explicitly requests it.\n\n## CRITICAL: Always Relay Information Back to the Requester\n\nWhen someone asks you to get information from another agent:\n1. Ask the other agent for the information\n2. When you receive the response, IMMEDIATELY relay it back to the ORIGINAL REQUESTER\n3. Do NOT just thank the helper agent - the requester is waiting for their answer!\n\n## IMPORTANT: Always Share Your Thinking\n\nYou MUST call `thenvoi_send_event(content, message_type=\"thought\")` BEFORE every action.\nThis is required so users can see your reasoning process.\n\n## Examples\n\n### Simple question - answer directly\n[John Doe]: What's 2+2?\n-> thenvoi_send_event(\"Simple arithmetic, answering directly.\", message_type=\"thought\")\n-> thenvoi_send_message(\"4\", mentions=[\"@john\"])\n\n### User asks about weather (you cannot answer directly)\n[John Doe]: What's the weather in Tokyo?\n-> thenvoi_send_event(\"I can't check weather directly. Looking for a Weather Agent.\", message_type=\"thought\")\n-> thenvoi_lookup_peers()\n-> thenvoi_send_event(\"Found Weather Agent. Adding to room.\", message_type=\"thought\")\n-> thenvoi_add_participant(\"Weather Agent\")\n-> thenvoi_send_message(\"What's the weather in Tokyo?\", mentions=[\"@john/weather-agent\"])\n\n[Weather Agent]: Tokyo is 15\u00B0C and cloudy.\n-> thenvoi_send_event(\"Got weather response. Relaying back to John Doe.\", message_type=\"thought\")\n-> thenvoi_send_message(\"The weather in Tokyo is 15\u00B0C and cloudy.\", mentions=[\"@john\"])\n\n### No suitable agent available\n[John Doe]: What's the stock price of AAPL?\n-> thenvoi_send_event(\"I can't check stock prices. Looking for a Stock Agent.\", message_type=\"thought\")\n-> thenvoi_lookup_peers()\n-> thenvoi_send_event(\"No stock agent available. Must inform user.\", message_type=\"thought\")\n-> thenvoi_send_message(\"I don't have access to stock prices, and there's no specialized agent available to help with that.\", mentions=[\"@john\"])\n\n### Follow-up question in same conversation\n[John Doe]: What about London?\n-> thenvoi_send_event(\"Follow-up weather question. Asking Weather Agent.\", message_type=\"thought\")\n-> thenvoi_send_message(\"What's the weather in London?\", mentions=[\"@john/weather-agent\"])\n\n[Weather Agent]: London is 8\u00B0C and rainy.\n-> thenvoi_send_event(\"Got London weather. Relaying to John Doe.\", message_type=\"thought\")\n-> thenvoi_send_message(\"London is 8\u00B0C and rainy.\", mentions=[\"@john\"])\n";
228
+ declare const BASE_INSTRUCTIONS: string;
229
+
230
+ declare const MEMORY_SECTION: string;
231
+
228
232
  declare const TEMPLATES: Record<string, string>;
229
233
  interface RenderSystemPromptOptions {
230
234
  agentName?: string;
@@ -232,6 +236,7 @@ interface RenderSystemPromptOptions {
232
236
  customSection?: string;
233
237
  template?: string;
234
238
  includeBaseInstructions?: boolean;
239
+ capabilities?: Partial<AgentToolsCapabilities>;
235
240
  }
236
241
  declare function renderSystemPrompt(options?: RenderSystemPromptOptions): string;
237
242
 
@@ -273,4 +278,4 @@ declare class GracefulShutdown {
273
278
  }
274
279
  declare function runWithGracefulShutdown(agent: StoppableAgent, options?: GracefulShutdownOptions): Promise<void>;
275
280
 
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, ParticipantTracker, PlatformMessage, type RenderSystemPromptOptions, RoomPresence, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
281
+ 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, ParticipantTracker, PlatformMessage, type RenderSystemPromptOptions, RoomPresence, TEMPLATES, assertChatEventType, buildParticipantsMessage, formatHistoryForLlm, formatMessageForLlm, isChatEventType, renderSystemPrompt, replaceUuidMentions, runWithGracefulShutdown };
package/dist/runtime.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  runWithGracefulShutdown,
15
15
  trackRoomJoin,
16
16
  trackRoomLeave
17
- } from "./chunk-I5EZG52P.js";
17
+ } from "./chunk-FP237EAG.js";
18
18
  import {
19
19
  HistoryProvider,
20
20
  SYNTHETIC_CONTACT_EVENTS_SENDER_ID,
@@ -25,7 +25,13 @@ import {
25
25
  formatHistoryForLlm,
26
26
  formatMessageForLlm,
27
27
  replaceUuidMentions
28
- } from "./chunk-INA6YZTZ.js";
28
+ } from "./chunk-RDM4TE4B.js";
29
+ import {
30
+ BASE_INSTRUCTIONS,
31
+ MEMORY_SECTION,
32
+ TEMPLATES,
33
+ renderSystemPrompt
34
+ } from "./chunk-DNPVCR3S.js";
29
35
  import {
30
36
  ALL_TOOL_NAMES,
31
37
  BASE_TOOL_NAMES,
@@ -40,12 +46,8 @@ import {
40
46
  getToolDescription,
41
47
  isChatEventType,
42
48
  mcpToolNames
43
- } from "./chunk-GVEQ3RAH.js";
44
- import {
45
- BASE_INSTRUCTIONS,
46
- TEMPLATES,
47
- renderSystemPrompt
48
- } from "./chunk-SFVKOEQH.js";
49
+ } from "./chunk-MLROFDKR.js";
50
+ import "./chunk-US226AS4.js";
49
51
  import {
50
52
  DEFAULT_REQUEST_OPTIONS
51
53
  } from "./chunk-SG4WLD2H.js";
@@ -250,6 +252,7 @@ export {
250
252
  HUB_ROOM_SYSTEM_PROMPT,
251
253
  HistoryProvider,
252
254
  MCP_TOOL_PREFIX,
255
+ MEMORY_SECTION,
253
256
  MEMORY_TOOL_NAMES,
254
257
  MessageRetryTracker,
255
258
  ParticipantTracker,
@@ -1,9 +1,10 @@
1
- import { h as AgentToolsCapabilities, g as PlatformMessageLike, A as AdapterToolsProtocol, e as Preprocessor, F as FrameworkAdapter, i as PreprocessorContext } from './protocols-DrhzOH6K.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-7jVzOeOP.js';
3
- import { M as MetadataMap, P as ParticipantRecord } from './dtos-DUpbIu8k.js';
1
+ import { h as AgentToolsCapabilities, g as PlatformMessageLike, A as AdapterToolsProtocol, e as Preprocessor, F as FrameworkAdapter, i as PreprocessorContext } from './protocols-BF6jamIl.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-DNySTI_8.js';
3
+ import { M as MetadataMap, P as ParticipantRecord } from './dtos-Dd_fTfLn.js';
4
4
  import { L as Logger } from './logger-CABQOnlR.js';
5
- import { T as ThenvoiLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-CxII3XkA.js';
6
- import { P as PaginationOptions } from './pagination-CcDkVFxK.js';
5
+ import { T as ThenvoiLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-D3AsUnd0.js';
6
+ import { P as PaginationOptions } from './pagination-BBLsYLhT.js';
7
+ import { W as WebSocketConflictPolicy, b as WebSocketDisconnectReason } from './disconnectReason-IuADl6TH.js';
7
8
 
8
9
  interface TopicHandlers {
9
10
  [event: string]: (payload: Record<string, unknown>) => Promise<void> | void;
@@ -26,7 +27,9 @@ interface ThenvoiLinkOptions {
26
27
  transport?: StreamingTransport;
27
28
  logger?: Logger;
28
29
  capabilities?: Partial<AgentToolsCapabilities>;
30
+ conflictPolicy?: WebSocketConflictPolicy;
29
31
  }
32
+ declare function deriveDefaultRestUrl(wsUrl: string): string;
30
33
  interface MessageMarkOptions {
31
34
  bestEffort?: boolean;
32
35
  }
@@ -43,15 +46,21 @@ declare class ThenvoiLink implements AsyncIterable<PlatformEvent> {
43
46
  private readonly eventQueue;
44
47
  private readonly waiters;
45
48
  private connected;
49
+ private lastDisconnectReason;
50
+ private terminalDisconnectError;
46
51
  constructor(options: ThenvoiLinkOptions);
47
52
  isConnected(): boolean;
53
+ getDisconnectReason(): WebSocketDisconnectReason | null;
48
54
  connect(): Promise<void>;
49
55
  disconnect(): Promise<void>;
50
56
  runForever(signal: AbortSignal): Promise<void>;
57
+ private recordDisconnectReason;
58
+ private recordDisconnectError;
51
59
  queueEvent(event: PlatformEvent): void;
52
60
  subscribeAgentRooms(): Promise<void>;
53
61
  subscribeRoom(roomId: string): Promise<void>;
54
62
  unsubscribeRoom(roomId: string): Promise<void>;
63
+ private joinRoomTopics;
55
64
  subscribeAgentContacts(): Promise<void>;
56
65
  unsubscribeAgentContacts(): Promise<void>;
57
66
  nextEvent(signal?: AbortSignal): Promise<PlatformEvent | null>;
@@ -476,7 +485,7 @@ declare const TOOL_MODELS: {
476
485
  };
477
486
  readonly system: {
478
487
  readonly type: "string";
479
- readonly enum: readonly ["sensory", "working", "long_term"];
488
+ readonly enum: readonly ("sensory" | "working" | "long_term")[];
480
489
  readonly description: "Filter by memory system.";
481
490
  };
482
491
  readonly type: {
@@ -516,7 +525,7 @@ declare const TOOL_MODELS: {
516
525
  };
517
526
  readonly system: {
518
527
  readonly type: "string";
519
- readonly enum: readonly ["sensory", "working", "long_term"];
528
+ readonly enum: readonly ("sensory" | "working" | "long_term")[];
520
529
  readonly description: "Memory system tier.";
521
530
  };
522
531
  readonly type: {
@@ -589,4 +598,4 @@ declare const MCP_TOOL_PREFIX = "mcp__thenvoi__";
589
598
  declare function mcpToolNames(names: Set<string>): string[];
590
599
  declare function getToolDescription(name: string): string;
591
600
 
592
- export { AgentRuntime as A, BASE_TOOL_NAMES as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_TOOL_PREFIX as M, PlatformRuntime as P, TOOL_MODELS as T, type PlatformRuntimeOptions as a, ThenvoiLink as b, ExecutionContext as c, ALL_TOOL_NAMES as d, CONTACT_TOOL_NAMES as e, type ExecutionState as f, MEMORY_TOOL_NAMES as g, MessageRetryTracker as h, getToolDescription as i, mcpToolNames as m };
601
+ export { AgentRuntime as A, BASE_TOOL_NAMES as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_TOOL_PREFIX as M, PlatformRuntime as P, TOOL_MODELS as T, type PlatformRuntimeOptions as a, ThenvoiLink as b, ExecutionContext as c, deriveDefaultRestUrl as d, ALL_TOOL_NAMES as e, CONTACT_TOOL_NAMES as f, type ExecutionState as g, MEMORY_TOOL_NAMES as h, MessageRetryTracker as i, getToolDescription as j, mcpToolNames as m };
@@ -1,9 +1,10 @@
1
- import { h as AgentToolsCapabilities, g as PlatformMessageLike, A as AdapterToolsProtocol, e as Preprocessor, F as FrameworkAdapter, i as PreprocessorContext } from './protocols-CInhtFpA.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-CovcHpYf.cjs';
3
- import { M as MetadataMap, P as ParticipantRecord } from './dtos-DUpbIu8k.cjs';
1
+ import { h as AgentToolsCapabilities, g as PlatformMessageLike, A as AdapterToolsProtocol, e as Preprocessor, F as FrameworkAdapter, i as PreprocessorContext } from './protocols-D2bTrQ_t.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-CKqrhGB1.cjs';
3
+ import { M as MetadataMap, P as ParticipantRecord } from './dtos-Dd_fTfLn.cjs';
4
4
  import { L as Logger } from './logger-CABQOnlR.cjs';
5
- import { T as ThenvoiLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-CSHFipIc.cjs';
6
- import { P as PaginationOptions } from './pagination-BPiys10t.cjs';
5
+ import { T as ThenvoiLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-DtMms5Fi.cjs';
6
+ import { P as PaginationOptions } from './pagination-CqidD-L_.cjs';
7
+ import { W as WebSocketConflictPolicy, b as WebSocketDisconnectReason } from './disconnectReason-IuADl6TH.cjs';
7
8
 
8
9
  interface TopicHandlers {
9
10
  [event: string]: (payload: Record<string, unknown>) => Promise<void> | void;
@@ -26,7 +27,9 @@ interface ThenvoiLinkOptions {
26
27
  transport?: StreamingTransport;
27
28
  logger?: Logger;
28
29
  capabilities?: Partial<AgentToolsCapabilities>;
30
+ conflictPolicy?: WebSocketConflictPolicy;
29
31
  }
32
+ declare function deriveDefaultRestUrl(wsUrl: string): string;
30
33
  interface MessageMarkOptions {
31
34
  bestEffort?: boolean;
32
35
  }
@@ -43,15 +46,21 @@ declare class ThenvoiLink implements AsyncIterable<PlatformEvent> {
43
46
  private readonly eventQueue;
44
47
  private readonly waiters;
45
48
  private connected;
49
+ private lastDisconnectReason;
50
+ private terminalDisconnectError;
46
51
  constructor(options: ThenvoiLinkOptions);
47
52
  isConnected(): boolean;
53
+ getDisconnectReason(): WebSocketDisconnectReason | null;
48
54
  connect(): Promise<void>;
49
55
  disconnect(): Promise<void>;
50
56
  runForever(signal: AbortSignal): Promise<void>;
57
+ private recordDisconnectReason;
58
+ private recordDisconnectError;
51
59
  queueEvent(event: PlatformEvent): void;
52
60
  subscribeAgentRooms(): Promise<void>;
53
61
  subscribeRoom(roomId: string): Promise<void>;
54
62
  unsubscribeRoom(roomId: string): Promise<void>;
63
+ private joinRoomTopics;
55
64
  subscribeAgentContacts(): Promise<void>;
56
65
  unsubscribeAgentContacts(): Promise<void>;
57
66
  nextEvent(signal?: AbortSignal): Promise<PlatformEvent | null>;
@@ -476,7 +485,7 @@ declare const TOOL_MODELS: {
476
485
  };
477
486
  readonly system: {
478
487
  readonly type: "string";
479
- readonly enum: readonly ["sensory", "working", "long_term"];
488
+ readonly enum: readonly ("sensory" | "working" | "long_term")[];
480
489
  readonly description: "Filter by memory system.";
481
490
  };
482
491
  readonly type: {
@@ -516,7 +525,7 @@ declare const TOOL_MODELS: {
516
525
  };
517
526
  readonly system: {
518
527
  readonly type: "string";
519
- readonly enum: readonly ["sensory", "working", "long_term"];
528
+ readonly enum: readonly ("sensory" | "working" | "long_term")[];
520
529
  readonly description: "Memory system tier.";
521
530
  };
522
531
  readonly type: {
@@ -589,4 +598,4 @@ declare const MCP_TOOL_PREFIX = "mcp__thenvoi__";
589
598
  declare function mcpToolNames(names: Set<string>): string[];
590
599
  declare function getToolDescription(name: string): string;
591
600
 
592
- export { AgentRuntime as A, BASE_TOOL_NAMES as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_TOOL_PREFIX as M, PlatformRuntime as P, TOOL_MODELS as T, type PlatformRuntimeOptions as a, ThenvoiLink as b, ExecutionContext as c, ALL_TOOL_NAMES as d, CONTACT_TOOL_NAMES as e, type ExecutionState as f, MEMORY_TOOL_NAMES as g, MessageRetryTracker as h, getToolDescription as i, mcpToolNames as m };
601
+ export { AgentRuntime as A, BASE_TOOL_NAMES as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_TOOL_PREFIX as M, PlatformRuntime as P, TOOL_MODELS as T, type PlatformRuntimeOptions as a, ThenvoiLink as b, ExecutionContext as c, deriveDefaultRestUrl as d, ALL_TOOL_NAMES as e, CONTACT_TOOL_NAMES as f, type ExecutionState as g, MEMORY_TOOL_NAMES as h, MessageRetryTracker as i, getToolDescription as j, mcpToolNames as m };
@@ -1,5 +1,5 @@
1
1
  import { McpSdkServerConfigWithInstance, SdkMcpToolDefinition } from '@anthropic-ai/claude-agent-sdk';
2
- import { A as AdapterToolsProtocol } from './protocols-DrhzOH6K.js';
2
+ import { A as AdapterToolsProtocol } from './protocols-BF6jamIl.js';
3
3
 
4
4
  interface McpToolRegistration {
5
5
  name: string;
@@ -40,14 +40,44 @@ declare function errorResult(message: string): McpToolResult;
40
40
 
41
41
  interface CreateThenvoiSdkMcpServerOptions {
42
42
  enableMemoryTools: boolean;
43
+ /**
44
+ * Returns the tools for a given room. In single-room mode (`multiRoom: false`),
45
+ * called once during init with `""` — must return the tools instance regardless of the argument.
46
+ */
43
47
  getToolsForRoom: (roomId: string) => AdapterToolsProtocol | undefined;
44
48
  additionalTools?: McpToolRegistration[];
49
+ multiRoom?: boolean;
50
+ }
51
+ interface GetSystemPromptContextResult {
52
+ roomId: string;
53
+ roomTitle: string | null;
54
+ agent: {
55
+ id: string;
56
+ name: string;
57
+ handle: string | null;
58
+ description: string | null;
59
+ };
60
+ participants: Array<{
61
+ id: string;
62
+ name: string;
63
+ type: string;
64
+ handle: string | null;
65
+ isSelf: boolean;
66
+ }>;
67
+ mentionFormat: string;
68
+ warnings: string[];
69
+ markdown: string;
70
+ }
71
+ interface GetSystemPromptContextOptions {
72
+ ttlMs?: number;
45
73
  }
46
74
  interface ThenvoiSdkMcpServer {
47
75
  serverConfig: McpSdkServerConfigWithInstance;
48
76
  allowedTools: string[];
49
77
  toolDefinitions: Array<SdkMcpToolDefinition<any>>;
78
+ getSystemPromptContext(roomId: string, options?: GetSystemPromptContextOptions): Promise<string>;
79
+ getSystemPromptContextData(roomId: string, options?: GetSystemPromptContextOptions): Promise<GetSystemPromptContextResult>;
50
80
  }
51
81
  declare function createThenvoiSdkMcpServer(options: CreateThenvoiSdkMcpServerOptions): ThenvoiSdkMcpServer;
52
82
 
53
- export { type BuildRegistrationsOptions as B, type CreateThenvoiSdkMcpServerOptions as C, type McpToolRegistration as M, type ThenvoiSdkMcpServer as T, type McpToolInputSchema as a, type McpToolResult as b, buildRoomScopedRegistrations as c, buildSingleContextRegistrations as d, errorResult as e, createThenvoiSdkMcpServer as f, successResult as s };
83
+ export { type BuildRegistrationsOptions as B, type CreateThenvoiSdkMcpServerOptions as C, type GetSystemPromptContextOptions as G, type McpToolRegistration as M, type ThenvoiSdkMcpServer as T, type McpToolInputSchema as a, type McpToolResult as b, buildRoomScopedRegistrations as c, buildSingleContextRegistrations as d, errorResult as e, type GetSystemPromptContextResult as f, createThenvoiSdkMcpServer as g, successResult as s };
@@ -1,5 +1,5 @@
1
1
  import { McpSdkServerConfigWithInstance, SdkMcpToolDefinition } from '@anthropic-ai/claude-agent-sdk';
2
- import { A as AdapterToolsProtocol } from './protocols-CInhtFpA.cjs';
2
+ import { A as AdapterToolsProtocol } from './protocols-D2bTrQ_t.cjs';
3
3
 
4
4
  interface McpToolRegistration {
5
5
  name: string;
@@ -40,14 +40,44 @@ declare function errorResult(message: string): McpToolResult;
40
40
 
41
41
  interface CreateThenvoiSdkMcpServerOptions {
42
42
  enableMemoryTools: boolean;
43
+ /**
44
+ * Returns the tools for a given room. In single-room mode (`multiRoom: false`),
45
+ * called once during init with `""` — must return the tools instance regardless of the argument.
46
+ */
43
47
  getToolsForRoom: (roomId: string) => AdapterToolsProtocol | undefined;
44
48
  additionalTools?: McpToolRegistration[];
49
+ multiRoom?: boolean;
50
+ }
51
+ interface GetSystemPromptContextResult {
52
+ roomId: string;
53
+ roomTitle: string | null;
54
+ agent: {
55
+ id: string;
56
+ name: string;
57
+ handle: string | null;
58
+ description: string | null;
59
+ };
60
+ participants: Array<{
61
+ id: string;
62
+ name: string;
63
+ type: string;
64
+ handle: string | null;
65
+ isSelf: boolean;
66
+ }>;
67
+ mentionFormat: string;
68
+ warnings: string[];
69
+ markdown: string;
70
+ }
71
+ interface GetSystemPromptContextOptions {
72
+ ttlMs?: number;
45
73
  }
46
74
  interface ThenvoiSdkMcpServer {
47
75
  serverConfig: McpSdkServerConfigWithInstance;
48
76
  allowedTools: string[];
49
77
  toolDefinitions: Array<SdkMcpToolDefinition<any>>;
78
+ getSystemPromptContext(roomId: string, options?: GetSystemPromptContextOptions): Promise<string>;
79
+ getSystemPromptContextData(roomId: string, options?: GetSystemPromptContextOptions): Promise<GetSystemPromptContextResult>;
50
80
  }
51
81
  declare function createThenvoiSdkMcpServer(options: CreateThenvoiSdkMcpServerOptions): ThenvoiSdkMcpServer;
52
82
 
53
- export { type BuildRegistrationsOptions as B, type CreateThenvoiSdkMcpServerOptions as C, type McpToolRegistration as M, type ThenvoiSdkMcpServer as T, type McpToolInputSchema as a, type McpToolResult as b, buildRoomScopedRegistrations as c, buildSingleContextRegistrations as d, errorResult as e, createThenvoiSdkMcpServer as f, successResult as s };
83
+ export { type BuildRegistrationsOptions as B, type CreateThenvoiSdkMcpServerOptions as C, type GetSystemPromptContextOptions as G, type McpToolRegistration as M, type ThenvoiSdkMcpServer as T, type McpToolInputSchema as a, type McpToolResult as b, buildRoomScopedRegistrations as c, buildSingleContextRegistrations as d, errorResult as e, type GetSystemPromptContextResult as f, createThenvoiSdkMcpServer as g, successResult as s };
@@ -1,4 +1,4 @@
1
- import { A as AdapterToolsProtocol, F as FrameworkAdapter, H as HistoryConverter, g as PlatformMessageLike, b as FrameworkAdapterInput } from './protocols-CInhtFpA.cjs';
1
+ import { A as AdapterToolsProtocol, F as FrameworkAdapter, H as HistoryConverter, g as PlatformMessageLike, b as FrameworkAdapterInput } from './protocols-D2bTrQ_t.cjs';
2
2
 
3
3
  /**
4
4
  * Base class for framework adapters that process one message at a time.
@@ -1,4 +1,4 @@
1
- import { A as AdapterToolsProtocol, F as FrameworkAdapter, H as HistoryConverter, g as PlatformMessageLike, b as FrameworkAdapterInput } from './protocols-DrhzOH6K.js';
1
+ import { A as AdapterToolsProtocol, F as FrameworkAdapter, H as HistoryConverter, g as PlatformMessageLike, b as FrameworkAdapterInput } from './protocols-BF6jamIl.js';
2
2
 
3
3
  /**
4
4
  * Base class for framework adapters that process one message at a time.
@@ -1,6 +1,6 @@
1
- import { A as AdapterToolsProtocol, d as PeerLookupTools, C as ContactTools, M as MemoryTools, h as AgentToolsCapabilities } from './protocols-CInhtFpA.cjs';
2
- import { a as MentionInput, M as MetadataMap, T as ToolOperationResult, P as ParticipantRecord, c as PaginatedList, d as PeerRecord, 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 } from './dtos-DUpbIu8k.cjs';
3
- import { R as RestApi } from './types-CSHFipIc.cjs';
1
+ import { A as AdapterToolsProtocol, d as PeerLookupTools, C as ContactTools, M as MemoryTools, h as AgentToolsCapabilities } from './protocols-D2bTrQ_t.cjs';
2
+ import { a as MentionInput, M as MetadataMap, T as ToolOperationResult, P as ParticipantRecord, c as PaginatedList, d as PeerRecord, 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 } from './dtos-Dd_fTfLn.cjs';
3
+ import { R as RestApi } from './types-DtMms5Fi.cjs';
4
4
 
5
5
  interface CapturedMessage {
6
6
  content: string;
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as AdapterToolsProtocol, d as PeerLookupTools, C as ContactTools, M as MemoryTools, h as AgentToolsCapabilities } from './protocols-DrhzOH6K.js';
2
- import { a as MentionInput, M as MetadataMap, T as ToolOperationResult, P as ParticipantRecord, c as PaginatedList, d as PeerRecord, 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 } from './dtos-DUpbIu8k.js';
3
- import { R as RestApi } from './types-CxII3XkA.js';
1
+ import { A as AdapterToolsProtocol, d as PeerLookupTools, C as ContactTools, M as MemoryTools, h as AgentToolsCapabilities } from './protocols-BF6jamIl.js';
2
+ import { a as MentionInput, M as MetadataMap, T as ToolOperationResult, P as ParticipantRecord, c as PaginatedList, d as PeerRecord, 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 } from './dtos-Dd_fTfLn.js';
3
+ import { R as RestApi } from './types-D3AsUnd0.js';
4
4
 
5
5
  interface CapturedMessage {
6
6
  content: string;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { P as ParticipantRecord } from './dtos-DUpbIu8k.cjs';
3
- import { g as PlatformMessageLike, A as AdapterToolsProtocol, b as FrameworkAdapterInput, H as HistoryConverter } from './protocols-CInhtFpA.cjs';
2
+ import { P as ParticipantRecord } from './dtos-Dd_fTfLn.cjs';
3
+ import { g as PlatformMessageLike, A as AdapterToolsProtocol, b as FrameworkAdapterInput, H as HistoryConverter } from './protocols-D2bTrQ_t.cjs';
4
4
 
5
5
  declare const messageCreatedPayloadSchema: z.ZodObject<{
6
6
  id: z.ZodString;
@@ -1,4 +1,4 @@
1
- import { T as ToolOperationResult, M as MetadataMap, j as MentionReference, c as PaginatedList, d as PeerRecord, 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, k as ContactRequestAction, l as PaginationMetadataLike } from './dtos-DUpbIu8k.js';
1
+ import { T as ToolOperationResult, M as MetadataMap, j as MentionReference, c as PaginatedList, d as PeerRecord, 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, k as ContactRequestAction, l as PaginationMetadataLike } from './dtos-Dd_fTfLn.js';
2
2
 
3
3
  interface RestRequestOptions {
4
4
  maxRetries?: number;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { P as ParticipantRecord } from './dtos-DUpbIu8k.js';
3
- import { g as PlatformMessageLike, A as AdapterToolsProtocol, b as FrameworkAdapterInput, H as HistoryConverter } from './protocols-DrhzOH6K.js';
2
+ import { P as ParticipantRecord } from './dtos-Dd_fTfLn.js';
3
+ import { g as PlatformMessageLike, A as AdapterToolsProtocol, b as FrameworkAdapterInput, H as HistoryConverter } from './protocols-BF6jamIl.js';
4
4
 
5
5
  declare const messageCreatedPayloadSchema: z.ZodObject<{
6
6
  id: z.ZodString;
@@ -1,4 +1,4 @@
1
- import { T as ToolOperationResult, M as MetadataMap, j as MentionReference, c as PaginatedList, d as PeerRecord, 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, k as ContactRequestAction, l as PaginationMetadataLike } from './dtos-DUpbIu8k.cjs';
1
+ import { T as ToolOperationResult, M as MetadataMap, j as MentionReference, c as PaginatedList, d as PeerRecord, 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, k as ContactRequestAction, l as PaginationMetadataLike } from './dtos-Dd_fTfLn.cjs';
2
2
 
3
3
  interface RestRequestOptions {
4
4
  maxRetries?: number;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@band-ai/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.10",
4
4
  "description": "Thenvoi TypeScript SDK core runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/thenvoi/thenvoi-sdk-typescript.git",
8
+ "url": "git+https://github.com/band-ai/band-sdk-typescript.git",
9
9
  "directory": "packages/sdk"
10
10
  },
11
11
  "type": "module",
@@ -81,10 +81,11 @@
81
81
  "typecheck": "tsc --noEmit",
82
82
  "lint": "eslint .",
83
83
  "clean": "rm -rf dist",
84
- "dev:linear": "tsx examples/linear-thenvoi/linear-thenvoi-bridge-server.ts"
84
+ "dev:linear": "tsx examples/linear-thenvoi/linear-thenvoi-bridge-server.ts",
85
+ "start:linear": "tsx examples/linear-thenvoi/linear-thenvoi-bridge-server.ts"
85
86
  },
86
87
  "engines": {
87
- "node": ">=22"
88
+ "node": ">=22.12"
88
89
  },
89
90
  "dependencies": {
90
91
  "@thenvoi/rest-client": "0.0.113",
@@ -95,23 +96,23 @@
95
96
  "zod-to-json-schema": "^3.25.1"
96
97
  },
97
98
  "peerDependencies": {
98
- "@a2a-js/sdk": "^0.3.10",
99
- "@agentclientprotocol/sdk": "^0.16.1",
100
- "@anthropic-ai/claude-agent-sdk": "^0.2.63",
101
- "@anthropic-ai/sdk": "^0.78.0",
102
- "@google/adk": "^0.5.0",
103
- "@google/genai": "^1.44.0",
104
- "@langchain/core": "^1.1.31",
105
- "@langchain/langgraph": "^1.2.0",
106
- "@linear/sdk": "^76.0.0",
107
- "@letta-ai/letta-client": "^1.7.0",
108
- "@modelcontextprotocol/sdk": "^1.10.0",
109
- "@openai/codex-sdk": "^0.107.0",
110
- "@opencode-ai/sdk": "^1.3.0",
111
- "ai": "^6.0.137",
112
- "express": "^5.2.1",
113
- "openai": "^6.27.0",
114
- "parlant-client": "^3.2.0"
99
+ "@a2a-js/sdk": ">=0.3.10",
100
+ "@agentclientprotocol/sdk": ">=0.16.1",
101
+ "@anthropic-ai/claude-agent-sdk": ">=0.2.63",
102
+ "@anthropic-ai/sdk": ">=0.78.0",
103
+ "@google/adk": ">=0.5.0",
104
+ "@google/genai": ">=1.44.0",
105
+ "@langchain/core": ">=1.1.31",
106
+ "@langchain/langgraph": ">=1.2.0",
107
+ "@linear/sdk": ">=76.0.0",
108
+ "@letta-ai/letta-client": ">=1.7.0",
109
+ "@modelcontextprotocol/sdk": ">=1.10.0",
110
+ "@openai/codex-sdk": ">=0.107.0",
111
+ "@opencode-ai/sdk": ">=1.3.0",
112
+ "ai": ">=6.0.137",
113
+ "express": ">=5.2.1",
114
+ "openai": ">=6.27.0",
115
+ "parlant-client": ">=3.2.0"
115
116
  },
116
117
  "peerDependenciesMeta": {
117
118
  "@a2a-js/sdk": {