@copilotkit/shared 1.55.0-next.9 → 1.55.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/a2ui-prompts.cjs +106 -0
  3. package/dist/a2ui-prompts.cjs.map +1 -0
  4. package/dist/a2ui-prompts.d.cts +20 -0
  5. package/dist/a2ui-prompts.d.cts.map +1 -0
  6. package/dist/a2ui-prompts.d.mts +20 -0
  7. package/dist/a2ui-prompts.d.mts.map +1 -0
  8. package/dist/a2ui-prompts.mjs +104 -0
  9. package/dist/a2ui-prompts.mjs.map +1 -0
  10. package/dist/attachments/types.d.cts +54 -0
  11. package/dist/attachments/types.d.cts.map +1 -0
  12. package/dist/attachments/types.d.mts +54 -0
  13. package/dist/attachments/types.d.mts.map +1 -0
  14. package/dist/attachments/utils.cjs +134 -0
  15. package/dist/attachments/utils.cjs.map +1 -0
  16. package/dist/attachments/utils.d.cts +42 -0
  17. package/dist/attachments/utils.d.cts.map +1 -0
  18. package/dist/attachments/utils.d.mts +42 -0
  19. package/dist/attachments/utils.d.mts.map +1 -0
  20. package/dist/attachments/utils.mjs +126 -0
  21. package/dist/attachments/utils.mjs.map +1 -0
  22. package/dist/index.cjs +29 -8
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +20 -3
  25. package/dist/index.d.cts.map +1 -1
  26. package/dist/index.d.mts +20 -3
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.mjs +19 -3
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/index.umd.js +259 -9
  31. package/dist/index.umd.js.map +1 -1
  32. package/dist/package.cjs +1 -1
  33. package/dist/package.mjs +1 -1
  34. package/dist/types/message.d.cts +15 -4
  35. package/dist/types/message.d.cts.map +1 -1
  36. package/dist/types/message.d.mts +15 -4
  37. package/dist/types/message.d.mts.map +1 -1
  38. package/dist/utils/types.cjs.map +1 -1
  39. package/dist/utils/types.d.cts +1 -0
  40. package/dist/utils/types.d.cts.map +1 -1
  41. package/dist/utils/types.d.mts +1 -0
  42. package/dist/utils/types.d.mts.map +1 -1
  43. package/dist/utils/types.mjs.map +1 -1
  44. package/package.json +33 -34
  45. package/src/a2ui-prompts.ts +101 -0
  46. package/src/attachments/__tests__/utils.test.ts +198 -0
  47. package/src/attachments/index.ts +19 -0
  48. package/src/attachments/types.ts +67 -0
  49. package/src/attachments/utils.ts +164 -0
  50. package/src/index.ts +43 -1
  51. package/src/types/__tests__/message.test.ts +62 -0
  52. package/src/types/message.ts +27 -3
  53. package/src/utils/types.ts +1 -0
