@stina/extension-api 0.32.0 → 0.33.0-alpha.8cab91c

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.
@@ -11,8 +11,6 @@ import type { ExtensionComponentData } from './types.components.js'
11
11
  * What an extension can contribute to Stina
12
12
  */
13
13
  export interface ExtensionContributions {
14
- /** User-configurable settings */
15
- settings?: SettingDefinition[]
16
14
  /** Tool settings views for UI */
17
15
  toolSettings?: ToolSettingsViewDefinition[]
18
16
  /** Right panel contributions */
@@ -36,75 +34,6 @@ export interface ExtensionContributions {
36
34
  }
37
35
  }
38
36
 
39
- // ============================================================================
40
- // Settings
41
- // ============================================================================
42
-
43
- /**
44
- * Setting definition for the UI
45
- */
46
- export interface SettingDefinition {
47
- /** Setting ID (namespaced automatically) */
48
- id: string
49
- /** Display title */
50
- title: string
51
- /** Help text */
52
- description?: string
53
- /** Setting type */
54
- type: 'string' | 'number' | 'boolean' | 'select'
55
- /** Default value */
56
- default?: unknown
57
- /** For select type: available options */
58
- options?: { value: string; label: string }[]
59
- /** For select type: load options from tool */
60
- optionsToolId?: string
61
- /** Params for options tool */
62
- optionsParams?: Record<string, unknown>
63
- /** Mapping for options tool response */
64
- optionsMapping?: SettingOptionsMapping
65
- /** Tool ID for creating a new option */
66
- createToolId?: string
67
- /** Label for create action */
68
- createLabel?: string
69
- /** Fields for create form */
70
- createFields?: SettingDefinition[]
71
- /** Static params always sent to create tool */
72
- createParams?: Record<string, unknown>
73
- /** Mapping for create tool response */
74
- createMapping?: SettingCreateMapping
75
- /** Validation rules */
76
- validation?: {
77
- required?: boolean
78
- min?: number
79
- max?: number
80
- pattern?: string
81
- }
82
- }
83
-
84
- /**
85
- * Mapping for select field options from tool response
86
- */
87
- export interface SettingOptionsMapping {
88
- /** Key for items array in tool result data */
89
- itemsKey: string
90
- /** Key for option value */
91
- valueKey: string
92
- /** Key for option label */
93
- labelKey: string
94
- /** Optional key for description */
95
- descriptionKey?: string
96
- }
97
-
98
- /**
99
- * Mapping for create tool response
100
- */
101
- export interface SettingCreateMapping {
102
- /** Key for result data object */
103
- resultKey?: string
104
- /** Key for option value (defaults to "id") */
105
- valueKey: string
106
- }
107
-
108
37
  // ============================================================================
109
38
  // Tool Settings Views
110
39
  // ============================================================================
@@ -121,8 +50,6 @@ export interface ToolSettingsViewDefinition {
121
50
  description?: string
122
51
  /** View configuration */
123
52
  view: ToolSettingsView
124
- /** Fields for create/edit forms (uses SettingDefinition) */
125
- fields?: SettingDefinition[]
126
53
  }
127
54
 
128
55
  /**
@@ -154,6 +81,32 @@ export interface ToolSettingsListView {
154
81
  idParam?: string
155
82
  /** Static params always sent to list tool */
156
83
  listParams?: Record<string, unknown>
84
+ /**
85
+ * Component-tree-based create/edit form. Fields bind to the current
86
+ * item via `value: "$item.<key>"` (or `selectedValue` / `checked`),
87
+ * and the host saves the resulting object via `upsertToolId` when
88
+ * the user clicks "Save".
89
+ */
90
+ editView?: {
91
+ /** Root component to render in the create/edit modal. */
92
+ content: ExtensionComponentData
93
+ }
94
+ /** Optional grouping configuration. When set, items are visually grouped by this field. */
95
+ groupBy?: ToolSettingsListGroupBy
96
+ }
97
+
98
+ /**
99
+ * Configures grouping for a list view. Items are grouped by the value
100
+ * of `key` on each item; groups appear in the order specified by `order`
101
+ * (with unlisted groups falling back to alphabetical order at the end).
102
+ */
103
+ export interface ToolSettingsListGroupBy {
104
+ /** Key in each item used to determine group membership. */
105
+ key: string
106
+ /** Explicit ordering of group values. Groups not listed appear afterwards, sorted alphabetically. */
107
+ order?: string[]
108
+ /** Human-friendly labels per group value (rendered as section headers). Falls back to the raw value if missing. */
109
+ labels?: Record<string, string>
157
110
  }
