@copilotkit/shared 2.0.0-rc.3 → 2.0.0-rc.31
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/README.md +3 -14
- package/dist/a2ui-envelope.cjs +2 -2
- package/dist/a2ui-envelope.cjs.map +1 -1
- package/dist/a2ui-envelope.d.cts +1 -1
- package/dist/a2ui-envelope.d.cts.map +1 -1
- package/dist/a2ui-envelope.d.mts +1 -1
- package/dist/a2ui-envelope.d.mts.map +1 -1
- package/dist/a2ui-envelope.mjs +2 -2
- package/dist/a2ui-envelope.mjs.map +1 -1
- package/dist/a2ui-prompts.cjs +21 -62
- package/dist/a2ui-prompts.cjs.map +1 -1
- package/dist/a2ui-prompts.d.cts +8 -1
- package/dist/a2ui-prompts.d.cts.map +1 -1
- package/dist/a2ui-prompts.d.mts +8 -1
- package/dist/a2ui-prompts.d.mts.map +1 -1
- package/dist/a2ui-prompts.mjs +22 -62
- package/dist/a2ui-prompts.mjs.map +1 -1
- package/dist/attachments/types.d.cts +1 -3
- package/dist/attachments/types.d.cts.map +1 -1
- package/dist/attachments/types.d.mts +1 -3
- package/dist/attachments/types.d.mts.map +1 -1
- package/dist/attachments/utils.cjs +16 -5
- package/dist/attachments/utils.cjs.map +1 -1
- package/dist/attachments/utils.d.cts +3 -1
- package/dist/attachments/utils.d.cts.map +1 -1
- package/dist/attachments/utils.d.mts +3 -1
- package/dist/attachments/utils.d.mts.map +1 -1
- package/dist/attachments/utils.mjs +16 -5
- package/dist/attachments/utils.mjs.map +1 -1
- package/dist/finalize-events.cjs +16 -0
- package/dist/finalize-events.cjs.map +1 -1
- package/dist/finalize-events.d.cts.map +1 -1
- package/dist/finalize-events.d.mts.map +1 -1
- package/dist/finalize-events.mjs +16 -0
- package/dist/finalize-events.mjs.map +1 -1
- package/dist/generative-ui/basic-functions.cjs +1 -1
- package/dist/generative-ui/basic-functions.cjs.map +1 -1
- package/dist/generative-ui/basic-functions.mjs +1 -1
- package/dist/generative-ui/basic-functions.mjs.map +1 -1
- package/dist/generative-ui/child-refs.cjs +3 -3
- package/dist/generative-ui/child-refs.cjs.map +1 -1
- package/dist/generative-ui/child-refs.d.cts.map +1 -1
- package/dist/generative-ui/child-refs.d.mts.map +1 -1
- package/dist/generative-ui/child-refs.mjs +3 -3
- package/dist/generative-ui/child-refs.mjs.map +1 -1
- package/dist/generative-ui/compact-schema.cjs +187 -0
- package/dist/generative-ui/compact-schema.cjs.map +1 -0
- package/dist/generative-ui/compact-schema.d.cts +55 -0
- package/dist/generative-ui/compact-schema.d.cts.map +1 -0
- package/dist/generative-ui/compact-schema.d.mts +55 -0
- package/dist/generative-ui/compact-schema.d.mts.map +1 -0
- package/dist/generative-ui/compact-schema.mjs +185 -0
- package/dist/generative-ui/compact-schema.mjs.map +1 -0
- package/dist/generative-ui/prompt-spec.cjs +225 -0
- package/dist/generative-ui/prompt-spec.cjs.map +1 -0
- package/dist/generative-ui/prompt-spec.d.cts +94 -0
- package/dist/generative-ui/prompt-spec.d.cts.map +1 -0
- package/dist/generative-ui/prompt-spec.d.mts +94 -0
- package/dist/generative-ui/prompt-spec.d.mts.map +1 -0
- package/dist/generative-ui/prompt-spec.mjs +220 -0
- package/dist/generative-ui/prompt-spec.mjs.map +1 -0
- package/dist/generative-ui/prompt.cjs +10 -36
- package/dist/generative-ui/prompt.cjs.map +1 -1
- package/dist/generative-ui/prompt.d.cts +2 -1
- package/dist/generative-ui/prompt.d.cts.map +1 -1
- package/dist/generative-ui/prompt.d.mts +2 -1
- package/dist/generative-ui/prompt.d.mts.map +1 -1
- package/dist/generative-ui/prompt.mjs +12 -38
- package/dist/generative-ui/prompt.mjs.map +1 -1
- package/dist/generative-ui/render-ui-args.cjs +1 -0
- package/dist/generative-ui/render-ui-args.cjs.map +1 -1
- package/dist/generative-ui/render-ui-args.d.cts.map +1 -1
- package/dist/generative-ui/render-ui-args.d.mts.map +1 -1
- package/dist/generative-ui/render-ui-args.mjs +1 -0
- package/dist/generative-ui/render-ui-args.mjs.map +1 -1
- package/dist/generative-ui/schema-render.cjs +242 -0
- package/dist/generative-ui/schema-render.cjs.map +1 -0
- package/dist/generative-ui/schema-render.d.cts +44 -0
- package/dist/generative-ui/schema-render.d.cts.map +1 -0
- package/dist/generative-ui/schema-render.d.mts +44 -0
- package/dist/generative-ui/schema-render.d.mts.map +1 -0
- package/dist/generative-ui/schema-render.mjs +239 -0
- package/dist/generative-ui/schema-render.mjs.map +1 -0
- package/dist/generative-ui/types.cjs +2 -2
- package/dist/generative-ui/types.cjs.map +1 -1
- package/dist/generative-ui/types.d.cts +7 -7
- package/dist/generative-ui/types.d.cts.map +1 -1
- package/dist/generative-ui/types.d.mts +7 -7
- package/dist/generative-ui/types.d.mts.map +1 -1
- package/dist/generative-ui/types.mjs +2 -2
- package/dist/generative-ui/types.mjs.map +1 -1
- package/dist/generative-ui/validate-operation.cjs +2 -2
- package/dist/generative-ui/validate-operation.cjs.map +1 -1
- package/dist/generative-ui/validate-operation.mjs +2 -2
- package/dist/generative-ui/validate-operation.mjs.map +1 -1
- package/dist/index.cjs +16 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +866 -455
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/standard-schema.cjs +20 -7
- package/dist/standard-schema.cjs.map +1 -1
- package/dist/standard-schema.d.cts +15 -16
- package/dist/standard-schema.d.cts.map +1 -1
- package/dist/standard-schema.d.mts +15 -16
- package/dist/standard-schema.d.mts.map +1 -1
- package/dist/standard-schema.mjs +20 -8
- package/dist/standard-schema.mjs.map +1 -1
- package/dist/telemetry/lambda-client.cjs +1 -1
- package/dist/telemetry/lambda-client.cjs.map +1 -1
- package/dist/telemetry/lambda-client.d.cts.map +1 -1
- package/dist/telemetry/lambda-client.d.mts.map +1 -1
- package/dist/telemetry/lambda-client.mjs +1 -1
- package/dist/telemetry/lambda-client.mjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.cjs +0 -5
- package/dist/telemetry/telemetry-disabled.cjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.d.cts +0 -5
- package/dist/telemetry/telemetry-disabled.d.cts.map +1 -1
- package/dist/telemetry/telemetry-disabled.d.mts +0 -5
- package/dist/telemetry/telemetry-disabled.d.mts.map +1 -1
- package/dist/telemetry/telemetry-disabled.mjs +0 -5
- package/dist/telemetry/telemetry-disabled.mjs.map +1 -1
- package/dist/types/message.d.cts +1 -18
- package/dist/types/message.d.cts.map +1 -1
- package/dist/types/message.d.mts +1 -18
- package/dist/types/message.d.mts.map +1 -1
- package/dist/utils/errors.cjs +5 -42
- package/dist/utils/errors.cjs.map +1 -1
- package/dist/utils/errors.d.cts +16 -34
- package/dist/utils/errors.d.cts.map +1 -1
- package/dist/utils/errors.d.mts +16 -34
- package/dist/utils/errors.d.mts.map +1 -1
- package/dist/utils/errors.mjs +6 -41
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +4 -6
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +4 -6
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +4 -6
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/inspector-visibility.cjs +25 -3
- package/dist/utils/inspector-visibility.cjs.map +1 -1
- package/dist/utils/inspector-visibility.d.cts +26 -3
- package/dist/utils/inspector-visibility.d.cts.map +1 -1
- package/dist/utils/inspector-visibility.d.mts +26 -3
- package/dist/utils/inspector-visibility.d.mts.map +1 -1
- package/dist/utils/inspector-visibility.mjs +25 -4
- package/dist/utils/inspector-visibility.mjs.map +1 -1
- package/dist/utils/json-schema.cjs +4 -79
- package/dist/utils/json-schema.cjs.map +1 -1
- package/dist/utils/json-schema.d.cts +1 -4
- package/dist/utils/json-schema.d.cts.map +1 -1
- package/dist/utils/json-schema.d.mts +1 -4
- package/dist/utils/json-schema.d.mts.map +1 -1
- package/dist/utils/json-schema.mjs +5 -78
- package/dist/utils/json-schema.mjs.map +1 -1
- package/dist/utils/random-id.cjs +13 -26
- package/dist/utils/random-id.cjs.map +1 -1
- package/dist/utils/random-id.d.cts +6 -3
- package/dist/utils/random-id.d.cts.map +1 -1
- package/dist/utils/random-id.d.mts +6 -3
- package/dist/utils/random-id.d.mts.map +1 -1
- package/dist/utils/random-id.mjs +14 -25
- package/dist/utils/random-id.mjs.map +1 -1
- package/package.json +10 -34
- package/scripts/verify-cjs-exports.cjs +1 -1
- package/src/__tests__/a2ui-envelope.test.ts +18 -13
- package/src/__tests__/a2ui-prompts.test.ts +47 -14
- package/src/__tests__/fixtures/prompt-goldens.json +354 -0
- package/src/__tests__/prompt-spec.test.ts +191 -0
- package/src/__tests__/root-entry-browser-safety.test.ts +5 -7
- package/src/__tests__/schema-render.test.ts +245 -0
- package/src/__tests__/standard-schema.test.ts +61 -101
- package/src/a2ui-envelope.ts +7 -6
- package/src/a2ui-prompts.ts +47 -96
- package/src/attachments/__tests__/utils.test.ts +22 -0
- package/src/attachments/types.ts +1 -3
- package/src/attachments/utils.ts +23 -5
- package/src/finalize-events.ts +16 -0
- package/src/generative-ui/__tests__/render-ui-args.test.ts +7 -7
- package/src/generative-ui/__tests__/validate-operation.test.ts +19 -13
- package/src/generative-ui/basic-functions.ts +1 -1
- package/src/generative-ui/child-refs.ts +5 -4
- package/src/generative-ui/compact-schema.ts +277 -0
- package/src/generative-ui/index.ts +3 -0
- package/src/generative-ui/prompt-spec.ts +335 -0
- package/src/generative-ui/prompt.ts +25 -75
- package/src/generative-ui/render-ui-args.ts +3 -0
- package/src/generative-ui/schema-render.ts +377 -0
- package/src/generative-ui/types.ts +10 -7
- package/src/generative-ui/validate-operation.ts +2 -2
- package/src/index.ts +3 -16
- package/src/standard-schema.ts +24 -27
- package/src/telemetry/lambda-client.ts +8 -3
- package/src/telemetry/model-host.test.ts +2 -5
- package/src/telemetry/telemetry-disabled.ts +0 -5
- package/src/types/message.ts +1 -19
- package/src/utils/__tests__/errors.test.ts +44 -0
- package/src/utils/__tests__/json-schema.test.ts +3 -479
- package/src/utils/__tests__/random-id.test.ts +37 -0
- package/src/utils/errors.ts +28 -85
- package/src/utils/index.ts +0 -2
- package/src/utils/inspector-visibility.test.ts +26 -0
- package/src/utils/inspector-visibility.ts +35 -3
- package/src/utils/json-schema.ts +5 -152
- package/src/utils/random-id.ts +17 -37
- package/tsconfig.json +3 -1
- package/tsdown.config.ts +2 -19
- package/dist/event-transforms/index.cjs +0 -15
- package/dist/event-transforms/index.d.cts +0 -4
- package/dist/event-transforms/index.d.mts +0 -4
- package/dist/event-transforms/index.mjs +0 -5
- package/dist/event-transforms/open-generative-ui-middleware.cjs +0 -286
- package/dist/event-transforms/open-generative-ui-middleware.cjs.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.cts +0 -60
- package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.mts +0 -60
- package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.mjs +0 -283
- package/dist/event-transforms/open-generative-ui-middleware.mjs.map +0 -1
- package/dist/event-transforms/recorded-events.cjs +0 -59
- package/dist/event-transforms/recorded-events.cjs.map +0 -1
- package/dist/event-transforms/recorded-events.d.cts +0 -23
- package/dist/event-transforms/recorded-events.d.cts.map +0 -1
- package/dist/event-transforms/recorded-events.d.mts +0 -23
- package/dist/event-transforms/recorded-events.d.mts.map +0 -1
- package/dist/event-transforms/recorded-events.mjs +0 -58
- package/dist/event-transforms/recorded-events.mjs.map +0 -1
- package/dist/telemetry/events.d.cts +0 -72
- package/dist/telemetry/events.d.cts.map +0 -1
- package/dist/telemetry/events.d.mts +0 -72
- package/dist/telemetry/events.d.mts.map +0 -1
- package/dist/telemetry/index.cjs +0 -18
- package/dist/telemetry/index.d.cts +0 -5
- package/dist/telemetry/index.d.mts +0 -5
- package/dist/telemetry/index.mjs +0 -6
- package/dist/telemetry/telemetry-client.cjs +0 -165
- package/dist/telemetry/telemetry-client.cjs.map +0 -1
- package/dist/telemetry/telemetry-client.d.cts +0 -87
- package/dist/telemetry/telemetry-client.d.cts.map +0 -1
- package/dist/telemetry/telemetry-client.d.mts +0 -87
- package/dist/telemetry/telemetry-client.d.mts.map +0 -1
- package/dist/telemetry/telemetry-client.mjs +0 -164
- package/dist/telemetry/telemetry-client.mjs.map +0 -1
- package/dist/telemetry/utils.cjs +0 -14
- package/dist/telemetry/utils.cjs.map +0 -1
- package/dist/telemetry/utils.mjs +0 -13
- package/dist/telemetry/utils.mjs.map +0 -1
- package/dist/utils/conditions.cjs +0 -32
- package/dist/utils/conditions.cjs.map +0 -1
- package/dist/utils/conditions.d.cts +0 -31
- package/dist/utils/conditions.d.cts.map +0 -1
- package/dist/utils/conditions.d.mts +0 -31
- package/dist/utils/conditions.d.mts.map +0 -1
- package/dist/utils/conditions.mjs +0 -31
- package/dist/utils/conditions.mjs.map +0 -1
- package/dist/utils/console-styling.cjs +0 -91
- package/dist/utils/console-styling.cjs.map +0 -1
- package/dist/utils/console-styling.d.cts +0 -65
- package/dist/utils/console-styling.d.cts.map +0 -1
- package/dist/utils/console-styling.d.mts +0 -65
- package/dist/utils/console-styling.d.mts.map +0 -1
- package/dist/utils/console-styling.mjs +0 -85
- package/dist/utils/console-styling.mjs.map +0 -1
- package/src/__tests__/zod-regression.test.ts +0 -319
- package/src/event-transforms/index.ts +0 -5
- package/src/event-transforms/open-generative-ui-middleware.ts +0 -392
- package/src/event-transforms/recorded-events.test.ts +0 -166
- package/src/event-transforms/recorded-events.ts +0 -74
- package/src/telemetry/events.ts +0 -68
- package/src/telemetry/index.ts +0 -9
- package/src/telemetry/telemetry-blank-license-identity.test.ts +0 -128
- package/src/telemetry/telemetry-client.test.ts +0 -798
- package/src/telemetry/telemetry-client.ts +0 -328
- package/src/telemetry/utils.ts +0 -15
- package/src/utils/__tests__/conditions.test.ts +0 -161
- package/src/utils/conditions.ts +0 -116
- package/src/utils/console-styling.ts +0 -126
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
//#region src/utils/console-styling.ts
|
|
2
|
-
/**
|
|
3
|
-
* Console styling utilities for CopilotKit branded messages
|
|
4
|
-
* Provides consistent, readable colors across light and dark console themes
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Color palette optimized for console readability
|
|
8
|
-
*/
|
|
9
|
-
const ConsoleColors = {
|
|
10
|
-
primary: "#007acc",
|
|
11
|
-
success: "#22c55e",
|
|
12
|
-
feature: "#a855f7",
|
|
13
|
-
cta: "#ef4444",
|
|
14
|
-
info: "#06b6d4",
|
|
15
|
-
inherit: "inherit",
|
|
16
|
-
warning: "#f59e0b"
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Console style templates for common patterns
|
|
20
|
-
*/
|
|
21
|
-
const ConsoleStyles = {
|
|
22
|
-
header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,
|
|
23
|
-
section: `color: ${ConsoleColors.success}; font-weight: bold;`,
|
|
24
|
-
highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,
|
|
25
|
-
cta: `color: ${ConsoleColors.success}; font-weight: bold;`,
|
|
26
|
-
info: `color: ${ConsoleColors.info}; font-weight: bold;`,
|
|
27
|
-
link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,
|
|
28
|
-
body: `color: ${ConsoleColors.inherit};`,
|
|
29
|
-
warning: `color: ${ConsoleColors.cta}; font-weight: bold;`
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Styled console message for CopilotKit Platform promotion
|
|
33
|
-
* Displays a beautiful, branded advertisement in the console
|
|
34
|
-
*/
|
|
35
|
-
function logCopilotKitPlatformMessage() {
|
|
36
|
-
console.log(`%cCopilotKit Warning%c
|
|
37
|
-
|
|
38
|
-
useCopilotChatHeadless_c provides full compatibility with CopilotKit's newly released Headless UI feature set. Headless UI requires a CopilotKit Intelligence license key, available for free at:
|
|
39
|
-
|
|
40
|
-
%chttps://dashboard.operations.copilotkit.ai%c
|
|
41
|
-
|
|
42
|
-
Alternatively, useCopilotChat is available for basic programmatic control, and does not require a license key.
|
|
43
|
-
|
|
44
|
-
To learn more about CopilotKit Intelligence, read the documentation here:
|
|
45
|
-
|
|
46
|
-
%chttps://docs.copilotkit.ai/intelligence/overview%c`, ConsoleStyles.header, ConsoleStyles.body, ConsoleStyles.cta, ConsoleStyles.body, ConsoleStyles.link, ConsoleStyles.body);
|
|
47
|
-
}
|
|
48
|
-
function publicApiKeyRequired(feature) {
|
|
49
|
-
console.log(`
|
|
50
|
-
%cCopilotKit Warning%c \n
|
|
51
|
-
In order to use ${feature}, you need to add your CopilotKit license key, available for free at https://dashboard.operations.copilotkit.ai.
|
|
52
|
-
`.trim(), ConsoleStyles.header, ConsoleStyles.body);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Create a styled console message with custom content
|
|
56
|
-
*
|
|
57
|
-
* @param template - Template string with %c placeholders
|
|
58
|
-
* @param styles - Array of style strings matching the %c placeholders
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* logStyled(
|
|
63
|
-
* '%cCopilotKit%c Welcome to the platform!',
|
|
64
|
-
* [ConsoleStyles.header, ConsoleStyles.body]
|
|
65
|
-
* );
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
function logStyled(template, styles) {
|
|
69
|
-
console.log(template, ...styles);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Quick styled console methods for common use cases
|
|
73
|
-
*/
|
|
74
|
-
const styledConsole = {
|
|
75
|
-
success: (message) => logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),
|
|
76
|
-
info: (message) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),
|
|
77
|
-
feature: (message) => logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),
|
|
78
|
-
cta: (message) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),
|
|
79
|
-
logCopilotKitPlatformMessage,
|
|
80
|
-
publicApiKeyRequired
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
export { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole };
|
|
85
|
-
//# sourceMappingURL=console-styling.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-styling.mjs","names":[],"sources":["../../src/utils/console-styling.ts"],"sourcesContent":["/**\n * Console styling utilities for CopilotKit branded messages\n * Provides consistent, readable colors across light and dark console themes\n */\n\n/**\n * Color palette optimized for console readability\n */\nexport const ConsoleColors = {\n /** Primary brand blue - for titles and links */\n primary: \"#007acc\",\n /** Success green - for positive messaging */\n success: \"#22c55e\",\n /** Purple - for feature highlights */\n feature: \"#a855f7\",\n /** Red - for calls-to-action */\n cta: \"#ef4444\",\n /** Cyan - for closing statements */\n info: \"#06b6d4\",\n /** Inherit console default - for body text */\n inherit: \"inherit\",\n /** Warning style */\n warning: \"#f59e0b\",\n} as const;\n\n/**\n * Console style templates for common patterns\n */\nexport const ConsoleStyles = {\n /** Large header style */\n header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,\n /** Section header style */\n section: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Feature highlight style */\n highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,\n /** Call-to-action style */\n cta: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Info style */\n info: `color: ${ConsoleColors.info}; font-weight: bold;`,\n /** Link style */\n link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,\n /** Body text - inherits console theme */\n body: `color: ${ConsoleColors.inherit};`,\n /** Warning style */\n warning: `color: ${ConsoleColors.cta}; font-weight: bold;`,\n} as const;\n\n/**\n * Styled console message for CopilotKit Platform promotion\n * Displays a beautiful, branded advertisement in the console\n */\nexport function logCopilotKitPlatformMessage() {\n console.log(\n `%cCopilotKit Warning%c\n\nuseCopilotChatHeadless_c provides full compatibility with CopilotKit's newly released Headless UI feature set. Headless UI requires a CopilotKit Intelligence license key, available for free at:\n\n%chttps://dashboard.operations.copilotkit.ai%c\n\nAlternatively, useCopilotChat is available for basic programmatic control, and does not require a license key.\n\nTo learn more about CopilotKit Intelligence, read the documentation here:\n\n%chttps://docs.copilotkit.ai/intelligence/overview%c`,\n ConsoleStyles.header,\n ConsoleStyles.body,\n ConsoleStyles.cta,\n ConsoleStyles.body,\n ConsoleStyles.link,\n ConsoleStyles.body,\n );\n}\n\nexport function publicApiKeyRequired(feature: string) {\n console.log(\n `\n%cCopilotKit Warning%c \\n\nIn order to use ${feature}, you need to add your CopilotKit license key, available for free at https://dashboard.operations.copilotkit.ai.\n `.trim(),\n ConsoleStyles.header,\n ConsoleStyles.body,\n );\n}\n\n/**\n * Create a styled console message with custom content\n *\n * @param template - Template string with %c placeholders\n * @param styles - Array of style strings matching the %c placeholders\n *\n * @example\n * ```typescript\n * logStyled(\n * '%cCopilotKit%c Welcome to the platform!',\n * [ConsoleStyles.header, ConsoleStyles.body]\n * );\n * ```\n */\nexport function logStyled(template: string, styles: string[]) {\n console.log(template, ...styles);\n}\n\n/**\n * Quick styled console methods for common use cases\n */\nexport const styledConsole = {\n /** Log a success message */\n success: (message: string) =>\n logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),\n\n /** Log an info message */\n info: (message: string) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),\n\n /** Log a feature highlight */\n feature: (message: string) =>\n logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),\n\n /** Log a call-to-action */\n cta: (message: string) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),\n\n /** Log the CopilotKit platform promotion */\n logCopilotKitPlatformMessage: logCopilotKitPlatformMessage,\n\n /** Log a `publicApiKeyRequired` warning */\n publicApiKeyRequired: publicApiKeyRequired,\n} as const;\n"],"mappings":";;;;;;;;AAQA,MAAa,gBAAgB;CAE3B,SAAS;CAET,SAAS;CAET,SAAS;CAET,KAAK;CAEL,MAAM;CAEN,SAAS;CAET,SAAS;CACV;;;;AAKD,MAAa,gBAAgB;CAE3B,QAAQ,UAAU,cAAc,QAAQ;CAExC,SAAS,UAAU,cAAc,QAAQ;CAEzC,WAAW,UAAU,cAAc,QAAQ;CAE3C,KAAK,UAAU,cAAc,QAAQ;CAErC,MAAM,UAAU,cAAc,KAAK;CAEnC,MAAM,UAAU,cAAc,QAAQ;CAEtC,MAAM,UAAU,cAAc,QAAQ;CAEtC,SAAS,UAAU,cAAc,IAAI;CACtC;;;;;AAMD,SAAgB,+BAA+B;AAC7C,SAAQ,IACN;;;;;;;;;;uDAWA,cAAc,QACd,cAAc,MACd,cAAc,KACd,cAAc,MACd,cAAc,MACd,cAAc,KACf;;AAGH,SAAgB,qBAAqB,SAAiB;AACpD,SAAQ,IACN;;kBAEc,QAAQ;MACpB,MAAM,EACR,cAAc,QACd,cAAc,KACf;;;;;;;;;;;;;;;;AAiBH,SAAgB,UAAU,UAAkB,QAAkB;AAC5D,SAAQ,IAAI,UAAU,GAAG,OAAO;;;;;AAMlC,MAAa,gBAAgB;CAE3B,UAAU,YACR,UAAU,OAAO,WAAW,CAAC,cAAc,QAAQ,CAAC;CAGtD,OAAO,YAAoB,UAAU,QAAQ,WAAW,CAAC,cAAc,KAAK,CAAC;CAG7E,UAAU,YACR,UAAU,OAAO,WAAW,CAAC,cAAc,UAAU,CAAC;CAGxD,MAAM,YAAoB,UAAU,QAAQ,WAAW,CAAC,cAAc,IAAI,CAAC;CAG7C;CAGR;CACvB"}
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Regression tests proving that `schemaToJsonSchema` produces identical output
|
|
3
|
-
* to a direct `zodToJsonSchema` call for all common Zod patterns.
|
|
4
|
-
*
|
|
5
|
-
* These tests exist to guarantee that the Standard Schema migration did not
|
|
6
|
-
* change the JSON Schema output for existing Zod users.
|
|
7
|
-
*/
|
|
8
|
-
import { describe, it, expect } from "vitest";
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
11
|
-
import { schemaToJsonSchema } from "../standard-schema";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Helper: call zodToJsonSchema the same way the old code path did, then
|
|
15
|
-
* compare with the new schemaToJsonSchema path.
|
|
16
|
-
*/
|
|
17
|
-
function expectIdenticalOutput(schema: z.ZodTypeAny) {
|
|
18
|
-
const direct = zodToJsonSchema(schema, { $refStrategy: "none" });
|
|
19
|
-
const migrated = schemaToJsonSchema(schema, { zodToJsonSchema });
|
|
20
|
-
expect(migrated).toEqual(direct);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe("Zod regression — schemaToJsonSchema produces identical output to direct zodToJsonSchema", () => {
|
|
24
|
-
describe("simple object schemas", () => {
|
|
25
|
-
it("required string and number fields", () => {
|
|
26
|
-
expectIdenticalOutput(z.object({ name: z.string(), age: z.number() }));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("optional fields", () => {
|
|
30
|
-
expectIdenticalOutput(
|
|
31
|
-
z.object({
|
|
32
|
-
city: z.string(),
|
|
33
|
-
units: z.enum(["celsius", "fahrenheit"]).optional(),
|
|
34
|
-
}),
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("empty object", () => {
|
|
39
|
-
expectIdenticalOutput(z.object({}));
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("object with default values", () => {
|
|
43
|
-
expectIdenticalOutput(
|
|
44
|
-
z.object({
|
|
45
|
-
page: z.number().default(1),
|
|
46
|
-
perPage: z.number().default(20),
|
|
47
|
-
query: z.string(),
|
|
48
|
-
}),
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe("nested objects", () => {
|
|
54
|
-
it("single level nesting", () => {
|
|
55
|
-
expectIdenticalOutput(
|
|
56
|
-
z.object({
|
|
57
|
-
user: z.object({ name: z.string(), email: z.string() }),
|
|
58
|
-
}),
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("deep nesting", () => {
|
|
63
|
-
expectIdenticalOutput(
|
|
64
|
-
z.object({
|
|
65
|
-
level1: z.object({
|
|
66
|
-
level2: z.object({
|
|
67
|
-
level3: z.object({
|
|
68
|
-
value: z.boolean(),
|
|
69
|
-
}),
|
|
70
|
-
}),
|
|
71
|
-
}),
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe("arrays", () => {
|
|
78
|
-
it("string array", () => {
|
|
79
|
-
expectIdenticalOutput(z.object({ tags: z.array(z.string()) }));
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("object array", () => {
|
|
83
|
-
expectIdenticalOutput(
|
|
84
|
-
z.object({
|
|
85
|
-
items: z.array(z.object({ id: z.number(), label: z.string() })),
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("nested arrays", () => {
|
|
91
|
-
expectIdenticalOutput(z.object({ matrix: z.array(z.array(z.number())) }));
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe("enums and literals", () => {
|
|
96
|
-
it("z.enum", () => {
|
|
97
|
-
expectIdenticalOutput(
|
|
98
|
-
z.object({ status: z.enum(["active", "inactive", "pending"]) }),
|
|
99
|
-
);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("z.literal string", () => {
|
|
103
|
-
expectIdenticalOutput(z.object({ type: z.literal("user") }));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("z.literal number", () => {
|
|
107
|
-
expectIdenticalOutput(z.object({ version: z.literal(2) }));
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("z.nativeEnum", () => {
|
|
111
|
-
enum Color {
|
|
112
|
-
Red = "red",
|
|
113
|
-
Green = "green",
|
|
114
|
-
Blue = "blue",
|
|
115
|
-
}
|
|
116
|
-
expectIdenticalOutput(z.object({ color: z.nativeEnum(Color) }));
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
describe("unions and discriminated unions", () => {
|
|
121
|
-
it("z.union of primitives", () => {
|
|
122
|
-
expectIdenticalOutput(
|
|
123
|
-
z.object({ value: z.union([z.string(), z.number()]) }),
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("z.union of objects", () => {
|
|
128
|
-
expectIdenticalOutput(
|
|
129
|
-
z.object({
|
|
130
|
-
result: z.union([
|
|
131
|
-
z.object({ ok: z.literal(true), data: z.string() }),
|
|
132
|
-
z.object({ ok: z.literal(false), error: z.string() }),
|
|
133
|
-
]),
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("z.discriminatedUnion", () => {
|
|
139
|
-
expectIdenticalOutput(
|
|
140
|
-
z.object({
|
|
141
|
-
event: z.discriminatedUnion("type", [
|
|
142
|
-
z.object({
|
|
143
|
-
type: z.literal("click"),
|
|
144
|
-
x: z.number(),
|
|
145
|
-
y: z.number(),
|
|
146
|
-
}),
|
|
147
|
-
z.object({ type: z.literal("keypress"), key: z.string() }),
|
|
148
|
-
]),
|
|
149
|
-
}),
|
|
150
|
-
);
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
describe("nullable and nullish", () => {
|
|
155
|
-
it("z.nullable", () => {
|
|
156
|
-
expectIdenticalOutput(z.object({ bio: z.string().nullable() }));
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("z.nullish (optional + nullable)", () => {
|
|
160
|
-
expectIdenticalOutput(z.object({ nickname: z.string().nullish() }));
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe("records and tuples", () => {
|
|
165
|
-
it("z.record", () => {
|
|
166
|
-
expectIdenticalOutput(
|
|
167
|
-
z.object({ metadata: z.record(z.string(), z.unknown()) }),
|
|
168
|
-
);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("z.tuple", () => {
|
|
172
|
-
expectIdenticalOutput(
|
|
173
|
-
z.object({ point: z.tuple([z.number(), z.number()]) }),
|
|
174
|
-
);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
describe("intersections", () => {
|
|
179
|
-
it("z.intersection", () => {
|
|
180
|
-
expectIdenticalOutput(
|
|
181
|
-
z.intersection(
|
|
182
|
-
z.object({ id: z.number() }),
|
|
183
|
-
z.object({ name: z.string() }),
|
|
184
|
-
),
|
|
185
|
-
);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
describe("string constraints", () => {
|
|
190
|
-
it("z.string with min/max", () => {
|
|
191
|
-
expectIdenticalOutput(z.object({ username: z.string().min(3).max(20) }));
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it("z.string with email", () => {
|
|
195
|
-
expectIdenticalOutput(z.object({ email: z.string().email() }));
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it("z.string with url", () => {
|
|
199
|
-
expectIdenticalOutput(z.object({ website: z.string().url() }));
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it("z.string with regex", () => {
|
|
203
|
-
expectIdenticalOutput(
|
|
204
|
-
z.object({ code: z.string().regex(/^[A-Z]{3}-\d{4}$/) }),
|
|
205
|
-
);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
describe("number constraints", () => {
|
|
210
|
-
it("z.number with min/max", () => {
|
|
211
|
-
expectIdenticalOutput(z.object({ score: z.number().min(0).max(100) }));
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it("z.number.int", () => {
|
|
215
|
-
expectIdenticalOutput(z.object({ count: z.number().int() }));
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it("z.number.positive", () => {
|
|
219
|
-
expectIdenticalOutput(z.object({ amount: z.number().positive() }));
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
describe("catchall and passthrough", () => {
|
|
224
|
-
it("z.object with catchall", () => {
|
|
225
|
-
expectIdenticalOutput(z.object({}).catchall(z.string()));
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it("z.object with passthrough", () => {
|
|
229
|
-
expectIdenticalOutput(z.object({ id: z.number() }).passthrough());
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
describe("z.any and z.unknown", () => {
|
|
234
|
-
it("z.any", () => {
|
|
235
|
-
expectIdenticalOutput(z.any());
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it("z.unknown", () => {
|
|
239
|
-
expectIdenticalOutput(z.unknown());
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it("object with z.any field", () => {
|
|
243
|
-
expectIdenticalOutput(z.object({ data: z.any() }));
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
describe("complex real-world schemas", () => {
|
|
248
|
-
it("tool-like schema with multiple field types", () => {
|
|
249
|
-
expectIdenticalOutput(
|
|
250
|
-
z.object({
|
|
251
|
-
query: z.string().describe("Search query"),
|
|
252
|
-
filters: z
|
|
253
|
-
.object({
|
|
254
|
-
category: z.enum(["books", "movies", "music"]).optional(),
|
|
255
|
-
minRating: z.number().min(0).max(5).optional(),
|
|
256
|
-
tags: z.array(z.string()).optional(),
|
|
257
|
-
})
|
|
258
|
-
.optional(),
|
|
259
|
-
pagination: z
|
|
260
|
-
.object({
|
|
261
|
-
page: z.number().int().positive().default(1),
|
|
262
|
-
perPage: z.number().int().positive().default(20),
|
|
263
|
-
})
|
|
264
|
-
.optional(),
|
|
265
|
-
sortBy: z.enum(["relevance", "date", "rating"]).default("relevance"),
|
|
266
|
-
}),
|
|
267
|
-
);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
it("CopilotKit-like weather tool schema", () => {
|
|
271
|
-
expectIdenticalOutput(
|
|
272
|
-
z.object({
|
|
273
|
-
city: z.string().describe("The city to get weather for"),
|
|
274
|
-
units: z
|
|
275
|
-
.enum(["celsius", "fahrenheit"])
|
|
276
|
-
.optional()
|
|
277
|
-
.describe("Temperature units"),
|
|
278
|
-
}),
|
|
279
|
-
);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
it("agent-like action schema with nested results", () => {
|
|
283
|
-
expectIdenticalOutput(
|
|
284
|
-
z.object({
|
|
285
|
-
action: z.discriminatedUnion("type", [
|
|
286
|
-
z.object({
|
|
287
|
-
type: z.literal("search"),
|
|
288
|
-
query: z.string(),
|
|
289
|
-
maxResults: z.number().int().optional(),
|
|
290
|
-
}),
|
|
291
|
-
z.object({
|
|
292
|
-
type: z.literal("navigate"),
|
|
293
|
-
url: z.string().url(),
|
|
294
|
-
}),
|
|
295
|
-
z.object({
|
|
296
|
-
type: z.literal("execute"),
|
|
297
|
-
code: z.string(),
|
|
298
|
-
language: z.enum(["javascript", "python", "shell"]),
|
|
299
|
-
}),
|
|
300
|
-
]),
|
|
301
|
-
context: z.record(z.string(), z.unknown()).optional(),
|
|
302
|
-
}),
|
|
303
|
-
);
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
describe("described schemas (common in tool definitions)", () => {
|
|
308
|
-
it("preserves .describe() metadata", () => {
|
|
309
|
-
expectIdenticalOutput(
|
|
310
|
-
z
|
|
311
|
-
.object({
|
|
312
|
-
city: z.string().describe("The city name"),
|
|
313
|
-
count: z.number().describe("Number of results"),
|
|
314
|
-
})
|
|
315
|
-
.describe("Weather tool parameters"),
|
|
316
|
-
);
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Server-only entry: A2UI depends on node:crypto. Do not re-export from the root.
|
|
2
|
-
export { A2UIMiddleware } from "@ag-ui/a2ui-middleware";
|
|
3
|
-
export type { A2UIMiddlewareConfig } from "@ag-ui/a2ui-middleware";
|
|
4
|
-
export * from "./open-generative-ui-middleware";
|
|
5
|
-
export * from "./recorded-events";
|