@stina/extension-api 0.32.0 → 0.33.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.
@@ -139,165 +139,6 @@
139
139
  "contributes": {
140
140
  "type": "object",
141
141
  "properties": {
142
- "settings": {
143
- "type": "array",
144
- "items": {
145
- "type": "object",
146
- "properties": {
147
- "id": {
148
- "type": "string",
149
- "description": "Setting ID (namespaced automatically)"
150
- },
151
- "title": {
152
- "type": "string",
153
- "description": "Display title"
154
- },
155
- "description": {
156
- "type": "string",
157
- "description": "Help text"
158
- },
159
- "type": {
160
- "type": "string",
161
- "enum": [
162
- "string",
163
- "number",
164
- "boolean",
165
- "select"
166
- ],
167
- "description": "Setting type"
168
- },
169
- "default": {
170
- "description": "Default value"
171
- },
172
- "options": {
173
- "type": "array",
174
- "items": {
175
- "type": "object",
176
- "properties": {
177
- "value": {
178
- "type": "string"
179
- },
180
- "label": {
181
- "type": "string"
182
- }
183
- },
184
- "required": [
185
- "value",
186
- "label"
187
- ],
188
- "additionalProperties": false
189
- },
190
- "description": "For select type: available options"
191
- },
192
- "optionsToolId": {
193
- "type": "string",
194
- "description": "For select type: load options from tool"
195
- },
196
- "optionsParams": {
197
- "type": "object",
198
- "additionalProperties": {},
199
- "description": "Params for options tool"
200
- },
201
- "optionsMapping": {
202
- "type": "object",
203
- "properties": {
204
- "itemsKey": {
205
- "type": "string",
206
- "description": "Key for items array in tool result data"
207
- },
208
- "valueKey": {
209
- "type": "string",
210
- "description": "Key for option value"
211
- },
212
- "labelKey": {
213
- "type": "string",
214
- "description": "Key for option label"
215
- },
216
- "descriptionKey": {
217
- "type": "string",
218
- "description": "Optional key for description"
219
- }
220
- },
221
- "required": [
222
- "itemsKey",
223
- "valueKey",
224
- "labelKey"
225
- ],
226
- "additionalProperties": false,
227
- "description": "Mapping for options tool response"
228
- },
229
- "createToolId": {
230
- "type": "string",
231
- "description": "Tool ID for creating a new option"
232
- },
233
- "createLabel": {
234
- "type": "string",
235
- "description": "Label for create action"
236
- },
237
- "createFields": {
238
- "type": "array",
239
- "items": {
240
- "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/settings/items"
241
- },
242
- "description": "Fields for create form"
243
- },
244
- "createParams": {
245
- "type": "object",
246
- "additionalProperties": {},
247
- "description": "Static params for create tool"
248
- },
249
- "createMapping": {
250
- "type": "object",
251
- "properties": {
252
- "resultKey": {
253
- "type": "string",
254
- "description": "Key for result data object"
255
- },
256
- "valueKey": {
257
- "type": "string",
258
- "description": "Key for option value (defaults to \"id\")"
259
- }
260
- },
261
- "required": [
262
- "valueKey"
263
- ],
264
- "additionalProperties": false,
265
- "description": "Mapping for create tool response"
266
- },
267
- "validation": {
268
- "type": "object",
269
- "properties": {
270
- "required": {
271
- "type": "boolean",
272
- "description": "Whether the field is required"
273
- },
274
- "min": {
275
- "type": "number",
276
- "description": "Minimum value (number) or length (string)"
277
- },
278
- "max": {
279
- "type": "number",
280
- "description": "Maximum value (number) or length (string)"
281
- },
282
- "pattern": {
283
- "type": "string",
284
- "description": "Regex pattern for validation"
285
- }
286
- },
287
- "additionalProperties": false,
288
- "description": "Validation rules"
289
- }
290
- },
291
- "required": [
292
- "id",
293
- "title",
294
- "type"
295
- ],
296
- "additionalProperties": false,
297
- "description": "Setting definition"
298
- },
299
- "description": "User-configurable settings"
300
- },
301
142
  "toolSettings": {
302
143
  "type": "array",
303
144
  "items": {
@@ -393,6 +234,105 @@
393
234
  "type": "object",
394
235
  "additionalProperties": {},
395
236
  "description": "Static params for list tool"
237
+ },
238
+ "editView": {
239
+ "type": "object",
240
+ "properties": {
241
+ "content": {
242
+ "type": "object",
243
+ "properties": {
244
+ "component": {
245
+ "type": "string",
246
+ "description": "Component type name"
247
+ },
248
+ "style": {
249
+ "type": "object",
250
+ "additionalProperties": {
251
+ "type": "string"
252
+ },
253
+ "propertyNames": {
254
+ "enum": [
255
+ "color",
256
+ "background-color",
257
+ "background",
258
+ "border-color",
259
+ "border",
260
+ "border-width",
261
+ "border-style",
262
+ "border-radius",
263
+ "border-top",
264
+ "border-right",
265
+ "border-bottom",
266
+ "border-left",
267
+ "border-top-left-radius",
268
+ "border-top-right-radius",
269
+ "border-bottom-left-radius",
270
+ "border-bottom-right-radius",
271
+ "padding",
272
+ "padding-top",
273
+ "padding-right",
274
+ "padding-bottom",
275
+ "padding-left",
276
+ "margin",
277
+ "margin-top",
278
+ "margin-right",
279
+ "margin-bottom",
280
+ "margin-left",
281
+ "gap",
282
+ "row-gap",
283
+ "column-gap",
284
+ "font-size",
285
+ "font-weight",
286
+ "font-style",
287
+ "text-align",
288
+ "text-decoration",
289
+ "line-height",
290
+ "letter-spacing",
291
+ "white-space",
292
+ "word-break",
293
+ "overflow-wrap",
294
+ "width",
295
+ "height",
296
+ "min-width",
297
+ "min-height",
298
+ "max-width",
299
+ "max-height",
300
+ "flex",
301
+ "flex-grow",
302
+ "flex-shrink",
303
+ "flex-basis",
304
+ "flex-wrap",
305
+ "align-self",
306
+ "justify-self",
307
+ "align-items",
308
+ "justify-content",
309
+ "opacity",
310
+ "visibility",
311
+ "overflow",
312
+ "overflow-x",
313
+ "overflow-y",
314
+ "box-shadow",
315
+ "outline",
316
+ "cursor",
317
+ "border-collapse",
318
+ "border-spacing"
319
+ ]
320
+ },
321
+ "description": "Safe CSS styles for the component"
322
+ }
323
+ },
324
+ "required": [
325
+ "component"
326
+ ],
327
+ "additionalProperties": true,
328
+ "description": "Root component for the create/edit modal"
329
+ }
330
+ },
331
+ "required": [
332
+ "content"
333
+ ],
334
+ "additionalProperties": false,
335
+ "description": "Component-tree create/edit form bound to $item.<key>"
396
336
  }
397
337
  },
398
338
  "required": [
@@ -449,78 +389,7 @@
449
389
  "description": "Component type name"
450
390
  },
451
391
  "style": {
452
- "type": "object",
453
- "additionalProperties": {
454
- "type": "string"
455
- },
456
- "propertyNames": {
457
- "enum": [
458
- "color",
459
- "background-color",
460
- "background",
461
- "border-color",
462
- "border",
463
- "border-width",
464
- "border-style",
465
- "border-radius",
466
- "border-top",
467
- "border-right",
468
- "border-bottom",
469
- "border-left",
470
- "border-top-left-radius",
471
- "border-top-right-radius",
472
- "border-bottom-left-radius",
473
- "border-bottom-right-radius",
474
- "padding",
475
- "padding-top",
476
- "padding-right",
477
- "padding-bottom",
478
- "padding-left",
479
- "margin",
480
- "margin-top",
481
- "margin-right",
482
- "margin-bottom",
483
- "margin-left",
484
- "gap",
485
- "row-gap",
486
- "column-gap",
487
- "font-size",
488
- "font-weight",
489
- "font-style",
490
- "text-align",
491
- "text-decoration",
492
- "line-height",
493
- "letter-spacing",
494
- "white-space",
495
- "word-break",
496
- "overflow-wrap",
497
- "width",
498
- "height",
499
- "min-width",
500
- "min-height",
501
- "max-width",
502
- "max-height",
503
- "flex",
504
- "flex-grow",
505
- "flex-shrink",
506
- "flex-basis",
507
- "flex-wrap",
508
- "align-self",
509
- "justify-self",
510
- "align-items",
511
- "justify-content",
512
- "opacity",
513
- "visibility",
514
- "overflow",
515
- "overflow-x",
516
- "overflow-y",
517
- "box-shadow",
518
- "outline",
519
- "cursor",
520
- "border-collapse",
521
- "border-spacing"
522
- ]
523
- },
392
+ "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/toolSettings/items/properties/view/anyOf/0/properties/editView/properties/content/properties/style",
524
393
  "description": "Safe CSS styles for the component"
525
394
  }
526
395
  },
@@ -540,13 +409,6 @@
540
409
  }
