@copilotkit/shared 2.0.0-rc.38 → 2.0.0-rc.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generative-ui/clone-value.cjs +364 -0
- package/dist/generative-ui/clone-value.cjs.map +1 -0
- package/dist/generative-ui/clone-value.d.cts +51 -0
- package/dist/generative-ui/clone-value.d.cts.map +1 -0
- package/dist/generative-ui/clone-value.d.mts +51 -0
- package/dist/generative-ui/clone-value.d.mts.map +1 -0
- package/dist/generative-ui/clone-value.mjs +363 -0
- package/dist/generative-ui/clone-value.mjs.map +1 -0
- package/dist/generative-ui/index.cjs +39 -0
- package/dist/generative-ui/index.d.cts +8 -2
- package/dist/generative-ui/index.d.mts +8 -2
- package/dist/generative-ui/index.mjs +8 -2
- package/dist/generative-ui/is-record.d.cts +3 -1
- package/dist/generative-ui/is-record.d.cts.map +1 -1
- package/dist/generative-ui/is-record.d.mts +3 -1
- package/dist/generative-ui/is-record.d.mts.map +1 -1
- package/dist/generative-ui/schema-render.cjs +2 -1
- package/dist/generative-ui/schema-render.cjs.map +1 -1
- package/dist/generative-ui/schema-render.d.cts.map +1 -1
- package/dist/generative-ui/schema-render.d.mts.map +1 -1
- package/dist/generative-ui/schema-render.mjs +2 -1
- package/dist/generative-ui/schema-render.mjs.map +1 -1
- package/dist/generative-ui/standard/chart-config.cjs +347 -0
- package/dist/generative-ui/standard/chart-config.cjs.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.cts +97 -0
- package/dist/generative-ui/standard/chart-config.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.mts +97 -0
- package/dist/generative-ui/standard/chart-config.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart-config.mjs +342 -0
- package/dist/generative-ui/standard/chart-config.mjs.map +1 -0
- package/dist/generative-ui/standard/composites.d.cts +2 -2
- package/dist/generative-ui/standard/composites.d.mts +2 -2
- package/dist/generative-ui/standard/declarations.d.cts +68 -68
- package/dist/generative-ui/standard/declarations.d.mts +68 -68
- package/dist/generative-ui/standard/index.d.mts +5 -1
- package/dist/generative-ui/standard/inputs.d.cts +22 -22
- package/dist/generative-ui/standard/inputs.d.mts +22 -22
- package/dist/generative-ui/standard/layout.d.cts +90 -90
- package/dist/generative-ui/standard/layout.d.mts +90 -90
- package/dist/generative-ui/standard/map-helpers.cjs +104 -0
- package/dist/generative-ui/standard/map-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.cts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.mts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.mjs +95 -0
- package/dist/generative-ui/standard/map-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/media.d.cts +6 -6
- package/dist/generative-ui/standard/media.d.mts +6 -6
- package/dist/generative-ui/standard/style-helpers.cjs +151 -0
- package/dist/generative-ui/standard/style-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.cts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.mts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.mjs +142 -0
- package/dist/generative-ui/standard/style-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/text.d.cts +14 -14
- package/dist/generative-ui/standard/text.d.mts +14 -14
- package/dist/generative-ui/standard/url.cjs +54 -0
- package/dist/generative-ui/standard/url.cjs.map +1 -0
- package/dist/generative-ui/standard/url.d.cts +32 -0
- package/dist/generative-ui/standard/url.d.cts.map +1 -0
- package/dist/generative-ui/standard/url.d.mts +32 -0
- package/dist/generative-ui/standard/url.d.mts.map +1 -0
- package/dist/generative-ui/standard/url.mjs +50 -0
- package/dist/generative-ui/standard/url.mjs.map +1 -0
- package/dist/generative-ui/thrown.cjs +69 -0
- package/dist/generative-ui/thrown.cjs.map +1 -0
- package/dist/generative-ui/thrown.d.cts +21 -0
- package/dist/generative-ui/thrown.d.cts.map +1 -0
- package/dist/generative-ui/thrown.d.mts +21 -0
- package/dist/generative-ui/thrown.d.mts.map +1 -0
- package/dist/generative-ui/thrown.mjs +67 -0
- package/dist/generative-ui/thrown.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +368 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +1 -1
- package/src/__tests__/schema-render.test.ts +78 -0
- package/src/generative-ui/__tests__/clone-value-differential.test.ts +480 -0
- package/src/generative-ui/__tests__/clone-value.test.ts +226 -0
- package/src/generative-ui/clone-value.ts +511 -0
- package/src/generative-ui/index.ts +6 -2
- package/src/generative-ui/schema-render.ts +2 -1
- package/src/generative-ui/standard/__tests__/standard-helpers.test.ts +407 -0
- package/src/generative-ui/standard/chart-config.ts +434 -0
- package/src/generative-ui/standard/index.ts +36 -0
- package/src/generative-ui/standard/map-helpers.ts +155 -0
- package/src/generative-ui/standard/style-helpers.ts +170 -0
- package/src/generative-ui/standard/url.ts +51 -0
- package/src/generative-ui/thrown.ts +90 -0
- package/src/index.ts +5 -0
|
@@ -55,12 +55,12 @@ declare const textSchema: z.ZodObject<{
|
|
|
55
55
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
56
56
|
text: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
57
57
|
size: z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
"2xs": "2xs";
|
|
59
|
-
xs: "xs";
|
|
60
58
|
sm: "sm";
|
|
61
59
|
md: "md";
|
|
62
60
|
lg: "lg";
|
|
63
61
|
"3xs": "3xs";
|
|
62
|
+
"2xs": "2xs";
|
|
63
|
+
xs: "xs";
|
|
64
64
|
}>>;
|
|
65
65
|
fontSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
66
66
|
lineHeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
@@ -121,12 +121,12 @@ declare const labelSchema: z.ZodObject<{
|
|
|
121
121
|
htmlFor: z.ZodOptional<z.ZodString>;
|
|
122
122
|
color: z.ZodOptional<z.ZodString>;
|
|
123
123
|
size: z.ZodOptional<z.ZodEnum<{
|
|
124
|
-
"2xs": "2xs";
|
|
125
|
-
xs: "xs";
|
|
126
124
|
sm: "sm";
|
|
127
125
|
md: "md";
|
|
128
126
|
lg: "lg";
|
|
129
127
|
"3xs": "3xs";
|
|
128
|
+
"2xs": "2xs";
|
|
129
|
+
xs: "xs";
|
|
130
130
|
}>>;
|
|
131
131
|
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
132
132
|
normal: "normal";
|
|
@@ -161,12 +161,12 @@ declare const BADGE_SIZES: readonly ["sm", "md", "lg"];
|
|
|
161
161
|
declare const badgeSchema: z.ZodObject<{
|
|
162
162
|
label: z.ZodString;
|
|
163
163
|
color: z.ZodOptional<z.ZodEnum<{
|
|
164
|
+
secondary: "secondary";
|
|
164
165
|
success: "success";
|
|
165
166
|
info: "info";
|
|
166
167
|
warning: "warning";
|
|
167
168
|
danger: "danger";
|
|
168
169
|
discovery: "discovery";
|
|
169
|
-
secondary: "secondary";
|
|
170
170
|
}>>;
|
|
171
171
|
size: z.ZodOptional<z.ZodEnum<{
|
|
172
172
|
sm: "sm";
|
|
@@ -203,12 +203,12 @@ declare const mathSchema: z.ZodObject<{
|
|
|
203
203
|
declare const shimmerSchema: z.ZodObject<{
|
|
204
204
|
text: z.ZodString;
|
|
205
205
|
size: z.ZodOptional<z.ZodEnum<{
|
|
206
|
-
"2xs": "2xs";
|
|
207
|
-
xs: "xs";
|
|
208
206
|
sm: "sm";
|
|
209
207
|
md: "md";
|
|
210
208
|
lg: "lg";
|
|
211
209
|
"3xs": "3xs";
|
|
210
|
+
"2xs": "2xs";
|
|
211
|
+
xs: "xs";
|
|
212
212
|
}>>;
|
|
213
213
|
lineThrough: z.ZodOptional<z.ZodBoolean>;
|
|
214
214
|
color: z.ZodOptional<z.ZodString>;
|
|
@@ -283,12 +283,12 @@ declare const textDeclarations: {
|
|
|
283
283
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
284
284
|
text: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
285
285
|
size: z.ZodOptional<z.ZodEnum<{
|
|
286
|
-
"2xs": "2xs";
|
|
287
|
-
xs: "xs";
|
|
288
286
|
sm: "sm";
|
|
289
287
|
md: "md";
|
|
290
288
|
lg: "lg";
|
|
291
289
|
"3xs": "3xs";
|
|
290
|
+
"2xs": "2xs";
|
|
291
|
+
xs: "xs";
|
|
292
292
|
}>>;
|
|
293
293
|
fontSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
294
294
|
lineHeight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
@@ -357,12 +357,12 @@ declare const textDeclarations: {
|
|
|
357
357
|
htmlFor: z.ZodOptional<z.ZodString>;
|
|
358
358
|
color: z.ZodOptional<z.ZodString>;
|
|
359
359
|
size: z.ZodOptional<z.ZodEnum<{
|
|
360
|
-
"2xs": "2xs";
|
|
361
|
-
xs: "xs";
|
|
362
360
|
sm: "sm";
|
|
363
361
|
md: "md";
|
|
364
362
|
lg: "lg";
|
|
365
363
|
"3xs": "3xs";
|
|
364
|
+
"2xs": "2xs";
|
|
365
|
+
xs: "xs";
|
|
366
366
|
}>>;
|
|
367
367
|
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
368
368
|
normal: "normal";
|
|
@@ -414,12 +414,12 @@ declare const textDeclarations: {
|
|
|
414
414
|
props: z.ZodObject<{
|
|
415
415
|
label: z.ZodString;
|
|
416
416
|
color: z.ZodOptional<z.ZodEnum<{
|
|
417
|
+
secondary: "secondary";
|
|
417
418
|
success: "success";
|
|
418
419
|
info: "info";
|
|
419
420
|
warning: "warning";
|
|
420
421
|
danger: "danger";
|
|
421
422
|
discovery: "discovery";
|
|
422
|
-
secondary: "secondary";
|
|
423
423
|
}>>;
|
|
424
424
|
size: z.ZodOptional<z.ZodEnum<{
|
|
425
425
|
sm: "sm";
|
|
@@ -474,12 +474,12 @@ declare const textDeclarations: {
|
|
|
474
474
|
props: z.ZodObject<{
|
|
475
475
|
text: z.ZodString;
|
|
476
476
|
size: z.ZodOptional<z.ZodEnum<{
|
|
477
|
-
"2xs": "2xs";
|
|
478
|
-
xs: "xs";
|
|
479
477
|
sm: "sm";
|
|
480
478
|
md: "md";
|
|
481
479
|
lg: "lg";
|
|
482
480
|
"3xs": "3xs";
|
|
481
|
+
"2xs": "2xs";
|
|
482
|
+
xs: "xs";
|
|
483
483
|
}>>;
|
|
484
484
|
lineThrough: z.ZodOptional<z.ZodBoolean>;
|
|
485
485
|
color: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/generative-ui/standard/url.ts
|
|
3
|
+
const SAFE_URL = /^(https?:|mailto:)/i;
|
|
4
|
+
/**
|
|
5
|
+
* The trimmed URL when its scheme is http, https or mailto, else
|
|
6
|
+
* `undefined`. Use it before a URL from agent data becomes an `href`.
|
|
7
|
+
*
|
|
8
|
+
* @example safeHref(" https://example.com ") // "https://example.com"
|
|
9
|
+
*/
|
|
10
|
+
function safeHref(url) {
|
|
11
|
+
const trimmed = url.trim();
|
|
12
|
+
return SAFE_URL.test(trimmed) ? trimmed : void 0;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The host name of a URL, with or without a scheme. `undefined` when the
|
|
16
|
+
* text is not a URL.
|
|
17
|
+
*
|
|
18
|
+
* @example hostOf("example.com/page") // "example.com"
|
|
19
|
+
*/
|
|
20
|
+
function hostOf(url) {
|
|
21
|
+
try {
|
|
22
|
+
return new URL(url.includes("://") ? url : `https://${url}`).hostname;
|
|
23
|
+
} catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The URL of the favicon of a host, from Google's favicon service.
|
|
29
|
+
*
|
|
30
|
+
* @param host - A host name, for example the result of `hostOf`.
|
|
31
|
+
*/
|
|
32
|
+
function faviconSrc(host) {
|
|
33
|
+
return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(host)}&sz=64`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is
|
|
37
|
+
* ignored. Does nothing where there is no `window.open`, for example on
|
|
38
|
+
* the server or on React Native.
|
|
39
|
+
*
|
|
40
|
+
* @param href - The URL to open. `undefined` does nothing.
|
|
41
|
+
*/
|
|
42
|
+
function openUrl(href) {
|
|
43
|
+
if (!href || typeof window === "undefined") return;
|
|
44
|
+
if (typeof window.open !== "function") return;
|
|
45
|
+
const safe = safeHref(href);
|
|
46
|
+
if (safe) window.open(safe, "_blank", "noopener,noreferrer");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.faviconSrc = faviconSrc;
|
|
51
|
+
exports.hostOf = hostOf;
|
|
52
|
+
exports.openUrl = openUrl;
|
|
53
|
+
exports.safeHref = safeHref;
|
|
54
|
+
//# sourceMappingURL=url.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.cjs","names":[],"sources":["../../../src/generative-ui/standard/url.ts"],"sourcesContent":["// Framework-free URL helpers of the standard components.\n\nconst SAFE_URL = /^(https?:|mailto:)/i;\n\n/**\n * The trimmed URL when its scheme is http, https or mailto, else\n * `undefined`. Use it before a URL from agent data becomes an `href`.\n *\n * @example safeHref(\" https://example.com \") // \"https://example.com\"\n */\nexport function safeHref(url: string) {\n const trimmed = url.trim();\n return SAFE_URL.test(trimmed) ? trimmed : undefined;\n}\n\n/**\n * The host name of a URL, with or without a scheme. `undefined` when the\n * text is not a URL.\n *\n * @example hostOf(\"example.com/page\") // \"example.com\"\n */\nexport function hostOf(url: string) {\n try {\n return new URL(url.includes(\"://\") ? url : `https://${url}`).hostname;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The URL of the favicon of a host, from Google's favicon service.\n *\n * @param host - A host name, for example the result of `hostOf`.\n */\nexport function faviconSrc(host: string) {\n return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(host)}&sz=64`;\n}\n\n/**\n * Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is\n * ignored. Does nothing where there is no `window.open`, for example on\n * the server or on React Native.\n *\n * @param href - The URL to open. `undefined` does nothing.\n */\nexport function openUrl(href: string | undefined) {\n if (!href || typeof window === \"undefined\") return;\n if (typeof window.open !== \"function\") return; // hermes-ok: feature check\n const safe = safeHref(href);\n if (safe) window.open(safe, \"_blank\", \"noopener,noreferrer\"); // hermes-ok: checked above\n}\n"],"mappings":";;AAEA,MAAM,WAAW;;;;;;;AAQjB,SAAgB,SAAS,KAAa;CACpC,MAAM,UAAU,IAAI,MAAM;AAC1B,QAAO,SAAS,KAAK,QAAQ,GAAG,UAAU;;;;;;;;AAS5C,SAAgB,OAAO,KAAa;AAClC,KAAI;AACF,SAAO,IAAI,IAAI,IAAI,SAAS,MAAM,GAAG,MAAM,WAAW,MAAM,CAAC;SACvD;AACN;;;;;;;;AASJ,SAAgB,WAAW,MAAc;AACvC,QAAO,6CAA6C,mBAAmB,KAAK,CAAC;;;;;;;;;AAU/E,SAAgB,QAAQ,MAA0B;AAChD,KAAI,CAAC,QAAQ,OAAO,WAAW,YAAa;AAC5C,KAAI,OAAO,OAAO,SAAS,WAAY;CACvC,MAAM,OAAO,SAAS,KAAK;AAC3B,KAAI,KAAM,QAAO,KAAK,MAAM,UAAU,sBAAsB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/generative-ui/standard/url.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The trimmed URL when its scheme is http, https or mailto, else
|
|
4
|
+
* `undefined`. Use it before a URL from agent data becomes an `href`.
|
|
5
|
+
*
|
|
6
|
+
* @example safeHref(" https://example.com ") // "https://example.com"
|
|
7
|
+
*/
|
|
8
|
+
declare function safeHref(url: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The host name of a URL, with or without a scheme. `undefined` when the
|
|
11
|
+
* text is not a URL.
|
|
12
|
+
*
|
|
13
|
+
* @example hostOf("example.com/page") // "example.com"
|
|
14
|
+
*/
|
|
15
|
+
declare function hostOf(url: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The URL of the favicon of a host, from Google's favicon service.
|
|
18
|
+
*
|
|
19
|
+
* @param host - A host name, for example the result of `hostOf`.
|
|
20
|
+
*/
|
|
21
|
+
declare function faviconSrc(host: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is
|
|
24
|
+
* ignored. Does nothing where there is no `window.open`, for example on
|
|
25
|
+
* the server or on React Native.
|
|
26
|
+
*
|
|
27
|
+
* @param href - The URL to open. `undefined` does nothing.
|
|
28
|
+
*/
|
|
29
|
+
declare function openUrl(href: string | undefined): void;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { faviconSrc, hostOf, openUrl, safeHref };
|
|
32
|
+
//# sourceMappingURL=url.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.cts","names":[],"sources":["../../../src/generative-ui/standard/url.ts"],"mappings":";;AAUA;;;;;iBAAgB,QAAA,CAAS,GAAA;;;;;AAwBzB;;iBAbgB,MAAA,CAAO,GAAA;;;AAwBvB;;;iBAXgB,UAAA,CAAW,IAAA;;;;;;;;iBAWX,OAAA,CAAQ,IAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/generative-ui/standard/url.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The trimmed URL when its scheme is http, https or mailto, else
|
|
4
|
+
* `undefined`. Use it before a URL from agent data becomes an `href`.
|
|
5
|
+
*
|
|
6
|
+
* @example safeHref(" https://example.com ") // "https://example.com"
|
|
7
|
+
*/
|
|
8
|
+
declare function safeHref(url: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The host name of a URL, with or without a scheme. `undefined` when the
|
|
11
|
+
* text is not a URL.
|
|
12
|
+
*
|
|
13
|
+
* @example hostOf("example.com/page") // "example.com"
|
|
14
|
+
*/
|
|
15
|
+
declare function hostOf(url: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The URL of the favicon of a host, from Google's favicon service.
|
|
18
|
+
*
|
|
19
|
+
* @param host - A host name, for example the result of `hostOf`.
|
|
20
|
+
*/
|
|
21
|
+
declare function faviconSrc(host: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is
|
|
24
|
+
* ignored. Does nothing where there is no `window.open`, for example on
|
|
25
|
+
* the server or on React Native.
|
|
26
|
+
*
|
|
27
|
+
* @param href - The URL to open. `undefined` does nothing.
|
|
28
|
+
*/
|
|
29
|
+
declare function openUrl(href: string | undefined): void;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { faviconSrc, hostOf, openUrl, safeHref };
|
|
32
|
+
//# sourceMappingURL=url.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.mts","names":[],"sources":["../../../src/generative-ui/standard/url.ts"],"mappings":";;AAUA;;;;;iBAAgB,QAAA,CAAS,GAAA;;;;;AAwBzB;;iBAbgB,MAAA,CAAO,GAAA;;;AAwBvB;;;iBAXgB,UAAA,CAAW,IAAA;;;;;;;;iBAWX,OAAA,CAAQ,IAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/generative-ui/standard/url.ts
|
|
2
|
+
const SAFE_URL = /^(https?:|mailto:)/i;
|
|
3
|
+
/**
|
|
4
|
+
* The trimmed URL when its scheme is http, https or mailto, else
|
|
5
|
+
* `undefined`. Use it before a URL from agent data becomes an `href`.
|
|
6
|
+
*
|
|
7
|
+
* @example safeHref(" https://example.com ") // "https://example.com"
|
|
8
|
+
*/
|
|
9
|
+
function safeHref(url) {
|
|
10
|
+
const trimmed = url.trim();
|
|
11
|
+
return SAFE_URL.test(trimmed) ? trimmed : void 0;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The host name of a URL, with or without a scheme. `undefined` when the
|
|
15
|
+
* text is not a URL.
|
|
16
|
+
*
|
|
17
|
+
* @example hostOf("example.com/page") // "example.com"
|
|
18
|
+
*/
|
|
19
|
+
function hostOf(url) {
|
|
20
|
+
try {
|
|
21
|
+
return new URL(url.includes("://") ? url : `https://${url}`).hostname;
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The URL of the favicon of a host, from Google's favicon service.
|
|
28
|
+
*
|
|
29
|
+
* @param host - A host name, for example the result of `hostOf`.
|
|
30
|
+
*/
|
|
31
|
+
function faviconSrc(host) {
|
|
32
|
+
return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(host)}&sz=64`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is
|
|
36
|
+
* ignored. Does nothing where there is no `window.open`, for example on
|
|
37
|
+
* the server or on React Native.
|
|
38
|
+
*
|
|
39
|
+
* @param href - The URL to open. `undefined` does nothing.
|
|
40
|
+
*/
|
|
41
|
+
function openUrl(href) {
|
|
42
|
+
if (!href || typeof window === "undefined") return;
|
|
43
|
+
if (typeof window.open !== "function") return;
|
|
44
|
+
const safe = safeHref(href);
|
|
45
|
+
if (safe) window.open(safe, "_blank", "noopener,noreferrer");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { faviconSrc, hostOf, openUrl, safeHref };
|
|
50
|
+
//# sourceMappingURL=url.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.mjs","names":[],"sources":["../../../src/generative-ui/standard/url.ts"],"sourcesContent":["// Framework-free URL helpers of the standard components.\n\nconst SAFE_URL = /^(https?:|mailto:)/i;\n\n/**\n * The trimmed URL when its scheme is http, https or mailto, else\n * `undefined`. Use it before a URL from agent data becomes an `href`.\n *\n * @example safeHref(\" https://example.com \") // \"https://example.com\"\n */\nexport function safeHref(url: string) {\n const trimmed = url.trim();\n return SAFE_URL.test(trimmed) ? trimmed : undefined;\n}\n\n/**\n * The host name of a URL, with or without a scheme. `undefined` when the\n * text is not a URL.\n *\n * @example hostOf(\"example.com/page\") // \"example.com\"\n */\nexport function hostOf(url: string) {\n try {\n return new URL(url.includes(\"://\") ? url : `https://${url}`).hostname;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The URL of the favicon of a host, from Google's favicon service.\n *\n * @param host - A host name, for example the result of `hostOf`.\n */\nexport function faviconSrc(host: string) {\n return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(host)}&sz=64`;\n}\n\n/**\n * Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is\n * ignored. Does nothing where there is no `window.open`, for example on\n * the server or on React Native.\n *\n * @param href - The URL to open. `undefined` does nothing.\n */\nexport function openUrl(href: string | undefined) {\n if (!href || typeof window === \"undefined\") return;\n if (typeof window.open !== \"function\") return; // hermes-ok: feature check\n const safe = safeHref(href);\n if (safe) window.open(safe, \"_blank\", \"noopener,noreferrer\"); // hermes-ok: checked above\n}\n"],"mappings":";AAEA,MAAM,WAAW;;;;;;;AAQjB,SAAgB,SAAS,KAAa;CACpC,MAAM,UAAU,IAAI,MAAM;AAC1B,QAAO,SAAS,KAAK,QAAQ,GAAG,UAAU;;;;;;;;AAS5C,SAAgB,OAAO,KAAa;AAClC,KAAI;AACF,SAAO,IAAI,IAAI,IAAI,SAAS,MAAM,GAAG,MAAM,WAAW,MAAM,CAAC;SACvD;AACN;;;;;;;;AASJ,SAAgB,WAAW,MAAc;AACvC,QAAO,6CAA6C,mBAAmB,KAAK,CAAC;;;;;;;;;AAU/E,SAAgB,QAAQ,MAA0B;AAChD,KAAI,CAAC,QAAQ,OAAO,WAAW,YAAa;AAC5C,KAAI,OAAO,OAAO,SAAS,WAAY;CACvC,MAAM,OAAO,SAAS,KAAK;AAC3B,KAAI,KAAM,QAAO,KAAK,MAAM,UAAU,sBAAsB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/generative-ui/thrown.ts
|
|
3
|
+
/**
|
|
4
|
+
* Sets `cause` as an own property. `new Error(message, { cause })` needs
|
|
5
|
+
* ES2022 error options, which an engine without them (the JavaScriptCore of
|
|
6
|
+
* iOS before 15, which React Native 0.70 can still run on) ignores without a
|
|
7
|
+
* word, so it is set by hand on every engine.
|
|
8
|
+
*/
|
|
9
|
+
function withCause(error, cause) {
|
|
10
|
+
Object.defineProperty(error, "cause", {
|
|
11
|
+
value: cause,
|
|
12
|
+
writable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
enumerable: false
|
|
15
|
+
});
|
|
16
|
+
return error;
|
|
17
|
+
}
|
|
18
|
+
/** The longest description of a thrown object's data. */
|
|
19
|
+
const MAX_DESCRIPTION = 200;
|
|
20
|
+
/**
|
|
21
|
+
* Reads what a thrown value says without letting the reading throw: a
|
|
22
|
+
* getter, a Proxy trap, a `toJSON` or a `toString` may throw too.
|
|
23
|
+
*/
|
|
24
|
+
function attempt(read) {
|
|
25
|
+
try {
|
|
26
|
+
return read();
|
|
27
|
+
} catch {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** The `message` of a thrown object, when it is a non-empty string. */
|
|
32
|
+
function messageOf(value) {
|
|
33
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
34
|
+
const message = attempt(() => value.message);
|
|
35
|
+
return typeof message === "string" && message !== "" ? message : void 0;
|
|
36
|
+
}
|
|
37
|
+
/** A thrown value as text, for a value that is not an Error. */
|
|
38
|
+
function describeThrown(value) {
|
|
39
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
40
|
+
if (typeof value === "object" && value !== null) {
|
|
41
|
+
const json = attempt(() => JSON.stringify(value));
|
|
42
|
+
if (typeof json === "string") return json.length > MAX_DESCRIPTION ? `${json.slice(0, MAX_DESCRIPTION)}…` : json;
|
|
43
|
+
}
|
|
44
|
+
return attempt(() => String(value)) ?? attempt(() => Object.prototype.toString.call(value)) ?? typeof value;
|
|
45
|
+
}
|
|
46
|
+
/** An Error of this realm, or of another one (a frame, a VM context). */
|
|
47
|
+
function isError(value) {
|
|
48
|
+
if (attempt(() => value instanceof Error)) return true;
|
|
49
|
+
return attempt(() => Object.prototype.toString.call(value)) === "[object Error]" && typeof attempt(() => value.message) === "string";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The Error for any thrown value. Code may throw anything: a string, or a
|
|
53
|
+
* falsy value (`undefined`, `null`, `0`, `""`) that a boundary which keeps
|
|
54
|
+
* the thrown value and tests it for truth would take for "no error". An
|
|
55
|
+
* Error comes back as it is; a non-empty string, or the string `message`
|
|
56
|
+
* of a thrown object, becomes the message; any other value is described in
|
|
57
|
+
* the message. A value that is not an Error is kept as the `cause`. This
|
|
58
|
+
* never throws, whatever the value.
|
|
59
|
+
*/
|
|
60
|
+
function toError(value) {
|
|
61
|
+
if (isError(value)) return value;
|
|
62
|
+
const message = typeof value === "string" && value !== "" ? value : messageOf(value) ?? `A value that is not an Error was thrown: ${describeThrown(value)}`;
|
|
63
|
+
return withCause(new Error(message), value);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.toError = toError;
|
|
68
|
+
exports.withCause = withCause;
|
|
69
|
+
//# sourceMappingURL=thrown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown.cjs","names":[],"sources":["../../src/generative-ui/thrown.ts"],"sourcesContent":["// Turns any thrown value into an Error, for the error boundaries of the\n// framework packages. Framework-free, and safe on Hermes.\n\n/**\n * Sets `cause` as an own property. `new Error(message, { cause })` needs\n * ES2022 error options, which an engine without them (the JavaScriptCore of\n * iOS before 15, which React Native 0.70 can still run on) ignores without a\n * word, so it is set by hand on every engine.\n */\nexport function withCause(error: Error, cause: unknown): Error {\n Object.defineProperty(error, \"cause\", {\n value: cause,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n return error;\n}\n\n/** The longest description of a thrown object's data. */\nconst MAX_DESCRIPTION = 200;\n\n/**\n * Reads what a thrown value says without letting the reading throw: a\n * getter, a Proxy trap, a `toJSON` or a `toString` may throw too.\n */\nfunction attempt<T>(read: () => T): T | undefined {\n try {\n return read();\n } catch {\n return undefined;\n }\n}\n\n/** The `message` of a thrown object, when it is a non-empty string. */\nfunction messageOf(value: unknown): string | undefined {\n if (typeof value !== \"object\" || value === null) return undefined;\n const message = attempt(() => (value as { message?: unknown }).message);\n return typeof message === \"string\" && message !== \"\" ? message : undefined;\n}\n\n/** A thrown value as text, for a value that is not an Error. */\nfunction describeThrown(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"object\" && value !== null) {\n // Its data, not \"[object Object]\".\n const json = attempt(() => JSON.stringify(value));\n if (typeof json === \"string\") {\n return json.length > MAX_DESCRIPTION\n ? `${json.slice(0, MAX_DESCRIPTION)}…`\n : json;\n }\n }\n return (\n attempt(() => String(value)) ??\n attempt(() => Object.prototype.toString.call(value)) ??\n typeof value\n );\n}\n\n/** An Error of this realm, or of another one (a frame, a VM context). */\nfunction isError(value: unknown): value is Error {\n // `instanceof` runs a Proxy's getPrototypeOf trap, which may throw.\n if (attempt(() => value instanceof Error)) return true;\n // Another realm's Error fails `instanceof`; its tag says what it is. A\n // tag can be set on any object, so it must have a message as well.\n return (\n attempt(() => Object.prototype.toString.call(value)) === \"[object Error]\" &&\n typeof attempt(() => (value as { message?: unknown }).message) === \"string\"\n );\n}\n\n/**\n * The Error for any thrown value. Code may throw anything: a string, or a\n * falsy value (`undefined`, `null`, `0`, `\"\"`) that a boundary which keeps\n * the thrown value and tests it for truth would take for \"no error\". An\n * Error comes back as it is; a non-empty string, or the string `message`\n * of a thrown object, becomes the message; any other value is described in\n * the message. A value that is not an Error is kept as the `cause`. This\n * never throws, whatever the value.\n */\nexport function toError(value: unknown): Error {\n if (isError(value)) return value;\n const message =\n typeof value === \"string\" && value !== \"\"\n ? value\n : (messageOf(value) ??\n `A value that is not an Error was thrown: ${describeThrown(value)}`);\n return withCause(new Error(message), value);\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,UAAU,OAAc,OAAuB;AAC7D,QAAO,eAAe,OAAO,SAAS;EACpC,OAAO;EACP,UAAU;EACV,cAAc;EACd,YAAY;EACb,CAAC;AACF,QAAO;;;AAIT,MAAM,kBAAkB;;;;;AAMxB,SAAS,QAAW,MAA8B;AAChD,KAAI;AACF,SAAO,MAAM;SACP;AACN;;;;AAKJ,SAAS,UAAU,OAAoC;AACrD,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,UAAU,cAAe,MAAgC,QAAQ;AACvE,QAAO,OAAO,YAAY,YAAY,YAAY,KAAK,UAAU;;;AAInE,SAAS,eAAe,OAAwB;AAC9C,KAAI,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,MAAM;AAC3D,KAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAE/C,MAAM,OAAO,cAAc,KAAK,UAAU,MAAM,CAAC;AACjD,MAAI,OAAO,SAAS,SAClB,QAAO,KAAK,SAAS,kBACjB,GAAG,KAAK,MAAM,GAAG,gBAAgB,CAAC,KAClC;;AAGR,QACE,cAAc,OAAO,MAAM,CAAC,IAC5B,cAAc,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC,IACpD,OAAO;;;AAKX,SAAS,QAAQ,OAAgC;AAE/C,KAAI,cAAc,iBAAiB,MAAM,CAAE,QAAO;AAGlD,QACE,cAAc,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC,KAAK,oBACzD,OAAO,cAAe,MAAgC,QAAQ,KAAK;;;;;;;;;;;AAavE,SAAgB,QAAQ,OAAuB;AAC7C,KAAI,QAAQ,MAAM,CAAE,QAAO;CAC3B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,KACnC,QACC,UAAU,MAAM,IACjB,4CAA4C,eAAe,MAAM;AACvE,QAAO,UAAU,IAAI,MAAM,QAAQ,EAAE,MAAM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/generative-ui/thrown.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sets `cause` as an own property. `new Error(message, { cause })` needs
|
|
4
|
+
* ES2022 error options, which an engine without them (the JavaScriptCore of
|
|
5
|
+
* iOS before 15, which React Native 0.70 can still run on) ignores without a
|
|
6
|
+
* word, so it is set by hand on every engine.
|
|
7
|
+
*/
|
|
8
|
+
declare function withCause(error: Error, cause: unknown): Error;
|
|
9
|
+
/**
|
|
10
|
+
* The Error for any thrown value. Code may throw anything: a string, or a
|
|
11
|
+
* falsy value (`undefined`, `null`, `0`, `""`) that a boundary which keeps
|
|
12
|
+
* the thrown value and tests it for truth would take for "no error". An
|
|
13
|
+
* Error comes back as it is; a non-empty string, or the string `message`
|
|
14
|
+
* of a thrown object, becomes the message; any other value is described in
|
|
15
|
+
* the message. A value that is not an Error is kept as the `cause`. This
|
|
16
|
+
* never throws, whatever the value.
|
|
17
|
+
*/
|
|
18
|
+
declare function toError(value: unknown): Error;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { toError, withCause };
|
|
21
|
+
//# sourceMappingURL=thrown.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown.d.cts","names":[],"sources":["../../src/generative-ui/thrown.ts"],"mappings":";;AASA;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,KAAA,EAAO,KAAA,YAAiB,KAAA;;;;;AAwEzD;;;;;iBAAgB,OAAA,CAAQ,KAAA,YAAiB,KAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/generative-ui/thrown.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sets `cause` as an own property. `new Error(message, { cause })` needs
|
|
4
|
+
* ES2022 error options, which an engine without them (the JavaScriptCore of
|
|
5
|
+
* iOS before 15, which React Native 0.70 can still run on) ignores without a
|
|
6
|
+
* word, so it is set by hand on every engine.
|
|
7
|
+
*/
|
|
8
|
+
declare function withCause(error: Error, cause: unknown): Error;
|
|
9
|
+
/**
|
|
10
|
+
* The Error for any thrown value. Code may throw anything: a string, or a
|
|
11
|
+
* falsy value (`undefined`, `null`, `0`, `""`) that a boundary which keeps
|
|
12
|
+
* the thrown value and tests it for truth would take for "no error". An
|
|
13
|
+
* Error comes back as it is; a non-empty string, or the string `message`
|
|
14
|
+
* of a thrown object, becomes the message; any other value is described in
|
|
15
|
+
* the message. A value that is not an Error is kept as the `cause`. This
|
|
16
|
+
* never throws, whatever the value.
|
|
17
|
+
*/
|
|
18
|
+
declare function toError(value: unknown): Error;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { toError, withCause };
|
|
21
|
+
//# sourceMappingURL=thrown.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown.d.mts","names":[],"sources":["../../src/generative-ui/thrown.ts"],"mappings":";;AASA;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,KAAA,EAAO,KAAA,YAAiB,KAAA;;;;;AAwEzD;;;;;iBAAgB,OAAA,CAAQ,KAAA,YAAiB,KAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region src/generative-ui/thrown.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sets `cause` as an own property. `new Error(message, { cause })` needs
|
|
4
|
+
* ES2022 error options, which an engine without them (the JavaScriptCore of
|
|
5
|
+
* iOS before 15, which React Native 0.70 can still run on) ignores without a
|
|
6
|
+
* word, so it is set by hand on every engine.
|
|
7
|
+
*/
|
|
8
|
+
function withCause(error, cause) {
|
|
9
|
+
Object.defineProperty(error, "cause", {
|
|
10
|
+
value: cause,
|
|
11
|
+
writable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
enumerable: false
|
|
14
|
+
});
|
|
15
|
+
return error;
|
|
16
|
+
}
|
|
17
|
+
/** The longest description of a thrown object's data. */
|
|
18
|
+
const MAX_DESCRIPTION = 200;
|
|
19
|
+
/**
|
|
20
|
+
* Reads what a thrown value says without letting the reading throw: a
|
|
21
|
+
* getter, a Proxy trap, a `toJSON` or a `toString` may throw too.
|
|
22
|
+
*/
|
|
23
|
+
function attempt(read) {
|
|
24
|
+
try {
|
|
25
|
+
return read();
|
|
26
|
+
} catch {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** The `message` of a thrown object, when it is a non-empty string. */
|
|
31
|
+
function messageOf(value) {
|
|
32
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
33
|
+
const message = attempt(() => value.message);
|
|
34
|
+
return typeof message === "string" && message !== "" ? message : void 0;
|
|
35
|
+
}
|
|
36
|
+
/** A thrown value as text, for a value that is not an Error. */
|
|
37
|
+
function describeThrown(value) {
|
|
38
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
39
|
+
if (typeof value === "object" && value !== null) {
|
|
40
|
+
const json = attempt(() => JSON.stringify(value));
|
|
41
|
+
if (typeof json === "string") return json.length > MAX_DESCRIPTION ? `${json.slice(0, MAX_DESCRIPTION)}…` : json;
|
|
42
|
+
}
|
|
43
|
+
return attempt(() => String(value)) ?? attempt(() => Object.prototype.toString.call(value)) ?? typeof value;
|
|
44
|
+
}
|
|
45
|
+
/** An Error of this realm, or of another one (a frame, a VM context). */
|
|
46
|
+
function isError(value) {
|
|
47
|
+
if (attempt(() => value instanceof Error)) return true;
|
|
48
|
+
return attempt(() => Object.prototype.toString.call(value)) === "[object Error]" && typeof attempt(() => value.message) === "string";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The Error for any thrown value. Code may throw anything: a string, or a
|
|
52
|
+
* falsy value (`undefined`, `null`, `0`, `""`) that a boundary which keeps
|
|
53
|
+
* the thrown value and tests it for truth would take for "no error". An
|
|
54
|
+
* Error comes back as it is; a non-empty string, or the string `message`
|
|
55
|
+
* of a thrown object, becomes the message; any other value is described in
|
|
56
|
+
* the message. A value that is not an Error is kept as the `cause`. This
|
|
57
|
+
* never throws, whatever the value.
|
|
58
|
+
*/
|
|
59
|
+
function toError(value) {
|
|
60
|
+
if (isError(value)) return value;
|
|
61
|
+
const message = typeof value === "string" && value !== "" ? value : messageOf(value) ?? `A value that is not an Error was thrown: ${describeThrown(value)}`;
|
|
62
|
+
return withCause(new Error(message), value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { toError, withCause };
|
|
67
|
+
//# sourceMappingURL=thrown.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown.mjs","names":[],"sources":["../../src/generative-ui/thrown.ts"],"sourcesContent":["// Turns any thrown value into an Error, for the error boundaries of the\n// framework packages. Framework-free, and safe on Hermes.\n\n/**\n * Sets `cause` as an own property. `new Error(message, { cause })` needs\n * ES2022 error options, which an engine without them (the JavaScriptCore of\n * iOS before 15, which React Native 0.70 can still run on) ignores without a\n * word, so it is set by hand on every engine.\n */\nexport function withCause(error: Error, cause: unknown): Error {\n Object.defineProperty(error, \"cause\", {\n value: cause,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n return error;\n}\n\n/** The longest description of a thrown object's data. */\nconst MAX_DESCRIPTION = 200;\n\n/**\n * Reads what a thrown value says without letting the reading throw: a\n * getter, a Proxy trap, a `toJSON` or a `toString` may throw too.\n */\nfunction attempt<T>(read: () => T): T | undefined {\n try {\n return read();\n } catch {\n return undefined;\n }\n}\n\n/** The `message` of a thrown object, when it is a non-empty string. */\nfunction messageOf(value: unknown): string | undefined {\n if (typeof value !== \"object\" || value === null) return undefined;\n const message = attempt(() => (value as { message?: unknown }).message);\n return typeof message === \"string\" && message !== \"\" ? message : undefined;\n}\n\n/** A thrown value as text, for a value that is not an Error. */\nfunction describeThrown(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"object\" && value !== null) {\n // Its data, not \"[object Object]\".\n const json = attempt(() => JSON.stringify(value));\n if (typeof json === \"string\") {\n return json.length > MAX_DESCRIPTION\n ? `${json.slice(0, MAX_DESCRIPTION)}…`\n : json;\n }\n }\n return (\n attempt(() => String(value)) ??\n attempt(() => Object.prototype.toString.call(value)) ??\n typeof value\n );\n}\n\n/** An Error of this realm, or of another one (a frame, a VM context). */\nfunction isError(value: unknown): value is Error {\n // `instanceof` runs a Proxy's getPrototypeOf trap, which may throw.\n if (attempt(() => value instanceof Error)) return true;\n // Another realm's Error fails `instanceof`; its tag says what it is. A\n // tag can be set on any object, so it must have a message as well.\n return (\n attempt(() => Object.prototype.toString.call(value)) === \"[object Error]\" &&\n typeof attempt(() => (value as { message?: unknown }).message) === \"string\"\n );\n}\n\n/**\n * The Error for any thrown value. Code may throw anything: a string, or a\n * falsy value (`undefined`, `null`, `0`, `\"\"`) that a boundary which keeps\n * the thrown value and tests it for truth would take for \"no error\". An\n * Error comes back as it is; a non-empty string, or the string `message`\n * of a thrown object, becomes the message; any other value is described in\n * the message. A value that is not an Error is kept as the `cause`. This\n * never throws, whatever the value.\n */\nexport function toError(value: unknown): Error {\n if (isError(value)) return value;\n const message =\n typeof value === \"string\" && value !== \"\"\n ? value\n : (messageOf(value) ??\n `A value that is not an Error was thrown: ${describeThrown(value)}`);\n return withCause(new Error(message), value);\n}\n"],"mappings":";;;;;;;AASA,SAAgB,UAAU,OAAc,OAAuB;AAC7D,QAAO,eAAe,OAAO,SAAS;EACpC,OAAO;EACP,UAAU;EACV,cAAc;EACd,YAAY;EACb,CAAC;AACF,QAAO;;;AAIT,MAAM,kBAAkB;;;;;AAMxB,SAAS,QAAW,MAA8B;AAChD,KAAI;AACF,SAAO,MAAM;SACP;AACN;;;;AAKJ,SAAS,UAAU,OAAoC;AACrD,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,UAAU,cAAe,MAAgC,QAAQ;AACvE,QAAO,OAAO,YAAY,YAAY,YAAY,KAAK,UAAU;;;AAInE,SAAS,eAAe,OAAwB;AAC9C,KAAI,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,MAAM;AAC3D,KAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAE/C,MAAM,OAAO,cAAc,KAAK,UAAU,MAAM,CAAC;AACjD,MAAI,OAAO,SAAS,SAClB,QAAO,KAAK,SAAS,kBACjB,GAAG,KAAK,MAAM,GAAG,gBAAgB,CAAC,KAClC;;AAGR,QACE,cAAc,OAAO,MAAM,CAAC,IAC5B,cAAc,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC,IACpD,OAAO;;;AAKX,SAAS,QAAQ,OAAgC;AAE/C,KAAI,cAAc,iBAAiB,MAAM,CAAE,QAAO;AAGlD,QACE,cAAc,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC,KAAK,oBACzD,OAAO,cAAe,MAAgC,QAAQ,KAAK;;;;;;;;;;;AAavE,SAAgB,QAAQ,OAAuB;AAC7C,KAAI,QAAQ,MAAM,CAAE,QAAO;CAC3B,MAAM,UACJ,OAAO,UAAU,YAAY,UAAU,KACnC,QACC,UAAU,MAAM,IACjB,4CAA4C,eAAe,MAAM;AACvE,QAAO,UAAU,IAAI,MAAM,QAAQ,EAAE,MAAM"}
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ const require_a2ui_envelope = require('./a2ui-envelope.cjs');
|
|
|
34
34
|
const require_open_generative_ui_prompts = require('./open-generative-ui-prompts.cjs');
|
|
35
35
|
const require_validate_operation = require('./generative-ui/validate-operation.cjs');
|
|
36
36
|
const require_render_ui_args = require('./generative-ui/render-ui-args.cjs');
|
|
37
|
+
const require_clone_value = require('./generative-ui/clone-value.cjs');
|
|
37
38
|
const require_compact_schema = require('./generative-ui/compact-schema.cjs');
|
|
38
39
|
const require_schema_render = require('./generative-ui/schema-render.cjs');
|
|
39
40
|
const require_prompt = require('./generative-ui/prompt.cjs');
|
|
@@ -158,6 +159,7 @@ exports.callerProblem = require_validate_operation.callerProblem;
|
|
|
158
159
|
exports.childIdsAtRefs = require_child_refs.childIdsAtRefs;
|
|
159
160
|
exports.childRefKind = require_child_refs.childRefKind;
|
|
160
161
|
exports.classifyModelHost = require_model_host.classifyModelHost;
|
|
162
|
+
exports.cloneValue = require_clone_value.cloneValue;
|
|
161
163
|
exports.collectChildRefs = require_child_refs.collectChildRefs;
|
|
162
164
|
exports.commitRowKeyStore = require_row_render_keys.commitRowKeyStore;
|
|
163
165
|
exports.computeSamplingMeta = require_sampling.computeSamplingMeta;
|
package/dist/index.cjs.map
CHANGED
|
@@ -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/base\";\n"],"mappings":"
|
|
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// On the root, not only on `@copilotkit/shared/generative-ui`: the core\n// root entry needs it, and importing the generative UI barrel there would\n// load its validators and catalogs in every app (Metro does not\n// tree-shake), and leave the UMD build without a global for the subpath.\nexport { cloneValue } from \"./generative-ui/clone-value\";\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
|
@@ -8,6 +8,7 @@ import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./ge
|
|
|
8
8
|
import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.cjs";
|
|
9
9
|
import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.cjs";
|
|
10
10
|
import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.cjs";
|
|
11
|
+
import { cloneValue } from "./generative-ui/clone-value.cjs";
|
|
11
12
|
import { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from "./types/openai-assistant.cjs";
|
|
12
13
|
import { Action, MappedParameterTypes, Parameter } from "./types/action.cjs";
|
|
13
14
|
import { CopilotCloudConfig } from "./types/copilot-cloud-config.cjs";
|
|
@@ -77,5 +78,5 @@ interface LicenseContextValue {
|
|
|
77
78
|
*/
|
|
78
79
|
declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined, runtimeEntitlements?: RuntimeEntitlementResponse): LicenseContextValue;
|
|
79
80
|
//#endregion
|
|
80
|
-
export { A2UIActionMessage, A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIComponentNode, A2UIFunctionCall, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, A2UIRuntimeInfo, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_INDEX_FUNCTION, A2UI_VERSION, AG_UI_CHANNEL_EVENT, AIMessage, ALL_GENERATIVE_UI_GUIDE_FEATURES, Action, ActivityMessage, AgentDescription, AllowedComponents, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_FUNCTIONS, COPILOTKIT_UI_ENVELOPE_FORMAT, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ChildRef, ChildRefKind, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ConfigurationError, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, type CopilotKitUIEnvelope, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExtractedRenderUIArgs, type FinalizeRunOptions, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_CONTEXT_DESCRIPTION, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, type GenerativeUIGuideFeatures, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUIRejectedOperation, GenerativeUISchemaSettings, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, InspectorMetadataV1, InspectorVisibilityOptions, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, MODEL_HOST_CLASSES, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, ModelHostClass, NonEmptyRecord, OperationKind, OperationValidation, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RenderUIArgsStream, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, RowKeyStore, type RunEventFinalizer, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SamplingMeta, Severity, SingleRouteRuntimeInfo, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, THREAD_ALREADY_RUNNING_ERROR_CODE, TelemetryEmitter, TelemetrySurface, TelemetryTransport, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UNSAMPLED_RATE, UpgradeRequiredError, UserMessage, ValidateOperationOptions, VideoInputPart, actionParametersToJsonSchema, applyChildRefMarks, applyDescriptionOverrides, buildCompactGenerativeUISchema, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childIdsAtRefs, childRefKind, classifyModelHost, collectChildRefs, commitRowKeyStore, computeSamplingMeta, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, createRunEventFinalizer, defaultGenerativeUIPromptSpec, ensureStructuredError, envelopeToManifest, exceedsMaxSize, extractRenderUIArgs, finalizeRunEvents, firstNonBlankTelemetryId, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIFunctionCallMessageId, generativeUIGuideFeatures, generativeUIPromptFeatures, generativeUISurfaceMessageId, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getSourceUrl, hasBoundChildRef, isA2UIBasicFunction, isA2UIValueFunction, isActionBinding, isCallBinding, isIndexCall, isMacOS, isPathBinding, isStructuredCopilotKitError, isTelemetryDisabled, isValidationResult, jsonSchemaToActionParameters, lambdaClient, logger, mapAtChildRef, matchesAcceptFilter, parseAndWarnTelemetryId, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, processEnv, pruneRowKeyStore, randomId, randomUUID, readBody, readCopilotKitUIEnvelope, readFileAsBase64, renderGenerativeUIComponentList, renderGenerativeUISchema, resolveDebugConfig, resolveRowRenderKeys, resolveRowRenderKeysById, safeParseToolArgs, schemaCoverage, schemaToJsonSchema, selectPromptItems, shouldEnableInspector, stripIntelligenceRoutingFields, toA2UIActionMessage, tryMap, validateOperation, ɵINSPECTOR_LOOPBACK_HOSTS, ɵanySchema };
|
|
81
|
+
export { A2UIActionMessage, A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIComponentNode, A2UIFunctionCall, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, A2UIRuntimeInfo, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_INDEX_FUNCTION, A2UI_VERSION, AG_UI_CHANNEL_EVENT, AIMessage, ALL_GENERATIVE_UI_GUIDE_FEATURES, Action, ActivityMessage, AgentDescription, AllowedComponents, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_FUNCTIONS, COPILOTKIT_UI_ENVELOPE_FORMAT, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ChildRef, ChildRefKind, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ConfigurationError, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, type CopilotKitUIEnvelope, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExtractedRenderUIArgs, type FinalizeRunOptions, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_CONTEXT_DESCRIPTION, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, type GenerativeUIGuideFeatures, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUIRejectedOperation, GenerativeUISchemaSettings, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, InspectorMetadataV1, InspectorVisibilityOptions, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, MODEL_HOST_CLASSES, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, ModelHostClass, NonEmptyRecord, OperationKind, OperationValidation, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RenderUIArgsStream, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, RowKeyStore, type RunEventFinalizer, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SamplingMeta, Severity, SingleRouteRuntimeInfo, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, THREAD_ALREADY_RUNNING_ERROR_CODE, TelemetryEmitter, TelemetrySurface, TelemetryTransport, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UNSAMPLED_RATE, UpgradeRequiredError, UserMessage, ValidateOperationOptions, VideoInputPart, actionParametersToJsonSchema, applyChildRefMarks, applyDescriptionOverrides, buildCompactGenerativeUISchema, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childIdsAtRefs, childRefKind, classifyModelHost, cloneValue, collectChildRefs, commitRowKeyStore, computeSamplingMeta, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, createRunEventFinalizer, defaultGenerativeUIPromptSpec, ensureStructuredError, envelopeToManifest, exceedsMaxSize, extractRenderUIArgs, finalizeRunEvents, firstNonBlankTelemetryId, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIFunctionCallMessageId, generativeUIGuideFeatures, generativeUIPromptFeatures, generativeUISurfaceMessageId, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getSourceUrl, hasBoundChildRef, isA2UIBasicFunction, isA2UIValueFunction, isActionBinding, isCallBinding, isIndexCall, isMacOS, isPathBinding, isStructuredCopilotKitError, isTelemetryDisabled, isValidationResult, jsonSchemaToActionParameters, lambdaClient, logger, mapAtChildRef, matchesAcceptFilter, parseAndWarnTelemetryId, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, processEnv, pruneRowKeyStore, randomId, randomUUID, readBody, readCopilotKitUIEnvelope, readFileAsBase64, renderGenerativeUIComponentList, renderGenerativeUISchema, resolveDebugConfig, resolveRowRenderKeys, resolveRowRenderKeysById, safeParseToolArgs, schemaCoverage, schemaToJsonSchema, selectPromptItems, shouldEnableInspector, stripIntelligenceRoutingFields, toA2UIActionMessage, tryMap, validateOperation, ɵINSPECTOR_LOOPBACK_HOSTS, ɵanySchema };
|
|
81
82
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCa,kBAAA;;;;;UA8BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;;;;;;;;;;;;iBAgCG,yBAAA,CACd,MAAA,EAAQ,oBAAA,qBACR,mBAAA,GAAsB,0BAAA,GACrB,mBAAA"}
|