@puckeditor/plugin-ai 0.9.0-canary.d4a0bc62 → 0.9.0-canary.e1a77bb6
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.d.mts +0 -53
- package/dist/index.d.ts +0 -53
- package/dist/index.js +139 -510
- package/dist/index.mjs +122 -493
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -115,37 +115,6 @@ type DataToolStatus = {
|
|
|
115
115
|
status: ToolStatus;
|
|
116
116
|
toolCallId: string;
|
|
117
117
|
};
|
|
118
|
-
type AiFieldTypeShape<Value> = {
|
|
119
|
-
/** What the field represents, and any rules for using it */
|
|
120
|
-
description?: string;
|
|
121
|
-
/**
|
|
122
|
-
* JSON Schema for the field's value — the shape the model may write, at
|
|
123
|
-
* creation and in later edits. Without one the model never writes the
|
|
124
|
-
* field, like `ai.exclude`.
|
|
125
|
-
*/
|
|
126
|
-
schema?: Record<string, any>;
|
|
127
|
-
/**
|
|
128
|
-
* What a field the model designs starts as. When set, the model places the
|
|
129
|
-
* field and this value fills it; the model authors a value against `schema`
|
|
130
|
-
* only when this is absent.
|
|
131
|
-
*/
|
|
132
|
-
defaultValue?: Value;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* A user field type registered by the developer's config. Puck can't infer a
|
|
136
|
-
* value shape for one, so a type carries `schema`, `defaultValue`, or both.
|
|
137
|
-
*/
|
|
138
|
-
type AiFieldType$1<Value = AiFieldTypeValue> = AiFieldTypeShape<Value> & ({
|
|
139
|
-
schema: Record<string, any>;
|
|
140
|
-
} | {
|
|
141
|
-
defaultValue: Value;
|
|
142
|
-
});
|
|
143
|
-
/**
|
|
144
|
-
* Any JSON-ish value. Spelled out rather than `unknown` so a union with a
|
|
145
|
-
* function form doesn't collapse, which would drop the callback's parameter
|
|
146
|
-
* types at the call site.
|
|
147
|
-
*/
|
|
148
|
-
type AiFieldTypeValue = string | number | boolean | null | readonly unknown[] | Record<string, unknown>;
|
|
149
118
|
type AddOperation = {
|
|
150
119
|
op: "add";
|
|
151
120
|
id: string;
|
|
@@ -278,21 +247,6 @@ type PuckProviderMetadata = {
|
|
|
278
247
|
|
|
279
248
|
type PuckMessage = UIMessage<PuckProviderMetadata, PuckDataParts>;
|
|
280
249
|
|
|
281
|
-
type AiFieldTypeContext = {
|
|
282
|
-
/** The designed component the field belongs to */
|
|
283
|
-
componentName: string;
|
|
284
|
-
/** The field's name within that component */
|
|
285
|
-
fieldName: string;
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* A field type the developer's config registers: `schema` is what the model
|
|
289
|
-
* may write, `defaultValue` is what a designed field starts as — one or both.
|
|
290
|
-
* In the editor the default may be a function of the component and field
|
|
291
|
-
* being created.
|
|
292
|
-
*/
|
|
293
|
-
type AiFieldType = AiFieldType$1<AiFieldTypeValue | ((ctx: AiFieldTypeContext) => AiFieldTypeValue)>;
|
|
294
|
-
type AiFieldTypeRegistry = Record<string, AiFieldType>;
|
|
295
|
-
|
|
296
250
|
type Mode = "assembly" | "design";
|
|
297
251
|
type RequestOptions = {
|
|
298
252
|
body?: {
|
|
@@ -309,13 +263,6 @@ type RequestOptions = {
|
|
|
309
263
|
};
|
|
310
264
|
type AiPluginProps = {
|
|
311
265
|
host?: string;
|
|
312
|
-
/**
|
|
313
|
-
* Field types this config registers, keyed by field type. Each gives either
|
|
314
|
-
* a `schema` the AI writes the value against, or a `defaultValue` every
|
|
315
|
-
* field of the type starts with. Sent to the server as JSON, so a function
|
|
316
|
-
* `defaultValue` only resolves in the editor.
|
|
317
|
-
*/
|
|
318
|
-
fieldTypes?: AiFieldTypeRegistry;
|
|
319
266
|
chat?: {
|
|
320
267
|
attachments?: {
|
|
321
268
|
enabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -115,37 +115,6 @@ type DataToolStatus = {
|
|
|
115
115
|
status: ToolStatus;
|
|
116
116
|
toolCallId: string;
|
|
117
117
|
};
|
|
118
|
-
type AiFieldTypeShape<Value> = {
|
|
119
|
-
/** What the field represents, and any rules for using it */
|
|
120
|
-
description?: string;
|
|
121
|
-
/**
|
|
122
|
-
* JSON Schema for the field's value — the shape the model may write, at
|
|
123
|
-
* creation and in later edits. Without one the model never writes the
|
|
124
|
-
* field, like `ai.exclude`.
|
|
125
|
-
*/
|
|
126
|
-
schema?: Record<string, any>;
|
|
127
|
-
/**
|
|
128
|
-
* What a field the model designs starts as. When set, the model places the
|
|
129
|
-
* field and this value fills it; the model authors a value against `schema`
|
|
130
|
-
* only when this is absent.
|
|
131
|
-
*/
|
|
132
|
-
defaultValue?: Value;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* A user field type registered by the developer's config. Puck can't infer a
|
|
136
|
-
* value shape for one, so a type carries `schema`, `defaultValue`, or both.
|
|
137
|
-
*/
|
|
138
|
-
type AiFieldType$1<Value = AiFieldTypeValue> = AiFieldTypeShape<Value> & ({
|
|
139
|
-
schema: Record<string, any>;
|
|
140
|
-
} | {
|
|
141
|
-
defaultValue: Value;
|
|
142
|
-
});
|
|
143
|
-
/**
|
|
144
|
-
* Any JSON-ish value. Spelled out rather than `unknown` so a union with a
|
|
145
|
-
* function form doesn't collapse, which would drop the callback's parameter
|
|
146
|
-
* types at the call site.
|
|
147
|
-
*/
|
|
148
|
-
type AiFieldTypeValue = string | number | boolean | null | readonly unknown[] | Record<string, unknown>;
|
|
149
118
|
type AddOperation = {
|
|
150
119
|
op: "add";
|
|
151
120
|
id: string;
|
|
@@ -278,21 +247,6 @@ type PuckProviderMetadata = {
|
|
|
278
247
|
|
|
279
248
|
type PuckMessage = UIMessage<PuckProviderMetadata, PuckDataParts>;
|
|
280
249
|
|
|
281
|
-
type AiFieldTypeContext = {
|
|
282
|
-
/** The designed component the field belongs to */
|
|
283
|
-
componentName: string;
|
|
284
|
-
/** The field's name within that component */
|
|
285
|
-
fieldName: string;
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* A field type the developer's config registers: `schema` is what the model
|
|
289
|
-
* may write, `defaultValue` is what a designed field starts as — one or both.
|
|
290
|
-
* In the editor the default may be a function of the component and field
|
|
291
|
-
* being created.
|
|
292
|
-
*/
|
|
293
|
-
type AiFieldType = AiFieldType$1<AiFieldTypeValue | ((ctx: AiFieldTypeContext) => AiFieldTypeValue)>;
|
|
294
|
-
type AiFieldTypeRegistry = Record<string, AiFieldType>;
|
|
295
|
-
|
|
296
250
|
type Mode = "assembly" | "design";
|
|
297
251
|
type RequestOptions = {
|
|
298
252
|
body?: {
|
|
@@ -309,13 +263,6 @@ type RequestOptions = {
|
|
|
309
263
|
};
|
|
310
264
|
type AiPluginProps = {
|
|
311
265
|
host?: string;
|
|
312
|
-
/**
|
|
313
|
-
* Field types this config registers, keyed by field type. Each gives either
|
|
314
|
-
* a `schema` the AI writes the value against, or a `defaultValue` every
|
|
315
|
-
* field of the type starts with. Sent to the server as JSON, so a function
|
|
316
|
-
* `defaultValue` only resolves in the editor.
|
|
317
|
-
*/
|
|
318
|
-
fieldTypes?: AiFieldTypeRegistry;
|
|
319
266
|
chat?: {
|
|
320
267
|
attachments?: {
|
|
321
268
|
enabled?: boolean;
|