@copilotkit/shared 2.0.0-rc.30 → 2.0.0-rc.32

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 (231) hide show
  1. package/README.md +1 -1
  2. package/dist/generative-ui/catalog/catalog-export.cjs +329 -0
  3. package/dist/generative-ui/catalog/catalog-export.cjs.map +1 -0
  4. package/dist/generative-ui/catalog/catalog-export.d.cts +92 -0
  5. package/dist/generative-ui/catalog/catalog-export.d.cts.map +1 -0
  6. package/dist/generative-ui/catalog/catalog-export.d.mts +92 -0
  7. package/dist/generative-ui/catalog/catalog-export.d.mts.map +1 -0
  8. package/dist/generative-ui/catalog/catalog-export.mjs +328 -0
  9. package/dist/generative-ui/catalog/catalog-export.mjs.map +1 -0
  10. package/dist/generative-ui/catalog/catalog.cjs +315 -0
  11. package/dist/generative-ui/catalog/catalog.cjs.map +1 -0
  12. package/dist/generative-ui/catalog/catalog.d.cts +407 -0
  13. package/dist/generative-ui/catalog/catalog.d.cts.map +1 -0
  14. package/dist/generative-ui/catalog/catalog.d.mts +407 -0
  15. package/dist/generative-ui/catalog/catalog.d.mts.map +1 -0
  16. package/dist/generative-ui/catalog/catalog.mjs +312 -0
  17. package/dist/generative-ui/catalog/catalog.mjs.map +1 -0
  18. package/dist/generative-ui/catalog/errors.cjs +13 -0
  19. package/dist/generative-ui/catalog/errors.cjs.map +1 -0
  20. package/dist/generative-ui/catalog/errors.d.cts +46 -0
  21. package/dist/generative-ui/catalog/errors.d.cts.map +1 -0
  22. package/dist/generative-ui/catalog/errors.d.mts +46 -0
  23. package/dist/generative-ui/catalog/errors.d.mts.map +1 -0
  24. package/dist/generative-ui/catalog/errors.mjs +12 -0
  25. package/dist/generative-ui/catalog/errors.mjs.map +1 -0
  26. package/dist/generative-ui/catalog/index.d.mts +6 -0
  27. package/dist/generative-ui/catalog/json-schema.cjs +16 -0
  28. package/dist/generative-ui/catalog/json-schema.cjs.map +1 -0
  29. package/dist/generative-ui/catalog/json-schema.d.cts +12 -0
  30. package/dist/generative-ui/catalog/json-schema.d.cts.map +1 -0
  31. package/dist/generative-ui/catalog/json-schema.d.mts +12 -0
  32. package/dist/generative-ui/catalog/json-schema.d.mts.map +1 -0
  33. package/dist/generative-ui/catalog/json-schema.mjs +16 -0
  34. package/dist/generative-ui/catalog/json-schema.mjs.map +1 -0
  35. package/dist/generative-ui/catalog/refs.cjs +21 -0
  36. package/dist/generative-ui/catalog/refs.cjs.map +1 -0
  37. package/dist/generative-ui/catalog/refs.d.cts +55 -0
  38. package/dist/generative-ui/catalog/refs.d.cts.map +1 -0
  39. package/dist/generative-ui/catalog/refs.d.mts +55 -0
  40. package/dist/generative-ui/catalog/refs.d.mts.map +1 -0
  41. package/dist/generative-ui/catalog/refs.mjs +18 -0
  42. package/dist/generative-ui/catalog/refs.mjs.map +1 -0
  43. package/dist/generative-ui/catalog/schema.cjs +74 -0
  44. package/dist/generative-ui/catalog/schema.cjs.map +1 -0
  45. package/dist/generative-ui/catalog/schema.d.cts +43 -0
  46. package/dist/generative-ui/catalog/schema.d.cts.map +1 -0
  47. package/dist/generative-ui/catalog/schema.d.mts +43 -0
  48. package/dist/generative-ui/catalog/schema.d.mts.map +1 -0
  49. package/dist/generative-ui/catalog/schema.mjs +68 -0
  50. package/dist/generative-ui/catalog/schema.mjs.map +1 -0
  51. package/dist/generative-ui/index.cjs +247 -0
  52. package/dist/generative-ui/index.d.cts +33 -0
  53. package/dist/generative-ui/index.d.mts +35 -0
  54. package/dist/generative-ui/index.mjs +34 -0
  55. package/dist/generative-ui/is-record.cjs +6 -1
  56. package/dist/generative-ui/is-record.cjs.map +1 -1
  57. package/dist/generative-ui/is-record.d.cts +6 -0
  58. package/dist/generative-ui/is-record.d.cts.map +1 -0
  59. package/dist/generative-ui/is-record.d.mts +6 -0
  60. package/dist/generative-ui/is-record.d.mts.map +1 -0
  61. package/dist/generative-ui/is-record.mjs +6 -2
  62. package/dist/generative-ui/is-record.mjs.map +1 -1
  63. package/dist/generative-ui/standard/chart.cjs +56 -0
  64. package/dist/generative-ui/standard/chart.cjs.map +1 -0
  65. package/dist/generative-ui/standard/chart.d.cts +62 -0
  66. package/dist/generative-ui/standard/chart.d.cts.map +1 -0
  67. package/dist/generative-ui/standard/chart.d.mts +62 -0
  68. package/dist/generative-ui/standard/chart.d.mts.map +1 -0
  69. package/dist/generative-ui/standard/chart.mjs +54 -0
  70. package/dist/generative-ui/standard/chart.mjs.map +1 -0
  71. package/dist/generative-ui/standard/checks.cjs +74 -0
  72. package/dist/generative-ui/standard/checks.cjs.map +1 -0
  73. package/dist/generative-ui/standard/checks.d.cts +56 -0
  74. package/dist/generative-ui/standard/checks.d.cts.map +1 -0
  75. package/dist/generative-ui/standard/checks.d.mts +56 -0
  76. package/dist/generative-ui/standard/checks.d.mts.map +1 -0
  77. package/dist/generative-ui/standard/checks.mjs +71 -0
  78. package/dist/generative-ui/standard/checks.mjs.map +1 -0
  79. package/dist/generative-ui/standard/components.cjs +23 -0
  80. package/dist/generative-ui/standard/components.cjs.map +1 -0
  81. package/dist/generative-ui/standard/components.d.cts +24 -0
  82. package/dist/generative-ui/standard/components.d.cts.map +1 -0
  83. package/dist/generative-ui/standard/components.d.mts +24 -0
  84. package/dist/generative-ui/standard/components.d.mts.map +1 -0
  85. package/dist/generative-ui/standard/components.mjs +22 -0
  86. package/dist/generative-ui/standard/components.mjs.map +1 -0
  87. package/dist/generative-ui/standard/composites.cjs +143 -0
  88. package/dist/generative-ui/standard/composites.cjs.map +1 -0
  89. package/dist/generative-ui/standard/composites.d.cts +233 -0
  90. package/dist/generative-ui/standard/composites.d.cts.map +1 -0
  91. package/dist/generative-ui/standard/composites.d.mts +233 -0
  92. package/dist/generative-ui/standard/composites.d.mts.map +1 -0
  93. package/dist/generative-ui/standard/composites.mjs +132 -0
  94. package/dist/generative-ui/standard/composites.mjs.map +1 -0
  95. package/dist/generative-ui/standard/data.cjs +176 -0
  96. package/dist/generative-ui/standard/data.cjs.map +1 -0
  97. package/dist/generative-ui/standard/data.d.cts +365 -0
  98. package/dist/generative-ui/standard/data.d.cts.map +1 -0
  99. package/dist/generative-ui/standard/data.d.mts +365 -0
  100. package/dist/generative-ui/standard/data.d.mts.map +1 -0
  101. package/dist/generative-ui/standard/data.mjs +167 -0
  102. package/dist/generative-ui/standard/data.mjs.map +1 -0
  103. package/dist/generative-ui/standard/declarations.cjs +40 -0
  104. package/dist/generative-ui/standard/declarations.cjs.map +1 -0
  105. package/dist/generative-ui/standard/declarations.d.cts +2570 -0
  106. package/dist/generative-ui/standard/declarations.d.cts.map +1 -0
  107. package/dist/generative-ui/standard/declarations.d.mts +2571 -0
  108. package/dist/generative-ui/standard/declarations.d.mts.map +1 -0
  109. package/dist/generative-ui/standard/declarations.mjs +39 -0
  110. package/dist/generative-ui/standard/declarations.mjs.map +1 -0
  111. package/dist/generative-ui/standard/feedback.cjs +97 -0
  112. package/dist/generative-ui/standard/feedback.cjs.map +1 -0
  113. package/dist/generative-ui/standard/feedback.d.cts +133 -0
  114. package/dist/generative-ui/standard/feedback.d.cts.map +1 -0
  115. package/dist/generative-ui/standard/feedback.d.mts +133 -0
  116. package/dist/generative-ui/standard/feedback.d.mts.map +1 -0
  117. package/dist/generative-ui/standard/feedback.mjs +90 -0
  118. package/dist/generative-ui/standard/feedback.mjs.map +1 -0
  119. package/dist/generative-ui/standard/index.d.mts +16 -0
  120. package/dist/generative-ui/standard/inputs.cjs +333 -0
  121. package/dist/generative-ui/standard/inputs.cjs.map +1 -0
  122. package/dist/generative-ui/standard/inputs.d.cts +1128 -0
  123. package/dist/generative-ui/standard/inputs.d.cts.map +1 -0
  124. package/dist/generative-ui/standard/inputs.d.mts +1128 -0
  125. package/dist/generative-ui/standard/inputs.d.mts.map +1 -0
  126. package/dist/generative-ui/standard/inputs.mjs +318 -0
  127. package/dist/generative-ui/standard/inputs.mjs.map +1 -0
  128. package/dist/generative-ui/standard/layout.cjs +289 -0
  129. package/dist/generative-ui/standard/layout.cjs.map +1 -0
  130. package/dist/generative-ui/standard/layout.d.cts +1974 -0
  131. package/dist/generative-ui/standard/layout.d.cts.map +1 -0
  132. package/dist/generative-ui/standard/layout.d.mts +1975 -0
  133. package/dist/generative-ui/standard/layout.d.mts.map +1 -0
  134. package/dist/generative-ui/standard/layout.mjs +269 -0
  135. package/dist/generative-ui/standard/layout.mjs.map +1 -0
  136. package/dist/generative-ui/standard/map.cjs +27 -0
  137. package/dist/generative-ui/standard/map.cjs.map +1 -0
  138. package/dist/generative-ui/standard/map.d.cts +31 -0
  139. package/dist/generative-ui/standard/map.d.cts.map +1 -0
  140. package/dist/generative-ui/standard/map.d.mts +31 -0
  141. package/dist/generative-ui/standard/map.d.mts.map +1 -0
  142. package/dist/generative-ui/standard/map.mjs +25 -0
  143. package/dist/generative-ui/standard/map.mjs.map +1 -0
  144. package/dist/generative-ui/standard/media.cjs +215 -0
  145. package/dist/generative-ui/standard/media.cjs.map +1 -0
  146. package/dist/generative-ui/standard/media.d.cts +396 -0
  147. package/dist/generative-ui/standard/media.d.cts.map +1 -0
  148. package/dist/generative-ui/standard/media.d.mts +396 -0
  149. package/dist/generative-ui/standard/media.d.mts.map +1 -0
  150. package/dist/generative-ui/standard/media.mjs +205 -0
  151. package/dist/generative-ui/standard/media.mjs.map +1 -0
  152. package/dist/generative-ui/standard/parameter-order.cjs +231 -0
  153. package/dist/generative-ui/standard/parameter-order.cjs.map +1 -0
  154. package/dist/generative-ui/standard/parameter-order.d.cts +84 -0
  155. package/dist/generative-ui/standard/parameter-order.d.cts.map +1 -0
  156. package/dist/generative-ui/standard/parameter-order.d.mts +84 -0
  157. package/dist/generative-ui/standard/parameter-order.d.mts.map +1 -0
  158. package/dist/generative-ui/standard/parameter-order.mjs +230 -0
  159. package/dist/generative-ui/standard/parameter-order.mjs.map +1 -0
  160. package/dist/generative-ui/standard/styles.cjs +62 -0
  161. package/dist/generative-ui/standard/styles.cjs.map +1 -0
  162. package/dist/generative-ui/standard/styles.d.cts +17 -0
  163. package/dist/generative-ui/standard/styles.d.cts.map +1 -0
  164. package/dist/generative-ui/standard/styles.d.mts +17 -0
  165. package/dist/generative-ui/standard/styles.d.mts.map +1 -0
  166. package/dist/generative-ui/standard/styles.mjs +60 -0
  167. package/dist/generative-ui/standard/styles.mjs.map +1 -0
  168. package/dist/generative-ui/standard/text.cjs +226 -0
  169. package/dist/generative-ui/standard/text.cjs.map +1 -0
  170. package/dist/generative-ui/standard/text.d.cts +522 -0
  171. package/dist/generative-ui/standard/text.d.cts.map +1 -0
  172. package/dist/generative-ui/standard/text.d.mts +522 -0
  173. package/dist/generative-ui/standard/text.d.mts.map +1 -0
  174. package/dist/generative-ui/standard/text.mjs +209 -0
  175. package/dist/generative-ui/standard/text.mjs.map +1 -0
  176. package/dist/generative-ui/standard/theme.cjs +115 -0
  177. package/dist/generative-ui/standard/theme.cjs.map +1 -0
  178. package/dist/generative-ui/standard/theme.d.cts +60 -0
  179. package/dist/generative-ui/standard/theme.d.cts.map +1 -0
  180. package/dist/generative-ui/standard/theme.d.mts +60 -0
  181. package/dist/generative-ui/standard/theme.d.mts.map +1 -0
  182. package/dist/generative-ui/standard/theme.mjs +112 -0
  183. package/dist/generative-ui/standard/theme.mjs.map +1 -0
  184. package/dist/generative-ui/standard/tokens.cjs +336 -0
  185. package/dist/generative-ui/standard/tokens.cjs.map +1 -0
  186. package/dist/generative-ui/standard/tokens.d.cts +76 -0
  187. package/dist/generative-ui/standard/tokens.d.cts.map +1 -0
  188. package/dist/generative-ui/standard/tokens.d.mts +76 -0
  189. package/dist/generative-ui/standard/tokens.d.mts.map +1 -0
  190. package/dist/generative-ui/standard/tokens.mjs +305 -0
  191. package/dist/generative-ui/standard/tokens.mjs.map +1 -0
  192. package/dist/index.cjs.map +1 -1
  193. package/dist/index.d.cts +10 -10
  194. package/dist/index.d.mts +10 -10
  195. package/dist/index.mjs.map +1 -1
  196. package/dist/index.umd.js +2 -2
  197. package/dist/index.umd.js.map +1 -1
  198. package/dist/package.cjs +1 -1
  199. package/dist/package.mjs +1 -1
  200. package/package.json +7 -3
  201. package/src/generative-ui/base.ts +9 -0
  202. package/src/generative-ui/catalog/catalog-export.ts +478 -0
  203. package/src/generative-ui/catalog/catalog.ts +1167 -0
  204. package/src/generative-ui/catalog/errors.ts +102 -0
  205. package/src/generative-ui/catalog/index.ts +6 -0
  206. package/src/generative-ui/catalog/json-schema.ts +14 -0
  207. package/src/generative-ui/catalog/refs.ts +87 -0
  208. package/src/generative-ui/catalog/schema.ts +107 -0
  209. package/src/generative-ui/index.ts +7 -0
  210. package/src/generative-ui/is-record.ts +6 -1
  211. package/src/generative-ui/standard/__tests__/theme.test.ts +61 -0
  212. package/src/generative-ui/standard/__tests__/tokens.test.ts +139 -0
  213. package/src/generative-ui/standard/chart.ts +79 -0
  214. package/src/generative-ui/standard/checks.ts +98 -0
  215. package/src/generative-ui/standard/components.ts +35 -0
  216. package/src/generative-ui/standard/composites.ts +158 -0
  217. package/src/generative-ui/standard/data.ts +213 -0
  218. package/src/generative-ui/standard/declarations.ts +57 -0
  219. package/src/generative-ui/standard/feedback.ts +105 -0
  220. package/src/generative-ui/standard/index.ts +19 -0
  221. package/src/generative-ui/standard/inputs.ts +423 -0
  222. package/src/generative-ui/standard/layout.ts +312 -0
  223. package/src/generative-ui/standard/map.ts +32 -0
  224. package/src/generative-ui/standard/media.ts +265 -0
  225. package/src/generative-ui/standard/parameter-order.ts +155 -0
  226. package/src/generative-ui/standard/styles.ts +79 -0
  227. package/src/generative-ui/standard/text.ts +210 -0
  228. package/src/generative-ui/standard/theme.ts +198 -0
  229. package/src/generative-ui/standard/tokens.ts +317 -0
  230. package/src/index.ts +1 -1
  231. package/tsdown.config.ts +1 -1
