@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 CHANGED
@@ -1196,65 +1196,47 @@ You MUST respond with ONLY a valid JSON object (no markdown, no code blocks):
1196
1196
 
1197
1197
  ## Your Task
1198
1198
 
1199
- 1. **Create a filter component** based on the user's request (DatePicker, Dropdown, SearchBox, etc.)
1200
- 2. **Update all existing components** to use the filter values in their queries/params
1199
+ 1. **Create a filter component** based on the user's request
1200
+ 2. **Update existing components** with dynamic title/description interpolation if needed
1201
+ 3. **Preserve all existing props** - the filter system handles param merging at runtime
1201
1202
 
1202
- ## Filter Types
1203
+ ## How The Filter System Works
1203
1204
 
1204
- Choose the appropriate filter component based on user intent:
1205
- - **DateRangePicker**: For date range filtering (start date, end date)
1206
- - **DatePicker**: For single date filtering
1207
- - **Dropdown**: For categorical filtering (status, category, type, etc.)
1208
- - **MultiSelect**: For multiple value selection
1209
- - **SearchBox**: For text search filtering
1210
- - **NumberRange**: For numeric range filtering
1205
+ 1. Filter component has a \`filters\` array with preset options, each containing \`label\`, \`value\`, and \`params\`
1206
+ 2. When user selects a filter option, those \`params\` are broadcast to all listening components
1207
+ 3. Components automatically merge filter params with their existing params (filter values override defaults)
1208
+ 4. Component titles/descriptions can use \`{%filterKeyLabel%}\` syntax for dynamic text
1211
1209
 
1212
1210
  ## Filter Component Structure
1213
1211
 
1214
- Generate a filter component with these props:
1215
- \`\`\`json
1216
- {
1217
- "componentId": "unique_filter_id",
1218
- "componentType": "DateRangePicker | Dropdown | SearchBox | etc.",
1219
- "componentName": "Display Name",
1220
- "props": {
1221
- "filterId": "unique_filter_id",
1222
- "label": "Filter Label",
1223
- "defaultValue": "optional default value",
1224
- "options": []
1225
- }
1226
- }
1227
- \`\`\`
1212
+ The filter uses DynamicFilterDropdown with:
1213
+ - **filterKey**: Identifier for label interpolation (e.g., "period", "name", "category")
1214
+ - **filters**: Array of options with label, value, params, and optionally isDefault
1215
+ - **defaultValue**: The value of the initially selected option
1228
1216
 
1229
- ## Updating Existing Components
1230
-
1231
- For each existing component, update its query/externalTool to use the filter:
1232
-
1233
- ### For Database Queries:
1234
- - Add filter conditions to WHERE clause using \`$paramName\` placeholders
1235
- - Add the filter param to the \`params\` object with binding reference
1217
+ ## Dynamic Title/Description Interpolation
1236
1218
 
1237
- ### For External Tools:
1238
- - Add filter params to the tool's params object with binding reference
1219
+ Use \`{%filterKeyLabel%}\` syntax for dynamic text:
1220
+ - filterKey "period" \u2192 use \`{%periodLabel%}\` in titles/descriptions
1221
+ - filterKey "name" \u2192 use \`{%nameLabel%}\` in titles/descriptions
1222
+ - Example: \`"{%periodLabel%} Revenue"\` becomes "Q3 2025 Revenue" when user selects "Q3 2025"
1239
1223
 
1240
- ## Filter Bindings
1224
+ **CRITICAL Template Syntax:**
1225
+ - Use \`{%keyLabel%}\` format (percent signs, key + "Label" suffix)
1226
+ - Do NOT use \`{{...}}\` or \`$...\` syntax - these don't work
1241
1227
 
1242
- Use this binding format to connect filter values to component params:
1243
- \`\`\`json
1244
- {
1245
- "paramName": "$filter.filterId.value"
1246
- }
1247
- \`\`\`
1248
-
1249
- For DateRangePicker:
1250
- - \`$filter.filterId.startDate\`
1251
- - \`$filter.filterId.endDate\`
1228
+ ## Updating Existing Components
1252
1229
 
1253
- For Dropdown/MultiSelect:
1254
- - \`$filter.filterId.value\`
1230
+ **IMPORTANT - Parameter Handling:**
1231
+ - Do NOT change existing parameter values to placeholders
1232
+ - Keep all existing/default parameter values as they are
1233
+ - The filter system MERGES params at runtime: filter params override component defaults
1255
1234
 
1256
- For SearchBox:
1257
- - \`$filter.filterId.searchText\`
1235
+ **What to modify in existing components:**
1236
+ - Modify \`title\` for \`{%filterKeyLabel%}\` interpolation (only if title exists)
1237
+ - Modify \`description\` for interpolation (only if description exists)
1238
+ - Modify other props only if specifically needed for the filter to function
1239
+ - Copy ALL other props exactly as provided
1258
1240
 
1259
1241
  ### Database Query Rules
1260
1242
  {{DATABASE_RULES}}
@@ -1265,53 +1247,48 @@ You MUST respond with ONLY a valid JSON object (no markdown, no code blocks):
1265
1247
 
1266
1248
  {
1267
1249
  "filterComponent": {
1268
- "componentId": "filter_unique_id",
1269
- "componentType": "DateRangePicker | Dropdown | etc.",
1270
- "componentName": "Filter Display Name",
1250
+ "id": "filter-<descriptive-id>",
1251
+ "name": "DynamicFilterDropdown",
1252
+ "type": "FilterDropdown",
1271
1253
  "props": {
1272
- "filterId": "filter_unique_id",
1273
- "label": "Filter Label",
1274
- "defaultValue": null,
1275
- "options": []
1254
+ "title": "<Filter display title>",
1255
+ "filterKey": "<key_for_interpolation>",
1256
+ "defaultValue": "<default_option_value>",
1257
+ "filters": [
1258
+ {
1259
+ "label": "<Display label for option>",
1260
+ "value": "<unique_option_value>",
1261
+ "params": { "<param_key>": "<actual_value>", "...": "..." },
1262
+ "isDefault": true
1263
+ }
1264
+ ]
1276
1265
  }
1277
1266
  },
1278
1267
  "updatedComponents": [
1279
1268
  {
1280
- "componentId": "existing_component_id",
1281
- "componentType": "existing_type",
1282
- "componentName": "existing_name",
1269
+ "id": "<existing_component_id>",
1270
+ "name": "<existing_component_name>",
1271
+ "type": "<existing_type>",
1283
1272
  "props": {
1284
- // RETURN THE COMPLETE PROPS OBJECT
1285
- // Copy ALL existing props and only modify the necessary fields
1286
- "title": "Existing Title",
1287
- "description": "Existing Description",
1288
- "config": {},
1289
- "query": {
1290
- "sql": "SELECT ... WHERE column BETWEEN $startDate AND $endDate",
1291
- "params": {
1292
- "existingParam": "existing_value",
1293
- "startDate": "$filter.filterId.startDate",
1294
- "endDate": "$filter.filterId.endDate"
1295
- }
1296
- }
1273
+ "...all existing props preserved...",
1274
+ "title": "{%<filterKey>Label%} <rest of title>",
1275
+ "description": "<updated if needed>"
1297
1276
  }
1298
1277
  }
1299
1278
  ],
1300
1279
  "filterBindings": {
1301
- "startDate": "$filter.filterId.startDate",
1302
- "endDate": "$filter.filterId.endDate"
1280
+ "<param_key>": "Describes which filter param this binds to"
1303
1281
  },
1304
- "reasoning": "Explanation of filter choice and how components were updated"
1282
+ "reasoning": "Explanation of filter choice and what params it provides"
1305
1283
  }
1306
1284
 
1307
- **CRITICAL:**
1308
- - Return ONLY valid JSON (no markdown code blocks, no text before/after)
1309
- - **RETURN COMPLETE PROPS**: Copy ALL existing props from each component, only modify what's needed for the filter
1310
- - Do NOT omit existing props like title, description, config - include them unchanged
1311
- - Only modify query.sql (add WHERE conditions) and query.params (add filter bindings)
1312
- - For externalTool, only add filter params to the params object
1313
- - Use consistent param naming across all components
1314
- - Ensure SQL syntax is valid with the new filter conditions
1285
+ **CRITICAL RULES:**
1286
+ 1. Return ONLY valid JSON (no markdown code blocks)
1287
+ 2. **COPY ALL existing props** - modify title/description for interpolation only if they exist
1288
+ 3. **DO NOT change parameter values** - keep existing defaults, filter merges at runtime
1289
+ 4. Use \`{%filterKeyLabel%}\` for dynamic text (NOT \`{{...}}\` or \`$...\`)
1290
+ 5. Filter \`params\` must have ACTUAL values (real dates, strings), not placeholders
1291
+ 6. Each filter option needs: label, value, params (and optionally isDefault)
1315
1292
 
1316
1293
  ## Database Schema
1317
1294
  {{SCHEMA_DOC}}
@@ -10535,13 +10512,13 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
10535
10512
  });
10536
10513
  return { success: false, errors };
10537
10514
  }
10538
- const originalComponent = components.find((c) => c.id === result.componentId);
10515
+ const originalComponent = components.find((c) => c.name === result.componentName);
10539
10516
  if (!originalComponent) {
10540
- errors.push(`Component ${result.componentId} not found in available components`);
10517
+ errors.push(`Component ${result.componentName} not found in available components`);
10541
10518
  userPromptErrorLogger.logError("DASH_COMP_REQ", "Component not found", {
10542
10519
  prompt,
10543
- componentId: result.componentId,
10544
- availableComponentIds: components.map((c) => c.id)
10520
+ componentName: result.componentName,
10521
+ availableComponentNames: components.map((c) => c.name)
10545
10522
  });
10546
10523
  return { success: false, errors };
10547
10524
  }