@copilotkit/shared 1.66.2 → 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +53 -0
  2. package/dist/index.cjs +2 -0
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +2 -1
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +2 -1
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +2 -1
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/index.umd.js +149 -4
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/package.cjs +1 -1
  13. package/dist/package.mjs +1 -1
  14. package/dist/utils/index.cjs +3 -2
  15. package/dist/utils/index.cjs.map +1 -1
  16. package/dist/utils/index.d.cts +1 -0
  17. package/dist/utils/index.d.cts.map +1 -1
  18. package/dist/utils/index.d.mts +1 -0
  19. package/dist/utils/index.d.mts.map +1 -1
  20. package/dist/utils/index.mjs +3 -2
  21. package/dist/utils/index.mjs.map +1 -1
  22. package/dist/utils/inspector-metadata.cjs +147 -0
  23. package/dist/utils/inspector-metadata.cjs.map +1 -0
  24. package/dist/utils/inspector-metadata.d.cts +55 -0
  25. package/dist/utils/inspector-metadata.d.cts.map +1 -0
  26. package/dist/utils/inspector-metadata.d.mts +55 -0
  27. package/dist/utils/inspector-metadata.d.mts.map +1 -0
  28. package/dist/utils/inspector-metadata.mjs +146 -0
  29. package/dist/utils/inspector-metadata.mjs.map +1 -0
  30. package/dist/utils/types.cjs.map +1 -1
  31. package/dist/utils/types.d.cts +2 -0
  32. package/dist/utils/types.d.cts.map +1 -1
  33. package/dist/utils/types.d.mts +2 -0
  34. package/dist/utils/types.d.mts.map +1 -1
  35. package/dist/utils/types.mjs.map +1 -1
  36. package/package.json +1 -1
  37. package/src/utils/index.ts +3 -2
  38. package/src/utils/inspector-metadata.test.ts +742 -0
  39. package/src/utils/inspector-metadata.ts +273 -0
  40. package/src/utils/types.ts +2 -0
