@stina/extension-api 0.58.0 → 1.3.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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/runtime.cjs +10 -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 +10 -2
- package/dist/runtime.js.map +1 -1
- package/dist/schemas/index.cjs +67 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +469 -6
- package/dist/schemas/index.d.ts +469 -6
- package/dist/schemas/index.js +61 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/{types.tools-DtYAgtto.d.cts → types.tools-C0GqXQlu.d.cts} +117 -1
- package/dist/{types.tools-DtYAgtto.d.ts → types.tools-C0GqXQlu.d.ts} +117 -1
- package/package.json +1 -1
- package/schema/extension-manifest.schema.json +58 -0
- package/src/index.ts +6 -0
- package/src/runtime.ts +29 -3
- package/src/schemas/card.schema.ts +43 -0
- package/src/schemas/components.schema.ts +38 -0
- package/src/schemas/contributions.schema.ts +26 -0
- package/src/schemas/index.ts +9 -0
- package/src/schemas/permissions.schema.ts +2 -0
- package/src/types.components.ts +60 -0
- package/src/types.contributions.ts +35 -0
- package/src/types.permissions.ts +1 -0
- package/src/types.tools.ts +28 -0
- package/src/types.ts +2 -1
|
@@ -171,6 +171,18 @@ interface LabelProps extends ExtensionComponentData {
|
|
|
171
171
|
component: 'Label';
|
|
172
172
|
text: string;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The extension API properties for the Clock component.
|
|
176
|
+
*
|
|
177
|
+
* The odd one out among the display components: it takes no facts, because the
|
|
178
|
+
* fact it shows is what time it is, and that is not something an action can
|
|
179
|
+
* hand over once. It reads the clock and the timezone from the host and keeps
|
|
180
|
+
* itself current, so a card carrying one stays right while the window is left
|
|
181
|
+
* open.
|
|
182
|
+
*/
|
|
183
|
+
interface ClockProps extends ExtensionComponentData {
|
|
184
|
+
component: 'Clock';
|
|
185
|
+
}
|
|
174
186
|
/** The extension API properties for the paragraph component. */
|
|
175
187
|
interface ParagraphProps extends ExtensionComponentData {
|
|
176
188
|
component: 'Paragraph';
|
|
@@ -581,6 +593,50 @@ interface StatTileProps extends ExtensionComponentData {
|
|
|
581
593
|
*/
|
|
582
594
|
trendIsGood?: boolean;
|
|
583
595
|
}
|
|
596
|
+
/** Whether a progress reading is drawn as a rail or as a ring. */
|
|
597
|
+
type ProgressShape = 'bar' | 'circle';
|
|
598
|
+
/**
|
|
599
|
+
* The colours a progress reading may take.
|
|
600
|
+
*
|
|
601
|
+
* A closed list rather than a colour string: the caller is usually a language
|
|
602
|
+
* model, and the six names here are the six the themes actually define, so a
|
|
603
|
+
* reading cannot end up in a hue the current theme has no contrast for.
|
|
604
|
+
*/
|
|
605
|
+
type ProgressColor = 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
606
|
+
/**
|
|
607
|
+
* The extension API properties for the ProgressBar component.
|
|
608
|
+
*
|
|
609
|
+
* One value seen against the range it lives in — how far along something is,
|
|
610
|
+
* how loaded a day looks, how high a level sits. A StatTile says what the
|
|
611
|
+
* number *is*; this says where it *sits*, which is the thing a number alone
|
|
612
|
+
* cannot show.
|
|
613
|
+
*
|
|
614
|
+
* `min` and `max` are the range, not decoration: a value is drawn as its
|
|
615
|
+
* position between them, so "3 of 5" and "60 of 100" fill the same amount.
|
|
616
|
+
* Values outside the range are clamped rather than refused — a reading that
|
|
617
|
+
* ran past its ceiling should still draw as full.
|
|
618
|
+
*/
|
|
619
|
+
interface ProgressBarProps extends ExtensionComponentData {
|
|
620
|
+
component: 'ProgressBar';
|
|
621
|
+
/** What is being measured, e.g. "Stressnivå". Shown beside the reading. */
|
|
622
|
+
label: string;
|
|
623
|
+
value: number;
|
|
624
|
+
/** Bottom of the range. Defaults to 0. */
|
|
625
|
+
min?: number;
|
|
626
|
+
/** Top of the range. Defaults to 100. */
|
|
627
|
+
max?: number;
|
|
628
|
+
/** Defaults to `bar`. */
|
|
629
|
+
shape?: ProgressShape;
|
|
630
|
+
/** Defaults to `accent`. */
|
|
631
|
+
color?: ProgressColor;
|
|
632
|
+
/** Written after the value, e.g. `%` or ` av 5`. */
|
|
633
|
+
unit?: string;
|
|
634
|
+
/** The readout in words, when the bare number does not say it. Replaces value and unit. */
|
|
635
|
+
valueLabel?: string;
|
|
636
|
+
/** One quiet line under the reading. */
|
|
637
|
+
caption?: string;
|
|
638
|
+
icon?: HugeIconName;
|
|
639
|
+
}
|
|
584
640
|
/** One row of a KeyValueList. */
|
|
585
641
|
interface KeyValueRow {
|
|
586
642
|
label: string;
|
|
@@ -721,6 +777,8 @@ interface CalendarEventProps extends ExtensionComponentData {
|
|
|
721
777
|
interface ExtensionContributions {
|
|
722
778
|
/** Tool settings views for UI */
|
|
723
779
|
toolSettings?: ToolSettingsViewDefinition[];
|
|
780
|
+
/** Cards for the strip above the conversation list */
|
|
781
|
+
statusCards?: StatusCardDefinition[];
|
|
724
782
|
/** Right panel contributions */
|
|
725
783
|
panels?: PanelDefinition[];
|
|
726
784
|
/** AI providers */
|
|
@@ -861,6 +919,38 @@ interface PanelDefinition {
|
|
|
861
919
|
/** Panel view schema */
|
|
862
920
|
view: PanelView;
|
|
863
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* A card for the strip above the conversation list.
|
|
924
|
+
*
|
|
925
|
+
* The same declarative machinery as a panel, in a much smaller space and with
|
|
926
|
+
* one rule that is not a style guide: a card says what is true right now. It
|
|
927
|
+
* has no controls, because a sidebar is read in passing and anything the user
|
|
928
|
+
* wants to do about what it says, they say in words.
|
|
929
|
+
*
|
|
930
|
+
* The user chooses which cards they want and in what order, so an extension
|
|
931
|
+
* offering three is offering three, not imposing them.
|
|
932
|
+
*/
|
|
933
|
+
interface StatusCardDefinition {
|
|
934
|
+
/** Unique card ID within the extension */
|
|
935
|
+
id: string;
|
|
936
|
+
/** What it is called where the user picks it */
|
|
937
|
+
title: string;
|
|
938
|
+
/** Icon name (from huge-icons) */
|
|
939
|
+
icon?: string;
|
|
940
|
+
/**
|
|
941
|
+
* How much room it may take.
|
|
942
|
+
*
|
|
943
|
+
* Part of the contract rather than a guideline, because the sidebar is a few
|
|
944
|
+
* hundred pixels wide and the first card written without a limit will be
|
|
945
|
+
* written against a screen.
|
|
946
|
+
*
|
|
947
|
+
* - `line`: one row. A figure, a label, a pill.
|
|
948
|
+
* - `block`: up to three rows.
|
|
949
|
+
*/
|
|
950
|
+
size: 'line' | 'block';
|
|
951
|
+
/** What it draws, and where the data comes from */
|
|
952
|
+
view: PanelComponentView;
|
|
953
|
+
}
|
|
864
954
|
/**
|
|
865
955
|
* Panel view schema (declarative)
|
|
866
956
|
*/
|
|
@@ -2262,6 +2352,32 @@ interface ToolResult {
|
|
|
2262
2352
|
* would send her after a component that does not exist.
|
|
2263
2353
|
*/
|
|
2264
2354
|
cardSuggestion?: string;
|
|
2355
|
+
/**
|
|
2356
|
+
* Pictures to show the user, rendered in the conversation where the tool ran.
|
|
2357
|
+
*
|
|
2358
|
+
* For what a card cannot hold and the model cannot reproduce: a generated
|
|
2359
|
+
* image, a rendered document, a photo fetched on the user's behalf. Like
|
|
2360
|
+
* {@link ToolResult.display}, this is for the user only — it is lifted out
|
|
2361
|
+
* before the result reaches the model, which would have nothing to do with
|
|
2362
|
+
* the bytes but spend tokens on them. Say in `data` that a picture was shown,
|
|
2363
|
+
* so she can talk about it without describing it back.
|
|
2364
|
+
*
|
|
2365
|
+
* The host stores each one as an attachment of the conversation, the same way
|
|
2366
|
+
* a picture the user sends is stored, so it is served to every client and can
|
|
2367
|
+
* be saved or shared from there. JPEG and PNG only, and 20 MB at most, since
|
|
2368
|
+
* those are the limits the attachment store already holds users to. One that
|
|
2369
|
+
* fails them is dropped with a warning rather than half-shown.
|
|
2370
|
+
*/
|
|
2371
|
+
attachments?: ToolAttachment[];
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* One picture a tool wants shown. See {@link ToolResult.attachments}.
|
|
2375
|
+
*/
|
|
2376
|
+
interface ToolAttachment {
|
|
2377
|
+
/** The image bytes, base64 encoded. The format is read from the bytes. */
|
|
2378
|
+
data: string;
|
|
2379
|
+
/** A file name to offer when the user saves it, e.g. `friday.png`. */
|
|
2380
|
+
name?: string;
|
|
2265
2381
|
}
|
|
2266
2382
|
/**
|
|
2267
2383
|
* Action implementation for UI interactions.
|
|
@@ -2289,4 +2405,4 @@ interface ActionResult {
|
|
|
2289
2405
|
error?: string;
|
|
2290
2406
|
}
|
|
2291
2407
|
|
|
2292
|
-
export { type
|
|
2408
|
+
export { type BackgroundTaskContext as $, type ActionResult as A, type ActionsAPI as B, type ChatMessage as C, type Disposable as D, type ExtensionContributions as E, type EventsAPI as F, type GetModelsOptions as G, type HugeIconName as H, type SchedulerAPI as I, type SchedulerJobRequest as J, type SchedulerSchedule as K, type LocalizedString as L, type ModelInfo as M, type NetworkAPI as N, type UserProfile as O, type PanelDefinition as P, type ChatAPI as Q, type ChatInstructionMessage as R, type SchedulerFirePayload as S, type ToolResult as T, type UserAPI as U, type VoiceSessionOptions as V, type ConversationPresentation as W, type LogAPI as X, type BackgroundWorkersAPI as Y, type BackgroundTaskConfig as Z, type BackgroundTaskCallback as _, type ChatOptions as a, type WeatherForecastProps as a$, type BackgroundTaskHealth as a0, type BackgroundRestartPolicy as a1, type Query as a2, type QueryOptions as a3, type StorageAPI as a4, type SecretsAPI as a5, type StorageCollectionConfig as a6, type StorageContributions as a7, type AIProvider as a8, type ModelCapabilities as a9, type SelectProps as aA, type IconPickerProps as aB, type VerticalStackProps as aC, type HorizontalStackProps as aD, type GridProps as aE, type DividerProps as aF, type IconProps as aG, type IconButtonType as aH, type IconButtonProps as aI, type PanelAction as aJ, type PanelProps as aK, type ToggleProps as aL, type CollapsibleProps as aM, type FrameVariant as aN, type FrameProps as aO, type ListProps as aP, type PillVariant as aQ, type PillProps as aR, type CheckboxProps as aS, type MarkdownProps as aT, type TextPreviewProps as aU, type ModalProps as aV, type ConditionalGroupProps as aW, type WeatherCondition as aX, type WeatherWind as aY, type WeatherNowProps as aZ, type WeatherForecastStep as a_, type ChatImage as aa, type ToolCall as ab, type VoiceTransportRequest as ac, type Tool as ad, type ToolAttachment as ae, type Action as af, type ExtensionModule as ag, type AllowedCSSProperty as ah, type ExtensionComponentStyle as ai, type ExtensionComponentData as aj, type ExtensionComponentIterator as ak, type ExtensionComponentChildren as al, type ExtensionActionCall as am, type ExtensionActionRef as an, type ExtensionDataSource as ao, type ExtensionPanelDefinition as ap, type HeaderProps as aq, type LabelProps as ar, type ClockProps as as, type ParagraphProps as at, type ButtonProps as au, type TextInputProps as av, type PasswordInputProps as aw, type NumberInputProps as ax, type TextAreaProps as ay, type DateTimeInputProps as az, type StreamEvent as b, type ChartKind as b0, type ChartSeries as b1, type ChartProps as b2, type StatTrend as b3, type StatTileProps as b4, type ProgressShape as b5, type ProgressColor as b6, type ProgressBarProps as b7, type KeyValueRow as b8, type KeyValueListProps as b9, type TimelineVariant as ba, type TimelineEntry as bb, type TimelineProps as bc, type NoteVariant as bd, type NoteProps as be, type CalendarEventStatus as bf, type CalendarEventProps as bg, type ExecutionContext as bh, type VoiceSessionDescriptor as c, type ToolSettingsViewDefinition as d, type ToolSettingsView as e, type ToolSettingsListView as f, type ToolSettingsListMapping as g, type ToolSettingsComponentView as h, type ToolSettingsActionDataSource as i, type StatusCardDefinition as j, type PanelView as k, type PanelComponentView as l, type PanelActionDataSource as m, type PanelUnknownView as n, type ProviderDefinition as o, type ProviderConfigView as p, type PromptContribution as q, resolveLocalizedString as r, type PromptSection as s, type ToolDefinition as t, type ToolConfirmationConfig as u, type CommandDefinition as v, type ExtensionContext as w, type SettingsAPI as x, type ProvidersAPI as y, type ToolsAPI as z };
|
|
@@ -171,6 +171,18 @@ interface LabelProps extends ExtensionComponentData {
|
|
|
171
171
|
component: 'Label';
|
|
172
172
|
text: string;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The extension API properties for the Clock component.
|
|
176
|
+
*
|
|
177
|
+
* The odd one out among the display components: it takes no facts, because the
|
|
178
|
+
* fact it shows is what time it is, and that is not something an action can
|
|
179
|
+
* hand over once. It reads the clock and the timezone from the host and keeps
|
|
180
|
+
* itself current, so a card carrying one stays right while the window is left
|
|
181
|
+
* open.
|
|
182
|
+
*/
|
|
183
|
+
interface ClockProps extends ExtensionComponentData {
|
|
184
|
+
component: 'Clock';
|
|
185
|
+
}
|
|
174
186
|
/** The extension API properties for the paragraph component. */
|
|
175
187
|
interface ParagraphProps extends ExtensionComponentData {
|
|
176
188
|
component: 'Paragraph';
|
|
@@ -581,6 +593,50 @@ interface StatTileProps extends ExtensionComponentData {
|
|
|
581
593
|
*/
|
|
582
594
|
trendIsGood?: boolean;
|
|
583
595
|
}
|
|
596
|
+
/** Whether a progress reading is drawn as a rail or as a ring. */
|
|
597
|
+
type ProgressShape = 'bar' | 'circle';
|
|
598
|
+
/**
|
|
599
|
+
* The colours a progress reading may take.
|
|
600
|
+
*
|
|
601
|
+
* A closed list rather than a colour string: the caller is usually a language
|
|
602
|
+
* model, and the six names here are the six the themes actually define, so a
|
|
603
|
+
* reading cannot end up in a hue the current theme has no contrast for.
|
|
604
|
+
*/
|
|
605
|
+
type ProgressColor = 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
606
|
+
/**
|
|
607
|
+
* The extension API properties for the ProgressBar component.
|
|
608
|
+
*
|
|
609
|
+
* One value seen against the range it lives in — how far along something is,
|
|
610
|
+
* how loaded a day looks, how high a level sits. A StatTile says what the
|
|
611
|
+
* number *is*; this says where it *sits*, which is the thing a number alone
|
|
612
|
+
* cannot show.
|
|
613
|
+
*
|
|
614
|
+
* `min` and `max` are the range, not decoration: a value is drawn as its
|
|
615
|
+
* position between them, so "3 of 5" and "60 of 100" fill the same amount.
|
|
616
|
+
* Values outside the range are clamped rather than refused — a reading that
|
|
617
|
+
* ran past its ceiling should still draw as full.
|
|
618
|
+
*/
|
|
619
|
+
interface ProgressBarProps extends ExtensionComponentData {
|
|
620
|
+
component: 'ProgressBar';
|
|
621
|
+
/** What is being measured, e.g. "Stressnivå". Shown beside the reading. */
|
|
622
|
+
label: string;
|
|
623
|
+
value: number;
|
|
624
|
+
/** Bottom of the range. Defaults to 0. */
|
|
625
|
+
min?: number;
|
|
626
|
+
/** Top of the range. Defaults to 100. */
|
|
627
|
+
max?: number;
|
|
628
|
+
/** Defaults to `bar`. */
|
|
629
|
+
shape?: ProgressShape;
|
|
630
|
+
/** Defaults to `accent`. */
|
|
631
|
+
color?: ProgressColor;
|
|
632
|
+
/** Written after the value, e.g. `%` or ` av 5`. */
|
|
633
|
+
unit?: string;
|
|
634
|
+
/** The readout in words, when the bare number does not say it. Replaces value and unit. */
|
|
635
|
+
valueLabel?: string;
|
|
636
|
+
/** One quiet line under the reading. */
|
|
637
|
+
caption?: string;
|
|
638
|
+
icon?: HugeIconName;
|
|
639
|
+
}
|
|
584
640
|
/** One row of a KeyValueList. */
|
|
585
641
|
interface KeyValueRow {
|
|
586
642
|
label: string;
|
|
@@ -721,6 +777,8 @@ interface CalendarEventProps extends ExtensionComponentData {
|
|
|
721
777
|
interface ExtensionContributions {
|
|
722
778
|
/** Tool settings views for UI */
|
|
723
779
|
toolSettings?: ToolSettingsViewDefinition[];
|
|
780
|
+
/** Cards for the strip above the conversation list */
|
|
781
|
+
statusCards?: StatusCardDefinition[];
|
|
724
782
|
/** Right panel contributions */
|
|
725
783
|
panels?: PanelDefinition[];
|
|
726
784
|
/** AI providers */
|
|
@@ -861,6 +919,38 @@ interface PanelDefinition {
|
|
|
861
919
|
/** Panel view schema */
|
|
862
920
|
view: PanelView;
|
|
863
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* A card for the strip above the conversation list.
|
|
924
|
+
*
|
|
925
|
+
* The same declarative machinery as a panel, in a much smaller space and with
|
|
926
|
+
* one rule that is not a style guide: a card says what is true right now. It
|
|
927
|
+
* has no controls, because a sidebar is read in passing and anything the user
|
|
928
|
+
* wants to do about what it says, they say in words.
|
|
929
|
+
*
|
|
930
|
+
* The user chooses which cards they want and in what order, so an extension
|
|
931
|
+
* offering three is offering three, not imposing them.
|
|
932
|
+
*/
|
|
933
|
+
interface StatusCardDefinition {
|
|
934
|
+
/** Unique card ID within the extension */
|
|
935
|
+
id: string;
|
|
936
|
+
/** What it is called where the user picks it */
|
|
937
|
+
title: string;
|
|
938
|
+
/** Icon name (from huge-icons) */
|
|
939
|
+
icon?: string;
|
|
940
|
+
/**
|
|
941
|
+
* How much room it may take.
|
|
942
|
+
*
|
|
943
|
+
* Part of the contract rather than a guideline, because the sidebar is a few
|
|
944
|
+
* hundred pixels wide and the first card written without a limit will be
|
|
945
|
+
* written against a screen.
|
|
946
|
+
*
|
|
947
|
+
* - `line`: one row. A figure, a label, a pill.
|
|
948
|
+
* - `block`: up to three rows.
|
|
949
|
+
*/
|
|
950
|
+
size: 'line' | 'block';
|
|
951
|
+
/** What it draws, and where the data comes from */
|
|
952
|
+
view: PanelComponentView;
|
|
953
|
+
}
|
|
864
954
|
/**
|
|
865
955
|
* Panel view schema (declarative)
|
|
866
956
|
*/
|
|
@@ -2262,6 +2352,32 @@ interface ToolResult {
|
|
|
2262
2352
|
* would send her after a component that does not exist.
|
|
2263
2353
|
*/
|
|
2264
2354
|
cardSuggestion?: string;
|
|
2355
|
+
/**
|
|
2356
|
+
* Pictures to show the user, rendered in the conversation where the tool ran.
|
|
2357
|
+
*
|
|
2358
|
+
* For what a card cannot hold and the model cannot reproduce: a generated
|
|
2359
|
+
* image, a rendered document, a photo fetched on the user's behalf. Like
|
|
2360
|
+
* {@link ToolResult.display}, this is for the user only — it is lifted out
|
|
2361
|
+
* before the result reaches the model, which would have nothing to do with
|
|
2362
|
+
* the bytes but spend tokens on them. Say in `data` that a picture was shown,
|
|
2363
|
+
* so she can talk about it without describing it back.
|
|
2364
|
+
*
|
|
2365
|
+
* The host stores each one as an attachment of the conversation, the same way
|
|
2366
|
+
* a picture the user sends is stored, so it is served to every client and can
|
|
2367
|
+
* be saved or shared from there. JPEG and PNG only, and 20 MB at most, since
|
|
2368
|
+
* those are the limits the attachment store already holds users to. One that
|
|
2369
|
+
* fails them is dropped with a warning rather than half-shown.
|
|
2370
|
+
*/
|
|
2371
|
+
attachments?: ToolAttachment[];
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* One picture a tool wants shown. See {@link ToolResult.attachments}.
|
|
2375
|
+
*/
|
|
2376
|
+
interface ToolAttachment {
|
|
2377
|
+
/** The image bytes, base64 encoded. The format is read from the bytes. */
|
|
2378
|
+
data: string;
|
|
2379
|
+
/** A file name to offer when the user saves it, e.g. `friday.png`. */
|
|
2380
|
+
name?: string;
|
|
2265
2381
|
}
|
|
2266
2382
|
/**
|
|
2267
2383
|
* Action implementation for UI interactions.
|
|
@@ -2289,4 +2405,4 @@ interface ActionResult {
|
|
|
2289
2405
|
error?: string;
|
|
2290
2406
|
}
|
|
2291
2407
|
|
|
2292
|
-
export { type
|
|
2408
|
+
export { type BackgroundTaskContext as $, type ActionResult as A, type ActionsAPI as B, type ChatMessage as C, type Disposable as D, type ExtensionContributions as E, type EventsAPI as F, type GetModelsOptions as G, type HugeIconName as H, type SchedulerAPI as I, type SchedulerJobRequest as J, type SchedulerSchedule as K, type LocalizedString as L, type ModelInfo as M, type NetworkAPI as N, type UserProfile as O, type PanelDefinition as P, type ChatAPI as Q, type ChatInstructionMessage as R, type SchedulerFirePayload as S, type ToolResult as T, type UserAPI as U, type VoiceSessionOptions as V, type ConversationPresentation as W, type LogAPI as X, type BackgroundWorkersAPI as Y, type BackgroundTaskConfig as Z, type BackgroundTaskCallback as _, type ChatOptions as a, type WeatherForecastProps as a$, type BackgroundTaskHealth as a0, type BackgroundRestartPolicy as a1, type Query as a2, type QueryOptions as a3, type StorageAPI as a4, type SecretsAPI as a5, type StorageCollectionConfig as a6, type StorageContributions as a7, type AIProvider as a8, type ModelCapabilities as a9, type SelectProps as aA, type IconPickerProps as aB, type VerticalStackProps as aC, type HorizontalStackProps as aD, type GridProps as aE, type DividerProps as aF, type IconProps as aG, type IconButtonType as aH, type IconButtonProps as aI, type PanelAction as aJ, type PanelProps as aK, type ToggleProps as aL, type CollapsibleProps as aM, type FrameVariant as aN, type FrameProps as aO, type ListProps as aP, type PillVariant as aQ, type PillProps as aR, type CheckboxProps as aS, type MarkdownProps as aT, type TextPreviewProps as aU, type ModalProps as aV, type ConditionalGroupProps as aW, type WeatherCondition as aX, type WeatherWind as aY, type WeatherNowProps as aZ, type WeatherForecastStep as a_, type ChatImage as aa, type ToolCall as ab, type VoiceTransportRequest as ac, type Tool as ad, type ToolAttachment as ae, type Action as af, type ExtensionModule as ag, type AllowedCSSProperty as ah, type ExtensionComponentStyle as ai, type ExtensionComponentData as aj, type ExtensionComponentIterator as ak, type ExtensionComponentChildren as al, type ExtensionActionCall as am, type ExtensionActionRef as an, type ExtensionDataSource as ao, type ExtensionPanelDefinition as ap, type HeaderProps as aq, type LabelProps as ar, type ClockProps as as, type ParagraphProps as at, type ButtonProps as au, type TextInputProps as av, type PasswordInputProps as aw, type NumberInputProps as ax, type TextAreaProps as ay, type DateTimeInputProps as az, type StreamEvent as b, type ChartKind as b0, type ChartSeries as b1, type ChartProps as b2, type StatTrend as b3, type StatTileProps as b4, type ProgressShape as b5, type ProgressColor as b6, type ProgressBarProps as b7, type KeyValueRow as b8, type KeyValueListProps as b9, type TimelineVariant as ba, type TimelineEntry as bb, type TimelineProps as bc, type NoteVariant as bd, type NoteProps as be, type CalendarEventStatus as bf, type CalendarEventProps as bg, type ExecutionContext as bh, type VoiceSessionDescriptor as c, type ToolSettingsViewDefinition as d, type ToolSettingsView as e, type ToolSettingsListView as f, type ToolSettingsListMapping as g, type ToolSettingsComponentView as h, type ToolSettingsActionDataSource as i, type StatusCardDefinition as j, type PanelView as k, type PanelComponentView as l, type PanelActionDataSource as m, type PanelUnknownView as n, type ProviderDefinition as o, type ProviderConfigView as p, type PromptContribution as q, resolveLocalizedString as r, type PromptSection as s, type ToolDefinition as t, type ToolConfirmationConfig as u, type CommandDefinition as v, type ExtensionContext as w, type SettingsAPI as x, type ProvidersAPI as y, type ToolsAPI as z };
|
package/package.json
CHANGED
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
"settings.register",
|
|
120
120
|
"commands.register",
|
|
121
121
|
"panels.register",
|
|
122
|
+
"statusCards.register",
|
|
122
123
|
"events.emit",
|
|
123
124
|
"scheduler.register",
|
|
124
125
|
"background.workers",
|
|
@@ -564,6 +565,63 @@
|
|
|
564
565
|
},
|
|
565
566
|
"description": "Right panel contributions"
|
|
566
567
|
},
|
|
568
|
+
"statusCards": {
|
|
569
|
+
"type": "array",
|
|
570
|
+
"items": {
|
|
571
|
+
"type": "object",
|
|
572
|
+
"properties": {
|
|
573
|
+
"id": {
|
|
574
|
+
"type": "string",
|
|
575
|
+
"description": "Unique card ID within the extension"
|
|
576
|
+
},
|
|
577
|
+
"title": {
|
|
578
|
+
"type": "string",
|
|
579
|
+
"description": "What it is called where the user picks it"
|
|
580
|
+
},
|
|
581
|
+
"icon": {
|
|
582
|
+
"type": "string",
|
|
583
|
+
"description": "Icon name (from huge-icons)"
|
|
584
|
+
},
|
|
585
|
+
"size": {
|
|
586
|
+
"type": "string",
|
|
587
|
+
"enum": [
|
|
588
|
+
"line",
|
|
589
|
+
"block"
|
|
590
|
+
],
|
|
591
|
+
"description": "How much room it may take: one row, or up to three"
|
|
592
|
+
},
|
|
593
|
+
"view": {
|
|
594
|
+
"type": "object",
|
|
595
|
+
"properties": {
|
|
596
|
+
"kind": {
|
|
597
|
+
"$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/panels/items/properties/view/anyOf/0/properties/kind"
|
|
598
|
+
},
|
|
599
|
+
"data": {
|
|
600
|
+
"$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/panels/items/properties/view/anyOf/0/properties/data"
|
|
601
|
+
},
|
|
602
|
+
"content": {
|
|
603
|
+
"$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/panels/items/properties/view/anyOf/0/properties/content"
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
"required": [
|
|
607
|
+
"kind",
|
|
608
|
+
"content"
|
|
609
|
+
],
|
|
610
|
+
"additionalProperties": false,
|
|
611
|
+
"description": "What it draws, and where the data comes from"
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
"required": [
|
|
615
|
+
"id",
|
|
616
|
+
"title",
|
|
617
|
+
"size",
|
|
618
|
+
"view"
|
|
619
|
+
],
|
|
620
|
+
"additionalProperties": false,
|
|
621
|
+
"description": "Status card definition"
|
|
622
|
+
},
|
|
623
|
+
"description": "Cards for the strip above the conversation list"
|
|
624
|
+
},
|
|
567
625
|
"providers": {
|
|
568
626
|
"type": "array",
|
|
569
627
|
"items": {
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export type {
|
|
|
24
24
|
ToolSettingsComponentView,
|
|
25
25
|
ToolSettingsActionDataSource,
|
|
26
26
|
PanelDefinition,
|
|
27
|
+
StatusCardDefinition,
|
|
27
28
|
PanelView,
|
|
28
29
|
PanelComponentView,
|
|
29
30
|
PanelActionDataSource,
|
|
@@ -99,6 +100,7 @@ export type {
|
|
|
99
100
|
// Tools
|
|
100
101
|
Tool,
|
|
101
102
|
ToolResult,
|
|
103
|
+
ToolAttachment,
|
|
102
104
|
|
|
103
105
|
// Actions
|
|
104
106
|
Action,
|
|
@@ -162,6 +164,7 @@ export type {
|
|
|
162
164
|
// Component Props
|
|
163
165
|
HeaderProps,
|
|
164
166
|
LabelProps,
|
|
167
|
+
ClockProps,
|
|
165
168
|
ParagraphProps,
|
|
166
169
|
ButtonProps,
|
|
167
170
|
TextInputProps,
|
|
@@ -203,6 +206,9 @@ export type {
|
|
|
203
206
|
ChartProps,
|
|
204
207
|
StatTrend,
|
|
205
208
|
StatTileProps,
|
|
209
|
+
ProgressShape,
|
|
210
|
+
ProgressColor,
|
|
211
|
+
ProgressBarProps,
|
|
206
212
|
KeyValueRow,
|
|
207
213
|
KeyValueListProps,
|
|
208
214
|
TimelineVariant,
|
package/src/runtime.ts
CHANGED
|
@@ -648,11 +648,36 @@ function buildContext(
|
|
|
648
648
|
if (permissions.some((p) => p.startsWith('network:'))) {
|
|
649
649
|
const networkApi: NetworkAPI = {
|
|
650
650
|
async fetch(url: string, options?: RequestInit): Promise<Response> {
|
|
651
|
-
const result = await sendRequest<{
|
|
652
|
-
|
|
651
|
+
const result = await sendRequest<{
|
|
652
|
+
status: number
|
|
653
|
+
statusText: string
|
|
654
|
+
headers: Record<string, string>
|
|
655
|
+
body: string
|
|
656
|
+
bodyEncoding?: 'base64'
|
|
657
|
+
}>('network.fetch', { url, options })
|
|
658
|
+
// The host sends a body that is not text as base64, since the bridge is
|
|
659
|
+
// JSON. Turn it back into bytes here so `response.arrayBuffer()` gives
|
|
660
|
+
// the extension what the server sent and `text()` still works.
|
|
661
|
+
const isBase64 = result.bodyEncoding === 'base64'
|
|
662
|
+
const body = isBase64
|
|
663
|
+
? Uint8Array.from(atob(result.body), (char) => char.charCodeAt(0))
|
|
664
|
+
: result.body
|
|
665
|
+
|
|
666
|
+
// The host says the same thing in a header, for extensions whose bundled
|
|
667
|
+
// copy of this runtime is older than the encoding and would hand the
|
|
668
|
+
// base64 on as text. This runtime just decoded it, so the header would be
|
|
669
|
+
// a lie by the time the extension reads it: take it back out.
|
|
670
|
+
const headers = { ...result.headers }
|
|
671
|
+
if (isBase64) {
|
|
672
|
+
for (const name of Object.keys(headers)) {
|
|
673
|
+
if (name.toLowerCase() === 'x-stina-body-encoding') delete headers[name]
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return new Response(body, {
|
|
653
678
|
status: result.status,
|
|
654
679
|
statusText: result.statusText,
|
|
655
|
-
headers
|
|
680
|
+
headers,
|
|
656
681
|
})
|
|
657
682
|
},
|
|
658
683
|
|
|
@@ -996,6 +1021,7 @@ export type {
|
|
|
996
1021
|
Tool,
|
|
997
1022
|
ToolDefinition,
|
|
998
1023
|
ToolResult,
|
|
1024
|
+
ToolAttachment,
|
|
999
1025
|
ToolCall,
|
|
1000
1026
|
Action,
|
|
1001
1027
|
ActionResult,
|
|
@@ -34,6 +34,8 @@ import {
|
|
|
34
34
|
WeatherWindSchema,
|
|
35
35
|
ChartKindSchema,
|
|
36
36
|
StatTrendSchema,
|
|
37
|
+
ProgressShapeSchema,
|
|
38
|
+
ProgressColorSchema,
|
|
37
39
|
TimelineVariantSchema,
|
|
38
40
|
NoteVariantSchema,
|
|
39
41
|
CalendarEventStatusSchema,
|
|
@@ -259,6 +261,23 @@ const StatTileCardSchema = z
|
|
|
259
261
|
})
|
|
260
262
|
.strict()
|
|
261
263
|
|
|
264
|
+
const ProgressBarCardSchema = z
|
|
265
|
+
.object({
|
|
266
|
+
component: z.literal('ProgressBar'),
|
|
267
|
+
label: z.string(),
|
|
268
|
+
value: z.number(),
|
|
269
|
+
min: z.number().optional(),
|
|
270
|
+
max: z.number().optional(),
|
|
271
|
+
shape: ProgressShapeSchema.optional(),
|
|
272
|
+
color: ProgressColorSchema.optional(),
|
|
273
|
+
unit: z.string().optional(),
|
|
274
|
+
valueLabel: z.string().optional(),
|
|
275
|
+
caption: z.string().optional(),
|
|
276
|
+
icon: z.string().optional(),
|
|
277
|
+
style,
|
|
278
|
+
})
|
|
279
|
+
.strict()
|
|
280
|
+
|
|
262
281
|
const KeyValueListCardSchema = z
|
|
263
282
|
.object({
|
|
264
283
|
component: z.literal('KeyValueList'),
|
|
@@ -350,6 +369,7 @@ export const CHAT_CARD_COMPONENTS = [
|
|
|
350
369
|
'WeatherForecast',
|
|
351
370
|
'Chart',
|
|
352
371
|
'StatTile',
|
|
372
|
+
'ProgressBar',
|
|
353
373
|
'KeyValueList',
|
|
354
374
|
'Timeline',
|
|
355
375
|
'Note',
|
|
@@ -382,12 +402,35 @@ const CARD_MEMBERS = [
|
|
|
382
402
|
WeatherForecastCardSchema,
|
|
383
403
|
ChartCardSchema,
|
|
384
404
|
StatTileCardSchema,
|
|
405
|
+
ProgressBarCardSchema,
|
|
385
406
|
KeyValueListCardSchema,
|
|
386
407
|
TimelineCardSchema,
|
|
387
408
|
NoteCardSchema,
|
|
388
409
|
CalendarEventCardSchema,
|
|
389
410
|
] as const
|
|
390
411
|
|
|
412
|
+
/**
|
|
413
|
+
* The properties each card component accepts, read off the schemas themselves.
|
|
414
|
+
*
|
|
415
|
+
* Derived rather than listed, for the same reason `describeChatCardProfile`
|
|
416
|
+
* is: a hand-kept copy of this drifts, and a drifted copy rejects components
|
|
417
|
+
* that are in fact legal.
|
|
418
|
+
*
|
|
419
|
+
* Used by profiles that validate a card *template* rather than a finished card
|
|
420
|
+
* — the status card, whose leaves are references to data that does not exist
|
|
421
|
+
* yet and so cannot be type-checked by these schemas. They can still be held to
|
|
422
|
+
* this vocabulary, which is what catches a property the model invented.
|
|
423
|
+
*/
|
|
424
|
+
export const CHAT_CARD_PROPS: Readonly<Record<string, readonly string[]>> = Object.freeze(
|
|
425
|
+
Object.fromEntries(
|
|
426
|
+
CARD_MEMBERS.map((member) => {
|
|
427
|
+
const shape = (member as unknown as z.AnyZodObject).shape as Record<string, z.ZodTypeAny>
|
|
428
|
+
const name = (shape['component']!._def as { value: string }).value
|
|
429
|
+
return [name, Object.freeze(Object.keys(shape))]
|
|
430
|
+
})
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
|
|
391
434
|
/**
|
|
392
435
|
* One component of a chat card.
|
|
393
436
|
*
|
|
@@ -197,6 +197,14 @@ export const LabelPropsSchema = z
|
|
|
197
197
|
.passthrough()
|
|
198
198
|
.describe('Label component')
|
|
199
199
|
|
|
200
|
+
export const ClockPropsSchema = z
|
|
201
|
+
.object({
|
|
202
|
+
component: z.literal('Clock'),
|
|
203
|
+
style: ExtensionComponentStyleSchema.optional(),
|
|
204
|
+
})
|
|
205
|
+
.passthrough()
|
|
206
|
+
.describe('Clock component: the current date and time where the user is')
|
|
207
|
+
|
|
200
208
|
export const ParagraphPropsSchema = z
|
|
201
209
|
.object({
|
|
202
210
|
component: z.literal('Paragraph'),
|
|
@@ -651,6 +659,32 @@ export const StatTilePropsSchema = z
|
|
|
651
659
|
.passthrough()
|
|
652
660
|
.describe('Single-number stat tile component')
|
|
653
661
|
|
|
662
|
+
export const ProgressShapeSchema = z
|
|
663
|
+
.enum(['bar', 'circle'])
|
|
664
|
+
.describe('Drawn as a rail or as a ring')
|
|
665
|
+
|
|
666
|
+
export const ProgressColorSchema = z
|
|
667
|
+
.enum(['accent', 'success', 'warning', 'danger', 'info', 'neutral'])
|
|
668
|
+
.describe('One of the theme colours')
|
|
669
|
+
|
|
670
|
+
export const ProgressBarPropsSchema = z
|
|
671
|
+
.object({
|
|
672
|
+
component: z.literal('ProgressBar'),
|
|
673
|
+
label: z.string().describe('What is being measured'),
|
|
674
|
+
value: z.number().describe('Where the reading sits. Clamped to the range'),
|
|
675
|
+
min: z.number().optional().describe('Bottom of the range. Defaults to 0'),
|
|
676
|
+
max: z.number().optional().describe('Top of the range. Defaults to 100'),
|
|
677
|
+
shape: ProgressShapeSchema.optional().describe('Defaults to bar'),
|
|
678
|
+
color: ProgressColorSchema.optional().describe('Defaults to accent'),
|
|
679
|
+
unit: z.string().optional().describe('Written after the value'),
|
|
680
|
+
valueLabel: z.string().optional().describe('The readout in words, replacing value and unit'),
|
|
681
|
+
caption: z.string().optional().describe('One quiet line under the reading'),
|
|
682
|
+
icon: z.string().optional().describe('Icon name'),
|
|
683
|
+
style: ExtensionComponentStyleSchema.optional(),
|
|
684
|
+
})
|
|
685
|
+
.passthrough()
|
|
686
|
+
.describe('Progress component')
|
|
687
|
+
|
|
654
688
|
export const KeyValueRowSchema = z
|
|
655
689
|
.object({
|
|
656
690
|
label: z.string(),
|
|
@@ -794,6 +828,10 @@ export type ChartSeries = z.infer<typeof ChartSeriesSchema>
|
|
|
794
828
|
export type ChartProps = z.infer<typeof ChartPropsSchema>
|
|
795
829
|
export type StatTrend = z.infer<typeof StatTrendSchema>
|
|
796
830
|
export type StatTileProps = z.infer<typeof StatTilePropsSchema>
|
|
831
|
+
export type ClockProps = z.infer<typeof ClockPropsSchema>
|
|
832
|
+
export type ProgressShape = z.infer<typeof ProgressShapeSchema>
|
|
833
|
+
export type ProgressColor = z.infer<typeof ProgressColorSchema>
|
|
834
|
+
export type ProgressBarProps = z.infer<typeof ProgressBarPropsSchema>
|
|
797
835
|
export type KeyValueRow = z.infer<typeof KeyValueRowSchema>
|
|
798
836
|
export type KeyValueListProps = z.infer<typeof KeyValueListPropsSchema>
|
|
799
837
|
export type TimelineVariant = z.infer<typeof TimelineVariantSchema>
|