541
410
  ],
542
411
  "description": "View configuration"
543
- },
544
- "fields": {
545
- "type": "array",
546
- "items": {
547
- "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/settings/items"
548
- },
549
- "description": "Fields for create/edit forms"
550
412
  }
551
413
  },
552
414
  "required": [
@@ -624,7 +486,7 @@
624
486
  "description": "Component type name"
625
487
  },
626
488
  "style": {
627
- "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/toolSettings/items/properties/view/anyOf/1/properties/content/properties/style",
489
+ "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/toolSettings/items/properties/view/anyOf/0/properties/editView/properties/content/properties/style",
628
490
  "description": "Safe CSS styles for the component"
629
491
  }
630
492
  },
@@ -696,118 +558,33 @@
696
558
  "additionalProperties": {},
697
559
  "description": "Default settings"
698
560
  },
699
- "configSchema": {
561
+ "configView": {
700
562
  "type": "object",
701
563
  "properties": {
702
- "properties": {
564
+ "content": {
703
565
  "type": "object",
704
- "additionalProperties": {
705
- "type": "object",
706
- "properties": {
707
- "type": {
708
- "type": "string",
709
- "enum": [
710
- "string",
711
- "number",
712
- "boolean",
713
- "select",
714
- "password",
715
- "url"
716
- ],
717
- "description": "Property type"
718
- },
719
- "title": {
720
- "type": "string",
721
- "description": "Display label"
722
- },
723
- "description": {
724
- "type": "string",
725
- "description": "Help text"
726
- },
727
- "default": {
728
- "description": "Default value"
729
- },
730
- "required": {
731
- "type": "boolean",
732
- "description": "Whether the field is required"
733
- },
734
- "placeholder": {
735
- "type": "string",
736
- "description": "Placeholder text"
737
- },
738
- "options": {
739
- "type": "array",
740
- "items": {
741
- "type": "object",
742
- "properties": {
743
- "value": {
744
- "type": "string",
745
- "description": "Value stored in settings"
746
- },
747
- "label": {
748
- "type": "string",
749
- "description": "Display label"
750
- }
751
- },
752
- "required": [
753
- "value",
754
- "label"
755
- ],
756
- "additionalProperties": false,
757
- "description": "Select option"
758
- },
759
- "description": "For select type"
760
- },
761
- "validation": {
762
- "type": "object",
763
- "properties": {
764
- "pattern": {
765
- "type": "string",
766
- "description": "Regex pattern the value must match"
767
- },
768
- "minLength": {
769
- "type": "number",
770
- "description": "Minimum string length"
771
- },
772
- "maxLength": {
773
- "type": "number",
774
- "description": "Maximum string length"
775
- },
776
- "min": {
777
- "type": "number",
778
- "description": "Minimum number value"
779
- },
780
- "max": {
781
- "type": "number",
782
- "description": "Maximum number value"
783
- }
784
- },
785
- "additionalProperties": false,
786
- "description": "Validation rules"
787
- }
566
+ "properties": {
567
+ "component": {
568
+ "type": "string",
569
+ "description": "Component type name"
788
570
  },
789
- "required": [
790
- "type",
791
- "title"
792
- ],
793
- "additionalProperties": false,
794
- "description": "Provider config property"
795
- },
796
- "description": "Property definitions"
797
- },
798
- "order": {
799
- "type": "array",
800
- "items": {
801
- "type": "string"
571
+ "style": {
572
+ "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/toolSettings/items/properties/view/anyOf/0/properties/editView/properties/content/properties/style",
573
+ "description": "Safe CSS styles for the component"
574
+ }
802
575
  },
803
- "description": "Display order of properties"
576
+ "required": [
577
+ "component"
578
+ ],
579
+ "additionalProperties": true,
580
+ "description": "Root component to render"
804
581
  }
805
582
  },
806
583
  "required": [
807
- "properties"
584
+ "content"
808
585
  ],
809
586
  "additionalProperties": false,
810
- "description": "Configuration UI schema"
587
+ "description": "Component-tree configuration view"
811
588
  }
812
589
  },
813
590
  "required": [
package/src/index.ts CHANGED
@@ -17,9 +17,6 @@ export type {
17
17
  ExtensionManifest,
18
18
  Platform,
19
19
  ExtensionContributions,
20
- SettingDefinition,
21
- SettingOptionsMapping,
22
- SettingCreateMapping,
23
20
  ToolSettingsViewDefinition,
24
21
  ToolSettingsView,
25
22
  ToolSettingsListView,
@@ -32,19 +29,13 @@ export type {
32
29
  PanelActionDataSource,
33
30
  PanelUnknownView,
34
31
  ProviderDefinition,
32
+ ProviderConfigView,
35
33
  PromptContribution,
36
34
  PromptSection,
37
35
  ToolDefinition,
38
36
  ToolConfirmationConfig,
39
37
  CommandDefinition,
40
38
 
41
- // Provider Configuration Schema
42
- ProviderConfigSchema,
43
- ProviderConfigProperty,
44
- ProviderConfigPropertyType,
45
- ProviderConfigSelectOption,
46
- ProviderConfigValidation,
47
-
48
39
  // Permissions
49
40
  Permission,
50
41
  NetworkPermission,
@@ -166,6 +157,9 @@ export type {
166
157
  ParagraphProps,
167
158
  ButtonProps,
168
159
  TextInputProps,
160
+ PasswordInputProps,
161
+ NumberInputProps,
162
+ TextAreaProps,
169
163
  DateTimeInputProps,
170
164
  SelectProps,
171
165
  IconPickerProps,
@@ -210,6 +210,9 @@ export const ButtonPropsSchema = z
210
210
  .object({
211
211
  component: z.literal('Button'),
212
212
  text: z.string().describe('Button text'),
213
+ type: z.enum(['normal', 'primary', 'danger', 'accent']).optional().describe('Visual style'),
214
+ title: z.string().optional().describe('Tooltip shown on hover'),
215
+ disabled: z.boolean().optional().describe('Disable the button'),
213
216
  onClickAction: ExtensionActionRefSchema.describe('Action to call on click'),
214
217
  style: ExtensionComponentStyleSchema.optional(),
215
218
  })
@@ -222,18 +225,58 @@ export const TextInputPropsSchema = z
222
225
  label: z.string().describe('Input label'),
223
226
  placeholder: z.string().optional().describe('Placeholder text'),
224
227
  value: z.string().optional().describe('Current value'),
225
- onChangeAction: ExtensionActionRefSchema.describe('Action to call on change'),
228
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
226
229
  style: ExtensionComponentStyleSchema.optional(),
227
230
  })
228
231
  .passthrough()
229
232
  .describe('TextInput component')
230
233
 
234
+ export const PasswordInputPropsSchema = z
235
+ .object({
236
+ component: z.literal('PasswordInput'),
237
+ label: z.string().describe('Input label'),
238
+ placeholder: z.string().optional().describe('Placeholder text'),
239
+ value: z.string().optional().describe('Current value'),
240
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
241
+ style: ExtensionComponentStyleSchema.optional(),
242
+ })
243
+ .passthrough()
244
+ .describe('Password input component (text is masked)')
245
+
246
+ export const NumberInputPropsSchema = z
247
+ .object({
248
+ component: z.literal('NumberInput'),
249
+ label: z.string().describe('Input label'),
250
+ placeholder: z.string().optional().describe('Placeholder text'),
251
+ value: z.union([z.string(), z.number()]).optional().describe('Current value'),
252
+ min: z.number().optional().describe('Minimum value'),
253
+ max: z.number().optional().describe('Maximum value'),
254
+ step: z.number().optional().describe('Step'),
255
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
256
+ style: ExtensionComponentStyleSchema.optional(),
257
+ })
258
+ .passthrough()
259
+ .describe('Numeric input component')
260
+
261
+ export const TextAreaPropsSchema = z
262
+ .object({
263
+ component: z.literal('TextArea'),
264
+ label: z.string().describe('Input label'),
265
+ placeholder: z.string().optional().describe('Placeholder text'),
266
+ value: z.string().optional().describe('Current value'),
267
+ rows: z.number().int().positive().optional().describe('Number of visible text rows'),
268
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
269
+ style: ExtensionComponentStyleSchema.optional(),
270
+ })
271
+ .passthrough()
272
+ .describe('TextArea component for multi-line text input')
273
+
231
274
  export const DateTimeInputPropsSchema = z
232
275
  .object({
233
276
  component: z.literal('DateTimeInput'),
234
277
  label: z.string().describe('Input label'),
235
278
  value: z.string().optional().describe('Current value'),
236
- onChangeAction: ExtensionActionRefSchema.describe('Action to call on change'),
279
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
237
280
  style: ExtensionComponentStyleSchema.optional(),
238
281
  })
239
282
  .passthrough()
@@ -245,7 +288,7 @@ export const SelectPropsSchema = z
245
288
  label: z.string().describe('Select label'),
246
289
  options: z.array(z.object({ label: z.string(), value: z.string() })).describe('Available options'),
247
290
  selectedValue: z.string().optional().describe('Currently selected value'),
248
- onChangeAction: ExtensionActionRefSchema.describe('Action to call on change'),
291
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
249
292
  style: ExtensionComponentStyleSchema.optional(),
250
293
  })
251
294
  .passthrough()
@@ -256,7 +299,7 @@ export const IconPickerPropsSchema = z
256
299
  component: z.literal('IconPicker'),
257
300
  label: z.string().optional().describe('Picker label'),
258
301
  value: z.string().optional().describe('Currently selected icon name'),
259
- onChangeAction: ExtensionActionRefSchema.describe('Action to call on change'),
302
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
260
303
  style: ExtensionComponentStyleSchema.optional(),
261
304
  })
262
305
  .passthrough()
@@ -358,7 +401,7 @@ export const TogglePropsSchema = z
358
401
  description: z.string().optional().describe('Description text'),
359
402
  checked: z.boolean().optional().describe('Whether the toggle is checked'),
360
403
  disabled: z.boolean().optional().describe('Whether the toggle is disabled'),
361
- onChangeAction: ExtensionActionRefSchema.describe('Action to call on change'),
404
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
362
405
  style: ExtensionComponentStyleSchema.optional(),
363
406
  })
