@copilotkit/shared 1.55.3 → 1.56.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.
- package/dist/a2ui-prompts.cjs +31 -22
- package/dist/a2ui-prompts.cjs.map +1 -1
- package/dist/a2ui-prompts.d.cts +2 -2
- package/dist/a2ui-prompts.d.cts.map +1 -1
- package/dist/a2ui-prompts.d.mts +2 -2
- package/dist/a2ui-prompts.d.mts.map +1 -1
- package/dist/a2ui-prompts.mjs +31 -22
- package/dist/a2ui-prompts.mjs.map +1 -1
- package/dist/debug.cjs +38 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.d.cts +29 -0
- package/dist/debug.d.cts.map +1 -0
- package/dist/debug.d.mts +29 -0
- package/dist/debug.d.mts.map +1 -0
- package/dist/debug.mjs +37 -0
- package/dist/debug.mjs.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +133 -28
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/utils/clipboard.cjs +28 -0
- package/dist/utils/clipboard.cjs.map +1 -0
- package/dist/utils/clipboard.d.cts +14 -0
- package/dist/utils/clipboard.d.cts.map +1 -0
- package/dist/utils/clipboard.d.mts +14 -0
- package/dist/utils/clipboard.d.mts.map +1 -0
- package/dist/utils/clipboard.mjs +27 -0
- package/dist/utils/clipboard.mjs.map +1 -0
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +1 -0
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +1 -0
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/json-schema.cjs +36 -5
- package/dist/utils/json-schema.cjs.map +1 -1
- package/dist/utils/json-schema.d.cts +1 -1
- package/dist/utils/json-schema.d.cts.map +1 -1
- package/dist/utils/json-schema.d.mts +1 -1
- package/dist/utils/json-schema.d.mts.map +1 -1
- package/dist/utils/json-schema.mjs +36 -5
- package/dist/utils/json-schema.mjs.map +1 -1
- package/dist/utils/types.cjs.map +1 -1
- package/dist/utils/types.d.cts +3 -0
- package/dist/utils/types.d.cts.map +1 -1
- package/dist/utils/types.d.mts +3 -0
- package/dist/utils/types.d.mts.map +1 -1
- package/dist/utils/types.mjs.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/debug.test.ts +116 -0
- package/src/a2ui-prompts.ts +31 -22
- package/src/debug.ts +55 -0
- package/src/index.ts +1 -0
- package/src/utils/__tests__/clipboard.test.ts +87 -0
- package/src/utils/__tests__/json-schema.test.ts +250 -1
- package/src/utils/clipboard.ts +23 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/json-schema.ts +84 -3
- package/src/utils/types.ts +3 -0
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,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";
|
|
@@ -15,6 +16,7 @@ import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safePa
|
|
|
15
16
|
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.mjs";
|
|
16
17
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
17
18
|
import "./telemetry/index.mjs";
|
|
19
|
+
import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.mjs";
|
|
18
20
|
import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.mjs";
|
|
19
21
|
import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.mjs";
|
|
20
22
|
import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
|
|
@@ -41,5 +43,5 @@ declare function createLicenseContextValue(status: null): {
|
|
|
41
43
|
getLimit: (feature: string) => number | null;
|
|
42
44
|
};
|
|
43
45
|
//#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 };
|
|
46
|
+
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, DebugConfig, 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, ResolvedDebugConfig, 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, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
45
47
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,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";
|
|
@@ -9,6 +10,7 @@ import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safePa
|
|
|
9
10
|
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.mjs";
|
|
10
11
|
import { version } from "./package.mjs";
|
|
11
12
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
13
|
+
import { resolveDebugConfig } from "./debug.mjs";
|
|
12
14
|
import { schemaToJsonSchema } from "./standard-schema.mjs";
|
|
13
15
|
import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
|
|
14
16
|
import { logger } from "./logger.mjs";
|
|
@@ -36,5 +38,5 @@ function createLicenseContextValue(status) {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
//#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 };
|
|
41
|
+
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, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
40
42
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -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":"
|
|
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 \"./debug\";\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":";;;;;;;;;;;;;;;;;;;;;AAkBA,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
|
-
|
|
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.
|
|
972
|
+
var version = "1.56.0";
|
|
915
973
|
|
|
916
974
|
//#endregion
|
|
917
975
|
//#region src/telemetry/scarf-client.ts
|
|
@@ -1016,6 +1074,42 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
1016
1074
|
}
|
|
1017
1075
|
};
|
|
1018
1076
|
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region src/debug.ts
|
|
1079
|
+
/** The all-off config used when debug is falsy. */
|
|
1080
|
+
const DEBUG_OFF = {
|
|
1081
|
+
enabled: false,
|
|
1082
|
+
events: false,
|
|
1083
|
+
lifecycle: false,
|
|
1084
|
+
verbose: false
|
|
1085
|
+
};
|
|
1086
|
+
/**
|
|
1087
|
+
* Normalizes a DebugConfig value into a ResolvedDebugConfig.
|
|
1088
|
+
*
|
|
1089
|
+
* - `false` / `undefined` → all off
|
|
1090
|
+
* - `true` → events + lifecycle on, verbose off (no PII in logs)
|
|
1091
|
+
* - object → merges with defaults (events: true, lifecycle: true, verbose: false)
|
|
1092
|
+
*/
|
|
1093
|
+
function resolveDebugConfig(debug) {
|
|
1094
|
+
var _debug$events, _debug$lifecycle, _debug$verbose;
|
|
1095
|
+
if (!debug) return DEBUG_OFF;
|
|
1096
|
+
if (debug === true) return {
|
|
1097
|
+
enabled: true,
|
|
1098
|
+
events: true,
|
|
1099
|
+
lifecycle: true,
|
|
1100
|
+
verbose: false
|
|
1101
|
+
};
|
|
1102
|
+
const events = (_debug$events = debug.events) !== null && _debug$events !== void 0 ? _debug$events : true;
|
|
1103
|
+
const lifecycle = (_debug$lifecycle = debug.lifecycle) !== null && _debug$lifecycle !== void 0 ? _debug$lifecycle : true;
|
|
1104
|
+
const enabled = events || lifecycle;
|
|
1105
|
+
return {
|
|
1106
|
+
enabled,
|
|
1107
|
+
events,
|
|
1108
|
+
lifecycle,
|
|
1109
|
+
verbose: enabled && ((_debug$verbose = debug.verbose) !== null && _debug$verbose !== void 0 ? _debug$verbose : false)
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1019
1113
|
//#endregion
|
|
1020
1114
|
//#region src/standard-schema.ts
|
|
1021
1115
|
/**
|
|
@@ -1405,29 +1499,38 @@ CRITICAL: Do NOT use "/name" (absolute) inside templates — use "name" (relativ
|
|
|
1405
1499
|
The container's path ("/items") uses a leading slash (absolute), but all
|
|
1406
1500
|
components INSIDE the template use paths WITHOUT leading slash.
|
|
1407
1501
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1502
|
+
COMPONENT VALUES — DEFAULT RULE:
|
|
1503
|
+
Use inline literal values for ALL component properties. Pass strings, numbers,
|
|
1504
|
+
arrays, and objects directly on the component. Do NOT use { "path": "..." }
|
|
1505
|
+
objects unless the property's schema explicitly allows it (see exception below).
|
|
1506
|
+
CRITICAL: USING { "path": "..." } ON A PROPERTY THAT DOES NOT DECLARE PATH
|
|
1507
|
+
SUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.
|
|
1508
|
+
ALWAYS CHECK THE COMPONENT SCHEMA FIRST — IF THE PROPERTY ONLY ACCEPTS A
|
|
1509
|
+
PLAIN TYPE, YOU MUST USE A LITERAL VALUE.
|
|
1510
|
+
VERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!
|
|
1415
1511
|
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
You MUST use { "path": "..." } to make inputs editable.
|
|
1512
|
+
For example, a chart's "data" must always be an inline array:
|
|
1513
|
+
"data": [{"label": "Jan", "value": 100}, {"label": "Feb", "value": 200}]
|
|
1514
|
+
A metric's "value" must always be an inline string:
|
|
1515
|
+
"value": "$1,200"
|
|
1421
1516
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1517
|
+
PATH BINDING EXCEPTION — SCHEMA-DRIVEN:
|
|
1518
|
+
A few properties accept { "path": "/some/path" } as an alternative to a literal
|
|
1519
|
+
value. You can identify these in the Available Components schema: the property
|
|
1520
|
+
will list BOTH a literal type AND an object-with-path option. If a property only
|
|
1521
|
+
shows a single type (string, number, array, etc.), it does NOT support path
|
|
1522
|
+
binding — use a literal value only.
|
|
1424
1523
|
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1524
|
+
Path binding is typically used for editable form inputs so the client can write
|
|
1525
|
+
user input back to the data model. When building forms:
|
|
1526
|
+
- Bind input "value" to a data model path: "value": { "path": "/form/name" }
|
|
1527
|
+
- Pre-fill via the "data" tool argument: "data": { "form": { "name": "Alice" } }
|
|
1528
|
+
- Capture values on submit via button action context:
|
|
1529
|
+
"action": { "event": { "name": "submit", "context": { "name": { "path": "/form/name" } } } }
|
|
1428
1530
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1531
|
+
REPEATING CONTENT uses a structural children format (not the same as value binding):
|
|
1532
|
+
children: { componentId: "card-id", path: "/items" }
|
|
1533
|
+
Components inside templates use RELATIVE paths (no leading slash): { "path": "name" }.`;
|
|
1431
1534
|
/**
|
|
1432
1535
|
* Design guidelines — visual design rules, component hierarchy tips,
|
|
1433
1536
|
* and action handler patterns.
|
|
@@ -1451,9 +1554,9 @@ Design principles:
|
|
|
1451
1554
|
"action": { "event": { "name": "myAction", "context": { "key": "value" } } }
|
|
1452
1555
|
The "event" key holds an OBJECT with "name" (required) and "context" (optional).
|
|
1453
1556
|
Do NOT use a flat format like {"event": "name"} — "event" must be an object.
|
|
1454
|
-
- For forms:
|
|
1455
|
-
|
|
1456
|
-
action context
|
|
1557
|
+
- For forms: check the component schema — if an input's "value" property
|
|
1558
|
+
supports path binding, use it for editable fields. The submit button's
|
|
1559
|
+
action context should reference the same paths to capture user input.
|
|
1457
1560
|
|
|
1458
1561
|
Use the SAME surfaceId as the main surface. Match action names to button action event names.`;
|
|
1459
1562
|
|
|
@@ -1514,6 +1617,7 @@ exports.TranscriptionErrors = TranscriptionErrors;
|
|
|
1514
1617
|
exports.UpgradeRequiredError = UpgradeRequiredError;
|
|
1515
1618
|
exports.actionParametersToJsonSchema = actionParametersToJsonSchema;
|
|
1516
1619
|
exports.convertJsonSchemaToZodSchema = convertJsonSchemaToZodSchema;
|
|
1620
|
+
exports.copyToClipboard = copyToClipboard;
|
|
1517
1621
|
exports.createLicenseContextValue = createLicenseContextValue;
|
|
1518
1622
|
exports.dataToUUID = dataToUUID;
|
|
1519
1623
|
exports.ensureStructuredError = ensureStructuredError;
|
|
@@ -1544,6 +1648,7 @@ exports.randomId = randomId;
|
|
|
1544
1648
|
exports.randomUUID = randomUUID;
|
|
1545
1649
|
exports.readBody = readBody;
|
|
1546
1650
|
exports.readFileAsBase64 = readFileAsBase64;
|
|
1651
|
+
exports.resolveDebugConfig = resolveDebugConfig;
|
|
1547
1652
|
exports.safeParseToolArgs = safeParseToolArgs;
|
|
1548
1653
|
exports.schemaToJsonSchema = schemaToJsonSchema;
|
|
1549
1654
|
exports.styledConsole = styledConsole;
|