158
111
 
159
112
  /**
@@ -272,79 +225,23 @@ export interface ProviderDefinition {
272
225
  suggestedDefaultModel?: string
273
226
  /** Default settings for this provider (e.g., { url: "http://localhost:11434" }) */
274
227
  defaultSettings?: Record<string, unknown>
275
- /** Schema for provider-specific configuration UI */
276
- configSchema?: ProviderConfigSchema
277
- }
278
-
279
- /**
280
- * Schema for provider-specific configuration.
281
- * Used to generate UI forms for configuring provider settings.
282
- */
283
- export interface ProviderConfigSchema {
284
- /** Property definitions */
285
- properties: Record<string, ProviderConfigProperty>
286
- /** Display order of properties in UI (optional, defaults to object key order) */
287
- order?: string[]
288
- }
289
-
290
- /**
291
- * Property types for provider configuration
292
- */
293
- export type ProviderConfigPropertyType =
294
- | 'string'
295
- | 'number'
296
- | 'boolean'
297
- | 'select'
298
- | 'password'
299
- | 'url'
300
-
301
- /**
302
- * Single property in a provider configuration schema.
303
- * Defines how a setting should be rendered and validated in the UI.
304
- */
305
- export interface ProviderConfigProperty {
306
- /** Property type - determines UI control */
307
- type: ProviderConfigPropertyType
308
- /** Display label */
309
- title: string
310
- /** Help text shown below the input */
311
- description?: string
312
- /** Default value */
313
- default?: unknown
314
- /** Whether the field is required */
315
- required?: boolean
316
- /** Placeholder text for input fields */
317
- placeholder?: string
318
- /** For 'select' type: static options */
319
- options?: ProviderConfigSelectOption[]
320
- /** Validation rules */
321
- validation?: ProviderConfigValidation
322
- }
323
-
324
- /**
325
- * Option for select-type properties
326
- */
327
- export interface ProviderConfigSelectOption {
328
- /** Value stored in settings */
329
- value: string
330
- /** Display label */
331
- label: string
228
+ /**
229
+ * Declarative configuration view rendered with the extensionComponent
230
+ * system. The host owns the settings state — bind fields with
231
+ * `value: "$settings.<key>"` and the host updates the model's
232
+ * settingsOverride when the user edits. `onChangeAction` is optional
233
+ * for input fields in this view; buttons can still use `onClickAction`
234
+ * to call extension actions (e.g. OAuth, "Test connection").
235
+ */
236
+ configView?: ProviderConfigView
332
237
  }
333
238
 
334
239
  /**
335
- * Validation rules for a property
240
+ * Component-tree-based configuration view for a provider.
336
241
  */
337
- export interface ProviderConfigValidation {
338
- /** Regex pattern the value must match */
339
- pattern?: string
340
- /** Minimum string length */
341
- minLength?: number
342
- /** Maximum string length */
343
- maxLength?: number
344
- /** Minimum number value */
345
- min?: number
346
- /** Maximum number value */
347
- max?: number
242
+ export interface ProviderConfigView {
243
+ /** Component tree describing the form. */
244
+ content: import('./types.components.js').ExtensionComponentData
348
245
  }
349
246
 
350
247
  // ============================================================================
package/src/types.ts CHANGED
@@ -22,10 +22,6 @@ export type {
22
22
  // Contributions
23
23
  export type {
24
24
  ExtensionContributions,
25
- // Settings
26
- SettingDefinition,
27
- SettingOptionsMapping,
28
- SettingCreateMapping,
29
25
  // Tool Settings Views
30
26
  ToolSettingsViewDefinition,
31
27
  ToolSettingsView,
@@ -41,11 +37,7 @@ export type {
41
37
  PanelComponentView,
42
38
  // Providers
43
39
  ProviderDefinition,
44
- ProviderConfigSchema,
45
- ProviderConfigPropertyType,
46
- ProviderConfigProperty,
47
- ProviderConfigSelectOption,
48
- ProviderConfigValidation,
40
+ ProviderConfigView,
49
41
  // Tools
50
42
  ToolDefinition,
51
43
  ToolConfirmationConfig,