package/README.md CHANGED
@@ -142,6 +142,59 @@ const response = await ChatOpenAI({ model: "gpt-4o" }).invoke(
142
142
  </a>
143
143
  </p>
144
144
 
145
+ ## Trusted Inspector metadata
146
+
147
+ `@copilotkit/shared` exports the versioned `InspectorMetadataV1` contract and
148
+ `parseInspectorMetadataV1()` parser. A Copilot Runtime can use this contract to
149
+ send project and license context to the Inspector:
150
+
151
+ ```ts
152
+ interface InspectorMetadataV1 {
153
+ readonly schemaVersion: 1;
154
+ readonly identity?: {
155
+ readonly organizationName: string;
156
+ readonly projectName: string;
157
+ };
158
+ readonly plan?: { readonly code: string; readonly label: string };
159
+ readonly license?: {
160
+ readonly state: "valid" | "none" | "expired" | "unknown";
161
+ };
162
+ readonly action?:
163
+ | { readonly kind: "manage_plan"; readonly url: string }
164
+ | { readonly kind: "renew"; readonly url: string }
165
+ | { readonly kind: "enable_intelligence"; readonly url: string };
166
+ readonly usage?: {
167
+ readonly used: number;
168
+ readonly limit:
169
+ | { readonly kind: "finite"; readonly value: number }
170
+ | { readonly kind: "unlimited" }
171
+ | { readonly kind: "unknown" };
172
+ readonly expiringSoonCount?: number;
173
+ };
174
+ }
175
+ ```
176
+
177
+ Every optional module is independent. The parser drops an invalid `identity`,
178
+ `plan`, `license`, `action`, or `usage` module without hiding valid sibling
179
+ modules. It returns `undefined` when the top-level value is not a plain object
180
+ with `schemaVersion: 1`.
181
+
182
+ Action URLs are treated as trusted navigation only after parsing. They must use
183
+ HTTPS, or HTTP on `localhost`, `127.0.0.1`, or `[::1]`; URLs with credentials, a
184
+ query string, or a fragment are rejected. Consumers use the accepted URL as
185
+ supplied and must not derive a destination from identity or plan values.
186
+
187
+ The optional `usage.expiringSoonCount` field lets V1 producers report a known
188
+ count. Older producers may omit it; absence remains valid V1 usage, while `0`
189
+ is a known count and stays distinct from absence. The parser drops a malformed,
190
+ inherited, or accessor-backed expiry leaf without removing `used`, `limit`, or
191
+ valid sibling modules. Older V1 consumers ignore the additive field, so
192
+ producers and consumers do not need a V2 schema or lock-step deployment.
193
+
194
+ `RuntimeInfo.inspectorMetadata?: boolean` is the capability signal. Clients only
195
+ request the optional metadata route when a runtime reports
196
+ `inspectorMetadata: true` in its runtime-info response.
197
+
145
198
  # Documentation
146
199
 
147
200
  To get started with CopilotKit, please check out the [documentation](https://docs.copilotkit.ai).
package/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@ const require_conditions = require('./utils/conditions.cjs');
4
4
  const require_console_styling = require('./utils/console-styling.cjs');
5
5
  const require_errors = require('./utils/errors.cjs');
6
6
  const require_json_schema = require('./utils/json-schema.cjs');
7
+ const require_inspector_metadata = require('./utils/inspector-metadata.cjs');
7
8
  const require_types = require('./utils/types.cjs');
8
9
  const require_random_id = require('./utils/random-id.cjs');
9
10
  const require_requests = require('./utils/requests.cjs');
@@ -108,6 +109,7 @@ exports.logStyled = require_console_styling.logStyled;
108
109
  exports.logger = require_logger.logger;
109
110
  exports.matchesAcceptFilter = require_utils.matchesAcceptFilter;
110
111
  exports.parseAndWarnTelemetryId = require_lambda_client.parseAndWarnTelemetryId;
112
+ exports.parseInspectorMetadataV1 = require_inspector_metadata.parseInspectorMetadataV1;
111
113
  exports.parseJson = require_index.parseJson;
112
114
  exports.parseTelemetryIdFromLicense = require_lambda_client.parseTelemetryIdFromLicense;
113
115
  exports.partialJSONParse = require_index.partialJSONParse;
@@ -1 +1 @@
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 { 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"}
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 { 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"}
package/dist/index.d.cts CHANGED
@@ -9,6 +9,7 @@ import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, Existenc
9
9
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.cjs";
10
10
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.cjs";
11
11
  import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.cjs";
12
+ import { InspectorMetadataV1, parseInspectorMetadataV1 } from "./utils/inspector-metadata.cjs";
12
13
  import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo } from "./utils/types.cjs";
13
14
  import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.cjs";
14
15
  import { readBody } from "./utils/requests.cjs";
@@ -58,5 +59,5 @@ interface LicenseContextValue {
58
59
  */
59
60
  declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined): LicenseContextValue;
60
61
  //#endregion
61
- 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 };
62
+ 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, InspectorMetadataV1, 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, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
62
63
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"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"}
1
+ {"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"}
package/dist/index.d.mts CHANGED
@@ -9,6 +9,7 @@ import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, Existenc
9
9
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
10
10
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.mjs";
11
11
  import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.mjs";
12
+ import { InspectorMetadataV1, parseInspectorMetadataV1 } from "./utils/inspector-metadata.mjs";
12
13
  import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo } from "./utils/types.mjs";
13
14
  import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.mjs";
14
15
  import { readBody } from "./utils/requests.mjs";
@@ -59,5 +60,5 @@ interface LicenseContextValue {
59
60
  */
60
61
  declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined): LicenseContextValue;
61
62
  //#endregion
62
- 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 };
63
+ 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, InspectorMetadataV1, 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, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
63
64
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"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"}
1
+ {"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"}
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ import { executeConditions } from "./utils/conditions.mjs";
3
3
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
4
4
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.mjs";
5
5
  import { actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.mjs";
6
+ import { parseInspectorMetadataV1 } from "./utils/inspector-metadata.mjs";
6
7
  import { RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE } from "./utils/types.mjs";
7
8
  import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.mjs";
8
9
  import { readBody } from "./utils/requests.mjs";
@@ -46,5 +47,5 @@ function createLicenseContextValue(status) {
46
47
  }
47
48
 
48
49
  //#endregion
49
- 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 };
50
+ 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, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
50
51
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./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
+ {"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"}
package/dist/index.umd.js CHANGED
@@ -797,6 +797,150 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
797
797
  return convertJsonSchemaToZodSchema(actionParametersToJsonSchema(parameters), true);
