@stina/extension-api 0.52.0 → 0.56.0

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.
@@ -23,7 +23,15 @@ __export(schemas_exports, {
23
23
  AllowedCSSPropertySchema: () => AllowedCSSPropertySchema,
24
24
  AuthorSchema: () => AuthorSchema,
25
25
  ButtonPropsSchema: () => ButtonPropsSchema,
26
+ CHAT_CARD_COMPONENTS: () => CHAT_CARD_COMPONENTS,
27
+ CalendarEventPropsSchema: () => CalendarEventPropsSchema,
28
+ CalendarEventStatusSchema: () => CalendarEventStatusSchema,
26
29
  CapabilityPermissionSchema: () => CapabilityPermissionSchema,
30
+ ChartKindSchema: () => ChartKindSchema,
31
+ ChartPropsSchema: () => ChartPropsSchema,
32
+ ChartSeriesSchema: () => ChartSeriesSchema,
33
+ ChatCardComponentSchema: () => ChatCardComponentSchema,
34
+ ChatCardSchema: () => ChatCardSchema,
27
35
  CheckboxPropsSchema: () => CheckboxPropsSchema,
28
36
  CollapsiblePropsSchema: () => CollapsiblePropsSchema,
29
37
  CommandDefinitionSchema: () => CommandDefinitionSchema,
@@ -49,12 +57,16 @@ __export(schemas_exports, {
49
57
  IconButtonTypeSchema: () => IconButtonTypeSchema,
50
58
  IconPickerPropsSchema: () => IconPickerPropsSchema,
51
59
  IconPropsSchema: () => IconPropsSchema,
60
+ KeyValueListPropsSchema: () => KeyValueListPropsSchema,
61
+ KeyValueRowSchema: () => KeyValueRowSchema,
52
62
  LabelPropsSchema: () => LabelPropsSchema,
53
63
  ListPropsSchema: () => ListPropsSchema,
54
64
  LocalizedStringSchema: () => LocalizedStringSchema,
55
65
  MarkdownPropsSchema: () => MarkdownPropsSchema,
56
66
  ModalPropsSchema: () => ModalPropsSchema,
57
67
  NetworkPermissionSchema: () => NetworkPermissionSchema,
68
+ NotePropsSchema: () => NotePropsSchema,
69
+ NoteVariantSchema: () => NoteVariantSchema,
58
70
  PERMISSION_PATTERNS: () => PERMISSION_PATTERNS,
59
71
  PanelActionDataSourceSchema: () => PanelActionDataSourceSchema,
60
72
  PanelActionSchema: () => PanelActionSchema,
@@ -73,10 +85,15 @@ __export(schemas_exports, {
73
85
  ProviderConfigViewSchema: () => ProviderConfigViewSchema,
74
86
  ProviderDefinitionSchema: () => ProviderDefinitionSchema,
75
87
  SelectPropsSchema: () => SelectPropsSchema,
88
+ StatTilePropsSchema: () => StatTilePropsSchema,
89
+ StatTrendSchema: () => StatTrendSchema,
76
90
  StoragePermissionSchema: () => StoragePermissionSchema,
77
91
  SystemPermissionSchema: () => SystemPermissionSchema,
78
92
  TextInputPropsSchema: () => TextInputPropsSchema,
79
93
  TextPreviewPropsSchema: () => TextPreviewPropsSchema,
94
+ TimelineEntrySchema: () => TimelineEntrySchema,
95
+ TimelinePropsSchema: () => TimelinePropsSchema,
96
+ TimelineVariantSchema: () => TimelineVariantSchema,
80
97
  TogglePropsSchema: () => TogglePropsSchema,
81
98
  ToolDefinitionSchema: () => ToolDefinitionSchema,
82
99
  ToolSettingsActionDataSourceSchema: () => ToolSettingsActionDataSourceSchema,
@@ -89,7 +106,14 @@ __export(schemas_exports, {
89
106
  UserDataPermissionSchema: () => UserDataPermissionSchema,
90
107
  VALID_PERMISSIONS: () => VALID_PERMISSIONS,
91
108
  VerticalStackPropsSchema: () => VerticalStackPropsSchema,
92
- isValidPermission: () => isValidPermission
109
+ WeatherConditionSchema: () => WeatherConditionSchema,
110
+ WeatherForecastPropsSchema: () => WeatherForecastPropsSchema,
111
+ WeatherForecastStepSchema: () => WeatherForecastStepSchema,
112
+ WeatherNowPropsSchema: () => WeatherNowPropsSchema,
113
+ WeatherWindSchema: () => WeatherWindSchema,
114
+ describeChatCardProfile: () => describeChatCardProfile,
115
+ isValidPermission: () => isValidPermission,
116
+ validateChatCard: () => validateChatCard
93
117
  });
94
118
  module.exports = __toCommonJS(schemas_exports);
95
119
 
@@ -486,6 +510,146 @@ var ListPropsSchema = import_zod2.z.object({
486
510
  children: ExtensionComponentChildrenSchema.describe("Child components rendered as list items"),
487
511
  style: ExtensionComponentStyleSchema.optional()
488
512
  }).passthrough().describe("List component");
513
+ var WeatherConditionSchema = import_zod2.z.enum([
514
+ "clear",
515
+ "partly-cloudy",
516
+ "cloudy",
517
+ "overcast",
518
+ "fog",
519
+ "light-rain",
520
+ "rain",
521
+ "heavy-rain",
522
+ "sleet",
523
+ "light-snow",
524
+ "snow",
525
+ "heavy-snow",
526
+ "thunderstorm",
527
+ "hail",
528
+ "windy"
529
+ ]).describe("Weather condition");
530
+ var WeatherWindSchema = import_zod2.z.object({
531
+ speed: import_zod2.z.number().describe("Sustained wind speed"),
532
+ unit: import_zod2.z.string().optional().describe("Unit written after the speed. Defaults to m/s"),
533
+ direction: import_zod2.z.string().optional().describe("Compass direction, in the caller's own words"),
534
+ gust: import_zod2.z.number().optional().describe("Gust speed, in the same unit")
535
+ }).passthrough().describe("Wind reading");
536
+ var WeatherNowPropsSchema = import_zod2.z.object({
537
+ component: import_zod2.z.literal("WeatherNow"),
538
+ place: import_zod2.z.string().describe("Where the reading is from"),
539
+ condition: WeatherConditionSchema,
540
+ conditionLabel: import_zod2.z.string().optional().describe("The condition in the user's own language"),
541
+ temperature: import_zod2.z.number().describe("Current temperature"),
542
+ feelsLike: import_zod2.z.number().optional().describe("Apparent temperature"),
543
+ unit: import_zod2.z.string().optional().describe("Written after every temperature. Defaults to \xB0"),
544
+ wind: WeatherWindSchema.optional(),
545
+ night: import_zod2.z.boolean().optional().describe("Draw the night variant of the icon"),
546
+ summary: import_zod2.z.string().optional().describe("One line of context under the numbers"),
547
+ style: ExtensionComponentStyleSchema.optional()
548
+ }).passthrough().describe("Current weather component");
549
+ var WeatherForecastStepSchema = import_zod2.z.object({
550
+ label: import_zod2.z.string().describe("Short step label, e.g. 14 or Tors"),
551
+ condition: WeatherConditionSchema,
552
+ conditionLabel: import_zod2.z.string().optional(),
553
+ high: import_zod2.z.number().describe("The warmer temperature, or the only one"),
554
+ low: import_zod2.z.number().optional().describe("The colder temperature"),
555
+ night: import_zod2.z.boolean().optional(),
556
+ precipitation: import_zod2.z.number().min(0).max(100).optional().describe("Chance of precipitation, 0-100"),
557
+ current: import_zod2.z.boolean().optional().describe("The step the reader is at; drawn larger")
558
+ }).passthrough().describe("One forecast step");
559
+ var WeatherForecastPropsSchema = import_zod2.z.object({
560
+ component: import_zod2.z.literal("WeatherForecast"),
561
+ title: import_zod2.z.string().optional().describe("Heading above the row"),
562
+ icon: import_zod2.z.string().optional().describe("Icon shown to the left of the title"),
563
+ unit: import_zod2.z.string().optional().describe("Written after every temperature. Defaults to \xB0"),
564
+ steps: import_zod2.z.array(WeatherForecastStepSchema).min(1).describe("Steps, hourly or daily"),
565
+ style: ExtensionComponentStyleSchema.optional()
566
+ }).passthrough().describe("Weather forecast component");
567
+ var ChartKindSchema = import_zod2.z.enum(["line", "bar", "area"]).describe("How the chart draws");
568
+ var ChartSeriesSchema = import_zod2.z.object({
569
+ name: import_zod2.z.string().optional().describe("Named in the legend"),
570
+ points: import_zod2.z.array(import_zod2.z.number().nullable()).describe("One value per label. null is a gap, drawn as one")
571
+ }).passthrough().describe("One chart series");
572
+ var ChartPropsSchema = import_zod2.z.object({
573
+ component: import_zod2.z.literal("Chart"),
574
+ chart: ChartKindSchema.optional().describe("Defaults to line"),
575
+ series: import_zod2.z.array(ChartSeriesSchema).min(1).max(8).describe("At most eight series"),
576
+ labels: import_zod2.z.array(import_zod2.z.string()).optional().describe("One per point, along the horizontal axis"),
577
+ title: import_zod2.z.string().optional().describe("Heading above the plot"),
578
+ icon: import_zod2.z.string().optional().describe("Icon shown to the left of the title"),
579
+ unit: import_zod2.z.string().optional().describe("Written after every value"),
580
+ zeroBaseline: import_zod2.z.boolean().optional().describe("Force the value axis to include zero"),
581
+ height: import_zod2.z.number().min(4).max(24).optional().describe("Plot height in rem. Defaults to 9"),
582
+ style: ExtensionComponentStyleSchema.optional()
583
+ }).passthrough().describe("Chart component");
584
+ var StatTrendSchema = import_zod2.z.enum(["up", "down", "flat"]).describe("Direction of change");
585
+ var StatTilePropsSchema = import_zod2.z.object({
586
+ component: import_zod2.z.literal("StatTile"),
587
+ label: import_zod2.z.string().describe("What the number is"),
588
+ value: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]).describe("The number itself"),
589
+ unit: import_zod2.z.string().optional().describe("Written after the value in smaller type"),
590
+ caption: import_zod2.z.string().optional().describe("One quiet line under the number"),
591
+ icon: import_zod2.z.string().optional().describe("Icon name"),
592
+ trend: StatTrendSchema.optional(),
593
+ trendLabel: import_zod2.z.string().optional().describe("The change in words"),
594
+ trendIsGood: import_zod2.z.boolean().optional().describe("Whether up is the good direction. Defaults to true"),
595
+ style: ExtensionComponentStyleSchema.optional()
596
+ }).passthrough().describe("Single-number stat tile component");
597
+ var KeyValueRowSchema = import_zod2.z.object({
598
+ label: import_zod2.z.string(),
599
+ value: import_zod2.z.string(),
600
+ icon: import_zod2.z.string().optional().describe("Icon name")
601
+ }).passthrough().describe("One key/value row");
602
+ var KeyValueListPropsSchema = import_zod2.z.object({
603
+ component: import_zod2.z.literal("KeyValueList"),
604
+ rows: import_zod2.z.array(KeyValueRowSchema).min(1).describe("Facts in two aligned columns"),
605
+ style: ExtensionComponentStyleSchema.optional()
606
+ }).passthrough().describe("Key/value list component");
607
+ var TimelineVariantSchema = import_zod2.z.enum(["default", "accent", "success", "warning", "danger"]).describe("How much a timeline entry stands out");
608
+ var TimelineEntrySchema = import_zod2.z.object({
609
+ time: import_zod2.z.string().describe("When it happens, worded as it should be read"),
610
+ title: import_zod2.z.string(),
611
+ description: import_zod2.z.string().optional().describe("A line under the title"),
612
+ icon: import_zod2.z.string().optional().describe("Icon name"),
613
+ duration: import_zod2.z.string().optional().describe("How long it lasts, in words"),
614
+ badge: import_zod2.z.string().optional().describe("Trailing badge"),
615
+ current: import_zod2.z.boolean().optional().describe("The entry the reader is at"),
616
+ past: import_zod2.z.boolean().optional().describe("Already behind us; drawn recessive"),
617
+ variant: TimelineVariantSchema.optional()
618
+ }).passthrough().describe("One timeline entry");
619
+ var TimelinePropsSchema = import_zod2.z.object({
620
+ component: import_zod2.z.literal("Timeline"),
621
+ title: import_zod2.z.string().optional().describe("Heading above the rail"),
622
+ icon: import_zod2.z.string().optional().describe("Icon shown to the left of the title"),
623
+ entries: import_zod2.z.array(TimelineEntrySchema).min(1).describe("Entries, in the order they happen"),
624
+ style: ExtensionComponentStyleSchema.optional()
625
+ }).passthrough().describe("Vertical timeline component");
626
+ var NoteVariantSchema = import_zod2.z.enum(["default", "accent", "success", "warning", "danger"]).describe("How much a note stands out");
627
+ var NotePropsSchema = import_zod2.z.object({
628
+ component: import_zod2.z.literal("Note"),
629
+ title: import_zod2.z.string().optional(),
630
+ icon: import_zod2.z.string().optional().describe("Icon shown to the left of the title"),
631
+ badge: import_zod2.z.string().optional().describe("Trailing badge next to the title"),
632
+ content: import_zod2.z.string().describe("The body, as markdown"),
633
+ footer: import_zod2.z.string().optional().describe("One quiet line at the bottom"),
634
+ variant: NoteVariantSchema.optional(),
635
+ style: ExtensionComponentStyleSchema.optional()
636
+ }).passthrough().describe("Titled block of prose component");
637
+ var CalendarEventStatusSchema = import_zod2.z.enum(["confirmed", "tentative", "cancelled"]).describe("Whether an event is going ahead");
638
+ var CalendarEventPropsSchema = import_zod2.z.object({
639
+ component: import_zod2.z.literal("CalendarEvent"),
640
+ title: import_zod2.z.string(),
641
+ start: import_zod2.z.string().describe("ISO 8601 with an offset"),
642
+ end: import_zod2.z.string().optional().describe("ISO 8601 with an offset"),
643
+ allDay: import_zod2.z.boolean().optional(),
644
+ location: import_zod2.z.string().optional(),
645
+ organizer: import_zod2.z.string().optional(),
646
+ attendees: import_zod2.z.array(import_zod2.z.string()).optional(),
647
+ calendar: import_zod2.z.string().optional().describe("Which calendar it sits in; shown as a badge"),
648
+ status: CalendarEventStatusSchema.optional(),
649
+ recurrence: import_zod2.z.string().optional().describe("How it repeats, in words"),
650
+ notes: import_zod2.z.string().optional(),
651
+ style: ExtensionComponentStyleSchema.optional()
652
+ }).passthrough().describe("Single calendar event component");
489
653
 
490
654
  // src/schemas/contributions.schema.ts
491
655
  var LocalizedStringSchema = import_zod3.z.union([import_zod3.z.string(), import_zod3.z.record(import_zod3.z.string())]).describe("String or localized string map");
@@ -633,12 +797,382 @@ var ExtensionManifestSchema = import_zod4.z.object({
633
797
  permissions: import_zod4.z.array(PermissionSchema).describe("Required permissions"),
634
798
  contributes: ExtensionContributionsSchema.optional().describe("What the extension contributes")
635
799
  }).describe("Extension manifest format");
800
+
801
+ // src/schemas/card.schema.ts
802
+ var import_zod5 = require("zod");
803
+ var style = ExtensionComponentStyleSchema.optional();
804
+ var children = import_zod5.z.lazy(
805
+ () => import_zod5.z.array(ChatCardComponentSchema).max(40)
806
+ );
807
+ var VerticalStackCardSchema = import_zod5.z.object({
808
+ component: import_zod5.z.literal("VerticalStack"),
809
+ children,
810
+ style
811
+ }).strict();
812
+ var HorizontalStackCardSchema = import_zod5.z.object({
813
+ component: import_zod5.z.literal("HorizontalStack"),
814
+ children,
815
+ style
816
+ }).strict();
817
+ var GridCardSchema = import_zod5.z.object({
818
+ component: import_zod5.z.literal("Grid"),
819
+ columns: import_zod5.z.number().min(1).max(6),
820
+ children,
821
+ style
822
+ }).strict();
823
+ var FrameCardSchema = import_zod5.z.object({
824
+ component: import_zod5.z.literal("Frame"),
825
+ // Only the string form: the components form of a title is for panels that
826
+ // put controls in their header, which a card has no business doing.
827
+ title: import_zod5.z.string().optional(),
828
+ collapsible: import_zod5.z.boolean().optional(),
829
+ defaultExpanded: import_zod5.z.boolean().optional(),
830
+ variant: FrameVariantSchema.optional(),
831
+ children,
832
+ style
833
+ }).strict();
834
+ var ListCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("List"), children, style }).strict();
835
+ var DividerCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Divider"), style }).strict();
836
+ var HeaderCardSchema = import_zod5.z.object({
837
+ component: import_zod5.z.literal("Header"),
838
+ level: import_zod5.z.number().min(1).max(6),
839
+ title: import_zod5.z.string(),
840
+ description: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.array(import_zod5.z.string())]).optional(),
841
+ icon: import_zod5.z.string().optional(),
842
+ style
843
+ }).strict();
844
+ var LabelCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Label"), text: import_zod5.z.string(), style }).strict();
845
+ var ParagraphCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Paragraph"), text: import_zod5.z.string(), style }).strict();
846
+ var MarkdownCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Markdown"), content: import_zod5.z.string(), style }).strict();
847
+ var IconCardSchema = import_zod5.z.object({
848
+ component: import_zod5.z.literal("Icon"),
849
+ name: import_zod5.z.string(),
850
+ title: import_zod5.z.string().optional(),
851
+ style
852
+ }).strict();
853
+ var PillCardSchema = import_zod5.z.object({
854
+ component: import_zod5.z.literal("Pill"),
855
+ text: import_zod5.z.string(),
856
+ icon: import_zod5.z.string().optional(),
857
+ variant: PillVariantSchema.optional(),
858
+ style
859
+ }).strict();
860
+ var WeatherNowCardSchema = import_zod5.z.object({
861
+ component: import_zod5.z.literal("WeatherNow"),
862
+ place: import_zod5.z.string(),
863
+ condition: WeatherConditionSchema,
864
+ conditionLabel: import_zod5.z.string().optional(),
865
+ temperature: import_zod5.z.number(),
866
+ feelsLike: import_zod5.z.number().optional(),
867
+ unit: import_zod5.z.string().optional(),
868
+ wind: WeatherWindSchema.optional(),
869
+ night: import_zod5.z.boolean().optional(),
870
+ summary: import_zod5.z.string().optional(),
871
+ style
872
+ }).strict();
873
+ var WeatherForecastCardSchema = import_zod5.z.object({
874
+ component: import_zod5.z.literal("WeatherForecast"),
875
+ title: import_zod5.z.string().optional(),
876
+ icon: import_zod5.z.string().optional(),
877
+ unit: import_zod5.z.string().optional(),
878
+ steps: import_zod5.z.array(
879
+ import_zod5.z.object({
880
+ label: import_zod5.z.string(),
881
+ condition: WeatherConditionSchema,
882
+ conditionLabel: import_zod5.z.string().optional(),
883
+ high: import_zod5.z.number(),
884
+ low: import_zod5.z.number().optional(),
885
+ night: import_zod5.z.boolean().optional(),
886
+ precipitation: import_zod5.z.number().min(0).max(100).optional(),
887
+ current: import_zod5.z.boolean().optional()
888
+ }).strict()
889
+ ).min(1).max(24),
890
+ style
891
+ }).strict();
892
+ var ChartCardSchema = import_zod5.z.object({
893
+ component: import_zod5.z.literal("Chart"),
894
+ chart: ChartKindSchema.optional(),
895
+ series: import_zod5.z.array(
896
+ import_zod5.z.object({
897
+ name: import_zod5.z.string().optional(),
898
+ points: import_zod5.z.array(import_zod5.z.number().nullable()).min(1).max(200)
899
+ }).strict()
900
+ ).min(1).max(8),
901
+ labels: import_zod5.z.array(import_zod5.z.string()).max(200).optional(),
902
+ title: import_zod5.z.string().optional(),
903
+ icon: import_zod5.z.string().optional(),
904
+ unit: import_zod5.z.string().optional(),
905
+ zeroBaseline: import_zod5.z.boolean().optional(),
906
+ height: import_zod5.z.number().min(4).max(24).optional(),
907
+ style
908
+ }).strict();
909
+ var StatTileCardSchema = import_zod5.z.object({
910
+ component: import_zod5.z.literal("StatTile"),
911
+ label: import_zod5.z.string(),
912
+ value: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number()]),
913
+ unit: import_zod5.z.string().optional(),
914
+ caption: import_zod5.z.string().optional(),
915
+ icon: import_zod5.z.string().optional(),
916
+ trend: StatTrendSchema.optional(),
917
+ trendLabel: import_zod5.z.string().optional(),
918
+ trendIsGood: import_zod5.z.boolean().optional(),
919
+ style
920
+ }).strict();
921
+ var KeyValueListCardSchema = import_zod5.z.object({
922
+ component: import_zod5.z.literal("KeyValueList"),
923
+ rows: import_zod5.z.array(
924
+ import_zod5.z.object({ label: import_zod5.z.string(), value: import_zod5.z.string(), icon: import_zod5.z.string().optional() }).strict()
925
+ ).min(1).max(40),
926
+ style
927
+ }).strict();
928
+ var TimelineCardSchema = import_zod5.z.object({
929
+ component: import_zod5.z.literal("Timeline"),
930
+ title: import_zod5.z.string().optional(),
931
+ icon: import_zod5.z.string().optional(),
932
+ entries: import_zod5.z.array(
933
+ import_zod5.z.object({
934
+ time: import_zod5.z.string(),
935
+ title: import_zod5.z.string(),
936
+ description: import_zod5.z.string().optional(),
937
+ icon: import_zod5.z.string().optional(),
938
+ duration: import_zod5.z.string().optional(),
939
+ badge: import_zod5.z.string().optional(),
940
+ current: import_zod5.z.boolean().optional(),
941
+ past: import_zod5.z.boolean().optional(),
942
+ variant: TimelineVariantSchema.optional()
943
+ }).strict()
944
+ ).min(1).max(40),
945
+ style
946
+ }).strict();
947
+ var NoteCardSchema = import_zod5.z.object({
948
+ component: import_zod5.z.literal("Note"),
949
+ title: import_zod5.z.string().optional(),
950
+ icon: import_zod5.z.string().optional(),
951
+ badge: import_zod5.z.string().optional(),
952
+ content: import_zod5.z.string(),
953
+ footer: import_zod5.z.string().optional(),
954
+ variant: NoteVariantSchema.optional(),
955
+ style
956
+ }).strict();
957
+ var CalendarEventCardSchema = import_zod5.z.object({
958
+ component: import_zod5.z.literal("CalendarEvent"),
959
+ title: import_zod5.z.string(),
960
+ start: import_zod5.z.string(),
961
+ end: import_zod5.z.string().optional(),
962
+ allDay: import_zod5.z.boolean().optional(),
963
+ location: import_zod5.z.string().optional(),
964
+ organizer: import_zod5.z.string().optional(),
965
+ attendees: import_zod5.z.array(import_zod5.z.string()).max(40).optional(),
966
+ calendar: import_zod5.z.string().optional(),
967
+ status: CalendarEventStatusSchema.optional(),
968
+ recurrence: import_zod5.z.string().optional(),
969
+ notes: import_zod5.z.string().optional(),
970
+ style
971
+ }).strict();
972
+ var CHAT_CARD_COMPONENTS = [
973
+ "VerticalStack",
974
+ "HorizontalStack",
975
+ "Grid",
976
+ "Frame",
977
+ "List",
978
+ "Divider",
979
+ "Header",
980
+ "Label",
981
+ "Paragraph",
982
+ "Markdown",
983
+ "Icon",
984
+ "Pill",
985
+ "WeatherNow",
986
+ "WeatherForecast",
987
+ "Chart",
988
+ "StatTile",
989
+ "KeyValueList",
990
+ "Timeline",
991
+ "Note",
992
+ "CalendarEvent"
993
+ ];
994
+ var CARD_MEMBERS = [
995
+ VerticalStackCardSchema,
996
+ HorizontalStackCardSchema,
997
+ GridCardSchema,
998
+ FrameCardSchema,
999
+ ListCardSchema,
1000
+ DividerCardSchema,
1001
+ HeaderCardSchema,
1002
+ LabelCardSchema,
1003
+ ParagraphCardSchema,
1004
+ MarkdownCardSchema,
1005
+ IconCardSchema,
1006
+ PillCardSchema,
1007
+ WeatherNowCardSchema,
1008
+ WeatherForecastCardSchema,
1009
+ ChartCardSchema,
1010
+ StatTileCardSchema,
1011
+ KeyValueListCardSchema,
1012
+ TimelineCardSchema,
1013
+ NoteCardSchema,
1014
+ CalendarEventCardSchema
1015
+ ];
1016
+ var ChatCardComponentSchema = import_zod5.z.lazy(
1017
+ () => import_zod5.z.discriminatedUnion(
1018
+ "component",
1019
+ CARD_MEMBERS
1020
+ )
1021
+ );
1022
+ var ChatCardSchema = ChatCardComponentSchema;
1023
+ var MAX_CARD_DEPTH = 8;
1024
+ function findScopeReference(value, path) {
1025
+ if (typeof value === "string") {
1026
+ return value.startsWith("$") ? path : null;
1027
+ }
1028
+ if (Array.isArray(value)) {
1029
+ for (let i = 0; i < value.length; i++) {
1030
+ const found = findScopeReference(value[i], `${path}[${i}]`);
1031
+ if (found) return found;
1032
+ }
1033
+ return null;
1034
+ }
1035
+ if (value && typeof value === "object") {
1036
+ for (const [key, child] of Object.entries(value)) {
1037
+ const found = findScopeReference(child, path ? `${path}.${key}` : key);
1038
+ if (found) return found;
1039
+ }
1040
+ }
1041
+ return null;
1042
+ }
1043
+ function cardDepth(value) {
1044
+ if (!value || typeof value !== "object") return 0;
1045
+ const kids = value.children;
1046
+ if (!Array.isArray(kids) || kids.length === 0) return 1;
1047
+ let deepest = 0;
1048
+ for (const child of kids) {
1049
+ const depth = cardDepth(child);
1050
+ if (depth > deepest) deepest = depth;
1051
+ }
1052
+ return deepest + 1;
1053
+ }
1054
+ function findMisalignedChart(value) {
1055
+ if (!value || typeof value !== "object") return null;
1056
+ if (Array.isArray(value)) {
1057
+ for (const item of value) {
1058
+ const found = findMisalignedChart(item);
1059
+ if (found) return found;
1060
+ }
1061
+ return null;
1062
+ }
1063
+ const node = value;
1064
+ if (node.component === "Chart" && Array.isArray(node.labels) && Array.isArray(node.series)) {
1065
+ const expected = node.labels.length;
1066
+ for (let i = 0; i < node.series.length; i++) {
1067
+ const points = node.series[i]?.points;
1068
+ if (Array.isArray(points) && points.length !== expected) {
1069
+ return `Chart series ${i} has ${points.length} points but there are ${expected} labels. Points line up with labels by position \u2014 use null for a reading you do not have.`;
1070
+ }
1071
+ }
1072
+ }
1073
+ for (const child of Object.values(node)) {
1074
+ const found = findMisalignedChart(child);
1075
+ if (found) return found;
1076
+ }
1077
+ return null;
1078
+ }
1079
+ var CARD_GAP_REM = 0.75;
1080
+ function applyCardSpacing(card) {
1081
+ if (card.component === "VerticalStack" || card.component === "HorizontalStack" || card.component === "Grid") {
1082
+ card["gap"] = CARD_GAP_REM;
1083
+ }
1084
+ if (Array.isArray(card["children"])) {
1085
+ for (const child of card["children"]) applyCardSpacing(child);
1086
+ }
1087
+ return card;
1088
+ }
1089
+ function validateChatCard(card) {
1090
+ const parsed = ChatCardSchema.safeParse(card);
1091
+ if (!parsed.success) {
1092
+ const issue = parsed.error.issues[0];
1093
+ const where = issue?.path.length ? ` at ${issue.path.join(".")}` : "";
1094
+ return { ok: false, error: `${issue?.message ?? "Invalid card"}${where}` };
1095
+ }
1096
+ const depth = cardDepth(parsed.data);
1097
+ if (depth > MAX_CARD_DEPTH) {
1098
+ return {
1099
+ ok: false,
1100
+ error: `Card nests ${depth} levels deep; at most ${MAX_CARD_DEPTH} are allowed. Flatten it.`
1101
+ };
1102
+ }
1103
+ const misaligned = findMisalignedChart(parsed.data);
1104
+ if (misaligned) {
1105
+ return { ok: false, error: misaligned };
1106
+ }
1107
+ const reference = findScopeReference(parsed.data, "");
1108
+ if (reference) {
1109
+ return {
1110
+ ok: false,
1111
+ error: `The value at ${reference} starts with "$", which the component system reads as a reference to data that a card does not have, so it would render as nothing. Write the value without the leading "$".`
1112
+ };
1113
+ }
1114
+ return { ok: true, card: applyCardSpacing(parsed.data) };
1115
+ }
1116
+ function describeType(schema) {
1117
+ const def = schema._def;
1118
+ switch (def.typeName) {
1119
+ case "ZodOptional":
1120
+ case "ZodNullable":
1121
+ case "ZodDefault":
1122
+ return describeType(schema.unwrap());
1123
+ case "ZodLazy":
1124
+ return "component[]";
1125
+ case "ZodArray": {
1126
+ const inner = describeType(def.type);
1127
+ return `${inner}[]`;
1128
+ }
1129
+ case "ZodObject": {
1130
+ const shape = schema.shape;
1131
+ const fields = Object.entries(shape).map(
1132
+ ([key, value]) => `${key}${value.isOptional() ? "?" : ""}`
1133
+ );
1134
+ return `{${fields.join(", ")}}`;
1135
+ }
1136
+ case "ZodEnum":
1137
+ return (def.values ?? []).join("|");
1138
+ case "ZodUnion":
1139
+ return (def.options ?? []).map(describeType).join("|");
1140
+ case "ZodLiteral":
1141
+ return String(def.value);
1142
+ case "ZodString":
1143
+ return "string";
1144
+ case "ZodNumber":
1145
+ return "number";
1146
+ case "ZodBoolean":
1147
+ return "boolean";
1148
+ case "ZodRecord":
1149
+ return "object";
1150
+ default:
1151
+ return "value";
1152
+ }
1153
+ }
1154
+ function describeChatCardProfile() {
1155
+ return CARD_MEMBERS.map((member) => {
1156
+ const shape = member.shape;
1157
+ const name = shape["component"]._def.value;
1158
+ const fields = Object.entries(shape).filter(([key]) => key !== "component" && key !== "style").map(([key, value]) => `${key}${value.isOptional() ? "?" : ""}: ${describeType(value)}`);
1159
+ return fields.length ? `${name} \u2014 ${fields.join("; ")}` : name;
1160
+ }).join("\n");
1161
+ }
636
1162
  // Annotate the CommonJS export names for ESM import in node:
