@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;" />
1 lines • 3.7 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type { RuntimeLicenseStatus } from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Server-reported license status from the runtime's /info endpoint. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a specific feature is licensed. Returns true if no licensing is active (no token). */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Returns null if not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/**\n * Client-safe license context factory, driven by the license status the\n * runtime reports via /info.\n *\n * Features are enabled unless the runtime definitively reports the license\n * as \"expired\" or \"invalid\". A null/\"none\"/\"unknown\" status fails open\n * (unlicensed = unrestricted, with branding), and \"expiring\" keeps features\n * on while the provider surfaces a warning banner. Per-feature data is not\n * in /info yet, so checkFeature is uniform across features and getLimit has\n * no limits to report. This is inlined here to avoid importing the full\n * license-verifier bundle (which depends on Node's `crypto`) into browser\n * bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n): LicenseContextValue {\n const resolvedStatus = status ?? null;\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: () => featuresEnabled,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa;;;;;;;;;;;;;;AAmDb,SAAgB,0BACd,QACqB;CACrB,MAAM,iBAAiB,UAAU;CACjC,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AACrD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}