@stina/extension-api 0.57.0 → 1.0.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.
@@ -731,6 +731,53 @@ export interface StatTileProps extends ExtensionComponentData {
731
731
  trendIsGood?: boolean
732
732
  }
733
733
 
734
+ /** Whether a progress reading is drawn as a rail or as a ring. */
735
+ export type ProgressShape = 'bar' | 'circle'
736
+
737
+ /**
738
+ * The colours a progress reading may take.
739
+ *
740
+ * A closed list rather than a colour string: the caller is usually a language
741
+ * model, and the six names here are the six the themes actually define, so a
742
+ * reading cannot end up in a hue the current theme has no contrast for.
743
+ */
744
+ export type ProgressColor = 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'neutral'
745
+
746
+ /**
747
+ * The extension API properties for the ProgressBar component.
748
+ *
749
+ * One value seen against the range it lives in — how far along something is,
750
+ * how loaded a day looks, how high a level sits. A StatTile says what the
751
+ * number *is*; this says where it *sits*, which is the thing a number alone
752
+ * cannot show.
753
+ *
754
+ * `min` and `max` are the range, not decoration: a value is drawn as its
755
+ * position between them, so "3 of 5" and "60 of 100" fill the same amount.
756
+ * Values outside the range are clamped rather than refused — a reading that
757
+ * ran past its ceiling should still draw as full.
758
+ */
759
+ export interface ProgressBarProps extends ExtensionComponentData {
760
+ component: 'ProgressBar'
761
+ /** What is being measured, e.g. "Stressnivå". Shown beside the reading. */
762
+ label: string
763
+ value: number
764
+ /** Bottom of the range. Defaults to 0. */
765
+ min?: number
766
+ /** Top of the range. Defaults to 100. */
767
+ max?: number
768
+ /** Defaults to `bar`. */
769
+ shape?: ProgressShape
770
+ /** Defaults to `accent`. */
771
+ color?: ProgressColor
772
+ /** Written after the value, e.g. `%` or ` av 5`. */
773
+ unit?: string
774
+ /** The readout in words, when the bare number does not say it. Replaces value and unit. */
775
+ valueLabel?: string
776
+ /** One quiet line under the reading. */
777
+ caption?: string
778
+ icon?: HugeIconName
779
+ }
780
+
734
781
  /** One row of a KeyValueList. */
735
782
  export interface KeyValueRow {
736
783
  label: string
@@ -13,6 +13,8 @@ import type { ExtensionComponentData } from './types.components.js'
13
13
  export interface ExtensionContributions {
14
14
  /** Tool settings views for UI */
15
15
  toolSettings?: ToolSettingsViewDefinition[]
16
+ /** Cards for the strip above the conversation list */
17
+ statusCards?: StatusCardDefinition[]
16
18
  /** Right panel contributions */
17
19
  panels?: PanelDefinition[]
18
20
  /** AI providers */
@@ -170,6 +172,39 @@ export interface PanelDefinition {
170
172
  view: PanelView
171
173
  }
172
174
 
175
+ /**
176
+ * A card for the strip above the conversation list.
177
+ *
178
+ * The same declarative machinery as a panel, in a much smaller space and with
179
+ * one rule that is not a style guide: a card says what is true right now. It
180
+ * has no controls, because a sidebar is read in passing and anything the user
181
+ * wants to do about what it says, they say in words.
182
+ *
183
+ * The user chooses which cards they want and in what order, so an extension
184
+ * offering three is offering three, not imposing them.
185
+ */
186
+ export interface StatusCardDefinition {
187
+ /** Unique card ID within the extension */
188
+ id: string
189
+ /** What it is called where the user picks it */
190
+ title: string
191
+ /** Icon name (from huge-icons) */
192
+ icon?: string
193
+ /**
194
+ * How much room it may take.
195
+ *
196
+ * Part of the contract rather than a guideline, because the sidebar is a few
197
+ * hundred pixels wide and the first card written without a limit will be
198
+ * written against a screen.
199
+ *
200
+ * - `line`: one row. A figure, a label, a pill.
201
+ * - `block`: up to three rows.
202
+ */
203
+ size: 'line' | 'block'
204
+ /** What it draws, and where the data comes from */
205
+ view: PanelComponentView
206
+ }
207
+
173
208
  /**
174
209
  * Panel view schema (declarative)
175
210
  */
@@ -39,6 +39,7 @@ export type CapabilityPermission =
39
39
  | 'settings.register'
40
40
  | 'commands.register'
41
41
  | 'panels.register'
42
+ | 'statusCards.register'
42
43
  | 'events.emit'
43
44
  | 'scheduler.register'
44
45
  | 'chat.message.write'
@@ -52,8 +52,27 @@ export interface ToolResult {
52
52
  * Validate with `validateChatCard` before returning one. A card that fails the
53
53
  * profile is dropped by the host rather than half-rendered, so a tool that
54
54
  * skips the check finds out from the user, which is the wrong end.
55
+ *
56
+ * Most tools should prefer {@link ToolResult.cardSuggestion}: a card drawn here
57
+ * is shown whatever the user asked, and a timeline of ten mails is the wrong
58
+ * answer to "did Anna write back?".
55
59
  */
56
60
  display?: ExtensionComponentData
61
+
62
+ /**
63
+ * The shape this tool thinks its answer has: one component name from the chat
64
+ * card profile, such as `"Timeline"` or `"WeatherForecast"`.
65
+ *
66
+ * A suggestion, not a drawing. It travels to the model with the result, and
67
+ * Stina decides whether to show a card at all, what goes in it, and how much of
68
+ * the data belongs there — summing three days into one figure, or answering in
69
+ * a sentence because the user asked a yes-or-no question. The tool knows the
70
+ * shape of its data; only she knows the shape of the question.
71
+ *
72
+ * A name outside the profile is dropped by the host with a warning, since it
73
+ * would send her after a component that does not exist.
74
+ */
75
+ cardSuggestion?: string
57
76
  }
58
77
 
59
78
  /**
package/src/types.ts CHANGED
@@ -31,6 +31,7 @@ export type {
31
31
  ToolSettingsActionDataSource,
32
32
  // Panels
33
33
  PanelDefinition,
34
+ StatusCardDefinition,
34
35
  PanelView,
35
36
  PanelUnknownView,
36
37
  PanelActionDataSource,