637
1163
  0 && (module.exports = {
638
1164
  AllowedCSSPropertySchema,
639
1165
  AuthorSchema,
640
1166
  ButtonPropsSchema,
1167
+ CHAT_CARD_COMPONENTS,
1168
+ CalendarEventPropsSchema,
1169
+ CalendarEventStatusSchema,
641
1170
  CapabilityPermissionSchema,
1171
+ ChartKindSchema,
1172
+ ChartPropsSchema,
1173
+ ChartSeriesSchema,
1174
+ ChatCardComponentSchema,
1175
+ ChatCardSchema,
642
1176
  CheckboxPropsSchema,
643
1177
  CollapsiblePropsSchema,
644
1178
  CommandDefinitionSchema,
@@ -664,12 +1198,16 @@ var ExtensionManifestSchema = import_zod4.z.object({
664
1198
  IconButtonTypeSchema,
665
1199
  IconPickerPropsSchema,
666
1200
  IconPropsSchema,
1201
+ KeyValueListPropsSchema,
1202
+ KeyValueRowSchema,
667
1203
  LabelPropsSchema,
668
1204
  ListPropsSchema,
669
1205
  LocalizedStringSchema,
670
1206
  MarkdownPropsSchema,
671
1207
  ModalPropsSchema,
672
1208
  NetworkPermissionSchema,
1209
+ NotePropsSchema,
1210
+ NoteVariantSchema,
673
1211
  PERMISSION_PATTERNS,
674
1212
  PanelActionDataSourceSchema,
675
1213
  PanelActionSchema,
@@ -688,10 +1226,15 @@ var ExtensionManifestSchema = import_zod4.z.object({
688
1226
  ProviderConfigViewSchema,
689
1227
  ProviderDefinitionSchema,
690
1228
  SelectPropsSchema,
1229
+ StatTilePropsSchema,
1230
+ StatTrendSchema,
691
1231
  StoragePermissionSchema,
692
1232
  SystemPermissionSchema,
693
1233
  TextInputPropsSchema,
694
1234
  TextPreviewPropsSchema,
1235
+ TimelineEntrySchema,
1236
+ TimelinePropsSchema,
1237
+ TimelineVariantSchema,
695
1238
  TogglePropsSchema,
696
1239
  ToolDefinitionSchema,
697
1240
  ToolSettingsActionDataSourceSchema,
@@ -704,6 +1247,13 @@ var ExtensionManifestSchema = import_zod4.z.object({
704
1247
  UserDataPermissionSchema,
705
1248
  VALID_PERMISSIONS,
706
1249
  VerticalStackPropsSchema,
707
- isValidPermission
1250
+ WeatherConditionSchema,
1251
+ WeatherForecastPropsSchema,
1252
+ WeatherForecastStepSchema,
1253
+ WeatherNowPropsSchema,
1254
+ WeatherWindSchema,
1255
+ describeChatCardProfile,
1256
+ isValidPermission,
1257
+ validateChatCard
708
1258
  });
709
1259
  //# sourceMappingURL=index.cjs.map