@@ -0,0 +1,305 @@
1
+ import { hasOwnKey } from "../is-record.mjs";
2
+
3
+ //#region src/generative-ui/standard/tokens.ts
4
+ /**
5
+ * Design tokens of the standard components. Each token is a CSS variable
6
+ * with a literal fallback, so a host can restyle a surface with the
7
+ * `--a2ui-*` variables. A value that is not a token passes through as raw
8
+ * CSS.
9
+ */
10
+ /** Id of `standardUI`, the catalog id the model writes in createSurface. */
11
+ const STANDARD_CATALOG_ID = "copilotkit/standard@1";
12
+ const TITLE_SIZES = [
13
+ "sm",
14
+ "md",
15
+ "lg",
16
+ "xl",
17
+ "2xl",
18
+ "3xl",
19
+ "4xl",
20
+ "5xl"
21
+ ];
22
+ const TEXT_SIZES = [
23
+ "3xs",
24
+ "2xs",
25
+ "xs",
26
+ "sm",
27
+ "md",
28
+ "lg"
29
+ ];
30
+ const WEIGHTS = [
31
+ "normal",
32
+ "medium",
33
+ "semibold",
34
+ "bold"
35
+ ];
36
+ const ALIGN = [
37
+ "start",
38
+ "center",
39
+ "end",
40
+ "baseline",
41
+ "stretch"
42
+ ];
43
+ const JUSTIFY = [
44
+ "start",
45
+ "center",
46
+ "end",
47
+ "spaceBetween",
48
+ "spaceAround",
49
+ "spaceEvenly",
50
+ "stretch"
51
+ ];
52
+ const WRAP = [
53
+ "nowrap",
54
+ "wrap",
55
+ "wrap-reverse"
56
+ ];
57
+ const RADII = [
58
+ "2xs",
59
+ "xs",
60
+ "sm",
61
+ "md",
62
+ "lg",
63
+ "xl",
64
+ "2xl",
65
+ "3xl",
66
+ "4xl",
67
+ "full"
68
+ ];
69
+ const TEXT_COLORS = [
70
+ "default",
71
+ "prose",
72
+ "primary",
73
+ "emphasis",
74
+ "secondary",
75
+ "tertiary",
76
+ "success",
77
+ "info",
78
+ "warning",
79
+ "caution",
80
+ "danger",
81
+ "discovery"
82
+ ];
83
+ const BORDER_COLORS = [
84
+ "default",
85
+ "subtle",
86
+ "strong",
87
+ "info",
88
+ "warning",
89
+ "caution",
90
+ "success",
91
+ "danger",
92
+ "discovery"
93
+ ];
94
+ const BACKGROUNDS = [
95
+ "surface",
96
+ "surface-secondary",
97
+ "surface-tertiary",
98
+ "surface-elevated",
99
+ "surface-elevated-secondary",
100
+ "surface-inverted",
101
+ "surface-soft",
102
+ "info",
103
+ "warning",
104
+ "caution",
105
+ "success",
106
+ "danger",
107
+ "discovery",
108
+ "info-solid",
109
+ "warning-solid",
110
+ "caution-solid",
111
+ "success-solid",
112
+ "danger-solid",
113
+ "discovery-solid"
114
+ ];
115
+ const RADIUS_PX = {
116
+ "2xs": "2px",
117
+ xs: "4px",
118
+ sm: "6px",
119
+ md: "8px",
120
+ lg: "12px",
121
+ xl: "16px",
122
+ "2xl": "20px",
123
+ "3xl": "24px",
124
+ "4xl": "32px",
125
+ full: "9999px"
126
+ };
127
+ const TEXT_COLOR_FALLBACK = {
128
+ default: "#0d0d0d",
129
+ prose: "#0d0d0d",
130
+ primary: "#0d0d0d",
131
+ emphasis: "#000",
132
+ secondary: "#5d5d5d",
133
+ tertiary: "#8e8e8e",
134
+ success: "#00805d",
135
+ info: "#0068bc",
136
+ warning: "#946200",
137
+ caution: "#946200",
138
+ danger: "#c1322c",
139
+ discovery: "#7040c1"
140
+ };
141
+ const BG_FALLBACK = {
142
+ surface: "#fff",
143
+ "surface-secondary": "#f7f7f8",
144
+ "surface-tertiary": "#ececec",
145
+ "surface-elevated": "#fff",
146
+ "surface-elevated-secondary": "#f7f7f8",
147
+ "surface-inverted": "#0d0d0d",
148
+ "surface-soft": "#fcfcfc",
149
+ info: "rgba(0, 104, 188, 0.08)",
150
+ warning: "rgba(148, 98, 0, 0.08)",
151
+ caution: "rgba(148, 98, 0, 0.08)",
152
+ success: "rgba(0, 128, 93, 0.08)",
153
+ danger: "rgba(193, 50, 44, 0.08)",
154
+ discovery: "rgba(112, 64, 193, 0.08)",
155
+ "info-solid": "#0068bc",
156
+ "warning-solid": "#946200",
157
+ "caution-solid": "#946200",
158
+ "success-solid": "#00805d",
159
+ "danger-solid": "#c1322c",
160
+ "discovery-solid": "#7040c1"
161
+ };
162
+ const BORDER_FALLBACK = {
163
+ default: "rgba(0, 0, 0, 0.1)",
164
+ subtle: "rgba(0, 0, 0, 0.05)",
165
+ strong: "#cdcdcd",
166
+ info: "#9cc4ea",
167
+ warning: "#e6c98a",
168
+ caution: "#e6c98a",
169
+ success: "#9ad9c3",
170
+ danger: "#eeaaa6",
171
+ discovery: "#c8b4ea"
172
+ };
173
+ function hasToken(table, key) {
174
+ return hasOwnKey(table, key);
175
+ }
176
+ /** A number is a count of 4px steps. A string passes through as CSS. */
177
+ function spacing(value) {
178
+ if (value === void 0) return void 0;
179
+ return typeof value === "number" ? `calc(var(--spacing, 0.25rem) * ${value})` : value;
180
+ }
181
+ /** A radius token, a number of pixels, or raw CSS. */
182
+ function radius(value) {
183
+ if (value === void 0) return void 0;
184
+ if (typeof value === "number") return `${value}px`;
185
+ if (value === "full") return "9999px";
186
+ return hasToken(RADIUS_PX, value) ? `var(--a2ui-radius-${value}, ${RADIUS_PX[value]})` : value;
187
+ }
188
+ /** A text color token, or a raw CSS color. */
189
+ function textColor(value) {
190
+ if (!value) return void 0;
191
+ return hasToken(TEXT_COLOR_FALLBACK, value) ? `var(--a2ui-color-text-${value}, ${TEXT_COLOR_FALLBACK[value]})` : value;
192
+ }
193
+ /** A background token, or a raw CSS color. */
194
+ function backgroundColor(value) {
195
+ if (!value) return void 0;
196
+ return hasToken(BG_FALLBACK, value) ? `var(--a2ui-color-${value}, ${BG_FALLBACK[value]})` : value;
197
+ }
198
+ /** The one inner panel of a Card: near-white fill. */
199
+ const INNER_PANEL_BG = "var(--a2ui-color-panel, rgb(252, 252, 252))";
200
+ const SOFT_TINT = {
201
+ info: "rgba(0, 104, 188, 0.06)",
202
+ warning: "rgba(148, 98, 0, 0.06)",
203
+ caution: "rgba(148, 98, 0, 0.06)",
204
+ success: "rgba(0, 128, 93, 0.06)",
205
+ danger: "rgba(193, 50, 44, 0.06)",
206
+ discovery: "rgba(112, 64, 193, 0.06)"
207
+ };
208
+ /**
209
+ * The background of a panel inside a Card. A neutral surface becomes the
210
+ * near-white inner panel. A semantic tint gets lighter (about 6% alpha).
211
+ * Solid and raw values go through `backgroundColor`.
212
+ */
213
+ function panelBackground(value) {
214
+ if (!value) return void 0;
215
+ if (value === "surface-secondary" || value === "surface-soft" || value === "surface-elevated-secondary") return INNER_PANEL_BG;
216
+ return hasToken(SOFT_TINT, value) ? `var(--a2ui-color-${value}-soft, ${SOFT_TINT[value]})` : backgroundColor(value);
217
+ }
218
+ /** A border color token, or a raw CSS color. */
219
+ function borderColor(value) {
220
+ if (!value) return void 0;
221
+ return hasToken(BORDER_FALLBACK, value) ? `var(--a2ui-color-border-${value}, ${BORDER_FALLBACK[value]})` : value;
222
+ }
223
+ /**
224
+ * The type scale at a 16px base, in em, so a surface scales with the font
225
+ * size of the host: title lg = 18/28, 2xl = 24/32; text md = 16/26,
226
+ * sm = 14/20, xs = 12/16, 3xs = 10/12. Line heights are unitless ratios.
227
+ */
228
+ const TITLE_SCALE = {
229
+ sm: [".875em", 1.429],
230
+ md: ["1em", 1.5],
231
+ lg: ["1.125em", 1.556],
232
+ xl: ["1.25em", 1.4],
233
+ "2xl": ["1.5em", 1.333],
234
+ "3xl": ["1.875em", 1.2],
235
+ "4xl": ["2.25em", 1.111],
236
+ "5xl": ["3em", 1.083]
237
+ };
238
+ const TEXT_SCALE = {
239
+ "3xs": [".625em", 1.2],
240
+ "2xs": [".6875em", 1.273],
241
+ xs: [".75em", 1.333],
242
+ sm: [".875em", 1.429],
243
+ md: ["1em", 1.625],
244
+ lg: ["1.125em", 1.556]
245
+ };
246
+ /** Text on an accent fill (solid buttons and badges, selected segments). */
247
+ const ON_ACCENT = "var(--a2ui-color-on-accent, #fff)";
248
+ /** The fill of a control (checkbox, radio, slider thumb, selected segment). */
249
+ const CONTROL_BG = "var(--a2ui-color-control, #fff)";
250
+ const SHADOW_XS = "var(--a2ui-shadow-xs, 0 1px 2px rgba(0,0,0,.12))";
251
+ const SHADOW_SM = "var(--a2ui-shadow-sm, 0 1px 3px rgba(0,0,0,.12))";
252
+ const SHADOW_SOFT = "var(--a2ui-shadow-soft, 0 1px 3px rgba(0,0,0,.06))";
253
+ const SHADOW_MD = "var(--a2ui-shadow-md, 0 4px 12px rgba(0,0,0,.08))";
254
+ /** The scrim behind a lightbox or modal. */
255
+ const BACKDROP = "var(--a2ui-color-backdrop, rgba(0,0,0,.8))";
256
+ /** The moving highlight of a shimmer placeholder. */
257
+ const SHIMMER_HIGHLIGHT = "var(--a2ui-color-shimmer, rgba(255,255,255,.55))";
258
+ /** The hover band behind a chart column. */
259
+ const CHART_CURSOR = "var(--a2ui-color-chart-cursor, rgba(0,0,0,.04))";
260
+ /**
261
+ * Chart series colors: a soft blue family first, then muted companions, so
262
+ * a chart with many series stays easy to read. A host can change each one
263
+ * with `--a2ui-chart-1`, `--a2ui-chart-2`, and so on.
264
+ */
265
+ const CHART_PALETTE_FALLBACK = [
266
+ "#7fb0f2",
267
+ "#2f6fd1",
268
+ "#b7cff7",
269
+ "#8bb5a8",
270
+ "#d9b36b",
271
+ "#c08bb0"
272
+ ];
273
+ const CHART_PALETTE = CHART_PALETTE_FALLBACK.map((hex, index) => `var(--a2ui-chart-${index + 1}, ${hex})`);
274
+ /**
275
+ * A UI font stack. A surface inherits the font of the host. This value is
276
+ * for hosts that want it (`font-family: var(--a2ui-font-family, ...)`).
277
+ */
278
+ const FONT_FAMILY = "var(--a2ui-font-family, -apple-system, ui-sans-serif, system-ui, \"Segoe UI\", Helvetica, \"Apple Color Emoji\", Arial, sans-serif, \"Segoe UI Emoji\", \"Segoe UI Symbol\")";
279
+ /** The heading scale in em. */
280
+ function titleFont(size = "md") {
281
+ const [fontSize, lineHeight] = TITLE_SCALE[size];
282
+ return {
283
+ fontSize,
284
+ lineHeight,
285
+ fontWeight: 600
286
+ };
287
+ }
288
+ /** The body text size, in em of the text around it. */
289
+ function textFont(size = "md") {
290
+ const [fontSize, lineHeight] = TEXT_SCALE[size];
291
+ return {
292
+ fontSize,
293
+ lineHeight
294
+ };
295
+ }
296
+ const FONT_WEIGHT = {
297
+ normal: 400,
298
+ medium: 500,
299
+ semibold: 600,
300
+ bold: 700
301
+ };
302
+
303
+ //#endregion
304
+ export { ALIGN, BACKDROP, BACKGROUNDS, BORDER_COLORS, CHART_CURSOR, CHART_PALETTE, CONTROL_BG, FONT_FAMILY, FONT_WEIGHT, INNER_PANEL_BG, JUSTIFY, ON_ACCENT, RADII, SHADOW_MD, SHADOW_SM, SHADOW_SOFT, SHADOW_XS, SHIMMER_HIGHLIGHT, STANDARD_CATALOG_ID, TEXT_COLORS, TEXT_SIZES, TITLE_SIZES, WEIGHTS, WRAP, backgroundColor, borderColor, panelBackground, radius, spacing, textColor, textFont, titleFont };
305
+ //# sourceMappingURL=tokens.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.mjs","names":[],"sources":["../../../src/generative-ui/standard/tokens.ts"],"sourcesContent":["import { hasOwnKey } from \"../is-record\";\n\n/**\n * Design tokens of the standard components. Each token is a CSS variable\n * with a literal fallback, so a host can restyle a surface with the\n * `--a2ui-*` variables. A value that is not a token passes through as raw\n * CSS.\n */\n\n/** Id of `standardUI`, the catalog id the model writes in createSurface. */\nexport const STANDARD_CATALOG_ID = \"copilotkit/standard@1\";\n\nexport const TITLE_SIZES = [\n \"sm\",\n \"md\",\n \"lg\",\n \"xl\",\n \"2xl\",\n \"3xl\",\n \"4xl\",\n \"5xl\",\n] as const;\nexport const TEXT_SIZES = [\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\"] as const;\nexport const WEIGHTS = [\"normal\", \"medium\", \"semibold\", \"bold\"] as const;\nexport const ALIGN = [\"start\", \"center\", \"end\", \"baseline\", \"stretch\"] as const;\nexport const JUSTIFY = [\n \"start\",\n \"center\",\n \"end\",\n \"spaceBetween\",\n \"spaceAround\",\n \"spaceEvenly\",\n \"stretch\",\n] as const;\nexport const WRAP = [\"nowrap\", \"wrap\", \"wrap-reverse\"] as const;\nexport const RADII = [\n \"2xs\",\n \"xs\",\n \"sm\",\n \"md\",\n \"lg\",\n \"xl\",\n \"2xl\",\n \"3xl\",\n \"4xl\",\n \"full\",\n] as const;\nexport const TEXT_COLORS = [\n \"default\",\n \"prose\",\n \"primary\",\n \"emphasis\",\n \"secondary\",\n \"tertiary\",\n \"success\",\n \"info\",\n \"warning\",\n \"caution\",\n \"danger\",\n \"discovery\",\n] as const;\nexport const BORDER_COLORS = [\n \"default\",\n \"subtle\",\n \"strong\",\n \"info\",\n \"warning\",\n \"caution\",\n \"success\",\n \"danger\",\n \"discovery\",\n] as const;\nexport const BACKGROUNDS = [\n \"surface\",\n \"surface-secondary\",\n \"surface-tertiary\",\n \"surface-elevated\",\n \"surface-elevated-secondary\",\n \"surface-inverted\",\n \"surface-soft\",\n \"info\",\n \"warning\",\n \"caution\",\n \"success\",\n \"danger\",\n \"discovery\",\n \"info-solid\",\n \"warning-solid\",\n \"caution-solid\",\n \"success-solid\",\n \"danger-solid\",\n \"discovery-solid\",\n] as const;\n\nexport type TitleSize = (typeof TITLE_SIZES)[number];\nexport type TextSize = (typeof TEXT_SIZES)[number];\nexport type Weight = (typeof WEIGHTS)[number];\nexport type Radius = (typeof RADII)[number];\n\nconst RADIUS_PX: Record<Radius, string> = {\n \"2xs\": \"2px\",\n xs: \"4px\",\n sm: \"6px\",\n md: \"8px\",\n lg: \"12px\",\n xl: \"16px\",\n \"2xl\": \"20px\",\n \"3xl\": \"24px\",\n \"4xl\": \"32px\",\n full: \"9999px\",\n};\nconst TEXT_COLOR_FALLBACK: Record<string, string> = {\n default: \"#0d0d0d\",\n prose: \"#0d0d0d\",\n primary: \"#0d0d0d\",\n emphasis: \"#000\",\n secondary: \"#5d5d5d\",\n tertiary: \"#8e8e8e\",\n success: \"#00805d\",\n info: \"#0068bc\",\n warning: \"#946200\",\n caution: \"#946200\",\n danger: \"#c1322c\",\n discovery: \"#7040c1\",\n};\nconst BG_FALLBACK: Record<string, string> = {\n surface: \"#fff\",\n \"surface-secondary\": \"#f7f7f8\",\n \"surface-tertiary\": \"#ececec\",\n \"surface-elevated\": \"#fff\",\n \"surface-elevated-secondary\": \"#f7f7f8\",\n \"surface-inverted\": \"#0d0d0d\",\n \"surface-soft\": \"#fcfcfc\",\n // A semantic tint is a hint, not a block: the text color at low alpha.\n info: \"rgba(0, 104, 188, 0.08)\",\n warning: \"rgba(148, 98, 0, 0.08)\",\n caution: \"rgba(148, 98, 0, 0.08)\",\n success: \"rgba(0, 128, 93, 0.08)\",\n danger: \"rgba(193, 50, 44, 0.08)\",\n discovery: \"rgba(112, 64, 193, 0.08)\",\n \"info-solid\": \"#0068bc\",\n \"warning-solid\": \"#946200\",\n \"caution-solid\": \"#946200\",\n \"success-solid\": \"#00805d\",\n \"danger-solid\": \"#c1322c\",\n \"discovery-solid\": \"#7040c1\",\n};\nconst BORDER_FALLBACK: Record<string, string> = {\n default: \"rgba(0, 0, 0, 0.1)\",\n subtle: \"rgba(0, 0, 0, 0.05)\",\n strong: \"#cdcdcd\",\n info: \"#9cc4ea\",\n warning: \"#e6c98a\",\n caution: \"#e6c98a\",\n success: \"#9ad9c3\",\n danger: \"#eeaaa6\",\n discovery: \"#c8b4ea\",\n};\n\nfunction hasToken<Key extends string>(\n table: Record<Key, string>,\n key: string,\n): key is Key {\n return hasOwnKey(table, key);\n}\n\n/** A number is a count of 4px steps. A string passes through as CSS. */\nexport function spacing(value: number | string | undefined) {\n if (value === undefined) return undefined;\n return typeof value === \"number\"\n ? `calc(var(--spacing, 0.25rem) * ${value})`\n : value;\n}\n\n/** A radius token, a number of pixels, or raw CSS. */\nexport function radius(value: string | number | undefined) {\n if (value === undefined) return undefined;\n if (typeof value === \"number\") return `${value}px`;\n if (value === \"full\") return \"9999px\";\n return hasToken(RADIUS_PX, value)\n ? `var(--a2ui-radius-${value}, ${RADIUS_PX[value]})`\n : value;\n}\n\n/** A text color token, or a raw CSS color. */\nexport function textColor(value: string | undefined) {\n if (!value) return undefined;\n return hasToken(TEXT_COLOR_FALLBACK, value)\n ? `var(--a2ui-color-text-${value}, ${TEXT_COLOR_FALLBACK[value]})`\n : value;\n}\n\n/** A background token, or a raw CSS color. */\nexport function backgroundColor(value: string | undefined) {\n if (!value) return undefined;\n return hasToken(BG_FALLBACK, value)\n ? `var(--a2ui-color-${value}, ${BG_FALLBACK[value]})`\n : value;\n}\n\n/** The one inner panel of a Card: near-white fill. */\nexport const INNER_PANEL_BG = \"var(--a2ui-color-panel, rgb(252, 252, 252))\";\nconst SOFT_TINT: Record<string, string> = {\n info: \"rgba(0, 104, 188, 0.06)\",\n warning: \"rgba(148, 98, 0, 0.06)\",\n caution: \"rgba(148, 98, 0, 0.06)\",\n success: \"rgba(0, 128, 93, 0.06)\",\n danger: \"rgba(193, 50, 44, 0.06)\",\n discovery: \"rgba(112, 64, 193, 0.06)\",\n};\n\n/**\n * The background of a panel inside a Card. A neutral surface becomes the\n * near-white inner panel. A semantic tint gets lighter (about 6% alpha).\n * Solid and raw values go through `backgroundColor`.\n */\nexport function panelBackground(value: string | undefined) {\n if (!value) return undefined;\n const isNeutral =\n value === \"surface-secondary\" ||\n value === \"surface-soft\" ||\n value === \"surface-elevated-secondary\";\n if (isNeutral) return INNER_PANEL_BG;\n return hasToken(SOFT_TINT, value)\n ? `var(--a2ui-color-${value}-soft, ${SOFT_TINT[value]})`\n : backgroundColor(value);\n}\n\n/** A border color token, or a raw CSS color. */\nexport function borderColor(value: string | undefined) {\n if (!value) return undefined;\n return hasToken(BORDER_FALLBACK, value)\n ? `var(--a2ui-color-border-${value}, ${BORDER_FALLBACK[value]})`\n : value;\n}\n\n/**\n * The type scale at a 16px base, in em, so a surface scales with the font\n * size of the host: title lg = 18/28, 2xl = 24/32; text md = 16/26,\n * sm = 14/20, xs = 12/16, 3xs = 10/12. Line heights are unitless ratios.\n */\nconst TITLE_SCALE: Record<TitleSize, [string, number]> = {\n sm: [\".875em\", 1.429],\n md: [\"1em\", 1.5],\n lg: [\"1.125em\", 1.556],\n xl: [\"1.25em\", 1.4],\n \"2xl\": [\"1.5em\", 1.333],\n \"3xl\": [\"1.875em\", 1.2],\n \"4xl\": [\"2.25em\", 1.111],\n \"5xl\": [\"3em\", 1.083],\n};\nconst TEXT_SCALE: Record<TextSize, [string, number]> = {\n \"3xs\": [\".625em\", 1.2],\n \"2xs\": [\".6875em\", 1.273],\n xs: [\".75em\", 1.333],\n sm: [\".875em\", 1.429],\n md: [\"1em\", 1.625],\n lg: [\"1.125em\", 1.556],\n};\n\n/** Text on an accent fill (solid buttons and badges, selected segments). */\nexport const ON_ACCENT = \"var(--a2ui-color-on-accent, #fff)\";\n/** The fill of a control (checkbox, radio, slider thumb, selected segment). */\nexport const CONTROL_BG = \"var(--a2ui-color-control, #fff)\";\nexport const SHADOW_XS = \"var(--a2ui-shadow-xs, 0 1px 2px rgba(0,0,0,.12))\";\nexport const SHADOW_SM = \"var(--a2ui-shadow-sm, 0 1px 3px rgba(0,0,0,.12))\";\nexport const SHADOW_SOFT = \"var(--a2ui-shadow-soft, 0 1px 3px rgba(0,0,0,.06))\";\nexport const SHADOW_MD = \"var(--a2ui-shadow-md, 0 4px 12px rgba(0,0,0,.08))\";\n/** The scrim behind a lightbox or modal. */\nexport const BACKDROP = \"var(--a2ui-color-backdrop, rgba(0,0,0,.8))\";\n/** The moving highlight of a shimmer placeholder. */\nexport const SHIMMER_HIGHLIGHT =\n \"var(--a2ui-color-shimmer, rgba(255,255,255,.55))\";\n/** The hover band behind a chart column. */\nexport const CHART_CURSOR = \"var(--a2ui-color-chart-cursor, rgba(0,0,0,.04))\";\n/**\n * Chart series colors: a soft blue family first, then muted companions, so\n * a chart with many series stays easy to read. A host can change each one\n * with `--a2ui-chart-1`, `--a2ui-chart-2`, and so on.\n */\nconst CHART_PALETTE_FALLBACK = [\n \"#7fb0f2\",\n \"#2f6fd1\",\n \"#b7cff7\",\n \"#8bb5a8\",\n \"#d9b36b\",\n \"#c08bb0\",\n];\nexport const CHART_PALETTE = CHART_PALETTE_FALLBACK.map(\n (hex, index) => `var(--a2ui-chart-${index + 1}, ${hex})`,\n);\n\n/**\n * A UI font stack. A surface inherits the font of the host. This value is\n * for hosts that want it (`font-family: var(--a2ui-font-family, ...)`).\n */\nexport const FONT_FAMILY =\n 'var(--a2ui-font-family, -apple-system, ui-sans-serif, system-ui, \"Segoe UI\", Helvetica, \"Apple Color Emoji\", Arial, sans-serif, \"Segoe UI Emoji\", \"Segoe UI Symbol\")';\n\n/** The heading scale in em. */\nexport function titleFont(size: TitleSize = \"md\") {\n const [fontSize, lineHeight] = TITLE_SCALE[size];\n return { fontSize, lineHeight, fontWeight: 600 };\n}\n\n/** The body text size, in em of the text around it. */\nexport function textFont(size: TextSize = \"md\") {\n const [fontSize, lineHeight] = TEXT_SCALE[size];\n return { fontSize, lineHeight };\n}\n\nexport const FONT_WEIGHT: Record<Weight, number> = {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,sBAAsB;AAEnC,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,aAAa;CAAC;CAAO;CAAO;CAAM;CAAM;CAAM;CAAK;AAChE,MAAa,UAAU;CAAC;CAAU;CAAU;CAAY;CAAO;AAC/D,MAAa,QAAQ;CAAC;CAAS;CAAU;CAAO;CAAY;CAAU;AACtE,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,OAAO;CAAC;CAAU;CAAQ;CAAe;AACtD,MAAa,QAAQ;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAOD,MAAM,YAAoC;CACxC,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;CACP,MAAM;CACP;AACD,MAAM,sBAA8C;CAClD,SAAS;CACT,OAAO;CACP,SAAS;CACT,UAAU;CACV,WAAW;CACX,UAAU;CACV,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;CACR,WAAW;CACZ;AACD,MAAM,cAAsC;CAC1C,SAAS;CACT,qBAAqB;CACrB,oBAAoB;CACpB,oBAAoB;CACpB,8BAA8B;CAC9B,oBAAoB;CACpB,gBAAgB;CAEhB,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;CACR,WAAW;CACX,cAAc;CACd,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CACjB,gBAAgB;CAChB,mBAAmB;CACpB;AACD,MAAM,kBAA0C;CAC9C,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;CACR,WAAW;CACZ;AAED,SAAS,SACP,OACA,KACY;AACZ,QAAO,UAAU,OAAO,IAAI;;;AAI9B,SAAgB,QAAQ,OAAoC;AAC1D,KAAI,UAAU,OAAW,QAAO;AAChC,QAAO,OAAO,UAAU,WACpB,kCAAkC,MAAM,KACxC;;;AAIN,SAAgB,OAAO,OAAoC;AACzD,KAAI,UAAU,OAAW,QAAO;AAChC,KAAI,OAAO,UAAU,SAAU,QAAO,GAAG,MAAM;AAC/C,KAAI,UAAU,OAAQ,QAAO;AAC7B,QAAO,SAAS,WAAW,MAAM,GAC7B,qBAAqB,MAAM,IAAI,UAAU,OAAO,KAChD;;;AAIN,SAAgB,UAAU,OAA2B;AACnD,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,SAAS,qBAAqB,MAAM,GACvC,yBAAyB,MAAM,IAAI,oBAAoB,OAAO,KAC9D;;;AAIN,SAAgB,gBAAgB,OAA2B;AACzD,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,SAAS,aAAa,MAAM,GAC/B,oBAAoB,MAAM,IAAI,YAAY,OAAO,KACjD;;;AAIN,MAAa,iBAAiB;AAC9B,MAAM,YAAoC;CACxC,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;CACR,WAAW;CACZ;;;;;;AAOD,SAAgB,gBAAgB,OAA2B;AACzD,KAAI,CAAC,MAAO,QAAO;AAKnB,KAHE,UAAU,uBACV,UAAU,kBACV,UAAU,6BACG,QAAO;AACtB,QAAO,SAAS,WAAW,MAAM,GAC7B,oBAAoB,MAAM,SAAS,UAAU,OAAO,KACpD,gBAAgB,MAAM;;;AAI5B,SAAgB,YAAY,OAA2B;AACrD,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,SAAS,iBAAiB,MAAM,GACnC,2BAA2B,MAAM,IAAI,gBAAgB,OAAO,KAC5D;;;;;;;AAQN,MAAM,cAAmD;CACvD,IAAI,CAAC,UAAU,MAAM;CACrB,IAAI,CAAC,OAAO,IAAI;CAChB,IAAI,CAAC,WAAW,MAAM;CACtB,IAAI,CAAC,UAAU,IAAI;CACnB,OAAO,CAAC,SAAS,MAAM;CACvB,OAAO,CAAC,WAAW,IAAI;CACvB,OAAO,CAAC,UAAU,MAAM;CACxB,OAAO,CAAC,OAAO,MAAM;CACtB;AACD,MAAM,aAAiD;CACrD,OAAO,CAAC,UAAU,IAAI;CACtB,OAAO,CAAC,WAAW,MAAM;CACzB,IAAI,CAAC,SAAS,MAAM;CACpB,IAAI,CAAC,UAAU,MAAM;CACrB,IAAI,CAAC,OAAO,MAAM;CAClB,IAAI,CAAC,WAAW,MAAM;CACvB;;AAGD,MAAa,YAAY;;AAEzB,MAAa,aAAa;AAC1B,MAAa,YAAY;AACzB,MAAa,YAAY;AACzB,MAAa,cAAc;AAC3B,MAAa,YAAY;;AAEzB,MAAa,WAAW;;AAExB,MAAa,oBACX;;AAEF,MAAa,eAAe;;;;;;AAM5B,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACD;AACD,MAAa,gBAAgB,uBAAuB,KACjD,KAAK,UAAU,oBAAoB,QAAQ,EAAE,IAAI,IAAI,GACvD;;;;;AAMD,MAAa,cACX;;AAGF,SAAgB,UAAU,OAAkB,MAAM;CAChD,MAAM,CAAC,UAAU,cAAc,YAAY;AAC3C,QAAO;EAAE;EAAU;EAAY,YAAY;EAAK;;;AAIlD,SAAgB,SAAS,OAAiB,MAAM;CAC9C,MAAM,CAAC,UAAU,cAAc,WAAW;AAC1C,QAAO;EAAE;EAAU;EAAY;;AAGjC,MAAa,cAAsC;CACjD,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,MAAM;CACP"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\n// Only browser-safe telemetry helpers live here. The runtime owns its\n// telemetry client (`packages/runtime/src/runtime/telemetry`), so this package\n// imports no Node-only analytics SDK (#4151).\nexport { isTelemetryDisabled } from \"./telemetry/telemetry-disabled\";\nexport * from \"./telemetry/sampling\";\n// Pure string classification with no imports, so it carries no runtime edge\n// into browser builds — same reasoning as `sampling` above.\nexport * from \"./telemetry/model-host\";\nexport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseTelemetryIdFromLicense,\n parseAndWarnTelemetryId,\n} from \"./telemetry/lambda-client\";\nexport type { LambdaSendOptions } from \"./telemetry/lambda-client\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport {\n createRunEventFinalizer,\n finalizeRunEvents,\n type FinalizeRunOptions,\n type RunEventFinalizer,\n} from \"./finalize-events\";\nexport { stripIntelligenceRoutingFields } from \"./intelligence-routing-fields\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Effective license status after structured entitlement precedence. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a feature is licensed. Ready entitlements override legacy status behavior. */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Zero means unlimited; null means not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/** Read a record value without traversing its prototype chain. */\nfunction getOwnRecordValue<Value>(\n record: Readonly<Record<string, Value>>,\n key: string,\n): Value | undefined {\n return Object.prototype.hasOwnProperty.call(record, key)\n ? record[key]\n : undefined;\n}\n\n/** Legacy UI surfaces that remain available for every active entitlement. */\nfunction isLegacyUiFeature(feature: string): boolean {\n return feature === \"chat\" || feature === \"popup\" || feature === \"sidebar\";\n}\n\n/**\n * Client-safe license context factory, driven by the license authority the\n * runtime reports via /info.\n *\n * A ready managed entitlement is authoritative in both directions. A ready\n * active self-hosted entitlement is also authoritative, while an inactive\n * self-hosted response preserves the legacy signed-license fallback. Active\n * entitlements supply feature grants and limits; authoritative inactive\n * entitlements deny every feature and limit. Older runtimes that report only a\n * status retain the legacy behavior: features are enabled unless the status is\n * \"expired\" or \"invalid\", and no limits are reported. This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on Node's\n * `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n runtimeEntitlements?: RuntimeEntitlementResponse,\n): LicenseContextValue {\n const readyEntitlement =\n runtimeEntitlements?.status === \"ready\"\n ? runtimeEntitlements.entitlement\n : null;\n const hasUsableSelfHostedLegacyFallback =\n readyEntitlement &&\n !readyEntitlement.active &&\n readyEntitlement.source === \"selfHostedDeploymentLicense\" &&\n (status === \"valid\" || status === \"expiring\");\n const featureAuthority =\n readyEntitlement && !hasUsableSelfHostedLegacyFallback\n ? readyEntitlement\n : null;\n const activeEntitlement = featureAuthority?.active ? featureAuthority : null;\n const resolvedStatus = activeEntitlement\n ? \"valid\"\n : readyEntitlement?.source === \"managedOrgSubscription\" ||\n readyEntitlement?.source === \"awsMarketplaceDeploymentLicense\"\n ? \"none\"\n : featureAuthority\n ? (status ?? \"none\")\n : (status ?? null);\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: (feature) =>\n featureAuthority\n ? activeEntitlement\n ? feature === \"threads\" &&\n Object.prototype.hasOwnProperty.call(\n activeEntitlement.limits,\n \"threads.max_count\",\n )\n ? true\n : (getOwnRecordValue(activeEntitlement.features, feature) ??\n isLegacyUiFeature(feature))\n : false\n : featuresEnabled,\n getLimit: (feature) =>\n activeEntitlement\n ? (getOwnRecordValue(activeEntitlement.limits, feature) ?? null)\n : null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n ALL_GENERATIVE_UI_GUIDE_FEATURES,\n buildGenerativeUIMarkdownGuidelines,\n generativeUIGuideFeatures,\n GENERATIVE_UI_MARKDOWN_GUIDELINES,\n GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,\n GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,\n} from \"./a2ui-prompts\";\nexport type { GenerativeUIGuideFeatures } from \"./a2ui-prompts\";\nexport {\n COPILOTKIT_FORWARDED_PROPS_KEY,\n COPILOTKIT_UI_ENVELOPE_FORMAT,\n envelopeToManifest,\n readCopilotKitUIEnvelope,\n} from \"./a2ui-envelope\";\nexport type { CopilotKitUIEnvelope } from \"./a2ui-envelope\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n\nexport { GENERATE_SANDBOXED_UI_DESCRIPTION } from \"./open-generative-ui-prompts\";\nexport * from \"./generative-ui\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa;;AA0Cb,SAAS,kBACP,QACA,KACmB;AACnB,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,GACpD,OAAO,OACP;;;AAIN,SAAS,kBAAkB,SAA0B;AACnD,QAAO,YAAY,UAAU,YAAY,WAAW,YAAY;;;;;;;;;;;;;;;;AAiBlE,SAAgB,0BACd,QACA,qBACqB;CACrB,MAAM,mBACJ,qBAAqB,WAAW,UAC5B,oBAAoB,cACpB;CACN,MAAM,oCACJ,oBACA,CAAC,iBAAiB,UAClB,iBAAiB,WAAW,kCAC3B,WAAW,WAAW,WAAW;CACpC,MAAM,mBACJ,oBAAoB,CAAC,oCACjB,mBACA;CACN,MAAM,oBAAoB,kBAAkB,SAAS,mBAAmB;CACxE,MAAM,iBAAiB,oBACnB,UACA,kBAAkB,WAAW,4BAC3B,kBAAkB,WAAW,oCAC7B,SACA,mBACG,UAAU,SACV,UAAU;CACnB,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AAErD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,eAAe,YACb,mBACI,oBACE,YAAY,aACZ,OAAO,UAAU,eAAe,KAC9B,kBAAkB,QAClB,oBACD,GACC,OACC,kBAAkB,kBAAkB,UAAU,QAAQ,IACvD,kBAAkB,QAAQ,GAC5B,QACF;EACN,WAAW,YACT,oBACK,kBAAkB,kBAAkB,QAAQ,QAAQ,IAAI,OACzD;EACP"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\n// Only browser-safe telemetry helpers live here. The runtime owns its\n// telemetry client (`packages/runtime/src/runtime/telemetry`), so this package\n// imports no Node-only analytics SDK (#4151).\nexport { isTelemetryDisabled } from \"./telemetry/telemetry-disabled\";\nexport * from \"./telemetry/sampling\";\n// Pure string classification with no imports, so it carries no runtime edge\n// into browser builds — same reasoning as `sampling` above.\nexport * from \"./telemetry/model-host\";\nexport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseTelemetryIdFromLicense,\n parseAndWarnTelemetryId,\n} from \"./telemetry/lambda-client\";\nexport type { LambdaSendOptions } from \"./telemetry/lambda-client\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport {\n createRunEventFinalizer,\n finalizeRunEvents,\n type FinalizeRunOptions,\n type RunEventFinalizer,\n} from \"./finalize-events\";\nexport { stripIntelligenceRoutingFields } from \"./intelligence-routing-fields\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Effective license status after structured entitlement precedence. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a feature is licensed. Ready entitlements override legacy status behavior. */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Zero means unlimited; null means not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/** Read a record value without traversing its prototype chain. */\nfunction getOwnRecordValue<Value>(\n record: Readonly<Record<string, Value>>,\n key: string,\n): Value | undefined {\n return Object.prototype.hasOwnProperty.call(record, key)\n ? record[key]\n : undefined;\n}\n\n/** Legacy UI surfaces that remain available for every active entitlement. */\nfunction isLegacyUiFeature(feature: string): boolean {\n return feature === \"chat\" || feature === \"popup\" || feature === \"sidebar\";\n}\n\n/**\n * Client-safe license context factory, driven by the license authority the\n * runtime reports via /info.\n *\n * A ready managed entitlement is authoritative in both directions. A ready\n * active self-hosted entitlement is also authoritative, while an inactive\n * self-hosted response preserves the legacy signed-license fallback. Active\n * entitlements supply feature grants and limits; authoritative inactive\n * entitlements deny every feature and limit. Older runtimes that report only a\n * status retain the legacy behavior: features are enabled unless the status is\n * \"expired\" or \"invalid\", and no limits are reported. This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on Node's\n * `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n runtimeEntitlements?: RuntimeEntitlementResponse,\n): LicenseContextValue {\n const readyEntitlement =\n runtimeEntitlements?.status === \"ready\"\n ? runtimeEntitlements.entitlement\n : null;\n const hasUsableSelfHostedLegacyFallback =\n readyEntitlement &&\n !readyEntitlement.active &&\n readyEntitlement.source === \"selfHostedDeploymentLicense\" &&\n (status === \"valid\" || status === \"expiring\");\n const featureAuthority =\n readyEntitlement && !hasUsableSelfHostedLegacyFallback\n ? readyEntitlement\n : null;\n const activeEntitlement = featureAuthority?.active ? featureAuthority : null;\n const resolvedStatus = activeEntitlement\n ? \"valid\"\n : readyEntitlement?.source === \"managedOrgSubscription\" ||\n readyEntitlement?.source === \"awsMarketplaceDeploymentLicense\"\n ? \"none\"\n : featureAuthority\n ? (status ?? \"none\")\n : (status ?? null);\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: (feature) =>\n featureAuthority\n ? activeEntitlement\n ? feature === \"threads\" &&\n Object.prototype.hasOwnProperty.call(\n activeEntitlement.limits,\n \"threads.max_count\",\n )\n ? true\n : (getOwnRecordValue(activeEntitlement.features, feature) ??\n isLegacyUiFeature(feature))\n : false\n : featuresEnabled,\n getLimit: (feature) =>\n activeEntitlement\n ? (getOwnRecordValue(activeEntitlement.limits, feature) ?? null)\n : null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n ALL_GENERATIVE_UI_GUIDE_FEATURES,\n buildGenerativeUIMarkdownGuidelines,\n generativeUIGuideFeatures,\n GENERATIVE_UI_MARKDOWN_GUIDELINES,\n GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,\n GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,\n} from \"./a2ui-prompts\";\nexport type { GenerativeUIGuideFeatures } from \"./a2ui-prompts\";\nexport {\n COPILOTKIT_FORWARDED_PROPS_KEY,\n COPILOTKIT_UI_ENVELOPE_FORMAT,\n envelopeToManifest,\n readCopilotKitUIEnvelope,\n} from \"./a2ui-envelope\";\nexport type { CopilotKitUIEnvelope } from \"./a2ui-envelope\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n\nexport { GENERATE_SANDBOXED_UI_DESCRIPTION } from \"./open-generative-ui-prompts\";\nexport * from \"./generative-ui/base\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa;;AA0Cb,SAAS,kBACP,QACA,KACmB;AACnB,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,GACpD,OAAO,OACP;;;AAIN,SAAS,kBAAkB,SAA0B;AACnD,QAAO,YAAY,UAAU,YAAY,WAAW,YAAY;;;;;;;;;;;;;;;;AAiBlE,SAAgB,0BACd,QACA,qBACqB;CACrB,MAAM,mBACJ,qBAAqB,WAAW,UAC5B,oBAAoB,cACpB;CACN,MAAM,oCACJ,oBACA,CAAC,iBAAiB,UAClB,iBAAiB,WAAW,kCAC3B,WAAW,WAAW,WAAW;CACpC,MAAM,mBACJ,oBAAoB,CAAC,oCACjB,mBACA;CACN,MAAM,oBAAoB,kBAAkB,SAAS,mBAAmB;CACxE,MAAM,iBAAiB,oBACnB,UACA,kBAAkB,WAAW,4BAC3B,kBAAkB,WAAW,oCAC7B,SACA,mBACG,UAAU,SACV,UAAU;CACnB,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AAErD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,eAAe,YACb,mBACI,oBACE,YAAY,aACZ,OAAO,UAAU,eAAe,KAC9B,kBAAkB,QAClB,oBACD,GACC,OACC,kBAAkB,kBAAkB,UAAU,QAAQ,IACvD,kBAAkB,QAAQ,GAC5B,QACF;EACN,WAAW,YACT,oBACK,kBAAkB,kBAAkB,QAAQ,QAAQ,IAAI,OACzD;EACP"}
package/dist/index.d.cts CHANGED
@@ -1,3 +1,13 @@
1
+ import { A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_INDEX_FUNCTION, COPILOTKIT_FUNCTIONS, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, functionCallers, isA2UIBasicFunction, isA2UIValueFunction, isCallBinding, isValidationResult } from "./generative-ui/basic-functions.cjs";
2
+ import { A2UIActionMessage, A2UIComponentNode, A2UIFunctionCall, A2UIOperation, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_VERSION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, generativeUIFunctionCallMessageId, generativeUISurfaceMessageId, toA2UIActionMessage } from "./generative-ui/types.cjs";
3
+ import { AllowedComponents, OperationKind, OperationValidation, ValidateOperationOptions, callerProblem, getOperationKind, getOperationSurfaceId, isActionBinding, isIndexCall, isPathBinding, validateOperation } from "./generative-ui/validate-operation.cjs";
4
+ import { ExtractedRenderUIArgs, RenderUIArgsStream, extractRenderUIArgs } from "./generative-ui/render-ui-args.cjs";
5
+ import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, ChildRef, ChildRefKind, applyChildRefMarks, childIdsAtRefs, childRefKind, collectChildRefs, hasBoundChildRef, mapAtChildRef } from "./generative-ui/child-refs.cjs";
6
+ import { GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUISchemaSettings, defaultGenerativeUIPromptSpec, generativeUIPromptFeatures, selectPromptItems } from "./generative-ui/prompt-spec.cjs";
7
+ import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./generative-ui/prompt.cjs";
8
+ import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.cjs";
9
+ import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.cjs";
10
+ import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.cjs";
1
11
  import { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from "./types/openai-assistant.cjs";
2
12
  import { Action, MappedParameterTypes, Parameter } from "./types/action.cjs";
3
13
  import { CopilotCloudConfig } from "./types/copilot-cloud-config.cjs";
@@ -22,7 +32,6 @@ import { SamplingMeta, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SUR
22
32
  import { MODEL_HOST_CLASSES, ModelHostClass, classifyModelHost } from "./telemetry/model-host.cjs";
23
33
  import { LambdaSendOptions, firstNonBlankTelemetryId, lambdaClient, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.cjs";
24
34
  import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.cjs";
25
- import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.cjs";
26
35
  import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.cjs";
27
36
  import { createAttachmentContent } from "./attachments/content.cjs";
28
37
  import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.cjs";
@@ -30,19 +39,10 @@ import { logger } from "./logger.cjs";
30
39
  import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./finalize-events.cjs";
31
40
  import { stripIntelligenceRoutingFields } from "./intelligence-routing-fields.cjs";
32
41
  import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.cjs";
33
- import { A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_INDEX_FUNCTION, COPILOTKIT_FUNCTIONS, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, functionCallers, isA2UIBasicFunction, isA2UIValueFunction, isCallBinding, isValidationResult } from "./generative-ui/basic-functions.cjs";
34
- import { A2UIActionMessage, A2UIComponentNode, A2UIFunctionCall, A2UIOperation, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_VERSION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, generativeUIFunctionCallMessageId, generativeUISurfaceMessageId, toA2UIActionMessage } from "./generative-ui/types.cjs";
35
- import { GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUISchemaSettings, defaultGenerativeUIPromptSpec, generativeUIPromptFeatures, selectPromptItems } from "./generative-ui/prompt-spec.cjs";
36
42
  import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, ALL_GENERATIVE_UI_GUIDE_FEATURES, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GenerativeUIGuideFeatures, buildGenerativeUIMarkdownGuidelines, generativeUIGuideFeatures } from "./a2ui-prompts.cjs";
37
43
  import { COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_UI_ENVELOPE_FORMAT, CopilotKitUIEnvelope, envelopeToManifest, readCopilotKitUIEnvelope } from "./a2ui-envelope.cjs";
38
44
  import { DebugEventEnvelope } from "./debug-event-envelope.cjs";
39
45
  import { GENERATE_SANDBOXED_UI_DESCRIPTION } from "./open-generative-ui-prompts.cjs";
40
- import { AllowedComponents, OperationKind, OperationValidation, ValidateOperationOptions, callerProblem, getOperationKind, getOperationSurfaceId, isActionBinding, isIndexCall, isPathBinding, validateOperation } from "./generative-ui/validate-operation.cjs";
41
- import { ExtractedRenderUIArgs, RenderUIArgsStream, extractRenderUIArgs } from "./generative-ui/render-ui-args.cjs";
42
- import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, ChildRef, ChildRefKind, applyChildRefMarks, childIdsAtRefs, childRefKind, collectChildRefs, hasBoundChildRef, mapAtChildRef } from "./generative-ui/child-refs.cjs";
43
- import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./generative-ui/prompt.cjs";
44
- import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.cjs";
45
- import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.cjs";
46
46
  import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier";
47
47
 
48
48
  //#region src/index.d.ts
package/dist/index.d.mts CHANGED
@@ -1,3 +1,13 @@
1
+ import { A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_INDEX_FUNCTION, COPILOTKIT_FUNCTIONS, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, functionCallers, isA2UIBasicFunction, isA2UIValueFunction, isCallBinding, isValidationResult } from "./generative-ui/basic-functions.mjs";
2
+ import { A2UIActionMessage, A2UIComponentNode, A2UIFunctionCall, A2UIOperation, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_VERSION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, generativeUIFunctionCallMessageId, generativeUISurfaceMessageId, toA2UIActionMessage } from "./generative-ui/types.mjs";
3
+ import { AllowedComponents, OperationKind, OperationValidation, ValidateOperationOptions, callerProblem, getOperationKind, getOperationSurfaceId, isActionBinding, isIndexCall, isPathBinding, validateOperation } from "./generative-ui/validate-operation.mjs";
4
+ import { ExtractedRenderUIArgs, RenderUIArgsStream, extractRenderUIArgs } from "./generative-ui/render-ui-args.mjs";
5
+ import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, ChildRef, ChildRefKind, applyChildRefMarks, childIdsAtRefs, childRefKind, collectChildRefs, hasBoundChildRef, mapAtChildRef } from "./generative-ui/child-refs.mjs";
6
+ import { GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUISchemaSettings, defaultGenerativeUIPromptSpec, generativeUIPromptFeatures, selectPromptItems } from "./generative-ui/prompt-spec.mjs";
7
+ import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./generative-ui/prompt.mjs";
8
+ import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.mjs";
9
+ import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.mjs";
10
+ import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.mjs";
1
11
  import { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from "./types/openai-assistant.mjs";
2
12
  import { Action, MappedParameterTypes, Parameter } from "./types/action.mjs";
3
13
  import { CopilotCloudConfig } from "./types/copilot-cloud-config.mjs";
@@ -22,7 +32,6 @@ import { SamplingMeta, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SUR
22
32
  import { MODEL_HOST_CLASSES, ModelHostClass, classifyModelHost } from "./telemetry/model-host.mjs";
23
33
  import { LambdaSendOptions, firstNonBlankTelemetryId, lambdaClient, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.mjs";
24
34
  import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.mjs";
25
- import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.mjs";
26
35
  import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.mjs";
27
36
  import { createAttachmentContent } from "./attachments/content.mjs";
28
37
  import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
@@ -30,19 +39,10 @@ import { logger } from "./logger.mjs";
30
39
  import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./finalize-events.mjs";
31
40
  import { stripIntelligenceRoutingFields } from "./intelligence-routing-fields.mjs";
32
41
  import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.mjs";
33
- import { A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_INDEX_FUNCTION, COPILOTKIT_FUNCTIONS, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, functionCallers, isA2UIBasicFunction, isA2UIValueFunction, isCallBinding, isValidationResult } from "./generative-ui/basic-functions.mjs";
34
- import { A2UIActionMessage, A2UIComponentNode, A2UIFunctionCall, A2UIOperation, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_VERSION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, generativeUIFunctionCallMessageId, generativeUISurfaceMessageId, toA2UIActionMessage } from "./generative-ui/types.mjs";
35
- import { GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUISchemaSettings, defaultGenerativeUIPromptSpec, generativeUIPromptFeatures, selectPromptItems } from "./generative-ui/prompt-spec.mjs";
36
42
  import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, ALL_GENERATIVE_UI_GUIDE_FEATURES, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GenerativeUIGuideFeatures, buildGenerativeUIMarkdownGuidelines, generativeUIGuideFeatures } from "./a2ui-prompts.mjs";
37
43
  import { COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_UI_ENVELOPE_FORMAT, CopilotKitUIEnvelope, envelopeToManifest, readCopilotKitUIEnvelope } from "./a2ui-envelope.mjs";
38
44
  import { DebugEventEnvelope } from "./debug-event-envelope.mjs";
39
45
  import { GENERATE_SANDBOXED_UI_DESCRIPTION } from "./open-generative-ui-prompts.mjs";
40
- import { AllowedComponents, OperationKind, OperationValidation, ValidateOperationOptions, callerProblem, getOperationKind, getOperationSurfaceId, isActionBinding, isIndexCall, isPathBinding, validateOperation } from "./generative-ui/validate-operation.mjs";
41
- import { ExtractedRenderUIArgs, RenderUIArgsStream, extractRenderUIArgs } from "./generative-ui/render-ui-args.mjs";
42
- import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, ChildRef, ChildRefKind, applyChildRefMarks, childIdsAtRefs, childRefKind, collectChildRefs, hasBoundChildRef, mapAtChildRef } from "./generative-ui/child-refs.mjs";
43
- import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./generative-ui/prompt.mjs";
44
- import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.mjs";
45
- import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.mjs";
46
46
  import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier";
47
47
 
48
48
  //#region src/index.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\n// Only browser-safe telemetry helpers live here. The runtime owns its\n// telemetry client (`packages/runtime/src/runtime/telemetry`), so this package\n// imports no Node-only analytics SDK (#4151).\nexport { isTelemetryDisabled } from \"./telemetry/telemetry-disabled\";\nexport * from \"./telemetry/sampling\";\n// Pure string classification with no imports, so it carries no runtime edge\n// into browser builds — same reasoning as `sampling` above.\nexport * from \"./telemetry/model-host\";\nexport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseTelemetryIdFromLicense,\n parseAndWarnTelemetryId,\n} from \"./telemetry/lambda-client\";\nexport type { LambdaSendOptions } from \"./telemetry/lambda-client\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport {\n createRunEventFinalizer,\n finalizeRunEvents,\n type FinalizeRunOptions,\n type RunEventFinalizer,\n} from \"./finalize-events\";\nexport { stripIntelligenceRoutingFields } from \"./intelligence-routing-fields\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Effective license status after structured entitlement precedence. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a feature is licensed. Ready entitlements override legacy status behavior. */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Zero means unlimited; null means not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/** Read a record value without traversing its prototype chain. */\nfunction getOwnRecordValue<Value>(\n record: Readonly<Record<string, Value>>,\n key: string,\n): Value | undefined {\n return Object.prototype.hasOwnProperty.call(record, key)\n ? record[key]\n : undefined;\n}\n\n/** Legacy UI surfaces that remain available for every active entitlement. */\nfunction isLegacyUiFeature(feature: string): boolean {\n return feature === \"chat\" || feature === \"popup\" || feature === \"sidebar\";\n}\n\n/**\n * Client-safe license context factory, driven by the license authority the\n * runtime reports via /info.\n *\n * A ready managed entitlement is authoritative in both directions. A ready\n * active self-hosted entitlement is also authoritative, while an inactive\n * self-hosted response preserves the legacy signed-license fallback. Active\n * entitlements supply feature grants and limits; authoritative inactive\n * entitlements deny every feature and limit. Older runtimes that report only a\n * status retain the legacy behavior: features are enabled unless the status is\n * \"expired\" or \"invalid\", and no limits are reported. This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on Node's\n * `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n runtimeEntitlements?: RuntimeEntitlementResponse,\n): LicenseContextValue {\n const readyEntitlement =\n runtimeEntitlements?.status === \"ready\"\n ? runtimeEntitlements.entitlement\n : null;\n const hasUsableSelfHostedLegacyFallback =\n readyEntitlement &&\n !readyEntitlement.active &&\n readyEntitlement.source === \"selfHostedDeploymentLicense\" &&\n (status === \"valid\" || status === \"expiring\");\n const featureAuthority =\n readyEntitlement && !hasUsableSelfHostedLegacyFallback\n ? readyEntitlement\n : null;\n const activeEntitlement = featureAuthority?.active ? featureAuthority : null;\n const resolvedStatus = activeEntitlement\n ? \"valid\"\n : readyEntitlement?.source === \"managedOrgSubscription\" ||\n readyEntitlement?.source === \"awsMarketplaceDeploymentLicense\"\n ? \"none\"\n : featureAuthority\n ? (status ?? \"none\")\n : (status ?? null);\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: (feature) =>\n featureAuthority\n ? activeEntitlement\n ? feature === \"threads\" &&\n Object.prototype.hasOwnProperty.call(\n activeEntitlement.limits,\n \"threads.max_count\",\n )\n ? true\n : (getOwnRecordValue(activeEntitlement.features, feature) ??\n isLegacyUiFeature(feature))\n : false\n : featuresEnabled,\n getLimit: (feature) =>\n activeEntitlement\n ? (getOwnRecordValue(activeEntitlement.limits, feature) ?? null)\n : null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n ALL_GENERATIVE_UI_GUIDE_FEATURES,\n buildGenerativeUIMarkdownGuidelines,\n generativeUIGuideFeatures,\n GENERATIVE_UI_MARKDOWN_GUIDELINES,\n GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,\n GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,\n} from \"./a2ui-prompts\";\nexport type { GenerativeUIGuideFeatures } from \"./a2ui-prompts\";\nexport {\n COPILOTKIT_FORWARDED_PROPS_KEY,\n COPILOTKIT_UI_ENVELOPE_FORMAT,\n envelopeToManifest,\n readCopilotKitUIEnvelope,\n} from \"./a2ui-envelope\";\nexport type { CopilotKitUIEnvelope } from \"./a2ui-envelope\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n\nexport { GENERATE_SANDBOXED_UI_DESCRIPTION } from \"./open-generative-ui-prompts\";\nexport * from \"./generative-ui\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,qBAAqBA;;AA0ClC,SAAS,kBACP,QACA,KACmB;AACnB,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,GACpD,OAAO,OACP;;;AAIN,SAAS,kBAAkB,SAA0B;AACnD,QAAO,YAAY,UAAU,YAAY,WAAW,YAAY;;;;;;;;;;;;;;;;AAiBlE,SAAgB,0BACd,QACA,qBACqB;CACrB,MAAM,mBACJ,qBAAqB,WAAW,UAC5B,oBAAoB,cACpB;CACN,MAAM,oCACJ,oBACA,CAAC,iBAAiB,UAClB,iBAAiB,WAAW,kCAC3B,WAAW,WAAW,WAAW;CACpC,MAAM,mBACJ,oBAAoB,CAAC,oCACjB,mBACA;CACN,MAAM,oBAAoB,kBAAkB,SAAS,mBAAmB;CACxE,MAAM,iBAAiB,oBACnB,UACA,kBAAkB,WAAW,4BAC3B,kBAAkB,WAAW,oCAC7B,SACA,mBACG,UAAU,SACV,UAAU;CACnB,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AAErD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,eAAe,YACb,mBACI,oBACE,YAAY,aACZ,OAAO,UAAU,eAAe,KAC9B,kBAAkB,QAClB,oBACD,GACC,OACC,kBAAkB,kBAAkB,UAAU,QAAQ,IACvD,kBAAkB,QAAQ,GAC5B,QACF;EACN,WAAW,YACT,oBACK,kBAAkB,kBAAkB,QAAQ,QAAQ,IAAI,OACzD;EACP"}
1
+ {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\n// Only browser-safe telemetry helpers live here. The runtime owns its\n// telemetry client (`packages/runtime/src/runtime/telemetry`), so this package\n// imports no Node-only analytics SDK (#4151).\nexport { isTelemetryDisabled } from \"./telemetry/telemetry-disabled\";\nexport * from \"./telemetry/sampling\";\n// Pure string classification with no imports, so it carries no runtime edge\n// into browser builds — same reasoning as `sampling` above.\nexport * from \"./telemetry/model-host\";\nexport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseTelemetryIdFromLicense,\n parseAndWarnTelemetryId,\n} from \"./telemetry/lambda-client\";\nexport type { LambdaSendOptions } from \"./telemetry/lambda-client\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport {\n createRunEventFinalizer,\n finalizeRunEvents,\n type FinalizeRunOptions,\n type RunEventFinalizer,\n} from \"./finalize-events\";\nexport { stripIntelligenceRoutingFields } from \"./intelligence-routing-fields\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Effective license status after structured entitlement precedence. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a feature is licensed. Ready entitlements override legacy status behavior. */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Zero means unlimited; null means not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/** Read a record value without traversing its prototype chain. */\nfunction getOwnRecordValue<Value>(\n record: Readonly<Record<string, Value>>,\n key: string,\n): Value | undefined {\n return Object.prototype.hasOwnProperty.call(record, key)\n ? record[key]\n : undefined;\n}\n\n/** Legacy UI surfaces that remain available for every active entitlement. */\nfunction isLegacyUiFeature(feature: string): boolean {\n return feature === \"chat\" || feature === \"popup\" || feature === \"sidebar\";\n}\n\n/**\n * Client-safe license context factory, driven by the license authority the\n * runtime reports via /info.\n *\n * A ready managed entitlement is authoritative in both directions. A ready\n * active self-hosted entitlement is also authoritative, while an inactive\n * self-hosted response preserves the legacy signed-license fallback. Active\n * entitlements supply feature grants and limits; authoritative inactive\n * entitlements deny every feature and limit. Older runtimes that report only a\n * status retain the legacy behavior: features are enabled unless the status is\n * \"expired\" or \"invalid\", and no limits are reported. This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on Node's\n * `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n runtimeEntitlements?: RuntimeEntitlementResponse,\n): LicenseContextValue {\n const readyEntitlement =\n runtimeEntitlements?.status === \"ready\"\n ? runtimeEntitlements.entitlement\n : null;\n const hasUsableSelfHostedLegacyFallback =\n readyEntitlement &&\n !readyEntitlement.active &&\n readyEntitlement.source === \"selfHostedDeploymentLicense\" &&\n (status === \"valid\" || status === \"expiring\");\n const featureAuthority =\n readyEntitlement && !hasUsableSelfHostedLegacyFallback\n ? readyEntitlement\n : null;\n const activeEntitlement = featureAuthority?.active ? featureAuthority : null;\n const resolvedStatus = activeEntitlement\n ? \"valid\"\n : readyEntitlement?.source === \"managedOrgSubscription\" ||\n readyEntitlement?.source === \"awsMarketplaceDeploymentLicense\"\n ? \"none\"\n : featureAuthority\n ? (status ?? \"none\")\n : (status ?? null);\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: (feature) =>\n featureAuthority\n ? activeEntitlement\n ? feature === \"threads\" &&\n Object.prototype.hasOwnProperty.call(\n activeEntitlement.limits,\n \"threads.max_count\",\n )\n ? true\n : (getOwnRecordValue(activeEntitlement.features, feature) ??\n isLegacyUiFeature(feature))\n : false\n : featuresEnabled,\n getLimit: (feature) =>\n activeEntitlement\n ? (getOwnRecordValue(activeEntitlement.limits, feature) ?? null)\n : null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n ALL_GENERATIVE_UI_GUIDE_FEATURES,\n buildGenerativeUIMarkdownGuidelines,\n generativeUIGuideFeatures,\n GENERATIVE_UI_MARKDOWN_GUIDELINES,\n GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,\n GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,\n} from \"./a2ui-prompts\";\nexport type { GenerativeUIGuideFeatures } from \"./a2ui-prompts\";\nexport {\n COPILOTKIT_FORWARDED_PROPS_KEY,\n COPILOTKIT_UI_ENVELOPE_FORMAT,\n envelopeToManifest,\n readCopilotKitUIEnvelope,\n} from \"./a2ui-envelope\";\nexport type { CopilotKitUIEnvelope } from \"./a2ui-envelope\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n\nexport { GENERATE_SANDBOXED_UI_DESCRIPTION } from \"./open-generative-ui-prompts\";\nexport * from \"./generative-ui/base\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,qBAAqBA;;AA0ClC,SAAS,kBACP,QACA,KACmB;AACnB,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,GACpD,OAAO,OACP;;;AAIN,SAAS,kBAAkB,SAA0B;AACnD,QAAO,YAAY,UAAU,YAAY,WAAW,YAAY;;;;;;;;;;;;;;;;AAiBlE,SAAgB,0BACd,QACA,qBACqB;CACrB,MAAM,mBACJ,qBAAqB,WAAW,UAC5B,oBAAoB,cACpB;CACN,MAAM,oCACJ,oBACA,CAAC,iBAAiB,UAClB,iBAAiB,WAAW,kCAC3B,WAAW,WAAW,WAAW;CACpC,MAAM,mBACJ,oBAAoB,CAAC,oCACjB,mBACA;CACN,MAAM,oBAAoB,kBAAkB,SAAS,mBAAmB;CACxE,MAAM,iBAAiB,oBACnB,UACA,kBAAkB,WAAW,4BAC3B,kBAAkB,WAAW,oCAC7B,SACA,mBACG,UAAU,SACV,UAAU;CACnB,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AAErD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,eAAe,YACb,mBACI,oBACE,YAAY,aACZ,OAAO,UAAU,eAAe,KAC9B,kBAAkB,QAClB,oBACD,GACC,OACC,kBAAkB,kBAAkB,UAAU,QAAQ,IACvD,kBAAkB,QAAQ,GAC5B,QACF;EACN,WAAW,YACT,oBACK,kBAAkB,kBAAkB,QAAQ,QAAQ,IAAI,OACzD;EACP"}
package/dist/index.umd.js CHANGED
@@ -2166,7 +2166,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
2166
2166
 
2167
2167
  //#endregion
2168
2168
  //#region package.json
2169
- var version = "2.0.0-rc.30";
2169
+ var version = "2.0.0-rc.32";
2170
2170
 
2171
2171
  //#endregion
2172
2172
  //#region src/generative-ui/basic-functions.ts
@@ -2336,7 +2336,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
2336
2336
 
2337
2337
  //#endregion
2338
2338
  //#region src/generative-ui/is-record.ts
2339
- /** True for a plain object: not null, not an array. Internal, not exported. */
2339
+ /** True for a plain object: not null, not an array. */
2340
2340
  function isRecord$2(value) {
2341
2341
  return typeof value === "object" && value !== null && !Array.isArray(value);
2342
2342
  }