@copilotkit/shared 1.55.2 → 1.55.3-canary.1776243725

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 (49) hide show
  1. package/dist/index.cjs +2 -0
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +2 -1
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.mts +2 -1
  6. package/dist/index.d.mts.map +1 -1
  7. package/dist/index.mjs +2 -1
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.umd.js +65 -6
  10. package/dist/index.umd.js.map +1 -1
  11. package/dist/package.cjs +1 -1
  12. package/dist/package.mjs +1 -1
  13. package/dist/utils/clipboard.cjs +28 -0
  14. package/dist/utils/clipboard.cjs.map +1 -0
  15. package/dist/utils/clipboard.d.cts +14 -0
  16. package/dist/utils/clipboard.d.cts.map +1 -0
  17. package/dist/utils/clipboard.d.mts +14 -0
  18. package/dist/utils/clipboard.d.mts.map +1 -0
  19. package/dist/utils/clipboard.mjs +27 -0
  20. package/dist/utils/clipboard.mjs.map +1 -0
  21. package/dist/utils/index.cjs +1 -0
  22. package/dist/utils/index.cjs.map +1 -1
  23. package/dist/utils/index.d.cts +1 -0
  24. package/dist/utils/index.d.cts.map +1 -1
  25. package/dist/utils/index.d.mts +1 -0
  26. package/dist/utils/index.d.mts.map +1 -1
  27. package/dist/utils/index.mjs +1 -0
  28. package/dist/utils/index.mjs.map +1 -1
  29. package/dist/utils/json-schema.cjs +36 -5
  30. package/dist/utils/json-schema.cjs.map +1 -1
  31. package/dist/utils/json-schema.d.cts +1 -1
  32. package/dist/utils/json-schema.d.cts.map +1 -1
  33. package/dist/utils/json-schema.d.mts +1 -1
  34. package/dist/utils/json-schema.d.mts.map +1 -1
  35. package/dist/utils/json-schema.mjs +36 -5
  36. package/dist/utils/json-schema.mjs.map +1 -1
  37. package/dist/utils/types.cjs.map +1 -1
  38. package/dist/utils/types.d.cts +3 -0
  39. package/dist/utils/types.d.cts.map +1 -1
  40. package/dist/utils/types.d.mts +3 -0
  41. package/dist/utils/types.d.mts.map +1 -1
  42. package/dist/utils/types.mjs.map +1 -1
  43. package/package.json +1 -1
  44. package/src/utils/__tests__/clipboard.test.ts +87 -0
  45. package/src/utils/__tests__/json-schema.test.ts +250 -1
  46. package/src/utils/clipboard.ts +23 -0
  47. package/src/utils/index.ts +1 -0
  48. package/src/utils/json-schema.ts +84 -3
  49. package/src/utils/types.ts +3 -0
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_clipboard = require('./utils/clipboard.cjs');
2
3
  const require_conditions = require('./utils/conditions.cjs');
3
4
  const require_console_styling = require('./utils/console-styling.cjs');
4
5
  const require_errors = require('./utils/errors.cjs');
@@ -73,6 +74,7 @@ exports.TranscriptionErrors = require_transcription_errors.TranscriptionErrors;
73
74
  exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
74
75
  exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
75
76
  exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
77
+ exports.copyToClipboard = require_clipboard.copyToClipboard;
76
78
  exports.createLicenseContextValue = createLicenseContextValue;
77
79
  exports.dataToUUID = require_random_id.dataToUUID;
78
80
  exports.ensureStructuredError = require_errors.ensureStructuredError;
@@ -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\";\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"}
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
@@ -4,6 +4,7 @@ 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
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
+ import { copyToClipboard } from "./utils/clipboard.cjs";
7
8
  import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.cjs";
8
9
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.cjs";
9
10
  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";
@@ -40,5 +41,5 @@ declare function createLicenseContextValue(status: null): {
40
41
  getLimit: (feature: string) => number | null;
41
42
  };
42
43
  //#endregion
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 };
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, copyToClipboard, 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 };
44
45
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
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"}
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
@@ -4,6 +4,7 @@ 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
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
+ import { copyToClipboard } from "./utils/clipboard.mjs";
7
8
  import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.mjs";
8
9
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
9
10
  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";
@@ -41,5 +42,5 @@ declare function createLicenseContextValue(status: null): {
41
42
  getLimit: (feature: string) => number | null;
42
43
  };
43
44
  //#endregion
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 };
45
+ 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, copyToClipboard, 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 };
45
46
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
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"}
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
@@ -1,3 +1,4 @@
1
+ import { copyToClipboard } from "./utils/clipboard.mjs";
1
2
  import { executeConditions } from "./utils/conditions.mjs";
2
3
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
3
4
  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";
@@ -36,5 +37,5 @@ function createLicenseContextValue(status) {
36
37
  }
37
38
 
38
39
  //#endregion
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 };
40
+ 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, copyToClipboard, 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 };
40
41
  //# 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\";\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"}
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"}
package/dist/index.umd.js CHANGED
@@ -33,6 +33,32 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
33
33
  //#endregion
34
34
  partial_json = __toESM(partial_json);
35
35
 
36
+ //#region src/utils/clipboard.ts
37
+ /**
38
+ * Safely copies text to the clipboard.
39
+ *
40
+ * Checks that the Clipboard API is available before attempting the write,
41
+ * and catches any errors (e.g. permission denied, insecure context).
42
+ *
43
+ * @param text - The text to copy to the clipboard.
44
+ * @returns `true` if the text was successfully copied, `false` otherwise.
45
+ */
46
+ async function copyToClipboard(text) {
47
+ var _navigator$clipboard;
48
+ if (!((_navigator$clipboard = navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText)) {
49
+ console.error("Clipboard API is not available");
50
+ return false;
51
+ }
52
+ try {
53
+ await navigator.clipboard.writeText(text);
54
+ return true;
55
+ } catch (err) {
56
+ console.error("Failed to copy to clipboard:", err);
57
+ return false;
58
+ }
59
+ }
60
+
61
+ //#endregion
36
62
  //#region src/utils/conditions.ts
37
63
  function executeConditions({ conditions, value }) {
38
64
  if (!(conditions === null || conditions === void 0 ? void 0 : conditions.length)) return true;
@@ -684,11 +710,37 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
684
710
  };
685
711
  }