798
798
  }
799
799
 
800
+ //#endregion
801
+ //#region src/utils/inspector-metadata.ts
802
+ function isRecord(value) {
803
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
804
+ try {
805
+ const prototype = Object.getPrototypeOf(value);
806
+ return prototype === Object.prototype || prototype === null;
807
+ } catch (_unused) {
808
+ return false;
809
+ }
810
+ }
811
+ function readOwnDataProperty(value, key) {
812
+ try {
813
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
814
+ return descriptor !== void 0 && "value" in descriptor ? descriptor.value : void 0;
815
+ } catch (_unused2) {
816
+ return;
817
+ }
818
+ }
819
+ function parseNonBlankString(value) {
820
+ if (typeof value !== "string") return;
821
+ const parsed = value.trim();
822
+ return parsed.length > 0 ? parsed : void 0;
823
+ }
824
+ function parseIdentity(value) {
825
+ if (!isRecord(value)) return;
826
+ const organizationName = parseNonBlankString(value.organizationName);
827
+ const projectName = parseNonBlankString(value.projectName);
828
+ if (organizationName === void 0 || projectName === void 0) return;
829
+ return {
830
+ organizationName,
831
+ projectName
832
+ };
833
+ }
834
+ function parsePlan(value) {
835
+ if (!isRecord(value)) return;
836
+ const code = parseNonBlankString(value.code);
837
+ const label = parseNonBlankString(value.label);
838
+ if (code === void 0 || label === void 0) return;
839
+ return {
840
+ code,
841
+ label
842
+ };
843
+ }
844
+ function parseLicense(value) {
845
+ if (!isRecord(value)) return;
846
+ switch (value.state) {
847
+ case "valid":
848
+ case "none":
849
+ case "expired":
850
+ case "unknown": return { state: value.state };
851
+ default: return;
852
+ }
853
+ }
854
+ function parseActionKind(value) {
855
+ switch (value) {
856
+ case "manage_plan":
857
+ case "renew":
858
+ case "enable_intelligence": return value;
859
+ default: return;
860
+ }
861
+ }
862
+ function parseSafeActionUrl(value) {
863
+ const url = parseNonBlankString(value);
864
+ if (url === void 0 || url.includes("?") || url.includes("#")) return;
865
+ const authorityStart = url.indexOf("://");
866
+ if (authorityStart < 1) return;
867
+ const authorityAndPath = url.slice(authorityStart + 3);
868
+ const pathStart = authorityAndPath.indexOf("/");
869
+ if ((pathStart === -1 ? authorityAndPath : authorityAndPath.slice(0, pathStart)).includes("@")) return;
870
+ let parsed;
871
+ try {
872
+ parsed = new URL(url);
873
+ } catch (_unused3) {
874
+ return;
875
+ }
876
+ if (parsed.hostname.length === 0 || parsed.username || parsed.password) return;
877
+ if (parsed.protocol === "https:") return url;
878
+ const isLoopbackHost = parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1" || parsed.hostname === "[::1]";
879
+ if (parsed.protocol === "http:" && isLoopbackHost) return url;
880
+ }
881
+ function parseAction(value) {
882
+ if (!isRecord(value)) return;
883
+ const kind = parseActionKind(value.kind);
884
+ const url = parseSafeActionUrl(value.url);
885
+ if (kind === void 0 || url === void 0) return;
886
+ return {
887
+ kind,
888
+ url
889
+ };
890
+ }
891
+ function isFiniteNonnegativeInteger(value) {
892
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
893
+ }
894
+ function parseUsageLimit(value) {
895
+ if (!isRecord(value)) return;
896
+ if (value.kind === "finite") {
897
+ if (typeof value.value !== "number" || !Number.isSafeInteger(value.value) || value.value < 1) return;
898
+ return {
899
+ kind: "finite",
900
+ value: value.value
901
+ };
902
+ }
903
+ if (value.kind === "unlimited") return { kind: "unlimited" };
904
+ if (value.kind === "unknown") return { kind: "unknown" };
905
+ }
906
+ function parseUsage(value) {
907
+ if (!isRecord(value)) return;
908
+ const limit = parseUsageLimit(value.limit);
909
+ const used = value.used;
910
+ if (!isFiniteNonnegativeInteger(used) || limit === void 0) return;
911
+ const rawExpiringSoonCount = readOwnDataProperty(value, "expiringSoonCount");
912
+ const expiringSoonCount = isFiniteNonnegativeInteger(rawExpiringSoonCount) ? rawExpiringSoonCount : void 0;
913
+ return {
914
+ used,
915
+ limit,
916
+ ...expiringSoonCount === void 0 ? {} : { expiringSoonCount }
917
+ };
918
+ }
919
+ /**
920
+ * Parses untrusted inspector metadata without letting one invalid optional
921
+ * module hide the other valid modules.
922
+ *
923
+ * @param value - The decoded runtime response body.
924
+ * @returns Normalized version 1 metadata, or `undefined` for an unsupported
925
+ * top-level payload.
926
+ */
927
+ function parseInspectorMetadataV1(value) {
928
+ if (!isRecord(value) || value.schemaVersion !== 1) return;
929
+ const identity = parseIdentity(value.identity);
930
+ const plan = parsePlan(value.plan);
931
+ const license = parseLicense(value.license);
932
+ const action = parseAction(value.action);
933
+ const usage = parseUsage(value.usage);
934
+ return {
935
+ schemaVersion: 1,
936
+ ...identity === void 0 ? {} : { identity },
937
+ ...plan === void 0 ? {} : { plan },
938
+ ...license === void 0 ? {} : { license },
939
+ ...action === void 0 ? {} : { action },
940
+ ...usage === void 0 ? {} : { usage }
941
+ };
942
+ }
943
+
800
944
  //#endregion
