@stina/extension-api 0.51.0 → 0.53.1
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.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/runtime.cjs +2 -2
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +2 -2
- package/dist/runtime.js.map +1 -1
- package/dist/schemas/index.cjs +545 -2
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +735 -35
- package/dist/schemas/index.d.ts +735 -35
- package/dist/schemas/index.js +520 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/{types.tools-XpXCoPrJ.d.cts → types.tools-BL9WPsi_.d.cts} +314 -2
- package/dist/{types.tools-XpXCoPrJ.d.ts → types.tools-BL9WPsi_.d.ts} +314 -2
- package/package.json +1 -1
- package/src/index.ts +20 -0
- package/src/runtime.ts +2 -2
- package/src/schemas/card.schema.test.ts +235 -0
- package/src/schemas/card.schema.ts +606 -0
- package/src/schemas/components.schema.ts +241 -0
- package/src/schemas/index.ts +30 -0
- package/src/types.components.ts +336 -0
- package/src/types.context.ts +15 -1
- package/src/types.tools.ts +15 -0
package/dist/schemas/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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,375 @@ 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
|
+
gap: import_zod5.z.number().min(0).max(8).optional(),
|
|
810
|
+
children,
|
|
811
|
+
style
|
|
812
|
+
}).strict();
|
|
813
|
+
var HorizontalStackCardSchema = import_zod5.z.object({
|
|
814
|
+
component: import_zod5.z.literal("HorizontalStack"),
|
|
815
|
+
gap: import_zod5.z.number().min(0).max(8).optional(),
|
|
816
|
+
children,
|
|
817
|
+
style
|
|
818
|
+
}).strict();
|
|
819
|
+
var GridCardSchema = import_zod5.z.object({
|
|
820
|
+
component: import_zod5.z.literal("Grid"),
|
|
821
|
+
columns: import_zod5.z.number().min(1).max(6),
|
|
822
|
+
gap: import_zod5.z.number().min(0).max(8).optional(),
|
|
823
|
+
children,
|
|
824
|
+
style
|
|
825
|
+
}).strict();
|
|
826
|
+
var FrameCardSchema = import_zod5.z.object({
|
|
827
|
+
component: import_zod5.z.literal("Frame"),
|
|
828
|
+
// Only the string form: the components form of a title is for panels that
|
|
829
|
+
// put controls in their header, which a card has no business doing.
|
|
830
|
+
title: import_zod5.z.string().optional(),
|
|
831
|
+
collapsible: import_zod5.z.boolean().optional(),
|
|
832
|
+
defaultExpanded: import_zod5.z.boolean().optional(),
|
|
833
|
+
variant: FrameVariantSchema.optional(),
|
|
834
|
+
children,
|
|
835
|
+
style
|
|
836
|
+
}).strict();
|
|
837
|
+
var ListCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("List"), children, style }).strict();
|
|
838
|
+
var DividerCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Divider"), style }).strict();
|
|
839
|
+
var HeaderCardSchema = import_zod5.z.object({
|
|
840
|
+
component: import_zod5.z.literal("Header"),
|
|
841
|
+
level: import_zod5.z.number().min(1).max(6),
|
|
842
|
+
title: import_zod5.z.string(),
|
|
843
|
+
description: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.array(import_zod5.z.string())]).optional(),
|
|
844
|
+
icon: import_zod5.z.string().optional(),
|
|
845
|
+
style
|
|
846
|
+
}).strict();
|
|
847
|
+
var LabelCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Label"), text: import_zod5.z.string(), style }).strict();
|
|
848
|
+
var ParagraphCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Paragraph"), text: import_zod5.z.string(), style }).strict();
|
|
849
|
+
var MarkdownCardSchema = import_zod5.z.object({ component: import_zod5.z.literal("Markdown"), content: import_zod5.z.string(), style }).strict();
|
|
850
|
+
var IconCardSchema = import_zod5.z.object({
|
|
851
|
+
component: import_zod5.z.literal("Icon"),
|
|
852
|
+
name: import_zod5.z.string(),
|
|
853
|
+
title: import_zod5.z.string().optional(),
|
|
854
|
+
style
|
|
855
|
+
}).strict();
|
|
856
|
+
var PillCardSchema = import_zod5.z.object({
|
|
857
|
+
component: import_zod5.z.literal("Pill"),
|
|
858
|
+
text: import_zod5.z.string(),
|
|
859
|
+
icon: import_zod5.z.string().optional(),
|
|
860
|
+
variant: PillVariantSchema.optional(),
|
|
861
|
+
style
|
|
862
|
+
}).strict();
|
|
863
|
+
var WeatherNowCardSchema = import_zod5.z.object({
|
|
864
|
+
component: import_zod5.z.literal("WeatherNow"),
|
|
865
|
+
place: import_zod5.z.string(),
|
|
866
|
+
condition: WeatherConditionSchema,
|
|
867
|
+
conditionLabel: import_zod5.z.string().optional(),
|
|
868
|
+
temperature: import_zod5.z.number(),
|
|
869
|
+
feelsLike: import_zod5.z.number().optional(),
|
|
870
|
+
unit: import_zod5.z.string().optional(),
|
|
871
|
+
wind: WeatherWindSchema.optional(),
|
|
872
|
+
night: import_zod5.z.boolean().optional(),
|
|
873
|
+
summary: import_zod5.z.string().optional(),
|
|
874
|
+
style
|
|
875
|
+
}).strict();
|
|
876
|
+
var WeatherForecastCardSchema = import_zod5.z.object({
|
|
877
|
+
component: import_zod5.z.literal("WeatherForecast"),
|
|
878
|
+
title: import_zod5.z.string().optional(),
|
|
879
|
+
icon: import_zod5.z.string().optional(),
|
|
880
|
+
unit: import_zod5.z.string().optional(),
|
|
881
|
+
steps: import_zod5.z.array(
|
|
882
|
+
import_zod5.z.object({
|
|
883
|
+
label: import_zod5.z.string(),
|
|
884
|
+
condition: WeatherConditionSchema,
|
|
885
|
+
conditionLabel: import_zod5.z.string().optional(),
|
|
886
|
+
high: import_zod5.z.number(),
|
|
887
|
+
low: import_zod5.z.number().optional(),
|
|
888
|
+
night: import_zod5.z.boolean().optional(),
|
|
889
|
+
precipitation: import_zod5.z.number().min(0).max(100).optional(),
|
|
890
|
+
current: import_zod5.z.boolean().optional()
|
|
891
|
+
}).strict()
|
|
892
|
+
).min(1).max(24),
|
|
893
|
+
style
|
|
894
|
+
}).strict();
|
|
895
|
+
var ChartCardSchema = import_zod5.z.object({
|
|
896
|
+
component: import_zod5.z.literal("Chart"),
|
|
897
|
+
chart: ChartKindSchema.optional(),
|
|
898
|
+
series: import_zod5.z.array(
|
|
899
|
+
import_zod5.z.object({
|
|
900
|
+
name: import_zod5.z.string().optional(),
|
|
901
|
+
points: import_zod5.z.array(import_zod5.z.number().nullable()).min(1).max(200)
|
|
902
|
+
}).strict()
|
|
903
|
+
).min(1).max(8),
|
|
904
|
+
labels: import_zod5.z.array(import_zod5.z.string()).max(200).optional(),
|
|
905
|
+
title: import_zod5.z.string().optional(),
|
|
906
|
+
icon: import_zod5.z.string().optional(),
|
|
907
|
+
unit: import_zod5.z.string().optional(),
|
|
908
|
+
zeroBaseline: import_zod5.z.boolean().optional(),
|
|
909
|
+
height: import_zod5.z.number().min(4).max(24).optional(),
|
|
910
|
+
style
|
|
911
|
+
}).strict();
|
|
912
|
+
var StatTileCardSchema = import_zod5.z.object({
|
|
913
|
+
component: import_zod5.z.literal("StatTile"),
|
|
914
|
+
label: import_zod5.z.string(),
|
|
915
|
+
value: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number()]),
|
|
916
|
+
unit: import_zod5.z.string().optional(),
|
|
917
|
+
caption: import_zod5.z.string().optional(),
|
|
918
|
+
icon: import_zod5.z.string().optional(),
|
|
919
|
+
trend: StatTrendSchema.optional(),
|
|
920
|
+
trendLabel: import_zod5.z.string().optional(),
|
|
921
|
+
trendIsGood: import_zod5.z.boolean().optional(),
|
|
922
|
+
style
|
|
923
|
+
}).strict();
|
|
924
|
+
var KeyValueListCardSchema = import_zod5.z.object({
|
|
925
|
+
component: import_zod5.z.literal("KeyValueList"),
|
|
926
|
+
rows: import_zod5.z.array(
|
|
927
|
+
import_zod5.z.object({ label: import_zod5.z.string(), value: import_zod5.z.string(), icon: import_zod5.z.string().optional() }).strict()
|
|
928
|
+
).min(1).max(40),
|
|
929
|
+
style
|
|
930
|
+
}).strict();
|
|
931
|
+
var TimelineCardSchema = import_zod5.z.object({
|
|
932
|
+
component: import_zod5.z.literal("Timeline"),
|
|
933
|
+
title: import_zod5.z.string().optional(),
|
|
934
|
+
icon: import_zod5.z.string().optional(),
|
|
935
|
+
entries: import_zod5.z.array(
|
|
936
|
+
import_zod5.z.object({
|
|
937
|
+
time: import_zod5.z.string(),
|
|
938
|
+
title: import_zod5.z.string(),
|
|
939
|
+
description: import_zod5.z.string().optional(),
|
|
940
|
+
icon: import_zod5.z.string().optional(),
|
|
941
|
+
duration: import_zod5.z.string().optional(),
|
|
942
|
+
badge: import_zod5.z.string().optional(),
|
|
943
|
+
current: import_zod5.z.boolean().optional(),
|
|
944
|
+
past: import_zod5.z.boolean().optional(),
|
|
945
|
+
variant: TimelineVariantSchema.optional()
|
|
946
|
+
}).strict()
|
|
947
|
+
).min(1).max(40),
|
|
948
|
+
style
|
|
949
|
+
}).strict();
|
|
950
|
+
var NoteCardSchema = import_zod5.z.object({
|
|
951
|
+
component: import_zod5.z.literal("Note"),
|
|
952
|
+
title: import_zod5.z.string().optional(),
|
|
953
|
+
icon: import_zod5.z.string().optional(),
|
|
954
|
+
badge: import_zod5.z.string().optional(),
|
|
955
|
+
content: import_zod5.z.string(),
|
|
956
|
+
footer: import_zod5.z.string().optional(),
|
|
957
|
+
variant: NoteVariantSchema.optional(),
|
|
958
|
+
style
|
|
959
|
+
}).strict();
|
|
960
|
+
var CalendarEventCardSchema = import_zod5.z.object({
|
|
961
|
+
component: import_zod5.z.literal("CalendarEvent"),
|
|
962
|
+
title: import_zod5.z.string(),
|
|
963
|
+
start: import_zod5.z.string(),
|
|
964
|
+
end: import_zod5.z.string().optional(),
|
|
965
|
+
allDay: import_zod5.z.boolean().optional(),
|
|
966
|
+
location: import_zod5.z.string().optional(),
|
|
967
|
+
organizer: import_zod5.z.string().optional(),
|
|
968
|
+
attendees: import_zod5.z.array(import_zod5.z.string()).max(40).optional(),
|
|
969
|
+
calendar: import_zod5.z.string().optional(),
|
|
970
|
+
status: CalendarEventStatusSchema.optional(),
|
|
971
|
+
recurrence: import_zod5.z.string().optional(),
|
|
972
|
+
notes: import_zod5.z.string().optional(),
|
|
973
|
+
style
|
|
974
|
+
}).strict();
|
|
975
|
+
var CHAT_CARD_COMPONENTS = [
|
|
976
|
+
"VerticalStack",
|
|
977
|
+
"HorizontalStack",
|
|
978
|
+
"Grid",
|
|
979
|
+
"Frame",
|
|
980
|
+
"List",
|
|
981
|
+
"Divider",
|
|
982
|
+
"Header",
|
|
983
|
+
"Label",
|
|
984
|
+
"Paragraph",
|
|
985
|
+
"Markdown",
|
|
986
|
+
"Icon",
|
|
987
|
+
"Pill",
|
|
988
|
+
"WeatherNow",
|
|
989
|
+
"WeatherForecast",
|
|
990
|
+
"Chart",
|
|
991
|
+
"StatTile",
|
|
992
|
+
"KeyValueList",
|
|
993
|
+
"Timeline",
|
|
994
|
+
"Note",
|
|
995
|
+
"CalendarEvent"
|
|
996
|
+
];
|
|
997
|
+
var CARD_MEMBERS = [
|
|
998
|
+
VerticalStackCardSchema,
|
|
999
|
+
HorizontalStackCardSchema,
|
|
1000
|
+
GridCardSchema,
|
|
1001
|
+
FrameCardSchema,
|
|
1002
|
+
ListCardSchema,
|
|
1003
|
+
DividerCardSchema,
|
|
1004
|
+
HeaderCardSchema,
|
|
1005
|
+
LabelCardSchema,
|
|
1006
|
+
ParagraphCardSchema,
|
|
1007
|
+
MarkdownCardSchema,
|
|
1008
|
+
IconCardSchema,
|
|
1009
|
+
PillCardSchema,
|
|
1010
|
+
WeatherNowCardSchema,
|
|
1011
|
+
WeatherForecastCardSchema,
|
|
1012
|
+
ChartCardSchema,
|
|
1013
|
+
StatTileCardSchema,
|
|
1014
|
+
KeyValueListCardSchema,
|
|
1015
|
+
TimelineCardSchema,
|
|
1016
|
+
NoteCardSchema,
|
|
1017
|
+
CalendarEventCardSchema
|
|
1018
|
+
];
|
|
1019
|
+
var ChatCardComponentSchema = import_zod5.z.lazy(
|
|
1020
|
+
() => import_zod5.z.discriminatedUnion(
|
|
1021
|
+
"component",
|
|
1022
|
+
CARD_MEMBERS
|
|
1023
|
+
)
|
|
1024
|
+
);
|
|
1025
|
+
var ChatCardSchema = ChatCardComponentSchema;
|
|
1026
|
+
var MAX_CARD_DEPTH = 8;
|
|
1027
|
+
function findScopeReference(value, path) {
|
|
1028
|
+
if (typeof value === "string") {
|
|
1029
|
+
return value.startsWith("$") ? path : null;
|
|
1030
|
+
}
|
|
1031
|
+
if (Array.isArray(value)) {
|
|
1032
|
+
for (let i = 0; i < value.length; i++) {
|
|
1033
|
+
const found = findScopeReference(value[i], `${path}[${i}]`);
|
|
1034
|
+
if (found) return found;
|
|
1035
|
+
}
|
|
1036
|
+
return null;
|
|
1037
|
+
}
|
|
1038
|
+
if (value && typeof value === "object") {
|
|
1039
|
+
for (const [key, child] of Object.entries(value)) {
|
|
1040
|
+
const found = findScopeReference(child, path ? `${path}.${key}` : key);
|
|
1041
|
+
if (found) return found;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return null;
|
|
1045
|
+
}
|
|
1046
|
+
function cardDepth(value) {
|
|
1047
|
+
if (!value || typeof value !== "object") return 0;
|
|
1048
|
+
const kids = value.children;
|
|
1049
|
+
if (!Array.isArray(kids) || kids.length === 0) return 1;
|
|
1050
|
+
let deepest = 0;
|
|
1051
|
+
for (const child of kids) {
|
|
1052
|
+
const depth = cardDepth(child);
|
|
1053
|
+
if (depth > deepest) deepest = depth;
|
|
1054
|
+
}
|
|
1055
|
+
return deepest + 1;
|
|
1056
|
+
}
|
|
1057
|
+
function findMisalignedChart(value) {
|
|
1058
|
+
if (!value || typeof value !== "object") return null;
|
|
1059
|
+
if (Array.isArray(value)) {
|
|
1060
|
+
for (const item of value) {
|
|
1061
|
+
const found = findMisalignedChart(item);
|
|
1062
|
+
if (found) return found;
|
|
1063
|
+
}
|
|
1064
|
+
return null;
|
|
1065
|
+
}
|
|
1066
|
+
const node = value;
|
|
1067
|
+
if (node.component === "Chart" && Array.isArray(node.labels) && Array.isArray(node.series)) {
|
|
1068
|
+
const expected = node.labels.length;
|
|
1069
|
+
for (let i = 0; i < node.series.length; i++) {
|
|
1070
|
+
const points = node.series[i]?.points;
|
|
1071
|
+
if (Array.isArray(points) && points.length !== expected) {
|
|
1072
|
+
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.`;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
for (const child of Object.values(node)) {
|
|
1077
|
+
const found = findMisalignedChart(child);
|
|
1078
|
+
if (found) return found;
|
|
1079
|
+
}
|
|
1080
|
+
return null;
|
|
1081
|
+
}
|
|
1082
|
+
function validateChatCard(card) {
|
|
1083
|
+
const parsed = ChatCardSchema.safeParse(card);
|
|
1084
|
+
if (!parsed.success) {
|
|
1085
|
+
const issue = parsed.error.issues[0];
|
|
1086
|
+
const where = issue?.path.length ? ` at ${issue.path.join(".")}` : "";
|
|
1087
|
+
return { ok: false, error: `${issue?.message ?? "Invalid card"}${where}` };
|
|
1088
|
+
}
|
|
1089
|
+
const depth = cardDepth(parsed.data);
|
|
1090
|
+
if (depth > MAX_CARD_DEPTH) {
|
|
1091
|
+
return {
|
|
1092
|
+
ok: false,
|
|
1093
|
+
error: `Card nests ${depth} levels deep; at most ${MAX_CARD_DEPTH} are allowed. Flatten it.`
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
const misaligned = findMisalignedChart(parsed.data);
|
|
1097
|
+
if (misaligned) {
|
|
1098
|
+
return { ok: false, error: misaligned };
|
|
1099
|
+
}
|
|
1100
|
+
const reference = findScopeReference(parsed.data, "");
|
|
1101
|
+
if (reference) {
|
|
1102
|
+
return {
|
|
1103
|
+
ok: false,
|
|
1104
|
+
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 "$".`
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
return { ok: true, card: parsed.data };
|
|
1108
|
+
}
|
|
1109
|
+
function describeType(schema) {
|
|
1110
|
+
const def = schema._def;
|
|
1111
|
+
switch (def.typeName) {
|
|
1112
|
+
case "ZodOptional":
|
|
1113
|
+
case "ZodNullable":
|
|
1114
|
+
case "ZodDefault":
|
|
1115
|
+
return describeType(schema.unwrap());
|
|
1116
|
+
case "ZodLazy":
|
|
1117
|
+
return "component[]";
|
|
1118
|
+
case "ZodArray": {
|
|
1119
|
+
const inner = describeType(def.type);
|
|
1120
|
+
return `${inner}[]`;
|
|
1121
|
+
}
|
|
1122
|
+
case "ZodObject": {
|
|
1123
|
+
const shape = schema.shape;
|
|
1124
|
+
const fields = Object.entries(shape).map(
|
|
1125
|
+
([key, value]) => `${key}${value.isOptional() ? "?" : ""}`
|
|
1126
|
+
);
|
|
1127
|
+
return `{${fields.join(", ")}}`;
|
|
1128
|
+
}
|
|
1129
|
+
case "ZodEnum":
|
|
1130
|
+
return (def.values ?? []).join("|");
|
|
1131
|
+
case "ZodUnion":
|
|
1132
|
+
return (def.options ?? []).map(describeType).join("|");
|
|
1133
|
+
case "ZodLiteral":
|
|
1134
|
+
return String(def.value);
|
|
1135
|
+
case "ZodString":
|
|
1136
|
+
return "string";
|
|
1137
|
+
case "ZodNumber":
|
|
1138
|
+
return "number";
|
|
1139
|
+
case "ZodBoolean":
|
|
1140
|
+
return "boolean";
|
|
1141
|
+
case "ZodRecord":
|
|
1142
|
+
return "object";
|
|
1143
|
+
default:
|
|
1144
|
+
return "value";
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
function describeChatCardProfile() {
|
|
1148
|
+
return CARD_MEMBERS.map((member) => {
|
|
1149
|
+
const shape = member.shape;
|
|
1150
|
+
const name = shape["component"]._def.value;
|
|
1151
|
+
const fields = Object.entries(shape).filter(([key]) => key !== "component" && key !== "style").map(([key, value]) => `${key}${value.isOptional() ? "?" : ""}: ${describeType(value)}`);
|
|
1152
|
+
return fields.length ? `${name} \u2014 ${fields.join("; ")}` : name;
|
|
1153
|
+
}).join("\n");
|
|
1154
|
+
}
|
|
636
1155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
637
1156
|
0 && (module.exports = {
|
|
638
1157
|
AllowedCSSPropertySchema,
|
|
639
1158
|
AuthorSchema,
|
|
640
1159
|
ButtonPropsSchema,
|
|
1160
|
+
CHAT_CARD_COMPONENTS,
|
|
1161
|
+
CalendarEventPropsSchema,
|
|
1162
|
+
CalendarEventStatusSchema,
|
|
641
1163
|
CapabilityPermissionSchema,
|
|
1164
|
+
ChartKindSchema,
|
|
1165
|
+
ChartPropsSchema,
|
|
1166
|
+
ChartSeriesSchema,
|
|
1167
|
+
ChatCardComponentSchema,
|
|
1168
|
+
ChatCardSchema,
|
|
642
1169
|
CheckboxPropsSchema,
|
|
643
1170
|
CollapsiblePropsSchema,
|
|
644
1171
|
CommandDefinitionSchema,
|
|
@@ -664,12 +1191,16 @@ var ExtensionManifestSchema = import_zod4.z.object({
|
|
|
664
1191
|
IconButtonTypeSchema,
|
|
665
1192
|
IconPickerPropsSchema,
|
|
666
1193
|
IconPropsSchema,
|
|
1194
|
+
KeyValueListPropsSchema,
|
|
1195
|
+
KeyValueRowSchema,
|
|
667
1196
|
LabelPropsSchema,
|
|
668
1197
|
ListPropsSchema,
|
|
669
1198
|
LocalizedStringSchema,
|
|
670
1199
|
MarkdownPropsSchema,
|
|
671
1200
|
ModalPropsSchema,
|
|
672
1201
|
NetworkPermissionSchema,
|
|
1202
|
+
NotePropsSchema,
|
|
1203
|
+
NoteVariantSchema,
|
|
673
1204
|
PERMISSION_PATTERNS,
|
|
674
1205
|
PanelActionDataSourceSchema,
|
|
675
1206
|
PanelActionSchema,
|
|
@@ -688,10 +1219,15 @@ var ExtensionManifestSchema = import_zod4.z.object({
|
|
|
688
1219
|
ProviderConfigViewSchema,
|
|
689
1220
|
ProviderDefinitionSchema,
|
|
690
1221
|
SelectPropsSchema,
|
|
1222
|
+
StatTilePropsSchema,
|
|
1223
|
+
StatTrendSchema,
|
|
691
1224
|
StoragePermissionSchema,
|
|
692
1225
|
SystemPermissionSchema,
|
|
693
1226
|
TextInputPropsSchema,
|
|
694
1227
|
TextPreviewPropsSchema,
|
|
1228
|
+
TimelineEntrySchema,
|
|
1229
|
+
TimelinePropsSchema,
|
|
1230
|
+
TimelineVariantSchema,
|
|
695
1231
|
TogglePropsSchema,
|
|
696
1232
|
ToolDefinitionSchema,
|
|
697
1233
|
ToolSettingsActionDataSourceSchema,
|
|
@@ -704,6 +1240,13 @@ var ExtensionManifestSchema = import_zod4.z.object({
|
|
|
704
1240
|
UserDataPermissionSchema,
|
|
705
1241
|
VALID_PERMISSIONS,
|
|
706
1242
|
VerticalStackPropsSchema,
|
|
707
|
-
|
|
1243
|
+
WeatherConditionSchema,
|
|
1244
|
+
WeatherForecastPropsSchema,
|
|
1245
|
+
WeatherForecastStepSchema,
|
|
1246
|
+
WeatherNowPropsSchema,
|
|
1247
|
+
WeatherWindSchema,
|
|
1248
|
+
describeChatCardProfile,
|
|
1249
|
+
isValidPermission,
|
|
1250
|
+
validateChatCard
|
|
708
1251
|
});
|
|
709
1252
|
//# sourceMappingURL=index.cjs.map
|