@superatomai/sdk-web 0.0.20 → 0.0.21
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.cjs +52 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -10
- package/dist/index.d.ts +37 -10
- package/dist/index.js +52 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -261,6 +261,7 @@ var AuthVerifyResponseMessageSchema = zod.z.object({
|
|
|
261
261
|
});
|
|
262
262
|
var UserPromptRequestPayloadSchema = zod.z.object({
|
|
263
263
|
prompt: zod.z.string(),
|
|
264
|
+
userId: zod.z.string().optional(),
|
|
264
265
|
SA_RUNTIME: zod.z.object({
|
|
265
266
|
threadId: zod.z.string(),
|
|
266
267
|
uiBlockId: zod.z.string()
|
|
@@ -274,17 +275,18 @@ var UserPromptRequestMessageSchema = zod.z.object({
|
|
|
274
275
|
to: MessageParticipantSchema.optional(),
|
|
275
276
|
payload: UserPromptRequestPayloadSchema
|
|
276
277
|
});
|
|
278
|
+
var ComponentPropsSchema = zod.z.object({
|
|
279
|
+
query: zod.z.string().optional(),
|
|
280
|
+
title: zod.z.string().optional(),
|
|
281
|
+
description: zod.z.string().optional(),
|
|
282
|
+
config: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
283
|
+
}).passthrough();
|
|
277
284
|
var ComponentSchema = zod.z.object({
|
|
278
285
|
id: zod.z.string(),
|
|
279
286
|
name: zod.z.string(),
|
|
280
287
|
type: zod.z.string(),
|
|
281
288
|
description: zod.z.string(),
|
|
282
|
-
props:
|
|
283
|
-
query: zod.z.string().optional(),
|
|
284
|
-
title: zod.z.string().optional(),
|
|
285
|
-
description: zod.z.string().optional(),
|
|
286
|
-
config: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
287
|
-
}),
|
|
289
|
+
props: ComponentPropsSchema,
|
|
288
290
|
category: zod.z.string().optional(),
|
|
289
291
|
keywords: zod.z.array(zod.z.string()).optional()
|
|
290
292
|
});
|
|
@@ -306,6 +308,7 @@ var UserPromptResponseMessageSchema = zod.z.object({
|
|
|
306
308
|
});
|
|
307
309
|
var UserPromptSuggestionsRequestPayloadSchema = zod.z.object({
|
|
308
310
|
prompt: zod.z.string(),
|
|
311
|
+
userId: zod.z.string().optional(),
|
|
309
312
|
limit: zod.z.number().int().positive().default(5)
|
|
310
313
|
});
|
|
311
314
|
var UserPromptSuggestionsRequestMessageSchema = zod.z.object({
|
|
@@ -334,10 +337,13 @@ var UserPromptSuggestionsResponseMessageSchema = zod.z.object({
|
|
|
334
337
|
});
|
|
335
338
|
var DashCompRequestPayloadSchema = zod.z.object({
|
|
336
339
|
prompt: zod.z.string(),
|
|
340
|
+
userId: zod.z.string().optional(),
|
|
337
341
|
SA_RUNTIME: zod.z.object({
|
|
338
342
|
threadId: zod.z.string().optional(),
|
|
339
343
|
uiBlockId: zod.z.string().optional()
|
|
340
|
-
}).optional()
|
|
344
|
+
}).optional(),
|
|
345
|
+
existingComponents: zod.z.array(ComponentSchema).optional(),
|
|
346
|
+
req_type: zod.z.enum(["create", "update", "filter"]).optional()
|
|
341
347
|
});
|
|
342
348
|
var DashCompRequestMessageSchema = zod.z.object({
|
|
343
349
|
id: zod.z.string(),
|
|
@@ -352,13 +358,24 @@ zod.z.object({
|
|
|
352
358
|
action: zod.z.enum(["get", "create", "update", "delete"]),
|
|
353
359
|
params: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
354
360
|
});
|
|
361
|
+
zod.z.object({
|
|
362
|
+
filterId: zod.z.string(),
|
|
363
|
+
filterField: zod.z.string(),
|
|
364
|
+
targetComponentId: zod.z.string(),
|
|
365
|
+
targetField: zod.z.string()
|
|
366
|
+
});
|
|
355
367
|
var DashCompResponsePayloadSchema = zod.z.object({
|
|
356
368
|
success: zod.z.boolean(),
|
|
357
369
|
errors: zod.z.array(zod.z.string()).optional(),
|
|
358
370
|
data: zod.z.object({
|
|
371
|
+
// For create/update requests
|
|
359
372
|
component: ComponentSchema.optional(),
|
|
360
373
|
reasoning: zod.z.string().optional(),
|
|
361
|
-
dataSource: zod.z.enum(["database", "external_tool", "none"]).optional()
|
|
374
|
+
dataSource: zod.z.enum(["database", "external_tool", "none"]).optional(),
|
|
375
|
+
// For filter requests
|
|
376
|
+
filterComponent: ComponentSchema.optional(),
|
|
377
|
+
updatedComponents: zod.z.array(ComponentSchema).optional(),
|
|
378
|
+
filterBindings: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
362
379
|
}).optional()
|
|
363
380
|
});
|
|
364
381
|
zod.z.object({
|
|
@@ -448,6 +465,7 @@ var UILogsMessageSchema = zod.z.object({
|
|
|
448
465
|
payload: UILogsPayloadSchema
|
|
449
466
|
});
|
|
450
467
|
var ActionsRequestPayloadSchema = zod.z.object({
|
|
468
|
+
userId: zod.z.string().optional(),
|
|
451
469
|
SA_RUNTIME: zod.z.object({
|
|
452
470
|
threadId: zod.z.string(),
|
|
453
471
|
uiBlockId: zod.z.string()
|
|
@@ -959,7 +977,7 @@ async function sendAuthVerifyRequest(client, token, timeout) {
|
|
|
959
977
|
}
|
|
960
978
|
|
|
961
979
|
// src/services/userPrompt.ts
|
|
962
|
-
async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, responseMode, onStream, timeout) {
|
|
980
|
+
async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, userId, responseMode, onStream, timeout) {
|
|
963
981
|
const messageId = `user_prompt_req_msg_${Date.now()}`;
|
|
964
982
|
const message = UserPromptRequestMessageSchema.parse({
|
|
965
983
|
id: messageId,
|
|
@@ -972,6 +990,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, respon
|
|
|
972
990
|
},
|
|
973
991
|
payload: {
|
|
974
992
|
prompt,
|
|
993
|
+
userId,
|
|
975
994
|
SA_RUNTIME: {
|
|
976
995
|
threadId,
|
|
977
996
|
uiBlockId
|
|
@@ -999,7 +1018,7 @@ async function sendUserPromptRequest(client, prompt, threadId, uiBlockId, respon
|
|
|
999
1018
|
}
|
|
1000
1019
|
}
|
|
1001
1020
|
}
|
|
1002
|
-
async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeout) {
|
|
1021
|
+
async function sendUserPromptSuggestionsRequest(client, prompt, userId, limit = 5, timeout) {
|
|
1003
1022
|
if (!prompt || prompt.trim().length === 0) {
|
|
1004
1023
|
return null;
|
|
1005
1024
|
}
|
|
@@ -1015,6 +1034,7 @@ async function sendUserPromptSuggestionsRequest(client, prompt, limit = 5, timeo
|
|
|
1015
1034
|
},
|
|
1016
1035
|
payload: {
|
|
1017
1036
|
prompt,
|
|
1037
|
+
userId,
|
|
1018
1038
|
limit
|
|
1019
1039
|
}
|
|
1020
1040
|
});
|
|
@@ -1774,6 +1794,7 @@ async function getActions(client, options) {
|
|
|
1774
1794
|
from: { type: client.type },
|
|
1775
1795
|
to: { type: "data-agent" },
|
|
1776
1796
|
payload: {
|
|
1797
|
+
userId: options.userId,
|
|
1777
1798
|
SA_RUNTIME: options.SA_RUNTIME
|
|
1778
1799
|
}
|
|
1779
1800
|
});
|
|
@@ -2219,7 +2240,7 @@ async function getKbNodeTags(client, timeout) {
|
|
|
2219
2240
|
|
|
2220
2241
|
// src/services/dash-comp.ts
|
|
2221
2242
|
async function sendDashCompRequest(client, options) {
|
|
2222
|
-
const { prompt, threadId, uiBlockId, timeout } = options;
|
|
2243
|
+
const { prompt, userId, threadId, uiBlockId, timeout, existingComponents, reqType } = options;
|
|
2223
2244
|
const messageId = `dash_comp_req_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
2224
2245
|
const message = DashCompRequestMessageSchema.parse({
|
|
2225
2246
|
id: messageId,
|
|
@@ -2232,10 +2253,13 @@ async function sendDashCompRequest(client, options) {
|
|
|
2232
2253
|
},
|
|
2233
2254
|
payload: {
|
|
2234
2255
|
prompt,
|
|
2256
|
+
userId,
|
|
2235
2257
|
SA_RUNTIME: threadId || uiBlockId ? {
|
|
2236
2258
|
threadId,
|
|
2237
2259
|
uiBlockId
|
|
2238
|
-
} : void 0
|
|
2260
|
+
} : void 0,
|
|
2261
|
+
existingComponents,
|
|
2262
|
+
req_type: reqType
|
|
2239
2263
|
}
|
|
2240
2264
|
});
|
|
2241
2265
|
try {
|
|
@@ -2247,6 +2271,15 @@ async function sendDashCompRequest(client, options) {
|
|
|
2247
2271
|
errors: payload.errors || ["Unknown error occurred"]
|
|
2248
2272
|
};
|
|
2249
2273
|
}
|
|
2274
|
+
if (reqType === "filter") {
|
|
2275
|
+
return {
|
|
2276
|
+
success: true,
|
|
2277
|
+
filterComponent: payload.data?.filterComponent,
|
|
2278
|
+
updatedComponents: payload.data?.updatedComponents,
|
|
2279
|
+
filterBindings: payload.data?.filterBindings,
|
|
2280
|
+
reasoning: payload.data?.reasoning
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2250
2283
|
return {
|
|
2251
2284
|
success: true,
|
|
2252
2285
|
component: payload.data?.component,
|
|
@@ -2546,20 +2579,22 @@ var SuperatomClient = class {
|
|
|
2546
2579
|
/**
|
|
2547
2580
|
* Send a user prompt request
|
|
2548
2581
|
* Delegates to user prompt service
|
|
2582
|
+
* @param userId - User ID for the request
|
|
2549
2583
|
* @param responseMode - 'component' for component response (default), 'text' for text streaming
|
|
2550
2584
|
* @param onStream - Optional callback for streaming text chunks (only for text mode)
|
|
2551
2585
|
*/
|
|
2552
|
-
async sendUserPromptRequest(prompt, threadId, uiBlockId, responseMode, onStream, timeout) {
|
|
2586
|
+
async sendUserPromptRequest(prompt, threadId, uiBlockId, userId, responseMode, onStream, timeout) {
|
|
2553
2587
|
this.log("info", "Sending user prompt request with streaming support");
|
|
2554
|
-
return sendUserPromptRequest(this, prompt, threadId, uiBlockId, responseMode, onStream, timeout);
|
|
2588
|
+
return sendUserPromptRequest(this, prompt, threadId, uiBlockId, userId, responseMode, onStream, timeout);
|
|
2555
2589
|
}
|
|
2556
2590
|
/**
|
|
2557
2591
|
* Send a user prompt suggestions request
|
|
2558
2592
|
* Delegates to user prompt service
|
|
2593
|
+
* @param userId - User ID for the request
|
|
2559
2594
|
*/
|
|
2560
|
-
async sendUserPromptSuggestionsRequest(prompt, limit = 5, timeout) {
|
|
2595
|
+
async sendUserPromptSuggestionsRequest(prompt, userId, limit = 5, timeout) {
|
|
2561
2596
|
this.log("info", "Sending user prompt suggestions request");
|
|
2562
|
-
return sendUserPromptSuggestionsRequest(this, prompt, limit, timeout);
|
|
2597
|
+
return sendUserPromptSuggestionsRequest(this, prompt, userId, limit, timeout);
|
|
2563
2598
|
}
|
|
2564
2599
|
/**
|
|
2565
2600
|
* Request bundle from server
|
|
@@ -2588,6 +2623,7 @@ var SuperatomClient = class {
|
|
|
2588
2623
|
/**
|
|
2589
2624
|
* Get AI-powered component suggestions based on a query
|
|
2590
2625
|
* Delegates to component service
|
|
2626
|
+
* @param userId - User ID for the request
|
|
2591
2627
|
*/
|
|
2592
2628
|
async getActions(options) {
|
|
2593
2629
|
this.log("info", "Requesting actions");
|