@assistant-ui/react-generative-ui 0.0.19 → 0.0.20

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.
Files changed (137) hide show
  1. package/dist/JSONGenerativeUI.client.d.ts +14 -15
  2. package/dist/JSONGenerativeUI.client.d.ts.map +1 -1
  3. package/dist/JSONGenerativeUI.client.js +28 -8
  4. package/dist/JSONGenerativeUI.client.js.map +1 -1
  5. package/dist/JSONGenerativeUI.server.d.ts +5 -7
  6. package/dist/JSONGenerativeUI.server.d.ts.map +1 -1
  7. package/dist/JSONGenerativeUI.shared.d.ts +35 -36
  8. package/dist/JSONGenerativeUI.shared.d.ts.map +1 -1
  9. package/dist/a2ui/convert.d.ts +7 -7
  10. package/dist/a2ui/convert.d.ts.map +1 -1
  11. package/dist/a2ui/convert.js +115 -16
  12. package/dist/a2ui/convert.js.map +1 -1
  13. package/dist/a2ui/reducer.d.ts +1 -3
  14. package/dist/a2ui/reducer.d.ts.map +1 -1
  15. package/dist/a2ui/reducer.js +8 -0
  16. package/dist/a2ui/reducer.js.map +1 -1
  17. package/dist/a2ui/snapshot.d.ts +3 -0
  18. package/dist/a2ui/snapshot.d.ts.map +1 -0
  19. package/dist/a2ui/snapshot.js +33 -0
  20. package/dist/a2ui/snapshot.js.map +1 -0
  21. package/dist/a2ui/types.d.ts +50 -40
  22. package/dist/a2ui/types.d.ts.map +1 -1
  23. package/dist/a2ui/types.js.map +1 -1
  24. package/dist/a2ui.d.ts +5 -4
  25. package/dist/a2ui.d.ts.map +1 -0
  26. package/dist/a2ui.js +2 -1
  27. package/dist/actionRegistry.d.ts +12 -14
  28. package/dist/actionRegistry.d.ts.map +1 -1
  29. package/dist/actionRegistry.js.map +1 -1
  30. package/dist/buildPresentParameters.d.ts +2 -4
  31. package/dist/buildPresentParameters.d.ts.map +1 -1
  32. package/dist/buildPresentParameters.js +16 -4
  33. package/dist/buildPresentParameters.js.map +1 -1
  34. package/dist/constants.d.ts +0 -2
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/convert/boundSpec.d.ts +0 -2
  37. package/dist/convert/boundSpec.d.ts.map +1 -1
  38. package/dist/convert/copyBounded.d.ts +2 -4
  39. package/dist/convert/copyBounded.d.ts.map +1 -1
  40. package/dist/convert/isElement.d.ts +1 -3
  41. package/dist/convert/isElement.d.ts.map +1 -1
  42. package/dist/convert/takeRun.d.ts +3 -5
  43. package/dist/convert/takeRun.d.ts.map +1 -1
  44. package/dist/defineGenerativeComponents.d.ts +1 -3
  45. package/dist/defineGenerativeComponents.d.ts.map +1 -1
  46. package/dist/generativeUIToJSX.d.ts +4 -6
  47. package/dist/generativeUIToJSX.d.ts.map +1 -1
  48. package/dist/index.d.ts +3 -13
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.server.d.ts +3 -13
  51. package/dist/index.server.d.ts.map +1 -0
  52. package/dist/index.shared.d.ts +15 -11
  53. package/dist/index.shared.d.ts.map +1 -0
  54. package/dist/ir.d.ts +17 -19
  55. package/dist/ir.d.ts.map +1 -1
  56. package/dist/renderGenerativeUI.d.ts +2 -4
  57. package/dist/renderGenerativeUI.d.ts.map +1 -1
  58. package/dist/scopeSchema.d.ts +6 -0
  59. package/dist/scopeSchema.d.ts.map +1 -0
  60. package/dist/scopeSchema.js +56 -0
  61. package/dist/scopeSchema.js.map +1 -0
  62. package/dist/slack/constants.d.ts +8 -9
  63. package/dist/slack/constants.d.ts.map +1 -1
  64. package/dist/slack/decodeBlockAction.d.ts +1 -3
  65. package/dist/slack/decodeBlockAction.d.ts.map +1 -1
  66. package/dist/slack/fromSlackBlocks.d.ts +1 -3
  67. package/dist/slack/fromSlackBlocks.d.ts.map +1 -1
  68. package/dist/slack/toSlackBlocks.d.ts +1 -3
  69. package/dist/slack/toSlackBlocks.d.ts.map +1 -1
  70. package/dist/slack/toSlackBlocks.js +1 -1
  71. package/dist/slack/types.d.ts +78 -80
  72. package/dist/slack/types.d.ts.map +1 -1
  73. package/dist/slack.d.ts +5 -5
  74. package/dist/slack.d.ts.map +1 -0
  75. package/dist/teams/constants.d.ts +1 -3
  76. package/dist/teams/constants.d.ts.map +1 -1
  77. package/dist/teams/decodeSubmitData.d.ts +1 -3
  78. package/dist/teams/decodeSubmitData.d.ts.map +1 -1
  79. package/dist/teams/toAdaptiveCard.d.ts +4 -6
  80. package/dist/teams/toAdaptiveCard.d.ts.map +1 -1
  81. package/dist/teams/toTeamsAttachments.d.ts +1 -3
  82. package/dist/teams/toTeamsAttachments.d.ts.map +1 -1
  83. package/dist/teams/types.d.ts +108 -109
  84. package/dist/teams/types.d.ts.map +1 -1
  85. package/dist/teams.d.ts +5 -5
  86. package/dist/teams.d.ts.map +1 -0
  87. package/dist/types.d.ts +36 -37
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/vocabulary/alert.d.ts +21 -23
  90. package/dist/vocabulary/alert.d.ts.map +1 -1
  91. package/dist/vocabulary/collectFormValues.d.ts +8 -10
  92. package/dist/vocabulary/collectFormValues.d.ts.map +1 -1
  93. package/dist/vocabulary/data.d.ts +45 -47
  94. package/dist/vocabulary/data.d.ts.map +1 -1
  95. package/dist/vocabulary/dispatch.d.ts +2 -4
  96. package/dist/vocabulary/dispatch.d.ts.map +1 -1
  97. package/dist/vocabulary/fact.d.ts +8 -10
  98. package/dist/vocabulary/fact.d.ts.map +1 -1
  99. package/dist/vocabulary/form.d.ts +7 -9
  100. package/dist/vocabulary/form.d.ts.map +1 -1
  101. package/dist/vocabulary/icon.d.ts +37 -39
  102. package/dist/vocabulary/icon.d.ts.map +1 -1
  103. package/dist/vocabulary/index.d.ts +1 -3
  104. package/dist/vocabulary/index.d.ts.map +1 -1
  105. package/dist/vocabulary/interactive.d.ts +87 -86
  106. package/dist/vocabulary/interactive.d.ts.map +1 -1
  107. package/dist/vocabulary/interactive.js +4 -4
  108. package/dist/vocabulary/interactive.js.map +1 -1
  109. package/dist/vocabulary/layout.d.ts +75 -77
  110. package/dist/vocabulary/layout.d.ts.map +1 -1
  111. package/dist/vocabulary/list.d.ts +10 -12
  112. package/dist/vocabulary/list.d.ts.map +1 -1
  113. package/dist/vocabulary/media.d.ts +21 -23
  114. package/dist/vocabulary/media.d.ts.map +1 -1
  115. package/dist/vocabulary/text.d.ts +53 -55
  116. package/dist/vocabulary/text.d.ts.map +1 -1
  117. package/dist/vocabulary/toTextContent.d.ts +0 -2
  118. package/dist/vocabulary/toTextContent.d.ts.map +1 -1
  119. package/package.json +4 -4
  120. package/src/JSONGenerativeUI.client.tsx +57 -15
  121. package/src/JSONGenerativeUI.test.tsx +298 -4
  122. package/src/a2ui/convert.test.ts +496 -0
  123. package/src/a2ui/convert.ts +170 -25
  124. package/src/a2ui/reducer.test.ts +18 -0
  125. package/src/a2ui/reducer.ts +16 -0
  126. package/src/a2ui/snapshot.test.ts +52 -0
  127. package/src/a2ui/snapshot.ts +52 -0
  128. package/src/a2ui/types.ts +16 -0
  129. package/src/a2ui.ts +2 -0
  130. package/src/actionRegistry.ts +5 -5
  131. package/src/buildPresentParameters.test.ts +246 -0
  132. package/src/buildPresentParameters.ts +18 -3
  133. package/src/scopeSchema.test.ts +72 -0
  134. package/src/scopeSchema.ts +71 -0
  135. package/src/vocabulary/interactive.dispatch.test.tsx +17 -3
  136. package/src/vocabulary/interactive.test.tsx +19 -0
  137. 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
