@base44-preview/sdk 0.8.17-pr.75.4ddbc56 → 0.8.17-pr.76.a16c363
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/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl } from
|
|
|
4
4
|
export { createClient, createClientFromRequest, Base44Error, getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl, };
|
|
5
5
|
export type { Base44Client, CreateClientConfig, CreateClientOptions, Base44ErrorJSON, };
|
|
6
6
|
export * from "./types.js";
|
|
7
|
-
export type { EntitiesModule, EntityHandler, RealtimeEventType, RealtimeEvent, RealtimeCallback,
|
|
7
|
+
export type { EntitiesModule, EntityHandler, RealtimeEventType, RealtimeEvent, RealtimeCallback, } from "./modules/entities.types.js";
|
|
8
8
|
export type { AuthModule, LoginResponse, RegisterParams, VerifyOtpParams, ChangePasswordParams, ResetPasswordParams, User, } from "./modules/auth.types.js";
|
|
9
9
|
export type { IntegrationsModule, IntegrationPackage, IntegrationEndpointFunction, CoreIntegrations, InvokeLLMParams, GenerateImageParams, GenerateImageResult, UploadFileParams, UploadFileResult, SendEmailParams, SendEmailResult, ExtractDataFromUploadedFileParams, ExtractDataFromUploadedFileResult, UploadPrivateFileParams, UploadPrivateFileResult, CreateFileSignedUrlParams, CreateFileSignedUrlResult, } from "./modules/integrations.types.js";
|
|
10
10
|
export type { FunctionsModule } from "./modules/functions.types.js";
|
|
@@ -138,7 +138,7 @@ export interface CreateConversationParams {
|
|
|
138
138
|
export interface AgentsModuleConfig {
|
|
139
139
|
/** Axios instance for HTTP requests */
|
|
140
140
|
axios: AxiosInstance;
|
|
141
|
-
/** Function to get WebSocket instance for
|
|
141
|
+
/** Function to get WebSocket instance for realtime updates (lazy initialization) */
|
|
142
142
|
getSocket: () => ReturnType<typeof RoomsSocket>;
|
|
143
143
|
/** Application ID */
|
|
144
144
|
appId: string;
|
|
@@ -151,7 +151,7 @@ export interface AgentsModuleConfig {
|
|
|
151
151
|
* Agents module for managing AI agent conversations.
|
|
152
152
|
*
|
|
153
153
|
* This module provides methods to create and manage conversations with AI agents,
|
|
154
|
-
* send messages, and subscribe to
|
|
154
|
+
* send messages, and subscribe to realtime updates. Conversations can be used
|
|
155
155
|
* for chat interfaces, support systems, or any interactive AI app.
|
|
156
156
|
*
|
|
157
157
|
* The agents module enables you to:
|
|
@@ -159,7 +159,7 @@ export interface AgentsModuleConfig {
|
|
|
159
159
|
* - **Create conversations** with agents defined in the app.
|
|
160
160
|
* - **Send messages** from users to agents and receive AI-generated responses.
|
|
161
161
|
* - **Retrieve conversations** individually or as filtered lists with sorting and pagination.
|
|
162
|
-
* - **Subscribe to
|
|
162
|
+
* - **Subscribe to realtime updates** using WebSocket connections to receive instant notifications when new messages arrive.
|
|
163
163
|
* - **Attach metadata** to conversations for tracking context, categories, priorities, or linking to external systems.
|
|
164
164
|
* - **Generate WhatsApp connection URLs** for users to interact with agents through WhatsApp.
|
|
165
165
|
*
|
|
@@ -275,7 +275,7 @@ export interface AgentsModule {
|
|
|
275
275
|
* Adds a message to a conversation.
|
|
276
276
|
*
|
|
277
277
|
* Sends a message to the agent and updates the conversation. This method
|
|
278
|
-
* also updates the
|
|
278
|
+
* also updates the realtime socket to notify any subscribers.
|
|
279
279
|
*
|
|
280
280
|
* @param conversation - The conversation to add the message to.
|
|
281
281
|
* @param message - The message to add.
|
|
@@ -293,19 +293,25 @@ export interface AgentsModule {
|
|
|
293
293
|
*/
|
|
294
294
|
addMessage(conversation: AgentConversation, message: Partial<AgentMessage>): Promise<AgentMessage>;
|
|
295
295
|
/**
|
|
296
|
-
* Subscribes to
|
|
296
|
+
* Subscribes to realtime updates for a conversation.
|
|
297
297
|
*
|
|
298
298
|
* Establishes a WebSocket connection to receive instant updates when new
|
|
299
299
|
* messages are added to the conversation. Returns an unsubscribe function
|
|
300
300
|
* to clean up the connection.
|
|
301
301
|
*
|
|
302
302
|
* @param conversationId - The conversation ID to subscribe to.
|
|
303
|
-
* @param onUpdate - Callback function called when the conversation is updated.
|
|
303
|
+
* @param onUpdate - Callback function called when the conversation is updated. The callback receives a conversation object with the following properties:
|
|
304
|
+
* - `id`: Unique identifier for the conversation.
|
|
305
|
+
* - `agent_name`: Name of the agent in this conversation.
|
|
306
|
+
* - `created_date`: ISO 8601 timestamp of when the conversation was created.
|
|
307
|
+
* - `updated_date`: ISO 8601 timestamp of when the conversation was last updated.
|
|
308
|
+
* - `messages`: Array of messages in the conversation. Each message includes `id`, `role` (`'user'`, `'assistant'`, or `'system'`), `content`, `created_date`, and optionally `tool_calls`, `reasoning`, `file_urls`, and `usage`.
|
|
309
|
+
* - `metadata`: Optional metadata associated with the conversation.
|
|
304
310
|
* @returns Unsubscribe function to stop receiving updates.
|
|
305
311
|
*
|
|
306
312
|
* @example
|
|
307
313
|
* ```typescript
|
|
308
|
-
* // Subscribe to
|
|
314
|
+
* // Subscribe to realtime updates
|
|
309
315
|
* const unsubscribe = base44.agents.subscribeToConversation(
|
|
310
316
|
* 'conv-123',
|
|
311
317
|
* (updatedConversation) => {
|
|
@@ -166,7 +166,6 @@ function startHeartBeatProcessor(track) {
|
|
|
166
166
|
return () => { };
|
|
167
167
|
}
|
|
168
168
|
analyticsSharedState.isHeartBeatProcessing = true;
|
|
169
|
-
track({ eventName: USER_HEARTBEAT_EVENT_NAME });
|
|
170
169
|
const interval = setInterval(() => {
|
|
171
170
|
track({ eventName: USER_HEARTBEAT_EVENT_NAME });
|
|
172
171
|
}, analyticsSharedState.config.heartBeatInterval);
|
|
@@ -19,10 +19,6 @@ export interface RealtimeEvent {
|
|
|
19
19
|
* Callback function invoked when a realtime event occurs.
|
|
20
20
|
*/
|
|
21
21
|
export type RealtimeCallback = (event: RealtimeEvent) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Function returned from subscribe, call it to unsubscribe.
|
|
24
|
-
*/
|
|
25
|
-
export type Subscription = () => void;
|
|
26
22
|
/**
|
|
27
23
|
* Entity handler providing CRUD operations for a specific entity type.
|
|
28
24
|
*
|
|
@@ -270,10 +266,16 @@ export interface EntityHandler {
|
|
|
270
266
|
/**
|
|
271
267
|
* Subscribes to realtime updates for all records of this entity type.
|
|
272
268
|
*
|
|
273
|
-
*
|
|
269
|
+
* Establishes a WebSocket connection to receive instant updates when any
|
|
270
|
+
* record is created, updated, or deleted. Returns an unsubscribe function
|
|
271
|
+
* to clean up the connection.
|
|
274
272
|
*
|
|
275
|
-
* @param callback -
|
|
276
|
-
*
|
|
273
|
+
* @param callback - Callback function called when an entity changes. The callback receives an event object with the following properties:
|
|
274
|
+
* - `type`: The type of change that occurred - `'create'`, `'update'`, or `'delete'`.
|
|
275
|
+
* - `data`: The entity data after the change.
|
|
276
|
+
* - `id`: The unique identifier of the affected entity.
|
|
277
|
+
* - `timestamp`: ISO 8601 timestamp of when the event occurred.
|
|
278
|
+
* @returns Unsubscribe function to stop receiving updates.
|
|
277
279
|
*
|
|
278
280
|
* @example
|
|
279
281
|
* ```typescript
|
|
@@ -282,11 +284,11 @@ export interface EntityHandler {
|
|
|
282
284
|
* console.log(`Task ${event.id} was ${event.type}d:`, event.data);
|
|
283
285
|
* });
|
|
284
286
|
*
|
|
285
|
-
* // Later,
|
|
287
|
+
* // Later, clean up the subscription
|
|
286
288
|
* unsubscribe();
|
|
287
289
|
* ```
|
|
288
290
|
*/
|
|
289
|
-
subscribe(callback: RealtimeCallback):
|
|
291
|
+
subscribe(callback: RealtimeCallback): () => void;
|
|
290
292
|
}
|
|
291
293
|
/**
|
|
292
294
|
* Entities module for managing app data.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.17-pr.
|
|
3
|
+
"version": "0.8.17-pr.76.a16c363",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"prepublishOnly": "npm run build",
|
|
21
21
|
"create-docs": "npm run create-docs:generate && npm run create-docs:process",
|
|
22
22
|
"push-docs": "node scripts/mintlify-post-processing/push-to-docs-repo.js",
|
|
23
|
+
"copy-docs-local": "node scripts/mintlify-post-processing/copy-to-local-docs.js",
|
|
23
24
|
"create-docs:generate": "typedoc",
|
|
24
25
|
"create-docs:process": "node scripts/mintlify-post-processing/file-processing/file-processing.js"
|
|
25
26
|
},
|