@choiceopen/atomemo-plugin-schema 0.1.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.
- package/README.md +37 -0
- package/dist/schemas.d.ts +12018 -0
- package/dist/schemas.js +532 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types-CpQliD1G.d.ts +702 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +0 -0
- package/package.json +66 -0
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IntRange, JsonObject, JsonValue, LiteralUnion } from "type-fest";
|
|
3
|
+
|
|
4
|
+
//#region src/types/common.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* I18n Entry
|
|
7
|
+
*/
|
|
8
|
+
interface I18nText {
|
|
9
|
+
/**
|
|
10
|
+
* English is required
|
|
11
|
+
*/
|
|
12
|
+
en_US: string;
|
|
13
|
+
[locale: `${LiteralUnion<"zh_Hans", string>}_${string}`]: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/utils/custom-json-value.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Custom JSON Value Schema
|
|
19
|
+
* @description Custom JSON Value Schema is a schema that allows any JSON value
|
|
20
|
+
*/
|
|
21
|
+
declare const JsonValueSchema: z.ZodJSONSchema;
|
|
22
|
+
/**
|
|
23
|
+
* Custom JSON Value Type
|
|
24
|
+
* @description Custom JSON Value Type is the type of the JSON value
|
|
25
|
+
*/
|
|
26
|
+
type JsonValue$1 = z.infer<typeof JsonValueSchema>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/types/property-ui.d.ts
|
|
29
|
+
interface PropertyUIOption {
|
|
30
|
+
/**
|
|
31
|
+
* The icon of the option
|
|
32
|
+
*/
|
|
33
|
+
icon?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The label of the option
|
|
36
|
+
*/
|
|
37
|
+
label: I18nText;
|
|
38
|
+
/**
|
|
39
|
+
* The value of the option
|
|
40
|
+
*/
|
|
41
|
+
value: string | number | boolean;
|
|
42
|
+
}
|
|
43
|
+
interface PropertyUICommonProps {
|
|
44
|
+
/**
|
|
45
|
+
* Whether the component is disabled
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The hint of the component
|
|
50
|
+
*/
|
|
51
|
+
hint?: I18nText;
|
|
52
|
+
/**
|
|
53
|
+
* The placeholder of the component
|
|
54
|
+
*/
|
|
55
|
+
placeholder?: I18nText;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the component is readonly
|
|
58
|
+
*/
|
|
59
|
+
readonly?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the component is sensitive
|
|
62
|
+
*/
|
|
63
|
+
sensitive?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the component supports expression
|
|
66
|
+
*/
|
|
67
|
+
support_expression?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The width of the component
|
|
70
|
+
*/
|
|
71
|
+
width?: "small" | "medium" | "full";
|
|
72
|
+
/**
|
|
73
|
+
* how many spaces to use for indentation in components
|
|
74
|
+
* @default undefined
|
|
75
|
+
* calculation rule: (4 * indentation)px
|
|
76
|
+
*/
|
|
77
|
+
indentation?: IntRange<2, 81, 2>;
|
|
78
|
+
/**
|
|
79
|
+
* Hide the component in the UI while preserving its value.
|
|
80
|
+
* Often used in combination with constant of Property to create hidden fields.
|
|
81
|
+
* - Layout behavior: behaves like CSS `display: none` (no space is reserved).
|
|
82
|
+
* - Data behavior: the underlying value is kept, included in serialization, and validated normally.
|
|
83
|
+
* @default false
|
|
84
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/display#none.
|
|
85
|
+
*/
|
|
86
|
+
display_none?: boolean;
|
|
87
|
+
}
|
|
88
|
+
interface PropertyUIEncryptedInputProps extends PropertyUICommonProps {
|
|
89
|
+
component: "encrypted-input";
|
|
90
|
+
}
|
|
91
|
+
type PropertyUIEncryptedString = PropertyUIEncryptedInputProps;
|
|
92
|
+
/** 输入框 UI 属性 */
|
|
93
|
+
interface PropertyUIInputProps extends PropertyUICommonProps {
|
|
94
|
+
component: "input";
|
|
95
|
+
}
|
|
96
|
+
/** 文本域 UI 属性 */
|
|
97
|
+
interface PropertyUITextareaProps extends PropertyUICommonProps {
|
|
98
|
+
component: "textarea";
|
|
99
|
+
max_height?: number;
|
|
100
|
+
min_height?: number;
|
|
101
|
+
}
|
|
102
|
+
/** 表达式输入框 UI 属性 */
|
|
103
|
+
interface PropertyUIExpressionInputProps extends PropertyUICommonProps {
|
|
104
|
+
component: "expression-input" | "expression-textarea";
|
|
105
|
+
max_height?: number;
|
|
106
|
+
min_height?: number;
|
|
107
|
+
}
|
|
108
|
+
/** 数字输入框 UI 属性 */
|
|
109
|
+
interface PropertyUINumberInputProps extends PropertyUICommonProps {
|
|
110
|
+
component: "number-input";
|
|
111
|
+
step?: number;
|
|
112
|
+
suffix?: string;
|
|
113
|
+
}
|
|
114
|
+
/** 代码编辑器 UI 属性 */
|
|
115
|
+
interface PropertyUICodeEditorProps extends PropertyUICommonProps {
|
|
116
|
+
component: "code-editor";
|
|
117
|
+
language?: "json" | "javascript" | "python3" | "html";
|
|
118
|
+
line_numbers?: boolean;
|
|
119
|
+
max_height?: number;
|
|
120
|
+
min_height?: number;
|
|
121
|
+
}
|
|
122
|
+
interface PropertyUISelectPropsBase {
|
|
123
|
+
clearable?: boolean;
|
|
124
|
+
options?: Array<PropertyUIOption>;
|
|
125
|
+
searchable?: boolean;
|
|
126
|
+
}
|
|
127
|
+
interface PropertyUISingleSelectProps extends PropertyUICommonProps, PropertyUISelectPropsBase {
|
|
128
|
+
component: "select";
|
|
129
|
+
}
|
|
130
|
+
interface PropertyUIRadioGroupProps extends PropertyUICommonProps, PropertyUISelectPropsBase {
|
|
131
|
+
component: "radio-group";
|
|
132
|
+
}
|
|
133
|
+
interface PropertyUIEmojiPickerProps extends PropertyUICommonProps {
|
|
134
|
+
component: "emoji-picker";
|
|
135
|
+
size?: "extra-small" | "small" | "medium" | "large";
|
|
136
|
+
}
|
|
137
|
+
interface PropertyUIColorPickerProps extends PropertyUICommonProps {
|
|
138
|
+
component: "color-picker";
|
|
139
|
+
}
|
|
140
|
+
interface PropertyUIMultiSelectProps extends PropertyUICommonProps, PropertyUISelectPropsBase {
|
|
141
|
+
component: "multi-select";
|
|
142
|
+
}
|
|
143
|
+
interface PropertyUISwitchProps extends PropertyUICommonProps {
|
|
144
|
+
component: "switch";
|
|
145
|
+
}
|
|
146
|
+
interface PropertyUICheckboxProps extends PropertyUICommonProps {
|
|
147
|
+
component: "checkbox";
|
|
148
|
+
}
|
|
149
|
+
interface PropertyUISliderProps extends PropertyUICommonProps {
|
|
150
|
+
component: "slider";
|
|
151
|
+
marks?: Record<number, string>;
|
|
152
|
+
show_value?: boolean;
|
|
153
|
+
step?: number;
|
|
154
|
+
}
|
|
155
|
+
/** Key/value pair editor UI. Supports Array<{name: string, value: string}> only. */
|
|
156
|
+
interface PropertyUIKeyValueEditorProps extends PropertyUICommonProps {
|
|
157
|
+
/** Custom text for the add button. */
|
|
158
|
+
add_button_label?: I18nText;
|
|
159
|
+
/**
|
|
160
|
+
* Item definition of PropertyArray is ignored for this UI; it always renders name/value pairs.
|
|
161
|
+
*/
|
|
162
|
+
component: "key-value-editor";
|
|
163
|
+
/** Description displayed when the list is empty. */
|
|
164
|
+
empty_description?: I18nText;
|
|
165
|
+
/** Optional header text shown above the list. */
|
|
166
|
+
section_header?: I18nText;
|
|
167
|
+
}
|
|
168
|
+
interface PropertyUITagInputProps extends PropertyUICommonProps {
|
|
169
|
+
component: "tag-input";
|
|
170
|
+
}
|
|
171
|
+
interface PropertyUICredentialSelectProps extends PropertyUICommonProps {
|
|
172
|
+
clearable?: boolean;
|
|
173
|
+
component: "credential-select";
|
|
174
|
+
searchable?: boolean;
|
|
175
|
+
}
|
|
176
|
+
interface PropertyUIJsonSchemaEditorProps extends PropertyUICommonProps {
|
|
177
|
+
component: "json-schema-editor";
|
|
178
|
+
}
|
|
179
|
+
interface PropertyUIConditionsEditorProps extends PropertyUICommonProps {
|
|
180
|
+
component: "conditions-editor";
|
|
181
|
+
}
|
|
182
|
+
interface PropertyUIArraySectionProps extends PropertyUICommonProps {
|
|
183
|
+
add_label?: I18nText;
|
|
184
|
+
collapsible?: boolean;
|
|
185
|
+
component: "array-section";
|
|
186
|
+
empty_message?: I18nText;
|
|
187
|
+
remove_tooltip?: I18nText;
|
|
188
|
+
sortable?: boolean;
|
|
189
|
+
}
|
|
190
|
+
interface PropertyUICollapsiblePanelProps extends PropertyUICommonProps {
|
|
191
|
+
collapsible?: boolean;
|
|
192
|
+
component: "collapsible-panel";
|
|
193
|
+
default_collapsed?: boolean;
|
|
194
|
+
panel_title?: I18nText;
|
|
195
|
+
remove_tooltip?: I18nText;
|
|
196
|
+
sortable?: boolean;
|
|
197
|
+
}
|
|
198
|
+
type PropertyUIProps = PropertyUIInputProps | PropertyUITextareaProps | PropertyUIExpressionInputProps | PropertyUINumberInputProps | PropertyUICodeEditorProps | PropertyUISingleSelectProps | PropertyUIRadioGroupProps | PropertyUIEmojiPickerProps | PropertyUIColorPickerProps | PropertyUIMultiSelectProps | PropertyUISwitchProps | PropertyUICheckboxProps | PropertyUISliderProps | PropertyUIKeyValueEditorProps | PropertyUITagInputProps | PropertyUICredentialSelectProps | PropertyUIJsonSchemaEditorProps | PropertyUIConditionsEditorProps | PropertyUIArraySectionProps | PropertyUICollapsiblePanelProps | PropertyUIEncryptedInputProps;
|
|
199
|
+
type PropertyUIComponentType = PropertyUIProps["component"];
|
|
200
|
+
type PropertyUIBoolean = PropertyUISwitchProps | PropertyUICheckboxProps;
|
|
201
|
+
type PropertyUINumber = PropertyUINumberInputProps | PropertyUISliderProps;
|
|
202
|
+
type PropertyUIString = PropertyUIInputProps | PropertyUITextareaProps | PropertyUIExpressionInputProps | PropertyUICodeEditorProps | PropertyUISingleSelectProps | PropertyUICredentialSelectProps | PropertyUIRadioGroupProps | PropertyUIEmojiPickerProps | PropertyUIColorPickerProps;
|
|
203
|
+
type PropertyUIArray = PropertyUIMultiSelectProps | PropertyUITagInputProps | PropertyUIKeyValueEditorProps | PropertyUISliderProps | PropertyUIArraySectionProps;
|
|
204
|
+
type PropertyUIContainer = PropertyUICollapsiblePanelProps;
|
|
205
|
+
type PropertyUIMisc = PropertyUIJsonSchemaEditorProps | PropertyUIConditionsEditorProps;
|
|
206
|
+
type PropertyUIObject = PropertyUIContainer | PropertyUIMisc | PropertyUICodeEditorProps;
|
|
207
|
+
type PropertyUICredentialId = PropertyUICredentialSelectProps;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/types/property.d.ts
|
|
210
|
+
/**
|
|
211
|
+
* Condition for controlling property visibility based on sibling property values
|
|
212
|
+
* @template TSchema - Parent schema containing all sibling properties
|
|
213
|
+
*/
|
|
214
|
+
type DisplayCondition<TSchema extends JsonObject = JsonObject> =
|
|
215
|
+
/**
|
|
216
|
+
* Direct property conditions: supports nested paths (e.g., "address.city")
|
|
217
|
+
*/
|
|
218
|
+
{ [P in keyof TSchema]?: Condition<TSchema[P]> }
|
|
219
|
+
/**
|
|
220
|
+
* Logical operators for combining multiple conditions
|
|
221
|
+
*/ | RootFilter<TSchema>;
|
|
222
|
+
/**
|
|
223
|
+
* Root Filter Operators for group conditions
|
|
224
|
+
*/
|
|
225
|
+
interface RootFilter<TSchema extends JsonObject = JsonObject> {
|
|
226
|
+
/**
|
|
227
|
+
* Joins conditions with logical AND; all conditions must be true
|
|
228
|
+
*/
|
|
229
|
+
$and?: Array<DisplayCondition<TSchema>>;
|
|
230
|
+
/**
|
|
231
|
+
* Joins conditions with logical NOR; none of the conditions must be true
|
|
232
|
+
*/
|
|
233
|
+
$nor?: Array<DisplayCondition<TSchema>>;
|
|
234
|
+
/**
|
|
235
|
+
* Joins conditions with logical OR; at least one condition must be true
|
|
236
|
+
*/
|
|
237
|
+
$or?: Array<DisplayCondition<TSchema>>;
|
|
238
|
+
}
|
|
239
|
+
type Condition<T extends JsonValue = JsonValue> = T | FilterOperators<T>;
|
|
240
|
+
/**
|
|
241
|
+
* Filter Operators
|
|
242
|
+
* reference: https://www.mongodb.com/docs/manual/reference/mql/query-predicates/
|
|
243
|
+
*/
|
|
244
|
+
interface FilterOperators<TValue extends JsonValue = JsonValue> {
|
|
245
|
+
/**
|
|
246
|
+
* Matches values equal to a specified value
|
|
247
|
+
*/
|
|
248
|
+
$eq?: TValue;
|
|
249
|
+
/**
|
|
250
|
+
* Checks if a field exists
|
|
251
|
+
*/
|
|
252
|
+
$exists?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Matches values greater than a specified value
|
|
255
|
+
*/
|
|
256
|
+
$gt?: TValue;
|
|
257
|
+
/**
|
|
258
|
+
* Matches values greater than or equal to a specified value
|
|
259
|
+
*/
|
|
260
|
+
$gte?: TValue;
|
|
261
|
+
/**
|
|
262
|
+
* Matches any value specified in an array
|
|
263
|
+
*/
|
|
264
|
+
$in?: Array<TValue>;
|
|
265
|
+
/**
|
|
266
|
+
* Matches values less than a specified value
|
|
267
|
+
*/
|
|
268
|
+
$lt?: TValue;
|
|
269
|
+
/**
|
|
270
|
+
* Matches values less than or equal to a specified value
|
|
271
|
+
*/
|
|
272
|
+
$lte?: TValue;
|
|
273
|
+
/**
|
|
274
|
+
* Matches values based on a modulo operation; value: [divisor, remainder]
|
|
275
|
+
*/
|
|
276
|
+
$mod?: TValue extends number ? [number, number] : never;
|
|
277
|
+
/**
|
|
278
|
+
* Matches values not equal to a specified value
|
|
279
|
+
*/
|
|
280
|
+
$ne?: TValue;
|
|
281
|
+
/**
|
|
282
|
+
* Matches values not in a specified array
|
|
283
|
+
*/
|
|
284
|
+
$nin?: Array<TValue>;
|
|
285
|
+
/**
|
|
286
|
+
* Regex options: i=case-insensitive, m=multiline, x=ignore whitespace, s=dotAll, u=unicode
|
|
287
|
+
*/
|
|
288
|
+
$options?: TValue extends string ? string : never;
|
|
289
|
+
/**
|
|
290
|
+
* Matches values against a regular expression pattern
|
|
291
|
+
*/
|
|
292
|
+
$regex?: TValue extends string ? RegExp | string : never;
|
|
293
|
+
/**
|
|
294
|
+
* Matches arrays with a specified number of elements
|
|
295
|
+
*/
|
|
296
|
+
$size?: TValue extends Array<unknown> ? number : never;
|
|
297
|
+
}
|
|
298
|
+
interface PropertyBase<TName extends string = string> {
|
|
299
|
+
/**
|
|
300
|
+
* Unique property name within the same level
|
|
301
|
+
*/
|
|
302
|
+
name: TName;
|
|
303
|
+
/**
|
|
304
|
+
* Display name (supports i18n)
|
|
305
|
+
*/
|
|
306
|
+
display_name?: I18nText;
|
|
307
|
+
/**
|
|
308
|
+
* Whether this property is required
|
|
309
|
+
*/
|
|
310
|
+
required?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Display condition; if not set, property is always visible
|
|
313
|
+
*/
|
|
314
|
+
display?: {
|
|
315
|
+
hide?: DisplayCondition;
|
|
316
|
+
show?: DisplayCondition;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* AI-related configuration
|
|
320
|
+
*/
|
|
321
|
+
ai?: {
|
|
322
|
+
llm_description?: I18nText;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* UI configuration for how the property is displayed
|
|
326
|
+
*/
|
|
327
|
+
ui?: PropertyUICommonProps;
|
|
328
|
+
}
|
|
329
|
+
interface PropertyString<TName extends string = string> extends PropertyBase<TName> {
|
|
330
|
+
type: "string";
|
|
331
|
+
/**
|
|
332
|
+
* Restrict value to a single constant
|
|
333
|
+
*/
|
|
334
|
+
constant?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Default value when not specified
|
|
337
|
+
*/
|
|
338
|
+
default?: string;
|
|
339
|
+
/**
|
|
340
|
+
* Restrict value to a set of allowed values
|
|
341
|
+
*/
|
|
342
|
+
enum?: Array<string>;
|
|
343
|
+
/**
|
|
344
|
+
* Maximum string length
|
|
345
|
+
*/
|
|
346
|
+
max_length?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Minimum string length
|
|
349
|
+
*/
|
|
350
|
+
min_length?: number;
|
|
351
|
+
ui?: PropertyUIString;
|
|
352
|
+
}
|
|
353
|
+
interface PropertyNumber<TName extends string = string> extends PropertyBase<TName> {
|
|
354
|
+
type: "number" | "integer";
|
|
355
|
+
/**
|
|
356
|
+
* Restrict value to a single constant
|
|
357
|
+
*/
|
|
358
|
+
constant?: number;
|
|
359
|
+
/**
|
|
360
|
+
* Default value when not specified
|
|
361
|
+
*/
|
|
362
|
+
default?: number;
|
|
363
|
+
/**
|
|
364
|
+
* Restrict value to a set of allowed values
|
|
365
|
+
*/
|
|
366
|
+
enum?: Array<number>;
|
|
367
|
+
/**
|
|
368
|
+
* Maximum value (inclusive)
|
|
369
|
+
*/
|
|
370
|
+
maximum?: number;
|
|
371
|
+
/**
|
|
372
|
+
* Minimum value (inclusive)
|
|
373
|
+
*/
|
|
374
|
+
minimum?: number;
|
|
375
|
+
ui?: PropertyUINumber;
|
|
376
|
+
}
|
|
377
|
+
interface PropertyBoolean<TName extends string = string> extends PropertyBase<TName> {
|
|
378
|
+
type: "boolean";
|
|
379
|
+
/**
|
|
380
|
+
* Restrict value to a single constant
|
|
381
|
+
*/
|
|
382
|
+
constant?: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Default value when not specified
|
|
385
|
+
*/
|
|
386
|
+
default?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Restrict value to a set of allowed values
|
|
389
|
+
*/
|
|
390
|
+
enum?: Array<boolean>;
|
|
391
|
+
ui?: PropertyUIBoolean;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Object Property Type
|
|
395
|
+
* @template TName - Type of the property name
|
|
396
|
+
* @template TDiscriminator - When PropertyObject is used as a variant(any_of) in PropertyDiscriminatedUnion, this type represents the discriminator property name
|
|
397
|
+
* @template TValue - real value type of the object property
|
|
398
|
+
*/
|
|
399
|
+
interface PropertyObject<TName extends string = string, TDiscriminator extends string = string, TValue extends Record<string, JsonValue> = Record<string, JsonValue>> extends PropertyBase<TName> {
|
|
400
|
+
type: "object";
|
|
401
|
+
/**
|
|
402
|
+
* Child properties of the object
|
|
403
|
+
*/
|
|
404
|
+
properties: string extends TDiscriminator ? Array<Property<TValue extends Record<string, JsonValue> ? Exclude<keyof TValue, number> : string>> : [Property<TDiscriminator> & {
|
|
405
|
+
constant: TValue[TDiscriminator];
|
|
406
|
+
}, ...Array<Property<TValue extends Record<string, JsonValue> ? Exclude<keyof TValue, number> : string>>];
|
|
407
|
+
/**
|
|
408
|
+
* Restrict value to a single constant
|
|
409
|
+
*/
|
|
410
|
+
constant?: TValue;
|
|
411
|
+
/**
|
|
412
|
+
* Default value when not specified
|
|
413
|
+
*/
|
|
414
|
+
default?: TValue;
|
|
415
|
+
/**
|
|
416
|
+
* Restrict value to a set of allowed values
|
|
417
|
+
*/
|
|
418
|
+
enum?: Array<TValue>;
|
|
419
|
+
/**
|
|
420
|
+
* Schema for additional properties beyond those defined in `properties`.
|
|
421
|
+
* Supports dynamic keys with values conforming to the specified property schema.
|
|
422
|
+
* Semantics similar to JSON Schema's additionalProperties: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-02#additionalProperties
|
|
423
|
+
*/
|
|
424
|
+
additional_properties?: Property;
|
|
425
|
+
ui?: PropertyUIObject;
|
|
426
|
+
}
|
|
427
|
+
interface PropertyDiscriminatedUnion<TName extends string = string, TDiscriminator extends string = string> extends PropertyBase<TName> {
|
|
428
|
+
type: "discriminated_union";
|
|
429
|
+
/**
|
|
430
|
+
* Possible object types in the array.
|
|
431
|
+
*/
|
|
432
|
+
any_of: Array<PropertyObject<string, TDiscriminator>>;
|
|
433
|
+
/**
|
|
434
|
+
* Property name used to discriminate between types
|
|
435
|
+
*/
|
|
436
|
+
discriminator: TDiscriminator;
|
|
437
|
+
/**
|
|
438
|
+
* UI component for displaying the discriminator field
|
|
439
|
+
*/
|
|
440
|
+
discriminator_ui?: PropertyUISwitchProps | PropertyUISingleSelectProps | PropertyUIRadioGroupProps;
|
|
441
|
+
ui?: PropertyUICollapsiblePanelProps;
|
|
442
|
+
}
|
|
443
|
+
interface PropertyArray<TName extends string = string> extends PropertyBase<TName> {
|
|
444
|
+
type: "array";
|
|
445
|
+
constant?: Array<JsonValue>;
|
|
446
|
+
default?: Array<JsonValue>;
|
|
447
|
+
enum?: Array<Array<JsonValue>>;
|
|
448
|
+
/**
|
|
449
|
+
* Item schema for array elements
|
|
450
|
+
*/
|
|
451
|
+
items: Property;
|
|
452
|
+
/**
|
|
453
|
+
* Maximum array size (inclusive)
|
|
454
|
+
*/
|
|
455
|
+
max_items?: number;
|
|
456
|
+
/**
|
|
457
|
+
* Minimum array size (inclusive)
|
|
458
|
+
*/
|
|
459
|
+
min_items?: number;
|
|
460
|
+
ui?: PropertyUIArray;
|
|
461
|
+
}
|
|
462
|
+
interface PropertyCredentialId<TName extends string = string> extends PropertyBase<TName> {
|
|
463
|
+
type: "credential_id";
|
|
464
|
+
/**
|
|
465
|
+
* This field is used to map to the credential name defined in the plugin.
|
|
466
|
+
*
|
|
467
|
+
* **Note:** The name must match exactly, otherwise the system will be unable to find the corresponding credential.
|
|
468
|
+
*/
|
|
469
|
+
credential_name: string;
|
|
470
|
+
ui?: PropertyUICredentialId;
|
|
471
|
+
}
|
|
472
|
+
interface PropertyEncryptedString<TName extends string = string> extends PropertyBase<TName> {
|
|
473
|
+
type: "encrypted_string";
|
|
474
|
+
ui?: PropertyUIEncryptedString;
|
|
475
|
+
}
|
|
476
|
+
type Property<TName extends string = string, TValue extends JsonValue = JsonValue> = PropertyArray<TName> | PropertyObject<TName, string, TValue extends JsonObject ? TValue : JsonObject> | PropertyString<TName> | PropertyBoolean<TName> | PropertyNumber<TName> | PropertyCredentialId<TName> | PropertyEncryptedString<TName> | PropertyDiscriminatedUnion<TName, string>;
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/types/definition.d.ts
|
|
479
|
+
interface BaseDefinition {
|
|
480
|
+
/**
|
|
481
|
+
* Name
|
|
482
|
+
*/
|
|
483
|
+
name: string;
|
|
484
|
+
/**
|
|
485
|
+
* Display name
|
|
486
|
+
*/
|
|
487
|
+
display_name: I18nText;
|
|
488
|
+
/**
|
|
489
|
+
* Description
|
|
490
|
+
*/
|
|
491
|
+
description: I18nText;
|
|
492
|
+
/**
|
|
493
|
+
* Icon, allowed to use Emoji or URL address
|
|
494
|
+
*/
|
|
495
|
+
icon: string;
|
|
496
|
+
/**
|
|
497
|
+
* Parameters
|
|
498
|
+
*/
|
|
499
|
+
parameters: Array<Property>;
|
|
500
|
+
/**
|
|
501
|
+
* Settings
|
|
502
|
+
*/
|
|
503
|
+
settings?: Array<Property>;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Plugin definition
|
|
507
|
+
*/
|
|
508
|
+
interface PluginDefinition<Locales extends string[], TransporterOptions> extends Omit<BaseDefinition, "parameters" | "settings"> {
|
|
509
|
+
/**
|
|
510
|
+
* The locales to support. Defaults to ["en_US"].
|
|
511
|
+
*/
|
|
512
|
+
locales: Locales;
|
|
513
|
+
/**
|
|
514
|
+
* The author's name of the plugin.
|
|
515
|
+
*/
|
|
516
|
+
author: string;
|
|
517
|
+
/**
|
|
518
|
+
* The author's email address.
|
|
519
|
+
*/
|
|
520
|
+
email: string;
|
|
521
|
+
/**
|
|
522
|
+
* The source URL of the plugin.
|
|
523
|
+
*/
|
|
524
|
+
repo?: string;
|
|
525
|
+
/**
|
|
526
|
+
* The version of the plugin.
|
|
527
|
+
*
|
|
528
|
+
* If you do not provide this value, it will fallback to the version field in your package.json file.
|
|
529
|
+
*
|
|
530
|
+
* We recommend doing it this way, but if you do provide this value, please ensure that it remains consistent with the version field in package.json.
|
|
531
|
+
*/
|
|
532
|
+
version?: string;
|
|
533
|
+
/**
|
|
534
|
+
* The options for the transporter.
|
|
535
|
+
*/
|
|
536
|
+
transporterOptions?: TransporterOptions;
|
|
537
|
+
}
|
|
538
|
+
type Feature = CredentialDefinition | DataSourceDefinition | ModelDefinition | ToolDefinition;
|
|
539
|
+
/**
|
|
540
|
+
* Credential definition
|
|
541
|
+
*/
|
|
542
|
+
interface CredentialDefinition extends Omit<BaseDefinition, "settings"> {}
|
|
543
|
+
/**
|
|
544
|
+
* DataSource definition
|
|
545
|
+
*/
|
|
546
|
+
interface DataSourceDefinition extends BaseDefinition {}
|
|
547
|
+
/**
|
|
548
|
+
* Model definition
|
|
549
|
+
*/
|
|
550
|
+
interface ModelDefinition extends Omit<BaseDefinition, "parameters" | "settings"> {
|
|
551
|
+
/**
|
|
552
|
+
* The unique name of the model.
|
|
553
|
+
*
|
|
554
|
+
* Plugin authors should use the **"model_provider/model_name"** format to define this field.
|
|
555
|
+
*/
|
|
556
|
+
name: string;
|
|
557
|
+
/**
|
|
558
|
+
* The type of the model, currently only "llm" is supported.
|
|
559
|
+
*/
|
|
560
|
+
model_type: "llm";
|
|
561
|
+
/**
|
|
562
|
+
* The default endpoint of the model.
|
|
563
|
+
*/
|
|
564
|
+
default_endpoint?: string;
|
|
565
|
+
/**
|
|
566
|
+
* Supported input types.
|
|
567
|
+
*/
|
|
568
|
+
input_modalities: Array<"file" | "image" | "text">;
|
|
569
|
+
/**
|
|
570
|
+
* Supported output types.
|
|
571
|
+
*/
|
|
572
|
+
output_modalities: Array<"text">;
|
|
573
|
+
/**
|
|
574
|
+
* All pricing values is in currency (if specified) per token/request.
|
|
575
|
+
*
|
|
576
|
+
* A value of 0 means the feature is free.
|
|
577
|
+
*/
|
|
578
|
+
pricing?: {
|
|
579
|
+
/**
|
|
580
|
+
* The currency of the pricing. Defaults to "USD" if not specified.
|
|
581
|
+
*/
|
|
582
|
+
currency?: string;
|
|
583
|
+
/**
|
|
584
|
+
* Cost per input token.
|
|
585
|
+
*/
|
|
586
|
+
input?: number;
|
|
587
|
+
/**
|
|
588
|
+
* Input cache read token price.
|
|
589
|
+
*/
|
|
590
|
+
input_cache_read?: number;
|
|
591
|
+
/**
|
|
592
|
+
* Input cache write token price.
|
|
593
|
+
*/
|
|
594
|
+
input_cache_write?: number;
|
|
595
|
+
/**
|
|
596
|
+
* Cost per output token.
|
|
597
|
+
*/
|
|
598
|
+
output?: number;
|
|
599
|
+
/**
|
|
600
|
+
* Fixed cost per API request if applicable.
|
|
601
|
+
*/
|
|
602
|
+
request?: number;
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Override the default parameters of the model.
|
|
606
|
+
*/
|
|
607
|
+
override_parameters?: {
|
|
608
|
+
/**
|
|
609
|
+
* This setting influences the variety in the model’s responses. Lower values lead to more predictable and typical responses, while higher values encourage more diverse and less common responses. At 0, the model always gives the same response for a given input.
|
|
610
|
+
*/
|
|
611
|
+
temperature?: {
|
|
612
|
+
/**
|
|
613
|
+
* @default 1.0
|
|
614
|
+
*/
|
|
615
|
+
default?: number;
|
|
616
|
+
/**
|
|
617
|
+
* @default 2.0
|
|
618
|
+
*/
|
|
619
|
+
maximum?: number;
|
|
620
|
+
/**
|
|
621
|
+
* @default 0.0
|
|
622
|
+
*/
|
|
623
|
+
minimum?: number;
|
|
624
|
+
};
|
|
625
|
+
/**
|
|
626
|
+
* This setting aims to control the repetition of tokens based on how often they appear in the input. It tries to use less frequently those tokens that appear more in the input, proportional to how frequently they occur. Token penalty scales with the number of occurrences. Negative values will encourage token reuse.
|
|
627
|
+
*/
|
|
628
|
+
frequency_penalty?: {
|
|
629
|
+
/**
|
|
630
|
+
* @default 0.0
|
|
631
|
+
*/
|
|
632
|
+
default?: number;
|
|
633
|
+
/**
|
|
634
|
+
* @default 2.0
|
|
635
|
+
*/
|
|
636
|
+
maximum?: number;
|
|
637
|
+
/**
|
|
638
|
+
* @default -2.0
|
|
639
|
+
*/
|
|
640
|
+
minimum?: number;
|
|
641
|
+
};
|
|
642
|
+
/**
|
|
643
|
+
* This sets the upper limit for the number of tokens the model can generate in response. It won’t produce more than this limit. The maximum value is the context length minus the prompt length.
|
|
644
|
+
*/
|
|
645
|
+
max_tokens?: {
|
|
646
|
+
/**
|
|
647
|
+
* @default 1_048_576
|
|
648
|
+
*/
|
|
649
|
+
default?: number;
|
|
650
|
+
/**
|
|
651
|
+
* @default 2_000_000
|
|
652
|
+
*/
|
|
653
|
+
maximum?: number;
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* Constrains the verbosity of the model’s response. Lower values produce more concise responses, while higher values produce more detailed and comprehensive responses. Introduced by OpenAI for the Responses API.
|
|
657
|
+
*
|
|
658
|
+
* For Anthropic models, this parameter maps to `output_config.effort`.
|
|
659
|
+
*/
|
|
660
|
+
verbosity?: {
|
|
661
|
+
/**
|
|
662
|
+
* @default "medium"
|
|
663
|
+
*/
|
|
664
|
+
default?: "low" | "medium" | "high";
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Declare which parameters are not supported by the model.
|
|
669
|
+
*
|
|
670
|
+
* Parameters defined here will not appear in the UI's parameter panel.
|
|
671
|
+
*
|
|
672
|
+
* Currently, the built-in parameters support are:
|
|
673
|
+
* - endpoint
|
|
674
|
+
* - temperature
|
|
675
|
+
* - frequency_penalty
|
|
676
|
+
* - seed
|
|
677
|
+
* - max_tokens
|
|
678
|
+
* - json_schema
|
|
679
|
+
* - stream
|
|
680
|
+
* - stream_options
|
|
681
|
+
* - structured_outputs
|
|
682
|
+
* - parallel_tool_calls
|
|
683
|
+
* - verbosity
|
|
684
|
+
*/
|
|
685
|
+
unsupported_parameters: Array<"endpoint" | "temperature" | "frequency_penalty" | "seed" | "max_tokens" | "json_schema" | "stream" | "stream_options" | "structured_outputs" | "parallel_tool_calls" | "verbosity">;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Tool definition
|
|
689
|
+
*/
|
|
690
|
+
interface ToolDefinition extends BaseDefinition {
|
|
691
|
+
/**
|
|
692
|
+
* The function to invoke when the tool is called.
|
|
693
|
+
*
|
|
694
|
+
* **Caution for developers**: You must ensure that the return value is JSON serializable.
|
|
695
|
+
*/
|
|
696
|
+
invoke: (context: {
|
|
697
|
+
args: any;
|
|
698
|
+
}) => Promise<JsonValue$1>;
|
|
699
|
+
}
|
|
700
|
+
//#endregion
|
|
701
|
+
export { PropertyUIEncryptedInputProps as A, PropertyUISingleSelectProps as B, PropertyUICollapsiblePanelProps as C, PropertyUIContainer as D, PropertyUIComponentType as E, PropertyUINumber as F, I18nText as G, PropertyUISwitchProps as H, PropertyUIObject as I, PropertyUIOption as L, PropertyUIInputProps as M, PropertyUIKeyValueEditorProps as N, PropertyUICredentialId as O, PropertyUIMisc as P, PropertyUIProps as R, PropertyUIBoolean as S, PropertyUICommonProps as T, JsonValue$1 as U, PropertyUIString as V, JsonValueSchema as W, PropertyNumber as _, ModelDefinition as a, PropertyUIArray as b, DisplayCondition as c, PropertyArray as d, PropertyBase as f, PropertyEncryptedString as g, PropertyDiscriminatedUnion as h, Feature as i, PropertyUIEncryptedString as j, PropertyUIEmojiPickerProps as k, FilterOperators as l, PropertyCredentialId as m, CredentialDefinition as n, PluginDefinition as o, PropertyBoolean as p, DataSourceDefinition as r, ToolDefinition as s, BaseDefinition as t, Property as u, PropertyObject as v, PropertyUIColorPickerProps as w, PropertyUIArraySectionProps as x, PropertyString as y, PropertyUIRadioGroupProps as z };
|
|
702
|
+
//# sourceMappingURL=types-CpQliD1G.d.ts.map
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as PropertyUIEncryptedInputProps, B as PropertyUISingleSelectProps, C as PropertyUICollapsiblePanelProps, D as PropertyUIContainer, E as PropertyUIComponentType, F as PropertyUINumber, G as I18nText, H as PropertyUISwitchProps, I as PropertyUIObject, L as PropertyUIOption, M as PropertyUIInputProps, N as PropertyUIKeyValueEditorProps, O as PropertyUICredentialId, P as PropertyUIMisc, R as PropertyUIProps, S as PropertyUIBoolean, T as PropertyUICommonProps, U as JsonValue, V as PropertyUIString, W as JsonValueSchema, _ as PropertyNumber, a as ModelDefinition, b as PropertyUIArray, c as DisplayCondition, d as PropertyArray, f as PropertyBase, g as PropertyEncryptedString, h as PropertyDiscriminatedUnion, i as Feature, j as PropertyUIEncryptedString, k as PropertyUIEmojiPickerProps, l as FilterOperators, m as PropertyCredentialId, n as CredentialDefinition, o as PluginDefinition, p as PropertyBoolean, r as DataSourceDefinition, s as ToolDefinition, t as BaseDefinition, u as Property, v as PropertyObject, w as PropertyUIColorPickerProps, x as PropertyUIArraySectionProps, y as PropertyString, z as PropertyUIRadioGroupProps } from "./types-CpQliD1G.js";
|
|
2
|
+
export { BaseDefinition, CredentialDefinition, DataSourceDefinition, DisplayCondition, Feature, FilterOperators, I18nText, JsonValue, JsonValueSchema, ModelDefinition, PluginDefinition, Property, PropertyArray, PropertyBase, PropertyBoolean, PropertyCredentialId, PropertyDiscriminatedUnion, PropertyEncryptedString, PropertyNumber, PropertyObject, PropertyString, PropertyUIArray, PropertyUIArraySectionProps, PropertyUIBoolean, PropertyUICollapsiblePanelProps, PropertyUIColorPickerProps, PropertyUICommonProps, PropertyUIComponentType, PropertyUIContainer, PropertyUICredentialId, PropertyUIEmojiPickerProps, PropertyUIEncryptedInputProps, PropertyUIEncryptedString, PropertyUIInputProps, PropertyUIKeyValueEditorProps, PropertyUIMisc, PropertyUINumber, PropertyUIObject, PropertyUIOption, PropertyUIProps, PropertyUIRadioGroupProps, PropertyUISingleSelectProps, PropertyUIString, PropertyUISwitchProps, ToolDefinition };
|
package/dist/types.js
ADDED
|
File without changes
|