801
945
  //#region src/utils/types.ts
802
946
  const RUNTIME_MODE_SSE = "sse";
@@ -899,7 +1043,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
899
1043
  function parseJson(json, fallback = "unset") {
900
1044
  try {
901
1045
  return JSON.parse(json);
902
- } catch (e) {
1046
+ } catch (_unused) {
903
1047
  return fallback === "unset" ? null : fallback;
904
1048
  }
905
1049
  }
@@ -912,7 +1056,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
912
1056
  const parsed = partial_json.parse(json);
913
1057
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
914
1058
  return {};
915
- } catch (error) {
1059
+ } catch (_unused2) {
916
1060
  return {};
917
1061
  }
918
1062
  }
@@ -963,7 +1107,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
963
1107
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
964
1108
  console.warn(`[CopilotKit] Tool arguments parsed to non-object (${typeof parsed}), falling back to empty object`);
965
1109
  return {};
966
- } catch (_unused) {
1110
+ } catch (_unused3) {
967
1111
  console.warn("[CopilotKit] Failed to parse tool arguments, falling back to empty object");
968
1112
  return {};
969
1113
  }
@@ -1532,7 +1676,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
1532
1676
 
1533
1677
  //#endregion
1534
1678
  //#region package.json
1535
- var version = "1.66.2";
1679
+ var version = "1.67.0";
1536
1680
 
1537
1681
  //#endregion
1538
1682
  //#region src/a2ui-prompts.ts
@@ -1739,6 +1883,7 @@ exports.logStyled = logStyled;
1739
1883
  exports.logger = logger;
1740
1884
  exports.matchesAcceptFilter = matchesAcceptFilter;
1741
1885
  exports.parseAndWarnTelemetryId = parseAndWarnTelemetryId;
1886
+ exports.parseInspectorMetadataV1 = parseInspectorMetadataV1;
1742
1887
  exports.parseJson = parseJson;
1743
1888
  exports.parseTelemetryIdFromLicense = parseTelemetryIdFromLicense;
1744
1889
  exports.partialJSONParse = partialJSONParse;