@assistant-ui/react-generative-ui 0.0.19 → 0.0.21
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/JSONGenerativeUI.client.d.ts +14 -15
- package/dist/JSONGenerativeUI.client.d.ts.map +1 -1
- package/dist/JSONGenerativeUI.client.js +28 -8
- package/dist/JSONGenerativeUI.client.js.map +1 -1
- package/dist/JSONGenerativeUI.server.d.ts +5 -7
- package/dist/JSONGenerativeUI.server.d.ts.map +1 -1
- package/dist/JSONGenerativeUI.shared.d.ts +35 -36
- package/dist/JSONGenerativeUI.shared.d.ts.map +1 -1
- package/dist/a2ui/convert.d.ts +7 -7
- package/dist/a2ui/convert.d.ts.map +1 -1
- package/dist/a2ui/convert.js +148 -28
- package/dist/a2ui/convert.js.map +1 -1
- package/dist/a2ui/reducer.d.ts +1 -3
- package/dist/a2ui/reducer.d.ts.map +1 -1
- package/dist/a2ui/reducer.js +8 -0
- package/dist/a2ui/reducer.js.map +1 -1
- package/dist/a2ui/snapshot.d.ts +3 -0
- package/dist/a2ui/snapshot.d.ts.map +1 -0
- package/dist/a2ui/snapshot.js +33 -0
- package/dist/a2ui/snapshot.js.map +1 -0
- package/dist/a2ui/types.d.ts +50 -40
- package/dist/a2ui/types.d.ts.map +1 -1
- package/dist/a2ui/types.js.map +1 -1
- package/dist/a2ui.d.ts +5 -4
- package/dist/a2ui.d.ts.map +1 -0
- package/dist/a2ui.js +2 -1
- package/dist/actionRegistry.d.ts +12 -14
- package/dist/actionRegistry.d.ts.map +1 -1
- package/dist/actionRegistry.js.map +1 -1
- package/dist/buildPresentParameters.d.ts +2 -4
- package/dist/buildPresentParameters.d.ts.map +1 -1
- package/dist/buildPresentParameters.js +16 -4
- package/dist/buildPresentParameters.js.map +1 -1
- package/dist/constants.d.ts +0 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/convert/boundSpec.d.ts +0 -2
- package/dist/convert/boundSpec.d.ts.map +1 -1
- package/dist/convert/copyBounded.d.ts +2 -4
- package/dist/convert/copyBounded.d.ts.map +1 -1
- package/dist/convert/isElement.d.ts +1 -3
- package/dist/convert/isElement.d.ts.map +1 -1
- package/dist/convert/takeRun.d.ts +3 -5
- package/dist/convert/takeRun.d.ts.map +1 -1
- package/dist/defineGenerativeComponents.d.ts +1 -3
- package/dist/defineGenerativeComponents.d.ts.map +1 -1
- package/dist/generativeUIToJSX.d.ts +4 -6
- package/dist/generativeUIToJSX.d.ts.map +1 -1
- package/dist/index.d.ts +3 -13
- package/dist/index.d.ts.map +1 -0
- package/dist/index.server.d.ts +3 -13
- package/dist/index.server.d.ts.map +1 -0
- package/dist/index.shared.d.ts +15 -11
- package/dist/index.shared.d.ts.map +1 -0
- package/dist/ir.d.ts +17 -19
- package/dist/ir.d.ts.map +1 -1
- package/dist/renderGenerativeUI.d.ts +2 -4
- package/dist/renderGenerativeUI.d.ts.map +1 -1
- package/dist/scopeSchema.d.ts +6 -0
- package/dist/scopeSchema.d.ts.map +1 -0
- package/dist/scopeSchema.js +56 -0
- package/dist/scopeSchema.js.map +1 -0
- package/dist/slack/constants.d.ts +8 -9
- package/dist/slack/constants.d.ts.map +1 -1
- package/dist/slack/decodeBlockAction.d.ts +1 -3
- package/dist/slack/decodeBlockAction.d.ts.map +1 -1
- package/dist/slack/fromSlackBlocks.d.ts +1 -3
- package/dist/slack/fromSlackBlocks.d.ts.map +1 -1
- package/dist/slack/toSlackBlocks.d.ts +1 -3
- package/dist/slack/toSlackBlocks.d.ts.map +1 -1
- package/dist/slack/toSlackBlocks.js +1 -1
- package/dist/slack/types.d.ts +78 -80
- package/dist/slack/types.d.ts.map +1 -1
- package/dist/slack.d.ts +5 -5
- package/dist/slack.d.ts.map +1 -0
- package/dist/teams/constants.d.ts +1 -3
- package/dist/teams/constants.d.ts.map +1 -1
- package/dist/teams/decodeSubmitData.d.ts +1 -3
- package/dist/teams/decodeSubmitData.d.ts.map +1 -1
- package/dist/teams/toAdaptiveCard.d.ts +4 -6
- package/dist/teams/toAdaptiveCard.d.ts.map +1 -1
- package/dist/teams/toTeamsAttachments.d.ts +1 -3
- package/dist/teams/toTeamsAttachments.d.ts.map +1 -1
- package/dist/teams/types.d.ts +108 -109
- package/dist/teams/types.d.ts.map +1 -1
- package/dist/teams.d.ts +5 -5
- package/dist/teams.d.ts.map +1 -0
- package/dist/types.d.ts +36 -37
- package/dist/types.d.ts.map +1 -1
- package/dist/vocabulary/alert.d.ts +21 -23
- package/dist/vocabulary/alert.d.ts.map +1 -1
- package/dist/vocabulary/collectFormValues.d.ts +8 -10
- package/dist/vocabulary/collectFormValues.d.ts.map +1 -1
- package/dist/vocabulary/data.d.ts +45 -47
- package/dist/vocabulary/data.d.ts.map +1 -1
- package/dist/vocabulary/dispatch.d.ts +2 -4
- package/dist/vocabulary/dispatch.d.ts.map +1 -1
- package/dist/vocabulary/fact.d.ts +8 -10
- package/dist/vocabulary/fact.d.ts.map +1 -1
- package/dist/vocabulary/form.d.ts +7 -9
- package/dist/vocabulary/form.d.ts.map +1 -1
- package/dist/vocabulary/icon.d.ts +37 -39
- package/dist/vocabulary/icon.d.ts.map +1 -1
- package/dist/vocabulary/index.d.ts +1 -3
- package/dist/vocabulary/index.d.ts.map +1 -1
- package/dist/vocabulary/interactive.d.ts +87 -86
- package/dist/vocabulary/interactive.d.ts.map +1 -1
- package/dist/vocabulary/interactive.js +4 -4
- package/dist/vocabulary/interactive.js.map +1 -1
- package/dist/vocabulary/layout.d.ts +75 -77
- package/dist/vocabulary/layout.d.ts.map +1 -1
- package/dist/vocabulary/list.d.ts +10 -12
- package/dist/vocabulary/list.d.ts.map +1 -1
- package/dist/vocabulary/media.d.ts +21 -23
- package/dist/vocabulary/media.d.ts.map +1 -1
- package/dist/vocabulary/text.d.ts +53 -55
- package/dist/vocabulary/text.d.ts.map +1 -1
- package/dist/vocabulary/toTextContent.d.ts +0 -2
- package/dist/vocabulary/toTextContent.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/JSONGenerativeUI.client.tsx +57 -15
- package/src/JSONGenerativeUI.test.tsx +298 -4
- package/src/a2ui/convert.test.ts +717 -0
- package/src/a2ui/convert.ts +229 -41
- package/src/a2ui/reducer.test.ts +18 -0
- package/src/a2ui/reducer.ts +16 -0
- package/src/a2ui/snapshot.test.ts +52 -0
- package/src/a2ui/snapshot.ts +52 -0
- package/src/a2ui/types.ts +16 -0
- package/src/a2ui.ts +2 -0
- package/src/actionRegistry.ts +5 -5
- package/src/buildPresentParameters.test.ts +246 -0
- package/src/buildPresentParameters.ts +18 -3
- package/src/scopeSchema.test.ts +72 -0
- package/src/scopeSchema.ts +71 -0
- package/src/vocabulary/interactive.dispatch.test.tsx +17 -3
- package/src/vocabulary/interactive.test.tsx +19 -0
- package/src/vocabulary/interactive.tsx +4 -1
|
@@ -1,81 +1,79 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/vocabulary/layout.d.ts
|
|
3
2
|
export declare const layoutVocabulary: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
3
|
+
Card: {
|
|
4
|
+
description: string;
|
|
5
|
+
properties: z.ZodObject<{
|
|
6
|
+
title: z.ZodOptional<z.ZodString>;
|
|
7
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
background: z.ZodOptional<z.ZodString>;
|
|
9
|
+
asForm: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
confirm: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
$action: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
type: z.ZodString;
|
|
14
|
+
}, z.core.$loose>>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
cancel: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
label: z.ZodString;
|
|
18
|
+
$action: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
type: z.ZodString;
|
|
20
|
+
}, z.core.$loose>>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
render: ({ title, padding, background, asForm, confirm, cancel, $dispatch, children, }: any) => import("react").JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
Col: {
|
|
26
|
+
description: string;
|
|
27
|
+
properties: z.ZodObject<{
|
|
28
|
+
gap: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
start: "start";
|
|
31
|
+
center: "center";
|
|
32
|
+
end: "end";
|
|
33
|
+
}>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
render: ({ gap, align, children }: any) => import("react").JSX.Element;
|
|
36
|
+
};
|
|
37
|
+
Row: {
|
|
38
|
+
description: string;
|
|
39
|
+
properties: z.ZodObject<{
|
|
40
|
+
gap: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
start: "start";
|
|
43
|
+
center: "center";
|
|
44
|
+
end: "end";
|
|
45
|
+
}>>;
|
|
46
|
+
justify: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
start: "start";
|
|
48
|
+
center: "center";
|
|
49
|
+
end: "end";
|
|
50
|
+
between: "between";
|
|
51
|
+
}>>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
render: ({ gap, align, justify, children }: any) => import("react").JSX.Element;
|
|
54
|
+
};
|
|
55
|
+
Spacer: {
|
|
56
|
+
description: string;
|
|
57
|
+
properties: z.ZodObject<{}, z.core.$strip>;
|
|
58
|
+
render: () => import("react").JSX.Element;
|
|
59
|
+
};
|
|
60
|
+
Badge: {
|
|
61
|
+
description: string;
|
|
62
|
+
properties: z.ZodObject<{
|
|
63
|
+
value: z.ZodString;
|
|
64
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
render: ({ value, variant, children }: any) => import("react").JSX.Element;
|
|
67
|
+
};
|
|
68
|
+
Box: {
|
|
69
|
+
description: string;
|
|
70
|
+
properties: z.ZodObject<{
|
|
71
|
+
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
72
|
+
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
73
|
+
radius: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"full">, z.ZodNumber]>>;
|
|
74
|
+
background: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
render: ({ width, height, radius, background, children }: any) => import("react").JSX.Element;
|
|
77
|
+
};
|
|
79
78
|
};
|
|
80
|
-
//#endregion
|
|
81
79
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/vocabulary/layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmNE,CAAC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/vocabulary/list.d.ts
|
|
3
2
|
export declare const listVocabulary: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
ListView: {
|
|
4
|
+
description: string;
|
|
5
|
+
properties: z.ZodObject<{}, z.core.$strip>;
|
|
6
|
+
render: ({ children }: any) => import("react").JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
ListViewItem: {
|
|
9
|
+
description: string;
|
|
10
|
+
properties: z.ZodObject<{}, z.core.$strip>;
|
|
11
|
+
render: ({ $action, $dispatch, children }: any) => import("react").JSX.Element;
|
|
12
|
+
};
|
|
14
13
|
};
|
|
15
|
-
//#endregion
|
|
16
14
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/vocabulary/list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,cAAc;;;;;;;;;;;CA0CI,CAAC"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/vocabulary/media.d.ts
|
|
3
2
|
export declare const mediaVocabulary: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
Image: {
|
|
4
|
+
description: string;
|
|
5
|
+
properties: z.ZodObject<{
|
|
6
|
+
src: z.ZodString;
|
|
7
|
+
alt: z.ZodString;
|
|
8
|
+
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
9
|
+
sm: "sm";
|
|
10
|
+
md: "md";
|
|
11
|
+
lg: "lg";
|
|
12
|
+
}>, z.ZodNumber]>>;
|
|
13
|
+
round: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
render: ({ src, alt, size, round }: any) => import("react").JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
Divider: {
|
|
18
|
+
description: string;
|
|
19
|
+
properties: z.ZodObject<{
|
|
20
|
+
flush: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
render: ({ flush }: any) => import("react").JSX.Element;
|
|
23
|
+
};
|
|
25
24
|
};
|
|
26
|
-
//#endregion
|
|
27
25
|
//# sourceMappingURL=media.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/vocabulary/media.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CAkDG,CAAC"}
|
|
@@ -1,59 +1,57 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/vocabulary/text.d.ts
|
|
3
2
|
export declare const textVocabulary: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
3
|
+
Header: {
|
|
4
|
+
description: string;
|
|
5
|
+
properties: z.ZodObject<{
|
|
6
|
+
text: z.ZodString;
|
|
7
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
8
|
+
sm: "sm";
|
|
9
|
+
md: "md";
|
|
10
|
+
lg: "lg";
|
|
11
|
+
xl: "xl";
|
|
12
|
+
"2xl": "2xl";
|
|
13
|
+
"3xl": "3xl";
|
|
14
|
+
}>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
render: ({ text, size, children }: any) => import("react").JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
Text: {
|
|
19
|
+
description: string;
|
|
20
|
+
properties: z.ZodObject<{
|
|
21
|
+
value: z.ZodString;
|
|
22
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
sm: "sm";
|
|
24
|
+
md: "md";
|
|
25
|
+
lg: "lg";
|
|
26
|
+
xl: "xl";
|
|
27
|
+
"2xl": "2xl";
|
|
28
|
+
"3xl": "3xl";
|
|
29
|
+
}>>;
|
|
30
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
normal: "normal";
|
|
32
|
+
medium: "medium";
|
|
33
|
+
semibold: "semibold";
|
|
34
|
+
bold: "bold";
|
|
35
|
+
}>>;
|
|
36
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
emphasis: "emphasis";
|
|
38
|
+
secondary: "secondary";
|
|
39
|
+
"alpha-70": "alpha-70";
|
|
40
|
+
white: "white";
|
|
41
|
+
"white-70": "white-70";
|
|
42
|
+
"white-50": "white-50";
|
|
43
|
+
}>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
streamProperties: true;
|
|
46
|
+
render: ({ value, size, weight, color, children }: any) => import("react").JSX.Element;
|
|
47
|
+
};
|
|
48
|
+
Caption: {
|
|
49
|
+
description: string;
|
|
50
|
+
properties: z.ZodObject<{
|
|
51
|
+
value: z.ZodString;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
streamProperties: true;
|
|
54
|
+
render: ({ value, children }: any) => import("react").JSX.Element;
|
|
55
|
+
};
|
|
57
56
|
};
|
|
58
|
-
//#endregion
|
|
59
57
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/vocabulary/text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toTextContent.d.ts","
|
|
1
|
+
{"version":3,"file":"toTextContent.d.ts","sourceRoot":"","sources":["../../src/vocabulary/toTextContent.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,MAAM,GAAG,IACM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-generative-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "Generative UI components for assistant-ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"generative-ui",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"sideEffects": false,
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@types/json-schema": "^7.0.15",
|
|
54
|
-
"assistant-stream": "^0.3.
|
|
54
|
+
"assistant-stream": "^0.3.45"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@assistant-ui/react": "^0.15.0",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@assistant-ui/react": "0.15.
|
|
69
|
-
"@assistant-ui/x-buildutils": "0.0.
|
|
68
|
+
"@assistant-ui/react": "0.15.22",
|
|
69
|
+
"@assistant-ui/x-buildutils": "0.0.29",
|
|
70
70
|
"@types/react": "^19.3.0",
|
|
71
71
|
"jsdom": "^30.0.1",
|
|
72
72
|
"react": "^19.3.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ToolCallMessagePartProps } from "@assistant-ui/react";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import { buildPresentParameters } from "./buildPresentParameters";
|
|
3
4
|
import {
|
|
@@ -36,6 +37,7 @@ export class JSONGenerativeUI {
|
|
|
36
37
|
private readonly library: GenerativeUILibrary;
|
|
37
38
|
private readonly parameters: PresentParameters;
|
|
38
39
|
private readonly actions: ActionRegistry | undefined;
|
|
40
|
+
private readonly completedPromptToolCallIds = new Set<string>();
|
|
39
41
|
|
|
40
42
|
constructor(options: JSONGenerativeUIOptions) {
|
|
41
43
|
this.library = options.library;
|
|
@@ -48,20 +50,60 @@ export class JSONGenerativeUI {
|
|
|
48
50
|
* between top-level blocks, which the host's message container does not
|
|
49
51
|
* provide, and stays out of the way while it has nothing to show.
|
|
50
52
|
*/
|
|
51
|
-
private readonly render = (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
private readonly render = (
|
|
54
|
+
{
|
|
55
|
+
args,
|
|
56
|
+
status,
|
|
57
|
+
addResult,
|
|
58
|
+
result,
|
|
59
|
+
toolCallId,
|
|
60
|
+
unstable_recordInteraction,
|
|
61
|
+
}: ToolCallMessagePartProps<Record<string, unknown>, any>,
|
|
62
|
+
completesPrompt = false,
|
|
63
|
+
): ReactNode => {
|
|
64
|
+
const actions = this.actions;
|
|
65
|
+
const dispatch = actions
|
|
66
|
+
? (action: Parameters<ActionRegistry["dispatch"]>[0]) => {
|
|
67
|
+
if (unstable_recordInteraction) {
|
|
68
|
+
try {
|
|
69
|
+
void unstable_recordInteraction({
|
|
70
|
+
type: "action",
|
|
71
|
+
payload: action,
|
|
72
|
+
}).catch(() => {});
|
|
73
|
+
} catch {}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const actionResult = actions.dispatch(action);
|
|
77
|
+
if (
|
|
78
|
+
completesPrompt &&
|
|
79
|
+
actionResult !== undefined &&
|
|
80
|
+
result === undefined
|
|
81
|
+
) {
|
|
82
|
+
void Promise.resolve(actionResult)
|
|
83
|
+
.then((response) => {
|
|
84
|
+
if (
|
|
85
|
+
response !== undefined &&
|
|
86
|
+
!this.completedPromptToolCallIds.has(toolCallId)
|
|
87
|
+
) {
|
|
88
|
+
this.completedPromptToolCallIds.add(toolCallId);
|
|
89
|
+
addResult(response);
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
.catch(() => {});
|
|
93
|
+
}
|
|
94
|
+
return actionResult;
|
|
95
|
+
}
|
|
96
|
+
: undefined;
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<div data-aui="root">
|
|
100
|
+
{renderGenerativeUI(args, this.library, {
|
|
101
|
+
status: uiStatus(status),
|
|
102
|
+
...(dispatch ? { dispatch } : {}),
|
|
103
|
+
})}
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
65
107
|
|
|
66
108
|
present(options?: PresentToolOptions): PresentTool {
|
|
67
109
|
return {
|
|
@@ -76,7 +118,7 @@ export class JSONGenerativeUI {
|
|
|
76
118
|
return {
|
|
77
119
|
...promptUserToolBase(this.parameters),
|
|
78
120
|
unstable_backendDefault: { parameters: true },
|
|
79
|
-
render: this.render,
|
|
121
|
+
render: (props) => this.render(props, true),
|
|
80
122
|
};
|
|
81
123
|
}
|
|
82
124
|
}
|