@puckeditor/plugin-ai 0.1.0-canary.f56e596d → 0.1.0-canary.ff322ae0
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 +107 -27
- package/dist/index.d.ts +107 -27
- package/dist/index.js +538 -411
- package/dist/index.mjs +537 -410
- package/package.json +4 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,22 +1,115 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { UIMessage, ChatStatus } from 'ai';
|
|
3
|
-
import { PuckProviderMetadata, PuckDataParts } from '@puckeditor/platform-types';
|
|
4
|
-
import { ReactNode, RefObject } from 'react';
|
|
5
2
|
|
|
6
|
-
type
|
|
3
|
+
type _JSONSchema = boolean | JSONSchema;
|
|
4
|
+
type JSONSchema = {
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
7
|
+
$id?: string;
|
|
8
|
+
$anchor?: string;
|
|
9
|
+
$ref?: string;
|
|
10
|
+
$dynamicRef?: string;
|
|
11
|
+
$dynamicAnchor?: string;
|
|
12
|
+
$vocabulary?: Record<string, boolean>;
|
|
13
|
+
$comment?: string;
|
|
14
|
+
$defs?: Record<string, JSONSchema>;
|
|
15
|
+
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
16
|
+
additionalItems?: _JSONSchema;
|
|
17
|
+
unevaluatedItems?: _JSONSchema;
|
|
18
|
+
prefixItems?: _JSONSchema[];
|
|
19
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
20
|
+
contains?: _JSONSchema;
|
|
21
|
+
additionalProperties?: _JSONSchema;
|
|
22
|
+
unevaluatedProperties?: _JSONSchema;
|
|
23
|
+
properties?: Record<string, _JSONSchema>;
|
|
24
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
25
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
26
|
+
propertyNames?: _JSONSchema;
|
|
27
|
+
if?: _JSONSchema;
|
|
28
|
+
then?: _JSONSchema;
|
|
29
|
+
else?: _JSONSchema;
|
|
30
|
+
allOf?: JSONSchema[];
|
|
31
|
+
anyOf?: JSONSchema[];
|
|
32
|
+
oneOf?: JSONSchema[];
|
|
33
|
+
not?: _JSONSchema;
|
|
34
|
+
multipleOf?: number;
|
|
35
|
+
maximum?: number;
|
|
36
|
+
exclusiveMaximum?: number | boolean;
|
|
37
|
+
minimum?: number;
|
|
38
|
+
exclusiveMinimum?: number | boolean;
|
|
39
|
+
maxLength?: number;
|
|
40
|
+
minLength?: number;
|
|
41
|
+
pattern?: string;
|
|
42
|
+
maxItems?: number;
|
|
43
|
+
minItems?: number;
|
|
44
|
+
uniqueItems?: boolean;
|
|
45
|
+
maxContains?: number;
|
|
46
|
+
minContains?: number;
|
|
47
|
+
maxProperties?: number;
|
|
48
|
+
minProperties?: number;
|
|
49
|
+
required?: string[];
|
|
50
|
+
dependentRequired?: Record<string, string[]>;
|
|
51
|
+
enum?: Array<string | number | boolean | null>;
|
|
52
|
+
const?: string | number | boolean | null;
|
|
53
|
+
id?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
default?: unknown;
|
|
57
|
+
deprecated?: boolean;
|
|
58
|
+
readOnly?: boolean;
|
|
59
|
+
writeOnly?: boolean;
|
|
60
|
+
nullable?: boolean;
|
|
61
|
+
examples?: unknown[];
|
|
62
|
+
format?: string;
|
|
63
|
+
contentMediaType?: string;
|
|
64
|
+
contentEncoding?: string;
|
|
65
|
+
contentSchema?: JSONSchema;
|
|
66
|
+
_prefault?: unknown;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type ComponentAiParams = {
|
|
70
|
+
instructions?: string;
|
|
71
|
+
schema?: JSONSchema;
|
|
72
|
+
defaultZone?: { allow?: string[]; disallow?: string[]; disabled?: boolean };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
type FieldAiParams = {
|
|
76
|
+
instructions?: string;
|
|
77
|
+
exclude?: boolean;
|
|
78
|
+
required?: boolean;
|
|
79
|
+
stream?: boolean;
|
|
80
|
+
schema?: JSONSchema;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare module "@measured/puck" {
|
|
84
|
+
export interface ComponentMetadata {
|
|
85
|
+
ai?: ComponentAiParams;
|
|
86
|
+
}
|
|
7
87
|
|
|
8
|
-
|
|
88
|
+
export interface ComponentConfigExtensions {
|
|
89
|
+
ai?: ComponentAiParams;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface FieldMetadata {
|
|
93
|
+
ai?: FieldAiParams;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface BaseField {
|
|
97
|
+
ai?: FieldAiParams;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type AiPluginProps = {
|
|
9
102
|
host?: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
103
|
+
chat?: {
|
|
104
|
+
onSubmit?: (prompt: string) => void;
|
|
105
|
+
examplePrompts?: {
|
|
106
|
+
href: string;
|
|
107
|
+
label: string;
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
17
110
|
};
|
|
18
111
|
|
|
19
|
-
declare function
|
|
112
|
+
declare function createAiPlugin(opts?: AiPluginProps): {
|
|
20
113
|
label: string;
|
|
21
114
|
name: string;
|
|
22
115
|
render: () => react_jsx_runtime.JSX.Element;
|
|
@@ -24,17 +117,4 @@ declare function createAIPlugin(opts?: ChatProps$1): {
|
|
|
24
117
|
mobilePanelHeight: "min-content";
|
|
25
118
|
};
|
|
26
119
|
|
|
27
|
-
|
|
28
|
-
children?: ReactNode;
|
|
29
|
-
examplePrompts?: ReactNode;
|
|
30
|
-
handleSubmit?: (prompt: string) => void;
|
|
31
|
-
hideInput?: boolean;
|
|
32
|
-
inputRef?: RefObject<HTMLTextAreaElement | null>;
|
|
33
|
-
status?: ChatStatus;
|
|
34
|
-
messages?: PuckMessage[];
|
|
35
|
-
error?: string;
|
|
36
|
-
handleRetry?: () => void;
|
|
37
|
-
};
|
|
38
|
-
declare function ChatBody({ children, examplePrompts, handleSubmit, hideInput, inputRef, messages, status, error, handleRetry, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
39
|
-
|
|
40
|
-
export { ChatBody, createAIPlugin as default };
|
|
120
|
+
export { createAiPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,115 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { UIMessage, ChatStatus } from 'ai';
|
|
3
|
-
import { PuckProviderMetadata, PuckDataParts } from '@puckeditor/platform-types';
|
|
4
|
-
import { ReactNode, RefObject } from 'react';
|
|
5
2
|
|
|
6
|
-
type
|
|
3
|
+
type _JSONSchema = boolean | JSONSchema;
|
|
4
|
+
type JSONSchema = {
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
7
|
+
$id?: string;
|
|
8
|
+
$anchor?: string;
|
|
9
|
+
$ref?: string;
|
|
10
|
+
$dynamicRef?: string;
|
|
11
|
+
$dynamicAnchor?: string;
|
|
12
|
+
$vocabulary?: Record<string, boolean>;
|
|
13
|
+
$comment?: string;
|
|
14
|
+
$defs?: Record<string, JSONSchema>;
|
|
15
|
+
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
16
|
+
additionalItems?: _JSONSchema;
|
|
17
|
+
unevaluatedItems?: _JSONSchema;
|
|
18
|
+
prefixItems?: _JSONSchema[];
|
|
19
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
20
|
+
contains?: _JSONSchema;
|
|
21
|
+
additionalProperties?: _JSONSchema;
|
|
22
|
+
unevaluatedProperties?: _JSONSchema;
|
|
23
|
+
properties?: Record<string, _JSONSchema>;
|
|
24
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
25
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
26
|
+
propertyNames?: _JSONSchema;
|
|
27
|
+
if?: _JSONSchema;
|
|
28
|
+
then?: _JSONSchema;
|
|
29
|
+
else?: _JSONSchema;
|
|
30
|
+
allOf?: JSONSchema[];
|
|
31
|
+
anyOf?: JSONSchema[];
|
|
32
|
+
oneOf?: JSONSchema[];
|
|
33
|
+
not?: _JSONSchema;
|
|
34
|
+
multipleOf?: number;
|
|
35
|
+
maximum?: number;
|
|
36
|
+
exclusiveMaximum?: number | boolean;
|
|
37
|
+
minimum?: number;
|
|
38
|
+
exclusiveMinimum?: number | boolean;
|
|
39
|
+
maxLength?: number;
|
|
40
|
+
minLength?: number;
|
|
41
|
+
pattern?: string;
|
|
42
|
+
maxItems?: number;
|
|
43
|
+
minItems?: number;
|
|
44
|
+
uniqueItems?: boolean;
|
|
45
|
+
maxContains?: number;
|
|
46
|
+
minContains?: number;
|
|
47
|
+
maxProperties?: number;
|
|
48
|
+
minProperties?: number;
|
|
49
|
+
required?: string[];
|
|
50
|
+
dependentRequired?: Record<string, string[]>;
|
|
51
|
+
enum?: Array<string | number | boolean | null>;
|
|
52
|
+
const?: string | number | boolean | null;
|
|
53
|
+
id?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
default?: unknown;
|
|
57
|
+
deprecated?: boolean;
|
|
58
|
+
readOnly?: boolean;
|
|
59
|
+
writeOnly?: boolean;
|
|
60
|
+
nullable?: boolean;
|
|
61
|
+
examples?: unknown[];
|
|
62
|
+
format?: string;
|
|
63
|
+
contentMediaType?: string;
|
|
64
|
+
contentEncoding?: string;
|
|
65
|
+
contentSchema?: JSONSchema;
|
|
66
|
+
_prefault?: unknown;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type ComponentAiParams = {
|
|
70
|
+
instructions?: string;
|
|
71
|
+
schema?: JSONSchema;
|
|
72
|
+
defaultZone?: { allow?: string[]; disallow?: string[]; disabled?: boolean };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
type FieldAiParams = {
|
|
76
|
+
instructions?: string;
|
|
77
|
+
exclude?: boolean;
|
|
78
|
+
required?: boolean;
|
|
79
|
+
stream?: boolean;
|
|
80
|
+
schema?: JSONSchema;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare module "@measured/puck" {
|
|
84
|
+
export interface ComponentMetadata {
|
|
85
|
+
ai?: ComponentAiParams;
|
|
86
|
+
}
|
|
7
87
|
|
|
8
|
-
|
|
88
|
+
export interface ComponentConfigExtensions {
|
|
89
|
+
ai?: ComponentAiParams;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface FieldMetadata {
|
|
93
|
+
ai?: FieldAiParams;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface BaseField {
|
|
97
|
+
ai?: FieldAiParams;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type AiPluginProps = {
|
|
9
102
|
host?: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
103
|
+
chat?: {
|
|
104
|
+
onSubmit?: (prompt: string) => void;
|
|
105
|
+
examplePrompts?: {
|
|
106
|
+
href: string;
|
|
107
|
+
label: string;
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
17
110
|
};
|
|
18
111
|
|
|
19
|
-
declare function
|
|
112
|
+
declare function createAiPlugin(opts?: AiPluginProps): {
|
|
20
113
|
label: string;
|
|
21
114
|
name: string;
|
|
22
115
|
render: () => react_jsx_runtime.JSX.Element;
|
|
@@ -24,17 +117,4 @@ declare function createAIPlugin(opts?: ChatProps$1): {
|
|
|
24
117
|
mobilePanelHeight: "min-content";
|
|
25
118
|
};
|
|
26
119
|
|
|
27
|
-
|
|
28
|
-
children?: ReactNode;
|
|
29
|
-
examplePrompts?: ReactNode;
|
|
30
|
-
handleSubmit?: (prompt: string) => void;
|
|
31
|
-
hideInput?: boolean;
|
|
32
|
-
inputRef?: RefObject<HTMLTextAreaElement | null>;
|
|
33
|
-
status?: ChatStatus;
|
|
34
|
-
messages?: PuckMessage[];
|
|
35
|
-
error?: string;
|
|
36
|
-
handleRetry?: () => void;
|
|
37
|
-
};
|
|
38
|
-
declare function ChatBody({ children, examplePrompts, handleSubmit, hideInput, inputRef, messages, status, error, handleRetry, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
39
|
-
|
|
40
|
-
export { ChatBody, createAIPlugin as default };
|
|
120
|
+
export { createAiPlugin };
|