@copilotkit/shared 1.9.1 → 1.9.2-next.1
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/CHANGELOG.md +8 -0
- package/dist/{chunk-GW2WLY4D.mjs → chunk-HNXYPG5J.mjs} +71 -24
- package/dist/chunk-HNXYPG5J.mjs.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +72 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/utils/errors.d.ts +34 -4
- package/dist/utils/errors.js +72 -23
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/errors.mjs +5 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +72 -23
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +5 -1
- package/package.json +3 -3
- package/src/utils/errors.ts +64 -11
- package/dist/chunk-GW2WLY4D.mjs.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils/conditions.ts","../src/utils/errors.ts","../src/utils/json-schema.ts","../src/utils/random-id.ts","../src/utils/index.ts","../src/constants/index.ts","../src/telemetry/telemetry-client.ts","../src/telemetry/utils.ts","../package.json"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n","export type ComparisonRule =\n | \"EQUALS\"\n | \"NOT_EQUALS\"\n | \"GREATER_THAN\"\n | \"LESS_THAN\"\n | \"CONTAINS\"\n | \"NOT_CONTAINS\"\n | \"MATCHES\"\n | \"STARTS_WITH\"\n | \"ENDS_WITH\";\nexport type LogicalRule = \"AND\" | \"OR\" | \"NOT\";\nexport type ExistenceRule = \"EXISTS\" | \"NOT_EXISTS\";\n\nexport type Rule = ComparisonRule | LogicalRule | ExistenceRule;\n\nexport interface BaseCondition {\n rule: Rule;\n path?: string;\n}\n\nexport interface ComparisonCondition extends BaseCondition {\n rule: ComparisonRule;\n value: any;\n}\n\nexport interface LogicalCondition extends BaseCondition {\n rule: LogicalRule;\n conditions: Condition[];\n}\n\nexport interface ExistenceCondition extends BaseCondition {\n rule: ExistenceRule;\n}\n\nexport type Condition = ComparisonCondition | LogicalCondition | ExistenceCondition;\n\nexport function executeConditions({\n conditions,\n value,\n}: {\n conditions?: Condition[];\n value: any;\n}): boolean {\n // If no conditions, consider it a pass\n if (!conditions?.length) return true;\n\n // Run all conditions (implicit AND)\n return conditions.every((condition) => executeCondition(condition, value));\n}\n\nfunction executeCondition(condition: Condition, value: any): boolean {\n const targetValue = condition.path ? getValueFromPath(value, condition.path) : value;\n\n switch (condition.rule) {\n // Logical\n case \"AND\":\n return (condition as LogicalCondition).conditions.every((c) => executeCondition(c, value));\n case \"OR\":\n return (condition as LogicalCondition).conditions.some((c) => executeCondition(c, value));\n case \"NOT\":\n return !(condition as LogicalCondition).conditions.every((c) => executeCondition(c, value));\n\n // Comparison\n case \"EQUALS\":\n return targetValue === (condition as ComparisonCondition).value;\n case \"NOT_EQUALS\":\n return targetValue !== (condition as ComparisonCondition).value;\n case \"GREATER_THAN\":\n return targetValue > (condition as ComparisonCondition).value;\n case \"LESS_THAN\":\n return targetValue < (condition as ComparisonCondition).value;\n case \"CONTAINS\":\n return (\n Array.isArray(targetValue) && targetValue.includes((condition as ComparisonCondition).value)\n );\n case \"NOT_CONTAINS\":\n return (\n Array.isArray(targetValue) &&\n !targetValue.includes((condition as ComparisonCondition).value)\n );\n case \"MATCHES\":\n return new RegExp((condition as ComparisonCondition).value).test(String(targetValue));\n case \"STARTS_WITH\":\n return String(targetValue).startsWith((condition as ComparisonCondition).value);\n case \"ENDS_WITH\":\n return String(targetValue).endsWith((condition as ComparisonCondition).value);\n\n // Existence\n case \"EXISTS\":\n return targetValue !== undefined && targetValue !== null;\n case \"NOT_EXISTS\":\n return targetValue === undefined || targetValue === null;\n }\n}\n\nfunction getValueFromPath(obj: any, path: string): any {\n return path.split(\".\").reduce((acc, part) => acc?.[part], obj);\n}\n","import { GraphQLError } from \"graphql\";\nimport { COPILOTKIT_VERSION } from \"../index\";\n\nexport enum Severity {\n Error = \"error\",\n}\n\nexport const ERROR_NAMES = {\n COPILOT_ERROR: \"CopilotError\",\n COPILOT_API_DISCOVERY_ERROR: \"CopilotApiDiscoveryError\",\n COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR: \"CopilotKitRemoteEndpointDiscoveryError\",\n COPILOT_KIT_AGENT_DISCOVERY_ERROR: \"CopilotKitAgentDiscoveryError\",\n COPILOT_KIT_LOW_LEVEL_ERROR: \"CopilotKitLowLevelError\",\n COPILOT_KIT_VERSION_MISMATCH_ERROR: \"CopilotKitVersionMismatchError\",\n RESOLVED_COPILOT_KIT_ERROR: \"ResolvedCopilotKitError\",\n CONFIGURATION_ERROR: \"ConfigurationError\",\n MISSING_PUBLIC_API_KEY_ERROR: \"MissingPublicApiKeyError\",\n UPGRADE_REQUIRED_ERROR: \"UpgradeRequiredError\",\n} as const;\nexport const COPILOT_CLOUD_ERROR_NAMES = [\n ERROR_NAMES.CONFIGURATION_ERROR,\n ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,\n ERROR_NAMES.UPGRADE_REQUIRED_ERROR,\n];\n\nexport enum CopilotKitErrorCode {\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NOT_FOUND = \"NOT_FOUND\",\n AGENT_NOT_FOUND = \"AGENT_NOT_FOUND\",\n API_NOT_FOUND = \"API_NOT_FOUND\",\n REMOTE_ENDPOINT_NOT_FOUND = \"REMOTE_ENDPOINT_NOT_FOUND\",\n MISUSE = \"MISUSE\",\n UNKNOWN = \"UNKNOWN\",\n VERSION_MISMATCH = \"VERSION_MISMATCH\",\n CONFIGURATION_ERROR = \"CONFIGURATION_ERROR\",\n MISSING_PUBLIC_API_KEY_ERROR = \"MISSING_PUBLIC_API_KEY_ERROR\",\n UPGRADE_REQUIRED_ERROR = \"UPGRADE_REQUIRED_ERROR\",\n}\n\nconst BASE_URL = \"https://docs.copilotkit.ai\";\n\nconst getSeeMoreMarkdown = (link: string) => `See more: [${link}](${link})`;\n\nexport const ERROR_CONFIG = {\n [CopilotKitErrorCode.NETWORK_ERROR]: {\n statusCode: 503,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n },\n [CopilotKitErrorCode.NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n },\n [CopilotKitErrorCode.AGENT_NOT_FOUND]: {\n statusCode: 500,\n troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,\n },\n [CopilotKitErrorCode.API_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n },\n [CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,\n },\n [CopilotKitErrorCode.MISUSE]: {\n statusCode: 400,\n troubleshootingUrl: null,\n },\n [CopilotKitErrorCode.UNKNOWN]: {\n statusCode: 500,\n },\n [CopilotKitErrorCode.CONFIGURATION_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.Error,\n },\n [CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.Error,\n },\n [CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR]: {\n statusCode: 402,\n troubleshootingUrl: null,\n severity: Severity.Error,\n },\n [CopilotKitErrorCode.VERSION_MISMATCH]: {\n statusCode: 400,\n troubleshootingUrl: null,\n },\n};\n\nexport class CopilotKitError extends GraphQLError {\n code: CopilotKitErrorCode;\n statusCode: number;\n severity?: Severity;\n constructor({\n message = \"Unknown error occurred\",\n code,\n severity,\n }: {\n message?: string;\n code: CopilotKitErrorCode;\n severity?: Severity;\n }) {\n const name = ERROR_NAMES.COPILOT_ERROR;\n const { statusCode } = ERROR_CONFIG[code];\n\n super(message, {\n extensions: {\n name,\n statusCode,\n },\n });\n this.code = code;\n this.name = name;\n this.statusCode = statusCode;\n this.severity = severity;\n }\n}\n\n/**\n * Error thrown when we can identify wrong usage of our components.\n * This helps us notify the developer before real errors can happen\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitMisuseError extends CopilotKitError {\n constructor({\n message,\n code = CopilotKitErrorCode.MISUSE,\n }: {\n message: string;\n code?: CopilotKitErrorCode;\n }) {\n const docsLink =\n \"troubleshootingUrl\" in ERROR_CONFIG[code] && ERROR_CONFIG[code].troubleshootingUrl\n ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl as string)\n : null;\n const finalMessage = docsLink ? `${message}.\\n\\n${docsLink}` : message;\n super({ message: finalMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\nconst getVersionMismatchErrorMessage = ({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n}: VersionMismatchResponse) =>\n `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? \"\"} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;\n/**\n * Error thrown when CPK versions does not match\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitVersionMismatchError extends CopilotKitError {\n constructor({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }: VersionMismatchResponse) {\n const code = CopilotKitErrorCode.VERSION_MISMATCH;\n super({\n message: getVersionMismatchErrorMessage({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }),\n code,\n });\n this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;\n }\n}\n\n/**\n * Error thrown when the CopilotKit API endpoint cannot be discovered or accessed.\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n * - There are network/firewall issues preventing access\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitApiDiscoveryError extends CopilotKitError {\n constructor(\n params: {\n message?: string;\n code?: CopilotKitErrorCode.API_NOT_FOUND | CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n url?: string;\n } = {},\n ) {\n const url = params.url ?? \"\";\n let operationSuffix = \"\";\n if (url?.includes(\"/info\")) operationSuffix = `when fetching CopilotKit info`;\n else if (url.includes(\"/actions/execute\"))\n operationSuffix = `when attempting to execute actions.`;\n else if (url.includes(\"/agents/state\")) operationSuffix = `when attempting to get agent state.`;\n else if (url.includes(\"/agents/execute\"))\n operationSuffix = `when attempting to execute agent(s).`;\n const message =\n params.message ??\n (params.url\n ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}`\n : `Failed to find CopilotKit API endpoint.`);\n const code = params.code ?? CopilotKitErrorCode.API_NOT_FOUND;\n const errorMessage = `${message}.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;\n super({ message: errorMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\n/**\n * This error is used for endpoints specified in runtime's remote endpoints. If they cannot be contacted\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n *\n * @extends CopilotKitApiDiscoveryError\n */\nexport class CopilotKitRemoteEndpointDiscoveryError extends CopilotKitApiDiscoveryError {\n constructor(params?: { message?: string; url?: string }) {\n const message =\n params?.message ??\n (params?.url\n ? `Failed to find or contact remote endpoint at url ${params.url}`\n : \"Failed to find or contact remote endpoint\");\n const code = CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Error thrown when a LangGraph agent cannot be found or accessed.\n * This typically occurs when:\n * - The specified agent name does not exist in the deployment\n * - The agent configuration is invalid or missing\n * - The agent service is not properly deployed or initialized\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitAgentDiscoveryError extends CopilotKitError {\n constructor(params: { agentName?: string; availableAgents: { name: string; id: string }[] }) {\n const { agentName, availableAgents } = params;\n const code = CopilotKitErrorCode.AGENT_NOT_FOUND;\n\n let message = \"Failed to find any agents.\";\n const configMessage = \"Please verify the agent name exists and is properly configured.\";\n const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);\n\n if (availableAgents.length) {\n message = agentName\n ? `Failed to find agent '${agentName}'. ${configMessage}`\n : `Failed to find agent. ${configMessage}`;\n\n const bulletList = availableAgents\n .map((agent) => `• ${agent.name} (ID: \\`${agent.id}\\`)`)\n .join(\"\\n\");\n\n message += `\\n\\nThe available agents are:\\n\\n${bulletList}\\n\\n${seeMore}`;\n } else {\n message += `\\n\\n${seeMore}`;\n }\n\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Handles low-level networking errors that occur before a request reaches the server.\n * These errors arise from issues in the underlying communication infrastructure rather than\n * application-level logic or server responses. Typically used to handle \"fetch failed\" errors\n * where no HTTP status code is available.\n *\n * Common scenarios include:\n * - Connection failures (ECONNREFUSED) when server is down/unreachable\n * - DNS resolution failures (ENOTFOUND) when domain can't be resolved\n * - Timeouts (ETIMEDOUT) when request takes too long\n * - Protocol/transport layer errors like SSL/TLS issues\n */\nexport class CopilotKitLowLevelError extends CopilotKitError {\n constructor({ error, url, message }: { error: Error; url: string; message?: string }) {\n let code = CopilotKitErrorCode.NETWORK_ERROR;\n\n // @ts-expect-error -- code may exist\n const errorCode = error.code as string;\n const errorMessage = message ?? resolveLowLevelErrorMessage({ errorCode, url });\n\n super({ message: errorMessage, code });\n\n this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;\n }\n}\n\n/**\n * Generic catch-all error handler for HTTP responses from the CopilotKit API where a status code is available.\n * Used when we receive an HTTP error status and wish to handle broad range of them\n *\n * This differs from CopilotKitLowLevelError in that:\n * - ResolvedCopilotKitError: Server was reached and returned an HTTP status\n * - CopilotKitLowLevelError: Error occurred before reaching server (e.g. network failure)\n *\n * @param status - The HTTP status code received from the API response\n * @param message - Optional error message to include\n * @param code - Optional specific CopilotKitErrorCode to override default behavior\n *\n * Default behavior:\n * - 400 Bad Request: Maps to CopilotKitApiDiscoveryError\n * - All other status codes: Maps to UNKNOWN error code if no specific code provided\n */\nexport class ResolvedCopilotKitError extends CopilotKitError {\n constructor({\n status,\n message,\n code,\n isRemoteEndpoint,\n url,\n }: {\n status: number;\n message?: string;\n code?: CopilotKitErrorCode;\n isRemoteEndpoint?: boolean;\n url?: string;\n }) {\n let resolvedCode = code;\n if (!resolvedCode) {\n switch (status) {\n case 400:\n throw new CopilotKitApiDiscoveryError({ message, url });\n case 404:\n throw isRemoteEndpoint\n ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n : new CopilotKitApiDiscoveryError({ message, url });\n default:\n resolvedCode = CopilotKitErrorCode.UNKNOWN;\n super({ message, code: resolvedCode });\n }\n } else {\n super({ message, code: resolvedCode });\n }\n this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n constructor(message: string) {\n super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });\n this.name = ERROR_NAMES.CONFIGURATION_ERROR;\n this.severity = Severity.Error;\n }\n}\n\nexport class MissingPublicApiKeyError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;\n this.severity = Severity.Error;\n }\n}\n\nexport class UpgradeRequiredError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;\n this.severity = Severity.Error;\n }\n}\n\ninterface VersionMismatchResponse {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n reactCoreVersion: string;\n}\n\nexport async function getPossibleVersionMismatch({\n runtimeVersion,\n runtimeClientGqlVersion,\n}: {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n}) {\n if (!runtimeVersion || runtimeVersion === \"\" || !runtimeClientGqlVersion) return;\n if (\n COPILOTKIT_VERSION !== runtimeVersion ||\n COPILOTKIT_VERSION !== runtimeClientGqlVersion ||\n runtimeVersion !== runtimeClientGqlVersion\n ) {\n return {\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n message: getVersionMismatchErrorMessage({\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n }),\n };\n }\n\n return;\n}\n\nconst resolveLowLevelErrorMessage = ({ errorCode, url }: { errorCode?: string; url: string }) => {\n const troubleshootingLink = ERROR_CONFIG[CopilotKitErrorCode.NETWORK_ERROR].troubleshootingUrl;\n const genericMessage = (description = `Failed to fetch from url ${url}.`) => `${description}.\n\nPossible reasons:\n- -The server may have an error preventing it from returning a response (Check the server logs for more info).\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n\n if (url.includes(\"/info\"))\n return genericMessage(`Failed to fetch CopilotKit agents/action information from url ${url}.`);\n if (url.includes(\"/actions/execute\"))\n return genericMessage(`Fetch call to ${url} to execute actions failed.`);\n if (url.includes(\"/agents/state\"))\n return genericMessage(`Fetch call to ${url} to get agent state failed.`);\n if (url.includes(\"/agents/execute\"))\n return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);\n\n switch (errorCode) {\n case \"ECONNREFUSED\":\n return `Connection to ${url} was refused. Ensure the server is running and accessible.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n case \"ENOTFOUND\":\n return `The server on ${url} could not be found. Check the URL or your network configuration.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[CopilotKitErrorCode.NOT_FOUND].troubleshootingUrl)}`;\n case \"ETIMEDOUT\":\n return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n default:\n return;\n }\n};\n","import { z } from \"zod\";\nimport { Parameter } from \"../types\";\n\nexport type JSONSchemaString = {\n type: \"string\";\n description?: string;\n enum?: string[];\n};\n\nexport type JSONSchemaNumber = {\n type: \"number\";\n description?: string;\n};\n\nexport type JSONSchemaBoolean = {\n type: \"boolean\";\n description?: string;\n};\n\nexport type JSONSchemaObject = {\n type: \"object\";\n properties?: Record<string, JSONSchema>;\n required?: string[];\n description?: string;\n};\n\nexport type JSONSchemaArray = {\n type: \"array\";\n items: JSONSchema;\n description?: string;\n};\n\nexport type JSONSchema =\n | JSONSchemaString\n | JSONSchemaNumber\n | JSONSchemaBoolean\n | JSONSchemaObject\n | JSONSchemaArray;\n\nexport function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of actionParameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of actionParameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n return {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n };\n}\n\n// Convert JSONSchema to Parameter[]\nexport function jsonSchemaToActionParameters(jsonSchema: JSONSchema): Parameter[] {\n if (jsonSchema.type !== \"object\" || !jsonSchema.properties) {\n return [];\n }\n\n const parameters: Parameter[] = [];\n const requiredFields = jsonSchema.required || [];\n\n for (const [name, schema] of Object.entries(jsonSchema.properties)) {\n const parameter = convertJsonSchemaToParameter(name, schema, requiredFields.includes(name));\n parameters.push(parameter);\n }\n\n return parameters;\n}\n\n// Convert JSONSchema property to Parameter\nfunction convertJsonSchemaToParameter(\n name: string,\n schema: JSONSchema,\n isRequired: boolean,\n): Parameter {\n const baseParameter: Parameter = {\n name,\n description: schema.description,\n };\n\n if (!isRequired) {\n baseParameter.required = false;\n }\n\n switch (schema.type) {\n case \"string\":\n return {\n ...baseParameter,\n type: \"string\",\n ...(schema.enum && { enum: schema.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n ...baseParameter,\n type: schema.type,\n };\n case \"object\":\n if (schema.properties) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.required || [];\n\n for (const [propName, propSchema] of Object.entries(schema.properties)) {\n attributes.push(\n convertJsonSchemaToParameter(propName, propSchema, requiredFields.includes(propName)),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object\",\n attributes,\n };\n }\n return {\n ...baseParameter,\n type: \"object\",\n };\n case \"array\":\n if (schema.items.type === \"object\" && \"properties\" in schema.items) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.items.required || [];\n\n for (const [propName, propSchema] of Object.entries(schema.items.properties || {})) {\n attributes.push(\n convertJsonSchemaToParameter(propName, propSchema, requiredFields.includes(propName)),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object[]\",\n attributes,\n };\n } else if (schema.items.type === \"array\") {\n throw new Error(\"Nested arrays are not supported\");\n } else {\n return {\n ...baseParameter,\n type: `${schema.items.type}[]`,\n };\n }\n default:\n return {\n ...baseParameter,\n type: \"string\",\n };\n }\n}\n\nfunction convertAttribute(attribute: Parameter): JSONSchema {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType as any },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean): z.ZodSchema {\n if (jsonSchema.type === \"object\") {\n const spec: { [key: string]: z.ZodSchema } = {};\n\n if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {\n return !required ? z.object(spec).optional() : z.object(spec);\n }\n\n for (const [key, value] of Object.entries(jsonSchema.properties)) {\n spec[key] = convertJsonSchemaToZodSchema(\n value,\n jsonSchema.required ? jsonSchema.required.includes(key) : false,\n );\n }\n let schema = z.object(spec).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"string\") {\n let schema = z.string().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"number\") {\n let schema = z.number().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"boolean\") {\n let schema = z.boolean().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"array\") {\n let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);\n let schema = z.array(itemSchema).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n throw new Error(\"Invalid JSON schema\");\n}\n","import { v4 as uuidv4, validate, v5 as uuidv5 } from \"uuid\";\n\nexport function randomId() {\n return \"ck-\" + uuidv4();\n}\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function dataToUUID(input: string, namespace?: string): string {\n const BASE_NAMESPACE = \"e4b01160-ff74-4c6e-9b27-d53cd930fe8e\";\n // Since namespace needs to be a uuid, we are creating a uuid for it.\n const boundNamespace = namespace ? uuidv5(namespace, BASE_NAMESPACE) : BASE_NAMESPACE;\n return uuidv5(input, boundNamespace);\n}\n\nexport function isValidUUID(uuid: string) {\n return validate(uuid);\n}\n","export * from \"./conditions\";\nexport * from \"./errors\";\nexport * from \"./json-schema\";\nexport * from \"./random-id\";\n\n/**\n * Safely parses a JSON string into an object\n * @param json The JSON string to parse\n * @param fallback Optional fallback value to return if parsing fails. If not provided or set to \"unset\", returns null\n * @returns The parsed JSON object, or the fallback value (or null) if parsing fails\n */\nexport function parseJson(json: string, fallback: any = \"unset\") {\n try {\n return JSON.parse(json);\n } catch (e) {\n return fallback === \"unset\" ? null : fallback;\n }\n}\n\n/**\n * Maps an array of items to a new array, skipping items that throw errors during mapping\n * @param items The array to map\n * @param callback The mapping function to apply to each item\n * @returns A new array containing only the successfully mapped items\n */\nexport function tryMap<TItem, TMapped>(\n items: TItem[],\n callback: (item: TItem, index: number, array: TItem[]) => TMapped,\n): TMapped[] {\n return items.reduce<TMapped[]>((acc, item, index, array) => {\n try {\n acc.push(callback(item, index, array));\n } catch (error) {\n console.error(error);\n }\n return acc;\n }, []);\n}\n\n/**\n * Checks if the current environment is macOS\n * @returns {boolean} True if running on macOS, false otherwise\n */\nexport function isMacOS(): boolean {\n return /Mac|iMac|Macintosh/i.test(navigator.userAgent);\n}\n","export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = \"X-CopilotCloud-Public-Api-Key\";\n","import { Analytics } from \"@segment/analytics-node\";\nimport { AnalyticsEvents } from \"./events\";\nimport { flattenObject, printSecurityNotice } from \"./utils\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport class TelemetryClient {\n segment: Analytics | undefined;\n globalProperties: Record<string, any> = {};\n cloudConfiguration: { publicApiKey: string; baseUrl: string } | null = null;\n packageName: string;\n packageVersion: string;\n private telemetryDisabled: boolean = false;\n private sampleRate: number = 0.05;\n private anonymousId = `anon_${uuidv4()}`;\n\n constructor({\n packageName,\n packageVersion,\n telemetryDisabled,\n telemetryBaseUrl,\n sampleRate,\n }: {\n packageName: string;\n packageVersion: string;\n telemetryDisabled?: boolean;\n telemetryBaseUrl?: string;\n sampleRate?: number;\n }) {\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.telemetryDisabled =\n telemetryDisabled ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n (process.env as any).DO_NOT_TRACK === \"true\" ||\n (process.env as any).DO_NOT_TRACK === \"1\";\n\n if (this.telemetryDisabled) {\n return;\n }\n\n this.setSampleRate(sampleRate);\n\n // eslint-disable-next-line\n const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || \"n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja\";\n\n this.segment = new Analytics({\n writeKey,\n });\n\n this.setGlobalProperties({\n \"copilotkit.package.name\": packageName,\n \"copilotkit.package.version\": packageVersion,\n });\n }\n\n private shouldSendEvent() {\n const randomNumber = Math.random();\n return randomNumber < this.sampleRate;\n }\n\n async capture<K extends keyof AnalyticsEvents>(event: K, properties: AnalyticsEvents[K]) {\n if (!this.shouldSendEvent() || !this.segment) {\n return;\n }\n\n const flattenedProperties = flattenObject(properties);\n const propertiesWithGlobal = {\n ...this.globalProperties,\n ...flattenedProperties,\n };\n const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal)\n .sort()\n .reduce(\n (obj, key) => {\n obj[key] = propertiesWithGlobal[key];\n return obj;\n },\n {} as Record<string, any>,\n );\n\n this.segment.track({\n anonymousId: this.anonymousId,\n event,\n properties: { ...orderedPropertiesWithGlobal },\n });\n }\n\n setGlobalProperties(properties: Record<string, any>) {\n const flattenedProperties = flattenObject(properties);\n this.globalProperties = { ...this.globalProperties, ...flattenedProperties };\n }\n\n setCloudConfiguration(properties: { publicApiKey: string; baseUrl: string }) {\n this.cloudConfiguration = properties;\n\n this.setGlobalProperties({\n cloud: {\n publicApiKey: properties.publicApiKey,\n baseUrl: properties.baseUrl,\n },\n });\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 0.05;\n\n // eslint-disable-next-line\n if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n // eslint-disable-next-line\n _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n if (_sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.sampleRate = _sampleRate;\n this.setGlobalProperties({\n sampleRate: this.sampleRate,\n sampleRateAdjustmentFactor: 1 - this.sampleRate,\n sampleWeight: 1 / this.sampleRate,\n });\n }\n}\n","import chalk from \"chalk\";\n\nexport function flattenObject(\n obj: Record<string, any>,\n parentKey = \"\",\n res: Record<string, any> = {},\n): Record<string, any> {\n for (let key in obj) {\n const propName = parentKey ? `${parentKey}.${key}` : key;\n if (typeof obj[key] === \"object\" && obj[key] !== null) {\n flattenObject(obj[key], propName, res);\n } else {\n res[propName] = obj[key];\n }\n }\n return res;\n}\n\nexport function printSecurityNotice(advisory: {\n advisory: string | null;\n message: string;\n severity: \"low\" | \"medium\" | \"high\" | \"none\";\n}) {\n const severityColor =\n {\n low: chalk.blue,\n medium: chalk.yellow,\n high: chalk.red,\n }[advisory.severity.toLowerCase()] || chalk.white;\n\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━ ${chalk.bold(`CopilotKit`)} ━━━━━━━━━━━━━━━━━━`);\n console.log();\n console.log(`${chalk.bold(`Severity: ${severityColor(advisory.severity.toUpperCase())}`)}`);\n console.log();\n console.log(`${chalk.bold(advisory.message)}`);\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);\n}\n","{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.9.1\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\"\n },\n \"dependencies\": {\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"graphql\": \"^16.8.1\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoCO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGY;AAEV,MAAI,EAAC,yCAAY;AAAQ,WAAO;AAGhC,SAAO,WAAW,MAAM,CAAC,cAAc,iBAAiB,WAAW,KAAK,CAAC;AAC3E;AAEA,SAAS,iBAAiB,WAAsB,OAAqB;AACnE,QAAM,cAAc,UAAU,OAAO,iBAAiB,OAAO,UAAU,IAAI,IAAI;AAE/E,UAAQ,UAAU,MAAM;AAAA,IAEtB,KAAK;AACH,aAAQ,UAA+B,WAAW,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAAA,IAC3F,KAAK;AACH,aAAQ,UAA+B,WAAW,KAAK,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAAA,IAC1F,KAAK;AACH,aAAO,CAAE,UAA+B,WAAW,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAAA,IAG5F,KAAK;AACH,aAAO,gBAAiB,UAAkC;AAAA,IAC5D,KAAK;AACH,aAAO,gBAAiB,UAAkC;AAAA,IAC5D,KAAK;AACH,aAAO,cAAe,UAAkC;AAAA,IAC1D,KAAK;AACH,aAAO,cAAe,UAAkC;AAAA,IAC1D,KAAK;AACH,aACE,MAAM,QAAQ,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EQ,cAAc,YAAgC;AACpD,QAAI;AAEJ,kBAAc,cAAc;AAG5B,QAAI,QAAQ,IAAI,kCAAkC;AAEhD,oBAAc,WAAW,QAAQ,IAAI,gCAAgC;AAAA,IACvE;AAEA,QAAI,cAAc,KAAK,cAAc,GAAG;AACtC,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AAEA,SAAK,aAAa;AAClB,SAAK,oBAAoB;AAAA,MACvB,YAAY,KAAK;AAAA,MACjB,4BAA4B,IAAI,KAAK;AAAA,MACrC,cAAc,IAAI,KAAK;AAAA,IACzB,CAAC;AAAA,EACH;AACF;;;AEnHE,cAAW;;;ATLN,IAAM,qBAAiC;","names":["Severity","CopilotKitErrorCode","uuidv4","uuidv5","import_uuid","uuidv4"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/conditions.ts","../src/utils/errors.ts","../src/utils/json-schema.ts","../src/utils/random-id.ts","../src/utils/index.ts","../src/constants/index.ts","../src/telemetry/telemetry-client.ts","../src/telemetry/utils.ts","../package.json"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n","export type ComparisonRule =\n | \"EQUALS\"\n | \"NOT_EQUALS\"\n | \"GREATER_THAN\"\n | \"LESS_THAN\"\n | \"CONTAINS\"\n | \"NOT_CONTAINS\"\n | \"MATCHES\"\n | \"STARTS_WITH\"\n | \"ENDS_WITH\";\nexport type LogicalRule = \"AND\" | \"OR\" | \"NOT\";\nexport type ExistenceRule = \"EXISTS\" | \"NOT_EXISTS\";\n\nexport type Rule = ComparisonRule | LogicalRule | ExistenceRule;\n\nexport interface BaseCondition {\n rule: Rule;\n path?: string;\n}\n\nexport interface ComparisonCondition extends BaseCondition {\n rule: ComparisonRule;\n value: any;\n}\n\nexport interface LogicalCondition extends BaseCondition {\n rule: LogicalRule;\n conditions: Condition[];\n}\n\nexport interface ExistenceCondition extends BaseCondition {\n rule: ExistenceRule;\n}\n\nexport type Condition = ComparisonCondition | LogicalCondition | ExistenceCondition;\n\nexport function executeConditions({\n conditions,\n value,\n}: {\n conditions?: Condition[];\n value: any;\n}): boolean {\n // If no conditions, consider it a pass\n if (!conditions?.length) return true;\n\n // Run all conditions (implicit AND)\n return conditions.every((condition) => executeCondition(condition, value));\n}\n\nfunction executeCondition(condition: Condition, value: any): boolean {\n const targetValue = condition.path ? getValueFromPath(value, condition.path) : value;\n\n switch (condition.rule) {\n // Logical\n case \"AND\":\n return (condition as LogicalCondition).conditions.every((c) => executeCondition(c, value));\n case \"OR\":\n return (condition as LogicalCondition).conditions.some((c) => executeCondition(c, value));\n case \"NOT\":\n return !(condition as LogicalCondition).conditions.every((c) => executeCondition(c, value));\n\n // Comparison\n case \"EQUALS\":\n return targetValue === (condition as ComparisonCondition).value;\n case \"NOT_EQUALS\":\n return targetValue !== (condition as ComparisonCondition).value;\n case \"GREATER_THAN\":\n return targetValue > (condition as ComparisonCondition).value;\n case \"LESS_THAN\":\n return targetValue < (condition as ComparisonCondition).value;\n case \"CONTAINS\":\n return (\n Array.isArray(targetValue) && targetValue.includes((condition as ComparisonCondition).value)\n );\n case \"NOT_CONTAINS\":\n return (\n Array.isArray(targetValue) &&\n !targetValue.includes((condition as ComparisonCondition).value)\n );\n case \"MATCHES\":\n return new RegExp((condition as ComparisonCondition).value).test(String(targetValue));\n case \"STARTS_WITH\":\n return String(targetValue).startsWith((condition as ComparisonCondition).value);\n case \"ENDS_WITH\":\n return String(targetValue).endsWith((condition as ComparisonCondition).value);\n\n // Existence\n case \"EXISTS\":\n return targetValue !== undefined && targetValue !== null;\n case \"NOT_EXISTS\":\n return targetValue === undefined || targetValue === null;\n }\n}\n\nfunction getValueFromPath(obj: any, path: string): any {\n return path.split(\".\").reduce((acc, part) => acc?.[part], obj);\n}\n","import { GraphQLError } from \"graphql\";\nimport { COPILOTKIT_VERSION } from \"../index\";\n\nexport enum Severity {\n CRITICAL = \"critical\", // Critical errors that block core functionality\n WARNING = \"warning\", // Configuration/setup issues that need attention\n INFO = \"info\", // General errors and network issues\n}\n\nexport enum ErrorVisibility {\n BANNER = \"banner\", // Critical errors shown as fixed banners\n TOAST = \"toast\", // Regular errors shown as dismissible toasts\n SILENT = \"silent\", // Errors logged but not shown to user\n DEV_ONLY = \"dev_only\", // Errors only shown in development mode\n}\n\nexport const ERROR_NAMES = {\n COPILOT_ERROR: \"CopilotError\",\n COPILOT_API_DISCOVERY_ERROR: \"CopilotApiDiscoveryError\",\n COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR: \"CopilotKitRemoteEndpointDiscoveryError\",\n COPILOT_KIT_AGENT_DISCOVERY_ERROR: \"CopilotKitAgentDiscoveryError\",\n COPILOT_KIT_LOW_LEVEL_ERROR: \"CopilotKitLowLevelError\",\n COPILOT_KIT_VERSION_MISMATCH_ERROR: \"CopilotKitVersionMismatchError\",\n RESOLVED_COPILOT_KIT_ERROR: \"ResolvedCopilotKitError\",\n CONFIGURATION_ERROR: \"ConfigurationError\",\n MISSING_PUBLIC_API_KEY_ERROR: \"MissingPublicApiKeyError\",\n UPGRADE_REQUIRED_ERROR: \"UpgradeRequiredError\",\n} as const;\n\n// Banner errors - critical configuration/discovery issues\nexport const BANNER_ERROR_NAMES = [\n ERROR_NAMES.CONFIGURATION_ERROR,\n ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,\n ERROR_NAMES.UPGRADE_REQUIRED_ERROR,\n ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR,\n];\n\n// Legacy cloud error names for backward compatibility\nexport const COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;\n\nexport enum CopilotKitErrorCode {\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NOT_FOUND = \"NOT_FOUND\",\n AGENT_NOT_FOUND = \"AGENT_NOT_FOUND\",\n API_NOT_FOUND = \"API_NOT_FOUND\",\n REMOTE_ENDPOINT_NOT_FOUND = \"REMOTE_ENDPOINT_NOT_FOUND\",\n MISUSE = \"MISUSE\",\n UNKNOWN = \"UNKNOWN\",\n VERSION_MISMATCH = \"VERSION_MISMATCH\",\n CONFIGURATION_ERROR = \"CONFIGURATION_ERROR\",\n MISSING_PUBLIC_API_KEY_ERROR = \"MISSING_PUBLIC_API_KEY_ERROR\",\n UPGRADE_REQUIRED_ERROR = \"UPGRADE_REQUIRED_ERROR\",\n}\n\nconst BASE_URL = \"https://docs.copilotkit.ai\";\n\nconst getSeeMoreMarkdown = (link: string) => `See more: [${link}](${link})`;\n\nexport const ERROR_CONFIG = {\n [CopilotKitErrorCode.NETWORK_ERROR]: {\n statusCode: 503,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.TOAST,\n severity: Severity.INFO,\n },\n [CopilotKitErrorCode.NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.TOAST,\n severity: Severity.INFO,\n },\n [CopilotKitErrorCode.AGENT_NOT_FOUND]: {\n statusCode: 500,\n troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.API_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.MISUSE]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.WARNING,\n },\n [CopilotKitErrorCode.UNKNOWN]: {\n statusCode: 500,\n visibility: ErrorVisibility.TOAST,\n severity: Severity.INFO,\n },\n [CopilotKitErrorCode.CONFIGURATION_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR]: {\n statusCode: 402,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.VERSION_MISMATCH]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.INFO,\n },\n};\n\nexport class CopilotKitError extends GraphQLError {\n code: CopilotKitErrorCode;\n statusCode: number;\n severity?: Severity;\n visibility: ErrorVisibility;\n\n constructor({\n message = \"Unknown error occurred\",\n code,\n severity,\n visibility,\n }: {\n message?: string;\n code: CopilotKitErrorCode;\n severity?: Severity;\n visibility?: ErrorVisibility;\n }) {\n const name = ERROR_NAMES.COPILOT_ERROR;\n const config = ERROR_CONFIG[code];\n const { statusCode } = config;\n const resolvedVisibility = visibility ?? config.visibility ?? ErrorVisibility.TOAST;\n const resolvedSeverity = severity ?? (\"severity\" in config ? config.severity : undefined);\n\n super(message, {\n extensions: {\n name,\n statusCode,\n code,\n visibility: resolvedVisibility,\n severity: resolvedSeverity,\n troubleshootingUrl: \"troubleshootingUrl\" in config ? config.troubleshootingUrl : null,\n originalError: {\n message,\n stack: new Error().stack,\n },\n },\n });\n\n this.code = code;\n this.name = name;\n this.statusCode = statusCode;\n this.severity = resolvedSeverity;\n this.visibility = resolvedVisibility;\n }\n}\n\n/**\n * Error thrown when we can identify wrong usage of our components.\n * This helps us notify the developer before real errors can happen\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitMisuseError extends CopilotKitError {\n constructor({\n message,\n code = CopilotKitErrorCode.MISUSE,\n }: {\n message: string;\n code?: CopilotKitErrorCode;\n }) {\n const docsLink =\n \"troubleshootingUrl\" in ERROR_CONFIG[code] && ERROR_CONFIG[code].troubleshootingUrl\n ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl as string)\n : null;\n const finalMessage = docsLink ? `${message}.\\n\\n${docsLink}` : message;\n super({ message: finalMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\nconst getVersionMismatchErrorMessage = ({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n}: VersionMismatchResponse) =>\n `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? \"\"} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;\n/**\n * Error thrown when CPK versions does not match\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitVersionMismatchError extends CopilotKitError {\n constructor({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }: VersionMismatchResponse) {\n const code = CopilotKitErrorCode.VERSION_MISMATCH;\n super({\n message: getVersionMismatchErrorMessage({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }),\n code,\n });\n this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;\n }\n}\n\n/**\n * Error thrown when the CopilotKit API endpoint cannot be discovered or accessed.\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n * - There are network/firewall issues preventing access\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitApiDiscoveryError extends CopilotKitError {\n constructor(\n params: {\n message?: string;\n code?: CopilotKitErrorCode.API_NOT_FOUND | CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n url?: string;\n } = {},\n ) {\n const url = params.url ?? \"\";\n let operationSuffix = \"\";\n if (url?.includes(\"/info\")) operationSuffix = `when fetching CopilotKit info`;\n else if (url.includes(\"/actions/execute\"))\n operationSuffix = `when attempting to execute actions.`;\n else if (url.includes(\"/agents/state\")) operationSuffix = `when attempting to get agent state.`;\n else if (url.includes(\"/agents/execute\"))\n operationSuffix = `when attempting to execute agent(s).`;\n const message =\n params.message ??\n (params.url\n ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}`\n : `Failed to find CopilotKit API endpoint.`);\n const code = params.code ?? CopilotKitErrorCode.API_NOT_FOUND;\n const errorMessage = `${message}.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;\n super({ message: errorMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\n/**\n * This error is used for endpoints specified in runtime's remote endpoints. If they cannot be contacted\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n *\n * @extends CopilotKitApiDiscoveryError\n */\nexport class CopilotKitRemoteEndpointDiscoveryError extends CopilotKitApiDiscoveryError {\n constructor(params?: { message?: string; url?: string }) {\n const message =\n params?.message ??\n (params?.url\n ? `Failed to find or contact remote endpoint at url ${params.url}`\n : \"Failed to find or contact remote endpoint\");\n const code = CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Error thrown when a LangGraph agent cannot be found or accessed.\n * This typically occurs when:\n * - The specified agent name does not exist in the deployment\n * - The agent configuration is invalid or missing\n * - The agent service is not properly deployed or initialized\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitAgentDiscoveryError extends CopilotKitError {\n constructor(params: { agentName?: string; availableAgents: { name: string; id: string }[] }) {\n const { agentName, availableAgents } = params;\n const code = CopilotKitErrorCode.AGENT_NOT_FOUND;\n\n let message = \"Failed to find any agents.\";\n const configMessage = \"Please verify the agent name exists and is properly configured.\";\n const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);\n\n if (availableAgents.length) {\n message = agentName\n ? `Failed to find agent '${agentName}'. ${configMessage}`\n : `Failed to find agent. ${configMessage}`;\n\n const bulletList = availableAgents\n .map((agent) => `• ${agent.name} (ID: \\`${agent.id}\\`)`)\n .join(\"\\n\");\n\n message += `\\n\\nThe available agents are:\\n\\n${bulletList}\\n\\n${seeMore}`;\n } else {\n message += `\\n\\n${seeMore}`;\n }\n\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Handles low-level networking errors that occur before a request reaches the server.\n * These errors arise from issues in the underlying communication infrastructure rather than\n * application-level logic or server responses. Typically used to handle \"fetch failed\" errors\n * where no HTTP status code is available.\n *\n * Common scenarios include:\n * - Connection failures (ECONNREFUSED) when server is down/unreachable\n * - DNS resolution failures (ENOTFOUND) when domain can't be resolved\n * - Timeouts (ETIMEDOUT) when request takes too long\n * - Protocol/transport layer errors like SSL/TLS issues\n */\nexport class CopilotKitLowLevelError extends CopilotKitError {\n constructor({ error, url, message }: { error: Error; url: string; message?: string }) {\n let code = CopilotKitErrorCode.NETWORK_ERROR;\n\n // @ts-expect-error -- code may exist\n const errorCode = error.code as string;\n const errorMessage = message ?? resolveLowLevelErrorMessage({ errorCode, url });\n\n super({ message: errorMessage, code });\n\n this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;\n }\n}\n\n/**\n * Generic catch-all error handler for HTTP responses from the CopilotKit API where a status code is available.\n * Used when we receive an HTTP error status and wish to handle broad range of them\n *\n * This differs from CopilotKitLowLevelError in that:\n * - ResolvedCopilotKitError: Server was reached and returned an HTTP status\n * - CopilotKitLowLevelError: Error occurred before reaching server (e.g. network failure)\n *\n * @param status - The HTTP status code received from the API response\n * @param message - Optional error message to include\n * @param code - Optional specific CopilotKitErrorCode to override default behavior\n *\n * Default behavior:\n * - 400 Bad Request: Maps to CopilotKitApiDiscoveryError\n * - All other status codes: Maps to UNKNOWN error code if no specific code provided\n */\nexport class ResolvedCopilotKitError extends CopilotKitError {\n constructor({\n status,\n message,\n code,\n isRemoteEndpoint,\n url,\n }: {\n status: number;\n message?: string;\n code?: CopilotKitErrorCode;\n isRemoteEndpoint?: boolean;\n url?: string;\n }) {\n let resolvedCode = code;\n if (!resolvedCode) {\n switch (status) {\n case 400:\n throw new CopilotKitApiDiscoveryError({ message, url });\n case 404:\n throw isRemoteEndpoint\n ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n : new CopilotKitApiDiscoveryError({ message, url });\n default:\n resolvedCode = CopilotKitErrorCode.UNKNOWN;\n super({ message, code: resolvedCode, visibility: ErrorVisibility.BANNER });\n }\n } else {\n super({ message, code: resolvedCode });\n }\n this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n constructor(message: string) {\n super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });\n this.name = ERROR_NAMES.CONFIGURATION_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\nexport class MissingPublicApiKeyError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;\n this.severity = Severity.CRITICAL;\n }\n}\n\nexport class UpgradeRequiredError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\ninterface VersionMismatchResponse {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n reactCoreVersion: string;\n}\n\nexport async function getPossibleVersionMismatch({\n runtimeVersion,\n runtimeClientGqlVersion,\n}: {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n}) {\n if (!runtimeVersion || runtimeVersion === \"\" || !runtimeClientGqlVersion) return;\n if (\n COPILOTKIT_VERSION !== runtimeVersion ||\n COPILOTKIT_VERSION !== runtimeClientGqlVersion ||\n runtimeVersion !== runtimeClientGqlVersion\n ) {\n return {\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n message: getVersionMismatchErrorMessage({\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n }),\n };\n }\n\n return;\n}\n\nconst resolveLowLevelErrorMessage = ({ errorCode, url }: { errorCode?: string; url: string }) => {\n const troubleshootingLink = ERROR_CONFIG[CopilotKitErrorCode.NETWORK_ERROR].troubleshootingUrl;\n const genericMessage = (description = `Failed to fetch from url ${url}.`) => `${description}.\n\nPossible reasons:\n- -The server may have an error preventing it from returning a response (Check the server logs for more info).\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n\n if (url.includes(\"/info\"))\n return genericMessage(`Failed to fetch CopilotKit agents/action information from url ${url}.`);\n if (url.includes(\"/actions/execute\"))\n return genericMessage(`Fetch call to ${url} to execute actions failed.`);\n if (url.includes(\"/agents/state\"))\n return genericMessage(`Fetch call to ${url} to get agent state failed.`);\n if (url.includes(\"/agents/execute\"))\n return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);\n\n switch (errorCode) {\n case \"ECONNREFUSED\":\n return `Connection to ${url} was refused. Ensure the server is running and accessible.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n case \"ENOTFOUND\":\n return `The server on ${url} could not be found. Check the URL or your network configuration.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[CopilotKitErrorCode.NOT_FOUND].troubleshootingUrl)}`;\n case \"ETIMEDOUT\":\n return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n default:\n return;\n }\n};\n","import { z } from \"zod\";\nimport { Parameter } from \"../types\";\n\nexport type JSONSchemaString = {\n type: \"string\";\n description?: string;\n enum?: string[];\n};\n\nexport type JSONSchemaNumber = {\n type: \"number\";\n description?: string;\n};\n\nexport type JSONSchemaBoolean = {\n type: \"boolean\";\n description?: string;\n};\n\nexport type JSONSchemaObject = {\n type: \"object\";\n properties?: Record<string, JSONSchema>;\n required?: string[];\n description?: string;\n};\n\nexport type JSONSchemaArray = {\n type: \"array\";\n items: JSONSchema;\n description?: string;\n};\n\nexport type JSONSchema =\n | JSONSchemaString\n | JSONSchemaNumber\n | JSONSchemaBoolean\n | JSONSchemaObject\n | JSONSchemaArray;\n\nexport function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of actionParameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of actionParameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n return {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n };\n}\n\n// Convert JSONSchema to Parameter[]\nexport function jsonSchemaToActionParameters(jsonSchema: JSONSchema): Parameter[] {\n if (jsonSchema.type !== \"object\" || !jsonSchema.properties) {\n return [];\n }\n\n const parameters: Parameter[] = [];\n const requiredFields = jsonSchema.required || [];\n\n for (const [name, schema] of Object.entries(jsonSchema.properties)) {\n const parameter = convertJsonSchemaToParameter(name, schema, requiredFields.includes(name));\n parameters.push(parameter);\n }\n\n return parameters;\n}\n\n// Convert JSONSchema property to Parameter\nfunction convertJsonSchemaToParameter(\n name: string,\n schema: JSONSchema,\n isRequired: boolean,\n): Parameter {\n const baseParameter: Parameter = {\n name,\n description: schema.description,\n };\n\n if (!isRequired) {\n baseParameter.required = false;\n }\n\n switch (schema.type) {\n case \"string\":\n return {\n ...baseParameter,\n type: \"string\",\n ...(schema.enum && { enum: schema.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n ...baseParameter,\n type: schema.type,\n };\n case \"object\":\n if (schema.properties) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.required || [];\n\n for (const [propName, propSchema] of Object.entries(schema.properties)) {\n attributes.push(\n convertJsonSchemaToParameter(propName, propSchema, requiredFields.includes(propName)),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object\",\n attributes,\n };\n }\n return {\n ...baseParameter,\n type: \"object\",\n };\n case \"array\":\n if (schema.items.type === \"object\" && \"properties\" in schema.items) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.items.required || [];\n\n for (const [propName, propSchema] of Object.entries(schema.items.properties || {})) {\n attributes.push(\n convertJsonSchemaToParameter(propName, propSchema, requiredFields.includes(propName)),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object[]\",\n attributes,\n };\n } else if (schema.items.type === \"array\") {\n throw new Error(\"Nested arrays are not supported\");\n } else {\n return {\n ...baseParameter,\n type: `${schema.items.type}[]`,\n };\n }\n default:\n return {\n ...baseParameter,\n type: \"string\",\n };\n }\n}\n\nfunction convertAttribute(attribute: Parameter): JSONSchema {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType as any },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean): z.ZodSchema {\n if (jsonSchema.type === \"object\") {\n const spec: { [key: string]: z.ZodSchema } = {};\n\n if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {\n return !required ? z.object(spec).optional() : z.object(spec);\n }\n\n for (const [key, value] of Object.entries(jsonSchema.properties)) {\n spec[key] = convertJsonSchemaToZodSchema(\n value,\n jsonSchema.required ? jsonSchema.required.includes(key) : false,\n );\n }\n let schema = z.object(spec).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"string\") {\n let schema = z.string().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"number\") {\n let schema = z.number().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"boolean\") {\n let schema = z.boolean().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"array\") {\n let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);\n let schema = z.array(itemSchema).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n throw new Error(\"Invalid JSON schema\");\n}\n","import { v4 as uuidv4, validate, v5 as uuidv5 } from \"uuid\";\n\nexport function randomId() {\n return \"ck-\" + uuidv4();\n}\n\nexport function randomUUID() {\n return uuidv4();\n}\n\nexport function dataToUUID(input: string, namespace?: string): string {\n const BASE_NAMESPACE = \"e4b01160-ff74-4c6e-9b27-d53cd930fe8e\";\n // Since namespace needs to be a uuid, we are creating a uuid for it.\n const boundNamespace = namespace ? uuidv5(namespace, BASE_NAMESPACE) : BASE_NAMESPACE;\n return uuidv5(input, boundNamespace);\n}\n\nexport function isValidUUID(uuid: string) {\n return validate(uuid);\n}\n","export * from \"./conditions\";\nexport * from \"./errors\";\nexport * from \"./json-schema\";\nexport * from \"./random-id\";\n\n/**\n * Safely parses a JSON string into an object\n * @param json The JSON string to parse\n * @param fallback Optional fallback value to return if parsing fails. If not provided or set to \"unset\", returns null\n * @returns The parsed JSON object, or the fallback value (or null) if parsing fails\n */\nexport function parseJson(json: string, fallback: any = \"unset\") {\n try {\n return JSON.parse(json);\n } catch (e) {\n return fallback === \"unset\" ? null : fallback;\n }\n}\n\n/**\n * Maps an array of items to a new array, skipping items that throw errors during mapping\n * @param items The array to map\n * @param callback The mapping function to apply to each item\n * @returns A new array containing only the successfully mapped items\n */\nexport function tryMap<TItem, TMapped>(\n items: TItem[],\n callback: (item: TItem, index: number, array: TItem[]) => TMapped,\n): TMapped[] {\n return items.reduce<TMapped[]>((acc, item, index, array) => {\n try {\n acc.push(callback(item, index, array));\n } catch (error) {\n console.error(error);\n }\n return acc;\n }, []);\n}\n\n/**\n * Checks if the current environment is macOS\n * @returns {boolean} True if running on macOS, false otherwise\n */\nexport function isMacOS(): boolean {\n return /Mac|iMac|Macintosh/i.test(navigator.userAgent);\n}\n","export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = \"X-CopilotCloud-Public-Api-Key\";\n","import { Analytics } from \"@segment/analytics-node\";\nimport { AnalyticsEvents } from \"./events\";\nimport { flattenObject, printSecurityNotice } from \"./utils\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport class TelemetryClient {\n segment: Analytics | undefined;\n globalProperties: Record<string, any> = {};\n cloudConfiguration: { publicApiKey: string; baseUrl: string } | null = null;\n packageName: string;\n packageVersion: string;\n private telemetryDisabled: boolean = false;\n private sampleRate: number = 0.05;\n private anonymousId = `anon_${uuidv4()}`;\n\n constructor({\n packageName,\n packageVersion,\n telemetryDisabled,\n telemetryBaseUrl,\n sampleRate,\n }: {\n packageName: string;\n packageVersion: string;\n telemetryDisabled?: boolean;\n telemetryBaseUrl?: string;\n sampleRate?: number;\n }) {\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.telemetryDisabled =\n telemetryDisabled ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n (process.env as any).DO_NOT_TRACK === \"true\" ||\n (process.env as any).DO_NOT_TRACK === \"1\";\n\n if (this.telemetryDisabled) {\n return;\n }\n\n this.setSampleRate(sampleRate);\n\n // eslint-disable-next-line\n const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || \"n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja\";\n\n this.segment = new Analytics({\n writeKey,\n });\n\n this.setGlobalProperties({\n \"copilotkit.package.name\": packageName,\n \"copilotkit.package.version\": packageVersion,\n });\n }\n\n private shouldSendEvent() {\n const randomNumber = Math.random();\n return randomNumber < this.sampleRate;\n }\n\n async capture<K extends keyof AnalyticsEvents>(event: K, properties: AnalyticsEvents[K]) {\n if (!this.shouldSendEvent() || !this.segment) {\n return;\n }\n\n const flattenedProperties = flattenObject(properties);\n const propertiesWithGlobal = {\n ...this.globalProperties,\n ...flattenedProperties,\n };\n const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal)\n .sort()\n .reduce(\n (obj, key) => {\n obj[key] = propertiesWithGlobal[key];\n return obj;\n },\n {} as Record<string, any>,\n );\n\n this.segment.track({\n anonymousId: this.anonymousId,\n event,\n properties: { ...orderedPropertiesWithGlobal },\n });\n }\n\n setGlobalProperties(properties: Record<string, any>) {\n const flattenedProperties = flattenObject(properties);\n this.globalProperties = { ...this.globalProperties, ...flattenedProperties };\n }\n\n setCloudConfiguration(properties: { publicApiKey: string; baseUrl: string }) {\n this.cloudConfiguration = properties;\n\n this.setGlobalProperties({\n cloud: {\n publicApiKey: properties.publicApiKey,\n baseUrl: properties.baseUrl,\n },\n });\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 0.05;\n\n // eslint-disable-next-line\n if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n // eslint-disable-next-line\n _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n if (_sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.sampleRate = _sampleRate;\n this.setGlobalProperties({\n sampleRate: this.sampleRate,\n sampleRateAdjustmentFactor: 1 - this.sampleRate,\n sampleWeight: 1 / this.sampleRate,\n });\n }\n}\n","import chalk from \"chalk\";\n\nexport function flattenObject(\n obj: Record<string, any>,\n parentKey = \"\",\n res: Record<string, any> = {},\n): Record<string, any> {\n for (let key in obj) {\n const propName = parentKey ? `${parentKey}.${key}` : key;\n if (typeof obj[key] === \"object\" && obj[key] !== null) {\n flattenObject(obj[key], propName, res);\n } else {\n res[propName] = obj[key];\n }\n }\n return res;\n}\n\nexport function printSecurityNotice(advisory: {\n advisory: string | null;\n message: string;\n severity: \"low\" | \"medium\" | \"high\" | \"none\";\n}) {\n const severityColor =\n {\n low: chalk.blue,\n medium: chalk.yellow,\n high: chalk.red,\n }[advisory.severity.toLowerCase()] || chalk.white;\n\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━ ${chalk.bold(`CopilotKit`)} ━━━━━━━━━━━━━━━━━━`);\n console.log();\n console.log(`${chalk.bold(`Severity: ${severityColor(advisory.severity.toUpperCase())}`)}`);\n console.log();\n console.log(`${chalk.bold(advisory.message)}`);\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);\n}\n","{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.9.2-next.1\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\"\n },\n \"dependencies\": {\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"graphql\": \"^16.8.1\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"autom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ity","ErrorVisibility","CopilotKitErrorCode","uuidv4","uuidv5","import_uuid","uuidv4"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BANNER_ERROR_NAMES,
|
|
2
3
|
COPILOTKIT_VERSION,
|
|
3
4
|
COPILOT_CLOUD_ERROR_NAMES,
|
|
4
5
|
ConfigurationError,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
CopilotKitVersionMismatchError,
|
|
13
14
|
ERROR_CONFIG,
|
|
14
15
|
ERROR_NAMES,
|
|
16
|
+
ErrorVisibility,
|
|
15
17
|
MissingPublicApiKeyError,
|
|
16
18
|
ResolvedCopilotKitError,
|
|
17
19
|
Severity,
|
|
@@ -20,7 +22,7 @@ import {
|
|
|
20
22
|
isMacOS,
|
|
21
23
|
parseJson,
|
|
22
24
|
tryMap
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-HNXYPG5J.mjs";
|
|
24
26
|
import {
|
|
25
27
|
dataToUUID,
|
|
26
28
|
isValidUUID,
|
|
@@ -52,6 +54,7 @@ import {
|
|
|
52
54
|
import "./chunk-6QGXWNS5.mjs";
|
|
53
55
|
import "./chunk-NAFEBKSO.mjs";
|
|
54
56
|
export {
|
|
57
|
+
BANNER_ERROR_NAMES,
|
|
55
58
|
COPILOTKIT_VERSION,
|
|
56
59
|
COPILOT_CLOUD_API_URL,
|
|
57
60
|
COPILOT_CLOUD_CHAT_URL,
|
|
@@ -69,6 +72,7 @@ export {
|
|
|
69
72
|
CopilotKitVersionMismatchError,
|
|
70
73
|
ERROR_CONFIG,
|
|
71
74
|
ERROR_NAMES,
|
|
75
|
+
ErrorVisibility,
|
|
72
76
|
MissingPublicApiKeyError,
|
|
73
77
|
ResolvedCopilotKitError,
|
|
74
78
|
Severity,
|
package/dist/utils/errors.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
2
|
|
|
3
3
|
declare enum Severity {
|
|
4
|
-
|
|
4
|
+
CRITICAL = "critical",// Critical errors that block core functionality
|
|
5
|
+
WARNING = "warning",// Configuration/setup issues that need attention
|
|
6
|
+
INFO = "info"
|
|
7
|
+
}
|
|
8
|
+
declare enum ErrorVisibility {
|
|
9
|
+
BANNER = "banner",// Critical errors shown as fixed banners
|
|
10
|
+
TOAST = "toast",// Regular errors shown as dismissible toasts
|
|
11
|
+
SILENT = "silent",// Errors logged but not shown to user
|
|
12
|
+
DEV_ONLY = "dev_only"
|
|
5
13
|
}
|
|
6
14
|
declare const ERROR_NAMES: {
|
|
7
15
|
readonly COPILOT_ERROR: "CopilotError";
|
|
@@ -15,7 +23,8 @@ declare const ERROR_NAMES: {
|
|
|
15
23
|
readonly MISSING_PUBLIC_API_KEY_ERROR: "MissingPublicApiKeyError";
|
|
16
24
|
readonly UPGRADE_REQUIRED_ERROR: "UpgradeRequiredError";
|
|
17
25
|
};
|
|
18
|
-
declare const
|
|
26
|
+
declare const BANNER_ERROR_NAMES: ("CopilotApiDiscoveryError" | "CopilotKitRemoteEndpointDiscoveryError" | "CopilotKitAgentDiscoveryError" | "ConfigurationError" | "MissingPublicApiKeyError" | "UpgradeRequiredError")[];
|
|
27
|
+
declare const COPILOT_CLOUD_ERROR_NAMES: ("CopilotApiDiscoveryError" | "CopilotKitRemoteEndpointDiscoveryError" | "CopilotKitAgentDiscoveryError" | "ConfigurationError" | "MissingPublicApiKeyError" | "UpgradeRequiredError")[];
|
|
19
28
|
declare enum CopilotKitErrorCode {
|
|
20
29
|
NETWORK_ERROR = "NETWORK_ERROR",
|
|
21
30
|
NOT_FOUND = "NOT_FOUND",
|
|
@@ -33,58 +42,79 @@ declare const ERROR_CONFIG: {
|
|
|
33
42
|
NETWORK_ERROR: {
|
|
34
43
|
statusCode: number;
|
|
35
44
|
troubleshootingUrl: string;
|
|
45
|
+
visibility: ErrorVisibility;
|
|
46
|
+
severity: Severity;
|
|
36
47
|
};
|
|
37
48
|
NOT_FOUND: {
|
|
38
49
|
statusCode: number;
|
|
39
50
|
troubleshootingUrl: string;
|
|
51
|
+
visibility: ErrorVisibility;
|
|
52
|
+
severity: Severity;
|
|
40
53
|
};
|
|
41
54
|
AGENT_NOT_FOUND: {
|
|
42
55
|
statusCode: number;
|
|
43
56
|
troubleshootingUrl: string;
|
|
57
|
+
visibility: ErrorVisibility;
|
|
58
|
+
severity: Severity;
|
|
44
59
|
};
|
|
45
60
|
API_NOT_FOUND: {
|
|
46
61
|
statusCode: number;
|
|
47
62
|
troubleshootingUrl: string;
|
|
63
|
+
visibility: ErrorVisibility;
|
|
64
|
+
severity: Severity;
|
|
48
65
|
};
|
|
49
66
|
REMOTE_ENDPOINT_NOT_FOUND: {
|
|
50
67
|
statusCode: number;
|
|
51
68
|
troubleshootingUrl: string;
|
|
69
|
+
visibility: ErrorVisibility;
|
|
70
|
+
severity: Severity;
|
|
52
71
|
};
|
|
53
72
|
MISUSE: {
|
|
54
73
|
statusCode: number;
|
|
55
74
|
troubleshootingUrl: null;
|
|
75
|
+
visibility: ErrorVisibility;
|
|
76
|
+
severity: Severity;
|
|
56
77
|
};
|
|
57
78
|
UNKNOWN: {
|
|
58
79
|
statusCode: number;
|
|
80
|
+
visibility: ErrorVisibility;
|
|
81
|
+
severity: Severity;
|
|
59
82
|
};
|
|
60
83
|
CONFIGURATION_ERROR: {
|
|
61
84
|
statusCode: number;
|
|
62
85
|
troubleshootingUrl: null;
|
|
63
86
|
severity: Severity;
|
|
87
|
+
visibility: ErrorVisibility;
|
|
64
88
|
};
|
|
65
89
|
MISSING_PUBLIC_API_KEY_ERROR: {
|
|
66
90
|
statusCode: number;
|
|
67
91
|
troubleshootingUrl: null;
|
|
68
92
|
severity: Severity;
|
|
93
|
+
visibility: ErrorVisibility;
|
|
69
94
|
};
|
|
70
95
|
UPGRADE_REQUIRED_ERROR: {
|
|
71
96
|
statusCode: number;
|
|
72
97
|
troubleshootingUrl: null;
|
|
73
98
|
severity: Severity;
|
|
99
|
+
visibility: ErrorVisibility;
|
|
74
100
|
};
|
|
75
101
|
VERSION_MISMATCH: {
|
|
76
102
|
statusCode: number;
|
|
77
103
|
troubleshootingUrl: null;
|
|
104
|
+
visibility: ErrorVisibility;
|
|
105
|
+
severity: Severity;
|
|
78
106
|
};
|
|
79
107
|
};
|
|
80
108
|
declare class CopilotKitError extends GraphQLError {
|
|
81
109
|
code: CopilotKitErrorCode;
|
|
82
110
|
statusCode: number;
|
|
83
111
|
severity?: Severity;
|
|
84
|
-
|
|
112
|
+
visibility: ErrorVisibility;
|
|
113
|
+
constructor({ message, code, severity, visibility, }: {
|
|
85
114
|
message?: string;
|
|
86
115
|
code: CopilotKitErrorCode;
|
|
87
116
|
severity?: Severity;
|
|
117
|
+
visibility?: ErrorVisibility;
|
|
88
118
|
});
|
|
89
119
|
}
|
|
90
120
|
/**
|
|
@@ -223,4 +253,4 @@ declare function getPossibleVersionMismatch({ runtimeVersion, runtimeClientGqlVe
|
|
|
223
253
|
message: string;
|
|
224
254
|
} | undefined>;
|
|
225
255
|
|
|
226
|
-
export { COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, getPossibleVersionMismatch };
|
|
256
|
+
export { 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, getPossibleVersionMismatch };
|
package/dist/utils/errors.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/utils/errors.ts
|
|
21
21
|
var errors_exports = {};
|
|
22
22
|
__export(errors_exports, {
|
|
23
|
+
BANNER_ERROR_NAMES: () => BANNER_ERROR_NAMES,
|
|
23
24
|
COPILOT_CLOUD_ERROR_NAMES: () => COPILOT_CLOUD_ERROR_NAMES,
|
|
24
25
|
ConfigurationError: () => ConfigurationError,
|
|
25
26
|
CopilotKitAgentDiscoveryError: () => CopilotKitAgentDiscoveryError,
|
|
@@ -32,6 +33,7 @@ __export(errors_exports, {
|
|
|
32
33
|
CopilotKitVersionMismatchError: () => CopilotKitVersionMismatchError,
|
|
33
34
|
ERROR_CONFIG: () => ERROR_CONFIG,
|
|
34
35
|
ERROR_NAMES: () => ERROR_NAMES,
|
|
36
|
+
ErrorVisibility: () => ErrorVisibility,
|
|
35
37
|
MissingPublicApiKeyError: () => MissingPublicApiKeyError,
|
|
36
38
|
ResolvedCopilotKitError: () => ResolvedCopilotKitError,
|
|
37
39
|
Severity: () => Severity,
|
|
@@ -42,16 +44,25 @@ module.exports = __toCommonJS(errors_exports);
|
|
|
42
44
|
var import_graphql = require("graphql");
|
|
43
45
|
|
|
44
46
|
// package.json
|
|
45
|
-
var version = "1.9.1";
|
|
47
|
+
var version = "1.9.2-next.1";
|
|
46
48
|
|
|
47
49
|
// src/index.ts
|
|
48
50
|
var COPILOTKIT_VERSION = version;
|
|
49
51
|
|
|
50
52
|
// src/utils/errors.ts
|
|
51
53
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
52
|
-
Severity2["
|
|
54
|
+
Severity2["CRITICAL"] = "critical";
|
|
55
|
+
Severity2["WARNING"] = "warning";
|
|
56
|
+
Severity2["INFO"] = "info";
|
|
53
57
|
return Severity2;
|
|
54
58
|
})(Severity || {});
|
|
59
|
+
var ErrorVisibility = /* @__PURE__ */ ((ErrorVisibility2) => {
|
|
60
|
+
ErrorVisibility2["BANNER"] = "banner";
|
|
61
|
+
ErrorVisibility2["TOAST"] = "toast";
|
|
62
|
+
ErrorVisibility2["SILENT"] = "silent";
|
|
63
|
+
ErrorVisibility2["DEV_ONLY"] = "dev_only";
|
|
64
|
+
return ErrorVisibility2;
|
|
65
|
+
})(ErrorVisibility || {});
|
|
55
66
|
var ERROR_NAMES = {
|
|
56
67
|
COPILOT_ERROR: "CopilotError",
|
|
57
68
|
COPILOT_API_DISCOVERY_ERROR: "CopilotApiDiscoveryError",
|
|
@@ -64,11 +75,15 @@ var ERROR_NAMES = {
|
|
|
64
75
|
MISSING_PUBLIC_API_KEY_ERROR: "MissingPublicApiKeyError",
|
|
65
76
|
UPGRADE_REQUIRED_ERROR: "UpgradeRequiredError"
|
|
66
77
|
};
|
|
67
|
-
var
|
|
78
|
+
var BANNER_ERROR_NAMES = [
|
|
68
79
|
ERROR_NAMES.CONFIGURATION_ERROR,
|
|
69
80
|
ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,
|
|
70
|
-
ERROR_NAMES.UPGRADE_REQUIRED_ERROR
|
|
81
|
+
ERROR_NAMES.UPGRADE_REQUIRED_ERROR,
|
|
82
|
+
ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,
|
|
83
|
+
ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,
|
|
84
|
+
ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR
|
|
71
85
|
];
|
|
86
|
+
var COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;
|
|
72
87
|
var CopilotKitErrorCode = /* @__PURE__ */ ((CopilotKitErrorCode2) => {
|
|
73
88
|
CopilotKitErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
74
89
|
CopilotKitErrorCode2["NOT_FOUND"] = "NOT_FOUND";
|
|
@@ -88,69 +103,101 @@ var getSeeMoreMarkdown = (link) => `See more: [${link}](${link})`;
|
|
|
88
103
|
var ERROR_CONFIG = {
|
|
89
104
|
["NETWORK_ERROR" /* NETWORK_ERROR */]: {
|
|
90
105
|
statusCode: 503,
|
|
91
|
-
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found
|
|
106
|
+
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,
|
|
107
|
+
visibility: "toast" /* TOAST */,
|
|
108
|
+
severity: "info" /* INFO */
|
|
92
109
|
},
|
|
93
110
|
["NOT_FOUND" /* NOT_FOUND */]: {
|
|
94
111
|
statusCode: 404,
|
|
95
|
-
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found
|
|
112
|
+
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,
|
|
113
|
+
visibility: "toast" /* TOAST */,
|
|
114
|
+
severity: "info" /* INFO */
|
|
96
115
|
},
|
|
97
116
|
["AGENT_NOT_FOUND" /* AGENT_NOT_FOUND */]: {
|
|
98
117
|
statusCode: 500,
|
|
99
|
-
troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error
|
|
118
|
+
troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,
|
|
119
|
+
visibility: "banner" /* BANNER */,
|
|
120
|
+
severity: "critical" /* CRITICAL */
|
|
100
121
|
},
|
|
101
122
|
["API_NOT_FOUND" /* API_NOT_FOUND */]: {
|
|
102
123
|
statusCode: 404,
|
|
103
|
-
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found
|
|
124
|
+
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,
|
|
125
|
+
visibility: "banner" /* BANNER */,
|
|
126
|
+
severity: "critical" /* CRITICAL */
|
|
104
127
|
},
|
|
105
128
|
["REMOTE_ENDPOINT_NOT_FOUND" /* REMOTE_ENDPOINT_NOT_FOUND */]: {
|
|
106
129
|
statusCode: 404,
|
|
107
|
-
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error
|
|
130
|
+
troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,
|
|
131
|
+
visibility: "banner" /* BANNER */,
|
|
132
|
+
severity: "critical" /* CRITICAL */
|
|
108
133
|
},
|
|
109
134
|
["MISUSE" /* MISUSE */]: {
|
|
110
135
|
statusCode: 400,
|
|
111
|
-
troubleshootingUrl: null
|
|
136
|
+
troubleshootingUrl: null,
|
|
137
|
+
visibility: "dev_only" /* DEV_ONLY */,
|
|
138
|
+
severity: "warning" /* WARNING */
|
|
112
139
|
},
|
|
113
140
|
["UNKNOWN" /* UNKNOWN */]: {
|
|
114
|
-
statusCode: 500
|
|
141
|
+
statusCode: 500,
|
|
142
|
+
visibility: "toast" /* TOAST */,
|
|
143
|
+
severity: "info" /* INFO */
|
|
115
144
|
},
|
|
116
145
|
["CONFIGURATION_ERROR" /* CONFIGURATION_ERROR */]: {
|
|
117
146
|
statusCode: 400,
|
|
118
147
|
troubleshootingUrl: null,
|
|
119
|
-
severity: "
|
|
148
|
+
severity: "warning" /* WARNING */,
|
|
149
|
+
visibility: "banner" /* BANNER */
|
|
120
150
|
},
|
|
121
151
|
["MISSING_PUBLIC_API_KEY_ERROR" /* MISSING_PUBLIC_API_KEY_ERROR */]: {
|
|
122
152
|
statusCode: 400,
|
|
123
153
|
troubleshootingUrl: null,
|
|
124
|
-
severity: "
|
|
154
|
+
severity: "critical" /* CRITICAL */,
|
|
155
|
+
visibility: "banner" /* BANNER */
|
|
125
156
|
},
|
|
126
157
|
["UPGRADE_REQUIRED_ERROR" /* UPGRADE_REQUIRED_ERROR */]: {
|
|
127
158
|
statusCode: 402,
|
|
128
159
|
troubleshootingUrl: null,
|
|
129
|
-
severity: "
|
|
160
|
+
severity: "warning" /* WARNING */,
|
|
161
|
+
visibility: "banner" /* BANNER */
|
|
130
162
|
},
|
|
131
163
|
["VERSION_MISMATCH" /* VERSION_MISMATCH */]: {
|
|
132
164
|
statusCode: 400,
|
|
133
|
-
troubleshootingUrl: null
|
|
165
|
+
troubleshootingUrl: null,
|
|
166
|
+
visibility: "dev_only" /* DEV_ONLY */,
|
|
167
|
+
severity: "info" /* INFO */
|
|
134
168
|
}
|
|
135
169
|
};
|
|
136
170
|
var CopilotKitError = class extends import_graphql.GraphQLError {
|
|
137
171
|
constructor({
|
|
138
172
|
message = "Unknown error occurred",
|
|
139
173
|
code,
|
|
140
|
-
severity
|
|
174
|
+
severity,
|
|
175
|
+
visibility
|
|
141
176
|
}) {
|
|
142
177
|
const name = ERROR_NAMES.COPILOT_ERROR;
|
|
143
|
-
const
|
|
178
|
+
const config = ERROR_CONFIG[code];
|
|
179
|
+
const { statusCode } = config;
|
|
180
|
+
const resolvedVisibility = visibility ?? config.visibility ?? "toast" /* TOAST */;
|
|
181
|
+
const resolvedSeverity = severity ?? ("severity" in config ? config.severity : void 0);
|
|
144
182
|
super(message, {
|
|
145
183
|
extensions: {
|
|
146
184
|
name,
|
|
147
|
-
statusCode
|
|
185
|
+
statusCode,
|
|
186
|
+
code,
|
|
187
|
+
visibility: resolvedVisibility,
|
|
188
|
+
severity: resolvedSeverity,
|
|
189
|
+
troubleshootingUrl: "troubleshootingUrl" in config ? config.troubleshootingUrl : null,
|
|
190
|
+
originalError: {
|
|
191
|
+
message,
|
|
192
|
+
stack: new Error().stack
|
|
193
|
+
}
|
|
148
194
|
}
|
|
149
195
|
});
|
|
150
196
|
this.code = code;
|
|
151
197
|
this.name = name;
|
|
152
198
|
this.statusCode = statusCode;
|
|
153
|
-
this.severity =
|
|
199
|
+
this.severity = resolvedSeverity;
|
|
200
|
+
this.visibility = resolvedVisibility;
|
|
154
201
|
}
|
|
155
202
|
};
|
|
156
203
|
var CopilotKitMisuseError = class extends CopilotKitError {
|
|
@@ -270,7 +317,7 @@ var ResolvedCopilotKitError = class extends CopilotKitError {
|
|
|
270
317
|
throw isRemoteEndpoint ? new CopilotKitRemoteEndpointDiscoveryError({ message, url }) : new CopilotKitApiDiscoveryError({ message, url });
|
|
271
318
|
default:
|
|
272
319
|
resolvedCode = "UNKNOWN" /* UNKNOWN */;
|
|
273
|
-
super({ message, code: resolvedCode });
|
|
320
|
+
super({ message, code: resolvedCode, visibility: "banner" /* BANNER */ });
|
|
274
321
|
}
|
|
275
322
|
} else {
|
|
276
323
|
super({ message, code: resolvedCode });
|
|
@@ -282,21 +329,21 @@ var ConfigurationError = class extends CopilotKitError {
|
|
|
282
329
|
constructor(message) {
|
|
283
330
|
super({ message, code: "CONFIGURATION_ERROR" /* CONFIGURATION_ERROR */ });
|
|
284
331
|
this.name = ERROR_NAMES.CONFIGURATION_ERROR;
|
|
285
|
-
this.severity = "
|
|
332
|
+
this.severity = "warning" /* WARNING */;
|
|
286
333
|
}
|
|
287
334
|
};
|
|
288
335
|
var MissingPublicApiKeyError = class extends ConfigurationError {
|
|
289
336
|
constructor(message) {
|
|
290
337
|
super(message);
|
|
291
338
|
this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;
|
|
292
|
-
this.severity = "
|
|
339
|
+
this.severity = "critical" /* CRITICAL */;
|
|
293
340
|
}
|
|
294
341
|
};
|
|
295
342
|
var UpgradeRequiredError = class extends ConfigurationError {
|
|
296
343
|
constructor(message) {
|
|
297
344
|
super(message);
|
|
298
345
|
this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;
|
|
299
|
-
this.severity = "
|
|
346
|
+
this.severity = "warning" /* WARNING */;
|
|
300
347
|
}
|
|
301
348
|
};
|
|
302
349
|
async function getPossibleVersionMismatch({
|
|
@@ -358,6 +405,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
358
405
|
};
|
|
359
406
|
// Annotate the CommonJS export names for ESM import in node:
|
|
360
407
|
0 && (module.exports = {
|
|
408
|
+
BANNER_ERROR_NAMES,
|
|
361
409
|
COPILOT_CLOUD_ERROR_NAMES,
|
|
362
410
|
ConfigurationError,
|
|
363
411
|
CopilotKitAgentDiscoveryError,
|
|
@@ -370,6 +418,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
370
418
|
CopilotKitVersionMismatchError,
|
|
371
419
|
ERROR_CONFIG,
|
|
372
420
|
ERROR_NAMES,
|
|
421
|
+
ErrorVisibility,
|
|
373
422
|
MissingPublicApiKeyError,
|
|
374
423
|
ResolvedCopilotKitError,
|
|
375
424
|
Severity,
|