@superatomai/sdk-web 0.0.5 → 0.0.6
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 +94 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -2
- package/dist/index.d.ts +107 -2
- package/dist/index.js +89 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -396,6 +396,40 @@ var UILogsMessageSchema = zod.z.object({
|
|
|
396
396
|
to: MessageParticipantSchema.optional(),
|
|
397
397
|
payload: UILogsPayloadSchema
|
|
398
398
|
});
|
|
399
|
+
var ActionsRequestPayloadSchema = zod.z.object({
|
|
400
|
+
SA_RUNTIME: zod.z.object({
|
|
401
|
+
threadId: zod.z.string(),
|
|
402
|
+
uiBlockId: zod.z.string()
|
|
403
|
+
}).optional()
|
|
404
|
+
});
|
|
405
|
+
var ActionsRequestMessageSchema = zod.z.object({
|
|
406
|
+
id: zod.z.string(),
|
|
407
|
+
from: MessageParticipantSchema,
|
|
408
|
+
type: zod.z.literal("ACTIONS"),
|
|
409
|
+
payload: ActionsRequestPayloadSchema
|
|
410
|
+
});
|
|
411
|
+
var ActionsResponsePayloadSchema = zod.z.object({
|
|
412
|
+
success: zod.z.boolean(),
|
|
413
|
+
data: zod.z.any().optional(),
|
|
414
|
+
error: zod.z.string().optional()
|
|
415
|
+
});
|
|
416
|
+
var ActionsResponseMessageSchema = zod.z.object({
|
|
417
|
+
id: zod.z.string(),
|
|
418
|
+
type: zod.z.literal("ACTIONS_RES"),
|
|
419
|
+
from: MessageParticipantSchema,
|
|
420
|
+
to: MessageParticipantSchema.optional(),
|
|
421
|
+
payload: ActionsResponsePayloadSchema
|
|
422
|
+
});
|
|
423
|
+
var ComponentsSendPayloadSchema = zod.z.object({
|
|
424
|
+
components: zod.z.array(zod.z.any())
|
|
425
|
+
});
|
|
426
|
+
var ComponentsSendMessageSchema = zod.z.object({
|
|
427
|
+
id: zod.z.string(),
|
|
428
|
+
type: zod.z.literal("COMPONENT_LIST_RES"),
|
|
429
|
+
from: MessageParticipantSchema,
|
|
430
|
+
to: MessageParticipantSchema.optional(),
|
|
431
|
+
payload: ComponentsSendPayloadSchema
|
|
432
|
+
});
|
|
399
433
|
var UsersRequestPayloadSchema = zod.z.object({
|
|
400
434
|
operation: zod.z.enum(["create", "update", "delete", "getAll", "getOne"]),
|
|
401
435
|
data: zod.z.object({
|
|
@@ -532,6 +566,7 @@ __export(services_exports, {
|
|
|
532
566
|
deleteDashboard: () => deleteDashboard,
|
|
533
567
|
deleteReport: () => deleteReport,
|
|
534
568
|
deleteUser: () => deleteUser,
|
|
569
|
+
getActions: () => getActions,
|
|
535
570
|
getAllDashboards: () => getAllDashboards,
|
|
536
571
|
getAllReports: () => getAllReports,
|
|
537
572
|
getAllUsers: () => getAllUsers,
|
|
@@ -543,6 +578,7 @@ __export(services_exports, {
|
|
|
543
578
|
requestData: () => requestData,
|
|
544
579
|
sendAuthLoginRequest: () => sendAuthLoginRequest,
|
|
545
580
|
sendAuthVerifyRequest: () => sendAuthVerifyRequest,
|
|
581
|
+
sendComponents: () => sendComponents,
|
|
546
582
|
sendUserPromptRequest: () => sendUserPromptRequest,
|
|
547
583
|
sendUserPromptSuggestionsRequest: () => sendUserPromptSuggestionsRequest,
|
|
548
584
|
updateDashboard: () => updateDashboard,
|
|
@@ -693,7 +729,8 @@ async function requestData(client, options) {
|
|
|
693
729
|
payload: {
|
|
694
730
|
collection: options.collection,
|
|
695
731
|
op: options.operation,
|
|
696
|
-
params: options.params
|
|
732
|
+
params: options.params,
|
|
733
|
+
SA_RUNTIME: options.SA_RUNTIME
|
|
697
734
|
}
|
|
698
735
|
});
|
|
699
736
|
const response = await client.sendWithResponse(message, options.timeout);
|
|
@@ -723,6 +760,23 @@ async function getComponentSuggestions(client, query, options) {
|
|
|
723
760
|
error: payload.error
|
|
724
761
|
};
|
|
725
762
|
}
|
|
763
|
+
async function sendComponents(client, components) {
|
|
764
|
+
const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
765
|
+
const ws_msg = {
|
|
766
|
+
id: messageId,
|
|
767
|
+
type: "COMPONENT_LIST_RES",
|
|
768
|
+
from: {
|
|
769
|
+
type: "runtime"
|
|
770
|
+
},
|
|
771
|
+
to: {
|
|
772
|
+
type: "data-agent"
|
|
773
|
+
},
|
|
774
|
+
payload: {
|
|
775
|
+
components
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
client.send(ws_msg);
|
|
779
|
+
}
|
|
726
780
|
|
|
727
781
|
// src/services/users.ts
|
|
728
782
|
async function createUser(client, username, password, timeout) {
|
|
@@ -1081,6 +1135,27 @@ async function getReport(client, reportId, timeout) {
|
|
|
1081
1135
|
};
|
|
1082
1136
|
}
|
|
1083
1137
|
|
|
1138
|
+
// src/services/actions.ts
|
|
1139
|
+
async function getActions(client, options) {
|
|
1140
|
+
const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
1141
|
+
const message = ActionsRequestMessageSchema.parse({
|
|
1142
|
+
id: messageId,
|
|
1143
|
+
type: "ACTIONS",
|
|
1144
|
+
from: { type: "runtime" },
|
|
1145
|
+
to: { type: "data-agent" },
|
|
1146
|
+
payload: {
|
|
1147
|
+
SA_RUNTIME: options.SA_RUNTIME
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
const response = await client.sendWithResponse(message, options.timeout);
|
|
1151
|
+
const payload = response.payload;
|
|
1152
|
+
return {
|
|
1153
|
+
success: payload.success,
|
|
1154
|
+
data: payload.data,
|
|
1155
|
+
error: payload.error
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1084
1159
|
// src/client.ts
|
|
1085
1160
|
var SuperatomClient = class {
|
|
1086
1161
|
constructor(config) {
|
|
@@ -1396,6 +1471,18 @@ var SuperatomClient = class {
|
|
|
1396
1471
|
this.log("info", "Requesting component suggestions for query:", query);
|
|
1397
1472
|
return getComponentSuggestions(this, query, options);
|
|
1398
1473
|
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Get AI-powered component suggestions based on a query
|
|
1476
|
+
* Delegates to component service
|
|
1477
|
+
*/
|
|
1478
|
+
async getActions(options) {
|
|
1479
|
+
this.log("info", "Requesting actions");
|
|
1480
|
+
return getActions(this, options);
|
|
1481
|
+
}
|
|
1482
|
+
async sendComponents(components) {
|
|
1483
|
+
this.log("info", "Sending components");
|
|
1484
|
+
return sendComponents(this, components);
|
|
1485
|
+
}
|
|
1399
1486
|
// ==================== User Management Methods ====================
|
|
1400
1487
|
// These methods delegate to user service for admin user CRUD operations
|
|
1401
1488
|
/**
|
|
@@ -1567,6 +1654,10 @@ function hasComponents() {
|
|
|
1567
1654
|
// src/index.ts
|
|
1568
1655
|
var SDK_VERSION = "0.1.0";
|
|
1569
1656
|
|
|
1657
|
+
exports.ActionsRequestMessageSchema = ActionsRequestMessageSchema;
|
|
1658
|
+
exports.ActionsRequestPayloadSchema = ActionsRequestPayloadSchema;
|
|
1659
|
+
exports.ActionsResponseMessageSchema = ActionsResponseMessageSchema;
|
|
1660
|
+
exports.ActionsResponsePayloadSchema = ActionsResponsePayloadSchema;
|
|
1570
1661
|
exports.AuthLoginPayloadSchema = AuthLoginPayloadSchema;
|
|
1571
1662
|
exports.AuthLoginRequestMessageSchema = AuthLoginRequestMessageSchema;
|
|
1572
1663
|
exports.AuthLoginResponseMessageSchema = AuthLoginResponseMessageSchema;
|
|
@@ -1583,6 +1674,8 @@ exports.BundleRequestMessageSchema = BundleRequestMessageSchema;
|
|
|
1583
1674
|
exports.BundleRequestPayloadSchema = BundleRequestPayloadSchema;
|
|
1584
1675
|
exports.ClientConfigSchema = ClientConfigSchema;
|
|
1585
1676
|
exports.ComponentSchema = ComponentSchema;
|
|
1677
|
+
exports.ComponentsSendMessageSchema = ComponentsSendMessageSchema;
|
|
1678
|
+
exports.ComponentsSendPayloadSchema = ComponentsSendPayloadSchema;
|
|
1586
1679
|
exports.DataRequestMessageSchema = DataRequestMessageSchema;
|
|
1587
1680
|
exports.DataRequestPayloadSchema = DataRequestPayloadSchema;
|
|
1588
1681
|
exports.DataResponseMessageSchema = DataResponseMessageSchema;
|