@@ -0,0 +1,42 @@
1
+ import { InputContentSource } from "../types/message.cjs";
2
+ import { AttachmentModality } from "./types.cjs";
3
+
4
+ //#region src/attachments/utils.d.ts
5
+ /**
6
+ * Derive the attachment modality from a MIME type string.
7
+ */
8
+ declare function getModalityFromMimeType(mimeType: string): AttachmentModality;
9
+ /**
10
+ * Format a byte count as a human-readable file size string.
11
+ */
12
+ declare function formatFileSize(bytes: number): string;
13
+ /**
14
+ * Check if a file exceeds the maximum allowed size.
15
+ */
16
+ declare function exceedsMaxSize(file: File, maxSize?: number): boolean;
17
+ /**
18
+ * Read a File as a base64 string (without the data URL prefix).
19
+ */
20
+ declare function readFileAsBase64(file: File): Promise<string>;
21
+ /**
22
+ * Generate a thumbnail data URL from a video file by capturing a frame near the start (at 0.1s).
23
+ * Returns undefined if thumbnail generation fails or if called outside a browser environment.
24
+ */
25
+ declare function generateVideoThumbnail(file: File): Promise<string | undefined>;
26
+ /**
27
+ * Check if a file's MIME type matches an accept filter string.
28
+ * Handles file extensions (e.g. ".pdf"), MIME wildcards ("image/*"), and comma-separated lists.
29
+ */
30
+ declare function matchesAcceptFilter(file: File, accept: string): boolean;
31
+ /**
32
+ * Convert an InputContentSource to a usable URL string.
33
+ * For data sources, returns a base64 data URL; for URL sources, returns the URL directly.
34
+ */
35
+ declare function getSourceUrl(source: InputContentSource): string;
36
+ /**
37
+ * Return a short human-readable label for a document MIME type (e.g. "PDF", "DOC").
38
+ */
39
+ declare function getDocumentIcon(mimeType: string): string;
40
+ //#endregion
41
+ export { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 };
42
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../../src/attachments/utils.ts"],"mappings":";;;;;;AAQA;iBAAgB,uBAAA,CAAwB,QAAA,WAAmB,kBAAA;;;;iBAU3C,cAAA,CAAe,KAAA;;;;iBASf,cAAA,CACd,IAAA,EAAM,IAAA,EACN,OAAA;AAFF;;;AAAA,iBAUgB,gBAAA,CAAiB,IAAA,EAAM,IAAA,GAAO,OAAA;;;;;iBAqB9B,sBAAA,CACd,IAAA,EAAM,IAAA,GACL,OAAA;AAvBH;;;;AAAA,iBAwFgB,mBAAA,CAAoB,IAAA,EAAM,IAAA,EAAM,MAAA;;;;;iBAoBhC,YAAA,CAAa,MAAA,EAAQ,kBAAA;;;;iBAUrB,eAAA,CAAgB,QAAA"}
@@ -0,0 +1,42 @@
1
+ import { InputContentSource } from "../types/message.mjs";
2
+ import { AttachmentModality } from "./types.mjs";
3
+
4
+ //#region src/attachments/utils.d.ts
5
+ /**
6
+ * Derive the attachment modality from a MIME type string.
7
+ */
8
+ declare function getModalityFromMimeType(mimeType: string): AttachmentModality;
9
+ /**
10
+ * Format a byte count as a human-readable file size string.
11
+ */
12
+ declare function formatFileSize(bytes: number): string;
13
+ /**
14
+ * Check if a file exceeds the maximum allowed size.
15
+ */
16
+ declare function exceedsMaxSize(file: File, maxSize?: number): boolean;
17
+ /**
18
+ * Read a File as a base64 string (without the data URL prefix).
19
+ */
20
+ declare function readFileAsBase64(file: File): Promise<string>;
21
+ /**
22
+ * Generate a thumbnail data URL from a video file by capturing a frame near the start (at 0.1s).
23
+ * Returns undefined if thumbnail generation fails or if called outside a browser environment.
24
+ */
25
+ declare function generateVideoThumbnail(file: File): Promise<string | undefined>;
26
+ /**
27
+ * Check if a file's MIME type matches an accept filter string.
28
+ * Handles file extensions (e.g. ".pdf"), MIME wildcards ("image/*"), and comma-separated lists.
29
+ */
30
+ declare function matchesAcceptFilter(file: File, accept: string): boolean;
31
+ /**
32
+ * Convert an InputContentSource to a usable URL string.
33
+ * For data sources, returns a base64 data URL; for URL sources, returns the URL directly.
34
+ */
35
+ declare function getSourceUrl(source: InputContentSource): string;
36
+ /**
37
+ * Return a short human-readable label for a document MIME type (e.g. "PDF", "DOC").
38
+ */
39
+ declare function getDocumentIcon(mimeType: string): string;
40
+ //#endregion
41
+ export { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 };
42
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/attachments/utils.ts"],"mappings":";;;;;;AAQA;iBAAgB,uBAAA,CAAwB,QAAA,WAAmB,kBAAA;;;;iBAU3C,cAAA,CAAe,KAAA;;;;iBASf,cAAA,CACd,IAAA,EAAM,IAAA,EACN,OAAA;AAFF;;;AAAA,iBAUgB,gBAAA,CAAiB,IAAA,EAAM,IAAA,GAAO,OAAA;;;;;iBAqB9B,sBAAA,CACd,IAAA,EAAM,IAAA,GACL,OAAA;AAvBH;;;;AAAA,iBAwFgB,mBAAA,CAAoB,IAAA,EAAM,IAAA,EAAM,MAAA;;;;;iBAoBhC,YAAA,CAAa,MAAA,EAAQ,kBAAA;;;;iBAUrB,eAAA,CAAgB,QAAA"}
@@ -0,0 +1,126 @@
1
+ //#region src/attachments/utils.ts
2
+ const DEFAULT_MAX_SIZE = 20 * 1024 * 1024;
3
+ /**
4
+ * Derive the attachment modality from a MIME type string.
5
+ */
6
+ function getModalityFromMimeType(mimeType) {
7
+ if (mimeType.startsWith("image/")) return "image";
8
+ if (mimeType.startsWith("audio/")) return "audio";
9
+ if (mimeType.startsWith("video/")) return "video";
10
+ return "document";
11
+ }
12
+ /**
13
+ * Format a byte count as a human-readable file size string.
14
+ */
15
+ function formatFileSize(bytes) {
16
+ if (bytes < 1024) return `${bytes} B`;
17
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
18
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
19
+ }
20
+ /**
21
+ * Check if a file exceeds the maximum allowed size.
22
+ */
23
+ function exceedsMaxSize(file, maxSize = DEFAULT_MAX_SIZE) {
24
+ return file.size > maxSize;
25
+ }
26
+ /**
27
+ * Read a File as a base64 string (without the data URL prefix).
28
+ */
29
+ function readFileAsBase64(file) {
30
+ return new Promise((resolve, reject) => {
31
+ const reader = new FileReader();
32
+ reader.onload = (e) => {
33
+ const base64 = (e.target?.result)?.split(",")[1];
34
+ if (base64) resolve(base64);
35
+ else reject(/* @__PURE__ */ new Error("Failed to read file as base64"));
36
+ };
37
+ reader.onerror = reject;
38
+ reader.readAsDataURL(file);
39
+ });
40
+ }
41
+ /**
42
+ * Generate a thumbnail data URL from a video file by capturing a frame near the start (at 0.1s).
43
+ * Returns undefined if thumbnail generation fails or if called outside a browser environment.
44
+ */
45
+ function generateVideoThumbnail(file) {
46
+ if (typeof document === "undefined") return Promise.resolve(void 0);
47
+ return new Promise((resolve) => {
48
+ let resolved = false;
49
+ const video = document.createElement("video");
50
+ const canvas = document.createElement("canvas");
51
+ const url = URL.createObjectURL(file);
52
+ const cleanup = (result) => {
53
+ if (resolved) return;
54
+ resolved = true;
55
+ URL.revokeObjectURL(url);
56
+ resolve(result);
57
+ };
58
+ const timeout = setTimeout(() => {
59
+ console.warn(`[CopilotKit] generateVideoThumbnail: timed out for file "${file.name}"`);
60
+ cleanup(void 0);
61
+ }, 1e4);
62
+ video.preload = "metadata";
63
+ video.muted = true;
64
+ video.playsInline = true;
65
+ video.onloadeddata = () => {
66
+ video.currentTime = .1;
67
+ };
68
+ video.onseeked = () => {
69
+ clearTimeout(timeout);
70
+ canvas.width = video.videoWidth;
71
+ canvas.height = video.videoHeight;
72
+ const ctx = canvas.getContext("2d");
73
+ if (ctx) {
74
+ ctx.drawImage(video, 0, 0);
75
+ cleanup(canvas.toDataURL("image/jpeg", .7));
76
+ } else {
77
+ console.warn("[CopilotKit] generateVideoThumbnail: could not get 2d canvas context");
78
+ cleanup(void 0);
79
+ }
80
+ };
81
+ video.onerror = () => {
82
+ clearTimeout(timeout);
83
+ console.warn(`[CopilotKit] generateVideoThumbnail: video element error for file "${file.name}"`);
84
+ cleanup(void 0);
85
+ };
86
+ video.src = url;
87
+ });
88
+ }
89
+ /**
90
+ * Check if a file's MIME type matches an accept filter string.
91
+ * Handles file extensions (e.g. ".pdf"), MIME wildcards ("image/*"), and comma-separated lists.
92
+ */
93
+ function matchesAcceptFilter(file, accept) {
94
+ if (!accept || accept === "*/*") return true;
95
+ return accept.split(",").map((f) => f.trim()).some((filter) => {
96
+ if (filter.startsWith(".")) return (file.name ?? "").toLowerCase().endsWith(filter.toLowerCase());
97
+ if (filter.endsWith("/*")) {
98
+ const prefix = filter.slice(0, -2);
99
+ return file.type.startsWith(prefix + "/");
100
+ }
101
+ return file.type === filter;
102
+ });
103
+ }
104
+ /**
105
+ * Convert an InputContentSource to a usable URL string.
106
+ * For data sources, returns a base64 data URL; for URL sources, returns the URL directly.
107
+ */
108
+ function getSourceUrl(source) {
109
+ if (source.type === "url") return source.value;
110
+ return `data:${source.mimeType};base64,${source.value}`;
111
+ }
112
+ /**
113
+ * Return a short human-readable label for a document MIME type (e.g. "PDF", "DOC").
114
+ */
115
+ function getDocumentIcon(mimeType) {
116
+ if (mimeType.includes("pdf")) return "PDF";
117
+ if (mimeType.includes("sheet") || mimeType.includes("excel")) return "XLS";
118
+ if (mimeType.includes("presentation") || mimeType.includes("powerpoint")) return "PPT";
119
+ if (mimeType.includes("word") || mimeType.includes("document")) return "DOC";
120
+ if (mimeType.includes("text/")) return "TXT";
121
+ return "FILE";
122
+ }
123
+
124
+ //#endregion
125
+ export { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 };
126
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/attachments/utils.ts"],"sourcesContent":["import type { AttachmentModality } from \"./types\";\nimport type { InputContentSource } from \"../types/message\";\n\nconst DEFAULT_MAX_SIZE = 20 * 1024 * 1024; // 20MB\n\n/**\n * Derive the attachment modality from a MIME type string.\n */\nexport function getModalityFromMimeType(mimeType: string): AttachmentModality {\n if (mimeType.startsWith(\"image/\")) return \"image\";\n if (mimeType.startsWith(\"audio/\")) return \"audio\";\n if (mimeType.startsWith(\"video/\")) return \"video\";\n return \"document\";\n}\n\n/**\n * Format a byte count as a human-readable file size string.\n */\nexport function formatFileSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Check if a file exceeds the maximum allowed size.\n */\nexport function exceedsMaxSize(\n file: File,\n maxSize: number = DEFAULT_MAX_SIZE,\n): boolean {\n return file.size > maxSize;\n}\n\n/**\n * Read a File as a base64 string (without the data URL prefix).\n */\nexport function readFileAsBase64(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (e) => {\n const result = e.target?.result as string;\n const base64 = result?.split(\",\")[1];\n if (base64) {\n resolve(base64);\n } else {\n reject(new Error(\"Failed to read file as base64\"));\n }\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n}\n\n/**\n * Generate a thumbnail data URL from a video file by capturing a frame near the start (at 0.1s).\n * Returns undefined if thumbnail generation fails or if called outside a browser environment.\n */\nexport function generateVideoThumbnail(\n file: File,\n): Promise<string | undefined> {\n if (typeof document === \"undefined\") {\n return Promise.resolve(undefined);\n }\n return new Promise((resolve) => {\n let resolved = false;\n const video = document.createElement(\"video\");\n const canvas = document.createElement(\"canvas\");\n const url = URL.createObjectURL(file);\n\n const cleanup = (result: string | undefined) => {\n if (resolved) return;\n resolved = true;\n URL.revokeObjectURL(url);\n resolve(result);\n };\n\n const timeout = setTimeout(() => {\n console.warn(\n `[CopilotKit] generateVideoThumbnail: timed out for file \"${file.name}\"`,\n );\n cleanup(undefined);\n }, 10000);\n\n video.preload = \"metadata\";\n video.muted = true;\n video.playsInline = true;\n\n video.onloadeddata = () => {\n video.currentTime = 0.1;\n };\n\n video.onseeked = () => {\n clearTimeout(timeout);\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(video, 0, 0);\n const thumbnail = canvas.toDataURL(\"image/jpeg\", 0.7);\n cleanup(thumbnail);\n } else {\n console.warn(\n \"[CopilotKit] generateVideoThumbnail: could not get 2d canvas context\",\n );\n cleanup(undefined);\n }\n };\n\n video.onerror = () => {\n clearTimeout(timeout);\n console.warn(\n `[CopilotKit] generateVideoThumbnail: video element error for file \"${file.name}\"`,\n );\n cleanup(undefined);\n };\n\n video.src = url;\n });\n}\n\n/**\n * Check if a file's MIME type matches an accept filter string.\n * Handles file extensions (e.g. \".pdf\"), MIME wildcards (\"image/*\"), and comma-separated lists.\n */\nexport function matchesAcceptFilter(file: File, accept: string): boolean {\n if (!accept || accept === \"*/*\") return true;\n\n const filters = accept.split(\",\").map((f) => f.trim());\n return filters.some((filter) => {\n if (filter.startsWith(\".\")) {\n return (file.name ?? \"\").toLowerCase().endsWith(filter.toLowerCase());\n }\n if (filter.endsWith(\"/*\")) {\n const prefix = filter.slice(0, -2);\n return file.type.startsWith(prefix + \"/\");\n }\n return file.type === filter;\n });\n}\n\n/**\n * Convert an InputContentSource to a usable URL string.\n * For data sources, returns a base64 data URL; for URL sources, returns the URL directly.\n */\nexport function getSourceUrl(source: InputContentSource): string {\n if (source.type === \"url\") {\n return source.value;\n }\n return `data:${source.mimeType};base64,${source.value}`;\n}\n\n/**\n * Return a short human-readable label for a document MIME type (e.g. \"PDF\", \"DOC\").\n */\nexport function getDocumentIcon(mimeType: string): string {\n if (mimeType.includes(\"pdf\")) return \"PDF\";\n if (mimeType.includes(\"sheet\") || mimeType.includes(\"excel\")) return \"XLS\";\n if (mimeType.includes(\"presentation\") || mimeType.includes(\"powerpoint\"))\n return \"PPT\";\n if (mimeType.includes(\"word\") || mimeType.includes(\"document\")) return \"DOC\";\n if (mimeType.includes(\"text/\")) return \"TXT\";\n return \"FILE\";\n}\n"],"mappings":"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"}
package/dist/index.cjs CHANGED
@@ -11,14 +11,34 @@ const require_index$1 = require('./constants/index.cjs');
11
11
  const require_package = require('./package.cjs');
