@butlerbot/sdk 0.0.10-alpha → 0.0.10-alpha.1

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.
@@ -1,3 +1,4 @@
1
+ import { EventSource } from "eventsource";
1
2
  import { CONFIG } from "../config";
2
3
  import { RequestResponseV4 } from "../types/type_registry";
3
4
  import { ConversationStateResponse } from "../types/state/convo_state_response";
@@ -94,8 +95,8 @@ export declare class Conversation {
94
95
  /** Fetches the conversation state from the server, including message history and metadata */
95
96
  fetchState(): Promise<ConversationStateResponse>;
96
97
  /** Fetches the conversation stream from the server */
97
- fetchStream(cb: (chunk: RequestResponse) => any): void;
98
+ fetchStream(cb: (chunk: RequestResponse) => any): EventSource;
98
99
  /** Sends a message into the conversation */
99
- send(message: string, cb: (chunk: RequestResponse) => any, options?: DialogueRequestOptions): void;
100
+ send(message: string, cb: (chunk: RequestResponse) => any, options?: DialogueRequestOptions): EventSource;
100
101
  }
101
102
  export {};
@@ -135,6 +135,7 @@ class Conversation {
135
135
  if (this.debug)
136
136
  console.warn(`[Stream Error: ${url}]`, event);
137
137
  });
138
+ return sse;
138
139
  }
139
140
  // GETTERS
140
141
  /** Fetches the conversation state from the server, including message history and metadata */
@@ -198,6 +198,15 @@ export type BaseResponseMetadata = {
198
198
  /** The participant who generated this response */
199
199
  participantId?: string;
200
200
  };
201
+ /** A user message event */
202
+ export type UserMessageEvent = {
203
+ type: "user_message";
204
+ payload: MessagePayload;
205
+ metadata: {
206
+ userId: string;
207
+ timestamp: number;
208
+ };
209
+ };
201
210
  export type MessageEvent = {
202
211
  type: "message";
203
212
  payload: MessagePayload;
@@ -1,4 +1,4 @@
1
- import { ConvoStatusEvent, FileEvent, MessageEvent, ModelMessageCost, ReasoningEvent, ResponseMetadata, ResponseStatusEvent, TokenUsage, ToolEvent } from "../../conversation/v3/conversation_v3";
1
+ import { ConvoStatusEvent, FileEvent, MessageEvent, ModelMessageCost, ReasoningEvent, ResponseMetadata, ResponseStatusEvent, TokenUsage, ToolEvent, UserMessageEvent } from "../../conversation/v3/conversation_v3";
2
2
  import { ErrorCode } from "../../error";
3
3
  export type AIChatResultFailV4 = {
4
4
  success: false;
@@ -13,6 +13,7 @@ export type AIChatResultV4 = AIChatResultFailV4 | AIChatResultSuccessV4;
13
13
  export type TokenUsageV4 = TokenUsage;
14
14
  export type ModelMessageCostV4 = ModelMessageCost;
15
15
  export type ResponseStatusMetadataV4 = ResponseMetadata;
16
+ export type UserMessageResponseV4 = UserMessageEvent;
16
17
  export type AIMessageResponseV4 = MessageEvent;
17
18
  export type AIReasoningResponseV4 = ReasoningEvent;
18
19
  export type AIFileResponseV4 = FileEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butlerbot/sdk",
3
- "version": "0.0.10-alpha",
3
+ "version": "0.0.10-alpha.1",
4
4
  "description": "The official ButlerBot SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",