@copilotkit/shared
Advanced tools
| import { describe, it, expect } from "vitest"; | ||
| import { createLicenseContextValue } from "../index"; | ||
| import type { RuntimeLicenseStatus } from "../utils/types"; | ||
| describe("createLicenseContextValue", () => { | ||
| it("fails open when no status is known", () => { | ||
| for (const status of [null, undefined] as const) { | ||
| const ctx = createLicenseContextValue(status); | ||
| expect(ctx.status).toBeNull(); | ||
| expect(ctx.license).toBeNull(); | ||
| expect(ctx.checkFeature("chat")).toBe(true); | ||
| expect(ctx.getLimit("chat")).toBeNull(); | ||
| } | ||
| }); | ||
| it.each(["valid", "none", "expiring", "unknown"] as RuntimeLicenseStatus[])( | ||
| "enables features for %s status", | ||
| (status) => { | ||
| const ctx = createLicenseContextValue(status); | ||
| expect(ctx.status).toBe(status); | ||
| expect(ctx.checkFeature("chat")).toBe(true); | ||
| }, | ||
| ); | ||
| it.each(["expired", "invalid"] as RuntimeLicenseStatus[])( | ||
| "disables features for %s status", | ||
| (status) => { | ||
| const ctx = createLicenseContextValue(status); | ||
| expect(ctx.status).toBe(status); | ||
| expect(ctx.checkFeature("chat")).toBe(false); | ||
| }, | ||
| ); | ||
| }); |
+14
-7
@@ -26,14 +26,21 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| /** | ||
| * Client-safe license context factory. | ||
| * Client-safe license context factory, driven by the license status the | ||
| * runtime reports via /info. | ||
| * | ||
| * When status is null (no token provided), all features return true | ||
| * (unlicensed = unrestricted, with branding). This is inlined here to | ||
| * avoid importing the full license-verifier bundle (which depends on | ||
| * Node's `crypto`) into browser bundles. | ||
| * 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: null, | ||
| status: resolvedStatus, | ||
| license: null, | ||
| checkFeature: () => true, | ||
| checkFeature: () => featuresEnabled, | ||
| getLimit: () => null | ||
@@ -40,0 +47,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./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 {\n LicenseStatus,\n LicensePayload,\n} from \"@copilotkit/license-verifier\";\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 /** The resolved license status after verification. Null if no token provided. */\n status: LicenseStatus | null;\n /** Convenience: the license payload if valid, null otherwise. */\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.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa;;;;;;;;;AAgDb,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"} | ||
| {"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"} |
+15
-15
@@ -28,3 +28,3 @@ import { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from "./types/openai-assistant.cjs"; | ||
| import { DebugEventEnvelope } from "./debug-event-envelope.cjs"; | ||
| import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseStatus as LicenseStatus$1, LicenseTier } from "@copilotkit/license-verifier"; | ||
| import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier"; | ||
@@ -38,5 +38,5 @@ //#region src/index.d.ts | ||
| interface LicenseContextValue { | ||
| /** The resolved license status after verification. Null if no token provided. */ | ||
| status: LicenseStatus$1 | null; | ||
| /** Convenience: the license payload if valid, null otherwise. */ | ||
| /** Server-reported license status from the runtime's /info endpoint. Null until known. */ | ||
| status: RuntimeLicenseStatus | null; | ||
| /** The license payload if available. Always null on the client; the payload stays server-side. */ | ||
| license: LicensePayload$1 | null; | ||
@@ -49,17 +49,17 @@ /** Whether a specific feature is licensed. Returns true if no licensing is active (no token). */ | ||
| /** | ||
| * Client-safe license context factory. | ||
| * Client-safe license context factory, driven by the license status the | ||
| * runtime reports via /info. | ||
| * | ||
| * When status is null (no token provided), all features return true | ||
| * (unlicensed = unrestricted, with branding). This is inlined here to | ||
| * avoid importing the full license-verifier bundle (which depends on | ||
| * Node's `crypto`) into browser bundles. | ||
| * 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. | ||
| */ | ||
| declare function createLicenseContextValue(status: null): { | ||
| status: null; | ||
| license: null; | ||
| checkFeature: (feature: string) => boolean; | ||
| getLimit: (feature: string) => number | null; | ||
| }; | ||
| declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined): LicenseContextValue; | ||
| //#endregion | ||
| export { A2UIRuntimeInfo, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseAndWarnTelemetryId, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap }; | ||
| //# sourceMappingURL=index.d.cts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;UA6BI,mBAAA;;EAEf,MAAA,EAAQ,eAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;AArCb;;;;;iBAgDgB,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"} | ||
| {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;UA2BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;AAnCb;;;;;AA2BA;;;;;;iBAwBgB,yBAAA,CACd,MAAA,EAAQ,oBAAA,sBACP,mBAAA"} |
+15
-15
@@ -29,3 +29,3 @@ import { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from "./types/openai-assistant.mjs"; | ||
| import { DebugEventEnvelope } from "./debug-event-envelope.mjs"; | ||
| import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseStatus as LicenseStatus$1, LicenseTier } from "@copilotkit/license-verifier"; | ||
| import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier"; | ||
@@ -39,5 +39,5 @@ //#region src/index.d.ts | ||
| interface LicenseContextValue { | ||
| /** The resolved license status after verification. Null if no token provided. */ | ||
| status: LicenseStatus$1 | null; | ||
| /** Convenience: the license payload if valid, null otherwise. */ | ||
| /** Server-reported license status from the runtime's /info endpoint. Null until known. */ | ||
| status: RuntimeLicenseStatus | null; | ||
| /** The license payload if available. Always null on the client; the payload stays server-side. */ | ||
| license: LicensePayload$1 | null; | ||
@@ -50,17 +50,17 @@ /** Whether a specific feature is licensed. Returns true if no licensing is active (no token). */ | ||
| /** | ||
| * Client-safe license context factory. | ||
| * Client-safe license context factory, driven by the license status the | ||
| * runtime reports via /info. | ||
| * | ||
| * When status is null (no token provided), all features return true | ||
| * (unlicensed = unrestricted, with branding). This is inlined here to | ||
| * avoid importing the full license-verifier bundle (which depends on | ||
| * Node's `crypto`) into browser bundles. | ||
| * 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. | ||
| */ | ||
| declare function createLicenseContextValue(status: null): { | ||
| status: null; | ||
| license: null; | ||
| checkFeature: (feature: string) => boolean; | ||
| getLimit: (feature: string) => number | null; | ||
| }; | ||
| declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined): LicenseContextValue; | ||
| //#endregion | ||
| export { A2UIRuntimeInfo, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseAndWarnTelemetryId, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap }; | ||
| //# sourceMappingURL=index.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;UA6BI,mBAAA;;EAEf,MAAA,EAAQ,eAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;;AArCb;;;;iBAgDgB,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"} | ||
| {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;UA2BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;AAnCb;;;;;AA2BA;;;;;iBAwBgB,yBAAA,CACd,MAAA,EAAQ,oBAAA,sBACP,mBAAA"} |
+14
-7
@@ -25,14 +25,21 @@ import { copyToClipboard } from "./utils/clipboard.mjs"; | ||
| /** | ||
| * Client-safe license context factory. | ||
| * Client-safe license context factory, driven by the license status the | ||
| * runtime reports via /info. | ||
| * | ||
| * When status is null (no token provided), all features return true | ||
| * (unlicensed = unrestricted, with branding). This is inlined here to | ||
| * avoid importing the full license-verifier bundle (which depends on | ||
| * Node's `crypto`) into browser bundles. | ||
| * 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: null, | ||
| status: resolvedStatus, | ||
| license: null, | ||
| checkFeature: () => true, | ||
| checkFeature: () => featuresEnabled, | ||
| getLimit: () => null | ||
@@ -39,0 +46,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type {\n LicenseStatus,\n LicensePayload,\n} from \"@copilotkit/license-verifier\";\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 /** The resolved license status after verification. Null if no token provided. */\n status: LicenseStatus | null;\n /** Convenience: the license payload if valid, null otherwise. */\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.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa,qBAAqBA;;;;;;;;;AAgDlC,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"} | ||
| {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n 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,qBAAqBA;;;;;;;;;;;;;;AAmDlC,SAAgB,0BACd,QACqB;CACrB,MAAM,iBAAiB,UAAU;CACjC,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AACrD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"} |
+1
-1
| //#region package.json | ||
| var version = "1.61.1"; | ||
| var version = "1.61.2"; | ||
@@ -5,0 +5,0 @@ //#endregion |
+1
-1
| //#region package.json | ||
| var version = "1.61.1"; | ||
| var version = "1.61.2"; | ||
@@ -4,0 +4,0 @@ //#endregion |
+1
-1
| { | ||
| "name": "@copilotkit/shared", | ||
| "version": "1.61.1", | ||
| "version": "1.61.2", | ||
| "private": false, | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+23
-20
@@ -35,6 +35,4 @@ export * from "./types"; | ||
| import type { | ||
| LicenseStatus, | ||
| LicensePayload, | ||
| } from "@copilotkit/license-verifier"; | ||
| import type { LicensePayload } from "@copilotkit/license-verifier"; | ||
| import type { RuntimeLicenseStatus } from "./utils/types"; | ||
@@ -50,5 +48,5 @@ // LicenseContextValue was dropped from license-verifier's public API in | ||
| export interface LicenseContextValue { | ||
| /** The resolved license status after verification. Null if no token provided. */ | ||
| status: LicenseStatus | null; | ||
| /** Convenience: the license payload if valid, null otherwise. */ | ||
| /** Server-reported license status from the runtime's /info endpoint. Null until known. */ | ||
| status: RuntimeLicenseStatus | null; | ||
| /** The license payload if available. Always null on the client; the payload stays server-side. */ | ||
| license: LicensePayload | null; | ||
@@ -62,19 +60,24 @@ /** Whether a specific feature is licensed. Returns true if no licensing is active (no token). */ | ||
| /** | ||
| * Client-safe license context factory. | ||
| * Client-safe license context factory, driven by the license status the | ||
| * runtime reports via /info. | ||
| * | ||
| * When status is null (no token provided), all features return true | ||
| * (unlicensed = unrestricted, with branding). This is inlined here to | ||
| * avoid importing the full license-verifier bundle (which depends on | ||
| * Node's `crypto`) into browser bundles. | ||
| * 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. | ||
| */ | ||
| export function createLicenseContextValue(status: null): { | ||
| status: null; | ||
| license: null; | ||
| checkFeature: (feature: string) => boolean; | ||
| getLimit: (feature: string) => number | null; | ||
| } { | ||
| export function createLicenseContextValue( | ||
| status: RuntimeLicenseStatus | null | undefined, | ||
| ): LicenseContextValue { | ||
| const resolvedStatus = status ?? null; | ||
| const featuresEnabled = | ||
| resolvedStatus !== "expired" && resolvedStatus !== "invalid"; | ||
| return { | ||
| status: null, | ||
| status: resolvedStatus, | ||
| license: null, | ||
| checkFeature: () => true, | ||
| checkFeature: () => featuresEnabled, | ||
| getLimit: () => null, | ||
@@ -81,0 +84,0 @@ }; |
-21
| The MIT License | ||
| Copyright (c) Atai Barkai | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
945438
0.47%10434
0.52%