12
12
  const require_telemetry_client = require('./telemetry/telemetry-client.cjs');
13
13
  const require_standard_schema = require('./standard-schema.cjs');
14
+ const require_utils = require('./attachments/utils.cjs');
14
15
  const require_logger = require('./logger.cjs');
15
16
  const require_finalize_events = require('./finalize-events.cjs');
16
17
  const require_transcription_errors = require('./transcription-errors.cjs');
18
+ const require_a2ui_prompts = require('./a2ui-prompts.cjs');
17
19
 
18
20
  //#region src/index.ts
19
21
  const COPILOTKIT_VERSION = require_package.version;
22
+ /**
23
+ * Client-safe license context factory.
24
+ *
25
+ * When status is null (no token provided), all features return true
26
+ * (unlicensed = unrestricted, with branding). This is inlined here to
27
+ * avoid importing the full license-verifier bundle (which depends on
28
+ * Node's `crypto`) into browser bundles.
29
+ */
30
+ function createLicenseContextValue(status) {
31
+ return {
32
+ status: null,
33
+ license: null,
34
+ checkFeature: () => true,
35
+ getLimit: () => null
36
+ };
37
+ }
20
38
 
21
39
  //#endregion
40
+ exports.A2UI_DEFAULT_DESIGN_GUIDELINES = require_a2ui_prompts.A2UI_DEFAULT_DESIGN_GUIDELINES;
41
+ exports.A2UI_DEFAULT_GENERATION_GUIDELINES = require_a2ui_prompts.A2UI_DEFAULT_GENERATION_GUIDELINES;
22
42
  exports.AG_UI_CHANNEL_EVENT = require_index$1.AG_UI_CHANNEL_EVENT;
