UNPKG

@copilotkit/shared

Version:

<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />

50 lines (48 loc) 4.94 kB
import { copyToClipboard } from "./utils/clipboard.mjs"; import { executeConditions } from "./utils/conditions.mjs"; import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs"; 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"; import { actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.mjs"; import { RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE } from "./utils/types.mjs"; import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.mjs"; import { readBody } from "./utils/requests.mjs"; import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.mjs"; 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"; import { lambdaClient, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.mjs"; import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs"; import { resolveDebugConfig } from "./debug.mjs"; import { schemaToJsonSchema } from "./standard-schema.mjs"; import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs"; import { logger } from "./logger.mjs"; import { finalizeRunEvents } from "./finalize-events.mjs"; import { TranscriptionErrorCode, TranscriptionErrors } from "./transcription-errors.mjs"; import { version } from "./package.mjs"; import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES } from "./a2ui-prompts.mjs"; //#region src/index.ts const COPILOTKIT_VERSION = version; /** * Client-safe license context factory, driven by the license status the * runtime reports via /info. * * Features are enabled unless the runtime definitively reports the license * as "expired" or "invalid". A null/"none"/"unknown" status fails open * (unlicensed = unrestricted, with branding), and "expiring" keeps features * on while the provider surfaces a warning banner. Per-feature data is not * in /info yet, so checkFeature is uniform across features and getLimit has * no limits to report. This is inlined here to avoid importing the full * license-verifier bundle (which depends on Node's `crypto`) into browser * bundles. */ function createLicenseContextValue(status) { const resolvedStatus = status ?? null; const featuresEnabled = resolvedStatus !== "expired" && resolvedStatus !== "invalid"; return { status: resolvedStatus, license: null, checkFeature: () => featuresEnabled, getLimit: () => null }; } //#endregion 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, lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseAndWarnTelemetryId, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap }; //# sourceMappingURL=index.mjs.map