@superatomai/sdk-node 0.0.82-dsp → 0.0.84-dsp
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.mts +144 -799
- package/dist/index.d.ts +144 -799
- package/dist/index.js +60 -22
- package/dist/index.mjs +60 -22
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -331,7 +331,7 @@ var UserSchema = import_zod3.z.object({
|
|
|
331
331
|
password: import_zod3.z.string().min(1, "Password is required"),
|
|
332
332
|
fullname: import_zod3.z.string().optional(),
|
|
333
333
|
role: import_zod3.z.string().optional(),
|
|
334
|
-
userInfo: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
334
|
+
userInfo: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
335
335
|
wsIds: import_zod3.z.array(import_zod3.z.string()).optional()
|
|
336
336
|
// Only in memory, not persisted to file
|
|
337
337
|
});
|
|
@@ -359,8 +359,8 @@ var IncomingMessageSchema = import_zod3.z.object({
|
|
|
359
359
|
var DataRequestPayloadSchema = import_zod3.z.object({
|
|
360
360
|
collection: import_zod3.z.string(),
|
|
361
361
|
op: import_zod3.z.string(),
|
|
362
|
-
params: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
363
|
-
SA_RUNTIME: import_zod3.z.record(import_zod3.z.unknown()).optional()
|
|
362
|
+
params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
363
|
+
SA_RUNTIME: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
364
364
|
});
|
|
365
365
|
var DataRequestMessageSchema = import_zod3.z.object({
|
|
366
366
|
id: import_zod3.z.string(),
|
|
@@ -457,10 +457,12 @@ var UserPromptSuggestionsMessageSchema = import_zod3.z.object({
|
|
|
457
457
|
payload: UserPromptSuggestionsPayloadSchema
|
|
458
458
|
});
|
|
459
459
|
var ComponentPropsSchema = import_zod3.z.object({
|
|
460
|
+
// Same runtime schema as under zod 3; the cast keeps zod 3's inferred `{}`, since
|
|
461
|
+
// zod 4 infers z.object({}) as Record<string, never> and `query.sql` stops type-checking.
|
|
460
462
|
query: import_zod3.z.string().or(import_zod3.z.object({})).nullable().optional(),
|
|
461
463
|
title: import_zod3.z.string().optional(),
|
|
462
464
|
description: import_zod3.z.string().optional(),
|
|
463
|
-
config: import_zod3.z.record(import_zod3.z.unknown()).optional()
|
|
465
|
+
config: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
464
466
|
}).passthrough();
|
|
465
467
|
var ComponentSchema = import_zod3.z.object({
|
|
466
468
|
id: import_zod3.z.string(),
|
|
@@ -488,8 +490,8 @@ var WorkflowDescriptorSchema = import_zod3.z.object({
|
|
|
488
490
|
name: import_zod3.z.string(),
|
|
489
491
|
description: import_zod3.z.string(),
|
|
490
492
|
whenToUse: import_zod3.z.string(),
|
|
491
|
-
propsSchema: import_zod3.z.record(import_zod3.z.string()),
|
|
492
|
-
defaultProps: import_zod3.z.record(import_zod3.z.unknown()).optional()
|
|
493
|
+
propsSchema: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()),
|
|
494
|
+
defaultProps: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
493
495
|
});
|
|
494
496
|
var WorkflowsSchema = import_zod3.z.array(WorkflowDescriptorSchema);
|
|
495
497
|
var WorkflowListResponsePayloadSchema = import_zod3.z.object({
|
|
@@ -522,8 +524,9 @@ var ToolSchema = import_zod3.z.object({
|
|
|
522
524
|
toolType: import_zod3.z.enum(["source", "direct"]).optional(),
|
|
523
525
|
/** Full untruncated schema for source agent (all columns visible) */
|
|
524
526
|
fullSchema: import_zod3.z.string().optional(),
|
|
525
|
-
params: import_zod3.z.record(import_zod3.z.string()),
|
|
526
|
-
|
|
527
|
+
params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()),
|
|
528
|
+
// zod 4: z.function() is no longer a schema, so a tool's handler is checked as a plain callable.
|
|
529
|
+
fn: import_zod3.z.custom((v) => typeof v === "function", { message: "fn must be a function" }),
|
|
527
530
|
outputSchema: OutputSchema.optional(),
|
|
528
531
|
// Optional: describes the data structure returned by this tool
|
|
529
532
|
/** Cache policy. `false` = never cache (live data, write ops). Mirrors HTTP `Cache-Control: no-store`. */
|
|
@@ -545,7 +548,7 @@ var UsersRequestPayloadSchema = import_zod3.z.object({
|
|
|
545
548
|
password: import_zod3.z.string().optional(),
|
|
546
549
|
fullname: import_zod3.z.string().optional(),
|
|
547
550
|
role: import_zod3.z.string().optional(),
|
|
548
|
-
userInfo: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
551
|
+
userInfo: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
549
552
|
// Query operation fields
|
|
550
553
|
filters: UserQueryFiltersSchema.optional(),
|
|
551
554
|
limit: import_zod3.z.number().optional(),
|
|
@@ -564,7 +567,7 @@ var UILogsPayloadSchema = import_zod3.z.object({
|
|
|
564
567
|
level: import_zod3.z.enum(["info", "error", "warn", "debug"]),
|
|
565
568
|
message: import_zod3.z.string(),
|
|
566
569
|
type: import_zod3.z.enum(["explanation", "query", "general"]).optional(),
|
|
567
|
-
data: import_zod3.z.record(import_zod3.z.unknown()).optional()
|
|
570
|
+
data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
568
571
|
}))
|
|
569
572
|
});
|
|
570
573
|
var UILogsMessageSchema = import_zod3.z.object({
|
|
@@ -682,7 +685,7 @@ var UIBlockSchema = import_zod3.z.object({
|
|
|
682
685
|
// DB field name / Legacy field
|
|
683
686
|
generatedComponentMetadata: ComponentSchema.optional(),
|
|
684
687
|
// Actual field used by UIBlock class
|
|
685
|
-
componentData: import_zod3.z.record(import_zod3.z.any()).optional(),
|
|
688
|
+
componentData: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any()).optional(),
|
|
686
689
|
createdAt: import_zod3.z.string().optional(),
|
|
687
690
|
/**
|
|
688
691
|
* Which script recipe produced this answer. Set whenever the turn was answered
|
|
@@ -693,7 +696,7 @@ var UIBlockSchema = import_zod3.z.object({
|
|
|
693
696
|
*/
|
|
694
697
|
scriptBinding: import_zod3.z.object({
|
|
695
698
|
recipeId: import_zod3.z.string(),
|
|
696
|
-
params: import_zod3.z.record(import_zod3.z.any()).optional(),
|
|
699
|
+
params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any()).optional(),
|
|
697
700
|
name: import_zod3.z.string().optional(),
|
|
698
701
|
columns: import_zod3.z.array(import_zod3.z.string()).optional()
|
|
699
702
|
}).optional(),
|
|
@@ -774,7 +777,7 @@ var ArtifactsRequestPayloadSchema = import_zod3.z.object({
|
|
|
774
777
|
id: import_zod3.z.number().optional(),
|
|
775
778
|
name: import_zod3.z.string().optional(),
|
|
776
779
|
createdBy: import_zod3.z.string().optional(),
|
|
777
|
-
dsl: import_zod3.z.record(import_zod3.z.any()).optional(),
|
|
780
|
+
dsl: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any()).optional(),
|
|
778
781
|
status: import_zod3.z.string().optional(),
|
|
779
782
|
deleted: import_zod3.z.boolean().optional(),
|
|
780
783
|
limit: import_zod3.z.number().optional(),
|
|
@@ -854,7 +857,7 @@ var MenusRequestPayloadSchema = import_zod3.z.object({
|
|
|
854
857
|
userMessage: import_zod3.z.string().optional(),
|
|
855
858
|
parentId: import_zod3.z.number().nullable().optional(),
|
|
856
859
|
sortOrder: import_zod3.z.number().optional(),
|
|
857
|
-
props: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
860
|
+
props: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
858
861
|
isActive: import_zod3.z.boolean().optional(),
|
|
859
862
|
// Query operation fields
|
|
860
863
|
filters: MenusQueryFiltersSchema.optional(),
|
|
@@ -865,7 +868,7 @@ var MenusRequestPayloadSchema = import_zod3.z.object({
|
|
|
865
868
|
id: import_zod3.z.number(),
|
|
866
869
|
sortOrder: import_zod3.z.number()
|
|
867
870
|
})).optional(),
|
|
868
|
-
menuJson: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
871
|
+
menuJson: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
869
872
|
version: import_zod3.z.number().optional()
|
|
870
873
|
}).optional()
|
|
871
874
|
});
|
|
@@ -1042,7 +1045,7 @@ var DashComponentSchema = import_zod3.z.object({
|
|
|
1042
1045
|
name: import_zod3.z.string(),
|
|
1043
1046
|
kind: import_zod3.z.string(),
|
|
1044
1047
|
purpose: import_zod3.z.string(),
|
|
1045
|
-
props: import_zod3.z.record(DashComponentPropSchema).optional(),
|
|
1048
|
+
props: import_zod3.z.record(import_zod3.z.string(), DashComponentPropSchema).optional(),
|
|
1046
1049
|
useWhen: import_zod3.z.string().optional(),
|
|
1047
1050
|
notes: import_zod3.z.string().optional()
|
|
1048
1051
|
});
|
|
@@ -1998,6 +2001,7 @@ function canonicalPolicies(policies) {
|
|
|
1998
2001
|
const norm = policies.map((p) => ({
|
|
1999
2002
|
s: p.sourceId ?? "*",
|
|
2000
2003
|
t: [...p.readableTables ?? []].sort(),
|
|
2004
|
+
x: JSON.stringify(p.exceptions ?? []),
|
|
2001
2005
|
f: (p.rowFilters ?? []).map((f) => ({
|
|
2002
2006
|
t: f.table ?? "*",
|
|
2003
2007
|
c: f.column,
|
|
@@ -2674,6 +2678,38 @@ function accessFromConfig(config2) {
|
|
|
2674
2678
|
allowedSources: scoped ? allowedSourcesFrom(scoped.allowedSources) : null
|
|
2675
2679
|
};
|
|
2676
2680
|
}
|
|
2681
|
+
function exceptionsFromConfig(raw) {
|
|
2682
|
+
if (!Array.isArray(raw)) return [];
|
|
2683
|
+
const str = (v) => typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
2684
|
+
const out = [];
|
|
2685
|
+
for (const item of raw) {
|
|
2686
|
+
if (!item || typeof item !== "object") continue;
|
|
2687
|
+
const x = item;
|
|
2688
|
+
const name = typeof x.name === "string" && x.name ? x.name : void 0;
|
|
2689
|
+
if (!x.tables || typeof x.tables !== "object") continue;
|
|
2690
|
+
const visibleKeys = str(x.visibleKeys);
|
|
2691
|
+
const tables = {};
|
|
2692
|
+
for (const [table, spec] of Object.entries(x.tables)) {
|
|
2693
|
+
if (!table || !spec || typeof spec !== "object") continue;
|
|
2694
|
+
const s = spec;
|
|
2695
|
+
const link = str(s.link);
|
|
2696
|
+
const own = str(s.own);
|
|
2697
|
+
const columns = Array.isArray(s.columns) ? s.columns.filter((c) => typeof c === "string" && !!c) : [];
|
|
2698
|
+
let bad = null;
|
|
2699
|
+
if (!own && !link) bad = 'it has neither "link" nor "own"';
|
|
2700
|
+
else if (!own && columns.length === 0) bad = 'it lists no "columns"';
|
|
2701
|
+
else if (!own && !visibleKeys) bad = 'the exception has no "visibleKeys"';
|
|
2702
|
+
if (bad) {
|
|
2703
|
+
logger.warn(`[RequestIdentity] Exception "${name ?? "?"}": table "${table}" dropped because ${bad}.`);
|
|
2704
|
+
continue;
|
|
2705
|
+
}
|
|
2706
|
+
tables[table] = own ? { own } : { link, columns };
|
|
2707
|
+
}
|
|
2708
|
+
if (Object.keys(tables).length === 0) continue;
|
|
2709
|
+
out.push({ name, visibleKeys, tables });
|
|
2710
|
+
}
|
|
2711
|
+
return out;
|
|
2712
|
+
}
|
|
2677
2713
|
function policiesFromConfig(config2) {
|
|
2678
2714
|
const raw = scopedForm(config2)?.policies ?? config2;
|
|
2679
2715
|
const entries = Array.isArray(raw) ? raw : [raw];
|
|
@@ -2699,6 +2735,7 @@ function policiesFromConfig(config2) {
|
|
|
2699
2735
|
});
|
|
2700
2736
|
}
|
|
2701
2737
|
const readableTables = Array.isArray(e.readableTables) ? e.readableTables.filter((t) => typeof t === "string" && !!t) : [];
|
|
2738
|
+
const exceptions = exceptionsFromConfig(e.exceptions);
|
|
2702
2739
|
if (rowFilters.length === 0 && readableTables.length === 0) continue;
|
|
2703
2740
|
const label = typeof e.label === "string" && e.label.trim() ? e.label.trim() : void 0;
|
|
2704
2741
|
if (!label && rowFilters.some((f) => !f.label) && !warnedUnlabelled) {
|
|
@@ -2711,7 +2748,8 @@ function policiesFromConfig(config2) {
|
|
|
2711
2748
|
sourceId: typeof e.sourceId === "string" && e.sourceId ? e.sourceId : null,
|
|
2712
2749
|
label,
|
|
2713
2750
|
rowFilters,
|
|
2714
|
-
readableTables
|
|
2751
|
+
readableTables,
|
|
2752
|
+
exceptions
|
|
2715
2753
|
});
|
|
2716
2754
|
}
|
|
2717
2755
|
return out;
|
|
@@ -19740,7 +19778,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19740
19778
|
const parseResult = UserPromptRequestMessageSchema.safeParse(data);
|
|
19741
19779
|
if (!parseResult.success) {
|
|
19742
19780
|
const zodError = parseResult.error;
|
|
19743
|
-
zodError.
|
|
19781
|
+
zodError.issues.forEach((err) => {
|
|
19744
19782
|
errors.push(`${err.path.join(".")}: ${err.message}`);
|
|
19745
19783
|
});
|
|
19746
19784
|
return { success: false, errors };
|
|
@@ -24253,7 +24291,7 @@ var processDashCompRequest = async (data, components, _sendMessage, anthropicApi
|
|
|
24253
24291
|
const parseResult = DashCompRequestMessageSchema.safeParse(data);
|
|
24254
24292
|
if (!parseResult.success) {
|
|
24255
24293
|
const zodError = parseResult.error;
|
|
24256
|
-
zodError.
|
|
24294
|
+
zodError.issues.forEach((err) => {
|
|
24257
24295
|
errors.push(`${err.path.join(".")}: ${err.message}`);
|
|
24258
24296
|
});
|
|
24259
24297
|
return { success: false, errors };
|
|
@@ -24424,7 +24462,7 @@ async function handleDashboardAgentRequest(data, collections, sendMessage) {
|
|
|
24424
24462
|
console.log("[DashboardAgentReq] Handler invoked. Raw message type/id:", data?.type, data?.id);
|
|
24425
24463
|
const parseResult = DashboardAgentRequestMessageSchema.safeParse(data);
|
|
24426
24464
|
if (!parseResult.success) {
|
|
24427
|
-
logger.error("[DashboardAgentReq] Invalid message \u2014 failed schema validation:", JSON.stringify(parseResult.error.
|
|
24465
|
+
logger.error("[DashboardAgentReq] Invalid message \u2014 failed schema validation:", JSON.stringify(parseResult.error.issues));
|
|
24428
24466
|
return;
|
|
24429
24467
|
}
|
|
24430
24468
|
const { id, payload, from } = parseResult.data;
|
|
@@ -26279,7 +26317,7 @@ function handleCodingAgentAbort(data, sendMessage) {
|
|
|
26279
26317
|
async function handleCodingAgentRequest(data, collections, sendMessage) {
|
|
26280
26318
|
const parseResult = CodingAgentRequestMessageSchema.safeParse(data);
|
|
26281
26319
|
if (!parseResult.success) {
|
|
26282
|
-
logger.error("[CodingAgentReq] Invalid message:", JSON.stringify(parseResult.error.
|
|
26320
|
+
logger.error("[CodingAgentReq] Invalid message:", JSON.stringify(parseResult.error.issues));
|
|
26283
26321
|
return;
|
|
26284
26322
|
}
|
|
26285
26323
|
const { id, payload, from } = parseResult.data;
|
|
@@ -26399,7 +26437,7 @@ async function handleDashBuilderRequest(data, collections, sendMessage) {
|
|
|
26399
26437
|
async function handleDashBuilderRequestInner(data, collections, sendMessage) {
|
|
26400
26438
|
const parsed = DashBuilderRequestMessageSchema.safeParse(data);
|
|
26401
26439
|
if (!parsed.success) {
|
|
26402
|
-
logger.error("[DashBuilderReq] Invalid message:", JSON.stringify(parsed.error.
|
|
26440
|
+
logger.error("[DashBuilderReq] Invalid message:", JSON.stringify(parsed.error.issues));
|
|
26403
26441
|
return;
|
|
26404
26442
|
}
|
|
26405
26443
|
const { id, payload, from } = parsed.data;
|
package/dist/index.mjs
CHANGED
|
@@ -219,7 +219,7 @@ var UserSchema = z3.object({
|
|
|
219
219
|
password: z3.string().min(1, "Password is required"),
|
|
220
220
|
fullname: z3.string().optional(),
|
|
221
221
|
role: z3.string().optional(),
|
|
222
|
-
userInfo: z3.record(z3.unknown()).optional(),
|
|
222
|
+
userInfo: z3.record(z3.string(), z3.unknown()).optional(),
|
|
223
223
|
wsIds: z3.array(z3.string()).optional()
|
|
224
224
|
// Only in memory, not persisted to file
|
|
225
225
|
});
|
|
@@ -247,8 +247,8 @@ var IncomingMessageSchema = z3.object({
|
|
|
247
247
|
var DataRequestPayloadSchema = z3.object({
|
|
248
248
|
collection: z3.string(),
|
|
249
249
|
op: z3.string(),
|
|
250
|
-
params: z3.record(z3.unknown()).optional(),
|
|
251
|
-
SA_RUNTIME: z3.record(z3.unknown()).optional()
|
|
250
|
+
params: z3.record(z3.string(), z3.unknown()).optional(),
|
|
251
|
+
SA_RUNTIME: z3.record(z3.string(), z3.unknown()).optional()
|
|
252
252
|
});
|
|
253
253
|
var DataRequestMessageSchema = z3.object({
|
|
254
254
|
id: z3.string(),
|
|
@@ -345,10 +345,12 @@ var UserPromptSuggestionsMessageSchema = z3.object({
|
|
|
345
345
|
payload: UserPromptSuggestionsPayloadSchema
|
|
346
346
|
});
|
|
347
347
|
var ComponentPropsSchema = z3.object({
|
|
348
|
+
// Same runtime schema as under zod 3; the cast keeps zod 3's inferred `{}`, since
|
|
349
|
+
// zod 4 infers z.object({}) as Record<string, never> and `query.sql` stops type-checking.
|
|
348
350
|
query: z3.string().or(z3.object({})).nullable().optional(),
|
|
349
351
|
title: z3.string().optional(),
|
|
350
352
|
description: z3.string().optional(),
|
|
351
|
-
config: z3.record(z3.unknown()).optional()
|
|
353
|
+
config: z3.record(z3.string(), z3.unknown()).optional()
|
|
352
354
|
}).passthrough();
|
|
353
355
|
var ComponentSchema = z3.object({
|
|
354
356
|
id: z3.string(),
|
|
@@ -376,8 +378,8 @@ var WorkflowDescriptorSchema = z3.object({
|
|
|
376
378
|
name: z3.string(),
|
|
377
379
|
description: z3.string(),
|
|
378
380
|
whenToUse: z3.string(),
|
|
379
|
-
propsSchema: z3.record(z3.string()),
|
|
380
|
-
defaultProps: z3.record(z3.unknown()).optional()
|
|
381
|
+
propsSchema: z3.record(z3.string(), z3.string()),
|
|
382
|
+
defaultProps: z3.record(z3.string(), z3.unknown()).optional()
|
|
381
383
|
});
|
|
382
384
|
var WorkflowsSchema = z3.array(WorkflowDescriptorSchema);
|
|
383
385
|
var WorkflowListResponsePayloadSchema = z3.object({
|
|
@@ -410,8 +412,9 @@ var ToolSchema = z3.object({
|
|
|
410
412
|
toolType: z3.enum(["source", "direct"]).optional(),
|
|
411
413
|
/** Full untruncated schema for source agent (all columns visible) */
|
|
412
414
|
fullSchema: z3.string().optional(),
|
|
413
|
-
params: z3.record(z3.string()),
|
|
414
|
-
|
|
415
|
+
params: z3.record(z3.string(), z3.string()),
|
|
416
|
+
// zod 4: z.function() is no longer a schema, so a tool's handler is checked as a plain callable.
|
|
417
|
+
fn: z3.custom((v) => typeof v === "function", { message: "fn must be a function" }),
|
|
415
418
|
outputSchema: OutputSchema.optional(),
|
|
416
419
|
// Optional: describes the data structure returned by this tool
|
|
417
420
|
/** Cache policy. `false` = never cache (live data, write ops). Mirrors HTTP `Cache-Control: no-store`. */
|
|
@@ -433,7 +436,7 @@ var UsersRequestPayloadSchema = z3.object({
|
|
|
433
436
|
password: z3.string().optional(),
|
|
434
437
|
fullname: z3.string().optional(),
|
|
435
438
|
role: z3.string().optional(),
|
|
436
|
-
userInfo: z3.record(z3.unknown()).optional(),
|
|
439
|
+
userInfo: z3.record(z3.string(), z3.unknown()).optional(),
|
|
437
440
|
// Query operation fields
|
|
438
441
|
filters: UserQueryFiltersSchema.optional(),
|
|
439
442
|
limit: z3.number().optional(),
|
|
@@ -452,7 +455,7 @@ var UILogsPayloadSchema = z3.object({
|
|
|
452
455
|
level: z3.enum(["info", "error", "warn", "debug"]),
|
|
453
456
|
message: z3.string(),
|
|
454
457
|
type: z3.enum(["explanation", "query", "general"]).optional(),
|
|
455
|
-
data: z3.record(z3.unknown()).optional()
|
|
458
|
+
data: z3.record(z3.string(), z3.unknown()).optional()
|
|
456
459
|
}))
|
|
457
460
|
});
|
|
458
461
|
var UILogsMessageSchema = z3.object({
|
|
@@ -570,7 +573,7 @@ var UIBlockSchema = z3.object({
|
|
|
570
573
|
// DB field name / Legacy field
|
|
571
574
|
generatedComponentMetadata: ComponentSchema.optional(),
|
|
572
575
|
// Actual field used by UIBlock class
|
|
573
|
-
componentData: z3.record(z3.any()).optional(),
|
|
576
|
+
componentData: z3.record(z3.string(), z3.any()).optional(),
|
|
574
577
|
createdAt: z3.string().optional(),
|
|
575
578
|
/**
|
|
576
579
|
* Which script recipe produced this answer. Set whenever the turn was answered
|
|
@@ -581,7 +584,7 @@ var UIBlockSchema = z3.object({
|
|
|
581
584
|
*/
|
|
582
585
|
scriptBinding: z3.object({
|
|
583
586
|
recipeId: z3.string(),
|
|
584
|
-
params: z3.record(z3.any()).optional(),
|
|
587
|
+
params: z3.record(z3.string(), z3.any()).optional(),
|
|
585
588
|
name: z3.string().optional(),
|
|
586
589
|
columns: z3.array(z3.string()).optional()
|
|
587
590
|
}).optional(),
|
|
@@ -662,7 +665,7 @@ var ArtifactsRequestPayloadSchema = z3.object({
|
|
|
662
665
|
id: z3.number().optional(),
|
|
663
666
|
name: z3.string().optional(),
|
|
664
667
|
createdBy: z3.string().optional(),
|
|
665
|
-
dsl: z3.record(z3.any()).optional(),
|
|
668
|
+
dsl: z3.record(z3.string(), z3.any()).optional(),
|
|
666
669
|
status: z3.string().optional(),
|
|
667
670
|
deleted: z3.boolean().optional(),
|
|
668
671
|
limit: z3.number().optional(),
|
|
@@ -742,7 +745,7 @@ var MenusRequestPayloadSchema = z3.object({
|
|
|
742
745
|
userMessage: z3.string().optional(),
|
|
743
746
|
parentId: z3.number().nullable().optional(),
|
|
744
747
|
sortOrder: z3.number().optional(),
|
|
745
|
-
props: z3.record(z3.unknown()).optional(),
|
|
748
|
+
props: z3.record(z3.string(), z3.unknown()).optional(),
|
|
746
749
|
isActive: z3.boolean().optional(),
|
|
747
750
|
// Query operation fields
|
|
748
751
|
filters: MenusQueryFiltersSchema.optional(),
|
|
@@ -753,7 +756,7 @@ var MenusRequestPayloadSchema = z3.object({
|
|
|
753
756
|
id: z3.number(),
|
|
754
757
|
sortOrder: z3.number()
|
|
755
758
|
})).optional(),
|
|
756
|
-
menuJson: z3.record(z3.unknown()).optional(),
|
|
759
|
+
menuJson: z3.record(z3.string(), z3.unknown()).optional(),
|
|
757
760
|
version: z3.number().optional()
|
|
758
761
|
}).optional()
|
|
759
762
|
});
|
|
@@ -930,7 +933,7 @@ var DashComponentSchema = z3.object({
|
|
|
930
933
|
name: z3.string(),
|
|
931
934
|
kind: z3.string(),
|
|
932
935
|
purpose: z3.string(),
|
|
933
|
-
props: z3.record(DashComponentPropSchema).optional(),
|
|
936
|
+
props: z3.record(z3.string(), DashComponentPropSchema).optional(),
|
|
934
937
|
useWhen: z3.string().optional(),
|
|
935
938
|
notes: z3.string().optional()
|
|
936
939
|
});
|
|
@@ -1886,6 +1889,7 @@ function canonicalPolicies(policies) {
|
|
|
1886
1889
|
const norm = policies.map((p) => ({
|
|
1887
1890
|
s: p.sourceId ?? "*",
|
|
1888
1891
|
t: [...p.readableTables ?? []].sort(),
|
|
1892
|
+
x: JSON.stringify(p.exceptions ?? []),
|
|
1889
1893
|
f: (p.rowFilters ?? []).map((f) => ({
|
|
1890
1894
|
t: f.table ?? "*",
|
|
1891
1895
|
c: f.column,
|
|
@@ -2562,6 +2566,38 @@ function accessFromConfig(config2) {
|
|
|
2562
2566
|
allowedSources: scoped ? allowedSourcesFrom(scoped.allowedSources) : null
|
|
2563
2567
|
};
|
|
2564
2568
|
}
|
|
2569
|
+
function exceptionsFromConfig(raw) {
|
|
2570
|
+
if (!Array.isArray(raw)) return [];
|
|
2571
|
+
const str = (v) => typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
2572
|
+
const out = [];
|
|
2573
|
+
for (const item of raw) {
|
|
2574
|
+
if (!item || typeof item !== "object") continue;
|
|
2575
|
+
const x = item;
|
|
2576
|
+
const name = typeof x.name === "string" && x.name ? x.name : void 0;
|
|
2577
|
+
if (!x.tables || typeof x.tables !== "object") continue;
|
|
2578
|
+
const visibleKeys = str(x.visibleKeys);
|
|
2579
|
+
const tables = {};
|
|
2580
|
+
for (const [table, spec] of Object.entries(x.tables)) {
|
|
2581
|
+
if (!table || !spec || typeof spec !== "object") continue;
|
|
2582
|
+
const s = spec;
|
|
2583
|
+
const link = str(s.link);
|
|
2584
|
+
const own = str(s.own);
|
|
2585
|
+
const columns = Array.isArray(s.columns) ? s.columns.filter((c) => typeof c === "string" && !!c) : [];
|
|
2586
|
+
let bad = null;
|
|
2587
|
+
if (!own && !link) bad = 'it has neither "link" nor "own"';
|
|
2588
|
+
else if (!own && columns.length === 0) bad = 'it lists no "columns"';
|
|
2589
|
+
else if (!own && !visibleKeys) bad = 'the exception has no "visibleKeys"';
|
|
2590
|
+
if (bad) {
|
|
2591
|
+
logger.warn(`[RequestIdentity] Exception "${name ?? "?"}": table "${table}" dropped because ${bad}.`);
|
|
2592
|
+
continue;
|
|
2593
|
+
}
|
|
2594
|
+
tables[table] = own ? { own } : { link, columns };
|
|
2595
|
+
}
|
|
2596
|
+
if (Object.keys(tables).length === 0) continue;
|
|
2597
|
+
out.push({ name, visibleKeys, tables });
|
|
2598
|
+
}
|
|
2599
|
+
return out;
|
|
2600
|
+
}
|
|
2565
2601
|
function policiesFromConfig(config2) {
|
|
2566
2602
|
const raw = scopedForm(config2)?.policies ?? config2;
|
|
2567
2603
|
const entries = Array.isArray(raw) ? raw : [raw];
|
|
@@ -2587,6 +2623,7 @@ function policiesFromConfig(config2) {
|
|
|
2587
2623
|
});
|
|
2588
2624
|
}
|
|
2589
2625
|
const readableTables = Array.isArray(e.readableTables) ? e.readableTables.filter((t) => typeof t === "string" && !!t) : [];
|
|
2626
|
+
const exceptions = exceptionsFromConfig(e.exceptions);
|
|
2590
2627
|
if (rowFilters.length === 0 && readableTables.length === 0) continue;
|
|
2591
2628
|
const label = typeof e.label === "string" && e.label.trim() ? e.label.trim() : void 0;
|
|
2592
2629
|
if (!label && rowFilters.some((f) => !f.label) && !warnedUnlabelled) {
|
|
@@ -2599,7 +2636,8 @@ function policiesFromConfig(config2) {
|
|
|
2599
2636
|
sourceId: typeof e.sourceId === "string" && e.sourceId ? e.sourceId : null,
|
|
2600
2637
|
label,
|
|
2601
2638
|
rowFilters,
|
|
2602
|
-
readableTables
|
|
2639
|
+
readableTables,
|
|
2640
|
+
exceptions
|
|
2603
2641
|
});
|
|
2604
2642
|
}
|
|
2605
2643
|
return out;
|
|
@@ -19628,7 +19666,7 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
19628
19666
|
const parseResult = UserPromptRequestMessageSchema.safeParse(data);
|
|
19629
19667
|
if (!parseResult.success) {
|
|
19630
19668
|
const zodError = parseResult.error;
|
|
19631
|
-
zodError.
|
|
19669
|
+
zodError.issues.forEach((err) => {
|
|
19632
19670
|
errors.push(`${err.path.join(".")}: ${err.message}`);
|
|
19633
19671
|
});
|
|
19634
19672
|
return { success: false, errors };
|
|
@@ -24141,7 +24179,7 @@ var processDashCompRequest = async (data, components, _sendMessage, anthropicApi
|
|
|
24141
24179
|
const parseResult = DashCompRequestMessageSchema.safeParse(data);
|
|
24142
24180
|
if (!parseResult.success) {
|
|
24143
24181
|
const zodError = parseResult.error;
|
|
24144
|
-
zodError.
|
|
24182
|
+
zodError.issues.forEach((err) => {
|
|
24145
24183
|
errors.push(`${err.path.join(".")}: ${err.message}`);
|
|
24146
24184
|
});
|
|
24147
24185
|
return { success: false, errors };
|
|
@@ -24312,7 +24350,7 @@ async function handleDashboardAgentRequest(data, collections, sendMessage) {
|
|
|
24312
24350
|
console.log("[DashboardAgentReq] Handler invoked. Raw message type/id:", data?.type, data?.id);
|
|
24313
24351
|
const parseResult = DashboardAgentRequestMessageSchema.safeParse(data);
|
|
24314
24352
|
if (!parseResult.success) {
|
|
24315
|
-
logger.error("[DashboardAgentReq] Invalid message \u2014 failed schema validation:", JSON.stringify(parseResult.error.
|
|
24353
|
+
logger.error("[DashboardAgentReq] Invalid message \u2014 failed schema validation:", JSON.stringify(parseResult.error.issues));
|
|
24316
24354
|
return;
|
|
24317
24355
|
}
|
|
24318
24356
|
const { id, payload, from } = parseResult.data;
|
|
@@ -26167,7 +26205,7 @@ function handleCodingAgentAbort(data, sendMessage) {
|
|
|
26167
26205
|
async function handleCodingAgentRequest(data, collections, sendMessage) {
|
|
26168
26206
|
const parseResult = CodingAgentRequestMessageSchema.safeParse(data);
|
|
26169
26207
|
if (!parseResult.success) {
|
|
26170
|
-
logger.error("[CodingAgentReq] Invalid message:", JSON.stringify(parseResult.error.
|
|
26208
|
+
logger.error("[CodingAgentReq] Invalid message:", JSON.stringify(parseResult.error.issues));
|
|
26171
26209
|
return;
|
|
26172
26210
|
}
|
|
26173
26211
|
const { id, payload, from } = parseResult.data;
|
|
@@ -26287,7 +26325,7 @@ async function handleDashBuilderRequest(data, collections, sendMessage) {
|
|
|
26287
26325
|
async function handleDashBuilderRequestInner(data, collections, sendMessage) {
|
|
26288
26326
|
const parsed = DashBuilderRequestMessageSchema.safeParse(data);
|
|
26289
26327
|
if (!parsed.success) {
|
|
26290
|
-
logger.error("[DashBuilderReq] Invalid message:", JSON.stringify(parsed.error.
|
|
26328
|
+
logger.error("[DashBuilderReq] Invalid message:", JSON.stringify(parsed.error.issues));
|
|
26291
26329
|
return;
|
|
26292
26330
|
}
|
|
26293
26331
|
const { id, payload, from } = parsed.data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superatomai/sdk-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.84-dsp",
|
|
4
4
|
"description": "Node.js TypeScript SDK for Superatom",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"openai": "^4.77.0",
|
|
42
42
|
"typebox": "^1.1.38",
|
|
43
43
|
"ws": "^8.21.0",
|
|
44
|
-
"zod": "^
|
|
44
|
+
"zod": "^4.6.6"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"@openai/codex-sdk": "0.156.1"
|