23
43
  exports.BANNER_ERROR_NAMES = require_errors.BANNER_ERROR_NAMES;
24
44
  exports.COPILOTKIT_VERSION = COPILOTKIT_VERSION;
@@ -53,11 +73,18 @@ exports.TranscriptionErrors = require_transcription_errors.TranscriptionErrors;
53
73
  exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
54
74
  exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
55
75
  exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
76
+ exports.createLicenseContextValue = createLicenseContextValue;
56
77
  exports.dataToUUID = require_random_id.dataToUUID;
57
78
  exports.ensureStructuredError = require_errors.ensureStructuredError;
79
+ exports.exceedsMaxSize = require_utils.exceedsMaxSize;
58
80
  exports.executeConditions = require_conditions.executeConditions;
59
81
  exports.finalizeRunEvents = require_finalize_events.finalizeRunEvents;
82
+ exports.formatFileSize = require_utils.formatFileSize;
83
+ exports.generateVideoThumbnail = require_utils.generateVideoThumbnail;
84
+ exports.getDocumentIcon = require_utils.getDocumentIcon;
85
+ exports.getModalityFromMimeType = require_utils.getModalityFromMimeType;
60
86
  exports.getPossibleVersionMismatch = require_errors.getPossibleVersionMismatch;
87
+ exports.getSourceUrl = require_utils.getSourceUrl;
61
88
  exports.getZodParameters = require_json_schema.getZodParameters;