686
712
  }
687
- function convertJsonSchemaToZodSchema(jsonSchema, required) {
713
+ function convertJsonSchemaToZodSchema(jsonSchema, required, definitions, visitedRefs) {
714
+ var _ref, _jsonSchema$anyOf, _jsonSchema$type;
715
+ if (jsonSchema.$ref && definitions) {
716
+ const refPath = jsonSchema.$ref.replace(/^#\/\$defs\/|^#\/definitions\//, "");
717
+ const refs = visitedRefs !== null && visitedRefs !== void 0 ? visitedRefs : /* @__PURE__ */ new Set();
718
+ if (refs.has(refPath)) {
719
+ console.warn(`[CopilotKit] Circular $ref detected for "${refPath}" — falling back to z.any()`);
720
+ let schema = zod.z.any();
721
+ if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
722
+ return required ? schema : schema.optional();
723
+ }
724
+ const resolved = definitions[refPath];
725
+ if (resolved) {
726
+ const nextRefs = new Set(refs);
727
+ nextRefs.add(refPath);
728
+ return convertJsonSchemaToZodSchema(resolved, required, definitions, nextRefs);
729
+ }
730
+ }
731
+ const defs = (_ref = definitions !== null && definitions !== void 0 ? definitions : jsonSchema.$defs) !== null && _ref !== void 0 ? _ref : jsonSchema.definitions;
732
+ const unionVariants = (_jsonSchema$anyOf = jsonSchema.anyOf) !== null && _jsonSchema$anyOf !== void 0 ? _jsonSchema$anyOf : jsonSchema.oneOf;
733
+ if (Array.isArray(unionVariants) && unionVariants.length > 0) {
734
+ if (unionVariants.length === 1) return convertJsonSchemaToZodSchema(unionVariants[0], required, defs, visitedRefs);
735
+ const schemas = unionVariants.map((v) => convertJsonSchemaToZodSchema(v, true, defs, visitedRefs));
736
+ let schema = zod.z.union(schemas);
737
+ if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
738
+ return required ? schema : schema.optional();
739
+ }
688
740
  if (jsonSchema.type === "object") {
689
741
  const spec = {};
690
742
  if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) return !required ? zod.z.object(spec).optional() : zod.z.object(spec);
691
- for (const [key, value] of Object.entries(jsonSchema.properties)) spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false);
743
+ for (const [key, value] of Object.entries(jsonSchema.properties)) spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false, defs, visitedRefs);
692
744
  let schema = zod.z.object(spec).describe(jsonSchema.description);
693
745
  return required ? schema : schema.optional();
694
746
  } else if (jsonSchema.type === "string") {
@@ -698,18 +750,24 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
698
750
  }
699
751
  let schema = zod.z.string().describe(jsonSchema.description);
700
752
  return required ? schema : schema.optional();
701
- } else if (jsonSchema.type === "number") {
753
+ } else if (jsonSchema.type === "number" || jsonSchema.type === "integer") {
702
754
  let schema = zod.z.number().describe(jsonSchema.description);
703
755
  return required ? schema : schema.optional();
704
756
  } else if (jsonSchema.type === "boolean") {
705
757
  let schema = zod.z.boolean().describe(jsonSchema.description);
706
758
  return required ? schema : schema.optional();
707
759
  } else if (jsonSchema.type === "array") {
708
- let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
760
+ let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true, defs, visitedRefs);
709
761
  let schema = zod.z.array(itemSchema).describe(jsonSchema.description);
710
762
  return required ? schema : schema.optional();
763
+ } else if (jsonSchema.type === "null") {
764
+ let schema = zod.z.null().describe(jsonSchema.description);
765
+ return required ? schema : schema.optional();
711
766
  }
712
- throw new Error("Invalid JSON schema");
767
+ console.warn(`[CopilotKit] Unsupported JSON schema type "${(_jsonSchema$type = jsonSchema.type) !== null && _jsonSchema$type !== void 0 ? _jsonSchema$type : "unknown"}" — falling back to z.any()`);
768
+ let schema = zod.z.any();
769
+ if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
770
+ return required ? schema : schema.optional();
713
771
  }
714
772
  function getZodParameters(parameters) {
715
773
  if (!parameters) return zod.z.object({});
@@ -911,7 +969,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
911
969
 
912
970
  //#endregion
913
971
  //#region package.json
914
- var version = "1.55.2";
972
+ var version = "1.55.3-canary.1776243725";
915
973
 
916
974
  //#endregion
917
975
  //#region src/telemetry/scarf-client.ts
@@ -1514,6 +1572,7 @@ exports.TranscriptionErrors = TranscriptionErrors;
1514
1572
  exports.UpgradeRequiredError = UpgradeRequiredError;
1515
1573
  exports.actionParametersToJsonSchema = actionParametersToJsonSchema;
1516
1574
  exports.convertJsonSchemaToZodSchema = convertJsonSchemaToZodSchema;
1575
+ exports.copyToClipboard = copyToClipboard;
1517
1576
  exports.createLicenseContextValue = createLicenseContextValue;
1518
1577
  exports.dataToUUID = dataToUUID;
1519
1578
  exports.ensureStructuredError = ensureStructuredError;