@superatomai/sdk-node 0.0.43 → 0.0.44
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.js +63 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -86
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1174,65 +1174,47 @@ You MUST respond with ONLY a valid JSON object (no markdown, no code blocks):
|
|
|
1174
1174
|
|
|
1175
1175
|
## Your Task
|
|
1176
1176
|
|
|
1177
|
-
1. **Create a filter component** based on the user's request
|
|
1178
|
-
2. **Update
|
|
1177
|
+
1. **Create a filter component** based on the user's request
|
|
1178
|
+
2. **Update existing components** with dynamic title/description interpolation if needed
|
|
1179
|
+
3. **Preserve all existing props** - the filter system handles param merging at runtime
|
|
1179
1180
|
|
|
1180
|
-
## Filter
|
|
1181
|
+
## How The Filter System Works
|
|
1181
1182
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
- **MultiSelect**: For multiple value selection
|
|
1187
|
-
- **SearchBox**: For text search filtering
|
|
1188
|
-
- **NumberRange**: For numeric range filtering
|
|
1183
|
+
1. Filter component has a \`filters\` array with preset options, each containing \`label\`, \`value\`, and \`params\`
|
|
1184
|
+
2. When user selects a filter option, those \`params\` are broadcast to all listening components
|
|
1185
|
+
3. Components automatically merge filter params with their existing params (filter values override defaults)
|
|
1186
|
+
4. Component titles/descriptions can use \`{%filterKeyLabel%}\` syntax for dynamic text
|
|
1189
1187
|
|
|
1190
1188
|
## Filter Component Structure
|
|
1191
1189
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
"componentType": "DateRangePicker | Dropdown | SearchBox | etc.",
|
|
1197
|
-
"componentName": "Display Name",
|
|
1198
|
-
"props": {
|
|
1199
|
-
"filterId": "unique_filter_id",
|
|
1200
|
-
"label": "Filter Label",
|
|
1201
|
-
"defaultValue": "optional default value",
|
|
1202
|
-
"options": []
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
\`\`\`
|
|
1190
|
+
The filter uses DynamicFilterDropdown with:
|
|
1191
|
+
- **filterKey**: Identifier for label interpolation (e.g., "period", "name", "category")
|
|
1192
|
+
- **filters**: Array of options with label, value, params, and optionally isDefault
|
|
1193
|
+
- **defaultValue**: The value of the initially selected option
|
|
1206
1194
|
|
|
1207
|
-
##
|
|
1208
|
-
|
|
1209
|
-
For each existing component, update its query/externalTool to use the filter:
|
|
1210
|
-
|
|
1211
|
-
### For Database Queries:
|
|
1212
|
-
- Add filter conditions to WHERE clause using \`$paramName\` placeholders
|
|
1213
|
-
- Add the filter param to the \`params\` object with binding reference
|
|
1195
|
+
## Dynamic Title/Description Interpolation
|
|
1214
1196
|
|
|
1215
|
-
|
|
1216
|
-
-
|
|
1197
|
+
Use \`{%filterKeyLabel%}\` syntax for dynamic text:
|
|
1198
|
+
- filterKey "period" \u2192 use \`{%periodLabel%}\` in titles/descriptions
|
|
1199
|
+
- filterKey "name" \u2192 use \`{%nameLabel%}\` in titles/descriptions
|
|
1200
|
+
- Example: \`"{%periodLabel%} Revenue"\` becomes "Q3 2025 Revenue" when user selects "Q3 2025"
|
|
1217
1201
|
|
|
1218
|
-
|
|
1202
|
+
**CRITICAL Template Syntax:**
|
|
1203
|
+
- Use \`{%keyLabel%}\` format (percent signs, key + "Label" suffix)
|
|
1204
|
+
- Do NOT use \`{{...}}\` or \`$...\` syntax - these don't work
|
|
1219
1205
|
|
|
1220
|
-
|
|
1221
|
-
\`\`\`json
|
|
1222
|
-
{
|
|
1223
|
-
"paramName": "$filter.filterId.value"
|
|
1224
|
-
}
|
|
1225
|
-
\`\`\`
|
|
1226
|
-
|
|
1227
|
-
For DateRangePicker:
|
|
1228
|
-
- \`$filter.filterId.startDate\`
|
|
1229
|
-
- \`$filter.filterId.endDate\`
|
|
1206
|
+
## Updating Existing Components
|
|
1230
1207
|
|
|
1231
|
-
|
|
1232
|
-
-
|
|
1208
|
+
**IMPORTANT - Parameter Handling:**
|
|
1209
|
+
- Do NOT change existing parameter values to placeholders
|
|
1210
|
+
- Keep all existing/default parameter values as they are
|
|
1211
|
+
- The filter system MERGES params at runtime: filter params override component defaults
|
|
1233
1212
|
|
|
1234
|
-
|
|
1235
|
-
-
|
|
1213
|
+
**What to modify in existing components:**
|
|
1214
|
+
- Modify \`title\` for \`{%filterKeyLabel%}\` interpolation (only if title exists)
|
|
1215
|
+
- Modify \`description\` for interpolation (only if description exists)
|
|
1216
|
+
- Modify other props only if specifically needed for the filter to function
|
|
1217
|
+
- Copy ALL other props exactly as provided
|
|
1236
1218
|
|
|
1237
1219
|
### Database Query Rules
|
|
1238
1220
|
{{DATABASE_RULES}}
|
|
@@ -1243,53 +1225,48 @@ You MUST respond with ONLY a valid JSON object (no markdown, no code blocks):
|
|
|
1243
1225
|
|
|
1244
1226
|
{
|
|
1245
1227
|
"filterComponent": {
|
|
1246
|
-
"
|
|
1247
|
-
"
|
|
1248
|
-
"
|
|
1228
|
+
"id": "filter-<descriptive-id>",
|
|
1229
|
+
"name": "DynamicFilterDropdown",
|
|
1230
|
+
"type": "FilterDropdown",
|
|
1249
1231
|
"props": {
|
|
1250
|
-
"
|
|
1251
|
-
"
|
|
1252
|
-
"defaultValue":
|
|
1253
|
-
"
|
|
1232
|
+
"title": "<Filter display title>",
|
|
1233
|
+
"filterKey": "<key_for_interpolation>",
|
|
1234
|
+
"defaultValue": "<default_option_value>",
|
|
1235
|
+
"filters": [
|
|
1236
|
+
{
|
|
1237
|
+
"label": "<Display label for option>",
|
|
1238
|
+
"value": "<unique_option_value>",
|
|
1239
|
+
"params": { "<param_key>": "<actual_value>", "...": "..." },
|
|
1240
|
+
"isDefault": true
|
|
1241
|
+
}
|
|
1242
|
+
]
|
|
1254
1243
|
}
|
|
1255
1244
|
},
|
|
1256
1245
|
"updatedComponents": [
|
|
1257
1246
|
{
|
|
1258
|
-
"
|
|
1259
|
-
"
|
|
1260
|
-
"
|
|
1247
|
+
"id": "<existing_component_id>",
|
|
1248
|
+
"name": "<existing_component_name>",
|
|
1249
|
+
"type": "<existing_type>",
|
|
1261
1250
|
"props": {
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
"
|
|
1265
|
-
"description": "Existing Description",
|
|
1266
|
-
"config": {},
|
|
1267
|
-
"query": {
|
|
1268
|
-
"sql": "SELECT ... WHERE column BETWEEN $startDate AND $endDate",
|
|
1269
|
-
"params": {
|
|
1270
|
-
"existingParam": "existing_value",
|
|
1271
|
-
"startDate": "$filter.filterId.startDate",
|
|
1272
|
-
"endDate": "$filter.filterId.endDate"
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1251
|
+
"...all existing props preserved...",
|
|
1252
|
+
"title": "{%<filterKey>Label%} <rest of title>",
|
|
1253
|
+
"description": "<updated if needed>"
|
|
1275
1254
|
}
|
|
1276
1255
|
}
|
|
1277
1256
|
],
|
|
1278
1257
|
"filterBindings": {
|
|
1279
|
-
"
|
|
1280
|
-
"endDate": "$filter.filterId.endDate"
|
|
1258
|
+
"<param_key>": "Describes which filter param this binds to"
|
|
1281
1259
|
},
|
|
1282
|
-
"reasoning": "Explanation of filter choice and
|
|
1260
|
+
"reasoning": "Explanation of filter choice and what params it provides"
|
|
1283
1261
|
}
|
|
1284
1262
|
|
|
1285
|
-
**CRITICAL:**
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
- Ensure SQL syntax is valid with the new filter conditions
|
|
1263
|
+
**CRITICAL RULES:**
|
|
1264
|
+
1. Return ONLY valid JSON (no markdown code blocks)
|
|
1265
|
+
2. **COPY ALL existing props** - modify title/description for interpolation only if they exist
|
|
1266
|
+
3. **DO NOT change parameter values** - keep existing defaults, filter merges at runtime
|
|
1267
|
+
4. Use \`{%filterKeyLabel%}\` for dynamic text (NOT \`{{...}}\` or \`$...\`)
|
|
1268
|
+
5. Filter \`params\` must have ACTUAL values (real dates, strings), not placeholders
|
|
1269
|
+
6. Each filter option needs: label, value, params (and optionally isDefault)
|
|
1293
1270
|
|
|
1294
1271
|
## Database Schema
|
|
1295
1272
|
{{SCHEMA_DOC}}
|
|
@@ -10485,13 +10462,13 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
|
|
|
10485
10462
|
});
|
|
10486
10463
|
return { success: false, errors };
|
|
10487
10464
|
}
|
|
10488
|
-
const originalComponent = components.find((c) => c.
|
|
10465
|
+
const originalComponent = components.find((c) => c.name === result.componentName);
|
|
10489
10466
|
if (!originalComponent) {
|
|
10490
|
-
errors.push(`Component ${result.
|
|
10467
|
+
errors.push(`Component ${result.componentName} not found in available components`);
|
|
10491
10468
|
userPromptErrorLogger.logError("DASH_COMP_REQ", "Component not found", {
|
|
10492
10469
|
prompt,
|
|
10493
|
-
|
|
10494
|
-
|
|
10470
|
+
componentName: result.componentName,
|
|
10471
|
+
availableComponentNames: components.map((c) => c.name)
|
|
10495
10472
|
});
|
|
10496
10473
|
return { success: false, errors };
|
|
10497
10474
|
}
|