62
89
  exports.isMacOS = require_index.isMacOS;
63
90
  exports.isStructuredCopilotKitError = require_errors.isStructuredCopilotKitError;
@@ -67,6 +94,7 @@ exports.jsonSchemaToActionParameters = require_json_schema.jsonSchemaToActionPar
67
94
  exports.logCopilotKitPlatformMessage = require_console_styling.logCopilotKitPlatformMessage;
68
95
  exports.logStyled = require_console_styling.logStyled;
69
96
  exports.logger = require_logger.logger;
97
+ exports.matchesAcceptFilter = require_utils.matchesAcceptFilter;
70
98
  exports.parseJson = require_index.parseJson;
71
99
  exports.partialJSONParse = require_index.partialJSONParse;
72
100
  exports.phoenixExponentialBackoff = require_index.phoenixExponentialBackoff;
@@ -74,16 +102,9 @@ exports.publicApiKeyRequired = require_console_styling.publicApiKeyRequired;
74
102
  exports.randomId = require_random_id.randomId;
75
103
  exports.randomUUID = require_random_id.randomUUID;
76
104
  exports.readBody = require_requests.readBody;
105
+ exports.readFileAsBase64 = require_utils.readFileAsBase64;
77
106
  exports.safeParseToolArgs = require_index.safeParseToolArgs;
