@superatomai/sdk-web 0.0.18 → 0.0.19
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 +755 -755
- package/dist/index.cjs +108 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -1
- package/dist/index.d.ts +81 -1
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -1
- package/package.json +41 -43
package/dist/index.d.cts
CHANGED
|
@@ -2184,6 +2184,62 @@ declare function getKbNodeTags(client: SuperatomClient, timeout?: number): Promi
|
|
|
2184
2184
|
message?: string;
|
|
2185
2185
|
}>;
|
|
2186
2186
|
|
|
2187
|
+
/**
|
|
2188
|
+
* Dashboard Component Service
|
|
2189
|
+
* Handles DASH_COMP_REQ messages for picking components and generating props
|
|
2190
|
+
*/
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Response type for dashboard component request
|
|
2194
|
+
*/
|
|
2195
|
+
interface DashCompResponse {
|
|
2196
|
+
success: boolean;
|
|
2197
|
+
errors?: string[];
|
|
2198
|
+
component?: Component;
|
|
2199
|
+
reasoning?: string;
|
|
2200
|
+
dataSource?: 'database' | 'external_tool' | 'none';
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* Options for dashboard component request
|
|
2204
|
+
*/
|
|
2205
|
+
interface DashCompRequestOptions {
|
|
2206
|
+
/** User's prompt describing what component they need */
|
|
2207
|
+
prompt: string;
|
|
2208
|
+
/** Optional thread ID for conversation context */
|
|
2209
|
+
threadId?: string;
|
|
2210
|
+
/** Optional UI block ID for context */
|
|
2211
|
+
uiBlockId?: string;
|
|
2212
|
+
/** Request timeout in milliseconds */
|
|
2213
|
+
timeout?: number;
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Send a dashboard component request
|
|
2217
|
+
*
|
|
2218
|
+
* This method asks the LLM to:
|
|
2219
|
+
* 1. Pick the most appropriate component from available components
|
|
2220
|
+
* 2. Generate complete props for the component
|
|
2221
|
+
* 3. Determine data source (database query or external tool)
|
|
2222
|
+
*
|
|
2223
|
+
* @param client - SuperatomClient instance
|
|
2224
|
+
* @param options - Request options including prompt and optional context
|
|
2225
|
+
* @returns Dashboard component response with selected component and props
|
|
2226
|
+
*
|
|
2227
|
+
* @example
|
|
2228
|
+
* ```typescript
|
|
2229
|
+
* const response = await sendDashCompRequest(client, {
|
|
2230
|
+
* prompt: "Show me a bar chart of sales by category",
|
|
2231
|
+
* threadId: "thread-123",
|
|
2232
|
+
* });
|
|
2233
|
+
*
|
|
2234
|
+
* if (response.success && response.component) {
|
|
2235
|
+
* console.log('Selected component:', response.component.name);
|
|
2236
|
+
* console.log('Generated props:', response.component.props);
|
|
2237
|
+
* console.log('Data source:', response.dataSource);
|
|
2238
|
+
* }
|
|
2239
|
+
* ```
|
|
2240
|
+
*/
|
|
2241
|
+
declare function sendDashCompRequest(client: SuperatomClient, options: DashCompRequestOptions): Promise<DashCompResponse>;
|
|
2242
|
+
|
|
2187
2243
|
/**
|
|
2188
2244
|
* Services Index
|
|
2189
2245
|
* Re-exports all service functions for easy importing
|
|
@@ -2196,6 +2252,8 @@ type index_CreateBookmarkOptions = CreateBookmarkOptions;
|
|
|
2196
2252
|
type index_CreateDashboardOptions = CreateDashboardOptions;
|
|
2197
2253
|
type index_CreateReportOptions = CreateReportOptions;
|
|
2198
2254
|
type index_CreateUIOptions = CreateUIOptions;
|
|
2255
|
+
type index_DashCompRequestOptions = DashCompRequestOptions;
|
|
2256
|
+
type index_DashCompResponse = DashCompResponse;
|
|
2199
2257
|
type index_Dashboard = Dashboard;
|
|
2200
2258
|
type index_Expression = Expression;
|
|
2201
2259
|
declare const index_ExpressionSchema: typeof ExpressionSchema;
|
|
@@ -2264,6 +2322,7 @@ declare const index_searchKbNodes: typeof searchKbNodes;
|
|
|
2264
2322
|
declare const index_sendAuthLoginRequest: typeof sendAuthLoginRequest;
|
|
2265
2323
|
declare const index_sendAuthVerifyRequest: typeof sendAuthVerifyRequest;
|
|
2266
2324
|
declare const index_sendComponents: typeof sendComponents;
|
|
2325
|
+
declare const index_sendDashCompRequest: typeof sendDashCompRequest;
|
|
2267
2326
|
declare const index_sendUserPromptRequest: typeof sendUserPromptRequest;
|
|
2268
2327
|
declare const index_sendUserPromptSuggestionsRequest: typeof sendUserPromptSuggestionsRequest;
|
|
2269
2328
|
declare const index_updateBookmark: typeof updateBookmark;
|
|
@@ -2273,7 +2332,7 @@ declare const index_updateReport: typeof updateReport;
|
|
|
2273
2332
|
declare const index_updateUI: typeof updateUI;
|
|
2274
2333
|
declare const index_updateUser: typeof updateUser;
|
|
2275
2334
|
declare namespace index {
|
|
2276
|
-
export { type index_Binding as Binding, index_BindingSchema as BindingSchema, type index_Bookmark as Bookmark, type index_CreateBookmarkOptions as CreateBookmarkOptions, type index_CreateDashboardOptions as CreateDashboardOptions, type index_CreateReportOptions as CreateReportOptions, type index_CreateUIOptions as CreateUIOptions, type DSLRendererProps$2 as DSLRendererProps, DSLRendererPropsSchema$2 as DSLRendererPropsSchema, type index_Dashboard as Dashboard, type index_Expression as Expression, index_ExpressionSchema as ExpressionSchema, type index_ForDirective as ForDirective, index_ForDirectiveSchema as ForDirectiveSchema, type index_KbNode as KbNode, type index_Page as Page, index_PageSchema as PageSchema, type index_QueryBookmarksOptions as QueryBookmarksOptions, type index_QueryDashboardsOptions as QueryDashboardsOptions, type index_QueryReportsOptions as QueryReportsOptions, type index_QuerySpec as QuerySpec, index_QuerySpecSchema as QuerySpecSchema, type index_QueryUIsOptions as QueryUIsOptions, type index_QueryUsersOptions as QueryUsersOptions, type index_Report as Report, type DSLRendererProps$1 as ReportDSLRendererProps, type index_SearchKbNodesOptions as SearchKbNodesOptions, type index_UI as UI, type index_UIComponent as UIComponent, index_UIComponentSchema as UIComponentSchema, type DSLRendererProps as UIDSLRendererProps, type index_UIElement as UIElement, index_UIElementSchema as UIElementSchema, type index_UpdateBookmarkOptions as UpdateBookmarkOptions, type index_UpdateDashboardOptions as UpdateDashboardOptions, type index_UpdateReportOptions as UpdateReportOptions, type index_UpdateUIOptions as UpdateUIOptions, type index_User as User, index_createBookmark as createBookmark, index_createDashboard as createDashboard, index_createKbNode as createKbNode, index_createReport as createReport, index_createUI as createUI, index_createUser as createUser, index_deleteBookmark as deleteBookmark, index_deleteDashboard as deleteDashboard, index_deleteKbNode as deleteKbNode, index_deleteReport as deleteReport, index_deleteUI as deleteUI, index_deleteUser as deleteUser, index_getActions as getActions, index_getAllBookmarks as getAllBookmarks, index_getAllDashboards as getAllDashboards, index_getAllKbNodes as getAllKbNodes, index_getAllReports as getAllReports, index_getAllUIs as getAllUIs, index_getAllUsers as getAllUsers, index_getBookmark as getBookmark, index_getComponentSuggestions as getComponentSuggestions, index_getDashboard as getDashboard, index_getKbNode as getKbNode, index_getKbNodeCategories as getKbNodeCategories, index_getKbNodeTags as getKbNodeTags, index_getKbNodesByCategory as getKbNodesByCategory, index_getKbNodesByUser as getKbNodesByUser, index_getReport as getReport, index_getUI as getUI, index_getUser as getUser, index_queryBookmarks as queryBookmarks, index_queryDashboards as queryDashboards, index_queryReports as queryReports, index_queryUIs as queryUIs, index_queryUsers as queryUsers, index_requestBundle as requestBundle, index_requestData as requestData, index_searchKbNodes as searchKbNodes, index_sendAuthLoginRequest as sendAuthLoginRequest, index_sendAuthVerifyRequest as sendAuthVerifyRequest, index_sendComponents as sendComponents, index_sendUserPromptRequest as sendUserPromptRequest, index_sendUserPromptSuggestionsRequest as sendUserPromptSuggestionsRequest, index_updateBookmark as updateBookmark, index_updateDashboard as updateDashboard, index_updateKbNode as updateKbNode, index_updateReport as updateReport, index_updateUI as updateUI, index_updateUser as updateUser };
|
|
2335
|
+
export { type index_Binding as Binding, index_BindingSchema as BindingSchema, type index_Bookmark as Bookmark, type index_CreateBookmarkOptions as CreateBookmarkOptions, type index_CreateDashboardOptions as CreateDashboardOptions, type index_CreateReportOptions as CreateReportOptions, type index_CreateUIOptions as CreateUIOptions, type DSLRendererProps$2 as DSLRendererProps, DSLRendererPropsSchema$2 as DSLRendererPropsSchema, type index_DashCompRequestOptions as DashCompRequestOptions, type index_DashCompResponse as DashCompResponse, type index_Dashboard as Dashboard, type index_Expression as Expression, index_ExpressionSchema as ExpressionSchema, type index_ForDirective as ForDirective, index_ForDirectiveSchema as ForDirectiveSchema, type index_KbNode as KbNode, type index_Page as Page, index_PageSchema as PageSchema, type index_QueryBookmarksOptions as QueryBookmarksOptions, type index_QueryDashboardsOptions as QueryDashboardsOptions, type index_QueryReportsOptions as QueryReportsOptions, type index_QuerySpec as QuerySpec, index_QuerySpecSchema as QuerySpecSchema, type index_QueryUIsOptions as QueryUIsOptions, type index_QueryUsersOptions as QueryUsersOptions, type index_Report as Report, type DSLRendererProps$1 as ReportDSLRendererProps, type index_SearchKbNodesOptions as SearchKbNodesOptions, type index_UI as UI, type index_UIComponent as UIComponent, index_UIComponentSchema as UIComponentSchema, type DSLRendererProps as UIDSLRendererProps, type index_UIElement as UIElement, index_UIElementSchema as UIElementSchema, type index_UpdateBookmarkOptions as UpdateBookmarkOptions, type index_UpdateDashboardOptions as UpdateDashboardOptions, type index_UpdateReportOptions as UpdateReportOptions, type index_UpdateUIOptions as UpdateUIOptions, type index_User as User, index_createBookmark as createBookmark, index_createDashboard as createDashboard, index_createKbNode as createKbNode, index_createReport as createReport, index_createUI as createUI, index_createUser as createUser, index_deleteBookmark as deleteBookmark, index_deleteDashboard as deleteDashboard, index_deleteKbNode as deleteKbNode, index_deleteReport as deleteReport, index_deleteUI as deleteUI, index_deleteUser as deleteUser, index_getActions as getActions, index_getAllBookmarks as getAllBookmarks, index_getAllDashboards as getAllDashboards, index_getAllKbNodes as getAllKbNodes, index_getAllReports as getAllReports, index_getAllUIs as getAllUIs, index_getAllUsers as getAllUsers, index_getBookmark as getBookmark, index_getComponentSuggestions as getComponentSuggestions, index_getDashboard as getDashboard, index_getKbNode as getKbNode, index_getKbNodeCategories as getKbNodeCategories, index_getKbNodeTags as getKbNodeTags, index_getKbNodesByCategory as getKbNodesByCategory, index_getKbNodesByUser as getKbNodesByUser, index_getReport as getReport, index_getUI as getUI, index_getUser as getUser, index_queryBookmarks as queryBookmarks, index_queryDashboards as queryDashboards, index_queryReports as queryReports, index_queryUIs as queryUIs, index_queryUsers as queryUsers, index_requestBundle as requestBundle, index_requestData as requestData, index_searchKbNodes as searchKbNodes, index_sendAuthLoginRequest as sendAuthLoginRequest, index_sendAuthVerifyRequest as sendAuthVerifyRequest, index_sendComponents as sendComponents, index_sendDashCompRequest as sendDashCompRequest, index_sendUserPromptRequest as sendUserPromptRequest, index_sendUserPromptSuggestionsRequest as sendUserPromptSuggestionsRequest, index_updateBookmark as updateBookmark, index_updateDashboard as updateDashboard, index_updateKbNode as updateKbNode, index_updateReport as updateReport, index_updateUI as updateUI, index_updateUser as updateUser };
|
|
2277
2336
|
}
|
|
2278
2337
|
|
|
2279
2338
|
type MessageHandler = (message: Message) => void;
|
|
@@ -2916,6 +2975,27 @@ declare class SuperatomClient {
|
|
|
2916
2975
|
count?: number;
|
|
2917
2976
|
message?: string;
|
|
2918
2977
|
}>;
|
|
2978
|
+
/**
|
|
2979
|
+
* Request a dashboard component based on user prompt
|
|
2980
|
+
* Uses LLM to pick the best component and generate props
|
|
2981
|
+
* Supports both database queries and external tools as data sources
|
|
2982
|
+
* Delegates to dash-comp service
|
|
2983
|
+
*
|
|
2984
|
+
* @example
|
|
2985
|
+
* ```typescript
|
|
2986
|
+
* const response = await client.sendDashCompRequest({
|
|
2987
|
+
* prompt: "Show me a bar chart of sales by category",
|
|
2988
|
+
* threadId: "thread-123",
|
|
2989
|
+
* });
|
|
2990
|
+
*
|
|
2991
|
+
* if (response.success && response.component) {
|
|
2992
|
+
* console.log('Component:', response.component.name);
|
|
2993
|
+
* console.log('Props:', response.component.props);
|
|
2994
|
+
* console.log('Data source:', response.dataSource);
|
|
2995
|
+
* }
|
|
2996
|
+
* ```
|
|
2997
|
+
*/
|
|
2998
|
+
sendDashCompRequest(options: DashCompRequestOptions): Promise<DashCompResponse>;
|
|
2919
2999
|
/**
|
|
2920
3000
|
* Internal logging
|
|
2921
3001
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -2184,6 +2184,62 @@ declare function getKbNodeTags(client: SuperatomClient, timeout?: number): Promi
|
|
|
2184
2184
|
message?: string;
|
|
2185
2185
|
}>;
|
|
2186
2186
|
|
|
2187
|
+
/**
|
|
2188
|
+
* Dashboard Component Service
|
|
2189
|
+
* Handles DASH_COMP_REQ messages for picking components and generating props
|
|
2190
|
+
*/
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Response type for dashboard component request
|
|
2194
|
+
*/
|
|
2195
|
+
interface DashCompResponse {
|
|
2196
|
+
success: boolean;
|
|
2197
|
+
errors?: string[];
|
|
2198
|
+
component?: Component;
|
|
2199
|
+
reasoning?: string;
|
|
2200
|
+
dataSource?: 'database' | 'external_tool' | 'none';
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* Options for dashboard component request
|
|
2204
|
+
*/
|
|
2205
|
+
interface DashCompRequestOptions {
|
|
2206
|
+
/** User's prompt describing what component they need */
|
|
2207
|
+
prompt: string;
|
|
2208
|
+
/** Optional thread ID for conversation context */
|
|
2209
|
+
threadId?: string;
|
|
2210
|
+
/** Optional UI block ID for context */
|
|
2211
|
+
uiBlockId?: string;
|
|
2212
|
+
/** Request timeout in milliseconds */
|
|
2213
|
+
timeout?: number;
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Send a dashboard component request
|
|
2217
|
+
*
|
|
2218
|
+
* This method asks the LLM to:
|
|
2219
|
+
* 1. Pick the most appropriate component from available components
|
|
2220
|
+
* 2. Generate complete props for the component
|
|
2221
|
+
* 3. Determine data source (database query or external tool)
|
|
2222
|
+
*
|
|
2223
|
+
* @param client - SuperatomClient instance
|
|
2224
|
+
* @param options - Request options including prompt and optional context
|
|
2225
|
+
* @returns Dashboard component response with selected component and props
|
|
2226
|
+
*
|
|
2227
|
+
* @example
|
|
2228
|
+
* ```typescript
|
|
2229
|
+
* const response = await sendDashCompRequest(client, {
|
|
2230
|
+
* prompt: "Show me a bar chart of sales by category",
|
|
2231
|
+
* threadId: "thread-123",
|
|
2232
|
+
* });
|
|
2233
|
+
*
|
|
2234
|
+
* if (response.success && response.component) {
|
|
2235
|
+
* console.log('Selected component:', response.component.name);
|
|
2236
|
+
* console.log('Generated props:', response.component.props);
|
|
2237
|
+
* console.log('Data source:', response.dataSource);
|
|
2238
|
+
* }
|
|
2239
|
+
* ```
|
|
2240
|
+
*/
|
|
2241
|
+
declare function sendDashCompRequest(client: SuperatomClient, options: DashCompRequestOptions): Promise<DashCompResponse>;
|
|
2242
|
+
|
|
2187
2243
|
/**
|
|
2188
2244
|
* Services Index
|
|
2189
2245
|
* Re-exports all service functions for easy importing
|
|
@@ -2196,6 +2252,8 @@ type index_CreateBookmarkOptions = CreateBookmarkOptions;
|
|
|
2196
2252
|
type index_CreateDashboardOptions = CreateDashboardOptions;
|
|
2197
2253
|
type index_CreateReportOptions = CreateReportOptions;
|
|
2198
2254
|
type index_CreateUIOptions = CreateUIOptions;
|
|
2255
|
+
type index_DashCompRequestOptions = DashCompRequestOptions;
|
|
2256
|
+
type index_DashCompResponse = DashCompResponse;
|
|
2199
2257
|
type index_Dashboard = Dashboard;
|
|
2200
2258
|
type index_Expression = Expression;
|
|
2201
2259
|
declare const index_ExpressionSchema: typeof ExpressionSchema;
|
|
@@ -2264,6 +2322,7 @@ declare const index_searchKbNodes: typeof searchKbNodes;
|
|
|
2264
2322
|
declare const index_sendAuthLoginRequest: typeof sendAuthLoginRequest;
|
|
2265
2323
|
declare const index_sendAuthVerifyRequest: typeof sendAuthVerifyRequest;
|
|
2266
2324
|
declare const index_sendComponents: typeof sendComponents;
|
|
2325
|
+
declare const index_sendDashCompRequest: typeof sendDashCompRequest;
|
|
2267
2326
|
declare const index_sendUserPromptRequest: typeof sendUserPromptRequest;
|
|
2268
2327
|
declare const index_sendUserPromptSuggestionsRequest: typeof sendUserPromptSuggestionsRequest;
|
|
2269
2328
|
declare const index_updateBookmark: typeof updateBookmark;
|
|
@@ -2273,7 +2332,7 @@ declare const index_updateReport: typeof updateReport;
|
|
|
2273
2332
|
declare const index_updateUI: typeof updateUI;
|
|
2274
2333
|
declare const index_updateUser: typeof updateUser;
|
|
2275
2334
|
declare namespace index {
|
|
2276
|
-
export { type index_Binding as Binding, index_BindingSchema as BindingSchema, type index_Bookmark as Bookmark, type index_CreateBookmarkOptions as CreateBookmarkOptions, type index_CreateDashboardOptions as CreateDashboardOptions, type index_CreateReportOptions as CreateReportOptions, type index_CreateUIOptions as CreateUIOptions, type DSLRendererProps$2 as DSLRendererProps, DSLRendererPropsSchema$2 as DSLRendererPropsSchema, type index_Dashboard as Dashboard, type index_Expression as Expression, index_ExpressionSchema as ExpressionSchema, type index_ForDirective as ForDirective, index_ForDirectiveSchema as ForDirectiveSchema, type index_KbNode as KbNode, type index_Page as Page, index_PageSchema as PageSchema, type index_QueryBookmarksOptions as QueryBookmarksOptions, type index_QueryDashboardsOptions as QueryDashboardsOptions, type index_QueryReportsOptions as QueryReportsOptions, type index_QuerySpec as QuerySpec, index_QuerySpecSchema as QuerySpecSchema, type index_QueryUIsOptions as QueryUIsOptions, type index_QueryUsersOptions as QueryUsersOptions, type index_Report as Report, type DSLRendererProps$1 as ReportDSLRendererProps, type index_SearchKbNodesOptions as SearchKbNodesOptions, type index_UI as UI, type index_UIComponent as UIComponent, index_UIComponentSchema as UIComponentSchema, type DSLRendererProps as UIDSLRendererProps, type index_UIElement as UIElement, index_UIElementSchema as UIElementSchema, type index_UpdateBookmarkOptions as UpdateBookmarkOptions, type index_UpdateDashboardOptions as UpdateDashboardOptions, type index_UpdateReportOptions as UpdateReportOptions, type index_UpdateUIOptions as UpdateUIOptions, type index_User as User, index_createBookmark as createBookmark, index_createDashboard as createDashboard, index_createKbNode as createKbNode, index_createReport as createReport, index_createUI as createUI, index_createUser as createUser, index_deleteBookmark as deleteBookmark, index_deleteDashboard as deleteDashboard, index_deleteKbNode as deleteKbNode, index_deleteReport as deleteReport, index_deleteUI as deleteUI, index_deleteUser as deleteUser, index_getActions as getActions, index_getAllBookmarks as getAllBookmarks, index_getAllDashboards as getAllDashboards, index_getAllKbNodes as getAllKbNodes, index_getAllReports as getAllReports, index_getAllUIs as getAllUIs, index_getAllUsers as getAllUsers, index_getBookmark as getBookmark, index_getComponentSuggestions as getComponentSuggestions, index_getDashboard as getDashboard, index_getKbNode as getKbNode, index_getKbNodeCategories as getKbNodeCategories, index_getKbNodeTags as getKbNodeTags, index_getKbNodesByCategory as getKbNodesByCategory, index_getKbNodesByUser as getKbNodesByUser, index_getReport as getReport, index_getUI as getUI, index_getUser as getUser, index_queryBookmarks as queryBookmarks, index_queryDashboards as queryDashboards, index_queryReports as queryReports, index_queryUIs as queryUIs, index_queryUsers as queryUsers, index_requestBundle as requestBundle, index_requestData as requestData, index_searchKbNodes as searchKbNodes, index_sendAuthLoginRequest as sendAuthLoginRequest, index_sendAuthVerifyRequest as sendAuthVerifyRequest, index_sendComponents as sendComponents, index_sendUserPromptRequest as sendUserPromptRequest, index_sendUserPromptSuggestionsRequest as sendUserPromptSuggestionsRequest, index_updateBookmark as updateBookmark, index_updateDashboard as updateDashboard, index_updateKbNode as updateKbNode, index_updateReport as updateReport, index_updateUI as updateUI, index_updateUser as updateUser };
|
|
2335
|
+
export { type index_Binding as Binding, index_BindingSchema as BindingSchema, type index_Bookmark as Bookmark, type index_CreateBookmarkOptions as CreateBookmarkOptions, type index_CreateDashboardOptions as CreateDashboardOptions, type index_CreateReportOptions as CreateReportOptions, type index_CreateUIOptions as CreateUIOptions, type DSLRendererProps$2 as DSLRendererProps, DSLRendererPropsSchema$2 as DSLRendererPropsSchema, type index_DashCompRequestOptions as DashCompRequestOptions, type index_DashCompResponse as DashCompResponse, type index_Dashboard as Dashboard, type index_Expression as Expression, index_ExpressionSchema as ExpressionSchema, type index_ForDirective as ForDirective, index_ForDirectiveSchema as ForDirectiveSchema, type index_KbNode as KbNode, type index_Page as Page, index_PageSchema as PageSchema, type index_QueryBookmarksOptions as QueryBookmarksOptions, type index_QueryDashboardsOptions as QueryDashboardsOptions, type index_QueryReportsOptions as QueryReportsOptions, type index_QuerySpec as QuerySpec, index_QuerySpecSchema as QuerySpecSchema, type index_QueryUIsOptions as QueryUIsOptions, type index_QueryUsersOptions as QueryUsersOptions, type index_Report as Report, type DSLRendererProps$1 as ReportDSLRendererProps, type index_SearchKbNodesOptions as SearchKbNodesOptions, type index_UI as UI, type index_UIComponent as UIComponent, index_UIComponentSchema as UIComponentSchema, type DSLRendererProps as UIDSLRendererProps, type index_UIElement as UIElement, index_UIElementSchema as UIElementSchema, type index_UpdateBookmarkOptions as UpdateBookmarkOptions, type index_UpdateDashboardOptions as UpdateDashboardOptions, type index_UpdateReportOptions as UpdateReportOptions, type index_UpdateUIOptions as UpdateUIOptions, type index_User as User, index_createBookmark as createBookmark, index_createDashboard as createDashboard, index_createKbNode as createKbNode, index_createReport as createReport, index_createUI as createUI, index_createUser as createUser, index_deleteBookmark as deleteBookmark, index_deleteDashboard as deleteDashboard, index_deleteKbNode as deleteKbNode, index_deleteReport as deleteReport, index_deleteUI as deleteUI, index_deleteUser as deleteUser, index_getActions as getActions, index_getAllBookmarks as getAllBookmarks, index_getAllDashboards as getAllDashboards, index_getAllKbNodes as getAllKbNodes, index_getAllReports as getAllReports, index_getAllUIs as getAllUIs, index_getAllUsers as getAllUsers, index_getBookmark as getBookmark, index_getComponentSuggestions as getComponentSuggestions, index_getDashboard as getDashboard, index_getKbNode as getKbNode, index_getKbNodeCategories as getKbNodeCategories, index_getKbNodeTags as getKbNodeTags, index_getKbNodesByCategory as getKbNodesByCategory, index_getKbNodesByUser as getKbNodesByUser, index_getReport as getReport, index_getUI as getUI, index_getUser as getUser, index_queryBookmarks as queryBookmarks, index_queryDashboards as queryDashboards, index_queryReports as queryReports, index_queryUIs as queryUIs, index_queryUsers as queryUsers, index_requestBundle as requestBundle, index_requestData as requestData, index_searchKbNodes as searchKbNodes, index_sendAuthLoginRequest as sendAuthLoginRequest, index_sendAuthVerifyRequest as sendAuthVerifyRequest, index_sendComponents as sendComponents, index_sendDashCompRequest as sendDashCompRequest, index_sendUserPromptRequest as sendUserPromptRequest, index_sendUserPromptSuggestionsRequest as sendUserPromptSuggestionsRequest, index_updateBookmark as updateBookmark, index_updateDashboard as updateDashboard, index_updateKbNode as updateKbNode, index_updateReport as updateReport, index_updateUI as updateUI, index_updateUser as updateUser };
|
|
2277
2336
|
}
|
|
2278
2337
|
|
|
2279
2338
|
type MessageHandler = (message: Message) => void;
|
|
@@ -2916,6 +2975,27 @@ declare class SuperatomClient {
|
|
|
2916
2975
|
count?: number;
|
|
2917
2976
|
message?: string;
|
|
2918
2977
|
}>;
|
|
2978
|
+
/**
|
|
2979
|
+
* Request a dashboard component based on user prompt
|
|
2980
|
+
* Uses LLM to pick the best component and generate props
|
|
2981
|
+
* Supports both database queries and external tools as data sources
|
|
2982
|
+
* Delegates to dash-comp service
|
|
2983
|
+
*
|
|
2984
|
+
* @example
|
|
2985
|
+
* ```typescript
|
|
2986
|
+
* const response = await client.sendDashCompRequest({
|
|
2987
|
+
* prompt: "Show me a bar chart of sales by category",
|
|
2988
|
+
* threadId: "thread-123",
|
|
2989
|
+
* });
|
|
2990
|
+
*
|
|
2991
|
+
* if (response.success && response.component) {
|
|
2992
|
+
* console.log('Component:', response.component.name);
|
|
2993
|
+
* console.log('Props:', response.component.props);
|
|
2994
|
+
* console.log('Data source:', response.dataSource);
|
|
2995
|
+
* }
|
|
2996
|
+
* ```
|
|
2997
|
+
*/
|
|
2998
|
+
sendDashCompRequest(options: DashCompRequestOptions): Promise<DashCompResponse>;
|
|
2919
2999
|
/**
|
|
2920
3000
|
* Internal logging
|
|
2921
3001
|
*/
|
package/dist/index.js
CHANGED
|
@@ -330,6 +330,42 @@ var UserPromptSuggestionsResponseMessageSchema = z.object({
|
|
|
330
330
|
to: MessageParticipantSchema.optional(),
|
|
331
331
|
payload: UserPromptSuggestionsResponsePayloadSchema
|
|
332
332
|
});
|
|
333
|
+
var DashCompRequestPayloadSchema = z.object({
|
|
334
|
+
prompt: z.string(),
|
|
335
|
+
SA_RUNTIME: z.object({
|
|
336
|
+
threadId: z.string().optional(),
|
|
337
|
+
uiBlockId: z.string().optional()
|
|
338
|
+
}).optional()
|
|
339
|
+
});
|
|
340
|
+
var DashCompRequestMessageSchema = z.object({
|
|
341
|
+
id: z.string(),
|
|
342
|
+
type: z.literal("DASH_COMP_REQ"),
|
|
343
|
+
from: MessageParticipantSchema,
|
|
344
|
+
to: MessageParticipantSchema.optional(),
|
|
345
|
+
payload: DashCompRequestPayloadSchema
|
|
346
|
+
});
|
|
347
|
+
z.object({
|
|
348
|
+
toolId: z.string(),
|
|
349
|
+
toolName: z.string(),
|
|
350
|
+
action: z.enum(["get", "create", "update", "delete"]),
|
|
351
|
+
params: z.record(z.string(), z.unknown())
|
|
352
|
+
});
|
|
353
|
+
var DashCompResponsePayloadSchema = z.object({
|
|
354
|
+
success: z.boolean(),
|
|
355
|
+
errors: z.array(z.string()).optional(),
|
|
356
|
+
data: z.object({
|
|
357
|
+
component: ComponentSchema.optional(),
|
|
358
|
+
reasoning: z.string().optional(),
|
|
359
|
+
dataSource: z.enum(["database", "external_tool", "none"]).optional()
|
|
360
|
+
}).optional()
|
|
361
|
+
});
|
|
362
|
+
z.object({
|
|
363
|
+
id: z.string(),
|
|
364
|
+
type: z.literal("DASH_COMP_RES"),
|
|
365
|
+
from: MessageParticipantSchema,
|
|
366
|
+
to: MessageParticipantSchema.optional(),
|
|
367
|
+
payload: DashCompResponsePayloadSchema
|
|
368
|
+
});
|
|
333
369
|
var BundleRequestPayloadSchema = z.object({
|
|
334
370
|
devbundlereq: z.boolean().optional().default(false)
|
|
335
371
|
});
|
|
@@ -869,6 +905,7 @@ __export(services_exports, {
|
|
|
869
905
|
sendAuthLoginRequest: () => sendAuthLoginRequest,
|
|
870
906
|
sendAuthVerifyRequest: () => sendAuthVerifyRequest,
|
|
871
907
|
sendComponents: () => sendComponents,
|
|
908
|
+
sendDashCompRequest: () => sendDashCompRequest,
|
|
872
909
|
sendUserPromptRequest: () => sendUserPromptRequest,
|
|
873
910
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
874
911
|
updateBookmark: () => updateBookmark,
|
|
@@ -2175,6 +2212,51 @@ async function getKbNodeTags(client, timeout) {
|
|
|
2175
2212
|
};
|
|
2176
2213
|
}
|
|
2177
2214
|
|
|
2215
|
+
// src/services/dash-comp.ts
|
|
2216
|
+
async function sendDashCompRequest(client, options) {
|
|
2217
|
+
const { prompt, threadId, uiBlockId, timeout } = options;
|
|
2218
|
+
const messageId = `dash_comp_req_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
2219
|
+
const message = DashCompRequestMessageSchema.parse({
|
|
2220
|
+
id: messageId,
|
|
2221
|
+
type: "DASH_COMP_REQ",
|
|
2222
|
+
from: {
|
|
2223
|
+
type: client.type
|
|
2224
|
+
},
|
|
2225
|
+
to: {
|
|
2226
|
+
type: "data-agent"
|
|
2227
|
+
},
|
|
2228
|
+
payload: {
|
|
2229
|
+
prompt,
|
|
2230
|
+
SA_RUNTIME: threadId || uiBlockId ? {
|
|
2231
|
+
threadId,
|
|
2232
|
+
uiBlockId
|
|
2233
|
+
} : void 0
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
try {
|
|
2237
|
+
const response = await client.sendWithResponse(message, timeout);
|
|
2238
|
+
const payload = response.payload;
|
|
2239
|
+
if (!payload.success) {
|
|
2240
|
+
return {
|
|
2241
|
+
success: false,
|
|
2242
|
+
errors: payload.errors || ["Unknown error occurred"]
|
|
2243
|
+
};
|
|
2244
|
+
}
|
|
2245
|
+
return {
|
|
2246
|
+
success: true,
|
|
2247
|
+
component: payload.data?.component,
|
|
2248
|
+
reasoning: payload.data?.reasoning,
|
|
2249
|
+
dataSource: payload.data?.dataSource
|
|
2250
|
+
};
|
|
2251
|
+
} catch (error) {
|
|
2252
|
+
const errorMessage = error instanceof Error ? error.message : "Request failed";
|
|
2253
|
+
return {
|
|
2254
|
+
success: false,
|
|
2255
|
+
errors: [errorMessage]
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2178
2260
|
// src/client.ts
|
|
2179
2261
|
var SuperatomClient = class {
|
|
2180
2262
|
constructor(config) {
|
|
@@ -2842,6 +2924,32 @@ var SuperatomClient = class {
|
|
|
2842
2924
|
this.log("info", "Fetching KB node tags");
|
|
2843
2925
|
return getKbNodeTags(this, timeout);
|
|
2844
2926
|
}
|
|
2927
|
+
// ==================== Dashboard Component Methods ====================
|
|
2928
|
+
// These methods delegate to dash-comp service for component selection
|
|
2929
|
+
/**
|
|
2930
|
+
* Request a dashboard component based on user prompt
|
|
2931
|
+
* Uses LLM to pick the best component and generate props
|
|
2932
|
+
* Supports both database queries and external tools as data sources
|
|
2933
|
+
* Delegates to dash-comp service
|
|
2934
|
+
*
|
|
2935
|
+
* @example
|
|
2936
|
+
* ```typescript
|
|
2937
|
+
* const response = await client.sendDashCompRequest({
|
|
2938
|
+
* prompt: "Show me a bar chart of sales by category",
|
|
2939
|
+
* threadId: "thread-123",
|
|
2940
|
+
* });
|
|
2941
|
+
*
|
|
2942
|
+
* if (response.success && response.component) {
|
|
2943
|
+
* console.log('Component:', response.component.name);
|
|
2944
|
+
* console.log('Props:', response.component.props);
|
|
2945
|
+
* console.log('Data source:', response.dataSource);
|
|
2946
|
+
* }
|
|
2947
|
+
* ```
|
|
2948
|
+
*/
|
|
2949
|
+
async sendDashCompRequest(options) {
|
|
2950
|
+
this.log("info", "Sending dash comp request for prompt:", options.prompt.substring(0, 50) + "...");
|
|
2951
|
+
return sendDashCompRequest(this, options);
|
|
2952
|
+
}
|
|
2845
2953
|
/**
|
|
2846
2954
|
* Internal logging
|
|
2847
2955
|
*/
|