@copilotkit/shared 1.57.2 → 1.57.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +97 -32
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/telemetry/index.d.mts +2 -1
- package/dist/telemetry/lambda-client.cjs +70 -0
- package/dist/telemetry/lambda-client.cjs.map +1 -0
- package/dist/telemetry/lambda-client.d.cts +18 -0
- package/dist/telemetry/lambda-client.d.cts.map +1 -0
- package/dist/telemetry/lambda-client.d.mts +18 -0
- package/dist/telemetry/lambda-client.d.mts.map +1 -0
- package/dist/telemetry/lambda-client.mjs +67 -0
- package/dist/telemetry/lambda-client.mjs.map +1 -0
- package/dist/telemetry/telemetry-client.cjs +29 -10
- package/dist/telemetry/telemetry-client.cjs.map +1 -1
- package/dist/telemetry/telemetry-client.d.cts +3 -0
- package/dist/telemetry/telemetry-client.d.cts.map +1 -1
- package/dist/telemetry/telemetry-client.d.mts +3 -0
- package/dist/telemetry/telemetry-client.d.mts.map +1 -1
- package/dist/telemetry/telemetry-client.mjs +29 -10
- package/dist/telemetry/telemetry-client.mjs.map +1 -1
- package/package.json +1 -1
- package/src/telemetry/index.ts +6 -0
- package/src/telemetry/lambda-client.test.ts +111 -0
- package/src/telemetry/lambda-client.ts +153 -0
- package/src/telemetry/telemetry-client.test.ts +289 -0
- package/src/telemetry/telemetry-client.ts +67 -15
- package/dist/telemetry/scarf-client.cjs +0 -29
- package/dist/telemetry/scarf-client.cjs.map +0 -1
- package/dist/telemetry/scarf-client.mjs +0 -29
- package/dist/telemetry/scarf-client.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const require_random_id = require('./utils/random-id.cjs');
|
|
|
9
9
|
const require_requests = require('./utils/requests.cjs');
|
|
10
10
|
const require_index = require('./utils/index.cjs');
|
|
11
11
|
const require_index$1 = require('./constants/index.cjs');
|
|
12
|
-
const
|
|
12
|
+
const require_lambda_client = require('./telemetry/lambda-client.cjs');
|
|
13
13
|
const require_telemetry_client = require('./telemetry/telemetry-client.cjs');
|
|
14
14
|
const require_debug = require('./debug.cjs');
|
|
15
15
|
const require_standard_schema = require('./standard-schema.cjs');
|
|
@@ -17,6 +17,7 @@ const require_utils = require('./attachments/utils.cjs');
|
|
|
17
17
|
const require_logger = require('./logger.cjs');
|
|
18
18
|
const require_finalize_events = require('./finalize-events.cjs');
|
|
19
19
|
const require_transcription_errors = require('./transcription-errors.cjs');
|
|
20
|
+
const require_package = require('./package.cjs');
|
|
20
21
|
const require_a2ui_prompts = require('./a2ui-prompts.cjs');
|
|
21
22
|
|
|
22
23
|
//#region src/index.ts
|
|
@@ -94,11 +95,14 @@ exports.isStructuredCopilotKitError = require_errors.isStructuredCopilotKitError
|
|
|
94
95
|
exports.isTelemetryDisabled = require_telemetry_client.isTelemetryDisabled;
|
|
95
96
|
exports.isValidUUID = require_random_id.isValidUUID;
|
|
96
97
|
exports.jsonSchemaToActionParameters = require_json_schema.jsonSchemaToActionParameters;
|
|
98
|
+
exports.lambdaClient = require_lambda_client;
|
|
97
99
|
exports.logCopilotKitPlatformMessage = require_console_styling.logCopilotKitPlatformMessage;
|
|
98
100
|
exports.logStyled = require_console_styling.logStyled;
|
|
99
101
|
exports.logger = require_logger.logger;
|
|
100
102
|
exports.matchesAcceptFilter = require_utils.matchesAcceptFilter;
|
|
103
|
+
exports.parseAndWarnTelemetryId = require_lambda_client.parseAndWarnTelemetryId;
|
|
101
104
|
exports.parseJson = require_index.parseJson;
|
|
105
|
+
exports.parseTelemetryIdFromLicense = require_lambda_client.parseTelemetryIdFromLicense;
|
|
102
106
|
exports.partialJSONParse = require_index.partialJSONParse;
|
|
103
107
|
exports.phoenixExponentialBackoff = require_index.phoenixExponentialBackoff;
|
|
104
108
|
exports.publicApiKeyRequired = require_console_styling.publicApiKeyRequired;
|
package/dist/index.cjs.map
CHANGED
|
@@ -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 LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\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":"
|
|
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 LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\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;;;;;;;;;AA0Bb,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -15,6 +15,7 @@ import { readBody } from "./utils/requests.cjs";
|
|
|
15
15
|
import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.cjs";
|
|
16
16
|
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.cjs";
|
|
17
17
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.cjs";
|
|
18
|
+
import { LambdaSendOptions, _default, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.cjs";
|
|
18
19
|
import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.cjs";
|
|
19
20
|
import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.cjs";
|
|
20
21
|
import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.cjs";
|
|
@@ -43,5 +44,5 @@ declare function createLicenseContextValue(status: null): {
|
|
|
43
44
|
getLimit: (feature: string) => number | null;
|
|
44
45
|
};
|
|
45
46
|
//#endregion
|
|
46
|
-
export { 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, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, 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, 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, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
47
|
+
export { 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, type LicenseContextValue, type LicenseFeatures, type LicenseMode, 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, 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, _default as lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseAndWarnTelemetryId, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
47
48
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;;;;;iBA0BG,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,7 @@ import { readBody } from "./utils/requests.mjs";
|
|
|
15
15
|
import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.mjs";
|
|
16
16
|
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";
|
|
17
17
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
18
|
+
import { LambdaSendOptions, _default, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.mjs";
|
|
18
19
|
import "./telemetry/index.mjs";
|
|
19
20
|
import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.mjs";
|
|
20
21
|
import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.mjs";
|
|
@@ -44,5 +45,5 @@ declare function createLicenseContextValue(status: null): {
|
|
|
44
45
|
getLimit: (feature: string) => number | null;
|
|
45
46
|
};
|
|
46
47
|
//#endregion
|
|
47
|
-
export { 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, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, 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, 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, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
48
|
+
export { 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, type LicenseContextValue, type LicenseFeatures, type LicenseMode, 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, 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, _default as lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseAndWarnTelemetryId, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
48
49
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;;;;;iBA0BG,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id
|
|
|
8
8
|
import { readBody } from "./utils/requests.mjs";
|
|
9
9
|
import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.mjs";
|
|
10
10
|
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";
|
|
11
|
-
import {
|
|
11
|
+
import lambda_client_default, { parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.mjs";
|
|
12
12
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
13
13
|
import { resolveDebugConfig } from "./debug.mjs";
|
|
14
14
|
import { schemaToJsonSchema } from "./standard-schema.mjs";
|
|
@@ -16,6 +16,7 @@ import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon
|
|
|
16
16
|
import { logger } from "./logger.mjs";
|
|
17
17
|
import { finalizeRunEvents } from "./finalize-events.mjs";
|
|
18
18
|
import { TranscriptionErrorCode, TranscriptionErrors } from "./transcription-errors.mjs";
|
|
19
|
+
import { version } from "./package.mjs";
|
|
19
20
|
import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES } from "./a2ui-prompts.mjs";
|
|
20
21
|
|
|
21
22
|
//#region src/index.ts
|
|
@@ -38,5 +39,5 @@ function createLicenseContextValue(status) {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
//#endregion
|
|
41
|
-
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, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
42
|
+
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, lambda_client_default as lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseAndWarnTelemetryId, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
42
43
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -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 LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\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":"
|
|
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 LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\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;;;;;;;;;AA0BlC,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}
|
package/dist/index.umd.js
CHANGED
|
@@ -991,33 +991,71 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
991
991
|
}
|
|
992
992
|
|
|
993
993
|
//#endregion
|
|
994
|
-
//#region
|
|
995
|
-
var
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
994
|
+
//#region src/telemetry/lambda-client.ts
|
|
995
|
+
var _process$env;
|
|
996
|
+
const TELEMETRY_SINK_URL = typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.COPILOTKIT_TELEMETRY_URL) || "https://telemetry.copilotkit.ai/ingest";
|
|
997
|
+
const FETCH_TIMEOUT_MS = 3e3;
|
|
998
|
+
const STRIPPED_KEYS = new Set(["cloud.public_api_key", "cloud.publicApiKey"]);
|
|
999
|
+
function stripCloudKeys(obj) {
|
|
1000
|
+
if (!obj) return {};
|
|
1001
|
+
const out = {};
|
|
1002
|
+
for (const [k, v] of Object.entries(obj)) if (!STRIPPED_KEYS.has(k)) out[k] = v;
|
|
1003
|
+
return out;
|
|
1004
|
+
}
|
|
1005
|
+
function parseTelemetryIdFromLicense(token) {
|
|
1006
|
+
if (!token) return null;
|
|
1007
|
+
const parts = token.split(".");
|
|
1008
|
+
if (parts.length !== 3) return null;
|
|
1009
|
+
try {
|
|
1010
|
+
let b64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
1011
|
+
const padding = (4 - b64.length % 4) % 4;
|
|
1012
|
+
b64 += "=".repeat(padding);
|
|
1013
|
+
const json = typeof atob === "function" ? atob(b64) : Buffer.from(b64, "base64").toString("utf8");
|
|
1014
|
+
const decoded = JSON.parse(json);
|
|
1015
|
+
return typeof decoded.telemetry_id === "string" ? decoded.telemetry_id : null;
|
|
1016
|
+
} catch (_unused) {
|
|
1017
|
+
return null;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
function parseAndWarnTelemetryId(licenseToken) {
|
|
1021
|
+
const telemetryId = parseTelemetryIdFromLicense(licenseToken);
|
|
1022
|
+
if (!telemetryId) console.warn("[CopilotKit] License token did not yield a telemetry_id; telemetry events will be sent anonymously.");
|
|
1023
|
+
return telemetryId;
|
|
1024
|
+
}
|
|
1025
|
+
async function send(opts) {
|
|
1026
|
+
try {
|
|
1027
|
+
var _opts$packageVersion;
|
|
1028
|
+
const body = JSON.stringify({
|
|
1029
|
+
event: opts.event,
|
|
1030
|
+
properties: stripCloudKeys(opts.properties),
|
|
1031
|
+
global_properties: stripCloudKeys(opts.globalProperties),
|
|
1032
|
+
package: {
|
|
1033
|
+
name: opts.packageName,
|
|
1034
|
+
version: opts.packageVersion
|
|
1035
|
+
},
|
|
1036
|
+
ts: Math.floor(Date.now() / 1e3)
|
|
1037
|
+
});
|
|
1038
|
+
const telemetryId = parseTelemetryIdFromLicense(opts.licenseToken);
|
|
1039
|
+
const headers = {
|
|
1040
|
+
"Content-Type": "application/json",
|
|
1041
|
+
"User-Agent": opts.packageName ? `CopilotKit-Runtime/${(_opts$packageVersion = opts.packageVersion) !== null && _opts$packageVersion !== void 0 ? _opts$packageVersion : "unknown"} (${opts.packageName})` : "CopilotKit-Runtime"
|
|
1042
|
+
};
|
|
1043
|
+
if (telemetryId) headers["X-CopilotKit-Telemetry-Id"] = telemetryId;
|
|
1044
|
+
const controller = new AbortController();
|
|
1045
|
+
const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
1003
1046
|
try {
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
if (value !== null && value !== void 0) queryParams.append(key, String(value));
|
|
1009
|
-
});
|
|
1010
|
-
const url = `${SCARF_BASE_URL}?${queryParams.toString()}`;
|
|
1011
|
-
const response = await fetch(url, {
|
|
1012
|
-
method: "GET",
|
|
1047
|
+
await fetch(TELEMETRY_SINK_URL, {
|
|
1048
|
+
method: "POST",
|
|
1049
|
+
headers,
|
|
1050
|
+
body,
|
|
1013
1051
|
signal: controller.signal
|
|
1014
1052
|
});
|
|
1053
|
+
} finally {
|
|
1015
1054
|
clearTimeout(timeoutId);
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
};
|
|
1020
|
-
var scarf_client_default = new ScarfClient();
|
|
1055
|
+
}
|
|
1056
|
+
} catch (_unused2) {}
|
|
1057
|
+
}
|
|
1058
|
+
var lambda_client_default = { send };
|
|
1021
1059
|
|
|
1022
1060
|
//#endregion
|
|
1023
1061
|
//#region src/telemetry/telemetry-client.ts
|
|
@@ -1034,6 +1072,8 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
1034
1072
|
constructor({ packageName, packageVersion, telemetryDisabled, telemetryBaseUrl, sampleRate }) {
|
|
1035
1073
|
this.globalProperties = {};
|
|
1036
1074
|
this.cloudConfiguration = null;
|
|
1075
|
+
this.licenseToken = null;
|
|
1076
|
+
this.telemetryId = null;
|
|
1037
1077
|
this.telemetryDisabled = false;
|
|
1038
1078
|
this.sampleRate = .05;
|
|
1039
1079
|
this.anonymousId = `anon_${(0, uuid.v4)()}`;
|
|
@@ -1052,22 +1092,41 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
1052
1092
|
return Math.random() < this.sampleRate;
|
|
1053
1093
|
}
|
|
1054
1094
|
async capture(event, properties) {
|
|
1055
|
-
|
|
1095
|
+
var _this$licenseToken;
|
|
1096
|
+
if (this.telemetryDisabled) return;
|
|
1097
|
+
if (!this.telemetryId && !this.shouldSendEvent()) return;
|
|
1098
|
+
const effectiveSampleRate = this.telemetryId ? 1 : this.sampleRate;
|
|
1099
|
+
const samplingMeta = {
|
|
1100
|
+
sampleRate: effectiveSampleRate,
|
|
1101
|
+
sampleRateAdjustmentFactor: 1 - effectiveSampleRate,
|
|
1102
|
+
sampleWeight: 1 / effectiveSampleRate
|
|
1103
|
+
};
|
|
1056
1104
|
const flattenedProperties = flattenObject(properties);
|
|
1057
1105
|
const propertiesWithGlobal = {
|
|
1058
1106
|
...this.globalProperties,
|
|
1107
|
+
...samplingMeta,
|
|
1059
1108
|
...flattenedProperties
|
|
1060
1109
|
};
|
|
1061
1110
|
const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal).sort().reduce((obj, key) => {
|
|
1062
1111
|
obj[key] = propertiesWithGlobal[key];
|
|
1063
1112
|
return obj;
|
|
1064
1113
|
}, {});
|
|
1065
|
-
|
|
1114
|
+
await lambda_client_default.send({
|
|
1115
|
+
event,
|
|
1116
|
+
properties: flattenedProperties,
|
|
1117
|
+
globalProperties: {
|
|
1118
|
+
...this.globalProperties,
|
|
1119
|
+
...samplingMeta
|
|
1120
|
+
},
|
|
1121
|
+
packageName: this.packageName,
|
|
1122
|
+
packageVersion: this.packageVersion,
|
|
1123
|
+
licenseToken: (_this$licenseToken = this.licenseToken) !== null && _this$licenseToken !== void 0 ? _this$licenseToken : void 0
|
|
1124
|
+
});
|
|
1125
|
+
if (this.segment) this.segment.track({
|
|
1066
1126
|
anonymousId: this.anonymousId,
|
|
1067
1127
|
event,
|
|
1068
1128
|
properties: { ...orderedPropertiesWithGlobal }
|
|
1069
1129
|
});
|
|
1070
|
-
await scarf_client_default.logEvent({ event });
|
|
1071
1130
|
}
|
|
1072
1131
|
setGlobalProperties(properties) {
|
|
1073
1132
|
const flattenedProperties = flattenObject(properties);
|
|
@@ -1083,17 +1142,16 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
1083
1142
|
baseUrl: properties.baseUrl
|
|
1084
1143
|
} });
|
|
1085
1144
|
}
|
|
1145
|
+
setLicenseToken(licenseToken) {
|
|
1146
|
+
this.licenseToken = licenseToken;
|
|
1147
|
+
this.telemetryId = parseAndWarnTelemetryId(licenseToken);
|
|
1148
|
+
}
|
|
1086
1149
|
setSampleRate(sampleRate) {
|
|
1087
1150
|
let _sampleRate;
|
|
1088
1151
|
_sampleRate = sampleRate !== null && sampleRate !== void 0 ? sampleRate : .05;
|
|
1089
1152
|
if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);
|
|
1090
|
-
if (_sampleRate < 0 || _sampleRate > 1) throw new Error("Sample rate must be between 0 and 1");
|
|
1153
|
+
if (Number.isNaN(_sampleRate) || _sampleRate < 0 || _sampleRate > 1) throw new Error("Sample rate must be between 0 and 1");
|
|
1091
1154
|
this.sampleRate = _sampleRate;
|
|
1092
|
-
this.setGlobalProperties({
|
|
1093
|
-
sampleRate: this.sampleRate,
|
|
1094
|
-
sampleRateAdjustmentFactor: 1 - this.sampleRate,
|
|
1095
|
-
sampleWeight: 1 / this.sampleRate
|
|
1096
|
-
});
|
|
1097
1155
|
}
|
|
1098
1156
|
};
|
|
1099
1157
|
|
|
@@ -1474,6 +1532,10 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
1474
1532
|
})
|
|
1475
1533
|
};
|
|
1476
1534
|
|
|
1535
|
+
//#endregion
|
|
1536
|
+
//#region package.json
|
|
1537
|
+
var version = "1.57.4";
|
|
1538
|
+
|
|
1477
1539
|
//#endregion
|
|
1478
1540
|
//#region src/a2ui-prompts.ts
|
|
1479
1541
|
/**
|
|
@@ -1666,11 +1728,14 @@ exports.isStructuredCopilotKitError = isStructuredCopilotKitError;
|
|
|
1666
1728
|
exports.isTelemetryDisabled = isTelemetryDisabled;
|
|
1667
1729
|
exports.isValidUUID = isValidUUID;
|
|
1668
1730
|
exports.jsonSchemaToActionParameters = jsonSchemaToActionParameters;
|
|
1731
|
+
exports.lambdaClient = lambda_client_default;
|
|
1669
1732
|
exports.logCopilotKitPlatformMessage = logCopilotKitPlatformMessage;
|
|
1670
1733
|
exports.logStyled = logStyled;
|
|
1671
1734
|
exports.logger = logger;
|
|
1672
1735
|
exports.matchesAcceptFilter = matchesAcceptFilter;
|
|
1736
|
+
exports.parseAndWarnTelemetryId = parseAndWarnTelemetryId;
|
|
1673
1737
|
exports.parseJson = parseJson;
|
|
1738
|
+
exports.parseTelemetryIdFromLicense = parseTelemetryIdFromLicense;
|
|
1674
1739
|
exports.partialJSONParse = partialJSONParse;
|
|
1675
1740
|
exports.phoenixExponentialBackoff = phoenixExponentialBackoff;
|
|
1676
1741
|
exports.publicApiKeyRequired = publicApiKeyRequired;
|