78
107
  exports.schemaToJsonSchema = require_standard_schema.schemaToJsonSchema;
79
108
  exports.styledConsole = require_console_styling.styledConsole;
80
109
  exports.tryMap = require_index.tryMap;
81
- var _copilotkit_license_verifier = require("@copilotkit/license-verifier");
82
- Object.keys(_copilotkit_license_verifier).forEach(function (k) {
83
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
84
- enumerable: true,
85
- get: function () { return _copilotkit_license_verifier[k]; }
86
- });
87
- });
88
-
89
110
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\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\nexport * from \"@copilotkit/license-verifier\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\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 LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\n\n/**\n * Client-safe license context factory.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,MAAa;;;;;;;;;AA0Bb,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import { Action, MappedParameterTypes, Parameter } from "./types/action.cjs";
3
3
  import { CopilotCloudConfig } from "./types/copilot-cloud-config.cjs";
4
4
  import { PartialBy, RequiredBy } from "./types/utility.cjs";
5
5
  import { CopilotErrorEvent, CopilotErrorHandler, CopilotRequestContext } from "./types/error.cjs";
6
- import { AIMessage, ActivityMessage, DeveloperMessage, ImageData, Message, ReasoningMessage, Role, SystemMessage, ToolCall, ToolResult, UserMessage } from "./types/message.cjs";
6
+ import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageData, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.cjs";
7
7
  import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.cjs";
