@superatomai/sdk-web 0.0.1-mds → 0.0.2-mds
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 +97 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +97 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -338,6 +338,8 @@ var UserPromptSuggestionsResponseMessageSchema = zod.z.object({
|
|
|
338
338
|
var DashCompRequestPayloadSchema = zod.z.object({
|
|
339
339
|
prompt: zod.z.string(),
|
|
340
340
|
userId: zod.z.string().optional(),
|
|
341
|
+
/** Dashboard ID for scoping conversation history */
|
|
342
|
+
dashboardId: zod.z.string().optional(),
|
|
341
343
|
SA_RUNTIME: zod.z.object({
|
|
342
344
|
threadId: zod.z.string().optional(),
|
|
343
345
|
uiBlockId: zod.z.string().optional()
|
|
@@ -385,6 +387,39 @@ zod.z.object({
|
|
|
385
387
|
to: MessageParticipantSchema.optional(),
|
|
386
388
|
payload: DashCompResponsePayloadSchema
|
|
387
389
|
});
|
|
390
|
+
var ReportCompRequestPayloadSchema = zod.z.object({
|
|
391
|
+
prompt: zod.z.string(),
|
|
392
|
+
userId: zod.z.string().optional(),
|
|
393
|
+
reportId: zod.z.string().optional(),
|
|
394
|
+
projectId: zod.z.string().optional(),
|
|
395
|
+
SA_RUNTIME: zod.z.object({
|
|
396
|
+
threadId: zod.z.string().optional(),
|
|
397
|
+
uiBlockId: zod.z.string().optional()
|
|
398
|
+
}).optional()
|
|
399
|
+
});
|
|
400
|
+
var ReportCompRequestMessageSchema = zod.z.object({
|
|
401
|
+
id: zod.z.string(),
|
|
402
|
+
type: zod.z.literal("REPORT_COMP_REQ"),
|
|
403
|
+
from: MessageParticipantSchema,
|
|
404
|
+
to: MessageParticipantSchema.optional(),
|
|
405
|
+
payload: ReportCompRequestPayloadSchema
|
|
406
|
+
});
|
|
407
|
+
var ReportCompResponsePayloadSchema = zod.z.object({
|
|
408
|
+
success: zod.z.boolean(),
|
|
409
|
+
errors: zod.z.array(zod.z.string()).optional(),
|
|
410
|
+
data: zod.z.object({
|
|
411
|
+
components: zod.z.array(ComponentSchema).optional(),
|
|
412
|
+
reportTitle: zod.z.string().optional(),
|
|
413
|
+
reportDescription: zod.z.string().optional()
|
|
414
|
+
}).optional()
|
|
415
|
+
});
|
|
416
|
+
zod.z.object({
|
|
417
|
+
id: zod.z.string(),
|
|
418
|
+
type: zod.z.literal("REPORT_COMP_RES"),
|
|
419
|
+
from: MessageParticipantSchema,
|
|
420
|
+
to: MessageParticipantSchema.optional(),
|
|
421
|
+
payload: ReportCompResponsePayloadSchema
|
|
422
|
+
});
|
|
388
423
|
var BundleRequestPayloadSchema = zod.z.object({
|
|
389
424
|
devbundlereq: zod.z.boolean().optional().default(false)
|
|
390
425
|
});
|
|
@@ -1144,6 +1179,7 @@ __export(services_exports, {
|
|
|
1144
1179
|
sendAuthVerifyRequest: () => sendAuthVerifyRequest,
|
|
1145
1180
|
sendComponents: () => sendComponents,
|
|
1146
1181
|
sendDashCompRequest: () => sendDashCompRequest,
|
|
1182
|
+
sendReportCompRequest: () => sendReportCompRequest,
|
|
1147
1183
|
sendUserPromptRequest: () => sendUserPromptRequest,
|
|
1148
1184
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
1149
1185
|
updateArtifact: () => updateArtifact,
|
|
@@ -2636,7 +2672,7 @@ async function getKbNodeTags(client, timeout) {
|
|
|
2636
2672
|
|
|
2637
2673
|
// src/services/dash-comp.ts
|
|
2638
2674
|
async function sendDashCompRequest(client, options) {
|
|
2639
|
-
const { prompt, userId, threadId, uiBlockId, timeout, existingComponents, reqType } = options;
|
|
2675
|
+
const { prompt, userId, dashboardId, threadId, uiBlockId, timeout, existingComponents, reqType } = options;
|
|
2640
2676
|
const messageId = `dash_comp_req_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
2641
2677
|
const message = DashCompRequestMessageSchema.parse({
|
|
2642
2678
|
id: messageId,
|
|
@@ -2650,6 +2686,7 @@ async function sendDashCompRequest(client, options) {
|
|
|
2650
2686
|
payload: {
|
|
2651
2687
|
prompt,
|
|
2652
2688
|
userId,
|
|
2689
|
+
dashboardId,
|
|
2653
2690
|
SA_RUNTIME: threadId || uiBlockId ? {
|
|
2654
2691
|
threadId,
|
|
2655
2692
|
uiBlockId
|
|
@@ -2691,6 +2728,54 @@ async function sendDashCompRequest(client, options) {
|
|
|
2691
2728
|
}
|
|
2692
2729
|
}
|
|
2693
2730
|
|
|
2731
|
+
// src/services/report-comp.ts
|
|
2732
|
+
async function sendReportCompRequest(client, options) {
|
|
2733
|
+
const { prompt, userId, reportId, projectId, threadId, uiBlockId, timeout } = options;
|
|
2734
|
+
const messageId = `report_comp_req_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
2735
|
+
const message = ReportCompRequestMessageSchema.parse({
|
|
2736
|
+
id: messageId,
|
|
2737
|
+
type: "REPORT_COMP_REQ",
|
|
2738
|
+
from: {
|
|
2739
|
+
type: client.type
|
|
2740
|
+
},
|
|
2741
|
+
to: {
|
|
2742
|
+
type: "data-agent"
|
|
2743
|
+
},
|
|
2744
|
+
payload: {
|
|
2745
|
+
prompt,
|
|
2746
|
+
userId,
|
|
2747
|
+
reportId,
|
|
2748
|
+
projectId,
|
|
2749
|
+
SA_RUNTIME: threadId || uiBlockId ? {
|
|
2750
|
+
threadId,
|
|
2751
|
+
uiBlockId
|
|
2752
|
+
} : void 0
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
try {
|
|
2756
|
+
const response = await client.sendWithResponse(message, timeout || 12e4);
|
|
2757
|
+
const payload = response.payload;
|
|
2758
|
+
if (!payload.success) {
|
|
2759
|
+
return {
|
|
2760
|
+
success: false,
|
|
2761
|
+
errors: payload.errors || ["Unknown error occurred"]
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
return {
|
|
2765
|
+
success: true,
|
|
2766
|
+
components: payload.data?.components,
|
|
2767
|
+
reportTitle: payload.data?.reportTitle,
|
|
2768
|
+
reportDescription: payload.data?.reportDescription
|
|
2769
|
+
};
|
|
2770
|
+
} catch (error) {
|
|
2771
|
+
const errorMessage = error instanceof Error ? error.message : "Request failed";
|
|
2772
|
+
return {
|
|
2773
|
+
success: false,
|
|
2774
|
+
errors: [errorMessage]
|
|
2775
|
+
};
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2694
2779
|
// src/services/menus/index.ts
|
|
2695
2780
|
async function createMenu(client, options, timeout) {
|
|
2696
2781
|
const { name, componentName, icon, userMessage, parentId, sortOrder, props, isActive } = options;
|
|
@@ -3706,6 +3791,17 @@ var SuperatomClient = class {
|
|
|
3706
3791
|
this.log("info", "Sending dash comp request for prompt:", options.prompt.substring(0, 50) + "...");
|
|
3707
3792
|
return sendDashCompRequest(this, options);
|
|
3708
3793
|
}
|
|
3794
|
+
// ==================== Report Component Methods ====================
|
|
3795
|
+
/**
|
|
3796
|
+
* Send a report component request to generate a multi-component report layout
|
|
3797
|
+
*
|
|
3798
|
+
* @param options - Request options including prompt describing the report
|
|
3799
|
+
* @returns Report component response with array of components
|
|
3800
|
+
*/
|
|
3801
|
+
async sendReportCompRequest(options) {
|
|
3802
|
+
this.log("info", "Sending report comp request for prompt:", options.prompt.substring(0, 50) + "...");
|
|
3803
|
+
return sendReportCompRequest(this, options);
|
|
3804
|
+
}
|
|
3709
3805
|
// ==================== Menu Management Methods ====================
|
|
3710
3806
|
// These methods delegate to menus service for menu CRUD operations
|
|
3711
3807
|
/**
|