@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.
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/schemas/index.cjs +58 -110
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2752 -3056
- package/dist/schemas/index.d.ts +2752 -3056
- package/dist/schemas/index.js +56 -101
- package/dist/schemas/index.js.map +1 -1
- package/dist/{types.tools-XIdePk7Z.d.cts → types.tools-BYgcVNP4.d.cts} +82 -141
- package/dist/{types.tools-XIdePk7Z.d.ts → types.tools-BYgcVNP4.d.ts} +82 -141
- package/package.json +1 -1
- package/schema/extension-manifest.schema.json +146 -341
- package/src/index.ts +4 -10
- package/src/schemas/components.schema.ts +52 -6
- package/src/schemas/contributions.schema.ts +33 -178
- package/src/schemas/index.ts +4 -18
- package/src/types.components.ts +46 -6
- package/src/types.contributions.ts +39 -142
- package/src/types.ts +1 -9
|
@@ -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
|
-
/**
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
-
*
|
|
240
|
+
* Component-tree-based configuration view for a provider.
|
|
336
241
|
*/
|
|
337
|
-
export interface
|
|
338
|
-
/**
|
|
339
|
-
|
|
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
|
-
|
|
45
|
-
ProviderConfigPropertyType,
|
|
46
|
-
ProviderConfigProperty,
|
|
47
|
-
ProviderConfigSelectOption,
|
|
48
|
-
ProviderConfigValidation,
|
|
40
|
+
ProviderConfigView,
|
|
49
41
|
// Tools
|
|
50
42
|
ToolDefinition,
|
|
51
43
|
ToolConfirmationConfig,
|