8
8
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.cjs";
9
9
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.cjs";
@@ -15,13 +15,30 @@ import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safePa
15
15
  import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.cjs";
16
16
  import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.cjs";
17
17
  import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.cjs";
18
+ import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.cjs";
19
+ import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.cjs";
18
20
  import { logger } from "./logger.cjs";
19
21
  import { finalizeRunEvents } from "./finalize-events.cjs";
20
22
  import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.cjs";
21
- export * from "@copilotkit/license-verifier";
23
+ import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES } from "./a2ui-prompts.cjs";
24
+ import { LicenseChecker, LicenseContextValue, LicenseFeatures, LicenseMode, LicenseOwner, LicensePayload, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier";
22
25
 
23
26
  //#region src/index.d.ts
24
27
  declare const COPILOTKIT_VERSION: string;
28
+ /**
29
+ * Client-safe license context factory.
30
+ *
31
+ * When status is null (no token provided), all features return true
32
+ * (unlicensed = unrestricted, with branding). This is inlined here to
33
+ * avoid importing the full license-verifier bundle (which depends on
34
+ * Node's `crypto`) into browser bundles.
35
+ */
36
+ declare function createLicenseContextValue(status: null): {
37
+ status: null;
38
+ license: null;
39
+ checkFeature: (feature: string) => boolean;
40
+ getLimit: (feature: string) => number | null;
41
+ };
25
42
  //#endregion
26
- export { AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, InferSchemaOutput, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, finalizeRunEvents, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
43
+ export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
27
44
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cAgBa,kBAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cAiBa,kBAAA;;;;;;;;;iBA0BG,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import { Action, MappedParameterTypes, Parameter } from "./types/action.mjs";
3
3
  import { CopilotCloudConfig } from "./types/copilot-cloud-config.mjs";
4
4
  import { PartialBy, RequiredBy } from "./types/utility.mjs";
5
5
  import { CopilotErrorEvent, CopilotErrorHandler, CopilotRequestContext } from "./types/error.mjs";
6
- import { AIMessage, ActivityMessage, DeveloperMessage, ImageData, Message, ReasoningMessage, Role, SystemMessage, ToolCall, ToolResult, UserMessage } from "./types/message.mjs";
6
+ import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageData, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.mjs";
7
7
  import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.mjs";
8
8
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
9
9
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.mjs";
@@ -16,13 +16,30 @@ import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COP
16
16
  import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
17
17
  import "./telemetry/index.mjs";
18
18
  import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.mjs";
19
+ import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.mjs";
20
+ import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
19
21
  import { logger } from "./logger.mjs";
20
22
  import { finalizeRunEvents } from "./finalize-events.mjs";
21
23
  import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.mjs";
22
- export * from "@copilotkit/license-verifier";
24
+ import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES } from "./a2ui-prompts.mjs";
25
+ import { LicenseChecker, LicenseContextValue, LicenseFeatures, LicenseMode, LicenseOwner, LicensePayload, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier";
23
26
 
24
27
  //#region src/index.d.ts
25
28
  declare const COPILOTKIT_VERSION: string;
29
+ /**
30
+ * Client-safe license context factory.
31
+ *
32
+ * When status is null (no token provided), all features return true
33
+ * (unlicensed = unrestricted, with branding). This is inlined here to
34
+ * avoid importing the full license-verifier bundle (which depends on
35
+ * Node's `crypto`) into browser bundles.
36
+ */
37
+ declare function createLicenseContextValue(status: null): {
38
+ status: null;
39
+ license: null;
40
+ checkFeature: (feature: string) => boolean;
41
+ getLimit: (feature: string) => number | null;
42
+ };
26
43
  //#endregion
27
- export { AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, InferSchemaOutput, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, finalizeRunEvents, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
44
+ export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
28
45
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;cAgBa,kBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;cAiBa,kBAAA;;;;;;;;;iBA0BG,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -10,15 +10,31 @@ import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COP
10
10
  import { version } from "./package.mjs";
11
11
  import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
12
12
  import { schemaToJsonSchema } from "./standard-schema.mjs";
13
+ import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
13
14
  import { logger } from "./logger.mjs";
14
15
  import { finalizeRunEvents } from "./finalize-events.mjs";
15
16
  import { TranscriptionErrorCode, TranscriptionErrors } from "./transcription-errors.mjs";
16
-
17
- export * from "@copilotkit/license-verifier"
17
+ import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES } from "./a2ui-prompts.mjs";
18
18
 
19
19
  //#region src/index.ts
20
20
  const COPILOTKIT_VERSION = version;
21
+ /**
22
+ * Client-safe license context factory.
23
+ *
24
+ * When status is null (no token provided), all features return true
25
+ * (unlicensed = unrestricted, with branding). This is inlined here to
26
+ * avoid importing the full license-verifier bundle (which depends on
27
+ * Node's `crypto`) into browser bundles.
28
+ */
29
+ function createLicenseContextValue(status) {
30
+ return {
31
+ status: null,
32
+ license: null,
33
+ checkFeature: () => true,
34
+ getLimit: () => null
35
+ };
36
+ }
21
37
 
22
38
  //#endregion
23
- export { AG_UI_CHANNEL_EVENT, BANNER_ERROR_NAMES, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, DEFAULT_AGENT_ID, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ResolvedCopilotKitError, Severity, TelemetryClient, TranscriptionErrorCode, TranscriptionErrors, UpgradeRequiredError, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, dataToUUID, ensureStructuredError, executeConditions, finalizeRunEvents, getPossibleVersionMismatch, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
39
+ export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, BANNER_ERROR_NAMES, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, DEFAULT_AGENT_ID, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ResolvedCopilotKitError, Severity, TelemetryClient, TranscriptionErrorCode, TranscriptionErrors, UpgradeRequiredError, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
24
40
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\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\nexport * from \"@copilotkit/license-verifier\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAa,qBAAqBA"}
1
+ {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\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 LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\n\n/**\n * Client-safe license context factory.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,qBAAqBA;;;;;;;;;AA0BlC,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}