- Card: {
5
- description: string;
6
- properties: z.ZodObject<{
7
- title: z.ZodOptional<z.ZodString>;
8
- padding: z.ZodOptional<z.ZodNumber>;
9
- background: z.ZodOptional<z.ZodString>;
10
- asForm: z.ZodOptional<z.ZodBoolean>;
11
- confirm: z.ZodOptional<z.ZodObject<{
12
- label: z.ZodString;
13
- $action: z.ZodOptional<z.ZodObject<{
14
- type: z.ZodString;
15
- }, z.core.$loose>>;
16
- }, z.core.$strip>>;
17
- cancel: z.ZodOptional<z.ZodObject<{
18
- label: z.ZodString;
19
- $action: z.ZodOptional<z.ZodObject<{
20
- type: z.ZodString;
21
- }, z.core.$loose>>;
22
- }, z.core.$strip>>;
23
- }, z.core.$strip>;
24
- render: ({ title, padding, background, asForm, confirm, cancel, $dispatch, children }: any) => import("react").JSX.Element;
25
- };
26
- Col: {
27
- description: string;
28
- properties: z.ZodObject<{
29
- gap: z.ZodOptional<z.ZodNumber>;
30
- align: z.ZodOptional<z.ZodEnum<{
31
- start: "start";
32
- center: "center";
33
- end: "end";
34
- }>>;
35
- }, z.core.$strip>;
36
- render: ({ gap, align, children }: any) => import("react").JSX.Element;
37
- };
38
- Row: {
39
- description: string;
40
- properties: z.ZodObject<{
41
- gap: z.ZodOptional<z.ZodNumber>;
42
- align: z.ZodOptional<z.ZodEnum<{
43
- start: "start";
44
- center: "center";
45
- end: "end";
46
- }>>;
47
- justify: z.ZodOptional<z.ZodEnum<{
48
- start: "start";
49
- center: "center";
50
- end: "end";
51
- between: "between";
52
- }>>;
53
- }, z.core.$strip>;
54
- render: ({ gap, align, justify, children }: any) => import("react").JSX.Element;
55
- };
56
- Spacer: {
57
- description: string;
58
- properties: z.ZodObject<{}, z.core.$strip>;
59
- render: () => import("react").JSX.Element;
60
- };
61
- Badge: {
62
- description: string;
63
- properties: z.ZodObject<{
64
- value: z.ZodString;
65
- variant: z.ZodOptional<z.ZodString>;
66
- }, z.core.$strip>;
67
- render: ({ value, variant, children }: any) => import("react").JSX.Element;
68
- };
69
- Box: {
70
- description: string;
71
- properties: z.ZodObject<{
72
- width: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
73
- height: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
74
- radius: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"full">, z.ZodNumber]>>;
75
- background: z.ZodOptional<z.ZodString>;
76
- }, z.core.$strip>;
77
- render: ({ width, height, radius, background, children }: any) => import("react").JSX.Element;
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","names":[],"sources":["../../src/vocabulary/layout.tsx"],"mappings":";;qBAwBa"}
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
- ListView: {
5
- description: string;
6
- properties: z.ZodObject<{}, z.core.$strip>;
7
- render: ({ children }: any) => import("react").JSX.Element;
8
- };
9
- ListViewItem: {
10
- description: string;
11
- properties: z.ZodObject<{}, z.core.$strip>;
12
- render: ({ $action, $dispatch, children }: any) => import("react").JSX.Element;
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","names":[],"sources":["../../src/vocabulary/list.tsx"],"mappings":";;qBAOa"}
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
- Image: {
5
- description: string;
6
- properties: z.ZodObject<{
7
- src: z.ZodString;
8
- alt: z.ZodString;
9
- size: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
10
- sm: "sm";
11
- md: "md";
12
- lg: "lg";
13
- }>, z.ZodNumber]>>;
14
- round: z.ZodOptional<z.ZodBoolean>;
15
- }, z.core.$strip>;
16
- render: ({ src, alt, size, round }: any) => import("react").JSX.Element;
17
- };
18
- Divider: {
19
- description: string;
20
- properties: z.ZodObject<{
21
- flush: z.ZodOptional<z.ZodBoolean>;
22
- }, z.core.$strip>;
23
- render: ({ flush }: any) => import("react").JSX.Element;
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","names":[],"sources":["../../src/vocabulary/media.tsx"],"mappings":";;qBAKa"}
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
- Header: {
5
- description: string;
6
- properties: z.ZodObject<{
7
- text: z.ZodString;
8
- size: z.ZodOptional<z.ZodEnum<{
9
- sm: "sm";
10
- md: "md";
11
- lg: "lg";
12
- xl: "xl";
13
- "2xl": "2xl";
14
- "3xl": "3xl";
15
- }>>;
16
- }, z.core.$strip>;
17
- render: ({ text, size, children }: any) => import("react").JSX.Element;
18
- };
19
- Text: {
20
- description: string;
21
- properties: z.ZodObject<{
22
- value: z.ZodString;
23
- size: z.ZodOptional<z.ZodEnum<{
24
- sm: "sm";
25
- md: "md";
26
- lg: "lg";
27
- xl: "xl";
28
- "2xl": "2xl";
29
- "3xl": "3xl";
30
- }>>;
31
- weight: z.ZodOptional<z.ZodEnum<{
32
- bold: "bold";
33
- normal: "normal";
34
- medium: "medium";
35
- semibold: "semibold";
36
- }>>;
37
- color: z.ZodOptional<z.ZodEnum<{
38
- secondary: "secondary";
39
- emphasis: "emphasis";
40
- "alpha-70": "alpha-70";
41
- white: "white";
42
- "white-70": "white-70";
43
- "white-50": "white-50";
44
- }>>;
45
- }, z.core.$strip>;
46
- streamProperties: true;
47
- render: ({ value, size, weight, color, children }: any) => import("react").JSX.Element;
48
- };
49
- Caption: {
50
- description: string;
51
- properties: z.ZodObject<{
52
- value: z.ZodString;
53
- }, z.core.$strip>;
54
- streamProperties: true;
55
- render: ({ value, children }: any) => import("react").JSX.Element;
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","names":[],"sources":["../../src/vocabulary/text.tsx"],"mappings":";;qBAKa"}
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,4 +1,2 @@
1
- //#region src/vocabulary/toTextContent.d.ts
2
1
  export declare const toTextContent: (value: unknown) => string | number | null;
3
- //#endregion
4
2
  //# sourceMappingURL=toTextContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toTextContent.d.ts","names":[],"sources":["../../src/vocabulary/toTextContent.ts"],"mappings":";qBAAa,gBAAiB"}
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.19",
3
+ "version": "0.0.20",
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.44"
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.21",
69
- "@assistant-ui/x-buildutils": "0.0.28",
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
- args,
53
- status,
54
- }: {
55
- args: unknown;
56
- status: { type: string };
57
- }): ReactNode => (
58
- <div data-aui="root">
59
- {renderGenerativeUI(args, this.library, {
60
- status: uiStatus(status),
61
- ...(this.actions ? { dispatch: this.actions.dispatch } : {}),
62
- })}
63
- </div>
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
  }