364
407
  .passthrough()
@@ -399,7 +442,7 @@ export const CheckboxPropsSchema = z
399
442
  checked: z.boolean().optional().describe('Whether the checkbox is checked'),
400
443
  disabled: z.boolean().optional().describe('Whether the checkbox is disabled'),
401
444
  strikethrough: z.boolean().optional().describe('Strike through label when checked'),
402
- onChangeAction: ExtensionActionRefSchema.describe('Action to call on change'),
445
+ onChangeAction: ExtensionActionRefSchema.optional().describe('Action to call on change'),
403
446
  style: ExtensionComponentStyleSchema.optional(),
404
447
  })
405
448
  .passthrough()
@@ -495,6 +538,9 @@ export type LabelProps = z.infer<typeof LabelPropsSchema>
495
538
  export type ParagraphProps = z.infer<typeof ParagraphPropsSchema>
496
539
  export type ButtonProps = z.infer<typeof ButtonPropsSchema>
497
540
  export type TextInputProps = z.infer<typeof TextInputPropsSchema>
541
+ export type PasswordInputProps = z.infer<typeof PasswordInputPropsSchema>
542
+ export type NumberInputProps = z.infer<typeof NumberInputPropsSchema>
543
+ export type TextAreaProps = z.infer<typeof TextAreaPropsSchema>
498
544
  export type DateTimeInputProps = z.infer<typeof DateTimeInputPropsSchema>
499
545
  export type SelectProps = z.infer<typeof SelectPropsSchema>
500
546
  export type IconPickerProps = z.infer<typeof IconPickerPropsSchema>