@apteva/apteva-kit 0.1.24 → 0.1.26

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.mjs CHANGED
@@ -594,14 +594,16 @@ function parseWidgetsFromText(text) {
594
594
  }
595
595
  try {
596
596
  const trimmedJson = jsonContent.trim();
597
- const props = JSON.parse(trimmedJson);
597
+ const parsed = JSON.parse(trimmedJson);
598
598
  const widgetId = `widget-${widgetType}-${simpleHash(trimmedJson)}`;
599
+ const { meta, ...props } = parsed;
599
600
  segments.push({
600
601
  type: "widget",
601
602
  widget: {
602
603
  type: widgetType,
603
604
  id: widgetId,
604
- props
605
+ props,
606
+ ...meta && { meta }
605
607
  }
606
608
  });
607
609
  hasWidgets = true;
@@ -709,6 +711,18 @@ function generateWidgetContext(enabledWidgets) {
709
711
 
710
712
  `;
711
713
  }
714
+ context += `### Meta field for extended data:
715
+
716
+ `;
717
+ context += `Any widget can include a "meta" field with extended data that isn't displayed but is captured by the UI:
718
+ `;
719
+ context += `- The widget displays from regular props (compact view)
720
+ `;
721
+ context += `- The "meta" field contains full/detailed data for external UI components
722
+ `;
723
+ context += `- Example: \`@ui:list[{"items": [{"id": "1", "title": "Task"}], "meta": {"items": [{"id": "1", "title": "Task", "description": "Full details...", "assignees": ["Alice"]}], "totalCount": 50}}]\`
724
+
725
+ `;
712
726
  context += `### Important notes:
713
727
  `;
714
728
  context += `- JSON must be valid (use double quotes for strings)
@@ -718,6 +732,8 @@ function generateWidgetContext(enabledWidgets) {
718
732
  context += `- You can include multiple widgets in a single response
719
733
  `;
720
734
  context += `- Combine widgets with regular text for context
735
+ `;
736
+ context += `- Use "meta" field when the UI needs more data than what's displayed
721
737
  `;
722
738
  return context;
723
739
  }
@@ -727,6 +743,8 @@ function generateCompactWidgetContext(enabledWidgets) {
727
743
  UI Widgets: Use @ui:type[{props}] syntax.
728
744
  `;
729
745
  context += `Available: ${widgets.join(", ")}
746
+ `;
747
+ context += `Add "meta" field for extended data not shown in widget but captured by UI.
730
748
  `;
731
749
  context += `Examples:
732
750
  `;