@stina/extension-api 0.31.1 → 0.32.0-alpha.25ba69d
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 +51 -111
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2662 -3128
- package/dist/schemas/index.d.ts +2662 -3128
- package/dist/schemas/index.js +50 -102
- package/dist/schemas/index.js.map +1 -1
- package/dist/{types.tools-B8gimq24.d.cts → types.tools-CLp-Zw8L.d.cts} +77 -144
- package/dist/{types.tools-B8gimq24.d.ts → types.tools-CLp-Zw8L.d.ts} +77 -144
- package/package.json +1 -1
- package/schema/extension-manifest.schema.json +133 -341
- package/src/index.ts +4 -10
- package/src/schemas/components.schema.ts +52 -6
- package/src/schemas/contributions.schema.ts +14 -178
- package/src/schemas/index.ts +2 -18
- package/src/types.components.ts +46 -6
- package/src/types.contributions.ts +33 -145
- 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,16 @@ 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
|
+
}
|
|
157
94
|
}
|
|
158
95
|
|
|
159
96
|
/**
|
|
@@ -272,79 +209,23 @@ export interface ProviderDefinition {
|
|
|
272
209
|
suggestedDefaultModel?: string
|
|
273
210
|
/** Default settings for this provider (e.g., { url: "http://localhost:11434" }) */
|
|
274
211
|
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
|
|
212
|
+
/**
|
|
213
|
+
* Declarative configuration view rendered with the extensionComponent
|
|
214
|
+
* system. The host owns the settings state — bind fields with
|
|
215
|
+
* `value: "$settings.<key>"` and the host updates the model's
|
|
216
|
+
* settingsOverride when the user edits. `onChangeAction` is optional
|
|
217
|
+
* for input fields in this view; buttons can still use `onClickAction`
|
|
218
|
+
* to call extension actions (e.g. OAuth, "Test connection").
|
|
219
|
+
*/
|
|
220
|
+
configView?: ProviderConfigView
|
|
332
221
|
}
|
|
333
222
|
|
|
334
223
|
/**
|
|
335
|
-
*
|
|
224
|
+
* Component-tree-based configuration view for a provider.
|
|
336
225
|
*/
|
|
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
|
|
226
|
+
export interface ProviderConfigView {
|
|
227
|
+
/** Component tree describing the form. */
|
|
228
|
+
content: import('./types.components.js').ExtensionComponentData
|
|
348
229
|
}
|
|
349
230
|
|
|
350
231
|
// ============================================================================
|
|
@@ -374,13 +255,20 @@ export interface ToolDefinition {
|
|
|
374
255
|
/** Parameter schema (JSON Schema) */
|
|
375
256
|
parameters?: Record<string, unknown>
|
|
376
257
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
258
|
+
* Whether this tool requires user confirmation before execution.
|
|
259
|
+
* Defaults to true if not specified — tools require confirmation unless explicitly opted out.
|
|
260
|
+
*/
|
|
261
|
+
requiresConfirmation?: boolean
|
|
262
|
+
/**
|
|
263
|
+
* Optional custom confirmation prompt to show the user.
|
|
264
|
+
* Only used when confirmation is required.
|
|
265
|
+
* @example { en: "Allow sending email?", sv: "Tillåt att skicka e-post?" }
|
|
379
266
|
*/
|
|
380
|
-
|
|
267
|
+
confirmationPrompt?: LocalizedString
|
|
381
268
|
}
|
|
382
269
|
|
|
383
270
|
/**
|
|
271
|
+
* @deprecated Use `requiresConfirmation` and `confirmationPrompt` directly on ToolDefinition instead.
|
|
384
272
|
* Configuration for tool confirmation.
|
|
385
273
|
*/
|
|
386
274
|
export interface ToolConfirmationConfig {
|
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,
|